Module:Items/ComparisonTables: Difference between revisions

getEquipmentTable: Remove unused function (then following this, ItemData is also unused)
(Exclude Golbin raid exclusive equipment (for now))
(getEquipmentTable: Remove unused function (then following this, ItemData is also unused))
Line 1: Line 1:
local p = {}
local p = {}
local ItemData = mw.loadData('Module:Items/data')


local Constants = require('Module:Constants')
local Constants = require('Module:Constants')
Line 237: Line 235:


return table.concat(resultPart)
return table.concat(resultPart)
end
function p.getEquipmentTable(frame)
local args = frame.args ~= nil and frame.args or frame
local type = args.type
local tier = args.tier
local slot = args.slot
local ammoTypeStr = args.ammoType
local category = args.category ~= nil and args.category or 'Combat'
--Find out what Ammo Type we're working with
local ammoType = nil
if ammoTypeStr ~= nil then
if ammoTypeStr == "Arrows" then
ammoType = 0
elseif ammoTypeStr == 'Bolts' then
ammoType = 1
elseif ammoTypeStr == 'Javelins' then
ammoType = 2
elseif ammoTypeStr == 'Throwing Knives' then
ammoType = 3
end
end
local isWeaponType = Shared.contains(weaponTypes, type)
--Now we need to figure out which items are in this list
local itemList = {}
for i, itemBase in pairs(ItemData.Items) do
local item = Shared.clone(itemBase)
item.id = i - 1
local listItem = false
if isWeaponType then
listItem = item.type == type and item.category == category
if ammoType ~= nil then listItem = listItem and item.ammoTypeRequired == ammoType end
else
--Now for handling armour
if type == "Armour" or type == "Melee" then
listItem = Items._getItemStat(item, 'defenceLevelRequired') ~= nil or (item.category == 'Combat' and item.type == 'Armour')
elseif type == "Ranged Armour" or type == "Ranged" then
listItem = Items._getItemStat(item, 'rangedLevelRequired') ~= nil or (item.category == 'Combat' and item.type == 'Ranged Armour')
elseif type == "Magic Armour" or type == "Magic" then
listItem = Items._getItemStat(item, 'magicLevelRequired') or (item.category == 'Combat' and item.type == 'Magic Armour')
else
listItem = item.type == type and item.category ~= 'Combat'
end
if ammoType ~= nil then listItem = listItem and item.ammoType == ammoType end
if slot ~= nil then listItem = listItem and Shared.contains(item.validSlots, slot) end
end
if listItem then
table.insert(itemList, item)
end
end
local result = p._getEquipmentTable(itemList).."[[Category:getEquipmentTable]]"
return result
end
end