Module:Games

--

local p = {}

local games = { ["AR1"] = "America Rising", ["AR2"] = "America Rising 2", ["WASH"] = "Washington's Malevolence", ["2D20"] = "Fallout 2d20", ["AR"] = "All Roads", ["D20"] = "Fallout Pen and Paper d20", ["FB"] = "Fallout Bible", ["FBG"] = "Fallout: The Board Game", ["FBGNC"] = "Fallout: New California", ["FILM"] = "Fallout (film)", ["FNV"] = "Fallout: New Vegas", ["FONV"] = "Fallout: New Vegas", ["FNVGRA"] = "Gun Runners' Arsenal", ["FONVGRA"] = "Gun Runners' Arsenal", ["FNVDM"] = "Dead Money", ["FONVDM"] = "Dead Money", ["FNVHH"] = "Honest Hearts", ["FONVHH"] = "Honest Hearts", ["FNVOWB"] = "Old World Blues (add-on)", ["FONVOWB"] = "Old World Blues (add-on)", ["FNVLR"] = "Lonesome Road (add-on)", ["FONVLR"] = "Lonesome Road (add-on)", ["FO1"] = "Fallout", ["FO2"] = "Fallout 2", ["FO3"] = "Fallout 3", ["FO3OA"] = "Operation: Anchorage", ["FO3TP"] = "The Pitt (add-on)", ["FO3BS"] = "Broken Steel", ["FO3PL"] = "Point Lookout (add-on)", ["FO3MZ"] = "Mothership Zeta (add-on)", ["FO4"] = "Fallout 4", ["FO4AUT"] = "Automatron (add-on)", ["FO4WW"] = "Wasteland Workshop", ["FO4FH"] = "Far Harbor (add-on)", ["FO4CW"] = "Contraptions Workshop", ["FO4VW"] = "Vault-Tec Workshop", ["FO4NW"] = "Nuka-World (add-on)", ["FO4CC"] = "Creation Club", ["FO76"] = "Fallout 76", ["FO76WA"] = "Wild Appalachia", ["FO76NW"] = "Nuclear Winter (update)", ["FO76WL"] = "Wastelanders", ["FO76LR"] = "The Legendary Run (update)", ["FO76OW"] = "One Wasteland For All", ["FO76FS"] = "Steel Dawn", ["FO76SD"] = "Steel Dawn", ["FO76LL"] = "Locked & Loaded", ["FO76SR"] = "Steel Reign", ["FO76FW"] = "Fallout Worlds", ["FO76NM"] = "Night of the Moth", ["FO76IB"] = "Invaders from Beyond", ["FO76TS"] = "Invaders from Beyond", ["FO76TYM"] = "Test Your Metal", ["FO76TP"] = "Expeditions: The Pitt", ["FO76NWT"] = "Nuka-World on Tour", ["FO76MI"] = "Mutation Invasion", ["FO76OBM"] = "Once in a Blue Moon", ["FO76S4S"] = "Shoot for the Stars", ["FO76U16"] = "Update 16", ["FO76U17"] = "Update 17", ["FO76U18"] = "Update 18", ["FO76U19"] = "Update 19", ["FO76U20"] = "Update 20", ["FO76U21"] = "Update 21", ["FO76U22"] = "Update 22", ["FO76U23"] = "Update 23", ["FO76U24"] = "Update 24", ["FO76U25"] = "Update 25", ["FO76U26"] = "Update 26", ["FO76U27"] = "Update 27", ["FO76U28"] = "Update 28", ["FO76U29"] = "Update 29", ["FO76U30"] = "Update 30", ["FO5"] = "Fallout 5", ["FOBOS"] = "Fallout: Brotherhood of Steel", ["FOBOS2"] = "Fallout: Brotherhood of Steel 2", ["FORPG"] = "Fallout: The Roleplaying Game", ["FORPGOCS"] = "Orange Coloured Sky", ["FORPGFO"] = "Fully Operational", ["FORPGWOA"] = "Winter of Atom", ["FORPGRD"] = "Rust Devils (Fallout: The Roleplaying Game)", ["FOS"] = "Fallout Shelter", ["FOSO"] = "Fallout Shelter Online", ["FOT"] = "Fallout Tactics", ["FOT2"] = "Fallout Tactics 2", ["FOTV"] = "Fallout Television Series", ["FOW"] = "Fallout: Warfare", ["FOX"] = "Fallout Extreme", ["FWW"] = "Fallout: Wasteland Warfare", ["FOWW"] = "Fallout: Wasteland Warfare", ["None"] = "Mentioned-only", ["PA"] = "One Man, and a Crate of Puppets", ["PV13"] = "Project V13", ["TAR"] = "Project V13", ["VB"] = "Van Buren", ["DOA"] = "Dawn of America", ["AOTL"] = "Attack of the Lobotomites!", ["CSEP"] = "CSEP", ["FOTF"] = "Fallout: The Frontier", ["FOCAS"] = "Fallout: Cascadia", ["FO4NV"] = "Fallout 4: New Vegas", ["FO4PA"] = "Fallout 4: Project Arroyo", ["FNM"] = "Fallout Nuevo Mexico", ["PBW"] = "Project Bygone Weapons", ["FNC"] = "Fallout: New California Mod", ["DIZ"] = "DiZco12's Lightweight Lore-Friendly Overhaul", ["TTW"] = "Tale of Two Wastelands", ["MPFO3"] = "More Perks for Fallout 3", ["MPREQ"] = "More Perks Requested for Fallout 3", ["MPOA"] = "More Perks for Operation: Anchorage", ["MPTP"] = "More Perks for The Pitt", ["MPBS"] = "More Perks for Broken Steel", ["MPPL"] = "More Perks for Point Lookout", ["MPMZ"] = "More Perks for Mothership Zeta", ["MPFNV"] = "More Perks for Fallout: New Vegas", ["MPCMP"] = "More Perks for Companions", ["MPMT"] = "More Traits for Fallout: New Vegas", ["MPDM"] = "More Perks for Dead Money", ["MPHH"] = "More Perks for Honest Hearts", ["MPOWB"] = "More Perks for Old World Blues", ["MPDF"] = "Deserter's Fortress", ["DUST"] = "DUST Survival Simulator", ["FANFIC"] = "Fanfiction", ["MOD"] = "Mod", }

