Module:Items/ComparisonTables: Difference between revisions

Remove getDoubleLootTable, now using modifier tables instead
m (Fix attack speed handling)
(Remove getDoubleLootTable, now using modifier tables instead)
Line 468: Line 468:
return p.getEquipmentTable(itemList)
return p.getEquipmentTable(itemList)
end
end
end
function p.getDoubleLootTable(frame)
local modsDL = {
["id"] = {
'melvorD:doubleItemsSkill',
'melvorD:doubleItemsChanceAgainstDamageType'
},
["alias"] = {
'increasedChanceToDoubleLootCombat',
'decreasedChanceToDoubleLootCombat',
'increasedChanceToDoubleItemsGlobal',
'decreasedChanceToDoubleItemsGlobal'
}
}
local matchCriteria = Modifiers.getMatchCriteriaFromIDs(modsDL.id, modsDL.alias)
local itemMatchedMods = {}
local itemList = Items.getItems(
function(item)
if item.modifiers ~= nil then
local matchedMods = Modifiers.getMatchingModifiers(item.modifiers, matchCriteria)
if Shared.tableIsEmpty(matchedMods.matched) then
return false
else
itemMatchedMods[item.id] = matchedMods.matched
return true
end
end
end
)
local resultPart = {}
table.insert(resultPart, '{| class="wikitable sortable stickyHeader"\r\n|-class="headerRow-0"')
table.insert(resultPart, '\r\n!colspan="2"|Name!!Bonus!!Description')
for i, item in Shared.skpairs(itemList) do
local lootValue = Modifiers.getModifierValue(itemMatchedMods[item.id])
table.insert(resultPart, '\r\n|-')
table.insert(resultPart, '\r\n|data-sort-value="'..item.name..'"|'..Icons.Icon({item.name, type='item', size=50, notext=true}))
table.insert(resultPart, '||' .. Icons.getExpansionIcon(item.id) .. Icons.Icon({item.name, type='item', noicon=true}))
table.insert(resultPart, '||style ="text-align: right;" data-sort-value="'..lootValue..'"|'..lootValue..'%')
table.insert(resultPart, '||' .. getItemDesc(item))
end
table.insert(resultPart, '\r\n|}')
return table.concat(resultPart)
end
end