Beispiel #1
0
def init():
	BuildingType("Temple", FontUtil.getChar("happy"), isTemple)
##--------	BUGFfH: Deleted by Denev 2009/10/12
	"""
	BuildingType("Cathedral", FontUtil.getChar("commerce culture"), isCathedral)
	BuildingType("Monastery", FontUtil.getChar("commerce research"), isMonastery)
	"""
##--------	BUGFfH: End Delete
	BuildingType("Shrine", FontUtil.getChar("commerce gold"), isShrine)
# MOD: Add a BuildingType() call for each new religious building type you define
#	BuildingType("Inquisition Office", FontUtil.getChar("cancel"), isInquisitionOffice)
	
##--------	BUGFfH: Modified by Denev 2009/10/13
	"""
	UnitType("Missionary", FontUtil.getChar("religion"), isMissionary)
	"""
	UnitType("Missionary", FontUtil.getChar("trade"), isMissionary)
##--------	BUGFfH: End Modify
# MOD: Add a BuildingType() call for each new religious unit type you define
#	UnitType("Inquisitor", FontUtil.getChar("religion"), isInquisitor)
##--------	BUGFfH: Added by Denev 2009/10/12
	UnitType("Priest", FontUtil.getChar("religion"), isPriest)
##--------	BUGFfH: End Add
	
	global NUM_RELIGIONS, ALL_RELIGIONS
	NUM_RELIGIONS = gc.getNumReligionInfos()
	ALL_RELIGIONS = range(NUM_RELIGIONS)
	for iReligion in ALL_RELIGIONS:
		BUILDINGS_BY_RELIGION.append([-1] * NUM_BUILDING_TYPES)
		UNITS_BY_RELIGION.append([-1] * NUM_UNIT_TYPES)
	
	for iBldg in range(gc.getNumBuildingInfos()):
		bldg = gc.getBuildingInfo(iBldg)
		iReligion = getBuildingReligion(bldg)
		if iReligion >= 0:
			for type in BUILDINGS:
				if type.matches(bldg, iReligion):
					BUILDINGS_BY_RELIGION[iReligion][type.index] = iBldg
					BugUtil.debug("ReligionUtil.init - %s %s is %i: %s", 
								gc.getReligionInfo(iReligion).getDescription(), type.description, iBldg, bldg.getDescription())
					break
	
	for iUnit in range(gc.getNumUnitInfos()):
		unit = gc.getUnitInfo(iUnit)
		iReligion = getUnitReligion(unit)
		if iReligion >= 0:
			for type in UNITS:
				if type.matches(unit, iReligion):
					UNITS_BY_RELIGION[iReligion][type.index] = iUnit
					BugUtil.debug("ReligionUtil.init - %s %s is %i: %s", 
								gc.getReligionInfo(iReligion).getDescription(), type.description, iUnit, unit.getDescription())
					break
	
	for iReligion in range(NUM_RELIGIONS):
		for index in range(NUM_BUILDING_TYPES):
			BugUtil.debug("F**K - %i bldg %i = %i", iReligion, index, getBuilding(iReligion, index))
		for index in range(NUM_UNIT_TYPES):
			BugUtil.debug("F**K - %i unit %i = %i", iReligion, index, getUnit(iReligion, index))
Beispiel #2
0
def getAttitudeText(nPlayer, nTarget, bNumber, bSmily, bWorstEnemy, bWarPeace,
                    bWarTrades):  # advc.152: bWarTrades added
    """Returns a string describing the attitude nPlayer has toward nTarget."""
    nAttitude = getAttitudeCount(nPlayer, nTarget)
    if nAttitude == None:
        return None

    szText = []
    if bSmily:
        szText.append(getAttitudeIcon(nPlayer, nTarget))
    if bNumber:
        szText.append(
            BugUtil.colorText(u"%+d" % nAttitude,
                              getAttitudeColor(nPlayer, nTarget)))

    szIcons = u""
    pPlayer = gc.getPlayer(nPlayer)
    pTarget = gc.getPlayer(nTarget)
    if bWorstEnemy and isWorstEnemy(pPlayer, pTarget):
        szIcons += FontUtil.getChar("angrypop")
    # <advc.152>
    bPeace = False
    # Moved from the bWarPeace branch:
    nTeam = pPlayer.getTeam()
    pTeam = gc.getTeam(nTeam)
    nTargetTeam = pTarget.getTeam()
    pTargetTeam = gc.getTeam(nTargetTeam)
    # </advc.152>
    if bWarPeace:
        if pTeam.isAtWar(nTargetTeam):
            szIcons += FontUtil.getChar("war")
        elif gc.getGame().getActiveTeam() in (nTeam, nTargetTeam):
            bPeace = False
            if pTeam.isForcePeace(nTargetTeam):
                bPeace = True
            elif pTargetTeam.isAVassal():
                for nOwnerTeam in range(gc.getMAX_TEAMS()):
                    if pTargetTeam.isVassal(nOwnerTeam) and pTeam.isForcePeace(
                            nOwnerTeam):
                        bPeace = True
                        break
            if bPeace:
                szIcons += FontUtil.getChar("peace")
    # <advc.152>
    if bWarTrades and not bPeace and nTargetTeam != gc.getGame().getActiveTeam(
    ) and nTeam != gc.getGame().getActiveTeam(
    ) and nTeam != nTargetTeam and not pTeam.isAtWar(
            nTargetTeam) and not pTeam.isHuman() and pTeam.AI_declareWarTrade(
                nTargetTeam,
                gc.getGame().getActiveTeam()) == -1:
        szIcons += FontUtil.getChar("occupation")
    # </advc.152>
    if szIcons:
        szText.append(szIcons)

    return u" ".join(szText)
