Module:Abb

local p = {}

local gameList = { AR = { icon = "Gametitle-AR.png", title = "All Roads", short = "All Roads" },

D20 = { icon = "Gametitle-D20.png", title = "Fallout Pen and Paper d20", short = "Fallout d20" },

FB = { icon = "Gametitle-FB.png", title = "Fallout Bible" },

FBG = { icon = "Gametitle-FBG.png", title = "Fallout: The Board Game" },

FBGNC = { icon = "Gametitle-FBGNC.png", title = "Fallout: New California" },   FBGWW = { icon = "Gametitle-FBGWW.png", title = "Fallout: Wasteland Warfare", },   FILM = { icon = "Film.png", title = "Fallout (film)" },

FNV = { icon = "Gametitle-FNV.png", title = "Fallout: New Vegas" },   FNVCS = { icon = "Gametitle-FNV_CS.png", title = "Courier's Stash" },

FNVDM = { icon = "Gametitle-FNV_DM.png", title = "Dead Money" },   FNVGRA = { icon = "Gametitle-FNV_GRA.png", title = "Gunn Runners' Arsenal" },

FNVHH = { icon = "Gametitle-FNV_HH.png", title = "Honest Hearts" },

FNVLR = { icon = "Gametitle-FNV_LR.png", title = "Lonesome Road (add-on)", short = "Lonesome Road" },

FNVOWB = { icon = "Gametitle-FNV_OWB.png", title = "Old World Blues (add-on)", short = "Old World Blues" },

FO4 = { icon = "Gametitle-FO4.png", title = "Fallout 4", },

FO4AUT = { icon = "Gametitle-FO4_AUT.png", title = "Automatron (add-on)", short = "Automatron" },

FO4WW = { icon = "Gametitle-FO4_WW.png", title = "Wasteland Workshop" },

FO4FH = { icon = "Gametitle-FO4_FH.png", title = "Far Harbor (add-on)", short = "Far Harbor" },

FO4CW = { icon = "Gametitle-FO4_CW.png", title = "Contraptions Workshop" },

FO4VW = { icon = "Gametitle-FO4_VW.png", title = "Vault-Tec Workshop" },

FO4NW = { icon = "Gametitle-FO4_NW.png", title = "Nuka-World (add-on)", short = "Nuka-World" },

FO4VR = { icon = "Gametitle-FO4VR.png", title = "Fallout 4 VR" },

FO4CC = { icon = "Gametitle-FO4_CC.png", title = "Creation Club" },   FOS = { icon = "Gametitle-FOS.png", title = "Fallout Shelter", },

FPB = { icon = "Gametitle-FPB.png", title = "Fallout Pip-Boy" },

FO = { icon = "Gametitle-FO1.png", title = "Fallout" },

FO1 = { icon = "Gametitle-FO1.png", title = "Fallout" },

FO2 = { icon = "Gametitle-FO2.png", title = "Fallout 2" },

FO3 = { icon = "Gametitle-FO3.png", title = "Fallout 3" },

FO3BS = { icon = "Gametitle-FO3_BS.png", title = "Broken Steel" },

FO3MZ = { icon = "Gametitle-FO3_MZ.png", title = "Mothership Zeta (add-on)", short = "Mothership Zeta" },

FO3OA = { icon = "Gametitle-FO3_OA.png", title = "Operation: Anchorage (add-on)", short = "Operation: Anchorage" },

FO3PL = { icon = "Gametitle-FO3_PL.png", title = "Point Lookout (add-on)", short = "Point Lookout" },

FO3TP = { icon = "Gametitle-FO3_TP.png", title = "The Pitt (add-on)", short = "The Pitt" },

FO76 = { icon = "Gametitle-FO76.png", title = "Fallout 76" },

FO76WA = { icon = "Gametitle-FO76_WA.png", title = "Wild Appalachia" },

FO76NW = { icon = "Gametitle-FO76_NW.png", title = "Nuclear Winter" },   FO76WL = { icon = "Gametitle-FO76_WL.png", title = "Wastelanders" },

FOBOS = { icon = "Gametitle-FOBOS.png", title = "Fallout: Brotherhood of Steel", short = "Fallout: BoS" },

FOBOS2 = { icon = "Gametitle-FOBOS2.png", title = "Fallout: Brotherhood of Steel 2", short = "Fallout: BoS 2" },

FOOL = { icon = "PV13.png", title = "Project V13" },

PV13 = { icon = "PV13.png", title = "Project V13" },

FOT = { icon = "Gametitle-FOT.png", title = "Fallout Tactics: Brotherhood of Steel", short = "Fallout Tactics" },   FOT2 = { icon = "Gametitle-FOT2.png", title = "Fallout Tactics 2" },

FOW = { icon = "Gametitle-FOW.png", title = "Fallout: Warfare" },

FOX = { icon = "Gametitle-FOX.png", title = "Fallout Extreme" },

FWW = { icon = "Gametitle-FWW.png", title = "Fallout: Wasteland Warfare" },   JES = { icon = "Gametitle-JES.png", title = "J.E. Sawyer's Fallout RPG", short = "JES Fallout RPG" },

LH = { icon = "Gametitle-LH.png", title = "Lionheart" },

PA = { icon = "Penny Arcade.gif", title = "One Man, and a Crate of Puppets", short = "Penny Arcade" },

TAR = { icon = "Gametitle-TAR.jpg", title = "The Armageddon Rag", short = "Armageddon Rag" },   TORN = { icon = "Gametitle-TORN.png", title = "TORN" },   VB = { icon = "Gametitle-VB.png", title = "Van Buren" },

WIKI = { icon = "Gametitle-Wiki.png", title = "Fallout Wiki:About", short = "Nukapedia" },   NONE = { title = "mentioned-only" },

RW = { title = "real world" } }

