Module:Skill

local p = {}

function p.main(frame) if frame == mw.getCurrentFrame then args = require('Module:ProcessArgs').merge(true) else frame = mw.getCurrentFrame end

if (args.name == nil or args.name == '') then return frame:preprocess(' Error! You must enter a  parameter! ') end

local skill = args.name

local result = mw.ext.cargo.query(       'Skills',         '_pageName, name, image, cooldown, consumes, cost, skilltype',         {            where = '_pageName="' .. skill .. '"',            limit = 1        }    )

if not (result[1]) then return frame:preprocess(' Error! Could not get data for '.. skill ..'! ') end

local descResult = mw.ext.cargo.query(       'Descriptions',        '_pageName, description',        {            where = '_pageName="' .. skill .. '"',            limit = 1        }    )

if not (descResult[1].description) then return frame:preprocess(' Error! Could not get description for '.. skill ..'! ') end

-- our Query results local skillData = result[1] local desc = descResult[1].description

-- Build the HTML local html = mw.html.create local mainStyle = 'padding: 0px; margin: 0px; min-width: 300px; border: 1px solid #222; color: #FFF; background-color: #000;' local mainDiv = html:tag('div'):addClass('skillbox'):cssText(mainStyle)

-- Header Div local headerStyle = 'float: left; background-color: #151515; width: 100%; height: 25px; vertical-align: middle; text-align: center; font-size: 15pt; font-weight: 475; line-height: 25px !important;' local headerDiv = mainDiv:tag('div'):addClass('heading'):cssText(headerStyle) headerDiv:wikitext(..skill..)

-- Image mainDiv:tag('div'):cssText('float:left; padding-bottom: 0px !important; padding-right: 5px'):wikitext(frame:preprocess(''))

-- Skill Info -- costs (purchase and activate costs) local costsStyle = 'display: block; text-align: left; padding-top: 3px; padding-right: 5px; margin-left: 5px;' local costsDiv = mainDiv:tag('div'):cssText(costsStyle):addClass('skillDesc') local costsOutput = skillData.cost if (skillData.skilltype == 'Passive') then costsOutput = costsOutput .. ' |  Passive ' else if ((args.manacost ~= nil and args.manacost ~= ) or (args.staminacost ~= nil and args.staminacost ~= ) or (args.cooldown ~= nil and args.cooldown ~= '')) then costsOutput = costsOutput .. ' |'            if (args.manacost ~= nil and args.manacost ~= '') then costsOutput = costsOutput .. ' ' .. args.manacost .. ' ' end if (args.staminacost ~= nil and args.staminacost ~= '') then costsOutput = costsOutput .. ' ' .. args.staminacost .. ' ' end if (args.cooldown ~= nil and args.cooldown ~= '') then costsOutput = costsOutput .. ' ' .. args.cooldown .. 's ' end end end costsDiv:wikitext(frame:preprocess(''..costsOutput..'')) -- and just chuck the description in the remaining div area mainDiv:tag('hr'):cssText('margin-right: 5px; margin-bottom: 8px;') mainDiv:wikitext(frame:preprocess('' .. desc .. ''))

mainDiv:tag('div'):cssText('clear: both;'):done return html:done

end

return p