Module:EquipmentTooltip

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

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

local rarityStars = function (rarity) return string.rep('★', rarity) end

function p.equipTooltip(frame) local equipName = frame.args[1]

local equip = cargo.query(		'Equipments,EquipmentStat,Resistance',		Equipments._pageName=page, Equipments.Name=name, Equipments.Icon=icon, Equipments.Type=type, Equipments.Rarity=rarity,Equipments.Attribute=attribute,Equipments.Trait=trait,EquipmentStat.HP=hp,EquipmentStat.DEF=def,EquipmentStat.STR=str,EquipmentStat.INTe=int,EquipmentStat.MP=mp,EquipmentStat.MND=mnd,Resistance.Fire=fire,Resistance.Ice=ice,Resistance.Wood=earth,Resistance.Thunder=thunder,Resistance.Light=light,Resistance.Dark=dark,Resistance.Poison=poison,Resistance.Blind=blind,Resistance.Curse=curse,Resistance.Silence=silence,Resistance.Paralysis=paralysis,Resistance.Sick=sick,		{		join = 'Equipments._pageName=EquipmentStat._pageName,Equipments._pageName=Resistance._pageName',	               where = ("Equipments.Name='%s'"):format(escp(equipName)),		}	)

if #equip == 0 then return  .. equipName ..  end

--local equip = equip[1]

-- Creates HTML Table local tbl = mw.html.create('table') -- :addClass('wikitable') :css('margin','auto') :css('border','collapse') :css('background','rgba(0,35,25,0.7)') :css('border-radius','5px') :css('color','#fff')

for _, fequip in ipairs(equip) do	local rarity = rarityStars(fequip.rarity) local type = frame:expandTemplate{title='EquipmentTypeInline', args = {fequip.type}} local icon = (fequip.icon == ) and  or (''):format(fequip.icon, fequip.page) local attribute = (fequip.attribute == '') and 'None' or (frame:expandTemplate{title='AttributeInline', args = {fequip.attribute}}) local armor = (fequip.type == 'Accessory') or (fequip.type =='Cloth') or (fequip.type =='Robe') or (fequip.type =='Armor') local res = (fequip.poison == 'RES') or (fequip.blind == 'RES') or (fequip.silence == 'RES') or (fequip.curse == 'RES') or (fequip.paralysis == 'RES') or (fequip.sick == 'RES') local weak = (fequip.poison == 'WEAK') or (fequip.blind == 'WEAK') or (fequip.silence == 'WEAK') or (fequip.curse == 'WEAK') or (fequip.paralysis == 'WEAK') or (fequip.sick == 'WEAK')

if res then res = '#b1c5ff' end

if weak then weak = '#ffffb1' end

if tonumber(fequip.fice) == nil then attributef = '' elseif tonumber(fequip.fire) > 0 then attributef = '#248f24' fequip.fire = ('▲'..fequip.fire) elseif tonumber(fequip.fire) < 0 then attributef = '#b30000' fequip.fire = ('▼'..fequip.fire) end

if tonumber(fequip.ice) == nil then attributei = '' elseif tonumber(fequip.ice) > 0 then attributei = '#248f24' fequip.ice = ('▲'..fequip.ice) elseif tonumber(fequip.ice) < 0 then attributei = '#b30000' fequip.ice = ('▼'..fequip.ice) end

if tonumber(fequip.earth) == nil then attributew = '' elseif tonumber(fequip.earth) > 0 then attributew = '#248f24' fequip.earth= ('▲'..fequip.earth) elseif tonumber(fequip.earth) < 0 then attributew = '#b30000' fequip.earth= ('▼'..fequip.earth) end

if tonumber(fequip.thunder) == nil then attributet = '' elseif tonumber(fequip.thunder) > 0 then attributet = '#248f24' fequip.thunder = ('▲'..fequip.thunder) elseif tonumber(fequip.thunder) < 0 then attributet = '#b30000' fequip.thunder = ('▼'..fequip.thunder) end

if tonumber(fequip.light) == nil then attributel = '' elseif tonumber(fequip.light) > 0 then attributel = '#248f24' fequip.light= ('▲'..fequip.light) elseif tonumber(fequip.light) < 0 then attributel = '#b30000' fequip.light = ('▼'..fequip.light) end

if tonumber(fequip.dark) == nil then attributed = '' elseif tonumber(fequip.dark) > 0 then attributed = '#248f24' fequip.dark= ('▲'..fequip.dark) elseif tonumber(fequip.dark) < 0 then attributed = '#b30000' fequip.dark= ('▼'..fequip.dark) end