Beispiel #3
0
def init():
	global g_gpIcon
	g_gpIcon = FontUtil.getChar("greatpeople")
	
	global g_gpUnitTypes
	g_gpUnitTypes = [None] * NUM_GP
	for i, s in enumerate(g_gpBarList):
		g_gpUnitTypes[i] = gc.getInfoTypeForString(s)
	
	global g_gpColors
	g_gpColors = [None] * NUM_GP
	g_gpColors[GP_SPY] = gc.getInfoTypeForString("COLOR_WHITE")
	g_gpColors[GP_ENGINEER] = gc.getYieldInfo(YieldTypes.YIELD_PRODUCTION).getColorType()
	g_gpColors[GP_MERCHANT] = gc.getInfoTypeForString("COLOR_YELLOW")
	g_gpColors[GP_SCIENTIST] = gc.getInfoTypeForString("COLOR_RESEARCH_STORED")
	g_gpColors[GP_ARTIST] = gc.getInfoTypeForString("COLOR_CULTURE_STORED")
	g_gpColors[GP_STATESMAN] = gc.getInfoTypeForString("COLOR_PLAYER_GOLDENROD")
	g_gpColors[GP_PROPHET] = gc.getInfoTypeForString("COLOR_BLUE")
	g_gpColors[GP_GENERAL] = gc.getInfoTypeForString("COLOR_RED")
	# MOD: specify color for each new great person (3)
	#g_gpColors[GP_DOCTOR] = gc.getInfoTypeForString("COLOR_WHITE")
	
	global g_unitIcons
	g_unitIcons = {}
	g_unitIcons[g_gpUnitTypes[GP_SPY]] = FontUtil.getChar(FontSymbols.COMMERCE_ESPIONAGE_CHAR)
	g_unitIcons[g_gpUnitTypes[GP_ENGINEER]] = FontUtil.getChar(FontSymbols.YIELD_PRODUCTION_CHAR)
	g_unitIcons[g_gpUnitTypes[GP_MERCHANT]] = FontUtil.getChar(FontSymbols.COMMERCE_GOLD_CHAR)
	g_unitIcons[g_gpUnitTypes[GP_SCIENTIST]] = FontUtil.getChar(FontSymbols.COMMERCE_RESEARCH_CHAR)
	g_unitIcons[g_gpUnitTypes[GP_ARTIST]] = FontUtil.getChar(FontSymbols.COMMERCE_CULTURE_CHAR)
	g_unitIcons[g_gpUnitTypes[GP_STATESMAN]] = FontUtil.getChar(FontSymbols.SCALES_CHAR)
	g_unitIcons[g_gpUnitTypes[GP_PROPHET]] = FontUtil.getChar(FontSymbols.RELIGION_CHAR)
	g_unitIcons[g_gpUnitTypes[GP_GENERAL]] = FontUtil.getChar(FontSymbols.GREAT_GENERAL_CHAR)
	def showPassiveMissionIcons(self, screen, szLeaderPanel, iEPoints, iDemoCost, iTechCost, iRow):
		# can see demographics icon
		if iEPoints >= iDemoCost:
			szText = FontUtil.getChar("ss life support")
		else:
			szText = FontUtil.getChar("space")

		# can see research icon
		if iEPoints >= iTechCost:
			szText += FontUtil.getChar("commerce research")
		else:
			szText += FontUtil.getChar("space")

		szName = self.getNextWidgetName()
		screen.setLabelAt(szName, szLeaderPanel, szText, CvUtil.FONT_LEFT_JUSTIFY, self.MissionLeaderPanel_X_PassiveMissions, iRow, self.Z_CONTROLS, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 );
