Fandom

Civilization

Module:Data/Civ3

< Module:Data

6,977pages 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.

--Sub pages : 
--/Buildings
--/Techs
--/Units
--/Wonders
--/Resources
--/Terrain
--/Strengths
--/Civs
 
local p = {}
 
 --Templates
local buildingrow = [[|-
|%s
|%s
|%s
|%s
|%s
|
%s
]]
 
local techrow = [[|-
|%s
|%s
|%s
|%s
|%s
|%s
]]
 
local unitrow= [[|-
|%s
|%s
|%s
|%s
|%s
|%s
]]
 
local resourcerow = [[|-
|%s
|%s
|%s
|%s
]]
 
local terrainrow = [[|-
|%s
|%s
|%s
|%s
|%s
|%s
]]
 
local strengthrow = [[|-
|%s
|%s
]]
 
local civrow = [[|-
|%s
|%s
|%s
|%s
|%s
]]
 
 
local unitpage = [=[<div class="container-with-margins" style="float:right; max-width:402px; clear:right;">
{| class="wikitable" style="margin:0;"
|+<big><big>'''%s'''</big></big>
|colspan="2" align="center"|%s
|-
! align="left"| Technology required
|%s
|-
! align="left"| Resource required
|%s
|-
! align="left"|{{shield3}} cost
|%s
|-
! align="left"|Attack/Defense
|%s
|-
! align="left"|Moves
|%s
|-
! align="left"|Bombard
|%s
|-
! align="left"|Range
|%s
|-
! align="left"|Rate of fire
|%s
|-
! align="left"|Upgrades to
|%s
|-
!colspan="2" align="center"|Notes
|-
|colspan="2"|
%s
|}</div>
{{BackArrow|List of units in Civ3|Back to the list of units}}{{#if:{{NAMESPACE}} | |[[Category:Units (Civ3)]]}}]=]
 
local techpage = [=[<div class="container-with-margins" style="float:right; max-width:402px; clear:right;">
{| class="wikitable" style="margin:0;"
|+<big><big>'''%s'''</big></big>
|colspan="2" align="center"|%s
|-
! align="left"| Requires
|%s
|-
! align="left"|Leads to
|%s
|-
! align="left"|Enables
|%s
|-
! align="left"|Obsoletes
|%s
|-
!colspan="2" align="center"|Notes
|-
|colspan="2"|
%s
|}</div>
{{BackArrow|List of advances in Civ3|Back to the list of advances}}{{#if:{{NAMESPACE}} | |[[Category:Technologies (Civ3)]]}}]=]
 
 
local buildingpage = [=[<div class="container-with-margins" style="float:right; max-width:402px; clear:right;">
{| class="wikitable" style="margin:0;"
|+<big><big>'''%s'''</big></big>
|colspan="2" align="center"|%s
|-
! align="left"| Technology required
|%s
|-
! align="left"|Resources required
|%s
|-
! align="left"|{{shield3}} cost
|%s
|-
! align="left"|Maintenance
|%s
|-
!colspan="2" align="center"|Effect
|-
|colspan="2"|
%s
|}</div>
{{BackArrow|List of buildings in Civ3|Back to the list of buildings}}{{#if:{{NAMESPACE}} | |[[Category:Buildings (Civ3)]]}}]=]
 
local wonderpage = [=[<div class="container-with-margins" style="float:right; max-width:402px; clear:right;">
{| class="wikitable" style="margin:0;"
|+<big><big>'''%s'''</big></big>
|colspan="2" align="center"|%s
|-
! align="left"| Technology required
|%s
|-
! align="left"|Resources required
|%s
|-
! align="left"|{{shield3}} cost
|%s
|-
! align="left"|Culture
|%s
|-
! align="left"|Obsoleted by
|%s
|-
!colspan="2" align="center"|Effect
|-
|colspan="2"|
%s
|-
!colspan="2" align="center"|Notes
|-
|colspan="2"|
%s
|}</div>
{{BackArrow|List of wonders in Civ3|Back to the list of wonders}}{{#if:{{NAMESPACE}} | |[[Category:Wonders (Civ3)]]}}]=]
 
local resourcepage = [=[<div class="container-with-margins" style="float:right; max-width:402px; clear:right;">
{| class="wikitable" style="margin:0;"
|+<big><big>'''%s'''</big></big>
|colspan="2" align="center"|%s
|-
! align="left"| Revealed by
|%s
|-
! align="left"|Found in
|%s
|-
! align="left"|Allows
|%s
|-
! align="left"|Tile bonus
|%s
|}</div>
{{BackArrow|List of resources in Civ3|Back to the list of resources}}{{#if:{{NAMESPACE}} | |[[Category:Resources (Civ3)]]}}]=]
 
local terrainpage = [=[<div class="container-with-margins" style="float:right; max-width:402px; clear:right;">
{| class="wikitable" style="margin:0;"
|+<big><big>'''%s'''</big></big>
|colspan="2" align="center"|%s
|-
! align="left"|Movement cost
|%s
|-
! align="left"|Defense bonus
|%s
|-
! align="left"|Food
|%s {{Food3}}
|-
! align="left"|Shields
|%s {{Shield3}}
|-
! align="left"|Commerce
|%s {{Gold3}}
|-
!colspan="2" align="center"|Notes
|-
|colspan="2"|
%s
|}</div>
{{BackArrow|List of terrains in Civ3|Back to the list of terrains}}{{#if:{{NAMESPACE}} | |[[Category:Terrain (Civ3)]]}}]=]
 
local strengthpage = [=[<div class="container-with-margins" style="max-width:402px; margin-right:auto; margin-left:auto;">
{| class="wikitable" style="margin:0;"
|+<big><big>'''%s'''</big></big>
|align="center"|%s
|}</div>
{{BackArrow|List of strengths in Civ3|Back to the list of strengths}}{{#if:{{NAMESPACE}} | |[[Category:Game concepts (Civ3)]]}}]=]
 
local civpage = [=[<div class="container-with-margins" style="float:right; max-width:402px; clear:right;">
{| class="wikitable" style="margin:0;"
|+<big><big>'''%s'''</big></big>
|colspan="2" align="center"|%s
|-
! align="left"|Leader
|%s
|-
! align="left"|Strengths
|%s
|-
! align="left"|Unique unit
|%s
|-
! align="left"|Starting<br>advances
|%s
|-
! align="left"|Aggression
|%s/5
|-
! align="left"|Favorite Government
|%s
|-
! align="left"|Shunned Government
|%s
|-
! align="left"|Culture group
|%s
|-
! align="left"|Production Emphasis
|%s
|-
!align="left"|Default Color
|style="background-color: %s"|&nbsp;
|-
!align="left"|Alternate Color
|style="background-color: %s"|&nbsp;
|-
|}</div>
{{BackArrow|List of civilizations in Civ3|Back to the list of civilizations}}{{#if:{{NAMESPACE}} | |[[Category:Civilizations (Civ3)]]}}]=]
 
--Utility functions
local function Link(s)
	return "[["..s.." (Civ3)|"..s.."]]"
end
 
local function Linkg(s)
	return "[["..s.." (government) (Civ3)|"..s.."]]"
end
 
local function LinkAll(t)
	local s = ""
	local first = true
	for k,v in pairs(t) do
		s = s..(first and "" or "<br/>")..Link(v)
		first = false
	end
	return s
end
 
local function GetTechLeadsTo(data, name)
	local leadsto = {}
	for k,v in pairs(data) do
		if v.reqtech then
			for i,j in pairs(v.reqtech) do
				if j == name then table.insert(leadsto,k) end
			end
		end
	end
	return leadsto
end
 
local function BuildingNotes(building)
	local s = ""
	if building.upgrade then
		s = "'''Upgrades to '''"..Link(building.upgrade).."\r\n"
	elseif building.reqbuilding then
		s = "'''Requires '''"..Link(building.reqbuilding).."\r\n"
	end
	return s..building.notes
end
 --Public functions
function p.GetBuildingRow(frame)
	local displayname = frame.args[1]
	local name = string.gsub(displayname , " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Buildings")
	local building = data[name]
 
	return frame:preprocess(string.format(buildingrow,
	"[[Image:"..displayname.." (Civ3).png|64px|link="..displayname.." (Civ3)]]",
	"[["..displayname.." (Civ3)|"..name.."]]",
	building.reqtech and Link(building.reqtech) or "None",
	building.cost and building.cost or "None",
	building.maintenance and building.maintenance or "None",
	BuildingNotes(building)))
end
 
function p.GetBuildingPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Buildings")[name]
 
	return frame:preprocess(string.format(buildingpage,
	name,
	"[[Image:"..PAGENAME..".png|120px]]",
	data.reqtech and Link(data.reqtech) or "None",
	data.reqresource and LinkAll(data.reqresource) or "None",
	data.cost and data.cost or "None",
	data.maintenance and data.maintenance.." {{Gold3}}" or "None",
	BuildingNotes(data)))
end
 
function p.GetTechRow(frame)
	local displayname = frame.args[1]
	local name = string.gsub(displayname , " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Techs")
	local tech = data[name]
 
	local leadsto = GetTechLeadsTo(data,name)
 
	return frame:preprocess(string.format(techrow,
	"[[Image:"..displayname.." (Civ3).png|64px|link="..displayname.." (Civ3)]]",
	"[["..displayname.." (Civ3)|"..name.."]]",
	tech.reqtech and LinkAll(tech.reqtech) or "None",
	tech.leadsto and LinkAll(tech.leadsto) or "None",
	tech.enables and LinkAll(tech.enables) or "None",
	tech.obsoletes and LinkAll(tech.obsoletes) or "None"))
end
 
function p.GetTechPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Techs")
	local tech = data[name]
 
	local leadsto = GetTechLeadsTo(data,name)
 
	return frame:preprocess(string.format(techpage,
	name,
	"[[Image:"..PAGENAME..".png|120px]]",
	tech.reqtech and LinkAll(tech.reqtech) or "None",
	tech.leadsto and LinkAll(tech.leadsto) or "None",
	tech.enables and LinkAll(tech.enables) or "None",
	tech.obsoletes and LinkAll(tech.obsoletes) or "None",
	tech.notes or "None"))
end
 
function p.GetUnitRow(frame)
	local displayname = frame.args[1]
	local name = string.gsub(displayname, " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Units")
	local unit = data[name]
 
	return frame:preprocess(string.format(unitrow,
	"[[Image:"..displayname.." (Civ3).png|64px|link="..displayname.." (Civ3)]]",
	"[["..displayname.." (Civ3)|"..name.."]]",
	unit.reqtech and Link(unit.reqtech) or "None",
	unit.cost or "None",
	(unit.attack or "0").."/"..(unit.defense or "0"),
	unit.moves or "None"))
end
 
function p.GetUnitPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Units")[name]
 
	return frame:preprocess(string.format(unitpage ,
	name,
	"[[Image:"..PAGENAME..".png|120px]]",
	data.reqtech and Link(data.reqtech) or "None",
	data.reqresource and LinkAll(data.reqresource) or "None",
	data.cost or "None",
	(data.attack or "0").."/"..(data.defense or "0"),
	data.moves or "None",
        data.bombard or "0",
	data.range or "0",
        data.rateoffire or "0",
	data.upgrade and Link(data.upgrade) or "None",
	data.notes or "None"))
end
 
function p.GetWonderPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Wonders")[name]
 
	return frame:preprocess(string.format(wonderpage,
	name,
	"[[Image:"..PAGENAME..".png|120px]]",
	data.reqtech and Link(data.reqtech) or "None",
	data.reqresource and LinkAll(data.reqresource) or "None",
	data.cost and data.cost or "None",
	data.culture and data.culture.." {{Culture3}}" or "None",
	data.obsolete and Link(data.obsolete) or "None",
	data.effect or "None",
	data.notes or "None"))
end
 
function p.GetResourceRow(frame)
	local displayname = frame.args[1]
	local name = string.gsub(displayname , " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Resources")
	local resource = data[name]
 
	return frame:preprocess(string.format(resourcerow,
	"[[Image:"..displayname.." (Civ3).png|64px|link="..displayname.." (Civ3)]]",
	"[["..displayname.." (Civ3)|"..name.."]]",
	resource.reqtech and Link(resource.reqtech) or "None",
	resource.found and LinkAll(resource.found) or "None",
	resource.tilebonus and resource.tilebonus or "None"))
end
 
function p.GetResourcePage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Resources")[name]
 
	return frame:preprocess(string.format(resourcepage,
	name,
	"[[Image:"..PAGENAME..".png|120px]]",
	data.reqtech and Link(data.reqtech) or "None",
	data.found and LinkAll(data.found) or "None",
	data.enables and LinkAll(data.enables) or "None",
	data.tilebonus or "None"))
end
 
function p.GetTerrainRow(frame)
	local displayname = frame.args[1]
	local name = string.gsub(displayname , " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Terrain")
	local terrain = data[name]
 
	return frame:preprocess(string.format(resourcerow,
	"[[Image:"..displayname.." (Civ3).png|64px|link="..displayname.." (Civ3)]]",
	"[["..displayname.." (Civ3)|"..name.."]]",
	terrain.movement or "None",
	terrain.defense or "None",
	terrain.food or "0",
	terrain.shields or "0",
	terrain.commerce or "0"))
end
 
function p.GetTerrainPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Terrain")[name]
 
	return frame:preprocess(string.format(terrainpage,
	name,
	"[[Image:"..PAGENAME..".png|120px]]",
	data.movement or "None",
	data.defense or "None",
	data.food or "0",
	data.shields or "0",
	data.commerce or "0",
	data.notes or "None"))
end
 
function p.GetStrengthRow(frame)
	local displayname = frame.args[1]
	local name = string.gsub(displayname , " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Strengths")
	local strength = data[name]
 
	return frame:preprocess(string.format(strengthrow,
	"[["..displayname.." (Civ3)|"..name.."]]",
	strength.notes or "None"))
end
 
function p.GetStrengthPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Strengths")[name]
 
	return frame:preprocess(string.format(strengthpage,
	name,
	data.notes or "None"))
end
 
function p.GetCivRow(frame)
	local displayname = frame.args[1]
	local name = string.gsub(displayname, " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Civs")
	local unit = data[name]
 
	return frame:preprocess(string.format(civrow,
	"[[Image:"..displayname.." (Civ3).png|64px|link="..displayname.." (Civ3)]]",
	"[["..displayname.." (Civ3)|"..name.."]]",
	unit.strengths and LinkAll(unit.strengths) or "None",
	unit.startingtechs and LinkAll(unit.startingtechs) or "None",
	unit.culturegroup or "None"))
end
 
function p.GetCivPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ3/Civs")[name]
 
	return frame:preprocess(string.format(civpage,
	name,
	"[[Image:"..PAGENAME..".png|130px]]",
	data.leader and Link(data.leader) or "?",
	data.strengths and LinkAll(data.strengths) or "None",
	data.unique and Link(data.unique) or "None",
	data.startingtechs and LinkAll(data.startingtechs) or "None",
        data.aggression or "0",
	data.favgov and Linkg(data.favgov) or "None",
        data.shungov and Linkg(data.shungov) or "None",
	data.culturegroup or "None",
        data.production or "None",
	data.color1 or "None",
	data.color2 or "None"))
end
return p

Also on Fandom

Random Wiki