Module:EternalsData

-- local p = {} local eternalsData = mw.loadData('Module:EternalsData/data') local lib      = require('Module:Feature') local color    = require('Module:Color') local FN       = require('Module:Filename') local IL       = require('Module:ImageLink') local userError = require('Dev:User error')

function p.getType(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end return eternalsData[args[1]].type or "Type not specified." end

function p.getEternal(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end return eternalsData[args[1]].eternal or "Eternal not specified." end

function p.getChampion(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end return eternalsData[args[1]].champion or "Champion not specified." end

function p.getDescription(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end return eternalsData[args[1]].description or "Description not specified." end

function p.eternallist(frame) local lang = mw.language.new( "en" ) local sdtable = mw.html.create('table') sdtable :addClass('sortable article-table nopadding sticky-header') :css('width','100%') :css('text-align','center') :newline :tag('tr') :tag('th') :css('width','26px') :done :newline :tag('th') :wikitext('Type') :done :newline :tag('th') :wikitext('Champion') :done :done :newline :tag('th') :wikitext('Description') :done :done :done :newline

local empressnode = mw.html.create('span') empressnode :css('color', 'violet') :css('font-size', 'x-large') :css('vertical-align', 'text-top') :attr('data-sort-value', "empress") :wikitext("")

local guidenode = mw.html.create('span') guidenode :css('color', 'green') :css('font-size', 'x-large') :css('font-weight', '600') :css('vertical-align', 'text-top') :attr('data-sort-value', "guide") :wikitext("")

local protectornode = mw.html.create('span') protectornode :css('color', 'yellow') :css('font-size', 'x-large') :css('vertical-align', 'text-top') :attr('data-sort-value', "protector") :wikitext("") local tricksternode = mw.html.create('span') tricksternode :css('color', 'magenta') :css('font-size', 'x-large') :css('vertical-align', 'text-top') :attr('data-sort-value', "trickster") :wikitext("") local wardennode = mw.html.create('span') wardennode :css('color', 'blue') :css('font-size', 'x-large') :css('vertical-align', 'text-top') :attr('data-sort-value', "warden") :wikitext("") local warriornode = mw.html.create('span') warriornode :css('color', 'red') :css('font-size', 'x-large') :css('vertical-align', 'text-top') :attr('data-sort-value', "warrior") :wikitext("") local eternalstable = {} for x in pairs(eternalsData) do       table.insert(eternalstable, x)    end table.sort(eternalstable)

for _, eternalname in pairs(eternalstable) do       local t = eternalsData[eternalname] local sdnode = mw.html.create('tr') local temp = ""

-- Eternal Type astring = ' ? '       if (t["eternal"] == "Empress") then astring = tostring(empressnode) end if (t["eternal"] == "Guide") then astring = tostring(guidenode) end if (t["eternal"] == "Protector") then astring = tostring(protectornode) end if (t["eternal"] == "Trickster") then astring = tostring(tricksternode) end if (t["eternal"] == "Warden") then astring = tostring(wardennode) end if (t["eternal"] == "Warrior") then astring = tostring(warriornode) end sdnode :tag('td') :tag('span') :attr('title', t["eternal"] or 'Missing') :wikitext(astring) :done

-- Name sdnode :tag('td') :addClass('eternal-icon') :attr('data-eternal', eternalname) :css('text-align', 'left') :done

-- Type if (t["type"] == "Common") then sdnode :tag('td') :attr('data-sort-value', 0) :wikitext(t["type"]) :done else sdnode :tag('td') :attr('data-sort-value', t["champion"]) :wikitext(t["champion"]) :done end

-- Description sdnode :tag('td') :wikitext(t["description"]) :done

-- Add skin row to the table sdtable :newline :node(sdnode) end -- END sdtable:allDone return tostring(sdtable) end