Trigan Emperor
Prince
- Joined
- Apr 11, 2015
- Messages
- 438
I'm trying to get the game to display cities' original owner info in the city icon's tooltip infobox in the city banner.
So, in the following screenshot, I would want it to say, underneath "City of Mongolia", "Original city of Bandar Brunei (city-state)".
There are some clues about how to do it in the section of code that tells the game to add a captured capital icon, saying "Original capital of [Civilization] (captured)".
Here's a section of code from the CityBannerManager.lua file. I've inserted a gap where I think the new code is going to need to go. At the end of the code is the section ORIGINAL OWNER CAPITAL ICON, which could be useful in showing how to do it.
So, in the following screenshot, I would want it to say, underneath "City of Mongolia", "Original city of Bandar Brunei (city-state)".

There are some clues about how to do it in the section of code that tells the game to add a captured capital icon, saying "Original capital of [Civilization] (captured)".
Here's a section of code from the CityBannerManager.lua file. I've inserted a gap where I think the new code is going to need to go. At the end of the code is the section ORIGINAL OWNER CAPITAL ICON, which could be useful in showing how to do it.
Code:
-- CAPITAL ICON
if pPlayer then
local instance:table = self.m_InfoIconIM:GetInstance();
local tooltip:string = "";
if pPlayer:IsMajor() then
if pCity:IsOriginalCapital() and pCity:GetOriginalOwner() == pCity:GetOwner() then
if pCity:IsCapital() then
-- Original capitial still owned by original owner
instance.Icon:SetIcon("ICON_CITY_CAPITAL");
else
-- Former original capital
instance.Icon:SetIcon("ICON_FORMER_CAPITAL");
end
tooltip = tooltip .. Locale.Lookup("LOC_CITY_BANNER_ORIGINAL_CAPITAL_TT", pPlayerConfig:GetCivilizationShortDescription());
elseif pCity:IsCapital() then
-- New capital
instance.Icon:SetIcon("ICON_NEW_CAPITAL");
tooltip = tooltip .. Locale.Lookup("LOC_CITY_BANNER_NEW_CAPITAL_TT", pPlayerConfig:GetCivilizationShortDescription());
else
-- Other cities
instance.Icon:SetIcon("ICON_OTHER_CITIES");
tooltip = tooltip .. Locale.Lookup("LOC_CITY_BANNER_OTHER_CITY_TT", pPlayerConfig:GetCivilizationShortDescription());
end
if GameCapabilities.HasCapability("CAPABILITY_ESPIONAGE") then
if Game.GetLocalPlayer() == playerID or HasEspionageView(playerID, cityID) then
tooltip = tooltip .. Locale.Lookup("LOC_ESPIONAGE_VIEW_ENABLED_TT");
else
tooltip = tooltip .. Locale.Lookup("LOC_ESPIONAGE_VIEW_DISABLED_TT");
end
end
elseif pPlayer:IsFreeCities() then
instance.Icon:SetIcon("ICON_CIVILIZATION_FREE_CITIES");
tooltip = tooltip .. Locale.Lookup("LOC_CITY_BANNER_FREE_CITY_TT");
else
instance.Icon:SetIcon("ICON_CITY_STATE");
tooltip = tooltip .. Locale.Lookup("LOC_CITY_BANNER_CITY_STATE_TT");
end
instance.Button:SetTexture("Banner_TypeSlot");
instance.Button:RegisterCallback(Mouse.eLClick, OnCapitalIconClicked);
instance.Button:SetVoid1(playerID);
instance.Button:SetVoid2(cityID);
instance.Button:SetToolTipString(tooltip);
-- ORIGINAL OWNER CAPITAL ICON
if pCity:GetOwner() ~= pCity:GetOriginalOwner() and pCity:IsOriginalCapital() then
local pOriginalOwner:table = Players[pCity:GetOriginalOwner()];
-- Only show the captured capital icon for major civs
if pOriginalOwner:IsMajor() then
local instance:table = self.m_InfoIconIM:GetInstance();
instance.Icon:SetIcon("ICON_CAPTURED_CAPITAL");
local pOriginalOwnerConfig:table = PlayerConfigurations[pCity:GetOriginalOwner()];
instance.Button:SetToolTipString(Locale.Lookup("LOC_CITY_BANNER_CAPTURED_CAPITAL_TT", pOriginalOwnerConfig:GetCivilizationShortDescription()));
instance.Button:RegisterCallback(Mouse.eLClick, OnCapitalIconClicked);
instance.Button:SetVoid1(pCity:GetOriginalOwner());
instance.Button:SetVoid2(cityID);
end
end
end