Beispiel #5
0
def init():
	global g_gpIcon
	g_gpIcon = FontUtil.getChar("greatpeople")
	
	global g_gpUnitTypes
	g_gpUnitTypes = [None] * NUM_GP
	for i, s in enumerate(g_gpBarList):
		g_gpUnitTypes[i] = gc.getInfoTypeForString(s)
	
	global g_gpColors
	g_gpColors = [None] * NUM_GP
	g_gpColors[GP_ADVENTURER] = gc.getInfoTypeForString("COLOR_RED")
	g_gpColors[GP_ARTIST] = gc.getInfoTypeForString("COLOR_CULTURE_STORED")
	g_gpColors[GP_COMMANDER] = gc.getInfoTypeForString("COLOR_GREEN")
	g_gpColors[GP_ENGINEER] = gc.getYieldInfo(YieldTypes.YIELD_PRODUCTION).getColorType()
	g_gpColors[GP_MERCHANT] = gc.getInfoTypeForString("COLOR_YELLOW")
	g_gpColors[GP_PROPHET] = gc.getInfoTypeForString("COLOR_BLUE")
	g_gpColors[GP_SCIENTIST] = gc.getInfoTypeForString("COLOR_RESEARCH_STORED")
		
	global g_unitIcons
	g_unitIcons = {}

	g_unitIcons[g_gpUnitTypes[GP_ADVENTURER]] = u"%c" %(CyGame().getSymbolID(FontSymbols.STRENGTH_CHAR))
	g_unitIcons[g_gpUnitTypes[GP_ARTIST]] = u"%c" %(gc.getCommerceInfo(CommerceTypes.COMMERCE_CULTURE).getChar())
	g_unitIcons[g_gpUnitTypes[GP_COMMANDER]] = u"%c" %(CyGame().getSymbolID(FontSymbols.GREAT_GENERAL_CHAR))
	g_unitIcons[g_gpUnitTypes[GP_ENGINEER]] = u"%c" %(gc.getYieldInfo(YieldTypes.YIELD_PRODUCTION).getChar())
	g_unitIcons[g_gpUnitTypes[GP_MERCHANT]] = u"%c" %(gc.getCommerceInfo(CommerceTypes.COMMERCE_GOLD).getChar())
	g_unitIcons[g_gpUnitTypes[GP_PROPHET]] = u"%c" % CyGame().getSymbolID(FontSymbols.RELIGION_CHAR)
	g_unitIcons[g_gpUnitTypes[GP_SCIENTIST]] = u"%c" %(gc.getCommerceInfo(CommerceTypes.COMMERCE_RESEARCH).getChar())
Beispiel #6
0
def init (colors=DEFAULT_COLORS, modifiers=None):
	"""Initializes this module, raising ConfigError if any problems occur."""
	# create font icons for each attitude level
	global ATTITUDE_ICONS
	ATTITUDE_ICONS = [FontUtil.getChar(key) for key in ATTITUDE_KEYS]
	if len(ATTITUDE_ICONS) != NUM_ATTITUDES:
		raise BugUtil.ConfigError("Failed to create attitude icons")
	
	# convert colors to type IDs
	if len(colors) != NUM_ATTITUDES:
		raise BugUtil.ConfigError("Expected %d colors" % NUM_ATTITUDES)
	global ATTITUDE_COLORS
	ATTITUDE_COLORS = map(gc.getInfoTypeForString, colors)
	invalidCount = ATTITUDE_COLORS.count(-1)
	if invalidCount > 0:
		invalid = []
		for id, color in zip(ATTITUDE_COLORS, colors):
			if id == -1:
				invalid.append(color)
		raise BugUtil.ConfigError("Given %d invalid colors: %s" % (invalidCount, str(invalid)))

	# init modifiers, overriding default list as necessary
	if modifiers is not None and (isinstance(modifiers, list) or isinstance(modifiers, tuple)):
		global ATTITUDE_MODIFIERS
		ATTITUDE_MODIFIERS = tuple(modifiers)
	initModifiers()
Beispiel #7
0
def getText(key, values=(), default=None, replaceFontTags=True):
	"""
	Looks up a translated message in XML with a tuple of replacement parameters.
	It is safe to pass in a single value instead of tuple/list.
	If the key isn't found, the default is returned.
	"""
	if values is None:
		values = ()
	elif not isinstance(values, (tuple, list)):
		values = (values,)
	if isinstance(key, unicode):
		warn("getText - received Unicode key %s", key)
		key = str(key)
	text = localText.getText(key, values)
	if (text and text != key):
		if replaceFontTags:
			import FontUtil
			text = FontUtil.replaceSymbols(text)
		return text
	else:
		if default is not None:
			return default
		else:
			debug("BugUtil.getText - XML key %s not found", key)
			return "XML key %s not found" % key
def getText(key, values=(), default=None, replaceFontTags=True):
    """
	Looks up a translated message in XML with a tuple of replacement parameters.
	It is safe to pass in a single value instead of tuple/list.
	If the key isn't found, the default is returned.
	"""
    if values is None:
        values = ()
    elif not isinstance(values, (tuple, list)):
        values = (values, )
    if isinstance(key, unicode):
        warn("getText - received Unicode key %s", key)
        key = str(key)
    text = localText.getText(key, values)
    if (text and text != key):
        if replaceFontTags:
            import FontUtil
            text = FontUtil.replaceSymbols(text)
        return text
    else:
        if default is not None:
            return default
        else:
            debug("BugUtil.getText - XML key %s not found", key)
            return "XML key %s not found" % key
