Merkava120
Oberleutnant
This techtree already has that option, I believe.
Really? Awesome.
This techtree already has that option, I believe.
szText = (CyGame().getSymbolID(FontSymbols.GREAT_PEOPLE_CHAR), 0) + pGreatPersonCity.getName() + " (%d)" %(iGPTurns)
szText = "GreatPerson: " + pGreatPersonCity.getName() + " (%d)" %(iGPTurns)
############################################################
##########=MSM===GP Bar (Impaler)===3/4===0===
############################################################
if (not CyInterface().isCityScreenUp()):
if CyUserProfile().getGraphicOption(gc.getInfoTypeForString("GRAPHICOPTION_GREAT_PERSON_BAR")):
pGreatPersonCity, iGPTurns = self.getnextGPCity()
if (iGPTurns < 10000000 and pGreatPersonCity):
[COLOR="Magenta"]szText = "GreatPerson: " + pGreatPersonCity.getName() + " (%d)" %(iGPTurns)[/COLOR]
screen.setText( "GreatPersonBarText", "Background", szText, CvUtil.FONT_CENTER_JUSTIFY, screen.centerX(565), 31, -0.4, FontTypes.GAME_FONT, WidgetTypes.WIDGET_HELP_GREAT_PEOPLE, -1, -1 )
screen.show( "GreatPersonBarText" )
fThreshold = float( gc.getPlayer( pGreatPersonCity.getOwner() ).greatPeopleThreshold(false) )
fRate = float(pGreatPersonCity.getGreatPeopleRate())
iFirst = float(pGreatPersonCity.getGreatPeopleProgress()) / fThreshold
screen.setBarPercentage( "GreatPersonBar", InfoBarTypes.INFOBAR_STORED, iFirst )
if ( iFirst == 1 ):
screen.setBarPercentage( "GreatPersonBar", InfoBarTypes.INFOBAR_RATE, fRate / fThreshold )
else:
screen.setBarPercentage( "GreatPersonBar", InfoBarTypes.INFOBAR_RATE, fRate / fThreshold / ( 1 - iFirst ) )
screen.show( "GreatPersonBar" )
else:
screen.hide( "GreatPersonBar" )
screen.hide( "GreatPersonBarText" )
############################################################
##########=MSM===GP Bar (Impaler)===3/4===X===
############################################################
szText = (%c: %s(%d)) % (CyGame().getSymbolID(FontSymbols.GREAT_PEOPLE_CHAR), pGreatPersonCity.getName(), iGPTurns)
if CyUserProfile().getGraphicOption(gc.getInfoTypeForString("GRAPHICOPTION_GREAT_PEOPLE_BAR")):
iMinTurns = 99999
iCityID = -1
(loopCity, iter) = pPlayer.firstCity(False)
while(loopCity):
iRate = loopCity.getGreatPeopleRate()
if iRate > 0:
iTurns = (pPlayer.greatPeopleThreshold(false) - loopCity.getGreatPeopleProgress() + iRate - 1) / iRate
if iTurns < iMinTurns:
iMinTurns = iTurns
iCityID = loopCity.getID()
(loopCity, iter) = pPlayer.nextCity(iter, False)
if iCityID > -1:
pCity = pPlayer.getCity(iCityID)
screen.addStackedBarGFC( "MainGPBar", xResolution /2 - iBarWidth /2 + 32, 3 + 24, iBarWidth - 36, iStackBarHeight, InfoBarTypes.NUM_INFOBAR_TYPES, WidgetTypes.WIDGET_PYTHON, 7200 + ePlayer, iCityID)
screen.setStackedBarColors( "MainGPBar", InfoBarTypes.INFOBAR_STORED, gc.getInfoTypeForString("COLOR_GREAT_PEOPLE_STORED") )
screen.setStackedBarColors( "MainGPBar", InfoBarTypes.INFOBAR_RATE, gc.getInfoTypeForString("COLOR_GREAT_PEOPLE_RATE") )
screen.setStackedBarColors( "MainGPBar", InfoBarTypes.INFOBAR_RATE_EXTRA, gc.getInfoTypeForString("COLOR_EMPTY") )
screen.setStackedBarColors( "MainGPBar", InfoBarTypes.INFOBAR_EMPTY, gc.getInfoTypeForString("COLOR_EMPTY") )
fGreatProgress = float(pCity.getGreatPeopleProgress()) / pPlayer.greatPeopleThreshold(false)
screen.setBarPercentage( "MainGPBar", InfoBarTypes.INFOBAR_STORED, fGreatProgress)
screen.setBarPercentage( "MainGPBar", InfoBarTypes.INFOBAR_RATE, 0.0)
if fGreatProgress < 1:
screen.setBarPercentage( "MainGPBar", InfoBarTypes.INFOBAR_RATE, ( float(pCity.getGreatPeopleRate()) / (pPlayer.greatPeopleThreshold(false) - pCity.getGreatPeopleProgress())))
iGreatUnit = -1
iMaxProgress = 0
for i in xrange(len(self.lGreatPeople)):
iUnitClass = self.lGreatPeople[i]
iUnit = gc.getCivilizationInfo(pPlayer.getCivilizationType()).getCivilizationUnits(iUnitClass)
if iUnit == -1: continue
iProgress = pCity.getGreatPeopleUnitProgress(iUnit)
if iProgress > iMaxProgress:
iMaxProgress = iProgress
iGreatUnit = iUnit
screen.addTableControlGFC( "MainGPText", 1, xResolution /2 - iBarWidth /2, 4 + 24, iBarWidth, iStackBarHeight, False, False, 28, 28, TableStyles.TABLE_STYLE_EMPTY )
screen.setTableColumnHeader( "MainGPText", 0, u"", iBarWidth)
screen.appendTableRow( "MainGPText" )
sUnit = ""
sButton = ""
if iGreatUnit > -1:
sUnit = gc.getUnitInfo(iGreatUnit).getDescription()
sButton = gc.getUnitInfo(iGreatUnit).getButton()
sText = u"<font=3>%s: %s (%d)</font>" %(pCity.getName(), sUnit, iMinTurns)
screen.setTableText( "MainGPText", 0, 0, sText, sButton, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_CENTER_JUSTIFY)
screen.setHitTest( "MainGPText", HitTestTypes.HITTEST_NOHIT )
## Great People Bar ##
enum GraphicOptionTypes // Exposed to Python
{
NO_GRAPHICOPTION = -1,
GRAPHICOPTION_SINGLE_UNIT_GRAPHICS,
GRAPHICOPTION_HEALTH_BARS,
GRAPHICOPTION_CITY_DETAIL,
GRAPHICOPTION_NO_COMBAT_ZOOM,
GRAPHICOPTION_NO_ENEMY_GLOW,
GRAPHICOPTION_FROZEN_ANIMATIONS,
GRAPHICOPTION_EFFECTS_DISABLED,
GRAPHICOPTION_GLOBE_VIEW_BUILDINGS_DISABLED,
GRAPHICOPTION_FULLSCREEN,
GRAPHICOPTION_LOWRES_TEXTURES,
GRAPHICOPTION_HIRES_TERRAIN,
GRAPHICOPTION_NO_MOVIES,
GRAPHICOPTION_CITY_RADIUS,
## Equipments ##
def placeAllows(self):
screen = self.top.getScreen()
panelName = self.top.getNextWidgetName()
screen.addPanel( panelName, CyTranslator().getText("TXT_KEY_PEDIA_ALLOWS", ()), "", false, true, self.top.X_ITEMS_PANE, self.Y_ALLOWS, self.W_MAIN_PANE, self.H_REQUIRES, PanelStyles.PANEL_STYLE_BLUE50 )
for eLoopUnit in xrange(gc.getNumUnitInfos()):
bFound = False
if (eLoopUnit >= 0):
if (gc.getUnitInfo(eLoopUnit).getPrereqAndBonus() == self.iBonus):
bFound = True
else:
j = 0
while (not bFound and j < gc.getNUM_UNIT_PREREQ_OR_BONUSES()):
if (gc.getUnitInfo(eLoopUnit).getPrereqOrBonuses(j) == self.iBonus):
bFound = True
j += 1
if bFound:
szButton = gc.getUnitInfo(eLoopUnit).getButton()
if self.top.iActivePlayer != -1:
szButton = gc.getPlayer(self.top.iActivePlayer).getUnitButton(eLoopUnit)
screen.attachImageButton( panelName, "", szButton, GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, eLoopUnit, 1, False )
for eLoopBuilding in xrange(gc.getNumBuildingInfos()):
bFound = False
if (gc.getBuildingInfo(eLoopBuilding).getPrereqAndBonus() == self.iBonus):
bFound = True
else:
j = 0
while (not bFound and j < gc.getNUM_BUILDING_PREREQ_OR_BONUSES()):
if (gc.getBuildingInfo(eLoopBuilding).getPrereqOrBonuses(j) == self.iBonus):
bFound = True
j += 1
if bFound:
screen.attachImageButton( panelName, "", gc.getBuildingInfo(eLoopBuilding).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, eLoopBuilding, 1, False )
## Equipments ##
def placeAllows(self):
screen = self.top.getScreen()
panelName = self.top.getNextWidgetName()
screen.addPanel( panelName, CyTranslator().getText("TXT_KEY_PEDIA_ALLOWS", ()), "", false, true, self.top.X_ITEMS_PANE, self.Y_ALLOWS, self.W_MAIN_PANE, self.H_REQUIRES, PanelStyles.PANEL_STYLE_BLUE50 )
for i in xrange(gc.getNumUnitClassInfos()):
item = gc.getUnitClassInfo(i).getDefaultUnitIndex()
if CyGame().getActiveCivilizationType() > -1:
item = gc.getCivilizationInfo(CyGame().getActiveCivilizationType()).getCivilizationUnits(i)
if item == -1: continue
bFound = False
Info = gc.getUnitInfo(item)
if Info.getPrereqAndBonus() == self.iBonus:
bFound = True
else:
for j in xrange(gc.getNUM_UNIT_PREREQ_OR_BONUSES()):
if Info.getPrereqOrBonuses(j) == self.iBonus:
bFound = True
break
if bFound:
szButton = Info.getButton()
if self.top.iActivePlayer > -1:
szButton = gc.getPlayer(self.top.iActivePlayer).getUnitButton(item)
screen.attachImageButton(panelName, "", szButton, GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, item, 1, False )
for i in xrange(gc.getNumBuildingClassInfos()):
item = gc.getBuildingClassInfo(i).getDefaultBuildingIndex()
if CyGame().getActiveCivilizationType() > -1:
item = gc.getCivilizationInfo(CyGame().getActiveCivilizationType()).getCivilizationBuildings(i)
if item == -1: continue
bFound = False
Info = gc.getBuildingInfo(item)
if Info.getPrereqAndBonus() == self.iBonus:
bFound = True
else:
for j in xrange(gc.getNUM_BUILDING_PREREQ_OR_BONUSES()):
if Info.getPrereqOrBonuses(j) == self.iBonus:
bFound = True
break
if bFound:
screen.attachImageButton(panelName, "", Info.getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, item, 1, False )
for item in xrange(gc.getNumRouteInfos()):
bFound = False
Info = gc.getRouteInfo(item)
if Info.getPrereqBonus() == self.iBonus:
bFound = True
else:
for j in xrange(gc.getNUM_ROUTE_PREREQ_OR_BONUSES()):
if Info.getPrereqOrBonus(j) == self.iBonus:
bFound = True
break
if bFound:
screen.attachImageButton(panelName, "", Info.getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PYTHON, 6788, item, False)