Module:PvMTreeExample
Documentation for this module may be created at Module:PvMTreeExample/doc
local p = {}
-- Data for the tiers
local tiers = {
['tier1'] = {
{ name = 'Double<br />Cast', file = 'Double Cast.png', total = 1 },
{ name = 'Fluid<br />Strikes', file = 'Fluid strikes.png', total = 1 },
{ name = 'Quick<br />Shot', file = 'Quick shot.png', total = 1 },
{ name = 'Boner<br />Boost', file = 'Boner boost.png', total = 5 },
{ name = 'Deft<br />Strikes', file = 'Deft strikes.png', total = 5 }
},
['tier2'] = {
{ name = 'Combat<br />XP', file = 'Combat xp.png', total = 5 },
{ name = 'Menacing<br />Mage', file = 'Menacing mage.png', total = 5 },
{ name = 'Elementalist', file = 'Elementalist.png', total = 5 },
{ name = 'Feral<br />fighter', file = 'Feral fighter.png', total = 5 },
{ name = 'Giant<br />Slayer', file = 'Giant slayer.png', total = 5 },
{ name = 'Ruthless<br />Ranger', file = 'Ruthless ranger.png', total = 5 },
{ name = 'Headshot', file = 'Headshot.png', total = 5 },
{ name = 'Bloodworm', file = 'Bloodworm.png', total = 1 },
{ name = 'Resilience I', file = 'Resilience i.png', total = 5 },
{ name = 'Heart<br />Rate', file = 'Heart rate.png', total = 10 },
{ name = 'Consistency', file = 'Consistency.png', total = 5 },
{ name = 'Fortification', file = 'Fortification.png', total = 5 },
{ name = 'Antifire', file = 'Antifire.png', total = 5 },
{ name = 'Antipoison', file = 'Antipoison.png', total = 5 },
{ name = 'Devout', file = 'Devout.png', total = 5 },
{ name = 'Renewal', file = 'Renewal.png', total = 5 }
},
['tier3'] = {
{ name = 'Porcupine', file = 'Porcupine.png', total = 5 },
{ name = 'Unnatural<br />Selection', file = 'Unnatural selection.png', total = 5 },
{ name = 'Treasure<br />Goblins', file = 'Treasure goblins.png', total = 5 },
{ name = 'Draining<br />Strikes', file = 'Draining strikes.png', total = 5 },
{ name = 'Exploding<br />Attacks', file = 'Exploding attacks.png', total = 5 },
{ name = 'Holey<br />Vestments', file = 'Holey vestments.png', total = 5 },
{ name = 'Bottomless<br />Quiver', file = 'Bottomless quiver.png', total = 5 },
{ name = 'Runic<br />Efficiency', file = 'Runic efficiency.png', total = 5 }
},
['tier4'] = {
{ name = 'Sigil of<br />Finality', file = 'Sigil of finality.png', total = 5 },
{ name = 'Pious<br />Protection', file = 'Pious protection.png', total = 5 },
{ name = 'Aggression', file = 'Aggression.png', total = 5 },
{ name = 'Precision', file = 'Precision.png', total = 5 },
{ name = 'Unholy', file = 'Unholy.png', total = 5 },
{ name = 'Firebender', file = 'Firebender.png', total = 5 },
{ name = 'Tekton\'s<br />Rage I', file = 'Tekton\'s rage i.png', total = 5 },
{ name = 'Ghommal\'s<br />Might I', file = 'Ghommal\'s might i.png', total = 5 },
{ name = 'Victory<br />Rush', file = 'Victory rush.png', total = 5 }
},
['tier5'] = {
{ name = 'Adrenaline<br />Assault', file = 'Adrenaline assault.png', total = 5 },
{ name = 'Guardian', file = 'Guardian.png', total = 1 },
{ name = 'Executioner', file = 'Executioner.png', total = 1 },
{ name = 'Berserker', file = 'Berserker.png', total = 5 },
{ name = 'Absolute<br />Unit', file = 'Absolute unit.png', total = 1 },
{ name = 'Resilience II', file = 'Resilience ii.png', total = 5 }
},
['tier6'] = {
{ name = 'Tekton\'s<br />Rage II', file = 'Tekton\'s rage ii.png', total = 5 },
{ name = 'Ghommal\'s<br />Might II', file = 'Ghommal\'s might ii.png', total = 5 },
{ name = 'Reach<br />Around', file = 'Reach around.png', total = 4 },
{ name = 'Energy<br />Efficiency', file = 'Energy efficiency.png', total = 7 }
},
['keystones'] = {
{ name = 'Key Stone:<br />Vanguard', file = 'Key stone: vanguard.png', total = 1 },
{ name = 'Key Stone:<br />Trickster', file = 'Key stone: trickster.png', total = 1 },
{ name = 'Key Stone:<br />Battlemage', file = 'Key stone: battlemage.png', total = 1 }
}
}
function p._main(frame)
local args = frame.args
local output = {}
local tier_order = { 'tier1', 'tier2', 'tier3', 'tier4', 'tier5', 'tier6', 'keystones' }
for _, tier_key in ipairs(tier_order) do
local value = args[tier_key]
if value then
local values = {}
for v in value:gmatch("([^,]+)") do
table.insert(values, tonumber(v))
end
local tier_data = tiers[tier_key]
table.insert(output, '=== ' .. (tier_key:gsub('(%a+)(%d+)', '%1 %2'):gsub('^%l', string.upper)) .. ' ===')
table.insert(output, '{| class="wikitable" style="width: 35%;"')
local i = 1
while i <= #tier_data do
local header_row_parts = {}
local data_row_parts = {}
local cells_in_row = 0
while i <= #tier_data and cells_in_row < 5 do
local item = tier_data[i]
local current = values[i] or 0
local total = item.total
local bgcolor = ''
if current == total then
bgcolor = 'background-color:#56e156;'
elseif current > 0 then
bgcolor = 'background-color:#ffed4c;'
else
bgcolor = ''
end
table.insert(header_row_parts, 'style="width: 20%;" | [[File:' .. item.file .. '|32px]]<br />' .. item.name .. '')
table.insert(data_row_parts, 'style="width: 20%; ' .. bgcolor .. '" | ' .. current .. '/' .. total .. '')
i = i + 1
cells_in_row = cells_in_row + 1
end
table.insert(output, '|-\n! ' .. table.concat(header_row_parts, ' !! '))
table.insert(output, '|-\n| style="text-align:center; height: 40px;"\n| ' .. table.concat(data_row_parts, ' || '))
end
table.insert(output, '|}')
table.insert(output, '') -- Add a blank line for separation
end
end
return table.concat(output, '\n')
end
return p