Civilization Wiki
Advertisement
Civilization Wiki

Documentation for this module may be created at Module:Data/Civ6/doc

-- <nowiki>

local utils = require("Module:TemplateUtils")

local p = {}

local steamachievementbox = [=[{| class="steam-achievement-container"
|class="steam-achievement-image-cell" |[[File:Steam achievement %s (Civ6).jpg|64px|%s]]
|class="steam-achievement-text-cell"|<div class="steam-achievement-text-cell-inner-container"><span class="steam-achievement-name">%s</span><br/><div class="steam-achievement-description">%s
:%s</div></div>
|}[[Category:Steam achievements in Civ6]]]=]
 
local function isEmpty(param) 
	return param == nil or param == ''
end
 
function p.GetSteamAchievement(frame, articlename)
	local PAGENAME = articlename or frame.args[1]
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ6/Achievements")[name]
	local missing = "<small>(Is this a reference to something in popular culture? Please [[Module:Data/Civ6/Achievements|add the information here]]!)</small>"
 
	if data == nil then
		return "''Achievement infobox data not found for \""..name.."\". Check the parameter or add the data to [[Module:Data/Civ6/Achievements]].''"
	end
 
	return utils.PreProcess(frame,string.format(steamachievementbox,
	name, name, name,
	data.condition,
	not isEmpty(data.reference) and data.reference or missing))
end
 
return p

-- </nowiki>