def init(colors=DEFAULT_COLORS, modifiers=None):
    """Initializes this module, raising ConfigError if any problems occur."""
    # create font icons for each attitude level
    global ATTITUDE_ICONS
    ATTITUDE_ICONS = [FontUtil.getChar(key) for key in ATTITUDE_KEYS]
    if len(ATTITUDE_ICONS) != NUM_ATTITUDES:
        raise BugUtil.ConfigError("Failed to create attitude icons")

    # convert colors to type IDs
    if len(colors) != NUM_ATTITUDES:
        raise BugUtil.ConfigError("Expected %d colors" % NUM_ATTITUDES)
    global ATTITUDE_COLORS
    ATTITUDE_COLORS = map(gc.getInfoTypeForString, colors)
    invalidCount = ATTITUDE_COLORS.count(-1)
    if invalidCount > 0:
        invalid = []
        for id, color in zip(ATTITUDE_COLORS, colors):
            if id == -1:
                invalid.append(color)
        raise BugUtil.ConfigError("Given %d invalid colors: %s" % (invalidCount, str(invalid)))

    # init modifiers, overriding default list as necessary
    if modifiers is not None and (isinstance(modifiers, list) or isinstance(modifiers, tuple)):
        global ATTITUDE_MODIFIERS
        ATTITUDE_MODIFIERS = tuple(modifiers)
    initModifiers()
def init():
    """
	Initializes the strings used to display the scoreboard.
	"""
    global columns

    # Used keys:
    # ABCDEFHIKLMNOPQRSTUVWZ*?
    # GJXY
    columns.append(Column('', ALIVE))
    columns.append(Column('S', SCORE, DYNAMIC))
    columns.append(Column('Z', SCORE_DELTA, DYNAMIC))
    columns.append(Column('K', RANK, DYNAMIC))
    columns.append(Column('I', ID, DYNAMIC))
    columns.append(Column('V', MASTER, DYNAMIC))
    columns.append(Column('C', NAME, DYNAMIC))
    columns.append(Column('?', NOT_MET, FIXED, smallText("?")))
    columns.append(Column('W', WAR, DYNAMIC))
    columns.append(Column('P', POWER, DYNAMIC))
    columns.append(Column('T', RESEARCH, SPECIAL))
    columns.append(Column('U', RESEARCH_TURNS, DYNAMIC))
    columns.append(
        Column('E', ESPIONAGE, FIXED,
               smallSymbol(FontSymbols.COMMERCE_ESPIONAGE_CHAR)))
    columns.append(Column('e', COUNTERESPIONAGE_TURNS, DYNAMIC))
    columns.append(
        Column('N', TRADE, FIXED, smallSymbol(FontSymbols.TRADE_CHAR)))
    columns.append(
        Column('B', BORDERS, FIXED,
               smallSymbol(FontSymbols.OPEN_BORDERS_CHAR)))
    columns.append(
        Column('D', PACT, FIXED, smallSymbol(FontSymbols.DEFENSIVE_PACT_CHAR)))
    columns.append(Column('R', RELIGION, DYNAMIC))
    columns.append(Column('A', ATTITUDE, DYNAMIC))
    columns.append(
        Column('@', PLAGUE, FIXED, smallSymbol(FontSymbols.PLAGUE_CHAR)))
    columns.append(Column('^', STABILITY, DYNAMIC))
    columns.append(Column('F', WONT_TALK, FIXED, smallText("!")))
    columns.append(
        Column('H', WORST_ENEMY, FIXED,
               smallSymbol(FontSymbols.ANGRY_POP_CHAR)))
    columns.append(
        Column('M', WHEOOH, FIXED, smallSymbol(FontSymbols.OCCUPATION_CHAR)))
    columns.append(Column('Q', CITIES, DYNAMIC))
    columns.append(Column('*', WAITING, FIXED, smallText("*")))
    columns.append(Column('L', NET_STATS, DYNAMIC))
    columns.append(Column('O', OOS, DYNAMIC))

    global WAR_ICON, PEACE_ICON
    WAR_ICON = smallSymbol(FontSymbols.WAR_CHAR)
    PEACE_ICON = smallSymbol(FontSymbols.PEACE_CHAR)

    global MASTER_ICON, ACTIVE_MASTER_ICON
    MASTER_ICON = smallSymbol(FontSymbols.SILVER_STAR_CHAR)
    ACTIVE_MASTER_ICON = smallSymbol(FontSymbols.STAR_CHAR)

    global VASSAL_PREFIX, VASSAL_POSTFIX
    VASSAL_PREFIX = smallSymbol(FontSymbols.BULLET_CHAR)
    VASSAL_POSTFIX = smallText(u" %s" %
                               FontUtil.getChar(FontSymbols.BULLET_CHAR))