local mainIcon = mw.html.create('div') -- Icon Container :css('display','inline-block') :css('position','relative') :wikitext('')

mainIcon:tag('span') -- Item Icon :css('position','absolute') :css('left','9%') :css('top','10%') :wikitext(icon)

-- Attributes Icons

local fire = mw.html.create('div') :css('display','inline-block') :css('position','relative') :css('margin-right','5px') :wikitext('')

fire:tag('span') -- Fire Icon :css('position','absolute') :css('left','50%') :css('color',attributew) :css('top','82%') :css('font-size','85%') :css('font-weight','bold') :css('text-align','center') :css('text-shadow','-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000') :css('transform','translate(-50%,-50%)') :wikitext(fequip.fire)

local ice = mw.html.create('div') :css('display','inline-block') :css('position','relative') :css('margin-right','5px') :wikitext('')

ice:tag('span') -- Ice Icon :css('position','absolute') :css('left','50%') :css('color',attributei) :css('top','82%') :css('font-size','85%') :css('font-weight','bold') :css('text-align','center') :css('text-shadow','-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000') :css('transform','translate(-50%,-50%)') :wikitext(fequip.ice)

local earth = mw.html.create('div') :css('display','inline-block') :css('position','relative') :css('margin-right','5px') :wikitext('')

earth:tag('span') -- Earth Icon :css('position','absolute') :css('left','50%') :css('color', attributew) :css('top','82%') :css('font-size','85%') :css('font-weight','bold') :css('text-align','center') :css('text-shadow','-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000') :css('transform','translate(-50%,-50%)') :wikitext(fequip.earth)

local thunder = mw.html.create('div') :css('display','inline-block') :css('position','relative') :css('margin-right','5px') :wikitext('')

thunder:tag('span') -- Thunder Icon :css('position','absolute') :css('left','50%') :css('color',attributet) :css('top','82%') :css('font-size','85%') :css('font-weight','bold') :css('text-align','center') :css('text-shadow','-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000') :css('transform','translate(-50%,-50%)') :wikitext(fequip.thunder)

local light = mw.html.create('div') :css('display','inline-block') :css('position','relative') :css('margin-right','5px') :wikitext('')

light:tag('span') -- Light Icon :css('position','absolute') :css('left','50%') :css('color',attributel) :css('top','82%') :css('font-size','85%') :css('font-weight','bold') :css('text-align','center') :css('text-shadow','-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000') :css('transform','translate(-50%,-50%)') :wikitext(fequip.light)

local dark = mw.html.create('div') :css('display','inline-block') :css('position','relative') :css('margin-right','5px') :wikitext('')

dark:tag('span') -- Dark Icon :css('position','absolute') :css('left','50%') :css('color',attributed) :css('top','82%') :css('font-size','85%') :css('font-weight','bold') :css('text-align','center') :css('text-shadow','-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000') :css('transform','translate(-50%,-50%)') :wikitext(fequip.dark)

-- Ailments Icons

local poison = mw.html.create('div') :css('display','inline-block') :css('position','relative') :css('margin-right','5px') :wikitext('')

poison:tag('span') -- Poison Icon :css('position','absolute') :css('left','50%') :css('color', weak or res or '#fff') :css('top','71%') :css('font-size','85%') :css('font-weight','bold') :css('text-align','center') :css('text-shadow','-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000') :css('transform','translate(-50%,-50%)') :wikitext(fequip.poison)

local blind = mw.html.create('div') :css('display','inline-block') :css('position','relative') :css('margin-right','5px') :wikitext('')

blind :tag('span') -- Blind Icon :css('position','absolute') :css('left','50%') :css('color','#00ff00') :css('top','71%') :css('font-size','85%') :css('font-weight','bold') :css('text-align','center') :css('text-shadow','-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000') :css('transform','translate(-50%,-50%)') :wikitext(fequip.blind)

local silence = mw.html.create('div') :css('display','inline-block') :css('position','relative') :css('margin-right','5px') :wikitext('')

silence:tag('span') -- Silence Icon :css('position','absolute') :css('left','50%') :css('color','#00ff00') :css('top','71%') :css('font-size','85%') :css('font-weight','bold') :css('text-align','center') :css('text-shadow','-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000') :css('transform','translate(-50%,-50%)') :wikitext(fequip.silence)

local curse = mw.html.create('div') :css('display','inline-block') :css('position','relative') :css('margin-right','5px') :wikitext('')

