stolenrays
Deity
- Joined
- Aug 2, 2009
- Messages
- 2,063
Platyping, what is a sample python code string to enable a graphic option? I've coded it into the DLL in CyEnumsInterface already as GRAPHICOPTION_GREAT_GENERAL_BAR
### HR - Pyramids
if not pHeadSelectedCity.isDisorder():
iPlayer = pHeadSelectedCity.getOwner()
if gc.getPlayer(iPlayer).getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_PYRAMIDS")) == 1:
if pHeadSelectedCity.isFoodProduction():
iFoodDifference += pHeadSelectedCity.getYieldRate(0) - pHeadSelectedCity.foodConsumption(False, 0)
###
iProductionDiffNoFood = pHeadSelectedCity.getCurrentProductionDifference(True, True)
iProductionDiffJustFood = (pHeadSelectedCity.getCurrentProductionDifference(False, True) - iProductionDiffNoFood)
szBuffer = u"<font=4>"
if (pHeadSelectedCity.isCapital()):
szBuffer += u"%c" %(CyGame().getSymbolID(FontSymbols.STAR_CHAR))
elif (pHeadSelectedCity.isGovernmentCenter()):
szBuffer += u"%c" %(CyGame().getSymbolID(FontSymbols.SILVER_STAR_CHAR))
if (pHeadSelectedCity.isPower()):
szBuffer += u"%c" %(CyGame().getSymbolID(FontSymbols.POWER_CHAR))
szBuffer += u"%s: %d" %(pHeadSelectedCity.getName(), pHeadSelectedCity.getPopulation())
if (pHeadSelectedCity.isOccupation()):
szBuffer += u" (%c:%d)" %(CyGame().getSymbolID(FontSymbols.OCCUPATION_CHAR), pHeadSelectedCity.getOccupationTimer())
szBuffer += u"</font>"
screen.setText( "CityNameText", "Background", szBuffer, CvUtil.FONT_CENTER_JUSTIFY, screen.centerX(512), 32, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_CITY_NAME, -1, -1 )
screen.setStyle( "CityNameText", "Button_Stone_Style" )
screen.show( "CityNameText" )
### BUG - Food Assist
if ( CityUtil.willGrowThisTurn(pHeadSelectedCity) or (iFoodDifference != 0) or not (pHeadSelectedCity.isFoodProduction() ) ):
if (CityUtil.willGrowThisTurn(pHeadSelectedCity)):
szBuffer = localText.getText("INTERFACE_CITY_GROWTH", ())
elif (iFoodDifference > 0):
### HR - Pyramids
iFoodTurnsLeft = (pHeadSelectedCity.growthThreshold() - pHeadSelectedCity.getFood()) / iFoodDifference
if (pHeadSelectedCity.growthThreshold() - pHeadSelectedCity.getFood()) % iFoodDifference > 0:
iFoodTurnsLeft += 1
###
szBuffer = localText.getText("INTERFACE_CITY_GROWING", (pHeadSelectedCity.getFoodTurnsLeft(), ))
elif (iFoodDifference < 0):
if (CityScreenOpt.isShowFoodAssist()):
iTurnsToStarve = pHeadSelectedCity.getFood() / -iFoodDifference + 1
if iTurnsToStarve > 1:
szBuffer = localText.getText("INTERFACE_CITY_SHRINKING", (iTurnsToStarve, ))
else:
szBuffer = localText.getText("INTERFACE_CITY_STARVING", ())
else:
szBuffer = localText.getText("INTERFACE_CITY_STARVING", ())
###
else:
szBuffer = localText.getText("INTERFACE_CITY_STAGNANT", ())
screen.setLabel( "PopulationText", "Background", szBuffer, CvUtil.FONT_CENTER_JUSTIFY, screen.centerX(512), iCityCenterRow1Y, -1.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
screen.setHitTest( "PopulationText", HitTestTypes.HITTEST_NOHIT )
screen.show( "PopulationText" )
### HR - Pyramids
if not pHeadSelectedCity.isDisorder():
if not pHeadSelectedCity.isFoodProduction() or gc.getPlayer(iPlayer).getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_PYRAMIDS")) == 1:
### BUG - Food Assist
if (CityScreenOpt.isShowFoodAssist()):
iFoodYield = pHeadSelectedCity.getYieldRate(YieldTypes.YIELD_FOOD)
iFoodEaten = pHeadSelectedCity.foodConsumption(False, 0)
if iFoodYield == iFoodEaten:
szBuffer = localText.getText("INTERFACE_CITY_FOOD_STAGNATE", (iFoodYield, iFoodEaten))
elif iFoodYield > iFoodEaten:
szBuffer = localText.getText("INTERFACE_CITY_FOOD_GROW", (iFoodYield, iFoodEaten, iFoodYield - iFoodEaten))
else:
szBuffer = localText.getText("INTERFACE_CITY_FOOD_SHRINK", (iFoodYield, iFoodEaten, iFoodYield - iFoodEaten))
else:
szBuffer = u"%d%c - %d%c" %(pHeadSelectedCity.getYieldRate(YieldTypes.YIELD_FOOD), gc.getYieldInfo(YieldTypes.YIELD_FOOD).getChar(), pHeadSelectedCity.foodConsumption(False, 0), CyGame().getSymbolID(FontSymbols.EATEN_FOOD_CHAR))
###
screen.setLabel( "PopulationInputText", "Background", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, iCityCenterRow1X - 6, iCityCenterRow1Y, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
screen.show( "PopulationInputText" )
else:
if not pHeadSelectedCity.isFoodProduction():
szBuffer = u"%d%c" %(iFoodDifference, gc.getYieldInfo(YieldTypes.YIELD_FOOD).getChar())
screen.setLabel( "PopulationInputText", "Background", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, iCityCenterRow1X - 6, iCityCenterRow1Y, -0.3, FontTypes.GAME_FONT,
*BugDll.widget("WIDGET_FOOD_MOD_HELP", -1, -1) )
screen.show( "PopulationInputText" )
###
## Great Zimbawee Start ##
iFoodTurnsLeft = (pHeadSelectedCity.growthThreshold() - pHeadSelectedCity.getFood()) / iFoodDifference
if (pHeadSelectedCity.growthThreshold() - pHeadSelectedCity.getFood()) % iFoodDifference > 0:
iFoodTurnsLeft += 1
## Great Zimbawee End ##
szBuffer = localText.getText("INTERFACE_CITY_GROWING", ([COLOR="Lime"]iFoodTurnsLeft[/COLOR], ))
platyping, Your mods are compatible with Caveman to Cosmos?
def canTrain(self,argsList):
pCity = argsList[0]
eUnit = argsList[1]
bContinue = argsList[2]
bTestVisible = argsList[3]
bIgnoreCost = argsList[4]
bIgnoreUpgrades = argsList[5]
## Merlion Start ##
if pCity.getNumActiveBuilding(gc.getInfoTypeForString("BUILDING_MERLION")) == true:
eUnitInfo = gc.getUnitInfo(eUnit)
if eUnitInfo.getPrereqAndBonus() != -1 or eUnitInfo.getPrereqOrBonuses(0) != -1:
pPlayer = gc.getPlayer(pCity.getOwner())
pTeam = gc.getTeam(pPlayer.getTeam())
if pTeam.isHasTech(eUnitInfo.getPrereqAndTech()) == false:
return False
i = 0
while eUnitInfo.getPrereqAndTechs(i) != -1:
if pTeam.isHasTech(eUnitInfo.getPrereqAndTechs(i)) == false:
return False
i += 1
if pCity.allUpgradesAvailable(eUnit, 0) == -1:
return True
## Merlion End ##
return False
## Merlion Start ##
if pCity.getNumActiveBuilding(gc.getInfoTypeForString("BUILDING_MERLION")):
eUnitInfo = gc.getUnitInfo(eUnit)
bRequireBonus = False
if eUnitInfo.getPrereqAndBonus() > -1:
bRequireBonus = True
if not bRequireBonus:
for iBonus in xrange(gc.getNUM_UNIT_PREREQ_OR_BONUSES()):
if eUnitInfo.getPrereqOrBonuses(iBonus) > -1:
bRequireBonus = True
break
if bRequireBonus:
pPlayer = gc.getPlayer(pCity.getOwner())
pTeam = gc.getTeam(pPlayer.getTeam())
if not pTeam.isHasTech(eUnitInfo.getPrereqAndTech()):
return False
for iTech in xrange(gc.getNUM_UNIT_AND_TECH_PREREQS()):
if eUnitInfo.getPrereqAndTechs(iTech) > -1:
if not pTeam.isHasTech(eUnitInfo.getPrereqAndTechs(iTech)):
return False
if eUnitInfo.getNukeRange() > -1:
if not CyGame().canTrainNukes():
return False
if eUnitInfo.getStateReligion() > -1:
if pPlayer.getStateReligion() != eUnitInfo.getStateReligion():
return False
if eUnitInfo.getPrereqReligion() > -1:
if not pCity.isHasReligion(eUnitInfo.getPrereqReligion()):
return False
if eUnitInfo.getPrereqCorporation() > -1:
if not pCity.isHasCorporation(eUnitInfo.getPrereqCorporation()):
return False
if eUnitInfo.getPrereqBuilding() > -1:
if not pCity.isHasBuilding(eUnitInfo.getPrereqBuilding()):
return False
iUnitClass = eUnitInfo.getUnitClassType()
UnitClassInfo = gc.getUnitClassInfo(iUnitClass)
if isWorldUnitClass(iUnitClass):
if CyGame().getUnitClassCreatedCount(iUnitClass) >= UnitClassInfo.getMaxGlobalInstances():
return False
if isTeamUnitClass(iUnitClass):
if pTeam.getUnitClassCountPlusMaking(iUnitClass) >= UnitClassInfo.getMaxTeamInstances():
return False
if isNationalUnitClass(iUnitClass):
if pPlayer.getUnitClassCountPlusMaking(iUnitClass) >= UnitClassInfo.getMaxPlayerInstances():
return False
if pCity.allUpgradesAvailable(eUnit, 0) == -1:
return True
## Platyping Wonders End ##