Beispiel #11
0
def init():
	global g_ePromo
	g_ePromo = gc.getInfoTypeForString("PROMOTION_LEADER")
	global g_promoButton
	g_promoButton = gc.getPromotionInfo(g_ePromo).getButton()
	global g_cGreatGeneral
	g_cGreatGeneral = FontUtil.getChar(FontSymbols.GREAT_GENERAL_CHAR)
Beispiel #12
0
	def createFontSymbol(self, key, fromSymbolOrKey=None, offset=None, name=None, attrs=None):
		if not fromSymbolOrKey:
			if not self.symbol:
				raise BugUtil.ConfigError("symbol %s requires an offset symbol" % key)
			fromSymbolOrKey = self.symbol
		if offset is None:
			offset = 1
		self.symbol = FontUtil.addOffsetSymbol(key, fromSymbolOrKey, offset, name)
Beispiel #13
0
def init():
    BuildingType("Temple", FontUtil.getChar("happy"), isTemple)
    BuildingType("Cathedral", FontUtil.getChar("commerce culture"),
                 isCathedral)
    BuildingType("Monastery", FontUtil.getChar("commerce research"),
                 isMonastery)
    BuildingType("Shrine", FontUtil.getChar("commerce gold"), isShrine)
    # MOD: Add a BuildingType() call for each new religious building type you define
    #	BuildingType("Inquisition Office", FontUtil.getChar("cancel"), isInquisitionOffice)

    UnitType("Missionary", FontUtil.getChar("religion"), isMissionary)
    # MOD: Add a BuildingType() call for each new religious unit type you define
    #	UnitType("Inquisitor", FontUtil.getChar("religion"), isInquisitor)

    global NUM_RELIGIONS, ALL_RELIGIONS
    NUM_RELIGIONS = gc.getNumReligionInfos()
    ALL_RELIGIONS = range(NUM_RELIGIONS)
    for iReligion in ALL_RELIGIONS:
        BUILDINGS_BY_RELIGION.append([-1] * NUM_BUILDING_TYPES)
        UNITS_BY_RELIGION.append([-1] * NUM_UNIT_TYPES)

    for iBldg in range(gc.getNumBuildingInfos()):
        bldg = gc.getBuildingInfo(iBldg)
        iReligion = getBuildingReligion(bldg)
        if iReligion >= 0:
            for type in BUILDINGS:
                if type.matches(bldg, iReligion):
                    BUILDINGS_BY_RELIGION[iReligion][type.index] = iBldg
                    BugUtil.debug(
                        "ReligionUtil.init - %s %s is %i: %s",
                        gc.getReligionInfo(iReligion).getDescription(),
                        type.description, iBldg, bldg.getDescription())
                    break

    for iUnit in range(gc.getNumUnitInfos()):
        unit = gc.getUnitInfo(iUnit)
        iReligion = getUnitReligion(unit)
        if iReligion >= 0:
            for type in UNITS:
                if type.matches(unit, iReligion):
                    UNITS_BY_RELIGION[iReligion][type.index] = iUnit
                    BugUtil.debug(
                        "ReligionUtil.init - %s %s is %i: %s",
                        gc.getReligionInfo(iReligion).getDescription(),
                        type.description, iUnit, unit.getDescription())
                    break
def getAttitudeText(nPlayer, nTarget, bNumber, bSmily, bWorstEnemy, bWarPeace):
    """Returns a string describing the attitude nPlayer has toward nTarget."""
    nAttitude = getAttitudeCount(nPlayer, nTarget)
    if nAttitude == None:
        return None

    szText = []
    if bSmily:
        szText.append(getAttitudeIcon(nPlayer, nTarget))
    if bNumber:
        szText.append(
            BugUtil.colorText(u"%+d" % nAttitude,
                              getAttitudeColor(nPlayer, nTarget)))

    szIcons = u""
    pPlayer = gc.getPlayer(nPlayer)
    pTarget = gc.getPlayer(nTarget)
    if bWorstEnemy and isWorstEnemy(pPlayer, pTarget):
        szIcons += FontUtil.getChar("angrypop")

    if bWarPeace:
        nTeam = pPlayer.getTeam()
        pTeam = gc.getTeam(nTeam)
        nTargetTeam = pTarget.getTeam()
        pTargetTeam = gc.getTeam(nTargetTeam)
        if pTeam.isAtWar(nTargetTeam):
            szIcons += FontUtil.getChar("war")
        elif gc.getGame().getActiveTeam() in (nTeam, nTargetTeam):
            bPeace = False
            if pTeam.isForcePeace(nTargetTeam):
                bPeace = True
            elif pTargetTeam.isAVassal():
                for nOwnerTeam in range(gc.getMAX_TEAMS()):
                    if pTargetTeam.isVassal(nOwnerTeam) and pTeam.isForcePeace(
                            nOwnerTeam):
                        bPeace = True
                        break
            if bPeace:
                szIcons += FontUtil.getChar("peace")
    if szIcons:
        szText.append(szIcons)

    return u" ".join(szText)
