Beispiel #1
0
def exportCore(iPlayer, bForce=False):
    iCiv = gc.getPlayer(iPlayer).getCivilizationType()
    sName = gc.getCivilizationInfo(iCiv).getShortDescription(0)
    if iPlayer == iHolyRome:
        sName = "HolyRome"
    elif iPlayer == iAztecs:
        sName = "Aztecs"

    lCorePlotList = Areas.getCoreArea(iPlayer)
    bCoreChanged = bForce
    if not bCoreChanged:
        for (x, y) in utils.getWorldPlotsList():
            bOldCore = (x, y) in lCorePlotList
            if gc.getMap().plot(x, y).isCore(iPlayer) != bOldCore:
                bCoreChanged = True
                break
    if bCoreChanged:
        lCorePlots = [(x, y) for (x, y) in utils.getWorldPlotsList()
                      if gc.getMap().plot(x, y).isCore(iPlayer)]
        BL, TR = getTLBR(lCorePlots)

        lExceptions = []
        for (x, y) in utils.getPlotList(BL, TR):
            plot = gc.getMap().plot(x, y)
            if not plot.isCore(iPlayer) and not (
                    plot.isWater() or (plot.isPeak() and
                                       (x, y) not in Areas.lPeakExceptions)):
                lExceptions.append((x, y))

        file = open(IMAGE_LOCATION + "\Cores\\" + sName + ".txt", 'wt')
        try:
            if not utils.isReborn(iPlayer):
                file.write("# tCoreArea\n")
                file.write("(" + str(BL) + ",\t" + str(TR) + "),\t# " + sName)
                if lExceptions:
                    file.write("\n\n# dCoreAreaExceptions\n")
                    file.write("i" + sName + " : " + str(lExceptions) + ",")
            else:
                file.write("# dChangedCoreArea\n")
                file.write("i" + sName + " : "
                           "(" + str(BL) + ",\t" + str(TR) + "),")
                if lExceptions:
                    file.write("\n\n# dChangedCoreAreaExceptions\n")
                    file.write("i" + sName + " : " + str(lExceptions) + ",")
        finally:
            file.close()
        sText = "Core map of %s exported" % sName
    else:
        sText = "No changes between current core and core defined in python"
    popup = PyPopup.PyPopup()
    popup.setBodyString(sText)
    popup.launch(True, PopupStates.POPUPSTATE_IMMEDIATE)
Beispiel #2
0
def exportRegionMap(bForce = False):
	bAutoWater = True

	bMapChanged = bForce
	if not bMapChanged:
		for (x, y) in utils.getWorldPlotsList():
			plot = gc.getMap().plot(x, y)
			if plot.getRegionID() != RegionMap.getMapValue(x, y):
				bMapChanged = True
				break
	if bMapChanged:
		file = open(IMAGE_LOCATION + "\Other\\RegionMap.txt", 'wt')
		try:
			file.write("tRegionMap = ( \n")
			for y in reversed(range(iWorldY)):
				sLine = "(\t"
				for x in range(iWorldX):
					plot = gc.getMap().plot(x, y)
					if plot.isWater() and bAutoWater:
						iValue = -1
					else:
						iValue = plot.getRegionID()
					sLine += "%d,\t" % iValue
				sLine += "),\n"
				file.write(sLine)
			file.write(")")
		finally:
			file.close()
		sText = "Regionmap exported"
	else:
		sText = "No changes between current regionmap and values defined in python"
	popup = PyPopup.PyPopup()
	popup.setBodyString(sText)
	popup.launch(True, PopupStates.POPUPSTATE_IMMEDIATE)
 def setBillyTheBlackSheep(self):
     lPlots = [(x, y) for (x, y) in utils.getWorldPlotsList()
               if gc.getMap().plot(x, y).getBonusType(-1) == iSheep
               and gc.getMap().plot(x, y).getBonusVarietyType(-1) == -1]
     tSheepPlot = utils.getRandomEntry(lPlots)
     if tSheepPlot:
         gc.getMap().plot(tSheepPlot[0],
                          tSheepPlot[1]).setBonusVarietyType(iSheepBlack)
