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', total = 1 },
{ name = 'Fluid<br />Strikes', total = 1 },
{ name = 'Quick<br />Shot', total = 1 },
{ name = 'Boner<br />Boost', total = 5 },
{ name = 'Deft<br />Strikes', total = 5 }
},
['tier2'] = {
{ name = 'Combat<br />XP', total = 5 },
{ name = 'Menacing<br />Mage', total = 5 },
{ name = 'Elementalist', total = 5 },
{ name = 'Feral<br />fighter', total = 5 },
{ name = 'Giant<br />Slayer', total = 5 },
{ name = 'Ruthless<br />Ranger', total = 5 },
{ name = 'Headshot', total = 5 },
{ name = 'Bloodworm', total = 1 },
{ name = 'Resilience I', total = 5 },
{ name = 'Heart<br />Rate', total = 10 },
{ name = 'Consistency', total = 5 },
{ name = 'Fortification', total = 5 },
{ name = 'Antifire', total = 5 },
{ name = 'Antipoison', total = 5 },
{ name = 'Devout', total = 5 },
{ name = 'Renewal', total = 5 }
},
-- Tiers 3-6 and Key Stones would go here
}
function p._main(frame)
local args = frame.args
local output = ''
for key, value in pairs(args) do
if tiers[key] then
local values = {}
for v in value:gmatch("([^,]+)") do
table.insert(values, tonumber(v))
end
local tier_data = tiers[key]
output = output .. '=== ' .. (key:gsub('(%a+)(%d+)', '%1 %2'):gsub('^%l', string.upper)) .. ' ===\n'
output = output .. '{| class="wikitable" style="width: 35%;"\n'
-- Create header rows
output = output .. '|-\n'
for i, item in ipairs(tier_data) do
local filename = item.name:gsub('<br />', ' '):gsub('%s+', ' ')
output = output .. '! style="width: 20%;" | [[File:' .. filename .. '.png|32px]]<br />' .. item.name .. ' '
end
output = output .. '\n'
-- Create data rows
output = output .. '|-\n'
output = output .. 'style="text-align:center; height: 40px;"\n'
for i, item in ipairs(tier_data) do
local current = values[i] or 0
local total = item.total
local bgcolor = ''
if current == total then
bgcolor = ' style="width: 20%; background-color:#56e156;"'
elseif current > 0 then
bgcolor = ' style="width: 20%; background-color:#ffed4c;"'
else
bgcolor = ' style="width: 20%;"'
end
output = output .. '|' .. bgcolor .. ' | ' .. current .. '/' .. total .. '\n'
end
output = output .. '|}\n\n'
end
end
return output
end
return p