def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBCorporationScreen", CvScreenEnums.WB_CORPORATION) global iSelectedPlayer global bHeadquarter global iOwnerType if inputClass.getButtonType() == WidgetTypes.WIDGET_PYTHON: if inputClass.getData1() > 7199 and inputClass.getData1() < 7300: iCityID = inputClass.getData2() iPlayerX = inputClass.getData1() - 7200 WBCityEditScreen.WBCityEditScreen( CvPlatyBuilderScreen.CvWorldBuilderScreen() ).interfaceScreen(gc.getPlayer(iPlayerX).getCity(iCityID)) elif inputClass.getData1() == 7876 or inputClass.getData1( ) == 7872: iPlayerX = inputClass.getData2() / 10000 WBPlayerScreen.WBPlayerScreen().interfaceScreen(iPlayerX) if inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 0: WBPlayerScreen.WBPlayerScreen().interfaceScreen( iSelectedPlayer) elif iIndex == 1: WBTeamScreen.WBTeamScreen().interfaceScreen( gc.getPlayer(iSelectedPlayer).getTeam()) elif iIndex == 8: WBReligionScreen.WBReligionScreen().interfaceScreen( iSelectedPlayer) elif iIndex == 10: WBGameDataScreen.WBGameDataScreen( CvPlatyBuilderScreen.CvWorldBuilderScreen( )).interfaceScreen() elif iIndex == 11: WBInfoScreen.WBInfoScreen().interfaceScreen(iSelectedPlayer) elif iIndex == 12: WBStoredDataScreen.WBStoredDataScreen( CvPlatyBuilderScreen.CvWorldBuilderScreen( )).interfaceScreen() elif iIndex == 13: WBPlayerEnabledScreen.WBPlayerEnabledScreen( self.top).interfaceScreen() elif inputClass.getFunctionName() == "OwnerType": iOwnerType = screen.getPullDownData( "OwnerType", screen.getSelectedPullDownID("OwnerType")) self.sortCities() elif inputClass.getFunctionName() == "CurrentPlayer": iSelectedPlayer = screen.getPullDownData( "CurrentPlayer", screen.getSelectedPullDownID("CurrentPlayer")) self.interfaceScreen(iSelectedPlayer) elif inputClass.getFunctionName() == "WBCityCorporations": if inputClass.getData1() == 8201: pCity = lCities[inputClass.getData()][0] if bHeadquarter: self.editHeadquarter(inputClass.getData2(), pCity) else: self.editCorporation(inputClass.getData2(), pCity, 2) self.placeCityTable() elif inputClass.getFunctionName() == "WBAllCorporations": if inputClass.getButtonType() == WidgetTypes.WIDGET_PYTHON: for (loopCity, iPlayerX) in lCities: self.editCorporation(inputClass.getData2(), loopCity, inputClass.getData1() == 6782) self.placeCityTable() elif inputClass.getFunctionName() == "SetHeadquarter": bHeadquarter = not bHeadquarter sText = "<font=3b>" + CyTranslator().getText( "TXT_KEY_CORPORATION_HEADQUARTERS", ()) + "</font>" sColor = CyTranslator().getText("[COLOR_WARNING_TEXT]", ()) if bHeadquarter: sColor = CyTranslator().getText("[COLOR_POSITIVE_TEXT]", ()) screen.modifyString("SetHeadquarter", sColor + sText + "</color>", 0) return 1
def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBPlayerUnits", CvScreenEnums.WB_UNITLIST) global iCityID global iUnitID global iCopyType global iOwnerType global iPlotType global iActivityType global iPlayer global iCityOwner global iUnitOwner pPlayer = GC.getPlayer(iPlayer) pUnitOwner = GC.getPlayer(iUnitOwner) pCityOwner = GC.getPlayer(iCityOwner) sName = inputClass.getFunctionName() if sName == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 0: WBPlayerScreen.WBPlayerScreen(self.WB).interfaceScreen(iPlayer) elif iIndex == 1: WBTeamScreen.WBTeamScreen(self.WB).interfaceScreen( pPlayer.getTeam()) elif iIndex == 2: WBProjectScreen.WBProjectScreen(self.WB).interfaceScreen( pPlayer.getTeam()) elif iIndex == 3: self.WB.goToSubScreen("TechScreen") elif iIndex == 11: WBInfoScreen.WBInfoScreen(self.WB).interfaceScreen(iPlayer) elif iIndex == 5: WBUnitScreen.WBUnitScreen(self.WB).interfaceScreen( pUnitOwner.getUnit(iUnitID)) elif iIndex == 6: WBPromotionScreen.WBPromotionScreen(self.WB).interfaceScreen( pUnitOwner.getUnit(iUnitID)) elif iIndex == 7: WBPlotScreen.WBPlotScreen(self.WB).interfaceScreen( pUnitOwner.getUnit(iUnitID).plot()) elif iIndex == 8: WBEventScreen.WBEventScreen(self.WB).interfaceScreen( pUnitOwner.getUnit(iUnitID).plot()) elif iIndex == 9: WBCityEditScreen.WBCityEditScreen(self.WB).interfaceScreen( pCityOwner.getCity(iCityID)) elif iIndex == 10: WBCityDataScreen.WBCityDataScreen(self.WB).interfaceScreen( pCityOwner.getCity(iCityID)) elif iIndex == 14: WBBuildingScreen.WBBuildingScreen(self.WB).interfaceScreen( pCityOwner.getCity(iCityID)) elif iIndex == 12: WBPlotScreen.WBPlotScreen(self.WB).interfaceScreen( pCityOwner.getCity(iCityID).plot()) elif iIndex == 13: WBEventScreen.WBEventScreen(self.WB).interfaceScreen( pCityOwner.getCity(iCityID).plot()) elif sName == "CurrentPlayer": iIndex = screen.getPullDownData( "CurrentPlayer", screen.getSelectedPullDownID("CurrentPlayer")) iCityID = -1 iUnitID = -1 self.interfaceScreen(iIndex) elif sName == "OwnerType": iOwnerType = screen.getPullDownData( "OwnerType", screen.getSelectedPullDownID("OwnerType")) if iCityOwner != iPlayer: iCityID = -1 if iUnitOwner != iPlayer: iUnitID = -1 self.sortCities() self.sortUnits() elif sName == "PlotType": iPlotType = screen.getPullDownData( "PlotType", screen.getSelectedPullDownID("PlotType")) if iCityOwner != iPlayer: iCityID = -1 if iUnitOwner != iPlayer: iUnitID = -1 self.sortCities() self.sortUnits() elif sName == "CopyType": iCopyType = screen.getPullDownData( "CopyType", screen.getSelectedPullDownID("CopyType")) self.sortUnits() screen.hide("ActivityType") if iCopyType == 5: screen.show("ActivityType") elif sName == "ActivityType": iActivityType = screen.getPullDownData( "ActivityType", screen.getSelectedPullDownID("ActivityType")) self.sortUnits() elif sName == "GoToCity": WBCityEditScreen.WBCityEditScreen(self.WB).interfaceScreen( pCityOwner.getCity(iCityID)) elif sName == "GoToUnit": WBUnitScreen.WBUnitScreen(self.WB).interfaceScreen( pUnitOwner.getUnit(iUnitID)) elif sName == "WBCityList": if inputClass.getData1() == 7872: iCityOwner = inputClass.getData2() / 10000 WBPlayerScreen.WBPlayerScreen( self.WB).interfaceScreen(iCityOwner) else: iCityID = inputClass.getData2() iCityOwner = inputClass.getData1() - 7200 self.placeCurrentCity() self.placeCityMap() elif sName == "DeleteCurrentCity": if pCityOwner: pCity = pCityOwner.getCity(iCityID) if not pCity: pCity.kill() iCityID = -1 self.sortCities() self.addPageSwitch() elif sName == "DeleteAllCities": for item in lCities: pPlayerX = GC.getPlayer(item[0]) pPlayerX.getCity(item[1]).kill() iCityID = -1 self.sortCities() self.addPageSwitch() elif sName == "WBUnitList": if inputClass.getData1() == 1043: return elif inputClass.getData1() == 7872: iUnitOwner = inputClass.getData2() / 10000 WBPlayerScreen.WBPlayerScreen( self.WB).interfaceScreen(iUnitOwner) else: iUnitID = inputClass.getData2() iUnitOwner = inputClass.getData1() - 8300 self.placeCurrentUnit() self.placeUnitMap() elif sName == "DeleteCurrentUnit": if pUnitOwner: pUnit = pUnitOwner.getUnit(iUnitID) if not pUnit.isNone(): pUnit.kill(False, PlayerTypes.NO_PLAYER) iUnitID = -1 self.sortUnits() self.addPageSwitch() elif sName == "DeleteAllUnits": for item in lUnits: pPlayerX = GC.getPlayer(item[0]) pPlayerX.getUnit(item[1]).kill(False, PlayerTypes.NO_PLAYER) iUnitID = -1 self.sortUnits() self.addPageSwitch() elif sName == "EndCurrentUnit": if pUnitOwner: pUnit = pUnitOwner.getUnit(iUnitID) if not pUnit.isNone(): pUnit.finishMoves() self.placeCurrentUnit() elif sName == "EndAllUnits": for item in lUnits: pPlayerX = GC.getPlayer(item[0]) pPlayerX.getUnit(item[1]).finishMoves() self.placeCurrentUnit() return
def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBCityEditScreen", CvScreenEnums.WB_CITYEDIT) global iChange global iOwnerType global iPlotType if inputClass.getFunctionName() == "ChangeBy": iChange = screen.getPullDownData( "ChangeBy", screen.getSelectedPullDownID("ChangeBy")) elif inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 1: WBCityDataScreen.WBCityDataScreen( self.WB).interfaceScreen(pCity) elif iIndex == 2: WBBuildingScreen.WBBuildingScreen( self.WB).interfaceScreen(pCity) elif iIndex == 3: WBPlayerScreen.WBPlayerScreen(self.WB).interfaceScreen(iPlayer) elif iIndex == 4: WBTeamScreen.WBTeamScreen(self.WB).interfaceScreen( pCity.getTeam()) elif iIndex == 5: WBPlayerUnits.WBPlayerUnits(self.WB).interfaceScreen(iPlayer) elif iIndex == 6: WBPlotScreen.WBPlotScreen(self.WB).interfaceScreen( pCity.plot()) elif iIndex == 7: WBEventScreen.WBEventScreen(self.WB).interfaceScreen( pCity.plot()) elif iIndex == 8: WBReligionScreen.WBReligionScreen( self.WB).interfaceScreen(iPlayer) elif iIndex == 9: WBCorporationScreen.WBCorporationScreen( self.WB).interfaceScreen(iPlayer) elif iIndex == 11: WBInfoScreen.WBInfoScreen(self.WB).interfaceScreen(iPlayer) elif inputClass.getFunctionName() == "OwnerType": iOwnerType = screen.getPullDownData( "OwnerType", screen.getSelectedPullDownID("OwnerType")) self.sortCities() elif inputClass.getFunctionName() == "PlotType": iPlotType = screen.getPullDownData( "PlotType", screen.getSelectedPullDownID("PlotType")) self.sortCities() elif inputClass.getFunctionName() == "CurrentCity": iPlayerX = inputClass.getData1() - 7200 pPlayerX = GC.getPlayer(iPlayerX) if pPlayerX: self.interfaceScreen(pPlayerX.getCity(inputClass.getData2())) elif inputClass.getFunctionName() == "CityName": import CvEventInterface CvEventInterface.getEventManager().beginEvent(5000, (pCity, True)) elif inputClass.getFunctionName() == "CityOwner": iIndex = screen.getSelectedPullDownID("CityOwner") GC.getPlayer(screen.getPullDownData("CityOwner", iIndex)).acquireCity( pCity, False, True) self.interfaceScreen(pPlot.getPlotCity()) elif inputClass.getFunctionName().find("BaseYield") > -1: iYield = YieldTypes(inputClass.getData2()) if inputClass.getData1() == 1030: pCity.changeBaseYieldRate(iYield, iChange) elif inputClass.getData1() == 1031: pCity.changeBaseYieldRate( iYield, -min(iChange, pCity.getBaseYieldRate(iYield))) self.placeStats() elif inputClass.getFunctionName().find("CityPopulation") > -1: if inputClass.getData1() == 1030: pCity.changePopulation(iChange) elif inputClass.getData1() == 1031: pCity.changePopulation(-min(iChange, pCity.getPopulation())) self.placeStats() elif inputClass.getFunctionName().find("CityFood") > -1: if inputClass.getData1() == 1030: pCity.changeFood( min(iChange, pCity.growthThreshold() - pCity.getFood())) elif inputClass.getData1() == 1031: pCity.changeFood(-min(iChange, pCity.getFood())) self.placeStats() elif inputClass.getFunctionName().find("CityDefense") > -1: if inputClass.getData1() == 1030: pCity.changeDefenseDamage( min( iChange, GC.getMAX_CITY_DEFENSE_DAMAGE() - pCity.getDefenseDamage())) elif inputClass.getData1() == 1031: pCity.changeDefenseDamage( -min(iChange, pCity.getDefenseDamage())) self.placeStats() elif inputClass.getFunctionName().find("CityTradeRoute") > -1: if inputClass.getData1() == 1030: pCity.changeExtraTradeRoutes( min(iChange, pCity.getMaxTradeRoutes() - pCity.getTradeRoutes())) elif inputClass.getData1() == 1031: pCity.changeExtraTradeRoutes( -min(iChange, pCity.getTradeRoutes())) self.placeStats() elif inputClass.getFunctionName().find("CityChangeCulture") > -1: if inputClass.getData1() == 1030: pCity.changeCulture(iPlayer, iChange, True) elif inputClass.getData1() == 1031: pCity.changeCulture(iPlayer, -min(iChange, pCity.getCulture(iPlayer)), True) self.placeStats() elif inputClass.getFunctionName() == ("CityCultureLevel"): iIndex = screen.getSelectedPullDownID("CityCultureLevel") if iIndex == 0: pCity.setOccupationTimer(max(1, pCity.getOccupationTimer())) else: pCity.setOccupationTimer(0) pCity.setCulture( iPlayer, GC.getCultureLevelInfo(iIndex).getSpeedThreshold( CyGame().getGameSpeedType()), True) self.placeStats() elif inputClass.getFunctionName().find("CityChangeHappy") > -1: if inputClass.getData1() == 1030: pCity.changeExtraHappiness(iChange) elif inputClass.getData1() == 1031: pCity.changeExtraHappiness(-iChange) self.placeStats() elif inputClass.getFunctionName().find("CityChangeHealth") > -1: if inputClass.getData1() == 1030: pCity.changeExtraHealth(iChange) elif inputClass.getData1() == 1031: pCity.changeExtraHealth(-iChange) self.placeStats() elif inputClass.getFunctionName().find("CityOccupationTurn") > -1: if inputClass.getData1() == 1030: pCity.changeOccupationTimer(iChange) elif inputClass.getData1() == 1031: pCity.changeOccupationTimer( -min(iChange, pCity.getOccupationTimer())) self.placeStats() elif inputClass.getFunctionName().find("CityDraftAnger") > -1: if inputClass.getData1() == 1030: pCity.changeConscriptAngerTimer(iChange) elif inputClass.getData1() == 1031: pCity.changeConscriptAngerTimer( -min(iChange, pCity.getConscriptAngerTimer())) self.placeStats() elif inputClass.getFunctionName().find("CityHurryAnger") > -1: if inputClass.getData1() == 1030: pCity.changeHurryAngerTimer(iChange) elif inputClass.getData1() == 1031: pCity.changeHurryAngerTimer( -min(iChange, pCity.getHurryAngerTimer())) self.placeStats() elif inputClass.getFunctionName().find("CityDefyResolution") > -1: if inputClass.getData1() == 1030: pCity.changeDefyResolutionAngerTimer(iChange) elif inputClass.getData1() == 1031: pCity.changeDefyResolutionAngerTimer( -min(iChange, pCity.getDefyResolutionAngerTimer())) self.placeStats() elif inputClass.getFunctionName().find("CityEspionageHappy") > -1: if inputClass.getData1() == 1030: pCity.changeEspionageHappinessCounter(iChange) elif inputClass.getData1() == 1031: pCity.changeEspionageHappinessCounter( -min(iChange, pCity.getEspionageHappinessCounter())) self.placeStats() elif inputClass.getFunctionName().find("CityEspionageHealth") > -1: if inputClass.getData1() == 1030: pCity.changeEspionageHealthCounter(iChange) elif inputClass.getData1() == 1031: pCity.changeEspionageHealthCounter( -min(iChange, pCity.getEspionageHealthCounter())) self.placeStats() elif inputClass.getFunctionName().find("CityTemporaryHappy") > -1: if inputClass.getData1() == 1030: pCity.changeHappinessTimer(iChange) elif inputClass.getData1() == 1031: pCity.changeHappinessTimer( -min(iChange, pCity.getHappinessTimer())) self.placeStats() elif inputClass.getFunctionName() == "WBCityProduction": self.handlePlatyChooseProduction(inputClass) self.placeProduction() elif inputClass.getFunctionName().find("CurrentProduction") > -1: if inputClass.getData1() == 1030: pCity.changeProduction( min(iChange, pCity.getProductionNeeded() - pCity.getProduction())) elif inputClass.getData1() == 1031: pCity.changeProduction(-min(iChange, pCity.getProduction())) self.placeProduction() elif inputClass.getFunctionName().find("CityEditScriptData") > -1: popup = Popup.PyPopup(2222, EventContextTypes.EVENTCONTEXT_ALL) popup.setHeaderString(CyTranslator().getText( "TXT_KEY_WB_SCRIPT", ())) popup.setUserData((pCity.getOwner(), pCity.getID())) popup.createEditBox(pCity.getScriptData()) popup.launch() return elif inputClass.getFunctionName() == "Commands": iIndex = screen.getPullDownData( "Commands", screen.getSelectedPullDownID("Commands")) if iIndex == 5: pCity.kill() else: self.WB.iMoveCity = pCity.getID() self.WB.iCurrentPlayer = iPlayer if iIndex == 1: self.WB.iPlayerAddMode = "MoveCity" elif iIndex == 2: self.WB.iPlayerAddMode = "DuplicateCity" elif iIndex == 3: self.WB.iPlayerAddMode = "MoveCityPlus" self.WB.lMoveUnit = [] for pUnitX in pPlot.units(): if pUnitX.getOwner() == iPlayer: self.WB.lMoveUnit.append([iPlayer, pUnitX.getID()]) elif iIndex == 4: self.WB.iPlayerAddMode = "DuplicateCityPlus" self.WB.lMoveUnit = [] for pUnitX in pPlot.units(): if pUnitX.getOwner() == iPlayer: self.WB.lMoveUnit.append([iPlayer, pUnitX.getID()]) screen.hideScreen() return 1
def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBGameDataScreen", CvScreenEnums.WB_GAMEDATA) global iChange global bHiddenOption global bRepeat global iSelectedCiv global iSelectedLeader if inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 8: WBReligionScreen.WBReligionScreen().interfaceScreen( self.top.m_iCurrentPlayer) elif iIndex == 9: WBCorporationScreen.WBCorporationScreen().interfaceScreen( self.top.m_iCurrentPlayer) elif iIndex == 11: WBInfoScreen.WBInfoScreen().interfaceScreen( self.top.m_iCurrentPlayer) elif inputClass.getFunctionName() == "ChangeBy": iChange = screen.getPullDownData( "ChangeBy", screen.getSelectedPullDownID("ChangeBy")) elif inputClass.getFunctionName().find("StartYear") > -1: if inputClass.getData1() == 1030: CyGame().setStartYear(CyGame().getStartYear() + iChange) elif inputClass.getData1() == 1031: CyGame().setStartYear(CyGame().getStartYear() - iChange) self.placeStats() elif inputClass.getFunctionName().find("MaxCityElimination") > -1: if inputClass.getData1() == 1030: CyGame().setMaxCityElimination( CyGame().getMaxCityElimination() + iChange) elif inputClass.getData1() == 1031: CyGame().setMaxCityElimination( max(0, CyGame().getMaxCityElimination() - iChange)) self.placeStats() elif inputClass.getFunctionName().find("GameTurn") > -1: if inputClass.getData1() == 1030: iChange = min( iChange, CyGame().getMaxTurns() - CyGame().getElapsedGameTurns()) CyGame().setGameTurn(CyGame().getGameTurn() + iChange) CyGame().changeMaxTurns(-iChange) elif inputClass.getData1() == 1031: iChange = min(CyGame().getGameTurn(), iChange) CyGame().setGameTurn(CyGame().getGameTurn() - iChange) CyGame().changeMaxTurns(iChange) self.placeStats() elif inputClass.getFunctionName().find("TargetScore") > -1: if inputClass.getData1() == 1030: CyGame().setTargetScore(CyGame().getTargetScore() + iChange) elif inputClass.getData1() == 1031: CyGame().setTargetScore( max(0, CyGame().getTargetScore() - iChange)) self.placeStats() elif inputClass.getFunctionName().find("EstimateEndTurn") > -1: if inputClass.getData1() == 1030: CyGame().setEstimateEndTurn(CyGame().getEstimateEndTurn() + iChange) elif inputClass.getData1() == 1031: CyGame().setEstimateEndTurn( max(0, CyGame().getEstimateEndTurn() - iChange)) self.placeStats() elif inputClass.getFunctionName().find("NukesExploded") > -1: if inputClass.getData1() == 1030: CyGame().changeNukesExploded(iChange) elif inputClass.getData1() == 1031: CyGame().changeNukesExploded( -min(CyGame().getNukesExploded(), iChange)) self.placeStats() elif inputClass.getFunctionName().find("MaxTurns") > -1: if inputClass.getData1() == 1030: CyGame().changeMaxTurns(iChange) elif inputClass.getData1() == 1031: CyGame().changeMaxTurns(-min(CyGame().getMaxTurns(), iChange)) self.placeStats() #Magister Start elif inputClass.getFunctionName().find("GlobalCounter") > -1: iChange2 = max(1, iChange * CyGame().getGlobalCounterLimit() / 100) if inputClass.getData1() == 1030: CyGame().changeGlobalCounter(iChange2) elif inputClass.getData1() == 1031: CyGame().changeGlobalCounter(-iChange2) self.placeStats() elif inputClass.getFunctionName().find("GlobalLimitCounter") > -1: if inputClass.getData1() == 1030: CyGame().changeGlobalCounterLimit(iChange) elif inputClass.getData1() == 1031: CyGame().changeGlobalCounterLimit(-iChange) self.placeStats() elif inputClass.getFunctionName().find("ScenarioCounter") > -1: if inputClass.getData1() == 1030: CyGame().changeScenarioCounter(iChange) elif inputClass.getData1() == 1031: CyGame().changeScenarioCounter(-iChange) self.placeStats() #Magister Stop elif inputClass.getFunctionName().find("TradeRoutes") > -1: if inputClass.getData1() == 1030: CyGame().changeTradeRoutes( min( iChange, gc.getDefineINT("MAX_TRADE_ROUTES") - gc.getDefineINT("INITIAL_TRADE_ROUTES") - CyGame().getTradeRoutes())) elif inputClass.getData1() == 1031: CyGame().changeTradeRoutes( -min(CyGame().getTradeRoutes(), iChange)) self.placeStats() elif inputClass.getFunctionName().find("AIAutoPlay") > -1: if inputClass.getData1() == 1030: CyGame().setAIAutoPlay(CyGame().getAIAutoPlay() + iChange) elif inputClass.getData1() == 1031: CyGame().setAIAutoPlay( max(0, CyGame().getAIAutoPlay() - iChange)) self.placeStats() elif inputClass.getFunctionName() == "WBGameOptions": iGameOption = inputClass.getData2() CyGame().setOption(iGameOption, not CyGame().isOption(iGameOption)) self.checkOptions(iGameOption) self.placeGameOptions() elif inputClass.getFunctionName() == "HiddenOptions": bHiddenOption = not bHiddenOption self.placeGameOptions() elif inputClass.getFunctionName() == "AllowsRepeat": bRepeat = not bRepeat iSelectedCiv = -1 iSelectedLeader = -1 self.placeNewPlayer() elif inputClass.getFunctionName() == "WBNewCiv": iSelectedCiv = inputClass.getData2() iSelectedLeader = -1 self.interfaceScreen() elif inputClass.getFunctionName() == "WBNewLeader": iSelectedLeader = inputClass.getData2() self.interfaceScreen() elif inputClass.getFunctionName() == "CreatePlayer": for i in xrange(gc.getMAX_CIV_PLAYERS()): if not gc.getPlayer(i).isEverAlive(): CyGame().addPlayer(i, iSelectedLeader, iSelectedCiv, True) #MNAI adds a bSetAlive parameter break screen.hideScreen() self.top.m_iCurrentPlayer = i self.top.normalPlayerTabModeCB() elif inputClass.getFunctionName() == "GameEditScriptData": popup = Popup.PyPopup(4444, EventContextTypes.EVENTCONTEXT_ALL) popup.setHeaderString(CyTranslator().getText( "TXT_KEY_WB_SCRIPT", ())) popup.createEditBox(CyGame().getScriptData()) popup.launch() return 1
def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBPromotionScreen", CvScreenEnums.WB_PROMOTION) global bApplyAll global iChangeType global iPlotType global iCopyType global iOwnerType global iSelectedClass if inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 0: WBUnitScreen.WBUnitScreen( CvPlatyBuilderScreen.CvWorldBuilderScreen( )).interfaceScreen(pUnit) elif iIndex == 2: WBPlayerScreen.WBPlayerScreen().interfaceScreen( pUnit.getOwner()) elif iIndex == 3: WBTeamScreen.WBTeamScreen().interfaceScreen(pUnit.getTeam()) elif iIndex == 4: WBPlotScreen.WBPlotScreen().interfaceScreen(pPlot) elif iIndex == 5: WBEventScreen.WBEventScreen().interfaceScreen(pPlot) elif iIndex == 6: WBPlayerUnits.WBPlayerUnits().interfaceScreen(pUnit.getOwner()) elif iIndex == 11: WBInfoScreen.WBInfoScreen().interfaceScreen(pUnit.getOwner()) elif inputClass.getFunctionName() == "ChangeType": iChangeType = screen.getPullDownData( "ChangeType", screen.getSelectedPullDownID("ChangeType")) elif inputClass.getFunctionName() == "OwnerType": iOwnerType = screen.getPullDownData( "OwnerType", screen.getSelectedPullDownID("OwnerType")) self.sortUnits() elif inputClass.getFunctionName() == "PlotType": iPlotType = screen.getPullDownData( "PlotType", screen.getSelectedPullDownID("PlotType")) self.sortUnits() elif inputClass.getFunctionName() == "CopyType": iCopyType = screen.getPullDownData( "CopyType", screen.getSelectedPullDownID("CopyType")) self.sortUnits() elif inputClass.getFunctionName() == "WBCurrentUnit": iPlayer = inputClass.getData1() - 8300 self.interfaceScreen( gc.getPlayer(iPlayer).getUnit(inputClass.getData2())) elif inputClass.getFunctionName() == "CombatClass": iSelectedClass = screen.getPullDownData( "CombatClass", screen.getSelectedPullDownID("CombatClass")) self.sortPromotions() elif inputClass.getFunctionName() == "WBPromotion": self.editPromotion(inputClass.getData2()) self.placePromotions() elif inputClass.getFunctionName() == "PromotionAll": for item in lList: self.editPromotion(item[1]) self.placePromotions() elif inputClass.getFunctionName() == "ApplyAll": bApplyAll = not bApplyAll sText = u"<font=3b>" + CyTranslator().getText( "TXT_KEY_WB_COPY_ALL", (CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_UNIT", ()), )) + "</font>" sColor = CyTranslator().getText("[COLOR_WARNING_TEXT]", ()) if bApplyAll: sColor = CyTranslator().getText("[COLOR_POSITIVE_TEXT]", ()) screen.modifyString("ApplyAll", sColor + sText + "</color>", 0) elif inputClass.getFunctionName() == "HideInactive": CvPlatyBuilderScreen.bHideInactive = not CvPlatyBuilderScreen.bHideInactive CvPlatyBuilderScreen.CvWorldBuilderScreen().refreshSideMenu() sText = u"<font=3b>" + CyTranslator().getText( "TXT_KEY_PEDIA_HIDE_INACTIVE", ()) + "</font>" sColor = CyTranslator().getText("[COLOR_WARNING_TEXT]", ()) if CvPlatyBuilderScreen.bHideInactive: sColor = CyTranslator().getText("[COLOR_POSITIVE_TEXT]", ()) screen.setText("HideInactive", "Background", sColor + sText + "</color>", CvUtil.FONT_RIGHT_JUSTIFY, screen.getXResolution() - 20, self.iTable_Y - 80, -0.1, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1) self.sortPromotions() return 1
def handleInput(self, inputClass, screen): HandleInputUtil.debugInput(inputClass) bAlt, bCtrl, bShift = self.InputData.getModifierKeys() iCode = inputClass.eNotifyCode iData = inputClass.iData ID = inputClass.iItemID NAME = inputClass.szFunctionName szFlag = HandleInputUtil.MOUSE_FLAGS.get(inputClass.uiFlags, "UNKNOWN") if iCode == 6: # Character if iData == 1: if self.bInEditBox: self.closeEditBox(screen, False) else: self.exit(screen) return 1 return 0 elif iCode in (16, 17): return 0 szSplit = NAME.split("|") BASE = szSplit[0] if szSplit[1:]: TYPE = szSplit[1] else: TYPE = "" if szSplit[2:]: CASE = szSplit[2:] else: CASE = [""] if iCode == 4: # Mouse Enter if NAME == "GameOption": self.WB.updateTooltip(screen, self.GC.getGameOptionInfo(ID).getHelp()) elif not iCode: # click if BASE == "SpinBox": if bCtrl: if szFlag == "MOUSE_RBUTTONUP": iInc = -1 else: iInc = 1 aList = (TYPE, CASE, NAME) if TYPE == "Date": if CASE[0] == "StartYear": if bCtrl: self.applySpinBoxData( None, (aList, self.GAME.getStartYear() + iInc)) else: self.initSpinBox(aList, self.GAME.getStartYear(), 1, 10000000, -10000000, self.szStartYear) elif CASE[0] == "GameTurn": if bCtrl: iNewValue = self.GAME.getGameTurn() + iInc if iNewValue > -1: self.applySpinBoxData(None, (aList, iNewValue)) else: self.initSpinBox(aList, self.GAME.getGameTurn(), 1, 10000000, 0, self.szGameTurn) elif CASE[0] == "MaxTurns": if bCtrl: iNewValue = self.GAME.getMaxTurns() + iInc if iNewValue > -1: self.applySpinBoxData(None, (aList, iNewValue)) else: self.initSpinBox(aList, self.GAME.getMaxTurns(), 1, 10000000, 0, self.szMaxTurns) elif TYPE == "MaxCityElimination": if bCtrl: iNewValue = self.GAME.getMaxCityElimination() + iInc if iNewValue > -1: self.applySpinBoxData(None, (aList, iNewValue)) else: self.initSpinBox(aList, self.GAME.getMaxCityElimination(), 1, 10000000, 0, self.szMaxCityElimination) elif TYPE == "TargetScore": if bCtrl: iNewValue = self.GAME.getTargetScore() + iInc if iNewValue > -1: self.applySpinBoxData(None, (aList, iNewValue)) else: self.initSpinBox(aList, self.GAME.getTargetScore(), 1, 10000000, 0, self.szTargetScore) elif TYPE == "NukesExploded": if bCtrl: iNewValue = self.GAME.getNukesExploded() + iInc if iNewValue > -1: self.applySpinBoxData(None, (aList, iNewValue, iInc)) else: self.initSpinBox(aList, self.GAME.getNukesExploded(), 1, 10000000, 0, self.szNukesExploded) elif TYPE == "TradeRoutes": if bCtrl: iNewValue = self.GAME.getTradeRoutes() + iInc if iNewValue > -1: self.applySpinBoxData(None, (aList, iNewValue, iInc)) else: self.initSpinBox(aList, self.GAME.getTradeRoutes(), 1, 10000000, 0, self.szTradeRoutes) elif BASE == "PullDown": aList = (TYPE, CASE, NAME) if TYPE == "CircumnavigatedGlobe": self.initPullDown(aList, self.GAME.getCircumnavigatedTeam(), self.szCircumnavigatedGlobe) elif BASE == "ScriptData": if TYPE == "Btn": self.initEditBox(screen) elif TYPE == "Ok": self.closeEditBox(screen, True) elif TYPE == "Cancel": self.closeEditBox(screen, False) elif NAME == "HiddenOptions": self.bHiddenOption = not self.bHiddenOption screen.hide(NAME) screen.modifyString(NAME, self.getHiddenOptionsBtnText(), 1 << 0) screen.show(NAME) self.placeGameOptions(screen) elif NAME == "GameOption" or inputClass.iData1 == 999: if NAME == "GameOption": iOption = ID else: iOption = inputClass.iData2 bNewValue = not self.GAME.isOption(iOption) self.GAME.setOption(iOption, bNewValue) if bNewValue: szTxt = self.szColorYay else: szTxt = self.szColorNay info = self.GC.getGameOptionInfo(iOption) szTxt += self.aFontList[3] + info.getDescription() if not info.getVisible(): szTxt += self.szHidden name = "GameOption" + str(iOption) screen.hide(name) screen.modifyString(name, szTxt, 1 << 0) screen.show(name) self.checkOptions(screen, iOption) elif NAME == "ExitSubScreen": self.exit(screen) return 1 elif iCode == 11: # List Select if NAME == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 8: self.exit(screen) import WBReligionScreen WBReligionScreen.WBReligionScreen(self.WB).interfaceScreen( self.WB.iCurrentPlayer) elif iIndex == 9: self.exit(screen) import WBCorporationScreen WBCorporationScreen.WBCorporationScreen( self.WB).interfaceScreen(self.WB.iCurrentPlayer) elif iIndex == 11: self.exit(screen) import WBInfoScreen WBInfoScreen.WBInfoScreen(self.WB).interfaceScreen( self.WB.iCurrentPlayer) global iSelectedCiv, iSelectedLeader if NAME == "WBNewCiv": iSelectedCiv = inputClass.iData2 iSelectedLeader = -1 self.placeNewPlayer(screen) elif NAME == "WBNewLeader": iSelectedLeader = inputClass.iData2 self.placeNewPlayer(screen) elif NAME == "CreatePlayer": for i in xrange(self.GC.getMAX_PC_PLAYERS()): if not self.GC.getPlayer(i).isEverAlive(): self.GAME.addPlayer(i, iSelectedLeader, iSelectedCiv, True) break self.exit(screen) self.WB.iCurrentPlayer = i self.WB.normalPlayerTabModeCB() return 1
def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBPromotionScreen", CvScreenEnums.WB_PROMOTION) global bApplyAll global iChangeType global iPlotType global iCopyType global iOwnerType global iSelectedClass if inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 0: WBUnitScreen.WBUnitScreen( CvPlatyBuilderScreen.CvWorldBuilderScreen( )).interfaceScreen(pUnit) elif iIndex == 2: WBPlayerScreen.WBPlayerScreen().interfaceScreen( pUnit.getOwner()) elif iIndex == 3: WBTeamScreen.WBTeamScreen().interfaceScreen(pUnit.getTeam()) elif iIndex == 4: WBPlotScreen.WBPlotScreen().interfaceScreen(pPlot) elif iIndex == 5: WBEventScreen.WBEventScreen().interfaceScreen(pPlot) elif iIndex == 6: WBPlayerUnits.WBPlayerUnits().interfaceScreen(pUnit.getOwner()) elif iIndex == 11: WBInfoScreen.WBInfoScreen().interfaceScreen(pUnit.getOwner()) elif inputClass.getFunctionName() == "ChangeType": iChangeType = screen.getPullDownData( "ChangeType", screen.getSelectedPullDownID("ChangeType")) elif inputClass.getFunctionName() == "OwnerType": iOwnerType = screen.getPullDownData( "OwnerType", screen.getSelectedPullDownID("OwnerType")) self.sortUnits() elif inputClass.getFunctionName() == "PlotType": iPlotType = screen.getPullDownData( "PlotType", screen.getSelectedPullDownID("PlotType")) self.sortUnits() elif inputClass.getFunctionName() == "CopyType": iCopyType = screen.getPullDownData( "CopyType", screen.getSelectedPullDownID("CopyType")) self.sortUnits() elif inputClass.getFunctionName() == "WBCurrentUnit": iPlayer = inputClass.getData1() - 8300 self.interfaceScreen( gc.getPlayer(iPlayer).getUnit(inputClass.getData2())) elif inputClass.getFunctionName() == "CombatClass": iSelectedClass = screen.getPullDownData( "CombatClass", screen.getSelectedPullDownID("CombatClass")) self.sortPromotions() elif inputClass.getFunctionName() == "WBPromotion": self.editPromotion(inputClass.getData2()) self.placePromotions() elif inputClass.getFunctionName() == "PromotionAll": for item in lList: self.editPromotion(item[1]) self.placePromotions() elif inputClass.getFunctionName() == "ApplyAll": bApplyAll = not bApplyAll sText = u"<font=3b>" + CyTranslator().getText( "TXT_KEY_WB_COPY_ALL", (CyTranslator().getText("TXT_KEY_PEDIA_CATEGORY_UNIT", ()), )) + "</font>" sColor = CyTranslator().getText("[COLOR_WARNING_TEXT]", ()) if bApplyAll: sColor = CyTranslator().getText("[COLOR_POSITIVE_TEXT]", ()) screen.modifyString("ApplyAll", sColor + sText + "</color>", 0) return 1
def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBReligionScreen", CvScreenEnums.WB_RELIGION) global bHoly global iSelectedPlayer global iOwnerType global iPlotType if inputClass.getButtonType() == WidgetTypes.WIDGET_PYTHON: if inputClass.getData1() > 7199 and inputClass.getData1() < 7300: iCityID = inputClass.getData2() iPlayerX = inputClass.getData1() - 7200 WBCityEditScreen.WBCityEditScreen( CvPlatyBuilderScreen.CvWorldBuilderScreen() ).interfaceScreen(gc.getPlayer(iPlayerX).getCity(iCityID)) elif inputClass.getData1() == 7876 or inputClass.getData1( ) == 7872: iPlayerX = inputClass.getData2() / 10000 WBPlayerScreen.WBPlayerScreen().interfaceScreen(iPlayerX) if inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 0: WBPlayerScreen.WBPlayerScreen().interfaceScreen( iSelectedPlayer) elif iIndex == 1: WBTeamScreen.WBTeamScreen().interfaceScreen( gc.getPlayer(iSelectedPlayer).getTeam()) elif iIndex == 9: WBCorporationScreen.WBCorporationScreen().interfaceScreen( iSelectedPlayer) elif iIndex == 10: WBGameDataScreen.WBGameDataScreen( CvPlatyBuilderScreen.CvWorldBuilderScreen( )).interfaceScreen() elif iIndex == 11: WBInfoScreen.WBInfoScreen().interfaceScreen(iSelectedPlayer) elif iIndex == 12: WBStoredDataScreen.WBStoredDataScreen( CvPlatyBuilderScreen.CvWorldBuilderScreen( )).interfaceScreen() elif inputClass.getFunctionName() == "OwnerType": iOwnerType = screen.getPullDownData( "OwnerType", screen.getSelectedPullDownID("OwnerType")) self.sortCities() elif inputClass.getFunctionName() == "CurrentPlayer": iSelectedPlayer = screen.getPullDownData( "CurrentPlayer", screen.getSelectedPullDownID("CurrentPlayer")) self.interfaceScreen(iSelectedPlayer) elif inputClass.getFunctionName() == "WBCityReligions": if inputClass.getButtonType() == WidgetTypes.WIDGET_HELP_RELIGION: iCityID = inputClass.getData2() / 100 iPlayerX = inputClass.getData2() % 100 pPlayerX = gc.getPlayer(iPlayerX) if pPlayerX: pCity = pPlayerX.getCity(iCityID) if pCity: if bHoly: self.editHolyCity(inputClass.getData1(), pCity) else: self.editReligion(inputClass.getData1(), pCity, 2) self.placeCityTable() elif inputClass.getFunctionName() == "WBAllReligions": if inputClass.getButtonType() == WidgetTypes.WIDGET_HELP_RELIGION: for (loopCity, iPlayerX) in lCities: self.editReligion(inputClass.getData1(), loopCity, inputClass.getData2() == 1) self.placeCityTable() elif inputClass.getFunctionName() == "SetHoly": bHoly = not bHoly sText = "<font=3b>" + CyTranslator().getText( "TXT_KEY_RELIGION_SCREEN_HOLY_CITY", ())[:-1] + "</font>" sColor = CyTranslator().getText("[COLOR_WARNING_TEXT]", ()) if bHoly: sColor = CyTranslator().getText("[COLOR_POSITIVE_TEXT]", ()) screen.modifyString("SetHoly", sColor + sText + "</color>", 0) return 1
def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBStoredDataScreen", CvScreenEnums.WB_STOREDDATA) global iChange global iSelectedCiv global bRemove global iSelectedMode global scriptDict global lBools global lInts global lLists global iSelectedList global iWarList if inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 8: WBReligionScreen.WBReligionScreen().interfaceScreen( self.top.m_iCurrentPlayer) elif iIndex == 9: WBCorporationScreen.WBCorporationScreen().interfaceScreen( self.top.m_iCurrentPlayer) elif iIndex == 10: WBGameDataScreen.WBGameDataScreen(self.top).interfaceScreen() elif iIndex == 11: WBInfoScreen.WBInfoScreen().interfaceScreen( self.top.m_iCurrentPlayer) elif inputClass.getFunctionName() == "ChangeBy": if bRemove: iChange = -screen.getPullDownData( "ChangeBy", screen.getSelectedPullDownID("ChangeBy")) else: iChange = screen.getPullDownData( "ChangeBy", screen.getSelectedPullDownID("ChangeBy")) elif inputClass.getFunctionName() == "ChangeType": bRemove = not bRemove iChange = -iChange elif inputClass.getFunctionName() == "SelectMode": iSelectedMode = screen.getPullDownData( "SelectMode", screen.getSelectedPullDownID("SelectMode")) iSelectedList = 0 self.loadData() elif inputClass.getFunctionName() == "SelectCiv": iSelectedCiv = screen.getPullDownData( "SelectCiv", screen.getSelectedPullDownID("SelectCiv")) self.placeCivButton() if iSelectedMode == 1: self.loadData() elif inputClass.getFunctionName() == "WBDataTable": if inputClass.getData1() == 22007: item = lBools[inputClass.getData2()] if iSelectedMode == 0: data.__dict__[item] = not data.__dict__[item] else: data.players[iSelectedCiv].__dict__[ item] = not data.players[iSelectedCiv].__dict__[item] elif inputClass.getData1() == 22008: item = lInts[inputClass.getData2()] if iSelectedMode == 0: iValue = data.__dict__[item] else: iValue = data.players[iSelectedCiv].__dict__[item] iValue += iChange if item == "iStabilityLevel": iValue = max(iStabilityCollapsing, min(iValue, iStabilitySolid)) elif item == "iFirstNewWorldColony": iValue = iSelectedCiv if iSelectedMode == 0: data.__dict__[item] = iValue else: data.players[iSelectedCiv].__dict__[item] = iValue if iSelectedMode == 0: for iPlayer in range(iNumPlayers): if not gc.getPlayer(iPlayer).isAlive(): continue dc.checkName(iPlayer) else: dc.checkName(iSelectedCiv) self.placeDataTable() elif inputClass.getFunctionName() == "WBListTable": iSelectedList = inputClass.getData2() self.placeListTables() elif inputClass.getFunctionName() == "WBListTableTwo": iItem = inputClass.getData2() sList = lLists[iSelectedList] if sList == "lWarTrend": iWarList = iItem elif isinstance(scriptDict[sList][iItem], bool): if iSelectedMode == 0: data.__dict__[sList][ iItem] = not data.__dict__[sList][iItem] else: data.players[iSelectedCiv].__dict__[sList][ iItem] = not data.players[iSelectedCiv].__dict__[ sList][iItem] elif isinstance(scriptDict[sList][iItem], int): bCiv = sList in [ "lFirstDiscovered", "lWonderBuilder", "lReligionFounder", "lFirstEntered", "lFirstGreatPeople" ] if bCiv: data.__dict__[sList][iItem] = iSelectedCiv else: if sList in ["lGoals", "lEconomyTrend"]: iValue = data.players[iSelectedCiv].__dict__[sList][ iItem] + abs(iChange) / iChange iValue = max(-1, min(iValue, 1)) data.players[iSelectedCiv].__dict__[sList][ iItem] = iValue elif sList == "lHappinessTrend": if bRemove: iValue = -1 else: iValue = 1 data.players[iSelectedCiv].__dict__[sList][ iItem] = iValue else: popup = Popup.PyPopup( 7777, EventContextTypes.EVENTCONTEXT_ALL) if iSelectedMode == 0: sText = str(data.__dict__[sList][iItem]) else: sText = str( data.players[iSelectedCiv].__dict__[sList] [iItem]) popup.setUserData((iItem, -1)) popup.createEditBox(sText) popup.launch() return 1 if iSelectedMode == 0: for iPlayer in range(iNumPlayers): if not gc.getPlayer(iPlayer).isAlive(): continue dc.checkName(iPlayer) else: dc.checkName(iSelectedCiv) self.placeListTables() elif inputClass.getFunctionName() == "WBListTableThree": iItem = inputClass.getData2() data.players[iSelectedCiv].__dict__["lWarTrend"][iWarList][ iItem] += iChange self.placeListTables() elif inputClass.getFunctionName() == "RestoreBackup": BugData.onGameLoad(-1) self.loadData() elif inputClass.getFunctionName() == "CreateBackup": BugData.save() return 1
def lateInit(): import CvCorporationScreen import CvEspionageAdvisor import CvMilitaryAdvisor import CvDomesticAdvisor import CvForeignAdvisor import CvFinanceAdvisor import CvReligionScreen import CvEraMovieScreen import CvVictoryScreen import CvCivicsScreen import CvInfoScreen import CvDawnOfMan import CvTopCivs import Forgetful import CvDebugInfoScreen import CvTechChooser import BuildListScreen screenMap[CORPORATION_SCREEN] = CvCorporationScreen.CvCorporationScreen() screenMap[ESPIONAGE_ADVISOR] = CvEspionageAdvisor.CvEspionageAdvisor() screenMap[MILITARY_ADVISOR] = CvMilitaryAdvisor.CvMilitaryAdvisor( MILITARY_ADVISOR) screenMap[DOMESTIC_ADVISOR] = CvDomesticAdvisor.CvDomesticAdvisor( DOMESTIC_ADVISOR) screenMap[FOREIGN_ADVISOR] = CvForeignAdvisor.CvForeignAdvisor( FOREIGN_ADVISOR) screenMap[FINANCE_ADVISOR] = CvFinanceAdvisor.CvFinanceAdvisor( FINANCE_ADVISOR) screenMap[RELIGION_SCREEN] = CvReligionScreen.CvReligionScreen() screenMap[ERA_MOVIE_SCREEN] = CvEraMovieScreen.CvEraMovieScreen() screenMap[VICTORY_SCREEN] = CvVictoryScreen.CvVictoryScreen(VICTORY_SCREEN) screenMap[CIVICS_SCREEN] = CvCivicsScreen.CvCivicsScreen(CIVICS_SCREEN) screenMap[INFO_SCREEN] = CvInfoScreen.CvInfoScreen(INFO_SCREEN) screenMap[DAWN_OF_MAN] = CvDawnOfMan.CvDawnOfMan() screenMap[TOP_CIVS] = CvTopCivs.CvTopCivs(TOP_CIVS) screenMap[FORGETFUL_SCREEN] = Forgetful.Forgetful() screenMap[DEBUG_INFO_SCREEN] = CvDebugInfoScreen.CvDebugInfoScreen() screenMap[TECH_CHOOSER] = CvTechChooser.CvTechChooser() screenMap[BUILD_LIST_SCREEN] = BuildListScreen.BuildListScreen() import WorldBuilder, CvAdvancedStartScreen global worldBuilderScreen, advancedStartScreen advancedStartScreen = CvAdvancedStartScreen.CvAdvancedStartScreen() worldBuilderScreen = WorldBuilder.WorldBuilder(WORLDBUILDER_SCREEN) screenMap[WORLDBUILDER_SCREEN] = worldBuilderScreen import WBPlotScreen import WBEventScreen import WBBuildingScreen import WBCityDataScreen import WBCityEditScreen import WBProjectScreen import WBTeamScreen import WBPlayerScreen import WBUnitScreen import WBPromotionScreen import WBDiplomacyScreen import WBPlayerUnits import WBReligionScreen import WBCorporationScreen import WBInfoScreen import WBTradeScreen screenMap[WB_PLOT] = WBPlotScreen.WBPlotScreen(worldBuilderScreen) screenMap[WB_EVENT] = WBEventScreen.WBEventScreen(worldBuilderScreen) screenMap[WB_BUILDING] = WBBuildingScreen.WBBuildingScreen( worldBuilderScreen) screenMap[WB_CITYDATA] = WBCityDataScreen.WBCityDataScreen( worldBuilderScreen) screenMap[WB_CITYEDIT] = WBCityEditScreen.WBCityEditScreen( worldBuilderScreen) screenMap[WB_PROJECT] = WBProjectScreen.WBProjectScreen(worldBuilderScreen) screenMap[WB_TEAM] = WBTeamScreen.WBTeamScreen(worldBuilderScreen) screenMap[WB_PLAYER] = WBPlayerScreen.WBPlayerScreen(worldBuilderScreen) screenMap[WB_UNIT] = WBUnitScreen.WBUnitScreen(worldBuilderScreen) screenMap[WB_PROMOTION] = WBPromotionScreen.WBPromotionScreen( worldBuilderScreen) screenMap[WB_DIPLOMACY] = WBDiplomacyScreen.WBDiplomacyScreen( worldBuilderScreen) screenMap[WB_UNITLIST] = WBPlayerUnits.WBPlayerUnits(worldBuilderScreen) screenMap[WB_RELIGION] = WBReligionScreen.WBReligionScreen( worldBuilderScreen) screenMap[WB_CORPORATION] = WBCorporationScreen.WBCorporationScreen( worldBuilderScreen) screenMap[WB_INFO] = WBInfoScreen.WBInfoScreen(worldBuilderScreen) screenMap[WB_TRADE] = WBTradeScreen.WBTradeScreen(worldBuilderScreen)
def handleInput (self, inputClass): screen = CyGInterfaceScreen( "WBPlayerScreen", CvScreenEnums.WB_PLAYER) global iChange if inputClass.getFunctionName() == "ChangeBy": iChange = screen.getPullDownData("ChangeBy", screen.getSelectedPullDownID("ChangeBy")) elif inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData("CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 1: WBTeamScreen.WBTeamScreen().interfaceScreen(iTeam) elif iIndex == 2: WBProjectScreen.WBProjectScreen().interfaceScreen(iTeam) elif iIndex == 3: WBTechScreen.WBTechScreen().interfaceScreen(iTeam) elif iIndex == 4: WBPlayerUnits.WBPlayerUnits().interfaceScreen(iPlayer) elif iIndex == 8: WBReligionScreen.WBReligionScreen().interfaceScreen(iPlayer) elif iIndex == 9: WBCorporationScreen.WBCorporationScreen().interfaceScreen(iPlayer) elif iIndex == 11: WBInfoScreen.WBInfoScreen().interfaceScreen(iPlayer) elif inputClass.getFunctionName() == "CurrentPlayer": iIndex = screen.getPullDownData("CurrentPlayer", screen.getSelectedPullDownID("CurrentPlayer")) self.interfaceScreen(iIndex) elif inputClass.getFunctionName() == "CurrentEra": pPlayer.setCurrentEra(screen.getPullDownData("CurrentEra", screen.getSelectedPullDownID("CurrentEra"))) elif inputClass.getFunctionName().find("PlayerGold") > -1: if inputClass.getData1() == 1030: pPlayer.changeGold(iChange) elif inputClass.getData1() == 1031: pPlayer.changeGold(- min(iChange, pPlayer.getGold())) self.placeStats() elif inputClass.getFunctionName().find("CombatXP") > -1: if inputClass.getData1() == 1030: pPlayer.changeCombatExperience(min(iChange, pPlayer.greatPeopleThreshold(True) - pPlayer.getCombatExperience())) elif inputClass.getData1() == 1031: pPlayer.changeCombatExperience(- min(iChange, pPlayer.getCombatExperience())) self.placeStats() elif inputClass.getFunctionName().find("GoldenAge") > -1: if inputClass.getData1() == 1030: pPlayer.changeGoldenAgeTurns(iChange) elif inputClass.getData1() == 1031: pPlayer.changeGoldenAgeTurns(- min(iChange, pPlayer.getGoldenAgeTurns())) self.placeStats() elif inputClass.getFunctionName().find("GPRequired") > -1: if inputClass.getData1() == 1030: pPlayer.changeNumUnitGoldenAges(iChange) elif inputClass.getData1() == 1031: pPlayer.changeNumUnitGoldenAges(- min(iChange, pPlayer.unitsRequiredForGoldenAge() - 1)) self.placeStats() elif inputClass.getFunctionName().find("Anarchy") > -1: if inputClass.getData1() == 1030: pPlayer.changeAnarchyTurns(iChange) elif inputClass.getData1() == 1031: pPlayer.changeAnarchyTurns(- min(iChange, pPlayer.getAnarchyTurns())) self.placeStats() elif inputClass.getFunctionName().find("CoastalTrade") > -1: if inputClass.getData1() == 1030: pPlayer.changeCoastalTradeRoutes(min(iChange, gc.getDefineINT("MAX_TRADE_ROUTES") - pPlayer.getCoastalTradeRoutes())) elif inputClass.getData1() == 1031: pPlayer.changeCoastalTradeRoutes(- min(iChange, pPlayer.getCoastalTradeRoutes())) self.placeStats() elif inputClass.getFunctionName().find("CommerceFlexible") > -1: iCommerce = CommerceTypes(inputClass.getData2()) if inputClass.getData1() == 1030: if pPlayer.isCommerceFlexible(iCommerce): pPlayer.changeCommercePercent(iCommerce, iChange) elif inputClass.getData1() == 1031: if pPlayer.isCommerceFlexible(iCommerce): pPlayer.changeCommercePercent(iCommerce, - min(iChange, pPlayer.getCommercePercent(iCommerce))) elif inputClass.getData1() == 7881: if pPlayer.isCommerceFlexible(iCommerce): pTeam.changeCommerceFlexibleCount(iCommerce, - pTeam.getCommerceFlexibleCount(iCommerce)) else: pTeam.changeCommerceFlexibleCount(iCommerce, 1) self.placeStats() elif inputClass.getFunctionName() == "WBPlayerResearch": iTech = inputClass.getData2() if iTech == -1: pPlayer.clearResearchQueue() else: pPlayer.pushResearch(iTech, True) self.interfaceScreen(iPlayer) elif inputClass.getFunctionName().find("CurrentResearch") > -1: iTech = pPlayer.getCurrentResearch() if iTech > -1: if inputClass.getData1() == 1030: pTeam.changeResearchProgress(pPlayer.getCurrentResearch(), min(iChange, pTeam.getResearchCost(iTech) - pTeam.getResearchProgress(iTech)), iPlayer) elif inputClass.getData1() == 1031: pTeam.changeResearchProgress(pPlayer.getCurrentResearch(), - min(iChange, pTeam.getResearchProgress(iTech)), iPlayer) self.placeResearch() elif inputClass.getFunctionName() == "WBPlayerReligions": iReligion = inputClass.getData1() pPlayer.setLastStateReligion(inputClass.getData1()) self.placeReligions() elif inputClass.getFunctionName().find("StateReligionUnit") > -1: if inputClass.getData1() == 1030: pPlayer.changeStateReligionUnitProductionModifier(iChange) elif inputClass.getData1() == 1031: pPlayer.changeStateReligionUnitProductionModifier(- min(iChange, pPlayer.getStateReligionUnitProductionModifier())) self.placeReligions() elif inputClass.getFunctionName().find("StateReligionBuilding") > -1: if inputClass.getData1() == 1030: pPlayer.changeStateReligionBuildingProductionModifier(iChange) elif inputClass.getData1() == 1031: pPlayer.changeStateReligionBuildingProductionModifier(- min(iChange, pPlayer.getStateReligionBuildingProductionModifier())) self.placeReligions() elif inputClass.getFunctionName() == "WBPlayerCivics": iCivic = inputClass.getData2() if pPlayer.canDoCivics(iCivic): pPlayer.setCivics(gc.getCivicInfo(iCivic).getCivicOptionType(), iCivic) self.interfaceScreen(iPlayer) elif inputClass.getFunctionName() == "PlayerEditScriptData": popup = Popup.PyPopup(1111, EventContextTypes.EVENTCONTEXT_ALL) popup.setHeaderString(CyTranslator().getText("TXT_KEY_WB_SCRIPT", ())) popup.setUserData((pPlayer.getID(),)) popup.createEditBox(pPlayer.getScriptData()) popup.launch() return return 1
def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBEventScreen", CvScreenEnums.WB_EVENT) global iSelectedEvent global iEventPlayer global iOtherPlayer global iOtherCity global iSelectedReligion global iSelectedCorporation global iSelectedUnit global iSelectedBuilding if inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 0: WBPlotScreen.WBPlotScreen().interfaceScreen(pPlot) elif iIndex == 2: if pPlot.getOwner() != -1: WBPlayerScreen.WBPlayerScreen().interfaceScreen( pPlot.getOwner()) elif iIndex == 3: WBTeamScreen.WBTeamScreen().interfaceScreen(pPlot.getTeam()) elif iIndex == 4: if pPlot.isCity(): WBCityEditScreen.WBCityEditScreen().interfaceScreen( pPlot.getPlotCity()) elif iIndex == 5: if iSelectedUnit > -1 and iEventPlayer > -1: pUnit = gc.getPlayer(iEventPlayer).getUnit(iSelectedUnit) else: pUnit = pPlot.getUnit(0) if pUnit: WBUnitScreen.WBUnitScreen( CvPlatyBuilderScreen.CvWorldBuilderScreen( )).interfaceScreen(pUnit) elif iIndex == 11: iPlayer = pPlot.getOwner() if iPlayer == -1: iPlayer = CyGame().getActivePlayer() WBInfoScreen.WBInfoScreen().interfaceScreen(iPlayer) elif inputClass.getFunctionName() == "WBEvent": iSelectedEvent = inputClass.getData2() self.placeEvents() elif inputClass.getFunctionName() == "WBEventPlayer": if inputClass.getData1() == 7876 or inputClass.getData1() == 7872: iEventPlayer = inputClass.getData2() / 10000 iSelectedUnit = -1 if iEventPlayer == iOtherPlayer: iOtherPlayer = -1 iOtherCity = -1 self.placeEventPlayers() self.placeOtherPlayers() self.placeOtherCities() self.placeUnits() elif inputClass.getFunctionName() == "WBOtherPlayer": if inputClass.getData1() == 7876 or inputClass.getData1() == 7872: iTemp = inputClass.getData2() / 10000 if iOtherPlayer == iTemp: iOtherPlayer = -1 else: iOtherPlayer = iTemp iOtherCity = -1 self.placeOtherPlayers() self.placeOtherCities() elif inputClass.getFunctionName() == "WBOtherCity": iTemp = inputClass.getData2() if iOtherCity == iTemp: iOtherCity = -1 else: iOtherCity = iTemp self.placeOtherCities() elif inputClass.getFunctionName() == "WBEventReligion": iTemp = inputClass.getData1() if iSelectedReligion == iTemp: iSelectedReligion = -1 else: iSelectedReligion = iTemp self.placeReligions() elif inputClass.getFunctionName() == "WBEventCorporation": iTemp = inputClass.getData2() if iSelectedCorporation == iTemp: iSelectedCorporation = -1 else: iSelectedCorporation = iTemp self.placeCorporations() elif inputClass.getFunctionName() == "WBEventBuilding": iTemp = inputClass.getData1() if iSelectedBuilding == iTemp: iSelectedBuilding = -1 else: iSelectedBuilding = iTemp self.placeBuildings() elif inputClass.getFunctionName() == "WBEventUnit": if inputClass.getData1() > 8299 and inputClass.getData1() < 8400: iUnit = inputClass.getData2() if iSelectedUnit == iUnit: iSelectedUnit = -1 else: iSelectedUnit = iUnit iEventPlayer = inputClass.getData1() - 8300 if iEventPlayer == iOtherPlayer: iOtherPlayer = -1 iOtherCity = -1 self.placeEventPlayers() self.placeOtherPlayers() self.placeOtherCities() self.placeUnits() elif inputClass.getFunctionName() == "TriggerEvent": if iEventPlayer == -1: return pPlayer = gc.getPlayer(iEventPlayer) iCity = -1 if pPlot.isCity(): iCity = pPlot.getPlotCity().getID() triggerData = pPlayer.initTriggeredData( iSelectedEvent, True, iCity, pPlot.getX(), pPlot.getY(), iOtherPlayer, iOtherCity, iSelectedReligion, iSelectedCorporation, iSelectedUnit, iSelectedBuilding) screen.hideScreen() return 1
def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBRiverScreen", CvScreenEnums.WB_PLOT_RIVER) global bAdd global bSensibility global bFord global iSelectedSide global iEditType global bRiverAutomatic global bRiverBranch global bRiverComplete if False: pass elif inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 1: WBEventScreen.WBEventScreen().interfaceScreen(pPlot) elif iIndex == 2: if pPlot.getOwner() != -1: WBPlayerScreen.WBPlayerScreen().interfaceScreen( pPlot.getOwner()) elif iIndex == 3: WBTeamScreen.WBTeamScreen().interfaceScreen(pPlot.getTeam()) elif iIndex == 4: if pPlot.isCity(): WBCityEditScreen.WBCityEditScreen().interfaceScreen( pPlot.getPlotCity()) elif iIndex == 5: pUnit = pPlot.getUnit(0) if pUnit: WBUnitScreen.WBUnitScreen( CvPlatyBuilderScreen.CvWorldBuilderScreen( )).interfaceScreen(pUnit) elif iIndex == 11: iPlayer = pPlot.getOwner() if iPlayer == -1: iPlayer = CyGame().getActivePlayer() WBInfoScreen.WBInfoScreen().interfaceScreen(iPlayer) elif iIndex == 12: WBPlotScreen.WBPlotScreen().interfaceScreen(pPlot) elif inputClass.getFunctionName() == "NextPlotUpButton": pNewPlot = CyMap().plot(pPlot.getX(), pPlot.getY() + 1) if not pNewPlot.isNone(): self.interfaceScreen(pNewPlot) elif inputClass.getFunctionName() == "NextPlotDownButton": pNewPlot = CyMap().plot(pPlot.getX(), pPlot.getY() - 1) if not pNewPlot.isNone(): self.interfaceScreen(pNewPlot) elif inputClass.getFunctionName() == "NextPlotLeftButton": pNewPlot = CyMap().plot(pPlot.getX() - 1, pPlot.getY()) if not pNewPlot.isNone(): self.interfaceScreen(pNewPlot) elif inputClass.getFunctionName() == "NextPlotRightButton": pNewPlot = CyMap().plot(pPlot.getX() + 1, pPlot.getY()) if not pNewPlot.isNone(): self.interfaceScreen(pNewPlot) elif inputClass.getFunctionName() == "WBRiverFeature": iFeature = pPlot.getFeatureType() iVariety = pPlot.getFeatureVariety() bSkip = False if inputClass.getData2() < 0 or not bAdd: pPlot.setFeatureType(-1, 0) CvUtil.removeScriptData(pPlot, "r") bSkip = True if bSensibility and pPlot.getPlotType( ) is not PlotTypes.PLOT_OCEAN: bSkip = True if not bSkip: if inputClass.getData2() >= 1000: if iFeature in riverIds["features"]: CvUtil.removeScriptData(pPlot, "r") pPlot.setTerrainType( riverIds["terrains"][inputClass.getData2() - 1000], True, True) pPlot.setFeatureType(-1, 0) pPlot.setFeatureType( riverIds["features"][inputClass.getData2() - 1000], 0) else: ra = self.lRiveralign[inputClass.getData2()] riverDesc = CvRiverUtil.getRiverScriptData(pPlot) riverDesc.rtype = ra[0] riverDesc.align = ra[1] if riverDesc.variant not in CvRiverUtil.RiverTypes[ riverDesc.rtype][riverDesc.align]: riverDesc.variant = 1 if not len(riverDesc.getVariantSides()) > iSelectedSide: iSelectedSide = 0 if iFeature not in riverIds["features"] or iVariety == 0: CvRiverUtil.addRiverFeature(pPlot) CvRiverUtil.updateRiverFeature(pPlot, riverDesc, True) self.placeScript() self.placeRiverFeature() elif inputClass.getFunctionName() == "WBRiverVariant": riverDesc = CvRiverUtil.getRiverScriptData(pPlot) iOld = riverDesc.variant iNew = inputClass.getData2() if iNew is not iOld: riverDesc.variant = iNew if iSelectedSide >= len(riverDesc.getVariantSides()): iSelectedSide = 0 CvRiverUtil.updateRiverFeature(pPlot, riverDesc, True) self.placeRiverFeature(0) elif inputClass.getFunctionName() == "WBRiverSubtile": iNew = inputClass.getData2() if iNew is not iSelectedSide: iSelectedSide = iNew self.placeRiverFeature(1) elif inputClass.getFunctionName() == "WBRiverTexture": riverDesc = CvRiverUtil.getRiverScriptData(pPlot) iOld = riverDesc.textures[iSelectedSide] iNew = inputClass.getData2() if iNew is not iOld: riverDesc.textures[iSelectedSide] = iNew CvRiverUtil.updateRiverFeature(pPlot, riverDesc, True) self.placeRiverFeature(2) if bRiverComplete or bRiverBranch: nearbyPlots = CvRiverUtil.getAdjacentTiles( pPlot, not bRiverComplete) # Remove this plot (=first entry) nearbyPlots.pop(0) CvRiverUtil.setTexture(nearbyPlots, iSelectedSide, iNew) elif inputClass.getFunctionName() == "WBRiverDecoration": riverDesc = CvRiverUtil.getRiverScriptData(pPlot) bActive = not (inputClass.getData2() in riverDesc.decorations) if bActive: riverDesc.decorations.append(inputClass.getData2()) else: riverDesc.decorations.remove(inputClass.getData2()) CvRiverUtil.updateRiverFeature(pPlot, riverDesc, True) self.placeRiverDecoration() elif inputClass.getFunctionName() == "WBRiverRapids": riverDesc = CvRiverUtil.getRiverScriptData(pPlot) riverDesc.rapids = inputClass.getData2() CvRiverUtil.updateRiverFeature(pPlot, riverDesc, True) if bRiverComplete or bRiverBranch: nearbyPlots = CvRiverUtil.getAdjacentTiles( pPlot, not bRiverComplete) """ dmsg = "" for n in nearbyPlots: dmsg += "(%i,%i)\n" % (n[0].getX(), n[0].getY()) CyInterface().addMessage(gc.getGame().getActivePlayer(), True, 5, dmsg, None, 2, None, ColorTypes(14), 0, 0, False, False) """ CvRiverUtil.setRapidDirection(nearbyPlots) self.placeRiverFeature(4) self.placeScript() elif inputClass.getFunctionName() == "WBRiverWaterColors": riverDesc = CvRiverUtil.getRiverScriptData(pPlot) # order is [ full texture color 1, halve texture color 1, ... ] riverDesc.waterColor = max(0, inputClass.getData2() - 2) # Use halve texture if rotation is set CvRiverUtil.updateRiverFeature(pPlot, riverDesc, True) if bRiverComplete or bRiverBranch: nearbyPlots = CvRiverUtil.getAdjacentTiles( pPlot, not bRiverComplete) CvRiverUtil.setWaterColor(nearbyPlots) self.placeRiverFeature(5) self.placeScript() elif inputClass.getFunctionName() == "WBRiverWaterRotations": riverDesc = CvRiverUtil.getRiverScriptData(pPlot) riverDesc.waterRotation = inputClass.getData2() if riverDesc.waterColor > 0: iPlus = 0 if riverDesc.waterRotation > 0: iPlus = 1 riverDesc.waterColor = 2 * \ ((riverDesc.waterColor+1)/2) - 1 + iPlus CvRiverUtil.updateRiverFeature(pPlot, riverDesc, True) self.placeRiverFeature(5) self.placeScript() elif inputClass.getFunctionName() == "PlotEditScriptData": popup = Popup.PyPopup(5555, EventContextTypes.EVENTCONTEXT_ALL) popup.setHeaderString(CyTranslator().getText( "TXT_KEY_WB_SCRIPT", ())) popup.setUserData((pPlot.getX(), pPlot.getY())) popup.createEditBox(pPlot.getScriptData()) popup.launch() elif inputClass.getFunctionName() == "SensibilityCheck": bSensibility = not bSensibility screen.setState("SensibilityCheck", bSensibility) elif inputClass.getFunctionName() == "FordCheck": bFord = not bFord iTerrain = pPlot.getTerrainType() iFeature = pPlot.getFeatureType() iVariety = pPlot.getFeatureVariety() if (iTerrain in riverIds["terrains"] and iTerrain is not riverIds["terrains"][int(bFord)]): pPlot.setTerrainType(riverIds["terrains"][int(bFord)], True, True) if (iFeature in riverIds["features"] and iVariety in riverIds["varieties"] and iFeature is not riverIds["features"][int(bFord)]): pPlot.setFeatureType(-1, 0) pPlot.setFeatureType(riverIds["features"][int(bFord)], iVariety) riverDesc = CvRiverUtil.getRiverScriptData(pPlot) if not iVariety == 0: CvRiverUtil.updateRiverFeature(pPlot, riverDesc, False) screen.setState("FordCheck", bFord) self.placeRiverFeature() elif inputClass.getFunctionName() == "RiverAutomaticCheck": bRiverAutomatic = not bRiverAutomatic screen.setState("RiverAutomaticCheck", bRiverAutomatic) elif inputClass.getFunctionName() == "RiverBranchCheck": bRiverBranch = not bRiverBranch screen.setState("RiverBranchCheck", bRiverBranch) elif inputClass.getFunctionName() == "RiverCompleteCheck": bRiverComplete = not bRiverComplete screen.setState("RiverCompleteCheck", bRiverComplete) return 1
def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBCityDataScreen", CvScreenEnums.WB_CITYDATA) global iChange global iOwnerType global iPlotType global bRemove global iSelectedClass global bWonder global iModifyBuilding global iSelectedYield if inputClass.getFunctionName() == "ChangeBy": iChange = screen.getPullDownData( "ChangeBy", screen.getSelectedPullDownID("ChangeBy")) elif inputClass.getFunctionName() == "ChangeType": bRemove = not bRemove elif inputClass.getFunctionName() == "CurrentCity": iPlayerX = inputClass.getData1() - 7200 pPlayerX = gc.getPlayer(iPlayerX) if pPlayerX: self.interfaceScreen(pPlayerX.getCity(inputClass.getData2())) elif inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 0: WBCityEditScreen.WBCityEditScreen( CvPlatyBuilderScreen.CvWorldBuilderScreen( )).interfaceScreen(pCity) elif iIndex == 2: WBBuildingScreen.WBBuildingScreen().interfaceScreen(pCity) elif iIndex == 3: WBPlayerScreen.WBPlayerScreen().interfaceScreen(iPlayer) elif iIndex == 4: WBTeamScreen.WBTeamScreen().interfaceScreen(pCity.getTeam()) elif iIndex == 5: WBPlayerUnits.WBPlayerUnits().interfaceScreen(iPlayer) elif iIndex == 6: WBPlotScreen.WBPlotScreen().interfaceScreen(pCity.plot()) elif iIndex == 7: WBEventScreen.WBEventScreen().interfaceScreen(pCity.plot()) elif iIndex == 8: WBReligionScreen.WBReligionScreen().interfaceScreen(iPlayer) elif iIndex == 9: WBCorporationScreen.WBCorporationScreen().interfaceScreen( iPlayer) elif iIndex == 11: WBInfoScreen.WBInfoScreen().interfaceScreen(iPlayer) elif inputClass.getFunctionName() == "OwnerType": iOwnerType = screen.getPullDownData( "OwnerType", screen.getSelectedPullDownID("OwnerType")) self.sortCities() elif inputClass.getFunctionName() == "PlotType": iPlotType = screen.getPullDownData( "PlotType", screen.getSelectedPullDownID("PlotType")) self.sortCities() elif inputClass.getFunctionName() == "SpecialistAll": for item in xrange(gc.getNumSpecialistInfos()): self.editFreeSpecialist(item) self.placeSpecialist() elif inputClass.getFunctionName() == "WBSpecialist": self.editFreeSpecialist(inputClass.getData2()) self.placeSpecialist() elif inputClass.getFunctionName() == "GreatPeopleProgressAll": for item in lGreatPeople: self.editGreatPeopleProgress(item[1]) self.placeGreatPeople() elif inputClass.getFunctionName().find("GreatPeopleFlat") > -1: if inputClass.getData1() == 1030: self.editGreatPeopleFlat(iChange) elif inputClass.getData1() == 1031: self.editGreatPeopleFlat(-iChange) self.placeGreatPeople() elif inputClass.getFunctionName().find("GreatPeopleRate") > -1: if inputClass.getData1() == 1030: self.editGreatPeopleRate(iChange) elif inputClass.getData1() == 1031: self.editGreatPeopleRate(-iChange) self.placeSpecialist() elif inputClass.getFunctionName() == "WBGreatPeople": self.editGreatPeopleProgress(inputClass.getData2()) self.placeGreatPeople() elif inputClass.getFunctionName() == "BonusClass": iSelectedClass = inputClass.getData() - 1 self.createBonusList() self.placeBonus() elif inputClass.getFunctionName() == "BonusAll": for item in lBonus: self.editFreeBonus(item[1]) self.placeBonus() elif inputClass.getFunctionName() == "WBBonus": if inputClass.getData1() == 7878: self.editFreeBonus(inputClass.getData2()) else: self.setNoBonusCB(inputClass.getData2()) self.placeBonus() elif inputClass.getFunctionName() == "BuildingType": bWonder = not bWonder self.sortBuildings() elif inputClass.getFunctionName() == "YieldType": iSelectedYield = screen.getPullDownData( "YieldType", screen.getSelectedPullDownID("YieldType")) elif inputClass.getFunctionName() == "WBModifyBuilding": self.modifyBuilding(inputClass.getData1()) self.placeModify() return 1
def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBTeamScreen", CvScreenEnums.WB_TEAM) global iChange global bRemove global iSelectedYield if inputClass.getFunctionName() == "ChangeBy": iChange = screen.getPullDownData( "ChangeBy", screen.getSelectedPullDownID("ChangeBy")) elif inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 0: WBPlayerScreen.WBPlayerScreen(self.WB).interfaceScreen( pTeam.getLeaderID()) elif iIndex == 2: WBProjectScreen.WBProjectScreen(self.WB).interfaceScreen(iTeam) elif iIndex == 3: self.WB.goToSubScreen("TechScreen") elif iIndex == 4: WBPlayerUnits.WBPlayerUnits(self.WB).interfaceScreen( pTeam.getLeaderID()) elif iIndex == 11: WBInfoScreen.WBInfoScreen(self.WB).interfaceScreen( pTeam.getLeaderID()) elif inputClass.getFunctionName() == "CurrentTeam": iTeamX = screen.getPullDownData( "CurrentTeam", screen.getSelectedPullDownID("CurrentTeam")) self.interfaceScreen(iTeamX) elif inputClass.getFunctionName() == "WBTeamMembers": if inputClass.getData1() == 7876 or inputClass.getData1() == 7872: iPlayer = inputClass.getData2() / 10000 WBPlayerScreen.WBPlayerScreen(self.WB).interfaceScreen(iPlayer) elif inputClass.getFunctionName() == "MergeTeam": pTeam.addTeam( screen.getPullDownData( "MergeTeam", screen.getSelectedPullDownID("MergeTeam"))) self.interfaceScreen(pTeam.getID()) elif inputClass.getFunctionName().find("NukeInterception") > -1: if inputClass.getData1() == 1030: pTeam.changeNukeInterception( min(iChange, 100 - pTeam.getNukeInterception())) elif inputClass.getData1() == 1031: iCount = min(iChange, pTeam.getNukeInterception()) pTeam.changeNukeInterception(-iCount) self.placeStats() elif inputClass.getFunctionName().find("EnemyWW") > -1: if inputClass.getData1() == 1030: pTeam.changeEnemyWarWearinessModifier(iChange) elif inputClass.getData1() == 1031: iCount = min(iChange, pTeam.getEnemyWarWearinessModifier()) pTeam.changeEnemyWarWearinessModifier(-iCount) self.placeStats() elif inputClass.getFunctionName().find("MasterPower") > -1: if inputClass.getData1() == 1030: pTeam.setMasterPower(pTeam.getMasterPower() + iChange) elif inputClass.getData1() == 1031: pTeam.setMasterPower(max(0, pTeam.getMasterPower() - iChange)) self.placeStats() elif inputClass.getFunctionName().find("VassalPower") > -1: if inputClass.getData1() == 1030: pTeam.setVassalPower(pTeam.getVassalPower() + iChange) elif inputClass.getData1() == 1031: pTeam.setVassalPower(max(0, pTeam.getVassalPower() - iChange)) self.placeStats() elif inputClass.getFunctionName().find("EspionageEver") > -1: if inputClass.getData1() == 1030: pTeam.changeEspionagePointsEver(iChange) elif inputClass.getData1() == 1031: iCount = min(iChange, pTeam.getEspionagePointsEver()) pTeam.changeEspionagePointsEver(-iCount) self.placeStats() elif inputClass.getFunctionName() == "WBTeamRoutes": self.editRoute(inputClass.getData2()) self.placeRoutes() elif inputClass.getFunctionName() == "WBTeamDomainMoves": self.editDomain(inputClass.getData2()) self.placeDomains() elif inputClass.getFunctionName() == "ChangeType": bRemove = not bRemove elif inputClass.getFunctionName() == "YieldType": iSelectedYield = screen.getPullDownData( "YieldType", screen.getSelectedPullDownID("YieldType")) elif inputClass.getFunctionName() == "WBTeamYield": self.modifyImprovement(inputClass.getData2()) self.placeImprovements() elif inputClass.getFunctionName() == "WBTeamVotes": iVote = GC.getBuildingInfo( inputClass.getData1()).getVoteSourceType() if pTeam.isForceTeamVoteEligible(iVote): pTeam.changeForceTeamVoteEligibilityCount( iVote, -pTeam.getForceTeamVoteEligibilityCount(iVote)) else: pTeam.changeForceTeamVoteEligibilityCount(iVote, 1) self.placeVotes() elif inputClass.getFunctionName() == "AbilitiesAll": for i in xrange(13): self.doTeamAbilities(i, not bRemove) self.placeAbilities() elif inputClass.getFunctionName() == "WBAbilities": iButton = inputClass.getButtonType() if iButton == WidgetTypes.WIDGET_HELP_MAP_CENTER: self.doTeamAbilities(0, -1) elif iButton == WidgetTypes.WIDGET_HELP_MAP_TRADE: self.doTeamAbilities(1, -1) elif iButton == WidgetTypes.WIDGET_HELP_TECH_TRADE: self.doTeamAbilities(2, -1) elif iButton == WidgetTypes.WIDGET_HELP_GOLD_TRADE: self.doTeamAbilities(3, -1) elif iButton == WidgetTypes.WIDGET_HELP_OPEN_BORDERS: self.doTeamAbilities(4, -1) elif iButton == WidgetTypes.WIDGET_HELP_DEFENSIVE_PACT: self.doTeamAbilities(5, -1) elif iButton == WidgetTypes.WIDGET_HELP_PERMANENT_ALLIANCE: self.doTeamAbilities(6, -1) elif iButton == WidgetTypes.WIDGET_HELP_VASSAL_STATE: self.doTeamAbilities(7, -1) elif iButton == WidgetTypes.WIDGET_HELP_BUILD_BRIDGE: self.doTeamAbilities(8, -1) elif iButton == WidgetTypes.WIDGET_HELP_IRRIGATION: self.doTeamAbilities(9, -1) elif iButton == WidgetTypes.WIDGET_HELP_IGNORE_IRRIGATION: self.doTeamAbilities(10, -1) elif iButton == WidgetTypes.WIDGET_HELP_WATER_WORK: self.doTeamAbilities(11, -1) elif iButton == WidgetTypes.WIDGET_HELP_LOS_BONUS: self.doTeamAbilities(12, -1) else: self.doTeamAbilities(inputClass.getData(), -1) self.placeAbilities() return 1
def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBProjectScreen", CvScreenEnums.WB_PROJECT) global iChange global iChangeType global bApplyAll global bNoBarb global iProjectType if inputClass.getFunctionName() == "ChangeBy": iChange = screen.getPullDownData( "ChangeBy", screen.getSelectedPullDownID("ChangeBy")) elif inputClass.getFunctionName() == "CurrentTeam": iIndex = screen.getPullDownData( "CurrentTeam", screen.getSelectedPullDownID("CurrentTeam")) self.interfaceScreen(iIndex) elif inputClass.getFunctionName() == "ProjectType": iProjectType = screen.getPullDownData( "ProjectType", screen.getSelectedPullDownID("ProjectType")) self.sortProjects() elif inputClass.getFunctionName() == "ChangeType": iChangeType = screen.getPullDownData( "ChangeType", screen.getSelectedPullDownID("ChangeType")) elif inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 0: WBPlayerScreen.WBPlayerScreen(self.WB).interfaceScreen( pTeam.getLeaderID()) elif iIndex == 1: WBTeamScreen.WBTeamScreen(self.WB).interfaceScreen(iTeam) elif iIndex == 3: self.WB.goToSubScreen("TechScreen") elif iIndex == 4: WBPlayerUnits.WBPlayerUnits(self.WB).interfaceScreen( pTeam.getLeaderID()) elif iIndex == 11: WBInfoScreen.WBInfoScreen(self.WB).interfaceScreen( pTeam.getLeaderID()) elif inputClass.getFunctionName() == "ProjectAll": for item in lProject: self.editProject(item[1]) self.placeProjects() elif inputClass.getFunctionName() == "WBProject": self.editProject(inputClass.getData2()) self.placeProjects() elif inputClass.getFunctionName() == "ApplyAll": bApplyAll = not bApplyAll sText = u"<font=3b>" + CyTranslator().getText( "TXT_KEY_WB_COPY_ALL", (CyTranslator().getText("TXT_KEY_MAIN_MENU_PLAYERS", ()), )) + "</font>" sColor = CyTranslator().getText("[COLOR_WARNING_TEXT]", ()) if bApplyAll: sColor = CyTranslator().getText("[COLOR_POSITIVE_TEXT]", ()) screen.modifyString("ApplyAll", sColor + sText + "</color>", 0) elif inputClass.getFunctionName() == "NoBarbarians": bNoBarb = not bNoBarb sText = u"<font=3b>" + CyTranslator().getText( "TXT_KEY_GAME_OPTION_NO_BARBARIANS", ()) + "</font>" sColor = CyTranslator().getText("[COLOR_WARNING_TEXT]", ()) if bNoBarb: sColor = CyTranslator().getText("[COLOR_POSITIVE_TEXT]", ()) screen.modifyString("NoBarbarians", sColor + sText + "</color>", 0) return 1
WB_EVENT: WBEventScreen.WBEventScreen(), WB_BUILDING: WBBuildingScreen.WBBuildingScreen(), WB_CITYDATA: WBCityDataScreen.WBCityDataScreen(), WB_CITYEDIT: WBCityEditScreen.WBCityEditScreen(worldBuilderScreen), WB_TECH: WBTechScreen.WBTechScreen(), WB_PROJECT: WBProjectScreen.WBProjectScreen(), WB_TEAM: WBTeamScreen.WBTeamScreen(), WB_PLAYER: WBPlayerScreen.WBPlayerScreen(), WB_UNIT: WBUnitScreen.WBUnitScreen(worldBuilderScreen), WB_PROMOTION: WBPromotionScreen.WBPromotionScreen(), WB_DIPLOMACY: WBDiplomacyScreen.WBDiplomacyScreen(), WB_GAMEDATA: WBGameDataScreen.WBGameDataScreen(worldBuilderScreen), WB_UNITLIST: WBPlayerUnits.WBPlayerUnits(), WB_RELIGION: WBReligionScreen.WBReligionScreen(), WB_CORPORATION: WBCorporationScreen.WBCorporationScreen(), WB_INFO: WBInfoScreen.WBInfoScreen(), WB_TRADE: WBTradeScreen.WBTradeScreen(), WB_STOREDDATA: WBStoredDataScreen.WBStoredDataScreen(worldBuilderScreen), } ####################################################################################### ## Handle Navigation Map ####################################################################################### HandleNavigationMap = {} # BUG - Options - start def init(): createDomesticAdvisor() createFinanceAdvisor() createMilitaryAdvisor()
def handleInput (self, inputClass): screen = CyGInterfaceScreen( "WBBuildingScreen", CvScreenEnums.WB_BUILDING) global bApplyAll global iSelectedClass global iChangeType global iOwnerType global iPlotType if inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData("CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 0: WBCityEditScreen.WBCityEditScreen(CvPlatyBuilderScreen.CvWorldBuilderScreen()).interfaceScreen(pCity) elif iIndex == 1: WBCityDataScreen.WBCityDataScreen().interfaceScreen(pCity) elif iIndex == 3: WBPlayerScreen.WBPlayerScreen().interfaceScreen(iPlayer) elif iIndex == 4: WBTeamScreen.WBTeamScreen().interfaceScreen(pCity.getTeam()) elif iIndex == 5: WBPlayerUnits.WBPlayerUnits().interfaceScreen(iPlayer) elif iIndex == 6: WBPlotScreen.WBPlotScreen().interfaceScreen(pCity.plot()) elif iIndex == 7: WBEventScreen.WBEventScreen().interfaceScreen(pCity.plot()) elif iIndex == 8: WBReligionScreen.WBReligionScreen().interfaceScreen(iPlayer) elif iIndex == 9: WBCorporationScreen.WBCorporationScreen().interfaceScreen(iPlayer) elif iIndex == 11: WBInfoScreen.WBInfoScreen().interfaceScreen(iPlayer) elif inputClass.getFunctionName() == "OwnerType": iOwnerType = screen.getPullDownData("OwnerType", screen.getSelectedPullDownID("OwnerType")) self.sortCities() elif inputClass.getFunctionName() == "PlotType": iPlotType = screen.getPullDownData("PlotType", screen.getSelectedPullDownID("PlotType")) self.sortCities() elif inputClass.getFunctionName() == "ChangeType": iChangeType = screen.getPullDownData("ChangeType", screen.getSelectedPullDownID("ChangeType")) elif inputClass.getFunctionName() == "CurrentCity": iPlayerX = inputClass.getData1() - 7200 pPlayerX = gc.getPlayer(iPlayerX) if pPlayerX: self.interfaceScreen(pPlayerX.getCity(inputClass.getData2())) elif inputClass.getFunctionName() == "WBBuilding": bUpdate = self.editBuilding(inputClass.getData1(), gc.getPlayer(iPlayer), False, False) self.placeBuildings() if bUpdate: self.placeWonders() elif inputClass.getFunctionName() == "BuildingAvailable": bUpdate = False for item in lBuilding: bTemp = self.editBuilding(item[1], gc.getPlayer(iPlayer), True, False) bUpdate = bUpdate or bTemp self.placeBuildings() if bUpdate: self.placeWonders() elif inputClass.getFunctionName() == "BuildingAll": bUpdate = False for item in lBuilding: bTemp = self.editBuilding(item[1], gc.getPlayer(iPlayer), False, False) bUpdate = bUpdate or bTemp self.placeBuildings() if bUpdate: self.placeWonders() elif inputClass.getFunctionName() == "WonderClass": iSelectedClass = inputClass.getData() self.placeWonders() elif inputClass.getFunctionName() == "WBWonders": bUpdate = self.editBuilding(inputClass.getData1(), gc.getPlayer(iPlayer), False, True) self.placeWonders() if bUpdate: self.placeBuildings() elif inputClass.getFunctionName() == "WonderAvailable": bUpdate = False lList = lWorld if iSelectedClass == 0: lList = lNational + lTeam + lWorld elif iSelectedClass == 1: lList = lNational elif iSelectedClass == 2: lList = lTeam for item in lList: bTemp = self.editBuilding(item[1], gc.getPlayer(iPlayer), True, True) bUpdate = bUpdate or bTemp self.placeWonders() if bUpdate: self.placeBuildings() elif inputClass.getFunctionName() == "WonderAll": bUpdate = False lList = lWorld if iSelectedClass == 0: lList = lNational + lTeam + lWorld elif iSelectedClass == 1: lList = lNational elif iSelectedClass == 2: lList = lTeam for item in lList: bTemp = self.editBuilding(item[1], gc.getPlayer(iPlayer), False, True) bUpdate = bUpdate or bTemp self.placeWonders() if bUpdate: self.placeBuildings() elif inputClass.getFunctionName() == "ApplyAll": bApplyAll = not bApplyAll sText = u"<font=3b>" + CyTranslator().getText("TXT_KEY_WB_COPY_ALL", (CyTranslator().getText("TXT_KEY_CONCEPT_CITIES", ()),)) + "</font>" sColor = CyTranslator().getText("[COLOR_WARNING_TEXT]", ()) if bApplyAll: sColor = CyTranslator().getText("[COLOR_POSITIVE_TEXT]", ()) screen.modifyString("ApplyAll", sColor + sText + "</color>", 0) return 1
def handleInput(self, inputClass): screen = CyGInterfaceScreen("WBGameDataScreen", CvScreenEnums.WB_GAMEDATA) global iChange global bHiddenOption global bRepeat global iSelectedCiv global iSelectedLeader global bRemove if inputClass.getFunctionName() == "CurrentPage": iIndex = screen.getPullDownData( "CurrentPage", screen.getSelectedPullDownID("CurrentPage")) if iIndex == 8: WBReligionScreen.WBReligionScreen().interfaceScreen( self.top.m_iCurrentPlayer) elif iIndex == 9: WBCorporationScreen.WBCorporationScreen().interfaceScreen( self.top.m_iCurrentPlayer) elif iIndex == 11: WBInfoScreen.WBInfoScreen().interfaceScreen( self.top.m_iCurrentPlayer) elif iIndex == 12: WBStoredDataScreen.WBStoredDataScreen( self.top).interfaceScreen() elif inputClass.getFunctionName() == "ChangeBy": if bRemove: iChange = -screen.getPullDownData( "ChangeBy", screen.getSelectedPullDownID("ChangeBy")) else: iChange = screen.getPullDownData( "ChangeBy", screen.getSelectedPullDownID("ChangeBy")) elif inputClass.getFunctionName() == "ChangeType": bRemove = not bRemove iChange = -iChange elif inputClass.getFunctionName().find("StartYear") > -1: if inputClass.getData1() == 1030: CyGame().setStartYear(CyGame().getStartYear() + abs(iChange)) elif inputClass.getData1() == 1031: CyGame().setStartYear(CyGame().getStartYear() - abs(iChange)) self.placeStats() elif inputClass.getFunctionName().find("MaxCityElimination") > -1: if inputClass.getData1() == 1030: CyGame().setMaxCityElimination( CyGame().getMaxCityElimination() + abs(iChange)) elif inputClass.getData1() == 1031: CyGame().setMaxCityElimination( max(0, CyGame().getMaxCityElimination() - abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("GameTurn") > -1: if inputClass.getData1() == 1030: iChange = min( abs(iChange), CyGame().getMaxTurns() - CyGame().getElapsedGameTurns()) CyGame().setGameTurn(CyGame().getGameTurn() + iChange) CyGame().changeMaxTurns(-iChange) elif inputClass.getData1() == 1031: iChange = min(CyGame().getGameTurn(), abs(iChange)) CyGame().setGameTurn(CyGame().getGameTurn() - iChange) CyGame().changeMaxTurns(iChange) self.placeStats() elif inputClass.getFunctionName().find("TargetScore") > -1: if inputClass.getData1() == 1030: CyGame().setTargetScore(CyGame().getTargetScore() + abs(iChange)) elif inputClass.getData1() == 1031: CyGame().setTargetScore( max(0, CyGame().getTargetScore() - abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("EstimateEndTurn") > -1: if inputClass.getData1() == 1030: CyGame().setEstimateEndTurn(CyGame().getEstimateEndTurn() + iChange) elif inputClass.getData1() == 1031: CyGame().setEstimateEndTurn( max(0, CyGame().getEstimateEndTurn() - iChange)) self.placeStats() elif inputClass.getFunctionName().find("NukesExploded") > -1: if inputClass.getData1() == 1030: CyGame().changeNukesExploded(abs(iChange)) elif inputClass.getData1() == 1031: CyGame().changeNukesExploded( -min(CyGame().getNukesExploded(), abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("MaxTurns") > -1: if inputClass.getData1() == 1030: CyGame().changeMaxTurns(abs(iChange)) elif inputClass.getData1() == 1031: CyGame().changeMaxTurns( -min(CyGame().getMaxTurns(), abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("TradeRoutes") > -1: if inputClass.getData1() == 1030: CyGame().changeTradeRoutes( min( abs(iChange), gc.getDefineINT("MAX_TRADE_ROUTES") - gc.getDefineINT("INITIAL_TRADE_ROUTES") - CyGame().getTradeRoutes())) elif inputClass.getData1() == 1031: CyGame().changeTradeRoutes( -min(CyGame().getTradeRoutes(), abs(iChange))) self.placeStats() elif inputClass.getFunctionName().find("AIAutoPlay") > -1: if inputClass.getData1() == 1030: CyGame().setAIAutoPlay(CyGame().getAIAutoPlay() + abs(iChange)) elif inputClass.getData1() == 1031: CyGame().setAIAutoPlay( max(0, CyGame().getAIAutoPlay() - abs(iChange))) self.placeStats() elif inputClass.getFunctionName() == "WBGameOptions": iGameOption = inputClass.getData2() if iGameOption < gc.getNumGameOptionInfos(): CyGame().setOption(iGameOption, not CyGame().isOption(iGameOption)) self.checkOptions(iGameOption) else: # Enabling/disabling secondary civs if iGameOption < 2000: iItem = iGameOption - 1000 data.setPlayerEnabled(iItem, not data.isPlayerEnabled(iItem)) # Enabling/disabling RFC options elif iGameOption == 2000: data.bIgnoreAI = not data.bIgnoreAI elif iGameOption == 2001: data.bUnlimitedSwitching = not data.bUnlimitedSwitching elif iGameOption == 2002: data.bNoCongressOption = not data.bNoCongressOption elif iGameOption == 2003: data.bNoPlagues = not data.bNoPlagues # Stored Variables elif iGameOption == 3001: data.bAlreadySwitched = not data.bAlreadySwitched elif iGameOption == 3002 and cong.isCongressEnabled(): data.iCongressTurns = max(1, data.iCongressTurns + iChange) self.placeGameOptions() elif inputClass.getFunctionName() == "HiddenOptions": bHiddenOption = not bHiddenOption self.placeGameOptions() elif inputClass.getFunctionName() == "AllowsRepeat": bRepeat = not bRepeat iSelectedCiv = -1 iSelectedLeader = -1 self.placeNewPlayer() elif inputClass.getFunctionName() == "WBNewCiv": iSelectedCiv = inputClass.getData2() iSelectedLeader = -1 self.interfaceScreen() elif inputClass.getFunctionName() == "WBNewLeader": iSelectedLeader = inputClass.getData2() self.interfaceScreen() elif inputClass.getFunctionName() == "CreatePlayer": for i in xrange(gc.getMAX_CIV_PLAYERS()): if not gc.getPlayer(i).isEverAlive(): CyGame().addPlayer(i, iSelectedLeader, iSelectedCiv) break screen.hideScreen() self.top.m_iCurrentPlayer = i self.top.normalPlayerTabModeCB() elif inputClass.getFunctionName() == "GameEditScriptData": popup = Popup.PyPopup(4444, EventContextTypes.EVENTCONTEXT_ALL) popup.setHeaderString(CyTranslator().getText( "TXT_KEY_WB_SCRIPT", ())) popup.createEditBox(CyGame().getScriptData()) popup.launch() return 1