Module:TAvatars

-- -- @authors Noreplyz --         Shufflertoxin

-- --[[                              Module:Avatars

This module is used for rendering avatar images of content creators and is suited for games, series and shows that have a    user attached to the topic. It is to be used with Template:Infobox/Games. It is an update to creator Banners. This module is invoked using Template:Avatars.

This module is an adaptation of w:c:wookiepedia:Module:Eras.

--]] --

local p = {}

-- -- Creator Data    Here you'll find all the data that we need to generate all possible     avatars and banners. To add one, copy an existing creator data and     add your own! --

local creatorData = { lewis = { image = "Avatar Lewis 2015.png", link = "Lewis Brindley", text = "Lewis", category = "" },   simon = { image = "Avatar Simon 2015.png", link = "Simon Lane", text = "Simon", category = "" },   duncan = { image = "Avatar Duncan 2015.png", link = "Duncan Jones", text = "Duncan", category = "" },   hannah = { image = "Avatar Hannah 2015.png", link = "Hannah Rutherford", text = "Hannah", category = "" },   kim = { image = "Avatar Kim 2015.png", link = "Kim Richards", text = "Kim", category = "" },   turpster = { image = "Avatar Turps 2015.jpg", link = "Mark Turpin", text = "Turps", category = "" },   sjin = { image = "Avatar Sjin 2015 2.png", link = "Paul Sykes", text = "Sjin", category = "" },   sips = { image = "Avatar Sips 2015.png", link = "Chris Lovasz", text = "Sips", category = "" },   rythian = { image = "Rythian Logo Square.png", link = "Joakim Hellstrand", text = "Rythian", category = "" },   hatfilms = { image = "HatFilmsYouTube.jpg", link = "Hat Films", text = "Hat Films", category = "" },   toby = { image = "Avatar Toby 2015.png", link = "Toby Cottrell", text = "Toby", category = "" },   martyn = { image = "Martyn Avatar 2016 - 1.png", link = "Martyn Littlewood", text = "Martyn", category = "" },   nilesy = { image = "YOGSCASTNilesy2.png", link = "Liam MacKay", text = "Nilesy", category = "" },   bebopvox = { image = "YOGSCASTKeith.PNG", link = "Keith Steinbach", text = "BebopVox", category = "" },   zylus = { image = "YOGSCASTZylus.PNG", link = "Rick van Laanen", text = "Zylus", category = "" },   pyrion = { image = "Flaxavatar.png", link = "Ted Forsyth", text = "Pyrion Flax", category = "" },   panda = { image = "YOGSCASTPanda.PNG", link = "John Cochrane", text = "Panda", category = "" },   parv = { image = "YOGSCASTParv2.png", link = "Alex Parvis", text = "Parv", category = "" },   fyreuk = { image = "Fyreukavatar.png", link = "FyreUK", text = "FyreUK", category = "" },   zoey = { image = "YOGSCASTZoey3.png", link = "Zoey Proasheck", text = "Zoey", category = "" },   willstrife = { image = "Avatar Will 2015.png", link = "William Strife", text = "Will Strife", category = "" },   psaccess = { image = "Dasdasdasdasdasd.jpg", link = "PlayStation Access", text = "PlayStation Access‏", category = "" },   benedgar = { image = "YOGSCASTBen.png", link = "Ben Edgar", text = "Ben" },   tomclark = { image = "YOGSCASTTom2.png", link = "Tom Clark", text = "Tom Clark", category = "" },   tombates = { image = "YOGSCASTTomBates.jpeg", link = "Tom Bates" },   adrian = { image = "YOGSCASTAdrian.png", link = "Adrian Ruiz" },   alex = { image = "YOGSCASTAlex.png", link = "Alex Turner" },   matttoffolo = { image = "Batmanmarch.jpg", link = "Matt Toffolo" },   sam = { image = "YOGSCASTSam.png", link = "Sam Gibbs", text = "Sam" },   markhulmes = { image = "MarkHulmesTwitterAvatar4.png", link = "Mark Hulmes", text = "Mark" },   harry = { image = "YOGSCASTHarry.png", link = "Harry Marshall", text = "VeteranHarry" },   nina = { image = "YOGSCASTNina.png", link = "Nina-Serena" },   ceeraanoo = { image = "Ciaran.png", link = "Ciaran Askew", text = "Ceeraanoo" },   caff = { image = "CaffCast_Yogscast_2016.jpeg", link = "CaffCast", text = "Caff", category = "" },   strippin = { image = "YOGSCASTStrippin2.png", link = "Sam Thorne", text = "Strippin", category = "" },   davechaos = { image = "YOGSCASTDave2.png", link = "Dave Bagnall", text = "DaveChaos", category = "" },   chrissa = { image = "HeyChrissa_-_July_2016.jpg", link = "Christine Nicholson", text = "Chrissa", category = "" },   ridgedog = { image = "YOGSCASTRidgedog.png", link = "Steven Goates", text = "Ridgedog", category = "" },   dwp = { image = "DeadWorkersPartyYouTube.png", link = "Dead Workers Party", text = "Dead Workers Party", category = "" },   fiona = { image = "Fiona_yog_avatar.jpg", link = "Fiona Riches", text = "Fiona", category = "" },   kaeyi = { image = "YOGSCASTKaeyi.png", link = "Stephanie Louise", text = "Kaeyi Dream", category = "" }, }

-- Render icon to wikitext

function renderImage(creator) creator = string.lower(creator) local ret = {} ret[#ret + 1] = ' ' ret[#ret + 1] = '[[File:'   ret[#ret + 1] = creatorData[creator].image    ret[#ret + 1] = '|x45px' -- height is always set at 45px    if creatorData[creator].text then        ret[#ret + 1] = '|'        ret[#ret + 1] = creatorData[creator].text    end    if creatorData[creator].link then        ret[#ret + 1] = '|link='        ret[#ret + 1] = creatorData[creator].link    end    ret[#ret + 1] = ']]' if creatorData[creator].text then ret[#ret + 1] = ' '..creatorData[creator].text..' ' else ret[#ret + 1] = ' '..creatorData[creator].link..' ' end ret[#ret + 1] = ' ' return table.concat(ret) end

-- Render category to wikitext function renderCategory(creator) creator = string.lower(creator) if creatorData[creator].category then return creatorData[creator].category else return '' end end

-- remove excess stuff function value_trim(s) return s:match( "^%s*(.-)%s*$" ) end

function p.main(frame) local tArgs = frame:getParent

local ret = {} ret[#ret + 1] = ' ' -- make images local numKeys = 0 for key, value in pairs(tArgs.args) do       success, result = pcall(renderImage,tostring(key)) if success then ret[#ret + 1] = renderImage(tostring(key)) numKeys = numKeys + 1 end end ret[#ret + 1] = ' ' -- make categories for key, value in pairs(tArgs.args) do       success, result = pcall(renderCategory,tostring(key)) if success then ret[#ret + 1] = renderCategory(tostring(key)) end end ret[#ret + 1] = ' ' return table.concat(ret) end

return p --