892
edits
m (typo) |
m (forgot the txt) |
||
(12 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
local tiers = { | local tiers = { | ||
{ tier = 1, name = 'obs1', icon = 'Agility', txt = 'I', link = ' | { tier = 1, name = 'obs1', icon = 'Agility', txt = 'I', link = 'Obstacle 1' }, | ||
{ tier = 2, name = 'obs2', icon = 'Agility', txt = 'II', link = ' | { tier = 2, name = 'obs2', icon = 'Agility', txt = 'II', link = 'Obstacle 2' }, | ||
{ tier = 3, name = 'obs3', icon = 'Agility', txt = 'III', link = ' | { tier = 3, name = 'obs3', icon = 'Agility', txt = 'III', link = 'Obstacle 3' }, | ||
{ tier = 4, name = 'obs4', icon = 'Agility', txt = 'IV', link = ' | { tier = 4, name = 'obs4', icon = 'Agility', txt = 'IV', link = 'Obstacle 4' }, | ||
{ tier = 5, name = 'obs5', icon = 'Agility', txt = 'V', link = ' | { tier = 5, name = 'obs5', icon = 'Agility', txt = 'V', link = 'Obstacle 5' }, | ||
{ tier = 6, name = ' | { tier = 6, name = 'obs6', icon = 'Agility', txt = 'VI', link = 'Obstacle 6' }, | ||
{ tier = 7, name = 'obs7', icon = 'Agility', txt = 'VII', link = ' | { tier = 7, name = 'obs7', icon = 'Agility', txt = 'VII', link = 'Obstacle 7' }, | ||
{ tier = 8, name = 'obs8', icon = 'Agility', txt = 'VIII', link = ' | { tier = 8, name = 'obs8', icon = 'Agility', txt = 'VIII', link = 'Obstacle 8' }, | ||
{ tier = 9, name = 'obs9', icon = 'Agility', txt = 'IX', link = ' | { tier = 9, name = 'obs9', icon = 'Agility', txt = 'IX', link = 'Obstacle 9' }, | ||
{ tier = 10, name = 'obs10', icon = 'Agility', txt = 'X', link = ' | { tier = 10, name = 'obs10', icon = 'Agility', txt = 'X', link = 'Obstacle 10' }, | ||
{ tier = 11, name = 'pillar', icon = 'Agility', txt = 'Pillar', link = 'Agility | { tier = 11, name = 'obs11', icon = 'Agility', txt = 'XI', link = 'Obstacle 11' }, | ||
{ tier = 12, name = 'obs12', icon = 'Agility', txt = 'XII', link = 'Obstacle 12' }, | |||
{ tier = 13, name = 'obs13', icon = 'Agility', txt = 'XIII', link = 'Obstacle 13' }, | |||
{ tier = 14, name = 'obs14', icon = 'Agility', txt = 'XIV', link = 'Obstacle 14' }, | |||
{ tier = 15, name = 'obs15', icon = 'Agility', txt = 'XV', link = 'Obstacle 15' }, | |||
{ tier = 98, name = 'pillar', icon = 'Agility', txt = 'Pillar', link = 'Passive Pillars' }, | |||
{ tier = 99, name = 'epillar', icon = 'Agility', txt = 'Elite Pillar', link = 'Passive Pillars' }, | |||
} | } | ||
function p.main(frame) | function p.main(frame) | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
-- local args = frame.args | |||
-- Dynamic colspan and N/A generation value | -- Dynamic colspan and N/A generation value | ||
local greatest_row_size = 0 | local greatest_row_size = 0 | ||
Line 28: | Line 35: | ||
local number_of_possible_choices = 6 | local number_of_possible_choices = 6 | ||
-- Have to sort this table or else the order is messed up when you use it | -- Have to sort this table or else the order is messed up when you use it | ||
table.sort(tiers, function(a, b) return a. | table.sort(tiers, function(a, b) return a.tier < b.tier end) | ||
local function make_row( | local function make_row(tier, data, compact) | ||
local tr = mw.html.create('tr') | local tr = mw.html.create('tr') | ||
local | local tiericon = tr:tag('td') | ||
tiericon:wikitext( icons.Icon({tier.link, tier.txt, img=tier.icon, type='skill'}) ) | |||
if compact then | if compact then | ||
tiericon:attr('style', 'padding-bottom: 4px;') | |||
end | end | ||
for _, v in ipairs(data) do | for _, v in ipairs(data) do | ||
local obstaclename = tr:tag('td'):wikitext(string.format('[[Agility#%s|%s]]', v, v)) | |||
local obstaclename = tr:tag('td'):wikitext(string.format('[[%s|%s]]', v | |||
if compact then | if compact then | ||
obstaclename:attr('style', 'padding-left: 12px;') | obstaclename:attr('style', 'padding-left: 12px;') | ||
Line 54: | Line 60: | ||
-- Find the greatest row count | -- Find the greatest row count | ||
for _, v in next, | for _, v in next, tiers, nil do | ||
local grs = 0 | local grs = 0 | ||
for i = 1, number_of_possible_choices, 1 do | for i = 1, number_of_possible_choices, 1 do | ||
Line 83: | Line 89: | ||
end | end | ||
for _, v in next, | for _, v in next, tiers, nil do | ||
local row_data = {} | local row_data = {} | ||
for i = 1, number_of_possible_choices, 1 do | for i = 1, number_of_possible_choices, 1 do | ||
local | local obstacle = args[v.name .. i] | ||
if | if obstacle and params.has_content(obstacle) then | ||
table.insert(row_data, | table.insert(row_data, obstacle) | ||
end | end | ||
end | end | ||
if #row_data > 0 or args.showall then | if #row_data > 0 or args.showall then |
edits