def onGameStart(self, argsList): 'Called at the start of the game' data.setup() self.rnf.setup() self.pla.setup() dc.setup() self.aiw.setup() vic.setup() cong.setup() # Leoreth: set DLL core values Modifiers.init() Areas.init() SettlerMaps.init() WarMaps.init() RegionMap.init() Civilizations.init() AIParameters.init() return 0
def onGameStart(self, argsList): 'Called at the start of the game' data.setup() self.rnf.setup() self.pla.setup() dc.setup() self.aiw.setup() self.up.setup() vic.setup() cong.setup() # Leoreth: set DLL core values Modifiers.init() Areas.init() SettlerMaps.init() WarMaps.init() RegionMap.init() Civilizations.init() AIParameters.init() return 0
def exportSettlerMap(iPlayer, bForce=False, bAll=False): iCiv = gc.getPlayer(iPlayer).getCivilizationType() sName = gc.getCivilizationInfo(iCiv).getShortDescription(0) if iPlayer == iHolyRome: sName = "HolyRome" elif iPlayer == iAztecs: sName = "Aztecs" bSettlerValueChanged = bForce if not bSettlerValueChanged: for (x, y) in utils.getWorldPlotsList(): plot = gc.getMap().plot(x, y) if plot.getSettlerValue(iPlayer) != SettlerMaps.getMapValue( iCiv, x, y): bSettlerValueChanged = True break if bSettlerValueChanged: file = open(IMAGE_LOCATION + "\SettlerValues\\" + sName + ".txt", 'wt') try: file.write("(") for y in reversed(range(iWorldY)): sLine = "(\t" for x in range(iWorldX): plot = gc.getMap().plot(x, y) if plot.isWater() or (plot.isPeak() and (x, y) not in Areas.lPeakExceptions): iValue = 20 else: iValue = plot.getSettlerValue(iPlayer) sLine += "%d,\t" % iValue if y == 0: sLine += "))," else: sLine += "),\n" file.write(sLine) finally: file.close() sText = "Settlermap of %s exported" % sName else: sText = "No changes between current settlervalues and values defined in python" if bAll: if iPlayer == iNumPlayers - 1: sText = "Settlermaps of all Civs exported" else: return popup = PyPopup.PyPopup() popup.setBodyString(sText) popup.launch(True, PopupStates.POPUPSTATE_IMMEDIATE)
def exportSettlerMap(iPlayer, bForce = False, bAll = False): iCiv = gc.getPlayer(iPlayer).getCivilizationType() sName = gc.getCivilizationInfo(iCiv).getShortDescription(0) if iPlayer == iHolyRome: sName = "HolyRome" elif iPlayer == iAztecs: sName = "Aztecs" bSettlerValueChanged = bForce if not bSettlerValueChanged: for (x, y) in utils.getWorldPlotsList(): if getSettlerValue(iPlayer, (x, y)) != SettlerMaps.getMapValue(iCiv, x, y): bSettlerValueChanged = True break if bSettlerValueChanged: file = open(IMAGE_LOCATION + "\SettlerValues\\" + sName + ".txt", 'wt') try: file.write("(") for y in reversed(range(iWorldY)): sLine = "(\t" for x in range(iWorldX): plot = gc.getMap().plot(x, y) if plot.isWater() or (plot.isPeak() and (x, y) not in Areas.lPeakExceptions): iValue = 20 else: iValue = getSettlerValue(iPlayer, (x, y)) sLine += "%d,\t" % iValue if y == 0: sLine += "))," else: sLine += "),\n" file.write(sLine) finally: file.close() sText = "Settlermap of %s exported" %sName else: sText = "No changes between current settlervalues and values defined in python" if bAll: if iPlayer == iNumPlayers-1: sText = "Settlermaps of all Civs exported" else: return popup = PyPopup.PyPopup() popup.setBodyString(sText) popup.launch(True, PopupStates.POPUPSTATE_IMMEDIATE)
def resetSettler(iPlayer): SettlerMaps.updateMap(iPlayer)