Module:Items: Difference between revisions

152 bytes removed ,  6 January 2022
Amend indentation
(Add to event items list)
(Amend indentation)
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},
["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
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},
['Mining Gloves'] = {cost=75000, charges=500},
              ['Smithing Gloves'] = {cost=100000, charges=500},
['Smithing Gloves'] = {cost=100000, charges=500},
              ['Thieving Gloves'] = {cost=100000, charges=500},
['Thieving Gloves'] = {cost=100000, charges=500},
              ['Gem Gloves'] = {cost=500000, charges=2000}}
['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(name == itemName) then
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]
result = item.equipRequirements.Level[skillID]
end
end
end
end
Line 172: Line 172:
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]
result = subVal[2]
  break
break
end
end
end
end
Line 208: Line 208:
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
if string.upper(asString) == 'FALSE' then
asString = (string.upper(asString) ~= 'FALSE')
asString = false
else
asString = true
end
end
end


Line 225: Line 221:
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 and Shared.contains(item.occupiesSlots, 'Weapon')) then
(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 366:
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]]')
table.insert(resultPart, '[[Category:Double Loot Chance Items]]')
  break
break
end
end
end
end
Line 421: Line 417:
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
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'}))
table.insert(spAttTable[spAtt.id].Icons, Icons.Icon({item.name, type='item'}))
end
end
end
end