17,105
edits
mNo edit summary |
mNo edit summary |
||
Line 30: | Line 30: | ||
end | end | ||
local | local firstItem = Items.getItemByID(itemList[1]) | ||
local isWeaponType = firstItem.validSlots ~= nil and Shared.contains(firstItem.validSlots, 'Weapon') and Shared.contains(weaponTypes, firstItem.type) | |||
--Now that we have a preliminary list, let's figure out which columns are irrelevant (IE are zero for all items in the selection) | --Now that we have a preliminary list, let's figure out which columns are irrelevant (IE are zero for all items in the selection) | ||
local ignoreColumns = Shared.clone(statColumns) | local ignoreColumns = Shared.clone(statColumns) | ||
for i, | for i, itemID in pairs(itemList) do | ||
local ndx = 1 | local ndx = 1 | ||
while Shared.tableCount(ignoreColumns) >= ndx do | while Shared.tableCount(ignoreColumns) >= ndx do | ||
if Items._getItemStat( | if Items._getItemStat(ItemData.Items[itemID], ignoreColumns[ndx], true) ~= 0 then | ||
table.remove(ignoreColumns, ndx) | table.remove(ignoreColumns, ndx) | ||
else | else | ||
Line 171: | Line 173: | ||
table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|Sources') | table.insert(resultPart, '\r\n!style="padding:0 1em 0 0.5em;"|Sources') | ||
table.sort(itemList, function(a, b) return a | table.sort(itemList, function(a, b) return a < b end) | ||
for i, | for i, itemID in pairs(itemList) do | ||
local item = ItemData.Items[itemID] | |||
if isWeaponType then | if isWeaponType then | ||
--Building rows for weapons | --Building rows for weapons | ||
Line 270: | Line 273: | ||
--Now we need to figure out which items are in this list | --Now we need to figure out which items are in this list | ||
local itemList = {} | local itemList = {} | ||
for i, | for i, item in pairs(ItemData.Items) do | ||
local listItem = false | local listItem = false | ||
if isWeaponType then | if isWeaponType then | ||
Line 292: | Line 293: | ||
end | end | ||
if listItem then | if listItem then | ||
table.insert(itemList, item) | table.insert(itemList, item.id) | ||
end | end | ||
end | end | ||
Line 346: | Line 347: | ||
return isMatch | return isMatch | ||
end) | end, true) | ||
return p._getEquipmentTable(itemList, includeModifiers, includeDescription) | return p._getEquipmentTable(itemList, includeModifiers, includeDescription) | ||
Line 380: | Line 381: | ||
hasErr = true | hasErr = true | ||
else | else | ||
table.insert(itemList, nextItem) | table.insert(itemList, nextItem.id) | ||
end | end | ||
end | end |