Module:Ability

local p = {} local h = {}

local data = mw.loadData('Module:Data/Ability')

function p.main(frame) local args = require('Dev:Arguments').getArgs(frame, {parentFirst=true}) return p._main(args) end

function p._main(args) local key = args.Name or args[1] if not key then return end local obj = data[key] if not obj then return end local t = { ' ',       '{| style="background-color:#140d0d; color:#D5D4D4; border: 1px solid #333; margin:left;"', '|-',       '! colspan=2 style="width:100px; background-color:#990000;"| Name', '| colspan=5 style="text-align:center; width:400px;"| ' .. obj.Name .. '', '|- style="background-color:#900"', '! Icon !! Attribute !! Power !! Type !! MP !!  Downtime !! CD ', '|-',       '| ' .. h.icon{obj.Name, '', Align='center'}, '| ' .. h.icon{obj.Attribute, 'Attributes#',Align='center'}, '| ' .. obj.Power .. ' ',       '| ' .. obj.Type .. ' ',       '| ' .. obj.MP .. ' ',       '| ' .. obj.Downtime .. ' ',       '| ' .. obj.CD .. ' ',   	'|-',        '! colspan=2 style="max-width:100px; background-color:#990000;"| Effect ', '| colspan=5 style="text-align:center;"|' .. obj.Effect, '|-',       '! colspan=2 style="max-width:100px; background-color:#990000;"| Availability ', '| colspan=5 style="text-align:center;"|' .. obj.Availability, '|-',       '! colspan=2 style="max-width:100px; background-color:#990000;"| Notes ', '| colspan=5 style="text-align:center;"|' .. obj.Notes, '|}',       ' ',    }    return table.concat(t, '\n') end

function h.icon(args) local name = args[1] local spec = args[2] local align = args.Align return (''):format(name, align, name, spec, name) end

return p