FANDOM


--Last known good (fixed crash on radiant items due to secondary ability 537)
--Next task - (Begin work on protection entries) or (Begin work on fusing chart function)
local p = {}
 
local items = mw.loadData( 'Module:Data/items' )
local abilities = mw.loadData( 'Module:Data/abilities' )
local slots = mw.loadData ( 'Module:Data/slots' )
local types = mw.loadData ( 'Module:Data/types' )
local skip = {}
 
function p.prottest (frame)
    --frame.args[1] should be item number
    ret = "Item "..frame.args[1]
    return ret
end
 
function p.itemlist ( frame )
    tablestart = "\<div class='tables items'\>\n{| class=\"sortable\"\n|-\n! class=\"unsortable\" |Image\n!Name\n!Rarity\n!Str\n!Con\n!Dex\n!Max Str\n!Max Con\n!Max Dex\n!Abilities\n"
    tablebody = ""
    tableend = "\n|\}</div>"
    for k,v in pairs (slots) do
        if k == frame.args[1] then targetslot = v end
    end
    for k,v in pairs (types) do
        if k == frame.args[2] then targettype = v end
    end
    for k,v in spairs( items) do
        if items[k].damage_type == targettype and items[k].slot == targetslot then
            if items[k].name == "" then name = "Item_"..k else name = items[k].name end
            tablebody = tablebody.."\n|-\n|[[File:Icon_item_"..k..".png|centre|60px|link="..name.."]]\n|[["..name.."]]\n|"..(items[k].rarity + 1).."\n|"..items[k].base_str.."\n|"..items[k].base_con.."\n|"..items[k].base_dex.."\n|"..items[k].max_str.."\n|"..items[k].max_con.."\n|"..items[k].max_dex.."\n|"
            if items[k].passive_ability ~= "1" and items[k].passive_ability ~= "0" then
                thisabil = items[k].passive_ability
                if abilities[thisabil].name == "" then lastcol = "Ability_"..thisabil else lastcol = abilities[thisabil].name end
                if items[k].secondary_passive_ability ~= "0" and items[k].secondary_passive_ability ~= "537" then 
                    thisabil = items[k].secondary_passive_ability
                    if abilities[thisabil].name == "" then lastcol = lastcol.."<br />Ability_"..thisabil else lastcol = lastcol.."<br />"..abilities[thisabil].name end
                end
                tablebody = tablebody..lastcol
            end
        end
    end
    return tablestart..tablebody..tableend
end
 
function spairs(t, order)
    local keys = {}
    for k in pairs(t) do keys[#keys+1] = k end
    if order then
        table.sort(keys, function(a,b) return order(t, a, b) end)
    else
        table.sort(keys)
    end
    local i = 0
    return function()
        i = i + 1
        if keys[i] then
            return keys[i], t[keys[i]]
        end
    end
end
function addToSet(skip, key)
    skip[key] = true
end
function removeFromSet(skip, key)
    skip[key] = nil
end
function setContains(skip, key)
    return skip[key] ~= nil
end
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.