Module:PvMTreeExample: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 64: | Line 64: | ||
}, | }, | ||
['keystones'] = { | ['keystones'] = { | ||
{ name = '[[Talents/PvM_talent_tree#Tier_7|Key Stone:<br />Vanguard]]', file = 'Key stone | { name = '[[Talents/PvM_talent_tree#Tier_7|Key Stone:<br />Vanguard]]', file = 'Key stone vanguard.png', total = 1 }, | ||
{ name = '[[Talents/PvM_talent_tree#Tier_7|Key Stone:<br />Trickster]]', file = 'Key stone | { name = '[[Talents/PvM_talent_tree#Tier_7|Key Stone:<br />Trickster]]', file = 'Key stone trickster.png', total = 1 }, | ||
{ name = '[[Talents/PvM_talent_tree#Tier_7|Key Stone:<br />Battlemage]]', file = 'Key stone | { name = '[[Talents/PvM_talent_tree#Tier_7|Key Stone:<br />Battlemage]]', file = 'Key stone battlemage.png', total = 1 } | ||
} | } | ||
} | } |
Revision as of 12:38, 19 August 2025
Documentation for this module may be created at Module:PvMTreeExample/doc
local p = {}
-- Data for the tiers
local tiers = {
['tier1'] = {
{ name = '[[Talents/PvM_talent_tree#Tier_1|Double<br />Cast]]', file = 'Double cast.png', total = 1 },
{ name = '[[Talents/PvM_talent_tree#Tier_1|Fluid<br />Strikes]]', file = 'Fluid strikes.png', total = 1 },
{ name = '[[Talents/PvM_talent_tree#Tier_1|Quick<br />Shot]]', file = 'Quick shot.png', total = 1 },
{ name = '[[Talents/PvM_talent_tree#Tier_1|Boner<br />Boost]]', file = 'Boner boost.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_1|Deft<br />Strikes]]', file = 'Deft strikes.png', total = 5 }
},
['tier2'] = {
{ name = '[[Talents/PvM_talent_tree#Tier_2|Combat<br />XP]]', file = 'Combat xp.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Menacing<br />Mage]]', file = 'Menacing mage.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Elementalist]]', file = 'Elementalist.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Feral<br />fighter]]', file = 'Feral fighter.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Giant<br />Slayer]]', file = 'Giant slayer.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Ruthless<br />Ranger]]', file = 'Ruthless ranger.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Headshot]]', file = 'Headshot.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Bloodworm]]', file = 'Bloodworm.png', total = 1 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Resilience I]]', file = 'Resilience i.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Heart<br />Rate]]', file = 'Heart rate.png', total = 10 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Consistency]]', file = 'Consistency.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Fortification]]', file = 'Fortification.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Antifire]]', file = 'Antifire.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Antipoison]]', file = 'Antipoison.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Devout]]', file = 'Devout.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_2|Renewal]]', file = 'Renewal.png', total = 5 }
},
['tier3'] = {
{ name = '[[Talents/PvM_talent_tree#Tier_3|Porcupine]]', file = 'Porcupine.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_3|Unnatural<br />Selection]]', file = 'Unnatural selection.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_3|Treasure<br />Goblins]]', file = 'Treasure goblins.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_3|Draining<br />Strikes]]', file = 'Draining strikes.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_3|Exploding<br />Attacks]]', file = 'Exploding attacks.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_3|Holey<br />Vestments]]', file = 'Holey vestments.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_3|Bottomless<br />Quiver]]', file = 'Bottomless quiver.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_3|Runic<br />Efficiency]]', file = 'Runic efficiency.png', total = 5 }
},
['tier4'] = {
{ name = '[[Talents/PvM_talent_tree#Tier_4|Sigil of<br />Finality]]', file = 'Sigil of finality.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_4|Pious<br />Protectio]]n', file = 'Pious protection.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_4|Aggression]]', file = 'Victory_rush.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_4|Precision]]', file = 'Precision.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_4|Unholy]]', file = 'Unholy.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_4|Firebender]]', file = 'Firebender.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_4|Tekton\'s<br />Rage I]]', file = 'Tekton\'s rage i.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_4|Ghommal\'s<br />Might I]]', file = 'Ghommal\'s might i.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_4|Victory<br />Rush]]', file = 'Victory rush.png', total = 5 }
},
['tier5'] = {
{ name = '[[Talents/PvM_talent_tree#Tier_5|Adrenaline<br />Assault]]', file = 'Adrenaline assault.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_5|Guardian]]', file = 'Guardian.png', total = 1 },
{ name = '[[Talents/PvM_talent_tree#Tier_5|Executioner]]', file = 'Executioner.png', total = 1 },
{ name = '[[Talents/PvM_talent_tree#Tier_5|Berserker]]', file = 'Berserker.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_5|Absolute<br />Unit]]', file = 'Absolute unit.png', total = 1 },
{ name = '[[Talents/PvM_talent_tree#Tier_5|Resilience II]]', file = 'Resilience ii.png', total = 5 }
},
['tier6'] = {
{ name = '[[Talents/PvM_talent_tree#Tier_6|Tekton\'s<br />Rage II]]', file = 'Tekton\'s rage ii.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_6|Ghommal\'s<br />Might II]]', file = 'Ghommal\'s might ii.png', total = 5 },
{ name = '[[Talents/PvM_talent_tree#Tier_6|Reach<br />Around]]', file = 'Reach around.png', total = 4 },
{ name = '[[Talents/PvM_talent_tree#Tier_6|Energy<br />Efficiency]]', file = 'Energy efficiency.png', total = 7 }
},
['keystones'] = {
{ name = '[[Talents/PvM_talent_tree#Tier_7|Key Stone:<br />Vanguard]]', file = 'Key stone vanguard.png', total = 1 },
{ name = '[[Talents/PvM_talent_tree#Tier_7|Key Stone:<br />Trickster]]', file = 'Key stone trickster.png', total = 1 },
{ name = '[[Talents/PvM_talent_tree#Tier_7|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, '|-' .. ' 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