17,030
edits
(Remove unreferenced vars) |
(_getItemStat: Add backwards compatibility for isTwoHanded & LevelRequirement stats) |
||
Line 17: | Line 17: | ||
p.OtherShopItems = {'Cooking Gloves', 'Mining Gloves', 'Gem Gloves', 'Smithing Gloves', 'Thieving Gloves'} | p.OtherShopItems = {'Cooking Gloves', 'Mining Gloves', 'Gem Gloves', 'Smithing Gloves', 'Thieving Gloves'} | ||
--This is hardcoded, so there's no easy way to scrape it. Hopefully it doesn't change | --This is hardcoded, so there's no easy way to scrape it. Hopefully it doesn't change | ||
p.GemTable = {["Topaz"] = {name = 'Topaz', id = 128, chance = 50}, | p.GemTable = {["Topaz"] = {name = 'Topaz', id = 128, chance = 50}, | ||
["Sapphire"] = {name = "Sapphire", id = 129, chance = 17.5}, | ["Sapphire"] = {name = "Sapphire", id = 129, chance = 17.5}, | ||
["Ruby"] = {name = "Ruby", id = 130, chance = 17.5}, | ["Ruby"] = {name = "Ruby", id = 130, chance = 17.5}, | ||
["Emerald"] = {name = "Emerald", id = 131, chance = 10}, | ["Emerald"] = {name = "Emerald", id = 131, chance = 10}, | ||
["Diamond"] = {name = "Diamond", id = 132, chance = 5}} | ["Diamond"] = {name = "Diamond", id = 132, chance = 5}} | ||
--The base chance to receive a gem while mining | --The base chance to receive a gem while mining | ||
Line 130: | Line 130: | ||
local equipStats = p._processEquipmentStats(item.equipmentStats) | local equipStats = p._processEquipmentStats(item.equipmentStats) | ||
result = equipStats[StatName] | result = equipStats[StatName] | ||
elseif StatName == 'isTwoHanded' then | |||
if item.validSlots ~= nil and item.occupiesSlots ~= nil then | |||
return Shared.contains(item.validSlots, 'Weapon') and Shared.contains(item.occupiesSlots, 'Shield') | |||
else | |||
return false | |||
end | |||
elseif string.find(StatName, '^(.+)LevelRequired$') ~= nil then | |||
local skillName = Shared.titleCase(string.match(StatName, '^(.+)LevelRequired$')) | |||
local skillID = Constants.getSkillID(skillName) | |||
for i, req in pairs(item.equipRequirements) do | |||
if req.type == 'Level' then | |||
for j, levelReq in pairs(req.levels) do | |||
if levelReq.skill == skillID then | |||
result = levelReq.level | |||
break | |||
end | |||
end | |||
if result ~= nil then break end | |||
end | |||
end | |||
elseif StatName == 'attackType' then | elseif StatName == 'attackType' then | ||
result = p._getWeaponAttackType(item) | result = p._getWeaponAttackType(item) | ||
Line 313: | Line 333: | ||
local item = p.getItem(itemName) | local item = p.getItem(itemName) | ||
local asList = false | local asList = false | ||
if frame.args ~= nil then | if frame.args ~= nil then | ||
asList = frame.args.asList ~= nil and frame.args.asList ~= '' and frame.args.asList ~= 'false' | asList = frame.args.asList ~= nil and frame.args.asList ~= '' and frame.args.asList ~= 'false' | ||
end | end | ||
Line 395: | Line 415: | ||
function p.getSpecialAttackTable(frame) | function p.getSpecialAttackTable(frame) | ||
local spAttTable = {} | local spAttTable = {} | ||
for i, item in Shared.skpairs(ItemData.Items) do | for i, item in Shared.skpairs(ItemData.Items) do | ||
if item.hasSpecialAttack then | if item.hasSpecialAttack then | ||
Line 404: | Line 424: | ||
end | end | ||
end | end | ||
end | end | ||
local result = '{|class="wikitable sortable stickyHeader"' | local result = '{|class="wikitable sortable stickyHeader"' |