Anonymous

Module:Equipment/Recommended: Difference between revisions

From Melvor Idle
m
let's hope
m (added temporary wrapper just so it keeps working)
m (let's hope)
Line 24: Line 24:
{ placement = 12, name = 'passive', icon = 'Slot_passive', txt = 'Passive', link = 'Combat Passive Slot' },
{ placement = 12, name = 'passive', icon = 'Slot_passive', txt = 'Passive', link = 'Combat Passive Slot' },
{ placement = 13, name = 'familiar1', icon = 'Slot_summon', txt = 'Familiar Left', link = 'Summoning' },
{ placement = 13, name = 'familiar1', icon = 'Slot_summon', txt = 'Familiar Left', link = 'Summoning' },
{ placement = 14, name = 'familiar2', icon = 'Slot_summon', txt = 'Familiar Right', link = 'Summoning' }
{ placement = 14, name = 'familiar2', icon = 'Slot_summon', txt = 'Familiar Right', link = 'Summoning' },
{ placement = 99, name = 'notes', icon = '', txt = "Notes", link = nil }
}
}


Line 108: Line 108:


function p.synergy(frame)
function p.synergy(frame)
return p.main(frame)
local args = frame:getParent().args
local left_summon = slots[13]
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 notes = slots[15]
local rows = {}
local header_row = {}
table.insert(header_row, summon_icon .. ' Left')
table.insert(header_row, summon_icon .. ' Right')
table.insert(rows, '{| class="mediawiki"')
table.insert(rows, table.concat(header_row, '\r\n! '))
local function make_gear_cell(name)
if name then
return '| ' .. icons.Icon({v, img=v, type='item'})
else
return '| ' .. summon_icon
end
end
-- first we create tables for left and right side making sure left[i] and right[i] correspond
-- could generate the rows in one go, but eh
local lefties = {}
local righties = {}
local notes = {}
for i = 1, number_of_possible_choices, 1 do
local left = args[left_summon.name .. i]
table.insert(lefties, make_gear_cell(left))
local right = args[right_summon.name .. i]
table.insert(righties, make_gear_cell(right))
local notes = args[notes.name .. i]
table.insert(notes, make_gear_cell(right))
end
-- then we create all the rows by formatting them
for i = 1, number_of_possible_choices, 1 do
local row = {}
table.insert(row, lefties[i])
table.insert(row, righties[i])
table.insert(row, notes[i])
table.insert(rows, table.concat(row, "\r\n"))
end
return table.concat(rows, '\r\n|-\r\n')..'|}'
 
end
end


return p
return p
892

edits