-- look up short title without disambig function stitle(game) local result = games[game] if game ~= "FILM" then result = result:gsub('%s%(.*', '')   end    return result end

-- ==================== -- This function, links, is for ordinary links within the body of -- an infobox. So if all you want returned is Fallout 4, then -- use the syntax: --       -- specifying a second argument returns the text in italics: --       -- ====================

function p.links(frame) local result = '' local game_list = mw.text.split(frame.args[1], "%s*,%s*") for n, game in ipairs(game_list) do       if game:lower == "none" then result = '' else result = result ..  .. stitle(game) ..  if n ~= #game_list then result = result .. ' '           end end end if (frame.args[2] and result ~= '') then return "''" .. result .. "''"   else return result end end

-- ==================== -- This function, title, generically generates links for the supertitle. -- Either just to the game page itself or to a more specific page. -- --  gives just Fallout 4 --  results in Fallout 4 --  results in Fallout 4 weapon -- ====================

function p.title(frame) local result = '' local game_list = mw.text.split(frame.args[1], "%s*,%s*") for n, game in ipairs(game_list) do       if game:lower == "none" then result = 'Mentioned-only' if frame.args[3] then result = result .. ' ' .. frame.args[3] end else local link if frame.args[2] then link = stitle(game) .. ' ' .. frame.args[2] else link = games[game] end local text = stitle(game) if frame.args[3] and n == #game_list then text = text .. ' ' .. frame.args[3] end result = result ..  .. text ..  if n ~= #game_list then result = result .. ' / '           end end end return result end

-- ==================== -- This function, header, generically generates game name text. --  results in Fallout 4 -- ====================

function p.header(frame) local result = '' local game_list = mw.text.split(frame.args[1], "%s*,%s*") for n, game in ipairs(game_list) do       if game:lower == "none" then result = 'Mentioned-only' if frame.args[3] then result = result .. ' ' .. frame.args[3] end else local link if frame.args[2] then link = stitle(game) .. ' ' .. frame.args[2] else link = games[game] end local text = stitle(game) if frame.args[3] and n == #game_list then text = text .. ' ' .. frame.args[3] end result = result .. text if n ~= #game_list then result = result .. ' / '           end end end return result end

-- ==================== -- This function, category, generically generates categories based on the input. --  results in -- ====================

function p.category(frame) local result = '' local game_list = mw.text.split(frame.args[1], "%s*,%s*") local skip_page = frame.args if frame.args[2] then local currTitle = mw.title.getCurrentTitle local parentTitle = mw.title.new(frame:getParent:getTitle) if parentTitle.prefixedText == currTitle.prefixedText then result = "" elseif currTitle:isSubpageOf(parentTitle) ~= true then for n, game in ipairs(game_list) do		   	if game:lower ~= "none" then local category category = '' result = result .. category end end end end return result end

return p

--