Beispiel #15
0
def init():
	"""
	Initializes the strings used to display the scoreboard.
	"""
	global columns
	
	# Used keys:
	# ABCDEFHIKLMNOPQRSTUVWZ*?
	# (unused: XY)
	columns.append(Column('', ALIVE))
	columns.append(Column('S', SCORE, DYNAMIC))
	columns.append(Column('Z', SCORE_DELTA, DYNAMIC))
	columns.append(Column('K', RANK, DYNAMIC))
	columns.append(Column('I', ID, DYNAMIC))
	columns.append(Column('V', MASTER, DYNAMIC))
	columns.append(Column('C', NAME, DYNAMIC))
	columns.append(Column('?', NOT_MET, FIXED, smallText("?")))
	columns.append(Column('W', WAR, DYNAMIC))
	columns.append(Column('P', POWER, DYNAMIC))
	columns.append(Column('T', RESEARCH, SPECIAL))
	columns.append(Column('U', RESEARCH_TURNS, DYNAMIC))
	columns.append(Column('E', ESPIONAGE, FIXED, smallSymbol(FontSymbols.COMMERCE_ESPIONAGE_CHAR)))
	columns.append(Column('N', TRADE, FIXED, smallSymbol(FontSymbols.TRADE_CHAR)))
	columns.append(Column('B', BORDERS, FIXED, smallSymbol(FontSymbols.OPEN_BORDERS_CHAR)))
	columns.append(Column('D', PACT, FIXED, smallSymbol(FontSymbols.DEFENSIVE_PACT_CHAR)))
	columns.append(Column('R', RELIGION, DYNAMIC))
	columns.append(Column('A', ATTITUDE, DYNAMIC))
	columns.append(Column('!', WONT_TALK, FIXED, smallText("!"))) #K-Mod changed this from 'F'
	columns.append(Column('H', WORST_ENEMY, FIXED, smallSymbol(FontSymbols.ANGRY_POP_CHAR)))
	columns.append(Column('M', WHEOOH, FIXED, smallSymbol(FontSymbols.OCCUPATION_CHAR)))
	columns.append(Column('Q', CITIES, DYNAMIC))
	columns.append(Column('*', WAITING, FIXED, smallText("*")))
	columns.append(Column('L', NET_STATS, DYNAMIC))
	columns.append(Column('O', OOS, DYNAMIC))
	# <kekm.30>
	columns.append(Column('F', LEADER_BUTTON, SPECIAL))
	columns.append(Column('G', CIV_BUTTON, SPECIAL))
	# </kekm.30>
	columns.append(Column('J', GOLDEN_AGE, DYNAMIC)) # advc.085
	
	global WAR_ICON, PEACE_ICON
	WAR_ICON = smallSymbol(FontSymbols.WAR_CHAR)
	PEACE_ICON = smallSymbol(FontSymbols.PEACE_CHAR)
	
	global MASTER_ICON, ACTIVE_MASTER_ICON
	MASTER_ICON = smallSymbol(FontSymbols.SILVER_STAR_CHAR)
	ACTIVE_MASTER_ICON = smallSymbol(FontSymbols.STAR_CHAR)
	
	global VASSAL_PREFIX, VASSAL_POSTFIX
	VASSAL_PREFIX = smallSymbol(FontSymbols.BULLET_CHAR)
	VASSAL_POSTFIX = smallText(u" %s" % FontUtil.getChar(FontSymbols.BULLET_CHAR))
	# <advc.085>
	global GOLDEN_AGE_ICON, ANARCHY_ICON
	GOLDEN_AGE_ICON = smallSymbol(FontSymbols.GOLDEN_AGE_CHAR)
	ANARCHY_ICON = smallSymbol(FontSymbols.BAD_GOLD_CHAR) # </advc.085>
def init():
	BuildingType("Temple", FontUtil.getChar("happy"), isTemple)
	BuildingType("Cathedral", FontUtil.getChar("commerce culture"), isCathedral)
	BuildingType("Monastery", FontUtil.getChar("commerce research"), isMonastery)
	BuildingType("Shrine", FontUtil.getChar("commerce gold"), isShrine)
# MOD: Add a BuildingType() call for each new religious building type you define
#	BuildingType("Inquisition Office", FontUtil.getChar("cancel"), isInquisitionOffice)
	
	UnitType("Missionary", FontUtil.getChar("religion"), isMissionary)