curse:tag('span') -- Curse Icon :css('position','absolute') :css('left','50%') :css('color','#00ff00') :css('top','71%') :css('font-size','85%') :css('font-weight','bold') :css('text-align','center') :css('text-shadow','-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000') :css('transform','translate(-50%,-50%)') :wikitext(fequip.curse)

local paralysis = mw.html.create('div') :css('display','inline-block') :css('position','relative') :css('margin-right','5px') :wikitext('')

paralysis:tag('span') -- Paralysis Icon :css('position','absolute') :css('left','50%') :css('color','#00ff00') :css('top','71%') :css('font-size','85%') :css('font-weight','bold') :css('text-align','center') :css('text-shadow','-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000') :css('transform','translate(-50%,-50%)') :wikitext(fequip.paralysis)

local sick = mw.html.create('div') :css('display','inline-block') :css('position','relative') :css('margin-right','5px') :wikitext('')

sick:tag('span') -- Sick Icon :css('position','absolute') :css('left','50%') :css('color','#00ff00') :css('top','71%') :css('font-size','85%') :css('font-weight','bold') :css('text-align','center') :css('text-shadow','-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000') :css('transform','translate(-50%,-50%)') :wikitext(fequip.sick)

tbl:tag('tr') :tag('td') -- Name :attr('colspan', '5') :css('text-align', 'center') :css('color','#292b32') :css('font-size','120%') :css('font-weight','bold') :css('background','rgb(57,62,85)') :css('background','linear-gradient(350deg, rgba(57,62,85,1) 0%, rgba(136,139,153,1) 49%, rgba(255,255,255,1) 100%)') :css('border-radius','5px') :wikitext(fequip.name)

tbl:tag('tr') :tag('td') -- Rarity :attr('colspan', '5') :css('text-align', 'center') :css('color','#d1aa19') :css('letter-spacing','5px') :css('font-size','120%') :css('background','rgb(0,0,0)') :css('background','radial-gradient(circle, rgba(28,28,28,1) 86%, rgba(0,0,0,1) 100%)') :css('border-radius','5px') :wikitext(rarity)

tbl:tag('tr') :tag('td') -- Icon Base :attr('rowspan', '4') :css('text-align', 'center') :css('background','rgba(28,28,28,1)') :css('width','70px') :css('border-radius','5px') :wikitext(tostring(mainIcon)) :tag('td') -- Type :attr('colspan', '2') :css('border-radius','5px') :css('background','rgb(0,0,0)') :css('background','radial-gradient(circle, rgba(28,28,28,1) 67%, rgba(0,0,0,1) 100%)') :wikitext(type)

:attr('colspan', '2') :css('background','rgb(0,0,0)') :css('background','radial-gradient(circle, rgba(28,28,28,1) 67%, rgba(0,0,0,1) 100%)') :css('border-radius','5px') :wikitext(attribute)

tbl:tag('tr') :tag('td') -- HP Stats Icon :css('width','45px') :css('font-size','80%') :css('vertical-align','middle') :css('text-align', 'right') :css('background','rgb(36,36,41)') :css('background','linear-gradient(270deg, rgba(36,36,41,1) 50%, rgba(0,0,0,1) 100%)') :css('border-radius','5px 1px 1px 5px') :wikitext('') :wikitext(' H P ') :tag('td') -- HP Value :css('width','90px') :css('font-size','80%') :css('font-weight','bold') :css('text-align','center') :css('background','rgb(36,36,41)') :css('background','linear-gradient(90deg, rgba(36,36,41,1) 74%, rgba(0,0,0,1) 100%)') :css('border-radius','1px 5px 5px 1px') :wikitext(fequip.hp) :tag('td') -- MP Stats Icon :css('width','45px') :css('font-size','80%') :css('vertical-align','middle') :css('text-align', 'right') :css('background','rgb(36,36,41)') :css('background','linear-gradient(270deg, rgba(36,36,41,1) 50%, rgba(0,0,0,1) 100%)') :css('border-radius','5px 1px 1px 5px') :wikitext('') :wikitext(' M P ')

:css('width','90px') :css('font-size','80%') :css('font-weight','bold') :css('text-align','center') :css('background','rgb(36,36,41)') :css('background','linear-gradient(90deg, rgba(36,36,41,1) 74%, rgba(0,0,0,1) 100%)') :css('border-radius','1px 5px 5px 1px') :wikitext(fequip.mp)