function setTable (keys) if string.len(tostring(keys)) > 0 then result = mw.text.split(keys, ",") else result = nil end return result end

function icon(frame) local fileCount = 1 local fileOut = "" while fileCount <= abbLength do       currentFile = string.upper(abbGames[fileCount]) currentFile = abbIcon[currentFile] if currentFile ~= nil then fileOut = fileOut .. currentFile end fileCount = fileCount + 1 end return fileOut end

function p.category(frame) local keys = setTable(frame.args['games']) local category = frame.args['category'] local prepend = frame.args['prepend'] local append = frame.args['append'] local mode = frame.args['mode'] local sortKey = frame.args['sort key'] local i = 1 local result = "" if keys ~= nil then while i <= table.getn(keys) do           local currentCat = nil currentCat = keys[i] currentCat = gameList[currentCat]['title'] result = result .. "[[Category:"

if string.lower(mode) == "append" then result = result .. string.lower(category) .. " "               if prepend ~= nil then result = result .. prepend end

result = result .. currentCat

if append ~= nil then result = result .. append end else result = result .. currentCat .. " "               if prepend ~= nil then result = result .. " " .. prepend end result = result .. category if append ~= nil then result = result .. append end end

if sortKey ~= nil and string.len(sortKey) ~= 0 then result = result .. "|" .. sortKey end result = result .. "]]"           i = i + 1 end else result = "[[Category:" .. category       if sortKey ~= nil and string.len(sortKey) ~= 0 then                result = result .. "|" .. sortKey        end        result = result .. "]]" end return result end

function p.abb(frame) if frame.args[2] ~= nil then mode = string.lower(frame.args[2]) end local games = string.upper(tostring(frame.args[1])) games = mw.text.split(games, ",") length = table.getn(games) if mode == "link" or mode == "text" or mode == "short" or mode == nil then result = abbOnly(games, mode, length) end

if mode == "cat" then abbCatName = frame.args[3] abbAppend = frame.args[4] abbPrepend = frame.args[5] abbCatMode = frame.args[6] abbSort = frame.args[7] result = abbCategory(games, length, abbCatName, abbAppend, abbPrepend, abbCatMode, abbSort) end

if mode == "icon" then result = abbFile(games, length) end return result end

return p