Module:SkillIcon

local cargo = mw.ext.cargo local p = {}

local escp = function (str) return (mw.ustring.gsub(str == nil and '' or tostring(str), "'", "\\'")) end

function p.skill(frame) local skillName = frame.args[1] local skill = cargo.query(		'Skills',		'Skills._pageName=page, Skills.Name=name, Skills.Icon=icon, Skills.Subtype=subtype, Skills.Type=type, Skills.MP=mp, Skills.SC=sc, Skills.Description=desc',		{			where = ("Skills.Name='%s'"):format(escp(skillName)),		}	)

if #skill == 0 then return  .. skillName ..  end

local skill = skill[1]

local showMP = string.len(skill.mp) >= 1

-- Creates HTML Table local tbl = mw.html.create('div') :css('border','none') :css('text-align','center')

local subtype = frame:expandTemplate{title='SkillSubtypeIcon', args = {skill.subtype, 'x19px'}} local icon = (skill.icon == ) and  or (''):format(skill.icon, skill.page) local frame = (''):format(skill.page) local mptext = ('')

local mainIcon = mw.html.create('div') :css('display','inline-block') :css('position','relative') :css('z-index', '1') :wikitext(icon) mainIcon:tag('span')                                      -- Skill Frame :css('position','absolute') :css('left','0%') :css('top','0%') :css('z-index', '2') :wikitext(frame)

mainIcon:tag('span')                                        -- Skill Subtype Icon :css('position','absolute') :css('left','0%') :css('top','-7%') :css('z-index', '3') :wikitext(subtype) if showMP then mainIcon:tag('span')                                  -- MP Value :css('position','absolute') :css('right','1%') :css('top','72%') :css('font-size','85%') :css('color','#e0f2f2') :css('text-shadow','1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 2px 0 #000') :css('text-align','right') :css('z-index', '4') :wikitext(skill.mp) mainIcon:tag('span')                                  -- MP Icon Text :css('position','absolute') :css('left','25%') :css('top','68%') :css('z-index', '5') :wikitext(mptext) end -- Full Item Icon tbl:tag('span') :css('border','none') :css('background','none') :css('text-align','center') :css('display', 'inline-block') :wikitext(tostring(mainIcon))

local name =  .. skill.name .. 

return tostring(tbl) end

return p