Module:Nymphs

local nymphs = mw.loadData("Module:Nymphs/data")

local f = require('Module:Functions')

local p = {}

function rarityToNum(a) rarities = {common=1, uncommon=2, rare=3,epic=4,legendary=5} if rarities[f.lower(a)] ~= nil then return rarities[f.lower(a)] end return 999 end

function rarityToColourString(a) local tier = rarityToNum(a) if    tier == 2 then return " Uncommon" elseif tier == 3 then return " Rare" elseif tier == 4 then return " Epic" elseif tier == 5 then return " Legendary" else                 return a	end end

function releaseToNum(a) if a == 'At Launch' then return 0 end return 999 end

function p.table(frame) local data = { '==Girls List==', '{| class="wikitable mw-datatable sortable" style="text-align: center;"', '|-',       '! Name', '! Picture', '! Class', '! data-sort-type="number" | Rarity', '! data-sort-type="number" | Release Date', '|-'   }    for a, s in pairs(nymphs) do        z = nil table.insert(data, '| '..a..'') table.insert(data, '| ') table.insert(data, '|'..s.class) table.insert(data, '| data-sort-value='..rarityToNum(s.rarity)..'|'..rarityToColourString(s.rarity)) table.insert(data, '| data-sort-value='..releaseToNum(s.release)..'|'..s.release) table.insert(data, '|-') end table.insert(data, '|}') for i, d in pairs(data) do mw.log(d) end return table.concat(data, "\n") end

return p