Anonymous

Module:Items/ComparisonTables: Difference between revisions

From Melvor Idle
Add abyssal level and AR support to _getEquipmentTable; Shrunk Icons to 32px; Add DLC column
No edit summary
(Add abyssal level and AR support to _getEquipmentTable; Shrunk Icons to 32px; Add DLC column)
Line 58: Line 58:
'rangedStrengthBonus', 'magicDamageBonus', 'meleeDefenceBonus',
'rangedStrengthBonus', 'magicDamageBonus', 'meleeDefenceBonus',
'rangedDefenceBonus', 'magicDefenceBonus', 'damageReduction',
'rangedDefenceBonus', 'magicDefenceBonus', 'damageReduction',
'attackLevelRequired', 'strengthLevelRequired', 'defenceLevelRequired',
'resistance', 'attackLevelRequired', 'strengthLevelRequired',  
'rangedLevelRequired', 'magicLevelRequired'
'defenceLevelRequired', 'rangedLevelRequired', 'magicLevelRequired',
'attackAbyssalLevel', 'strengthAbyssalLevel','defenceAbyssalLevel',
'rangedAbyssalLevel', 'magicAbyssalLevel'
}
}


Line 87: Line 89:
local defBonusCols = 3
local defBonusCols = 3
local lvlReqCols = 5
local lvlReqCols = 5
local abyssalLvlReqCols = 5
local ndx = 1
local ndx = 1
while Shared.tableCount(statColumns) >= ndx do
while Shared.tableCount(statColumns) >= ndx do
Line 94: Line 97:
if Shared.contains(colName, 'trengthBonus') then strBonusCols = strBonusCols - 1 end
if Shared.contains(colName, 'trengthBonus') then strBonusCols = strBonusCols - 1 end
if Shared.contains(colName, 'efenceBonus') then defBonusCols = defBonusCols - 1 end
if Shared.contains(colName, 'efenceBonus') then defBonusCols = defBonusCols - 1 end
if Shared.contains(colName, 'AbyssalLevel') then abyssalLvlReqCols = abyssalLvlReqCols - 1 end
if Shared.contains(colName, 'LevelRequired') then lvlReqCols = lvlReqCols - 1 end
if Shared.contains(colName, 'LevelRequired') then lvlReqCols = lvlReqCols - 1 end
table.remove(statColumns, ndx)
table.remove(statColumns, ndx)
Line 106: Line 110:
if isWeaponType then
if isWeaponType then
--Weapons have extra columns here for Attack Speed and "Two Handed?"
--Weapons have extra columns here for Attack Speed and "Two Handed?"
table.insert(resultPart, '\r\n!colspan="4"|')
table.insert(resultPart, '\r\n!colspan="5"|')
else
else
table.insert(resultPart, '\r\n!colspan="2"|')
table.insert(resultPart, '\r\n!colspan="3"|')
end
end
if attBonusCols > 0 then
if attBonusCols > 0 then
Line 124: Line 128:
if Shared.contains(statColumns, 'damageReduction') then
if Shared.contains(statColumns, 'damageReduction') then
table.insert(resultPart, '\r\n!colspan="1"|DR')
table.insert(resultPart, '\r\n!colspan="1"|DR')
end
if Shared.contains(statColumns, 'resistance') then
table.insert(resultPart, '\r\n!colspan="1"|AR')
end
end
if lvlReqCols > 0 then
if lvlReqCols > 0 then
table.insert(resultPart, '\r\n!colspan="'..lvlReqCols..'"|Lvl Req')
table.insert(resultPart, '\r\n!colspan="'..lvlReqCols..'"|Lvl Req')
end
if abyssalLvlReqCols > 0 then
table.insert(resultPart, '\r\n!colspan="'..abyssalLvlReqCols..'"|A. Lvl Req')
end
end
if includeModifiers and includeDescription then
if includeModifiers and includeDescription then
Line 137: Line 147:
table.insert(resultPart, '\r\n!Item')
table.insert(resultPart, '\r\n!Item')
table.insert(resultPart, '\r\n!Name')
table.insert(resultPart, '\r\n!Name')
table.insert(resultPart, '\r\n![[DLC]]')
--Weapons have Attack Speed here
--Weapons have Attack Speed here
if isWeaponType then
if isWeaponType then
Line 179: Line 190:
end
end
if Shared.contains(statColumns, 'damageReduction') then
if Shared.contains(statColumns, 'damageReduction') then
table.insert(resultPart, '\r\n!'..Icons.Icon({'Defence', type='skill', notext='true'}))
table.insert(resultPart, '\r\n!'..Icons.Icon({'Damage Reduction', notext='true'}))
end
if Shared.contains(statColumns, 'resistance') then
table.insert(resultPart, '\r\n!'..Icons.Icon({'Abyssal Resistance', notext='true'}))
end
end
--Level requirements
--Level requirements
Line 196: Line 210:
if Shared.contains(statColumns, 'magicLevelRequired') then
if Shared.contains(statColumns, 'magicLevelRequired') then
table.insert(resultPart, '\r\n!'..Icons.Icon({'Magic', type='skill', notext='true'}))
table.insert(resultPart, '\r\n!'..Icons.Icon({'Magic', type='skill', notext='true'}))
end
if Shared.contains(statColumns, 'attackAbyssalLevel') then
table.insert(resultPart, '\r\n!'..Icons.Icon({'Attack', type='skill', class='abyss-icon', notext='true'}))
end
if Shared.contains(statColumns, 'strengthAbyssalLevel') then
table.insert(resultPart, '\r\n!'..Icons.Icon({'Strength', type='skill', class='abyss-icon', notext='true'}))
end
if Shared.contains(statColumns, 'defenceAbyssalLevel') then
table.insert(resultPart, '\r\n!'..Icons.Icon({'Defence', type='skill', class='abyss-icon', notext='true'}))
end
if Shared.contains(statColumns, 'rangedAbyssalLevel') then
table.insert(resultPart, '\r\n!'..Icons.Icon({'Ranged', type='skill', class='abyss-icon', notext='true'}))
end
if Shared.contains(statColumns, 'magicAbyssalLevel') then
table.insert(resultPart, '\r\n!'..Icons.Icon({'Magic', type='skill', class='abyss-icon', notext='true'}))
end
end
--If includeModifiers is set to 'true', add the Modifiers column
--If includeModifiers is set to 'true', add the Modifiers column
Line 214: Line 243:
local atkSpeed = Items._getItemStat(item, 'attackSpeed', true)
local atkSpeed = Items._getItemStat(item, 'attackSpeed', true)
table.insert(resultPart, '\r\n|-')
table.insert(resultPart, '\r\n|-')
table.insert(resultPart, '\r\n|style="text-align: centre;"|'..Icons.Icon({item.name, type='item', size=50, notext=true}))
table.insert(resultPart, '\r\n|style="text-align: centre;"|'..Icons.Icon({item.name, type='item', size=32, notext=true}))
table.insert(resultPart, '\r\n|' .. Icons.getExpansionIcon(item.id) .. Icons.Icon({item.name, type='item', noicon=true}))
table.insert(resultPart, '\r\n|'..Icons.Icon({item.name, type='item', noicon=true}))
table.insert(resultPart, '\r\n|'..Icons.getDLCColumnIcon(item.id))
table.insert(resultPart, '\r\n| data-sort-value="' .. atkSpeed .. '" style="text-align:right;" |'..Num.round(atkSpeed / 1000, 3, 1) .. 's')
table.insert(resultPart, '\r\n| data-sort-value="' .. atkSpeed .. '" style="text-align:right;" |'..Num.round(atkSpeed / 1000, 3, 1) .. 's')
--That's the first list out of the way, now for 2-Handed
--That's the first list out of the way, now for 2-Handed
Line 223: Line 253:
local statValue = Items._getItemStat(item, statName, true)
local statValue = Items._getItemStat(item, statName, true)
table.insert(resultPart, '\r\n| style="text-align:right;" class="')
table.insert(resultPart, '\r\n| style="text-align:right;" class="')
if string.find(statName, '^(.+)LevelRequired$') == nil then
if string.find(statName, '^(.+)LevelRequired$') == nil or string.find(statName, '^(.+)Abyssallevel$') == nil then
if statValue > 0 then
if statValue > 0 then
table.insert(resultPart, 'table-positive')
table.insert(resultPart, 'table-positive')
Line 231: Line 261:
end
end
table.insert(resultPart, '"|'..Num.formatnum(statValue))
table.insert(resultPart, '"|'..Num.formatnum(statValue))
if statName == 'magicDamageBonus' or statName == 'damageReduction' then table.insert(resultPart, '%') end
if statName == 'magicDamageBonus' or statName == 'damageReduction' or statName == 'resistance' then table.insert(resultPart, '%') end
end
end
--If requested, add the item Modifiers
--If requested, add the item Modifiers
Line 262: Line 292:
--Building rows for armour
--Building rows for armour
table.insert(resultPart, '\r\n|-')
table.insert(resultPart, '\r\n|-')
table.insert(resultPart, '\r\n|'..Icons.Icon({(item.name or 'Unknown'), type='item', size=50, notext=true}))
table.insert(resultPart, '\r\n|'..Icons.Icon({(item.name or 'Unknown'), type='item', size=32, notext=true}))
table.insert(resultPart, '\r\n|' .. Icons.getExpansionIcon(item.id) .. Icons.Icon({item.name, type='item', noicon=true}))
table.insert(resultPart, '\r\n|'..Icons.Icon({item.name, type='item', noicon=true}))
table.insert(resultPart, '\r\n|'..Icons.getDLCColumnIcon(item.id))
for j, statName in pairs(statColumns) do
for j, statName in pairs(statColumns) do
local statValue = Items._getItemStat(item, statName, true)
local statValue = Items._getItemStat(item, statName, true)
Line 273: Line 304:
end
end
table.insert(resultPart, '"|'..Num.formatnum(statValue))
table.insert(resultPart, '"|'..Num.formatnum(statValue))
if statName == 'magicDamageBonus' or statName == 'damageReduction' then table.insert(resultPart, '%') end
if statName == 'magicDamageBonus' or statName == 'damageReduction' or statName == 'resistance' then table.insert(resultPart, '%') end
end
end
--If requested, add the item Modifiers
--If requested, add the item Modifiers