Anonymous

Module:Equipment/Recommended: Difference between revisions

From Melvor Idle
m
custom synergy table test
m (forgot a variable)
m (custom synergy table test)
Line 108: Line 108:


function p.synergy(frame)
function p.synergy(frame)
local args = frame:getParent().args
local args = frame.args -- frame:getParent().args
mw.logObject(args)
local left_summon = slots[13]
local left_summon = slots[13]
local right_summon = slots[14]
local right_summon = slots[14]
local summon_icon = string.format('[[File:%s.png|%s|link=%s|36px]] Right', right_summon.icon, right_summon.txt, right_summon.link)
local summon_icon = string.format('[[File:%s.png|Summon|36px]]', right_summon.icon)
local notes = slots[15]
local notes = slots[15]
local number_of_possible_choices = 5
local number_of_possible_choices = 5
Line 121: Line 122:
table.insert(rows, '{| class="mediawiki"')
table.insert(rows, '{| class="mediawiki"')
table.insert(rows, table.concat(header_row, '\r\n! '))
table.insert(rows, '! ' .. table.concat(header_row, '\r\n! '))
local function make_gear_cell(name)
local function make_gear_cell(name)
if name then
if name then
return '| ' .. icons.Icon({v, img=v, type='item'})
return '| ' .. icons.Icon({name, img=name, type='item'})
else
else
return '| ' .. summon_icon
return '| ' .. summon_icon
Line 136: Line 137:
local righties = {}
local righties = {}
local notes = {}
local notes = {}
local number_rows = 0
for i = 1, number_of_possible_choices, 1 do
for i = 1, number_of_possible_choices, 1 do
Line 144: Line 147:
table.insert(righties, make_gear_cell(right))
table.insert(righties, make_gear_cell(right))
local notes = args[notes.name .. i]
local note = args['notes' .. i]
table.insert(notes, make_gear_cell(right))
table.insert(notes, make_gear_cell(note))
if left or right or note then
number_rows = number_rows + 1
end
end
end
-- then we create all the rows by formatting them
-- then we create all the rows by formatting them
for i = 1, number_of_possible_choices, 1 do
for i = 1, number_rows, 1 do
local row = {}
local row = {}
table.insert(row, lefties[i])
table.insert(row, lefties[i])
Line 158: Line 165:
end
end
return table.concat(rows, '\r\n|-\r\n')..'|}'
return table.concat(rows, '\r\n|-\r\n')..'\r\n|}'
 
end


function p.test()
return p.synergy({ args = { familiar11 = 'Crow',
familiar21 = 'Devil',
familiar12 = 'Crow',
familiar22 = 'Octopus',
familiar13 = 'Crow',
familiar23 = 'Bear'
}} )
end
end


return p
return p
892

edits