# MOD: Add a BuildingType() call for each new religious unit type you define
#	UnitType("Inquisitor", FontUtil.getChar("religion"), isInquisitor)
	
	global NUM_RELIGIONS, ALL_RELIGIONS
	NUM_RELIGIONS = gc.getNumReligionInfos()
	ALL_RELIGIONS = range(NUM_RELIGIONS)
	for iReligion in ALL_RELIGIONS:
		BUILDINGS_BY_RELIGION.append([-1] * NUM_BUILDING_TYPES)
		UNITS_BY_RELIGION.append([-1] * NUM_UNIT_TYPES)
	
	for iBldg in range(gc.getNumBuildingInfos()):
		bldg = gc.getBuildingInfo(iBldg)
		iReligion = getBuildingReligion(bldg)
		if iReligion >= 0:
			for type in BUILDINGS:
				if type.matches(bldg, iReligion):
					BUILDINGS_BY_RELIGION[iReligion][type.index] = iBldg
					BugUtil.debug("ReligionUtil.init - %s %s is %i: %s", 
								gc.getReligionInfo(iReligion).getDescription(), type.description, iBldg, bldg.getDescription())
					break
	
	for iUnit in range(gc.getNumUnitInfos()):
		unit = gc.getUnitInfo(iUnit)
		iReligion = getUnitReligion(unit)
		if iReligion >= 0:
			for type in UNITS:
				if type.matches(unit, iReligion):
					UNITS_BY_RELIGION[iReligion][type.index] = iUnit
					BugUtil.debug("ReligionUtil.init - %s %s is %i: %s", 
								gc.getReligionInfo(iReligion).getDescription(), type.description, iUnit, unit.getDescription())
					break
def getAttitudeText (nPlayer, nTarget, bNumber, bSmily, bWorstEnemy, bWarPeace):
	"""Returns a string describing the attitude nPlayer has toward nTarget."""
	nAttitude = getAttitudeCount (nPlayer, nTarget)
	if nAttitude == None:
		return None
	
	szText = []
	if bSmily:
		szText.append(getAttitudeIcon(nPlayer, nTarget))
	if bNumber:
		szText.append(BugUtil.colorText(u"%+d" % nAttitude, getAttitudeColor(nPlayer, nTarget)))
	
	szIcons = u""
	pPlayer = gc.getPlayer(nPlayer)
	pTarget = gc.getPlayer(nTarget)
	if bWorstEnemy and isWorstEnemy(pPlayer, pTarget):
		szIcons += FontUtil.getChar("angrypop")
	
	if bWarPeace:
		nTeam = pPlayer.getTeam()
		pTeam = gc.getTeam(nTeam)
		nTargetTeam = pTarget.getTeam()
		pTargetTeam = gc.getTeam(nTargetTeam)
		if pTeam.isAtWar(nTargetTeam):
			szIcons += FontUtil.getChar("war")
		elif gc.getGame().getActiveTeam() in (nTeam, nTargetTeam):
			bPeace = False
			if pTeam.isForcePeace(nTargetTeam):
				bPeace = True
			elif pTargetTeam.isAVassal():
				for nOwnerTeam in range(gc.getMAX_TEAMS()):
					if pTargetTeam.isVassal(nOwnerTeam) and pTeam.isForcePeace(nOwnerTeam):
						bPeace = True
						break
			if bPeace:
				szIcons += FontUtil.getChar("peace")
	if szIcons:
		szText.append(szIcons)
	
	return u" ".join(szText)
def init():
	"""
	Initializes the strings used to display the scoreboard.
	"""
	global columns
	
	# Used keys:
	# ABCDEFHIKLMNOPQRSTUVWZ*?
	# GJXY
	columns.append(Column('', ALIVE))
	columns.append(Column('S', SCORE, DYNAMIC))
	columns.append(Column('Z', SCORE_DELTA, DYNAMIC))
	columns.append(Column('K', RANK, DYNAMIC))
	columns.append(Column('I', ID, DYNAMIC))
	columns.append(Column('V', MASTER, DYNAMIC))
	columns.append(Column('C', NAME, DYNAMIC))
	columns.append(Column('?', NOT_MET, FIXED, smallText("?")))
	columns.append(Column('W', WAR, DYNAMIC))
	columns.append(Column('P', POWER, DYNAMIC))
	columns.append(Column('T', RESEARCH, SPECIAL))
	columns.append(Column('U', RESEARCH_TURNS, DYNAMIC))
	columns.append(Column('E', ESPIONAGE, FIXED, smallSymbol(FontSymbols.COMMERCE_ESPIONAGE_CHAR)))
	columns.append(Column('e', COUNTERESPIONAGE_TURNS, DYNAMIC))
	columns.append(Column('N', TRADE, FIXED, smallSymbol(FontSymbols.TRADE_CHAR)))
	columns.append(Column('B', BORDERS, FIXED, smallSymbol(FontSymbols.OPEN_BORDERS_CHAR)))
	columns.append(Column('D', PACT, FIXED, smallSymbol(FontSymbols.DEFENSIVE_PACT_CHAR)))
	columns.append(Column('R', RELIGION, DYNAMIC))
	columns.append(Column('A', ATTITUDE, DYNAMIC))
	columns.append(Column('@', PLAGUE, FIXED, smallSymbol(FontSymbols.PLAGUE_CHAR)))
	columns.append(Column('^', STABILITY, DYNAMIC))
	columns.append(Column('F', WONT_TALK, FIXED, smallText("!")))
	columns.append(Column('H', WORST_ENEMY, FIXED, smallSymbol(FontSymbols.ANGRY_POP_CHAR)))
	columns.append(Column('M', WHEOOH, FIXED, smallSymbol(FontSymbols.OCCUPATION_CHAR)))
	columns.append(Column('Q', CITIES, DYNAMIC))
	columns.append(Column('*', WAITING, FIXED, smallText("*")))
	columns.append(Column('L', NET_STATS, DYNAMIC))
	columns.append(Column('O', OOS, DYNAMIC))
	
	global WAR_ICON, PEACE_ICON
	WAR_ICON = smallSymbol(FontSymbols.WAR_CHAR)
	PEACE_ICON = smallSymbol(FontSymbols.PEACE_CHAR)
	
	global MASTER_ICON, ACTIVE_MASTER_ICON
	MASTER_ICON = smallSymbol(FontSymbols.SILVER_STAR_CHAR)
	ACTIVE_MASTER_ICON = smallSymbol(FontSymbols.STAR_CHAR)
	
	global VASSAL_PREFIX, VASSAL_POSTFIX
	VASSAL_PREFIX = smallSymbol(FontSymbols.BULLET_CHAR)
	VASSAL_POSTFIX = smallText(u" %s" % FontUtil.getChar(FontSymbols.BULLET_CHAR))
