Anonymous

Module:Items/ComparisonTables: Difference between revisions

From Melvor Idle
added code to show special attacks in the Modifiers table for equipment because it seemed like the thing to do
(getEquipmentTable: Remove unused function (then following this, ItemData is also unused))
(added code to show special attacks in the Modifiers table for equipment because it seemed like the thing to do)
Line 196: Line 196:
if includeModifiers then
if includeModifiers then
table.insert(resultPart, '\r\n|style="text-align:left;padding:0 0.5em 0 0.5em;"|')
table.insert(resultPart, '\r\n|style="text-align:left;padding:0 0.5em 0 0.5em;"|')
table.insert(resultPart, Constants.getModifiersText(item.modifiers, true))
local txtLines = {}
local modTxt = Constants.getModifiersText(item.modifiers, true)
if modTxt ~= '' then
table.insert(txtLines, modTxt)
end
--For items with a special attack, show the details
if item.hasSpecialAttack then
table.insert(txtLines, "'''Special Attack:'''")
for i, spAtt in ipairs(item.specialAttacks) do
table.insert(txtLines, spAtt.defaultChance .. '% chance for ' .. spAtt.name .. ':')
table.insert(txtLines, spAtt.description)
end
end
table.insert(resultPart, table.concat(txtLines, '<br/>'))
end
end
--If requested, add description
--If requested, add description
Line 222: Line 235:
if includeModifiers then
if includeModifiers then
table.insert(resultPart, '\r\n|style="text-align:left;padding:0 0.5em 0 0.5em;"|')
table.insert(resultPart, '\r\n|style="text-align:left;padding:0 0.5em 0 0.5em;"|')
table.insert(resultPart, Constants.getModifiersText(item.modifiers, true))
local txtLines = {}
local modTxt = Constants.getModifiersText(item.modifiers, true)
if modTxt ~= '' then
table.insert(txtLines, modTxt)
end
--For items with a special attack, show the details
if item.hasSpecialAttack then
table.insert(txtLines, "'''Special Attack:'''")
for i, spAtt in ipairs(item.specialAttacks) do
table.insert(txtLines, spAtt.defaultChance .. '% chance for ' .. spAtt.name .. ':')
table.insert(txtLines, spAtt.description)
end
end
table.insert(resultPart, table.concat(txtLines, '<br/>'))
end
end
--If requested, add description
--If requested, add description