Module:ArkList

local cargo = mw.ext.cargo local skillIcon = require( 'Module:SkillIcon') local p = {}

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

function p.ArksList(frame) local ArkLevel = frame.args[1] local arks = cargo.query(		'Arks,ArkAttributes,ArkSkills,Equipments,Items',		Arks._pageName=page,Arks.Name=name,Arks.Icon=icon,Arks.Rarity=rarity,Arks.OrbType=orbType,Arks.EtherReward=etherReward,ArkAttributes.Level=level,ArkAttributes.Description=desc,GROUP_CONCAT(ArkSkills.SkillName SEPARATOR' ')=sname,Equipments.Rarity=rarity1,Equipments.Type=type,Items.Rarity=rarity2,Items.Subtype=subtype,		{			join = 'Arks._pageName=ArkAttributes._pageName,Arks._pageName=ArkSkills._pageName,Arks.EtherReward=Equipments._pageName,Arks.EtherReward=Items._pageName',                     groupBy = 'Arks._pageName',			where = ("ArkAttributes.Level='%s'"):format(escp(ArkLevel)),                       		}	)

-- Creates HTML Table local tbl = mw.html.create('table') :addClass('wikitable striped sortable') :css('text-align','center')

-- Table Headers tbl:tag('th'):wikitext('Ark') tbl:tag('th'):wikitext('Rarity') tbl:tag('th'):wikitext('Orb Type') tbl:tag('th'):wikitext('Attribute (MAX Level)') tbl:tag('th'):wikitext('Skills') tbl:tag('th'):wikitext('Ether Reward')

for _, ark in ipairs(arks) do		local rarity = frame:expandTemplate{title='ArkRarityIcon', args = {ark.rarity, 'x30px'}}   -- Rarity Image local icon = (''):format(ark.icon, ark.page)                      -- Ark Icon local orbtype = frame:expandTemplate{title='OrbIconInline', args = {ark.orbType, 'x24px'}} -- Soul Type local etherReward = (ark.subtype == '') and (frame:expandTemplate{title='ItemsIcon', args = {name=ark.etherReward,type=ark.type,rarity=ark.rarity1,page=ark.etherReward}}) or (frame:expandTemplate{title='ItemsIcon', args = {name=ark.etherReward,type=ark.subtype,rarity=ark.rarity2,page=ark.etherReward}})  -- Ether Reward Icon local skillnames = mw.text.split(ark.sname, ' ')

local skills = {} for _, skillname in ipairs(skillnames) do               	table.insert( skills, frame:expandTemplate{title='SkillIconInline', args = {skillname}} ) -- Icon Skill to show end skills = table.concat( skills, ' ' )

tbl:tag('tr') :tag('td') -- Ark Icon + Name :tag('div') :wikitext(icon) :css('margin-top','10px') :done :tag('div') :wikitext( .. ark.name .. ) :tag('td') -- Rarity :wikitext(rarity)

:wikitext(orbtype)

:css('text-align','left') :wikitext(ark.desc) :tag('td') -- Skills :css('text-align','left') :wikitext(skills) :tag('td') -- Ether Reward :wikitext(etherReward) end

return tostring(tbl) end

return p