Beispiel #19
0
def smallSymbol(symbol):
	return smallText(FontUtil.getChar(symbol))
Beispiel #20
0
def init():
    BuildingType("Temple", FontUtil.getChar("happy"), isTemple)
    ##--------	BUGFfH: Deleted by Denev 2009/10/12
    """
	BuildingType("Cathedral", FontUtil.getChar("commerce culture"), isCathedral)
	BuildingType("Monastery", FontUtil.getChar("commerce research"), isMonastery)
	"""
    ##--------	BUGFfH: End Delete
    BuildingType("Shrine", FontUtil.getChar("commerce gold"), isShrine)
    # MOD: Add a BuildingType() call for each new religious building type you define
    #	BuildingType("Inquisition Office", FontUtil.getChar("cancel"), isInquisitionOffice)

    ##--------	BUGFfH: Modified by Denev 2009/10/13
    """
	UnitType("Missionary", FontUtil.getChar("religion"), isMissionary)
	"""
    UnitType("Missionary", FontUtil.getChar("trade"), isMissionary)
    ##--------	BUGFfH: End Modify
    # MOD: Add a BuildingType() call for each new religious unit type you define
    #	UnitType("Inquisitor", FontUtil.getChar("religion"), isInquisitor)
    ##--------	BUGFfH: Added by Denev 2009/10/12
    UnitType("Priest", FontUtil.getChar("religion"), isPriest)
    ##--------	BUGFfH: End Add

    global NUM_RELIGIONS, ALL_RELIGIONS
    NUM_RELIGIONS = gc.getNumReligionInfos()
    ALL_RELIGIONS = range(NUM_RELIGIONS)
    for iReligion in ALL_RELIGIONS:
        BUILDINGS_BY_RELIGION.append([-1] * NUM_BUILDING_TYPES)
        UNITS_BY_RELIGION.append([-1] * NUM_UNIT_TYPES)

    for iBldg in range(gc.getNumBuildingInfos()):
        bldg = gc.getBuildingInfo(iBldg)
        iReligion = getBuildingReligion(bldg)
        if iReligion >= 0:
            for type in BUILDINGS:
                if type.matches(bldg, iReligion):
                    BUILDINGS_BY_RELIGION[iReligion][type.index] = iBldg
                    BugUtil.debug(
                        "ReligionUtil.init - %s %s is %i: %s",
                        gc.getReligionInfo(iReligion).getDescription(),
                        type.description, iBldg, bldg.getDescription())
                    break

    for iUnit in range(gc.getNumUnitInfos()):
        unit = gc.getUnitInfo(iUnit)
        iReligion = getUnitReligion(unit)
        if iReligion >= 0:
            for type in UNITS:
                if type.matches(unit, iReligion):
                    UNITS_BY_RELIGION[iReligion][type.index] = iUnit
                    BugUtil.debug(
                        "ReligionUtil.init - %s %s is %i: %s",
                        gc.getReligionInfo(iReligion).getDescription(),
                        type.description, iUnit, unit.getDescription())
                    break

    for iReligion in range(NUM_RELIGIONS):
        for index in range(NUM_BUILDING_TYPES):
            BugUtil.debug("F**K - %i bldg %i = %i", iReligion, index,
                          getBuilding(iReligion, index))
        for index in range(NUM_UNIT_TYPES):
            BugUtil.debug("F**K - %i unit %i = %i", iReligion, index,
                          getUnit(iReligion, index))
def smallSymbol(symbol):
    return smallText(FontUtil.getChar(symbol))
Beispiel #22
0
def init():
	global g_cGreatSpy
	g_cGreatSpy = FontUtil.getChar(FontSymbols.COMMERCE_ESPIONAGE_CHAR)