Fandom

Civilization

Module:Data/Civ4Col

< Module:Data

6,958pages 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
--/Fathers
--/Units
--/Goods
--/Civs
--/Leaders
--/Resources
--/Terrain
--/Traits
--/Promotions
--/Improvements
 
local p = {}
 
 --Templates
local buildingrow = [[|-
|%s
|%s
|%s
|%s
|%s
]]
 
local fatherrow = [[|-
|%s
|%s
|%s
]]
 
local unitrow= [[|-
|%s
|%s
|%s
|%s
|%s
|%s
]]
 
local goodrow = [[|-
|%s
|%s
|%s
|%s
]]
 
local resourcerow = [[|-
|%s
|%s
|%s
|%s
]]
 
local terrainrow = [[|-
|%s
|%s
|%s
|%s
|%s
|%s
|%s
|%s
|%s
|%s
|%s
|%s
|%s
]]
 
local promotionrow = [[|-
|%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"|Building required
|%s
|-
! align="left"|{{Hammer4}} required
|%s
|-
! align="left"|{{Toolc4c}} required
|%s
|-
! align="left"|{{Gunc4c}} required
|%s
|-
! align="left"|Train/purchase in Europe
|%s {{CoinsC4C}}
|-
! align="left"|Learn from [[Natives (Civ4Col)|Natives]]
|%s
|-
! align="left"|Strength
|%s %s
|-
! align="left"|Moves
|%s
|-
!colspan="2" align="center"|Notes
|-
|colspan="2"|
%s
|}</div>
{{BackArrow|List of units (Civ4Col)|See the list of units}}<br>
%s
==Civilopedia==
%s{{#if:{{NAMESPACE}} | |[[Category:Units (Civ4Col)]]}}]=]
 
local fatherpage = [=[<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"|Type
|%s
|-
!colspan="2" align="center"|Cost
|-
|%s
|%s
|-
!colspan="2" align="center"|Bonus
|-
|colspan="2"|
%s
|}</div>
{{BackArrow|Founding Fathers (Civ4Col)|See the list of founding fathers}}{{#if:{{NAMESPACE}} | |[[Category:Founding Fathers (Civ4Col)]]}}]=]
 
 
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"|Required building
|%s
|-
! align="left"|Allows
|%s
|-
! align="left"|{{Hammer4}} required
|%s
|-
! align="left"|{{Toolc4c}} required
|%s
|-
!colspan="2" align="center"|Notes
|-
|colspan="2"|
%s
|}</div>
{{BackArrow|List of buildings in Civ4Col|See the list of buildings}}<br>
%s
==Civilopedia==
%s{{#if:{{NAMESPACE}} | |[[Category:Buildings (Civ4Col)]]}}]=]
 
local goodpage = [=[<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"|Made into
|%s
|-
! align="left"|Made from
|%s
|-
!colspan="2" align="center"|Notes
|-
|colspan="2"|
%s
|}</div>
{{BackArrow|Goods (Civ4Col)|Goods}}<br>
%s
==Civilopedia==
%s{{#if:{{NAMESPACE}} | |[[Category:Goods (Civ4Col)]]}}]=]
 
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"|Leaders
|%s
|-
! align="left"|Traits
|%s
|}</div>
{{BackArrow|Civilization IV: Colonization|to Civilization IV: Colonization}}<br>
%s
==Civilopedia==
%s{{#if:{{NAMESPACE}} | |[[Category:Civilizations (Civ4Col)]]}}]=]
 
local leaderpage = [=[<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"|Civilization
|%s
|-
! align="left"|Traits
|%s
|-
|}</div>
{{BackArrow|Civilization IV: Colonization|to Civilization IV: Colonization}}<br>
%s
==Civilopedia==
%s{{#if:{{NAMESPACE}} | |[[Category:Leaders (Civ4Col)]]}}]=]
 
local traitpage = [=[<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"|Description
|-
|colspan="2"|
%s
|}</div>
{{BackArrow|Civilization IV: Colonization|to Civilization IV: Colonization}}{{#if:{{NAMESPACE}} | |[[Category:Traits (Civ4Col)]]}}]=]
 
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"|Found in
|%s
|-
! align="left"|Tile bonus
|%s
|}</div>
{{BackArrow|List of resources in Civ4Col|See the list of resources}}<br>
%s
==Civilopedia==
%s{{#if:{{NAMESPACE}} | |[[Category:Resources (Civ4Col)]]}}]=]
 
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"|[[Food (Civ4Col)|Food]] yield
|%s
|-
! align="left"|Movement cost
|%s
|-
! align="left"|Defense bonus
|%s
|-
! align="left"|[[Tobacco (Civ4Col)|Tobacco]] yield
|%s
|-
! align="left"|[[Cotton (Civ4Col)|Cotton]] yield
|%s
|-
! align="left"|[[Sugar (Civ4Col)|Sugar]] yield
|%s
|-
! align="left"|[[Furs (Civ4Col)|Furs]] yield
|%s
|-
! align="left"|[[Lumber (Civ4Col)|Lumber]] yield
|%s
|-
! align="left"|[[Ore (Civ4Col)|Ore]] yield
|%s
|-
! align="left"|[[Silver (Civ4Col)|Silver]] yield
|%s
|-
! align="left"|Bonus resources
|%s
|-
!colspan="2" align="center"|Notes
|-
|colspan="2"|
%s
|}</div>
{{BackArrow|Terrain (Civ4Col)|Terrain}}<br>
%s{{#if:{{NAMESPACE}} | |[[Category:Terrain (Civ4Col)]]}}]=]
 
local promotionpage = [=[<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"|Available to
|%s
|-
! align="left"|Special abilities
|%s
|}</div>
{{BackArrow|List of promotions in Civ4Col|See the list of promotions}}<br>
%s
{{#if:{{NAMESPACE}} | |[[Category:Promotions (Civ4Col)]]}}]=]
 
local improvementpage = [=[<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"|Yields
|%s
|-
! align="left"|Pillaging value
| ~ %s {{CoinsC4C}}
|-
!colspan="2" align="center"|Effects
|-
|colspan="2"|
%s
|}</div>
%s
{{#if:{{NAMESPACE}} | |[[Category:Improvements (Civ4Col)]]}}]=]
 
 
 
--Utility functions
local function Link(s)
	return "[["..s.." (Civ4Col)|"..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 LinkPro(t)
	local s = ""
	local first = true
	for k,v in pairs(t) do
		s = s..(first and "" or "<br/>").."[["..v.." (Promotion) (Civ4Col)|"..v.."]]"
		first = false
	end
	return s
end
 
local function LinkImp(t)
	local s = ""
	local first = true
	for k,v in pairs(t) do
		s = s..(first and "<nowiki>+</nowiki>1 " or "<br/><nowiki>+</nowiki>1 ")..Link(v)
		first = false
	end
	return s
end
 
local function attackicon(d)
        local s =""
 
        if d then
            s = "{{tooltip|{{Gunc4c}}|This unit can initiate attacks.}}"
        else
            s = "{{tooltip|{{NoMusketCol}}|This unit can only defend.}}"
        end
        return s
end
 
local function unitrowvariables(data)
        local s =""
 
        if data.hammers then
            s = s..(data.hammers or "0").." {{Hammer4}}<br>"..(data.tools or "0").." {{Toolc4c}}"
        else
            s = s..((data.train and data.train.." {{CoinsC4C}}") or "N/A")
        end
        return s
end
 
local function fatherpcosts(data)
        local s =""
 
        s = "Political [[Points (Civ4Col)|Points]]:<br>"..math.floor(data.pcost * .78).." Pilgrim<br>"..math.floor(data.pcost * 1.17).." Pioneer<br>"..math.floor(data.pcost * 1.3).." Explorer<br>"..math.floor(data.pcost * 1.43).." Conquistador<br>"..math.floor(data.pcost * 1.49).." Governor<br>"..math.floor(data.pcost * 1.56).." Patriot<br>"..math.floor(data.pcost * 1.62).." Revolutionary"
 
        return s
end
 
local function fatherocosts(data)
        local s =""
 
        if data.rcost then
            s= "Religion Points:<br>"..math.floor(data.rcost * .78).." Pilgrim<br>"..math.floor(data.rcost * 1.17).." Pioneer<br>"..math.floor(data.rcost * 1.3).." Explorer<br>"..math.floor(data.rcost * 1.43).." Conquistador<br>"..math.floor(data.rcost * 1.49).." Governor<br>"..math.floor(data.rcost * 1.56).." Patriot<br>"..math.floor(data.rcost * 1.62).." Revolutionary"
        else
            if data.tcost then
                s= "Trade Points:<br>"..math.floor(data.tcost * .78).." Pilgrim<br>"..math.floor(data.tcost * 1.17).." Pioneer<br>"..math.floor(data.tcost * 1.3).." Explorer<br>"..math.floor(data.tcost * 1.43).." Conquistador<br>"..math.floor(data.tcost * 1.49).." Governor<br>"..math.floor(data.tcost * 1.56).." Patriot<br>"..math.floor(data.tcost * 1.62).." Revolutionary"
 
            else
                if data.mcost then
                    s= "Military Points:<br>"..math.floor(data.mcost * .78).." Pilgrim<br>"..math.floor(data.mcost * 1.17).." Pioneer<br>"..math.floor(data.mcost * 1.3).." Explorer<br>"..math.floor(data.mcost * 1.43).." Conquistador<br>"..math.floor(data.mcost * 1.49).." Governor<br>"..math.floor(data.mcost * 1.56).." Patriot<br>"..math.floor(data.mcost * 1.62).." Revolutionary"
                else
                    if data.ecost then
                        s= "Exploration Points:<br>"..math.floor(data.ecost * .78).." Pilgrim<br>"..math.floor(data.ecost * 1.17).." Pioneer<br>"..math.floor(data.ecost * 1.3).." Explorer<br>"..math.floor(data.ecost * 1.43).." Conquistador<br>"..math.floor(data.ecost * 1.49).." Governor<br>"..math.floor(data.ecost * 1.56).." Patriot<br>"..math.floor(data.ecost * 1.62).." Revolutionary"
                    else
                        s = " "
                    end
                end
            end
        end
        return s
end
 
 --Public functions
function p.GetBuildingRow(frame)
	local displayname = frame.args[1]
	local name = string.gsub(displayname , " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Buildings")
	local building = data[name]
 
	return frame:preprocess(string.format(buildingrow,
	"[[Image:"..displayname.." Icon (Civ4Col).jpg|50px|link="..displayname.." (Civ4Col)]]",
	"[["..displayname.." (Civ4Col)|"..name.."]]",
	building.reqbuilding and LinkAll(building.reqbuilding) or "None",
	(building.pcost or "0").." {{Hammer4}}<br>"..(building.tcost or "0").." {{Toolc4c}}",
	building.notes or "None"))
end
 
function p.GetBuildingPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Buildings")[name]
	local vartext = frame.args[1]
 
        if vartext == "{{{1}}}" then
             vartext = ""
        end
	return frame:preprocess(string.format(buildingpage,
	name,
	"[[Image:"..PAGENAME..".png]]",
	data.reqbuilding and LinkAll(data.reqbuilding) or "None",
	data.allows and LinkAll(data.allows) or "N/A",
	data.pcost or "0",
	data.tcost or "0",
	data.notes or "None",
        vartext or "",
        data.cp))
end
 
function p.GetFatherRow(frame)
	local displayname = frame.args[1]
	local name = string.gsub(displayname , " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Fathers")
	local tech = data[name]
 
	return frame:preprocess(string.format(fatherrow,
	"[[Image:"..displayname.." (Civ4Col).png|50px|link="..displayname.." (Civ4Col)]]",
	"[["..displayname.." (Civ4Col)|"..name.."]]",
	tech.bonus or "None"))
end
 
function p.GetFatherPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Fathers")
	local tech = data[name]
 
	return frame:preprocess(string.format(fatherpage,
	name,
	"[[Image:"..PAGENAME..".png|256px]]",
	tech.type or "None",
	fatherpcosts(tech),
	fatherocosts(tech),
	tech.bonus or "None"))
end
 
function p.GetGoodRow(frame)
	local displayname = frame.args[1]
	local name = string.gsub(displayname , " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Goods")
	local tech = data[name]
 
	return frame:preprocess(string.format(goodrow,
	"[[Image:"..displayname.." (Civ4Col).png|50px|link="..displayname.." (Civ4Col)]]",
	"[["..displayname.." (Civ4Col)|"..name.."]]",
	tech.madefrom or "None",
	tech.madeinto or "None"))
end
 
function p.GetGoodPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Goods")
	local tech = data[name]
	local vartext = frame.args[1]
 
	if vartext == "{{{1}}}" then
             vartext = ""
        end
	return frame:preprocess(string.format(goodpage,
	name,
	"[[Image:"..PAGENAME..".png]]",
	tech.madeinto and Link(tech.madeinto) or "None",
	tech.madefrom and Link(tech.madefrom) or "None",
	tech.notes or "None",
        vartext or "",
        tech.cp or "None"))
end
 
function p.GetCivPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Civs")
	local tech = data[name]
	local vartext = frame.args[1]
 
	if vartext == "{{{1}}}" then
             vartext = ""
        end
	return frame:preprocess(string.format(civpage,
	name,
	"[[Image:"..PAGENAME..".png]]",
	tech.leaders and LinkAll(tech.leaders) or "None",
	tech.traits and LinkAll(tech.traits) or "None",
        vartext or "",
        tech.cp or "None"))
end
 
function p.GetLeaderPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Leaders")
	local tech = data[name]
	local vartext = frame.args[1]
 
	if vartext == "{{{1}}}" then
             vartext = ""
        end
	return frame:preprocess(string.format(leaderpage,
	name,
	"[[Image:"..PAGENAME..".png]]",
	tech.civ and Link(tech.civ) or "None",
	tech.traits and LinkAll(tech.traits) or "None",
        vartext or "",
        tech.cp or "None"))
end
 
function p.GetTraitPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Traits")[name]
 
	return frame:preprocess(string.format(traitpage,
	name,
	data.info or "None"))
end
 
function p.GetUnitRow(frame)
	local displayname = frame.args[1]
	local name = string.gsub(displayname, " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Units")
	local unit = data[name]
 
	return frame:preprocess(string.format(unitrow,
	"[[Image:"..displayname.." (Civ4Col).jpg|48px|link="..displayname.." (Civ4Col)]]",
	"[["..displayname.." (Civ4Col)|"..name.."]]",
	unit.reqbuilding and Link(unit.reqbuilding) or "None",
        unitrowvariables(unit),
	unit.strength 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/Civ4Col/Units")[name]
        local vartext = frame.args[1]
 
        if vartext == "{{{1}}}" then
             vartext = ""
        end		
	return frame:preprocess(string.format(unitpage ,
	name,
	"[[Image:"..PAGENAME..".png|300px]]",
	data.reqbuilding and Link(data.reqbuilding) or "None",
	data.hammers or "None",
	data.tools or "None",
	data.guns or "None",
	data.train or "N/A",
	data.natives or "N/A",
	data.strength or "0",
	attackicon(data.canattack),
	data.moves or "None",
	data.notes or "None",
        vartext,
        data.cp))
end
 
function p.GetResourceRow(frame)
	local displayname = frame.args[1]
	local name = string.gsub(displayname , " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Resources")
	local resource = data[name]
 
	return frame:preprocess(string.format(resourcerow,
	"[[Image:"..displayname.." (Resource) (Civ4Col).png|32px|link="..displayname.." (Resource) (Civ4Col)]]",
	"[["..displayname.." (Resource) (Civ4Col)|"..name.."]]",
	resource.found and LinkAll(resource.found) or "None",
	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/Civ4Col/Resources")[name]
        local vartext = frame.args[1]
 
        if vartext == "{{{1}}}" then
             vartext = ""
        end		
	return frame:preprocess(string.format(resourcepage,
	name,
	"[[Image:"..PAGENAME..".png|100px]]",
	data.found and LinkAll(data.found) or "None",
	data.tilebonus or "None",
        vartext,
        data.cp))
end
 
function p.GetTerrainRow(frame)
	local displayname = frame.args[1]
	local name = string.gsub(displayname , " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Terrain")
	local terrain = data[name]
 
	return frame:preprocess(string.format(terrainrow,
	"[[Image:"..displayname.." (Civ4Col).png|32px|link="..displayname.." (Civ4Col)]]",
	"[["..displayname.." (Civ4Col)|"..name.."]]",
	terrain.move or "None",
	terrain.defense or "None",
	terrain.food or "0",
	terrain.tobacco or "0",
	terrain.cotton or "0",
	terrain.sugar or "0",
	terrain.furs or "0",
	terrain.lumber or "0",
	terrain.ore or "0",
	terrain.silver or "0",
	terrain.resource and LinkAll(terrain.resource) or "None"))
end
 
function p.GetTerrainPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Terrain")[name]
        local vartext = frame.args[1]
 
        if vartext == "{{{1}}}" then
             vartext = ""
        end		
	return frame:preprocess(string.format(terrainpage,
	name,
	"[[Image:"..PAGENAME..".png|96px]]",
	data.food or "0",
	data.move or "None",
	data.defense or "None",
	data.tobacco or "0",
	data.cotton or "0",
	data.sugar or "0",
	data.furs or "0",
	data.lumber or "0",
	data.ore or "0",
	data.silver or "0",
	data.resource and LinkAll(data.resource) or "None",
	data.notes or "None",
        vartext))
end
 
function p.GetPromotionRow(frame)
	local displayname = frame.args[1]
	local name = string.gsub(displayname , " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Promotions")
	local resource = data[name]
 
	return frame:preprocess(string.format(promotionrow,
	"[[Image:"..displayname.." (Promotion) (Civ4Col).png|50px|link="..displayname.." (Promotion) (Civ4Col)]]",
	"[["..displayname.." (Promotion) (Civ4Col)|"..name.."]]",
        resource.requires and LinkPro(resource.requires) or "None",
        resource.leadsto and LinkPro(resource.leadsto) or "None",
	resource.abilities or "None"))
end
 
function p.GetPromotionPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Promotions")[name]
        local vartext = frame.args[1]
 
        if vartext == "{{{1}}}" then
             vartext = ""
        end		
	return frame:preprocess(string.format(promotionpage,
	name,
	"[[Image:"..PAGENAME..".png|100px]]",
	data.requires and LinkPro(data.requires) or "None",
	data.leadsto and LinkPro(data.leadsto) or "None",
	data.available or "None",
	data.abilities or "None",
        vartext))
end
 
function p.GetImprovementPage(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ4Col/Improvements")
	local tech = data[name]
	local vartext = frame.args[1]
 
	if vartext == "{{{1}}}" then
             vartext = ""
        end
	return frame:preprocess(string.format(improvementpage,
	name,
	"[[Image:"..PAGENAME..".png]]",
	tech.yields and LinkImp(tech.yields) or "None",
	tech.pillage or "None",
	tech.effects or "None",
        vartext or ""))
end
 
return p

Also on Fandom

Random Wiki