Beispiel #4
0
def exportAllCores():
	lAllCores = []
	lAllExceptions = []
	for iPlayer in range(iNumPlayers):
		iCiv = gc.getPlayer(iPlayer).getCivilizationType()
		sName = gc.getCivilizationInfo(iCiv).getShortDescription(0)
		if iPlayer == iHolyRome:
			sName = "HolyRome"
		elif iPlayer == iAztecs:
			sName = "Aztecs"

		Bottom = iWorldY
		Top = 0
		Left = iWorldX
		Right = 0
		for (x, y) in utils.getWorldPlotsList():
			if gc.getMap().plot(x, y).isCore(iPlayer):
				if x < Left:
					Left = x
				if x > Right:
					Right = x
				if y < Bottom:
					Bottom = y
				if y > Top:
					Top = y
		BL = (Left, Bottom)
		TR = (Right, Top)

		lExceptions = []
		for (x, y) in utils.getPlotList(BL, TR):
			plot = gc.getMap().plot(x, y)
			if not plot.isCore(iPlayer) and not (plot.isWater() or (plot.isPeak() and (x, y) not in Areas.lPeakExceptions)):
				lExceptions.append((x, y))

		lAllCores.append("("+ str(BL) + ",\t" + str(TR) + "),\t# " + sName)
		if lExceptions:
			lAllExceptions.append("i" + sName + " : " + str(lExceptions) + ",")

	file = open(IMAGE_LOCATION + "\Cores\\AllCores.txt", 'wt')
	try:
		file.write("tCoreArea = (\n")
		for sString in lAllCores:
			file.write(sString + "\n")
		file.write(")")
		file.write("\n\ndCoreAreaExceptions = {\n")
		for sString in lAllExceptions:
			file.write(sString + "\n")
		file.write("}")
	finally:
		file.close()
	sText = "All core maps exported"
	popup = PyPopup.PyPopup()
	popup.setBodyString(sText)
	popup.launch(True, PopupStates.POPUPSTATE_IMMEDIATE)
def exportAllCores():
	lAllCores = []
	lAllExceptions = []
	for iPlayer in range(iNumPlayers):
		iCiv = gc.getPlayer(iPlayer).getCivilizationType()
		sName = gc.getCivilizationInfo(iCiv).getShortDescription(0)
		if iPlayer == iHolyRome:
			sName = "HolyRome"
		elif iPlayer == iAztecs:
			sName = "Aztecs"

		Bottom = iWorldY
		Top = 0
		Left = iWorldX
		Right = 0
		for (x, y) in utils.getWorldPlotsList():
			if gc.getMap().plot(x, y).isCore(iPlayer):
				if x < Left:
					Left = x
				if x > Right:
					Right = x
				if y < Bottom:
					Bottom = y
				if y > Top:
					Top = y
		BL = (Left, Bottom)
		TR = (Right, Top)

		lExceptions = []
		for (x, y) in utils.getPlotList(BL, TR):
			plot = gc.getMap().plot(x, y)
			if not plot.isCore(iPlayer) and not (plot.isWater() or (plot.isPeak() and (x, y) not in Areas.lPeakExceptions)):
				lExceptions.append((x, y))

		lAllCores.append("("+ str(BL) + ",\t" + str(TR) + "),\t# " + sName)
		if lExceptions:
			lAllExceptions.append("i" + sName + " : " + str(lExceptions) + ",")

	file = open(IMAGE_LOCATION + "\Cores\\AllCores.txt", 'wt')
	try:
		file.write("tCoreArea = (\n")
		for sString in lAllCores:
			file.write(sString + "\n")
		file.write(")")
		file.write("\n\ndCoreAreaExceptions = {\n")
		for sString in lAllExceptions:
			file.write(sString + "\n")
		file.write("}")
	finally:
		file.close()
	sText = "All core maps exported"
	popup = PyPopup.PyPopup()
	popup.setBodyString(sText)
	popup.launch(True, PopupStates.POPUPSTATE_IMMEDIATE)
