Module:SkillList

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 local Magic = (skill.type=='Magic') local Passive = (skill.type=='Passive') local fontsize = string.len(skill.name) > 20 if fontsize then fontsize='85%' else fontsize='100%' end

-- 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, 'x24px'}} local icon = (skill.icon == ) and  or (''):format(skill.icon, skill.page) local frame = (''):format(skill.page) local sctext = ('') local mptext = ('')

local mainIcon = mw.html.create('div') :css('display','inline-block') :css('position','relative') :css('background','#484f5c') :css('border-radius','5px') :css('width', '300px') :css('height','80px') :css('box-shadow','0px 0px 2px 2px rgba(0,0,0,0.75)') :css('z-index', '1') mainIcon:tag('span')                                       -- Skill Name :css('position','absolute') :css('left','26%') :css('top','9.5%') :css('color','#e0f2f2') :css('font-size',fontsize) :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','left') :css('line-height','14px') :css('z-index', '7') :wikitext(skill.name) if Magic then mainIcon:tag('span')                                       -- Skill Name BG		:css('position','absolute') :css('left','0%') :css('top','0%') :css('border-radius','5px 5px 0px 0px') :css('z-index', '3') :css('width', '300px') :css('height','30px') :css('text-shadow', '0 0 2px black') :css('background','linear-gradient(90deg, rgba(154,109,173,1) 0%, rgba(70,43,109,1) 50%, rgba(50,27,80,1) 100%)') end

if Passive then mainIcon:tag('span')                                      -- Skill Name BG		:css('position','absolute') :css('left','0%') :css('top','0%') :css('border-radius','5px 5px 0px 0px') :css('z-index', '3') :css('width', '300px') :css('height','30px') :css('text-shadow', '0 0 2px black') :css('background','linear-gradient(90deg, rgba(170,158,118,1) 0%, rgba(106,88,44,1) 50%, rgba(80,68,27,1) 100%)') end mainIcon:tag('span')                                      -- SC BG		:css('position','absolute') :css('right','2%') :css('top','4%') :css('border-radius','5px') :css('z-index', '3') :css('width', '54px') :css('height','17px') :css('padding','2px') :css('background','rgba(14, 2, 33, 0.8)') :css('box-shadow','0px 0px 2px 2px rgba(0,0,0,0.75)')

mainIcon:tag('span')                                      -- Main BG		:css('position','absolute') :css('right','0%') :css('bottom','0%') :css('border-radius','0px 0px 5px 5px') :css('z-index', '3') :css('width', '300px') :css('height','50px') :css('background','rgba(107,110,115)')

mainIcon:tag('span')                                     -- Description BG		:css('position','absolute') :css('right','1.5%') :css('bottom','7%') :css('border-radius','5px') :css('z-index', '4') :css('width', '216px') :css('height','40px') :css('background','rgba(17,19,22,0.75)') :css('box-shadow','0px 0px 2px 2px rgba(0,0,0,0.75)') mainIcon:tag('span')                                 -- Description Value :css('position','absolute') :css('left','28%') :css('top','48%') :css('color','#e0f2f2') :css('font-size','85%') :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','left') :css('line-height','14px') :css('width', '70%') :css('z-index', '7') :wikitext(skill.desc) mainIcon:tag('span')                                      -- Skill Frame :css('position','absolute') :css('left','0%') :css('top','0%') :css('padding','5px') :css('z-index', '6') :wikitext(frame)

mainIcon:tag('span')                                        -- Skill Subtype Icon :css('position','absolute') :css('left','2%') :css('top','4.5%') :css('z-index', '7') :wikitext(subtype)

mainIcon:tag('span')                                       -- Item Icon :css('position','absolute') :css('left','0%') :css('top','0%') :css('padding','5px') :css('z-index', '5') :wikitext(icon)

mainIcon:tag('span')                                 -- SC Value :css('position','absolute') :css('right','6%') :css('top','4%') :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('vertical-align','top') :css('z-index', '7') :wikitext(skill.sc)

mainIcon:tag('span')                                 -- SC Text Icon :css('position','absolute') :css('right','12%') :css('top','0%') :css('padding','2px') :css('z-index', '5') :wikitext(sctext)

if showMP then mainIcon:tag('span')                                  -- MP Value :css('position','absolute') :css('right','75%') :css('bottom','4.5%') :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('vertical-align','top') :css('z-index', '7') :wikitext(skill.mp) mainIcon:tag('span')                                        -- MP Icon Text :css('position','absolute') :css('left','9%') :css('bottom','3%') :css('padding','2px') :css('z-index', '7') :wikitext(mptext) end -- Full Item Icon tbl:tag('span') :css('border','none') :css('background','transparent') :css('text-align','center') :css('display', 'inline-block') :wikitext(tostring(mainIcon))

local name =  .. skill.name .. 

return tostring(tbl) end

return p