2,875
edits
No edit summary |
No edit summary |
||
Line 13: | Line 13: | ||
local weaponTypes = {'Magic Staff', 'Magic Wand', 'Ranged Weapon', 'Weapon'} | local weaponTypes = {'Magic Staff', 'Magic Wand', 'Ranged Weapon', 'Weapon'} | ||
local function getAttackSpeed(item) | local function getAttackSpeed(item) | ||
Line 92: | Line 82: | ||
end | end | ||
local function | --== Helper Functions for getCategoryTable ==-- | ||
local function createStatCell(row, statVal) | |||
local cell = row:tag('td') | local cell = row:tag('td') | ||
if statVal > 0 then | if statVal > 0 then | ||
Line 104: | Line 91: | ||
end | end | ||
cell:css('text-align', 'right') | cell:css('text-align', 'right') | ||
return cell | return cell | ||
end | end | ||
local function addStatCell(row, item, stat) | |||
local statVal = 0 | |||
if item.equipmentStats ~= nil then | |||
statVal = item.equipmentStats[stat] or 0 | |||
end | |||
return createStatCell(row, statVal) | |||
:wikitext(statVal) | |||
end | |||
local function addDRCell(row, item) | |||
local dr = 0 | |||
local icon = nil | |||
-- Grab damage reduction figure | |||
if item.equipmentStats ~= nil then | |||
if item.equipmentStats.damageReduction then | |||
dr, icon = item.equipmentStats.damageReduction, 'Damage Reduction' | |||
elseif item.equipmentStats.resistance then | |||
dr, icon = item.equipmentStats.resistance, 'Abyssal Resistance' | |||
end | |||
end | |||
local cell = createStatCell(row, dr) | |||
-- Add DR icons, if there's any value | |||
if dr ~= 0 then | |||
cell:wikitext(Icons.Icon({icon, size=15, notext='true'}) .. ' ') | |||
end | |||
-- Add DR value | |||
cell:wikitext(dr .. '%') | |||
return cell | |||
end | |||
function p._getCategoryTable(slot) | function p._getCategoryTable(slot) | ||
local iconSize = 20 | local iconSize = 20 | ||
Line 137: | Line 158: | ||
-- TODO: if abyssal switch text | -- TODO: if abyssal switch text | ||
header0:tag('th'):wikitext("DR") | header0:tag('th'):wikitext("DR/AR") | ||
header0:tag('th') -- Empty row above "Equip Req" | header0:tag('th') -- Empty row above "Equip Req" | ||
Line 166: | Line 187: | ||
-- Damage reduction | -- Damage reduction | ||
header1:tag('th'):wikitext(Icons.Icon({'Damage Reduction', size=iconSize, notext='true'})) | header1:tag('th'):wikitext(Icons.Icon({'Damage Reduction', size=iconSize, notext='true'})) | ||
--Level requirements | --Level requirements | ||
header1:tag('th'):wikitext('Equip Req') | header1:tag('th'):wikitext('Equip Req') | ||
Debug.log(itemList) | |||
-- Fill the table with all items | -- Fill the table with all items | ||
for _, item in ipairs(itemList) do | for _, item in ipairs(itemList) do | ||
Line 208: | Line 227: | ||
addStatCell(row, item, 'magicDefenceBonus') | addStatCell(row, item, 'magicDefenceBonus') | ||
-- | -- Add Damage Reduction / Abyssal Resistance | ||
addDRCell(row, item) | |||
-- TODO: Format requirements | -- TODO: Format requirements |
edits