Fandom

Civilization

Module:Data/Starships

< Module:Data

6,976pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

local p = {}
local utils = require("Module:TemplateUtils")
local baseUtils = require("Module:Data")
 
local techrow = [[|-
|%s
|%s
|%s
]]
 
local wonderrow = [[|-
|%s
|%s
|%s
]]
 
local battlecardrow = [[|-
|%s
|%s
|%s
|%s
]]
 
 
local wonderpage = [=[<div class="container-with-margins" style="float:right; max-width:402px; clear:right;">
{| class="civbetable" style="margin:0;"
|+<big><big>'''%s'''</big></big>
|colspan="2" align="center"|%s<br/>
Wonder in ''[[Sid Meier's Starships]]''
|-
!colspan="2" align="center"|Description
|-
|colspan="2"| %s
|}</div>
{{BackArrow|List of wonders in Starships|Back to the list of wonders}}{{#if:{{NAMESPACE}} | |[[Category:Wonders (Starships)]]}}]=]
 
function p.GetWonderRow(frame, articlename)
	local PAGENAME = articlename or frame.args[1]
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Starships/Wonders")
	local wonder = data[name]
	local missing = "([[Module:Data/Starships/Wonders|Information missing]])"
 
	return utils.PreProcess(frame,string.format(wonderrow,
	"[[Image:"..PAGENAME.." (Starships).png|120px]]",
	"[["..name.." (Starships)|"..name.."]]",
	wonder.description or missing))
end
 
function p.GetWonderPage(frame, articlename)
	local PAGENAME = articlename or mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Starships/Wonders")
	local wonder = data[name]
	local missing = "([[Module:Data/Starships/Wonders|Information missing]])"
 
	if wonder == nil then
		return "''Wonder infobox data not found. Check the page name or add the data to [[Module:Data/Starships/Wonders]].''[[Category:Wonders (Starships)]]"
	end
 
	return utils.PreProcess(frame,string.format(wonderpage,
	name,
	"[[Image:"..PAGENAME..".png|180px]]",
	wonder.description or missing))
end
 
 
local techpage = [=[<div class="container-with-margins" style="float:right; max-width:402px; clear:right;">
{| class="civbetable" style="margin:0;"
|+<big><big>'''%s'''</big></big>
|colspan="2" align="center"|%s<br/>
Technology in ''[[Sid Meier's Starships]]''
|-
!colspan="2" align="center"|Description
|-
|colspan="2"| %s
|}</div>
{{BackArrow|List of technologies in Starships|Back to the list of technologies}}{{#if:{{NAMESPACE}} | |[[Category:Technologies (Starships)]]}}]=]
 
function p.GetTechRow(frame, articlename)
	local PAGENAME = articlename or frame.args[1]
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Starships/Techs")
	local tech = data[name]
	local missing = "([[Module:Data/Starships/Techs|Information missing]])"
 
	return utils.PreProcess(frame,string.format(techrow,
	"[[Image:"..PAGENAME.." (Starships).png|120px]]",
	"[["..name.." (Starships)|"..name.."]]",
	tech.description or missing))
end
 
function p.GetTechPage(frame, articlename)
	local PAGENAME = articlename or mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Starships/Techs")
	local tech = data[name]
	local missing = "([[Module:Data/Starships/Techs|Information missing]])"
 
	if tech == nil then
		return "''Tech infobox data not found. Check the page name or add the data to [[Module:Data/Starships/Techs]].''[[Category:Technologies (Starships)]]"
	end
 
	return utils.PreProcess(frame,string.format(techpage,
	name,
	"[[Image:"..PAGENAME..".png|120px]]",
	tech.description or missing))
end
 
 
local battlecardpage = [=[<div class="container-with-margins" style="float:right; max-width:402px; clear:right;">
{| class="civbetable" style="margin:0;"
|+<big><big>'''%s'''</big></big>
|colspan="2" align="center"|%s<br/>
Battle Card in ''[[Sid Meier's Starships]]''
|-
! Rarity
| %s
|-
!colspan="2" align="center"|Description
|-
|colspan="2"| %s
|}</div>
{{BackArrow|List of Battle Cards in Starships|Back to the list of Battle Cards}}{{#if:{{NAMESPACE}} | |[[Category:Battle Cards (Starships)]]}}]=]
 
function p.GetBattleCardRow(frame, articlename)
	local PAGENAME = articlename or frame.args[1]
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Starships/Battle Cards")
	local bc = data[name]
	local missing = "([[Module:Data/Starships/Battle Cards|Information missing]])"
 
	return utils.PreProcess(frame,string.format(battlecardrow,
	"[[Image:"..PAGENAME:gsub("/","-").." (Starships).png|60px]]",
	"[["..name.." (Starships)|"..name.."]]",
	bc.rarity or missing,
	bc.description or missing))
end
 
function p.GetBattleCardPage(frame, articlename)
	local PAGENAME = articlename or mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Starships/Battle Cards")
	local bc = data[name]
	local missing = "([[Module:Data/Starships/Battle Cards|Information missing]])"
 
	if bc == nil then
		return "''Battle Card infobox data not found. Check the page name or add the data to [[Module:Data/Starships/Battle Cards]].''[[Category:Battle Cards (Starships)]]"
	end
 
	return utils.PreProcess(frame,string.format(battlecardpage,
	name,
	"[[Image:"..PAGENAME:gsub("/","-")..".png|120px]]",
	bc.rarity or missing,
	bc.description or missing))
end
 
local steamachievementbox = [=[{| class="steam-achievement-container"
!class="steam-achievement-image-cell" |[[Image:Steam achievement %s (Starships).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 (Starships)]]]=]
 
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/Starships/Steam_achievements")[name]
	local missing = "<small>(Is this a reference to something in popular culture? Please [[Module:Data/Starships/Steam 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/Starships/Steam 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

Also on Fandom

Random Wiki