Beispiel #6
0
def exportWarMap(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"

    bWarMapChanged = bForce
    if not bWarMapChanged:
        for (x, y) in utils.getWorldPlotsList():
            plot = gc.getMap().plot(x, y)
            if plot.getWarValue(iPlayer) != WarMaps.getMapValue(iCiv, x, y):
                bWarMapChanged = True
                break
    if bWarMapChanged:
        file = open(IMAGE_LOCATION + "\WarMaps\\" + 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 = 0
                    elif plot.isCore(iPlayer):
                        iValue = max(8, plot.getWarValue(iPlayer))
                    else:
                        iValue = plot.getWarValue(iPlayer)
                    sLine += "%d,\t" % iValue
                if y == 0:
                    sLine += ")),"
                else:
                    sLine += "),\n"
                file.write(sLine)
        finally:
            file.close()
        sText = "Warmap of %s exported" % sName
    else:
        sText = "No changes between current warvalues and values defined in python"
    if bAll:
        if iPlayer == iNumPlayers - 1:
            sText = "Warmaps of all Civs exported"
        else:
            return
    popup = PyPopup.PyPopup()
    popup.setBodyString(sText)
    popup.launch(True, PopupStates.POPUPSTATE_IMMEDIATE)
def exportWarMap(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"

	bWarMapChanged = bForce
	if not bWarMapChanged:
		for (x, y) in utils.getWorldPlotsList():
			if getWarValue(iPlayer, (x, y)) != WarMaps.getMapValue(iCiv, x, y):
				bWarMapChanged = True
				break
	if bWarMapChanged:
		file = open(IMAGE_LOCATION + "\WarMaps\\" + 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 = 0
					elif plot.isCore(iPlayer):
						iValue = max(8, getWarValue(iPlayer, (x, y)))
					else:
						iValue = getWarValue(iPlayer, (x, y))
					sLine += "%d,\t" % iValue
				if y == 0:
					sLine += ")),"
				else:
					sLine += "),\n"
				file.write(sLine)
		finally:
			file.close()
		sText = "Warmap of %s exported" %sName
	else:
		sText = "No changes between current warvalues and values defined in python"
	if bAll:
		if iPlayer == iNumPlayers-1:
			sText = "Warmaps of all Civs exported"
		else:
			return
	popup = PyPopup.PyPopup()
	popup.setBodyString(sText)
	popup.launch(True, PopupStates.POPUPSTATE_IMMEDIATE)
	def selectClaims(self, iPlayer):
		pPlayer = gc.getPlayer(iPlayer)
		iGameTurn = gc.getGame().getGameTurn()
		iNumPlayersAlive = gc.getGame().countCivPlayersAlive()
		lPlots = []
		
		for iLoopPlayer in range(iNumTotalPlayers+1):
			if iLoopPlayer == iPlayer: continue
			if not gc.getPlayer(iLoopPlayer).isAlive(): continue
			
			# after a war: winners can only claim from losers and vice versa
			if self.bPostWar:
				if iPlayer in self.lWinners and iLoopPlayer not in self.lLosers: continue
				if iPlayer in self.lLosers and iLoopPlayer not in self.lWinners: continue
				
			# AI civs: cannot claim cities from friends
			if utils.getHumanID() != iPlayer and pPlayer.AI_getAttitude(iLoopPlayer) >= AttitudeTypes.ATTITUDE_FRIENDLY: continue
			
			# recently born
			if iGameTurn < getTurnForYear(tBirth[iLoopPlayer]) + utils.getTurns(20): continue
			
			# recently resurrected
			if iGameTurn < pPlayer.getLatestRebellionTurn() + utils.getTurns(20): continue
			
			# recently reborn
			if utils.isReborn(iLoopPlayer) and tRebirth != -1 and iGameTurn < getTurnForYear(tRebirth[iLoopPlayer]) + utils.getTurns(20): continue
			
			# exclude master/vassal relationships
			if gc.getTeam(iPlayer).isVassal(iLoopPlayer): continue
			if gc.getTeam(iLoopPlayer).isVassal(iPlayer): continue
			
			# cannot demand cities while at war
			if gc.getTeam(iPlayer).isAtWar(iLoopPlayer): continue
			
			for city in utils.getCityList(iLoopPlayer):
				x, y = city.getX(), city.getY()
				plot = gc.getMap().plot(x, y)
				iSettlerMapValue = plot.getSettlerValue(iPlayer)
				iValue = 0
				
				if not plot.isRevealed(iPlayer, False): continue
				if city.isCapital(): continue
				
				# after a war: losers can only claim previously owned cities
				if self.bPostWar and iPlayer in self.lLosers:
					if city.getGameTurnPlayerLost(iPlayer) < gc.getGame().getGameTurn() - utils.getTurns(25): continue
				
				# city culture
				iTotalCulture = city.countTotalCultureTimes100()
				if iTotalCulture > 0:
					iCultureRatio = city.getCultureTimes100(iPlayer) * 100 / iTotalCulture
					if iCultureRatio > 20:
						if iLoopPlayer != iAmerica:
							iValue += iCultureRatio / 20
							
				# ever owned
				if city.isEverOwned(iPlayer):
					iValue += 3
						
				# own core
				if plot.isCore(iPlayer):
					iValue += 5
							
				# colonies
				if iPlayer in lCivGroups[0]:
					if iLoopPlayer >= iNumPlayers or (iLoopPlayer not in lCivGroups[0] and utils.getStabilityLevel(iLoopPlayer) < iStabilityShaky) or (iLoopPlayer in lCivGroups[0] and utils.getHumanID() != iLoopPlayer and pPlayer.AI_getAttitude(iLoopPlayer) < AttitudeTypes.ATTITUDE_PLEASED):
						if plot.getRegionID() not in lEurope and plot.getRegionID() not in lMiddleEast:
							if iSettlerMapValue > 90:
								iValue += max(1, iSettlerMapValue / 100)
									
				# weaker and collapsing empires
				if iLoopPlayer < iNumPlayers:
					if gc.getGame().getPlayerRank(iLoopPlayer) > iNumPlayersAlive / 2 and gc.getGame().getPlayerRank(iLoopPlayer) < iNumPlayersAlive / 2:
						if data.players[iLoopPlayer].iStabilityLevel == iStabilityCollapsing:
							if iSettlerMapValue >= 90:
								iValue += max(1, iSettlerMapValue / 100)
									
				# close to own empire
				closestCity = gc.getMap().findCity(x, y, iPlayer, TeamTypes.NO_TEAM, False, False, TeamTypes.NO_TEAM, DirectionTypes.NO_DIRECTION, city)
				iDistance = stepDistance(x, y, closestCity.getX(), closestCity.getY())
				if iDistance < 5:
					iValue += 5-iDistance
					
				# after war: war targets
				if self.bPostWar:
					iValue += plot.getWarValue(iPlayer) / 2
					
				# AI America receives extra value for claims in the west
				if iPlayer == iAmerica and utils.getHumanID() != iPlayer:
					if utils.isPlotInArea((x, y), tAmericanClaimsTL, tAmericanClaimsBR):
						iValue += 5
						
				# help AI Australia gain Australia
				if iPlayer == iAustralia and utils.getHumanID() != iPlayer:
					if utils.isPlotInArea((x, y), tAustraliaTL, tAustraliaBR):
						iValue += 5
						
				# help Canada gain Labrador and Newfoundland
				if iPlayer == iCanada:
					if utils.isPlotInArea((x, y), tNewfoundlandTL, tNewfoundlandBR):
						iValue += 5
					
				if iValue > 0:
					lPlots.append((x, y, iValue))
		
		# extra spots for colonial civs -> will be settled
		# not available after wars because these congresses are supposed to reassign cities
		if iPlayer in lCivGroups[0] and not self.bPostWar:
			for (x, y) in utils.getWorldPlotsList():
				if utils.getHumanID() == iPlayer and not plot.isRevealed(iPlayer, False): continue
				plot = gc.getMap().plot(x, y)
				if not plot.isCity() and not plot.isPeak() and not plot.isWater() and pPlayer.canFound(x, y):
					if plot.getRegionID() in [rWestAfrica, rSouthAfrica, rEthiopia] or (plot.getRegionID() == [rAustralia, rOceania] and gc.getGame().getGameTurn() < tBirth[iAustralia]) or (plot.getRegionID() == rSouthAfrica and gc.getGame().getGameTurn() < tBirth[iBoers]):
						iSettlerMapValue = plot.getSettlerValue(iPlayer)
						if iSettlerMapValue >= 90 and cnm.getFoundName(iPlayer, (x, y)):
							closestCity = gc.getMap().findCity(x, y, PlayerTypes.NO_PLAYER, TeamTypes.NO_TEAM, False, False, TeamTypes.NO_TEAM, DirectionTypes.NO_DIRECTION, CyCity())
							if stepDistance(x, y, closestCity.getX(), closestCity.getY()) > 2:
								lPlots.append((x, y, max(1, iSettlerMapValue / 100 - 1)))
						
		lPlots = utils.getSortedList(lPlots, lambda x: x[2] + gc.getGame().getSorenRandNum(3, 'Randomize city value'), True)
		return lPlots[:10]
	def selectClaims(self, iPlayer):
		pPlayer = gc.getPlayer(iPlayer)
		iGameTurn = gc.getGame().getGameTurn()
		iNumPlayersAlive = gc.getGame().countCivPlayersAlive()
		lPlots = []
		
		for iLoopPlayer in range(iNumTotalPlayers+1):
			if iLoopPlayer == iPlayer: continue
			if not gc.getPlayer(iLoopPlayer).isAlive(): continue
			
			# after a war: winners can only claim from losers and vice versa
			if self.bPostWar:
				if iPlayer in self.lWinners and iLoopPlayer not in self.lLosers: continue
				if iPlayer in self.lLosers and iLoopPlayer not in self.lWinners: continue
				
			# AI civs: cannot claim cities from friends
			if utils.getHumanID() != iPlayer and pPlayer.AI_getAttitude(iLoopPlayer) >= AttitudeTypes.ATTITUDE_FRIENDLY: continue
			
			# recently born
			if iGameTurn < getTurnForYear(tBirth[iLoopPlayer]) + utils.getTurns(20): continue
			
			# recently resurrected
			if iGameTurn < pPlayer.getLatestRebellionTurn() + utils.getTurns(20): continue
			
			# recently reborn
			if utils.isReborn(iLoopPlayer) and tRebirth != -1 and iGameTurn < getTurnForYear(tRebirth[iLoopPlayer]) + utils.getTurns(20): continue
			
			# exclude master/vassal relationships
			if gc.getTeam(iPlayer).isVassal(iLoopPlayer): continue
			if gc.getTeam(iLoopPlayer).isVassal(iPlayer): continue
			
			# cannot demand cities while at war
			if gc.getTeam(iPlayer).isAtWar(iLoopPlayer): continue
			
			for city in utils.getCityList(iLoopPlayer):
				x, y = city.getX(), city.getY()
				plot = gc.getMap().plot(x, y)
				iSettlerMapValue = plot.getSettlerValue(iPlayer)
				iValue = 0
				
				if not plot.isRevealed(iPlayer, False): continue
				if city.isCapital(): continue
				
				# after a war: losers can only claim previously owned cities
				if self.bPostWar and iPlayer in self.lLosers:
					if city.getGameTurnPlayerLost(iPlayer) < gc.getGame().getGameTurn() - utils.getTurns(25): continue
				
				# city culture
				iTotalCulture = city.countTotalCultureTimes100()
				if iTotalCulture > 0:
					iCultureRatio = city.getCultureTimes100(iPlayer) * 100 / iTotalCulture
					if iCultureRatio > 20:
						if iLoopPlayer != iAmerica:
							iValue += iCultureRatio / 20
							
				# ever owned
				if city.isEverOwned(iPlayer):
					iValue += 3
						
				# own core
				if plot.isCore(iPlayer):
					iValue += 5
							
				# colonies
				if iPlayer in lCivGroups[0]:
					if iLoopPlayer >= iNumPlayers or (iLoopPlayer not in lCivGroups[0] and utils.getStabilityLevel(iLoopPlayer) < iStabilityShaky) or (iLoopPlayer in lCivGroups[0] and utils.getHumanID() != iLoopPlayer and pPlayer.AI_getAttitude(iLoopPlayer) < AttitudeTypes.ATTITUDE_PLEASED):
						if plot.getRegionID() not in lEurope and plot.getRegionID() not in lMiddleEast:
							if iSettlerMapValue > 90:
								iValue += max(1, iSettlerMapValue / 100)
									
				# weaker and collapsing empires
				if iLoopPlayer < iNumPlayers:
					if gc.getGame().getPlayerRank(iLoopPlayer) > iNumPlayersAlive / 2 and gc.getGame().getPlayerRank(iLoopPlayer) < iNumPlayersAlive / 2:
						if data.players[iLoopPlayer].iStabilityLevel == iStabilityCollapsing:
							if iSettlerMapValue >= 90:
								iValue += max(1, iSettlerMapValue / 100)
									
				# close to own empire
				closestCity = gc.getMap().findCity(x, y, iPlayer, TeamTypes.NO_TEAM, False, False, TeamTypes.NO_TEAM, DirectionTypes.NO_DIRECTION, city)
				iDistance = stepDistance(x, y, closestCity.getX(), closestCity.getY())
				if iDistance < 5:
					iValue += 5-iDistance
					
				# after war: war targets
				if self.bPostWar:
					iValue += plot.getWarValue(iPlayer) / 2
					
				# AI America receives extra value for claims in the west
				if iPlayer == iAmerica and utils.getHumanID() != iPlayer:
					if utils.isPlotInArea((x, y), tAmericanClaimsTL, tAmericanClaimsBR):
						iValue += 5
						
				# help Canada gain Labrador and Newfoundland
				if iPlayer == iCanada:
					if utils.isPlotInArea((x, y), tNewfoundlandTL, tNewfoundlandBR):
						iValue += 5
					
				if iValue > 0:
					lPlots.append((x, y, iValue))
		
		# extra spots for colonial civs -> will be settled
		# not available after wars because these congresses are supposed to reassign cities
		if iPlayer in lCivGroups[0] and not self.bPostWar:
			for (x, y) in utils.getWorldPlotsList():
				if utils.getHumanID() == iPlayer and not plot.isRevealed(iPlayer, False): continue
				plot = gc.getMap().plot(x, y)
				if not plot.isCity() and not plot.isPeak() and not plot.isWater() and pPlayer.canFound(x, y):
					if plot.getRegionID() in [rWestAfrica, rSouthAfrica, rEthiopia, rAustralia, rOceania]:
						iSettlerMapValue = plot.getSettlerValue(iPlayer)
						if iSettlerMapValue >= 90 and cnm.getFoundName(iPlayer, (x, y)):
							closestCity = gc.getMap().findCity(x, y, PlayerTypes.NO_PLAYER, TeamTypes.NO_TEAM, False, False, TeamTypes.NO_TEAM, DirectionTypes.NO_DIRECTION, CyCity())
							if stepDistance(x, y, closestCity.getX(), closestCity.getY()) > 2:
								lPlots.append((x, y, max(1, iSettlerMapValue / 100 - 1)))
						
		lPlots = utils.getSortedList(lPlots, lambda x: x[2] + gc.getGame().getSorenRandNum(3, 'Randomize city value'), True)
		return lPlots[:10]
def exportCore(iPlayer, bForce = False):
	iCiv = gc.getPlayer(iPlayer).getCivilizationType()
	sName = gc.getCivilizationInfo(iCiv).getShortDescription(0)
	if iPlayer == iHolyRome:
		sName = "HolyRome"
	elif iPlayer == iAztecs:
		sName = "Aztecs"

	lCorePlotList = Areas.getCoreArea(iPlayer)
	bCoreChanged = bForce
	if not bCoreChanged:
		for (x, y) in utils.getWorldPlotsList():
			bOldCore = (x, y) in lCorePlotList
			if gc.getMap().plot(x, y).isCore(iPlayer) != bOldCore:
				bCoreChanged = True
				break
	if bCoreChanged:
		Bottom = iWorldY
		Top = 0
		Left = iWorldX
		Right = 0
		for (x, y) in utils.getWorldPlotsList():
			if gc.getMap().plot(x, y).isCore(iPlayer):
				if x < Left:
					Left = x
				if x > Right:
					Right = x
				if y < Bottom:
					Bottom = y
				if y > Top:
					Top = y
		BL = (Left, Bottom)
		TR = (Right, Top)

		lExceptions = []
		for (x, y) in utils.getPlotList(BL, TR):
			plot = gc.getMap().plot(x, y)
			if not plot.isCore(iPlayer) and not (plot.isWater() or (plot.isPeak() and (x, y) not in Areas.lPeakExceptions)):
				lExceptions.append((x, y))

		file = open(IMAGE_LOCATION + "\Cores\\" + sName + ".txt", 'wt')
		try:
			if not utils.isReborn(iPlayer):
				file.write("# tCoreArea\n")
				file.write("("+ str(BL) + ",\t" + str(TR) + "),\t# " + sName)
				if lExceptions:
					file.write("\n\n# dCoreAreaExceptions\n")
					file.write("i" + sName + " : " + str(lExceptions) + ",")
			else:
				file.write("# dChangedCoreArea\n")
				file.write("i" + sName + " : " "("+ str(BL) + ",\t" + str(TR) + "),")
				if lExceptions:
					file.write("\n\n# dChangedCoreAreaExceptions\n")
					file.write("i" + sName + " : " + str(lExceptions) + ",")
		finally:
			file.close()
		sText = "Core map of %s exported" %sName
	else:
		sText = "No changes between current core and core defined in python"
	popup = PyPopup.PyPopup()
	popup.setBodyString(sText)
	popup.launch(True, PopupStates.POPUPSTATE_IMMEDIATE)
	def refreshMap(self):
		screen = CyGInterfaceScreen("WBInfoScreen", CvScreenEnums.WB_INFO)
		global lSelectedItem
		screen.minimapClearAllFlashingTiles()
		screen.bringMinimapToFront()
		sHeader = ""
		if iItem == -1 and iMode < 14:
			screen.hide("InfoHeader")
			return

		iColorA = gc.getInfoTypeForString(self.iColorA)
		iColorB = gc.getInfoTypeForString(self.iColorB)
		iX = screen.getXResolution()/3 + 20
		iY = screen.getYResolution() *2/3 + 30
		iWidth = screen.getXResolution() * 2/3 - 40
		iHeight = (screen.getYResolution() - iY - 40) / 24 * 24 + 2

		nColumns = iWidth / self.iMinColWidth
		if iMode < 14:
			screen.addTableControlGFC("PlotTable", nColumns, iX, iY, iWidth, iHeight, False, True, 24, 24, TableStyles.TABLE_STYLE_STANDARD)
			for i in xrange(nColumns):
				screen.setTableColumnHeader("PlotTable", i, "", iWidth/nColumns)

		iCount = 0
		iMaxRows = -1
		if iItem != -1 and iMode < 14:
			lTemp = lItems[iItem][5]
			if not lSelectedItem in lTemp:
				if len(lTemp) > 0:
					lSelectedItem = lTemp[0]
				else:
					lSelectedItem = [-1, -1]
			sHeader = self.Mode[iMode](iItem).getDescription()
		else:
			if iItem != -1:
				sHeader = gc.getCivilizationInfo(gc.getPlayer(iItem).getCivilizationType()).getShortDescription(0)
		screen.setLabel("InfoHeader", "Background", "<font=4b>" + sHeader + "</font>", CvUtil.FONT_CENTER_JUSTIFY, screen.getXResolution()/2, 20, -0.1, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

		if iItem != -1 and iMode < 14:
			if not lSelectedItem in lTemp:
				screen.hide("PlotData")
				return
		self.placePlotData()

		if iMode < 2:
			for lPlots in lTemp:
				iPlayer = lPlots[0]
				iUnit = lPlots[1]
				pPlayer = gc.getPlayer(iPlayer)
				pUnit = pPlayer.getUnit(iUnit)
				if pUnit.isNone(): continue
				pPlot = pUnit.plot()
				iX = pPlot.getX()
				iY = pPlot.getY()
				iColumn = iCount % nColumns
				iRow = iCount / nColumns
				if iRow > iMaxRows:
					screen.appendTableRow("PlotTable")
					iMaxRows = iRow
				iCount += 1
				sColor = u"<color=%d,%d,%d,%d>" %(pPlayer.getPlayerTextColorR(), pPlayer.getPlayerTextColorG(), pPlayer.getPlayerTextColorB(), pPlayer.getPlayerTextColorA())
				sText = sColor + pUnit.getName()
				screen.setTableText("PlotTable", iColumn, iRow, "<font=3>" + sText + "</color></font>", pUnit.getButton(), WidgetTypes.WIDGET_PYTHON, 8300 + iPlayer, iUnit, CvUtil.FONT_LEFT_JUSTIFY)
				screen.minimapFlashPlot(iX, iY, iColorB, -1)
			pUnit = gc.getPlayer(lSelectedItem[0]).getUnit(lSelectedItem[1])
			if pUnit:
				screen.minimapFlashPlot(pUnit.getX(), pUnit.getY(), iColorA, -1)
		elif iMode < 6:
			for lPlots in lItems[iItem][5]:
				iPlayer = lPlots[0]
				iCity = lPlots[1]
				pPlayer = gc.getPlayer(iPlayer)
				pCity = pPlayer.getCity(iCity)
				if pCity.isNone(): continue
				pPlot = pCity.plot()
				iX = pPlot.getX()
				iY = pPlot.getY()
				iColumn = iCount % nColumns
				iRow = iCount / nColumns
				if iRow > iMaxRows:
					screen.appendTableRow("PlotTable")
					iMaxRows = iRow
				iCount += 1
				sColor = u"<color=%d,%d,%d,%d>" %(pPlayer.getPlayerTextColorR(), pPlayer.getPlayerTextColorG(), pPlayer.getPlayerTextColorB(), pPlayer.getPlayerTextColorA())
				sText = sColor + pCity.getName()
				sButton = gc.getCivilizationInfo(pCity.getCivilizationType()).getButton()
				screen.setTableText("PlotTable", iColumn, iRow, "<font=3>" + sText + "</color></font>", sButton, WidgetTypes.WIDGET_PYTHON, 7200 + iPlayer, iCity, CvUtil.FONT_LEFT_JUSTIFY)
				screen.minimapFlashPlot(iX, iY, iColorB, -1)
				if lSelectedItem == lPlots:
					screen.minimapFlashPlot(iX, iY, iColorA, -1)
		elif iMode < 11:
			for lPlots in lItems[iItem][5]:
				iX = lPlots[0]
				iY = lPlots[1]
				pPlot = CyMap().plot(iX, iY)
				if pPlot.isNone(): continue
				iColumn = iCount % nColumns
				iRow = iCount / nColumns
				if iRow > iMaxRows:
					screen.appendTableRow("PlotTable")
					iMaxRows = iRow
				iCount += 1
				sColor = ""
				sButton = CyArtFileMgr().getInterfaceArtInfo("INTERFACE_BUTTONS_CANCEL").getPath()
				iOwner = pPlot.getOwner()
				if iOwner > -1:
					pPlayer = gc.getPlayer(iOwner)
					sColor = u"<color=%d,%d,%d,%d>" %(pPlayer.getPlayerTextColorR(), pPlayer.getPlayerTextColorG(), pPlayer.getPlayerTextColorB(), pPlayer.getPlayerTextColorA())
					sButton = gc.getCivilizationInfo(pPlayer.getCivilizationType()).getButton()
				sText = u"%s(%d, %d)" % (sColor, iX, iY)
				screen.setTableText("PlotTable", iColumn, iRow, "<font=3>" + sText + "</color></font>", sButton, WidgetTypes.WIDGET_PYTHON, 1027, iX * 10000 + iY, CvUtil.FONT_CENTER_JUSTIFY)
				screen.minimapFlashPlot(iX, iY, iColorB, -1)
				if lSelectedItem == lPlots:
					screen.minimapFlashPlot(iX, iY, iColorA, -1)
		elif iMode < 14:
			for lPlots in lItems[iItem][5]:
				iPlayer = lPlots[0]
				if iMode > 11:
					iPlayer = gc.getTeam(lPlots[0]).getLeaderID()
				iColumn = iCount % nColumns
				iRow = iCount / nColumns
				if iRow > iMaxRows:
					screen.appendTableRow("PlotTable")
					iMaxRows = iRow
				iCount += 1
				pPlayer = gc.getPlayer(iPlayer)
				iLeader = pPlayer.getLeaderType()
				sColor = u"<color=%d,%d,%d,%d>" %(pPlayer.getPlayerTextColorR(), pPlayer.getPlayerTextColorG(), pPlayer.getPlayerTextColorB(), pPlayer.getPlayerTextColorA())
				sButton = gc.getLeaderHeadInfo(iLeader).getButton()
				sText = u"%s%s" % (sColor, pPlayer.getName())
				screen.setTableText("PlotTable", iColumn, iRow, "<font=3>" + sText + "</color></font>", sButton, WidgetTypes.WIDGET_PYTHON, 7876, iPlayer * 10000 + iLeader, CvUtil.FONT_LEFT_JUSTIFY)
		elif iMode == 14 and iItem != -1:
			iPlayer = iItem
			tCapital = Areas.getCapital(iPlayer)
			for (x, y) in utils.getWorldPlotsList():
				plot = gc.getMap().plot(x, y)
				if plot.isWater(): continue
				if plot.isCore(iPlayer):
					iPlotType = iCore
				else:
					bForeignCore = Areas.isForeignCore(iPlayer, (x, y))
					iSettlerValue = plot.getSettlerValue(iPlayer)
					if iSettlerValue >= 90:
						if bForeignCore:
							iPlotType = iContest
						else:
							iPlotType = iHistorical
					elif iSettlerValue == 3 and bShowAIForbidden:
						iPlotType = iAIForbidden
					elif bForeignCore and bShowForeignCores:
						iPlotType = iForeignCore
					else:
						iPlotType = -1
				if iPlotType != -1:
					iColor = gc.getInfoTypeForString(lStabilityColors[iPlotType])
					screen.minimapFlashPlot(x, y, iColor, -1)

		elif iMode == 15 and iItem != -1:
			iColorS = gc.getInfoTypeForString(self.iColorSpawn)
			iColorSW = gc.getInfoTypeForString(self.iColorSpawnWater)
			iColorC = gc.getInfoTypeForString(lStabilityColors[2])
			iPlayer = iItem
			for tPlot in Areas.getBirthArea(iPlayer):
				plot = gc.getMap().plot(tPlot[0], tPlot[1])
				if plot.isWater():  screen.minimapFlashPlot(tPlot[0], tPlot[1], iColorSW, -1)
				else: screen.minimapFlashPlot(tPlot[0], tPlot[1], iColorS, -1)
			x, y = Areas.getCapital(iPlayer)
			screen.minimapFlashPlot(x, y, iColorC, -1)