Module:SkinData

-- local p = {}

local lib = require('Module:Feature') local color = require('Module:Color') local skinData = mw.loadData( 'Module:SkinData/data' )

-- Key: formatname   = text    - if skin name is not _ availability  = text    - Available, Legacy or Limited distribution  = text    - for limited edition skins cost          = number  - RP price release       = date    - release date retired       = date    - for skins that were made legacy after their initial release set           = boolean - part of a "Collection" within the League Client (not for unofficial themes) neweffects    = boolean - skin features new visual or sound effects newanimations = boolean - skin features new animations (even if only a recall or dance) transforming  = boolean - skin's appearance can be changed in-game filter        = boolean - skin features a voice-filter newquotes     = boolean - skin features some unique quotes newvoice      = boolean - skin features an entirely new voiceover extras        = boolean - purchasing the skin unlocks additional content (e.g. summoner icons) chromas       = table   - skin has possible chromas (including unavailable chromas) vu            = boolean - skin has been visually upgraded above its price tier (not currently used) splashartist  = table   - splash artist(s) --

function p.skinformatname(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].formatname end

function p.skinavailability(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].availability end

function p.skindistribution(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].distribution end

function p.skincost(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].cost end

function p.skinrelease(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].release end

function p.skinretired(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].retired end

function p.skinset(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].set end

function p.skinneweffects(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].neweffects end

function p.skinnewanimations(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].newanimations end

function p.skintransforming(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].transforming end

function p.skinfilter(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].filter end

function p.skinnewquotes(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].newquotes end

function p.skinnewvoice(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].newvoice end

function p.skinextras(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].extras end

function p.skinchromas(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end local t = skinData[args[1]].skins[args[2] or "Original"].chromas local s = "" if (type(t) == "table") then for i, v in ipairs(t) do           if i ~= 1 then s = s .. ", " .. t[i] else s = t[1] end end return s   else return nil end end

function p.skinvu(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end

return skinData[args[1]].skins[args[2] or "Original"].vu end

function p.skinsplashartist(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end local t = skinData[args[1]].skins[args[2] or "Original"].splashartist local s = "" if (type(t) == "table") then for i, v in ipairs(t) do           if i ~= 1 then s = s .. ", " .. t[i] else s = t[1] end end return s   else return nil end end

function p.skinlist(frame) local s = " " return s end

-- helper functions function table.val_to_str ( v ) if "string" == type( v ) then v = string.gsub( v, "\n", "\\n" ) if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then return "'" .. v .. "'"   end return '"' .. string.gsub(v,'"', '\\"' ) .. '"' else return "table" == type( v ) and table.tostring( v ) or     tostring( v ) end end function table.key_to_str ( k ) if "string" == type( k ) and string.match( k, "^[_%a][_%a%d]*$" ) then return k else return "[" .. table.val_to_str( k ) .. "]" end end function table.tostring( tbl ) local result, done = {}, {} for k, v in ipairs( tbl ) do   table.insert( result, table.val_to_str( v ) ) done[ k ] = true end for k, v in pairs( tbl ) do   if not done[ k ] then table.insert( result,       table.key_to_str( k ) .. "=" .. table.val_to_str( v ) ) end end return "{" .. table.concat( result, "," ) .. "}" end

return p

-- --