tbl:tag('tr') :tag('td') -- STR Stats Icon :css('width','45px') :css('font-size','80%') :css('vertical-align','middle') :css('text-align', 'right') :css('background','rgb(0,0,0)') :css('background','linear-gradient(270deg, rgba(22,22,22,1) 0%, rgba(0,0,0,1) 100%)') :css('border-radius','5px 1px 1px 5px') :wikitext('') :wikitext(' S T R') :tag('td') -- STR Value :css('width','90px') :css('font-size','80%') :css('font-weight','bold') :css('text-align','center') :css('background','rgb(0,0,0)') :css('background','linear-gradient(90deg, rgba(22,22,22,1) 74%, rgba(0,0,0,1) 100%)') :css('border-radius','1px 5px 5px 1px') :wikitext(fequip.str)

:css('width','45px') :css('font-size','80%') :css('vertical-align','middle') :css('text-align', 'right') :css('background','rgb(0,0,0)') :css('background','linear-gradient(270deg, rgba(22,22,22,1) 0%, rgba(0,0,0,1) 100%)') :css('border-radius','5px 1px 1px 5px') :wikitext('') :wikitext(' D E F')

:css('width','90px') :css('font-size','80%') :css('font-weight','bold') :css('text-align','center') :css('background','rgb(0,0,0)') :css('background','linear-gradient(90deg, rgba(22,22,22,1) 74%, rgba(0,0,0,1) 100%)') :css('border-radius','1px 5px 5px 1px') :wikitext(fequip.def)

tbl:tag('tr') :tag('td') -- INT Stats Icon :css('width','45px') :css('font-size','80%') :css('vertical-align','middle') :css('text-align', 'right') :css('background','rgb(36,36,41)') :css('background','linear-gradient(270deg, rgba(36,36,41,1) 50%, rgba(0,0,0,1) 100%)') :css('border-radius','5px 1px 1px 5px') :wikitext('') :wikitext(' I N T') :tag('td') -- INT Value :css('width','90px') :css('font-size','80%') :css('font-weight','bold') :css('text-align','center') :css('background','rgb(36,36,41)') :css('background','linear-gradient(90deg, rgba(36,36,41,1) 74%, rgba(0,0,0,1) 100%)') :css('border-radius','1px 5px 5px 1px') :wikitext(fequip.int)

:css('width','45px') :css('font-size','80%') :css('vertical-align','middle') :css('text-align', 'right') :css('background','rgb(36,36,41)') :css('background','linear-gradient(270deg, rgba(36,36,41,1) 50%, rgba(0,0,0,1) 100%)') :css('border-radius','5px 1px 1px 5px') :wikitext('') :wikitext(' MND')

:css('width','90px') :css('font-size','80%') :css('font-weight','bold') :css('text-align','center') :css('background','rgb(36,36,41)') :css('background','linear-gradient(90deg, rgba(36,36,41,1) 74%, rgba(0,0,0,1) 100%)') :css('border-radius','1px 5px 5px 1px') :wikitext(fequip.mnd)

-- If Trait NOT Empty

if (fequip.trait) ~= '' then

tbl:tag('tr') :tag('td') -- Trait Icon :css('background','rgba(28,28,28,1)') :css('border-radius','5px') :wikitext('') :tag('td') -- Trait Content :attr('colspan', '4') :css('verical-align','top') :css('line-height','16px') :css('background','rgba(28,28,28,1)') :css('border-radius','5px') :wikitext(fequip.trait) end

-- If Type EQUAL Armor, Accessory, Cloth, Robe

if armor then tbl:tag('tr') :tag('td') -- Resistance Icon :attr('rowspan', '3') :css('background','rgba(28,28,28,1)') :css('border-radius','5px') :wikitext('')

:css('font-size','90%') :css('width','50px') :css('border-radius','5px') :css('background','rgba(28,28,28,1)') :wikitext('Attribute') :tag('td') -- Attributes Full Icon :attr('colspan','3') :css('text-align', 'right') :css('background','rgba(28,28,28,1)') :css('border-radius','5px') :wikitext(tostring(fire)) :wikitext(tostring(ice)) :wikitext(tostring(earth)) :wikitext(tostring(thunder)) :wikitext(tostring(light)) :wikitext(tostring(dark)) tbl:tag('tr') :tag('td') -- Ailment Text :css('font-size','90%') :css('width','50px') :css('background','rgba(28,28,28,1)') :css('border-radius','5px') :wikitext('Ailment') :tag('td') -- Ailments Full Icon :attr('colspan','3') :css('text-align', 'right') :css('background','rgba(28,28,28,1)') :css('width','70px') :css('border-radius','5px') :wikitext(tostring(poison)) :wikitext(tostring(blind)) :wikitext(tostring(silence)) :wikitext(tostring(curse)) :wikitext(tostring(paralysis)) :wikitext(tostring(sick)) end end return tostring(tbl)

end

return p