4,951
edits
Falterfire (talk | contribs) (Fixed indenting) |
Falterfire (talk | contribs) (Added a check for level requirements to the 'hasCombatStats' check for autoarmourstats just to be safe) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 18: | Line 18: | ||
'Event Clue 3', 'Event Clue 4', 'Candle', 'Cake Base', | 'Event Clue 3', 'Event Clue 4', 'Candle', 'Cake Base', | ||
'Magical Flavouring', 'Magical Icing', 'Birthday Cake', | 'Magical Flavouring', 'Magical Icing', 'Birthday Cake', | ||
'Purple Party Hat', 'Birthday Token'} | 'Purple Party Hat', 'Birthday Token', 'Christmas Present (Yellow)', | ||
'Christmas Present (Blue)', 'Christmas Present (Green)', 'Christmas Present (White)', | |||
'Christmas Present (Purple)', 'Christmas Present (Standard)', 'Event Token - Holiday 2021', | |||
'Holiday Scarf', 'Gingerbread House', 'Gingerbread Man', 'Edible Candy Cane', | |||
'Locked Chest', 'Locked Chest Key', 'Event Token (Holiday 2021)'} | |||
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}, | |||
["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 34: | 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 77: | 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 116: | 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 132: | 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 168: | 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 196: | 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 204: | 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 221: | 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 270: | Line 286: | ||
--For equipment, show the slot they go in | --For equipment, show the slot they go in | ||
if item.validSlots ~= nil then | if item.validSlots ~= nil then | ||
table.insert(resultPart, "\r\n|-\r\n|'''Equipment Slot:''' "..table.concat( | local slotLinkMap = { | ||
["Helmet"] = 'Equipment#Helmets', | |||
["Platebody"] = 'Equipment#Platebodies', | |||
["Boots"] = 'Equipment#Boots', | |||
["Weapon"] = 'Equipment#Weapons', | |||
["Shield"] = 'Equipment#Offhand', | |||
["Amulet"] = 'Equipment#Amulets', | |||
["Ring"] = 'Equipment#Rings', | |||
["Gloves"] = 'Equipment#Gloves', | |||
["Quiver"] = 'Equipment#Ammunition', | |||
["Cape"] = 'Equipment#Capes', | |||
["Passive"] = 'Combat Passive Slot', | |||
["Summon1"] = 'Summoning', | |||
["Summon2"] = 'Summoning' | |||
} | |||
local slotText = {} | |||
for i, slot in ipairs(item.validSlots) do | |||
local slotLink = slotLinkMap[slot] | |||
if slotLink == nil then | |||
table.insert(slotText, slot) | |||
else | |||
table.insert(slotText, '[[' .. slotLink .. '|' .. slot .. ']]') | |||
end | |||
end | |||
table.insert(resultPart, "\r\n|-\r\n|'''Equipment Slot:''' "..table.concat(slotText, ', ')) | |||
end | end | ||
--For weapons with a special attack, show the details | --For weapons with a special attack, show the details | ||
Line 342: | 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 393: | 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 |