4,951
edits
(Add to event items list) |
Falterfire (talk | contribs) (Added a check for level requirements to the 'hasCombatStats' check for autoarmourstats just to be safe) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 26: | Line 26: | ||
--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}, | |||
["Ruby"] = {name = "Ruby", id = 130, chance = 17.5}, | |||
["Emerald"] = {name = "Emerald", id = 131, chance = 10}, | |||
["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 | ||
p.GemChance = .01 | p.GemChance = .01 | ||
Line 38: | Line 38: | ||
--The kinds of gloves with cost & charges | --The kinds of gloves with cost & charges | ||
p.GloveTable = {['Cooking Gloves'] = {cost=50000, charges=500}, | p.GloveTable = {['Cooking Gloves'] = {cost=50000, charges=500}, | ||
['Mining Gloves'] = {cost=75000, charges=500}, | |||
['Smithing Gloves'] = {cost=100000, charges=500}, | |||
['Thieving Gloves'] = {cost=100000, charges=500}, | |||
['Gem Gloves'] = {cost=500000, charges=2000}} | |||
Line 81: | Line 81: | ||
for i, item in pairs(ItemData.Items) do | for i, item in pairs(ItemData.Items) do | ||
local itemName = string.gsub(item.name, '#', '') | local itemName = string.gsub(item.name, '#', '') | ||
if | if name == itemName then | ||
result = Shared.clone(item) | result = Shared.clone(item) | ||
--Make sure every item has an id, and account for Lua being 1-index | --Make sure every item has an id, and account for Lua being 1-index | ||
Line 120: | Line 120: | ||
local skillID = Constants.getSkillID(skillName) | local skillID = Constants.getSkillID(skillName) | ||
if skillID ~= nil then | if skillID ~= nil then | ||
result = item.equipRequirements.Level[skillID] | |||
end | end | ||
end | end | ||
Line 136: | Line 136: | ||
elseif StatName == 'slayerBonusXP' then | elseif StatName == 'slayerBonusXP' then | ||
return p._getItemModifier(item, 'increasedSkillXP', 'Slayer', false) | return p._getItemModifier(item, 'increasedSkillXP', 'Slayer', false) | ||
elseif StatName == 'hasCombatStats' then | |||
return tostring(p.hasCombatStats(item) or p._hasLevelRequirements(item)) | |||
end | end | ||
if result == nil and ZeroIfNil then result = 0 end | if result == nil and ZeroIfNil then result = 0 end | ||
Line 172: | Line 174: | ||
for i, subVal in Shared.skpairs(item.modifiers[modifier]) do | for i, subVal in Shared.skpairs(item.modifiers[modifier]) do | ||
if subVal[1] == skill then | if subVal[1] == skill then | ||
result = subVal[2] | |||
break | |||
end | end | ||
end | end | ||
Line 200: | Line 202: | ||
end | end | ||
return false | return false | ||
end | |||
function p._hasLevelRequirements(item) | |||
--Function true if an item has at least one level requirement to equip | |||
if item.equipRequirements ~= nil and item.equipRequirements.Level ~= nil then | |||
for skillID, lvl in pairs(item.equipRequirements.Level) do | |||
if lvl ~= nil and lvl > 1 then | |||
return true | |||
end | |||
end | |||
return false | |||
else | |||
return false | |||
end | |||
end | end | ||
Line 208: | Line 224: | ||
local asString = frame.args ~= nil and frame.args[4] or frame[4] | local asString = frame.args ~= nil and frame.args[4] or frame[4] | ||
if asString ~= nil then | if asString ~= nil then | ||
asString = (string.upper(asString) ~= 'FALSE') | |||
end | end | ||
Line 225: | Line 237: | ||
function p._getWeaponAttackType(item) | function p._getWeaponAttackType(item) | ||
if item.isEquipment == true and (item.validSlots ~= nil and Shared.contains(item.validSlots, 'Weapon')) or | if item.isEquipment == true and (item.validSlots ~= nil and Shared.contains(item.validSlots, 'Weapon')) or | ||
(item.occupiesSlots ~= nil | (item.occupiesSlots ~= nil and Shared.contains(item.occupiesSlots, 'Weapon')) then | ||
if Shared.contains({'melee', 'ranged', 'magic'}, item.attackType) then | if Shared.contains({'melee', 'ranged', 'magic'}, item.attackType) then | ||
local iconType = item.attackType ~= 'melee' and 'skill' or nil | local iconType = item.attackType ~= 'melee' and 'skill' or nil | ||
Line 370: | Line 382: | ||
for modName, val in pairs(item.modifiers) do | for modName, val in pairs(item.modifiers) do | ||
if Shared.contains(modsDL, modName) then | if Shared.contains(modsDL, modName) then | ||
table.insert(resultPart, '[[Category:Double Loot Chance Items]]') | |||
break | |||
end | end | ||
end | end | ||
Line 421: | Line 433: | ||
if item.hasSpecialAttack then | if item.hasSpecialAttack then | ||
for i, spAtt in ipairs(item.specialAttacks) do | for i, spAtt in ipairs(item.specialAttacks) do | ||
if spAttTable[spAtt.id] == nil then spAttTable[spAtt.id] = {sortName=item.name, defn = spAtt, Icons = {}} end | |||
table.insert(spAttTable[spAtt.id].Icons, Icons.Icon({item.name, type='item'})) | |||
end | end | ||
end | end |