Exemple #1
0
    def onBuildingBuilt(self, argsList):
        'Building Completed'
        pCity, iBuildingType = argsList

        if (pCity.getOwner() == gc.getGame().getActivePlayer()):
            CGEUtils.CGEUtils().checkWonderPrereqBuildingAlert(iBuildingType)
            CGEUtils.CGEUtils().insertBuildingOrderQueue(pCity, iBuildingType)
Exemple #2
0
    def onSelectionGroupPushMission(self, argsList):
        'selection group mission'
        eOwner = argsList[0]
        eMission = argsList[1]
        iNumUnits = argsList[2]
        listUnitIds = argsList[3]

        if (CGEUtils.CGEUtils().isAutoReconSetMode()):
            CGEUtils.CGEUtils().setAutoRecon(eOwner, eMission, listUnitIds[0])
Exemple #3
0
    def onUnitBuilt(self, argsList):
        'Unit Completed'
        city = argsList[0]
        unit = argsList[1]

        # Unit Placement
        if (city.getOwner() == CyGame().getActivePlayer()):
            if (CGEUtils.CGEUtils().isAutoOrder()):
                if (not (UserPrefs.DisableAutoOrderAtWar and gc.getTeam(
                        gc.getGame().getActiveTeam()).getAtWarCount(False) > 0)
                    ):
                    CGEUtils.CGEUtils().executeAutoOrder(unit)
            UnitPlacement.UnitPlacement().doUnitOrder(city, unit)
Exemple #4
0
 def onGameStart(self, argsList):
     'Called at the start of the game'
     self.CGEManager.reminderInit()
     CGEDebug.CGEDebug().CGEWarning()
     CGEOptionControl.CGEOptionControl().setCGEDLLOptions()
     CityInfoPanelPS.CityInfoPanelPS().resetVictory()
     UnitPlacement.UnitPlacement().startGame()
     CGEUtils.CGEUtils().resetCGEUtils()
     self.getStealTechMissionNum()
Exemple #5
0
 def onLoadGame(self, argsList):
     self.CGEManager.reminderLoad()
     CGEDebug.CGEDebug().CGEWarning()
     CityInfoPanelPS.CityInfoPanelPS().resetVictory()
     CGEOptionControl.CGEOptionControl().setCGEDLLOptions()
     UnitPlacement.UnitPlacement().loadGame()
     CGEUtils.CGEUtils().resetCGEUtils()
     self.getStealTechMissionNum()
     return 0
Exemple #6
0
 def onBeginPlayerTurn(self, argsList):
     'Called at the beginning of a players turn'
     iGameTurn, iPlayer = argsList
     if (gc.getPlayer(iPlayer).isHuman()):
         AlertsLog.AlertsLog().AlertsLogStartTurn()
         # for APL compress mode
         if (CyInterface().getNumVisibleUnits() > 10 and gc.getTeam(
                 gc.getGame().getActiveTeam()).getAtWarCount(False) == 0):
             CyInterface().setDirty(
                 InterfaceDirtyBits.PlotListButtons_DIRTY_BIT, True)
         # Unit Placement Override Firaxis Bug
         UnitPlacement.UnitPlacement().doOverrideFiraxisBug()
         CGEUtils.CGEUtils().UpdateEspionagePoint()
Exemple #7
0
    def groupSelectionChanged(self, groupId):
        screen = self.getScreen()
        for groupIndex in xrange(self.numGroups):
            screen.deleteWidget(self.unitGroupName + str(groupIndex))

        screen.hide(self.unitBackgroundName)

        if (groupId == self.NO_GROUPS_ID):
            self.addUnitsToList()
            self.AutoReconList = []
        elif (groupId == self.AUTO_RECON_ID):
            if (gc.getGame().getActivePlayer() in self.selectedPlayerList):
                self.AutoReconList = CGEUtils.CGEUtils().getAutoReconUnitsList(
                )
            else:
                self.AutoReconList = []
            self.AutoReconUnitsList()
        else:
            self.createGroup(groupId)
            self.AutoReconList = []

        screen.show(self.unitBackgroundName)
        self.refreshMinimap()
Exemple #8
0
 def handleInput(self, inputClass):
     screen = self.getScreen()
     if (inputClass.getFunctionName() == self.RADAR_BUTTON
             and inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED and
             inputClass.getFlags() & MouseFlags.MOUSE_LBUTTONUP):  # radar
         self.getEnemyUnitList()
     if (inputClass.getFunctionName() == self.unitCheckBox
             and inputClass.getNotifyCode()
             == NotifyCode.NOTIFY_CLICKED):  # unit selected
         if (inputClass.getFlags() & MouseFlags.MOUSE_LBUTTONUP):
             self.toggleUnitCheckBox(inputClass.getData1())
         elif (inputClass.getFlags() & MouseFlags.MOUSE_RBUTTONUP):
             iIndex = inputClass.getData1()
             iRefUnitType = self.unitList[iIndex].getUnitType()
             bState = not screen.getCheckBoxState(self.checkBoxName(iIndex))
             for iLoop in xrange(len(self.unitList)):
                 pLoopUnit = self.unitList[iLoop]
                 if (pLoopUnit.getUnitType() == iRefUnitType):
                     tLoopUnit = (pLoopUnit.getOwner(), pLoopUnit.getID())
                     if (bState):
                         if (tLoopUnit not in self.selectedUnits):
                             self.selectedUnits.append(tLoopUnit)
                     else:
                         if (tLoopUnit in self.selectedUnits):
                             self.selectedUnits.remove(tLoopUnit)
                     screen.setState(self.checkBoxName(iLoop), bState)
             self.refreshMinimap()
     if (inputClass.getFunctionName() == self.groupSelectionName
             and inputClass.getNotifyCode()
             == NotifyCode.NOTIFY_LISTBOX_ITEM_SELECTED):  # group changed
         iIndex = screen.getSelectedPullDownID(self.groupSelectionName)
         self.groupSelectionChanged(iIndex)
     if (inputClass.getFunctionName() == self.AUTO_ORDER_CHECKBOX
             and inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED):
         CGEUtils.CGEUtils().setAutoOrder(
             screen.getCheckBoxState(self.AUTO_ORDER_CHECKBOX))
     return 0
Exemple #9
0
    def refreshMinimap(self):
        screen = self.getScreen()
        screen.minimapClearAllFlashingTiles()

        self.showEnemyMinimap()
        iColor = gc.getInfoTypeForString("COLOR_GREEN")
        iColorWar = gc.getInfoTypeForString("COLOR_YELLOW")
        ActiveTeam = gc.getGame().getActiveTeam()
        for (iOwner, iUnitID) in self.selectedUnits:
            unit = gc.getPlayer(iOwner).getUnit(iUnitID)
            if (gc.getTeam(ActiveTeam).isAtWar(
                    gc.getPlayer(unit.getOwner()).getTeam())):
                screen.minimapFlashPlot(unit.getX(), unit.getY(), iColorWar,
                                        -1)
            else:
                screen.minimapFlashPlot(unit.getX(), unit.getY(), iColor, -1)
        if (len(self.AutoReconList) > 0):
            for (iOwner, iUnitID) in self.selectedUnits:
                unit = gc.getPlayer(iOwner).getUnit(iUnitID)
                lTarget = CGEUtils.CGEUtils().getTargetPlot(unit.getID())
                if (lTarget != None):
                    screen.minimapFlashPlot(
                        lTarget[0], lTarget[1],
                        gc.getInfoTypeForString("COLOR_BLUE"), -1)
Exemple #10
0
    def OnEndGameTurn(self, argsList):
        iGameTurn = argsList[0]

        if (CFG_Alert_SpyStealTech):
            iActPlayer = gc.getGame().getActivePlayer()
            pActPlayer = gc.getPlayer(iActPlayer)
            EspDict = dict()
            (loopUnit, iter) = pActPlayer.firstUnit(false)
            lUnit = []
            while (loopUnit):
                if (not loopUnit.isDead()
                        and gc.getUnitInfo(loopUnit.getUnitType()).isSpy()):
                    pPlot = loopUnit.plot()
                    iTarget = pPlot.getOwner()
                    if (loopUnit.canEspionage(pPlot)
                            and iTarget != iActPlayer):
                        lUnit.append((pPlot, iTarget))
                        EspDict[iTarget] = set()
                (loopUnit, iter) = pActPlayer.nextUnit(iter, false)

            dTechDict = {}
            if (len(lUnit) > 0):
                ActiveTeam = gc.getTeam(pActPlayer.getTeam())
                lTechList = [
                    iTech for iTech in range(gc.getNumTechInfos())
                    if (not ActiveTeam.isHasTech(iTech))
                ]
                for iTarget in EspDict:
                    TargetTeam = gc.getTeam(gc.getPlayer(iTarget).getTeam())
                    dTechDict[iTarget] = [
                        iTech for iTech in lTechList
                        if (TargetTeam.isHasTech(iTech))
                    ]

            canDoEspMission = pActPlayer.canDoEspionageMission
            for (pPlot, iTarget) in lUnit:
                if (canDoEspMission(self.iStealTechMission, iTarget, pPlot,
                                    -1)):
                    for iTech in dTechDict[iTarget]:
                        if (canDoEspMission(self.iStealTechMission, iTarget,
                                            pPlot, iTech)):
                            EspDict[iTarget].add(iTech)

            for (iTarget, items) in EspDict.items():
                if (len(items) == 0):
                    continue
                szString = localText.getText(
                    "TXT_KEY_CGE_ALERT_STEAL_TECH",
                    (gc.getPlayer(iTarget).getName(), ))
                szTemp = ""
                for iTech in items:
                    szTemp += ", " + gc.getTechInfo(iTech).getDescription()
                szString += szTemp[1:]
                AlertsLog.AlertsLog().AlertsLogMessage(
                    iActPlayer, szString, None,
                    gc.getInfoTypeForString("COLOR_TECH_TEXT"), 0, 0, 2, -1,
                    iTarget, False, False)

        if (CFG_Alert_Obsolete):
            CGEUtils.CGEUtils().checkTechObsoleteAlert()

        CGEUtils.CGEUtils().checkSpyAlert()
        CGEUtils.CGEUtils().doAutoRecon()

        if (CGEUtils.CGEUtils().isAutoOrder()):
            iActPlayer = gc.getGame().getActivePlayer()
            pActPlayer = gc.getPlayer(iActPlayer)
            if (not (UserPrefs.DisableAutoOrderAtWar and gc.getTeam(
                    pActPlayer.getTeam()).getAtWarCount(False) > 0)):
                (pLoopUnit, iter) = pActPlayer.firstUnit(False)
                while (pLoopUnit):
                    if (iActPlayer == pLoopUnit.getOwner()):
                        pUnitGroup = pLoopUnit.getGroup()
                        if (pUnitGroup.getActivityType() <=
                                ActivityTypes.ACTIVITY_AWAKE
                                and pUnitGroup.getAutomateType()
                                == AutomateTypes.NO_AUTOMATE):
                            CGEUtils.CGEUtils().executeAutoOrder(pLoopUnit)
                    (pLoopUnit, iter) = pActPlayer.nextUnit(iter, False)
Exemple #11
0
    def __eventSpyMoveToCityApply(self, playerID, userData, popupReturn):
        iOpt1 = popupReturn.getSelectedPullDownValue(0)

        CGEUtils.CGEUtils().SpyMoveToCityExec(iOpt1)
        return 0
Exemple #12
0
    def interfaceScreen(self):

        # Create a new screen
        screen = self.getScreen()
        if screen.isActive():
            return
        screen.setRenderInterfaceOnly(True)
        screen.showScreen(PopupStates.POPUPSTATE_IMMEDIATE, False)

        self.EXIT_TEXT = u"<font=4>%s</font>" % (localText.getText(
            "TXT_KEY_PEDIA_SCREEN_EXIT", ()).upper())
        self.TITLE = u"<font=4b>%s</font>" % (localText.getText(
            "TXT_KEY_MILITARY_ADVISOR_TITLE", ()).upper())

        self.nWidgetCount = 0

        ############################################
        ### BEGIN CHANGES ENHANCED INTERFACE MOD ###
        ############################################

        self.W_SCREEN = screen.getXResolution()
        self.H_SCREEN = screen.getYResolution()
        self.X_EXIT = self.W_SCREEN - 30
        self.Y_EXIT = self.H_SCREEN - 37
        self.Y_BOTTOM_PANEL = self.H_SCREEN - 55
        self.iPromoLeader = gc.getInfoTypeForString("PROMOTION_LEADER")

        screen = self.getScreen()

        # Set the background and exit button, and show the screen
        screen.setDimensions(0, 0, self.W_SCREEN, self.H_SCREEN)
        screen.addDrawControl(
            self.BACKGROUND_ID,
            ArtFileMgr.getInterfaceArtInfo("SCREEN_BG_OPAQUE").getPath(), 0, 0,
            self.W_SCREEN, self.H_SCREEN, WidgetTypes.WIDGET_GENERAL, -1, -1)

        self.unitBackgroundName = self.getNextWidgetName()
        screen.addPanel(self.unitBackgroundName, "", "", True, True, 0, 48,
                        305, self.H_SCREEN - 48,
                        PanelStyles.PANEL_STYLE_CITY_LEFT)
        self.ordersPanelName = self.getNextWidgetName()
        screen.addPanel(self.ordersPanelName, "", "", True, True, 305,
                        self.H_SCREEN - 55, self.W_SCREEN - 305, 55,
                        PanelStyles.PANEL_STYLE_BOTTOMBAR)
        screen.addPanel("TopPanel", u"", u"", True, False, 0, 0, self.W_SCREEN,
                        55, PanelStyles.PANEL_STYLE_TOPBAR)
        screen.showWindowBackground(False)
        screen.setText(self.EXIT_ID, "Background", self.EXIT_TEXT,
                       CvUtil.FONT_RIGHT_JUSTIFY, self.X_EXIT, self.Y_EXIT,
                       self.Z_CONTROLS, FontTypes.TITLE_FONT,
                       WidgetTypes.WIDGET_CLOSE_SCREEN, -1, -1)

        self.viewX = 315
        self.viewWidth = self.W_SCREEN - 325
        self.viewHeight = self.H_SCREEN - 270
        self.viewY = self.H_SCREEN - self.viewHeight - 100  #ミニマップのy座標
        self.viewMargin = 20
        #ミニマップの青ラウンドバックグラウンドパネル
        screen.addPanel("", u"", "", False, False, self.viewX, self.viewY,
                        self.viewWidth, self.viewHeight,
                        PanelStyles.PANEL_STYLE_MAIN)

        self.initMinimap()

        screen.addDropDownBoxGFC(self.groupSelectionName, 15, 8, 260,
                                 WidgetTypes.WIDGET_GENERAL, -1, -1,
                                 FontTypes.GAME_FONT)
        screen.addPullDownString(
            self.groupSelectionName,
            localText.getText("TXT_KEY_MILITARY_ADVISOR_DONT_GROUP_UNITS", ()),
            self.NO_GROUPS_ID, self.NO_GROUPS_ID, True)
        screen.addPullDownString(
            self.groupSelectionName,
            localText.getText("TXT_KEY_MILITARY_ADVISOR_GROUP_BY_STACK", ()),
            self.STACK_GROUP_ID, self.STACK_GROUP_ID, False)
        screen.addPullDownString(
            self.groupSelectionName,
            localText.getText("TXT_KEY_MILITARY_ADVISOR_GROUP_BY_COMBAT_TYPE",
                              ()), self.COMBAT_TYPE_GROUP_ID,
            self.COMBAT_TYPE_GROUP_ID, False)
        screen.addPullDownString(
            self.groupSelectionName,
            localText.getText("TXT_KEY_MILITARY_ADVISOR_GROUP_BY_LOCATION",
                              ()), self.LOCATION_GROUP_ID,
            self.LOCATION_GROUP_ID, False)
        screen.addPullDownString(
            self.groupSelectionName,
            localText.getText("TXT_KEY_MILITARY_ADVISOR_AUTO_RECON", ()),
            self.AUTO_RECON_ID, self.AUTO_RECON_ID, False)

        self.unitPanelName = self.getNextWidgetName()
        self.unitGroupName = self.getNextWidgetName()

        self.szHeader = self.getNextWidgetName()
        screen.setText(self.szHeader, "Background", self.TITLE,
                       CvUtil.FONT_CENTER_JUSTIFY, self.X_SCREEN, self.Y_TITLE,
                       self.Z_CONTROLS, FontTypes.TITLE_FONT,
                       WidgetTypes.WIDGET_GENERAL, -1, -1)

        self.X_LEADERS = self.viewX
        self.Y_LEADERS = 60
        self.W_LEADERS = self.viewWidth - 110
        self.H_LEADERS = 102
        self.LEADER_BUTTON_SIZE = 64
        self.LEADER_MARGIN = 12
        self.LEADER_COLUMNS = int(
            self.W_LEADERS / (self.LEADER_BUTTON_SIZE + self.LEADER_MARGIN))

        screen.addPanel(self.LEADER_PANEL_ID, "", "", False, True,
                        self.X_LEADERS, self.Y_LEADERS, self.W_LEADERS,
                        self.H_LEADERS, PanelStyles.PANEL_STYLE_MAIN)
        # Radar Button
        self.enemyUnitList = []
        self.RadarState = False
        screen.addPanel(self.RADAR_PANEL, "", "", False, True,
                        self.W_SCREEN - 112, self.Y_LEADERS, self.H_LEADERS,
                        self.H_LEADERS, PanelStyles.PANEL_STYLE_MAIN)
        screen.addCheckBoxGFC(
            self.RADAR_BUTTON, "Art/Interface/Buttons/Radar.dds",
            ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(),
            self.W_SCREEN - 93, self.Y_LEADERS + 19, 64, 64,
            WidgetTypes.WIDGET_GENERAL, 1000, 1000,
            ButtonStyles.BUTTON_STYLE_LABEL)
        screen.setState(self.RADAR_BUTTON, False)

        screen.addCheckBoxGFC(
            self.AUTO_ORDER_CHECKBOX, "Art/Interface/Buttons/AutoOrder.dds",
            ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(),
            self.X_EXIT - 32, self.Y_BOTTOM_PANEL - 35, 32, 32,
            WidgetTypes.WIDGET_GENERAL, -1, -1,
            ButtonStyles.BUTTON_STYLE_LABEL)
        screen.setState(self.AUTO_ORDER_CHECKBOX,
                        CGEUtils.CGEUtils().isAutoOrder())

        iOldMode = CyInterface().getShowInterface()
        CyInterface().setShowInterface(
            InterfaceVisibility.INTERFACE_MINIMAP_ONLY)
        screen.updateMinimapVisibility()
        CyInterface().setShowInterface(iOldMode)

        self.iActivePlayer = gc.getGame().getActivePlayer()

        self.unitsList = [(0, 0, [], 0)] * gc.getNumUnitInfos()
        self.selectedUnitList = []
        self.selectedPlayerList.append(self.iActivePlayer)

        self.X_GREAT_GENERAL_BAR = self.X_LEADERS + 10
        self.Y_GREAT_GENERAL_BAR = self.Y_BOTTOM_PANEL - 35
        self.W_GREAT_GENERAL_BAR = 300
        self.H_GREAT_GENERAL_BAR = 30
        self.drawCombatExperience()

        self.refresh(True)
Exemple #13
0
    "Executive Briefing": ExecutiveBriefing.ExecutiveBriefing(),
    "More Civ4lerts": MoreCiv4lerts.MoreCiv4lertsOption(),
    "CGE Alerts": CGEEventManager.CGEEventOption(),
    "APL General": None,
    "Raw Commerce Display": None,  #CvMainInterface.CvMainInterface(),
    "Citizens Automated": None,
    "Specialist Stacker": CvMainInterface.CvMainInterface(),
    "Not Just Another Game Clock Mod": CvMainInterface.CvMainInterface(),
    "APL Info Pane": None,
    "APL Info Pane Colors": None,
    "APL Stacked Bar Colors": None,
    "CGEDLL": None,
    "Alerts Log": AlertsLog.AlertsLog(),
    "Top Culture Cities": CvMainInterface.CvMainInterface(),
    "Bottom Container Icon": CvMainInterface.CvMainInterface(),
    "Spy Detect": CGEUtils.CGEUtilsOption(),
}


class CGEOptionControl:
    def InitValue(self):
        global gOptionDict
        global CGEDLLOptions

        gOptionDict = {}
        config = CvConfigParser.CvConfigParser(
            "Civ IV Gameplay Enhancements Config.ini")

        if (config != None):
            for Option in CGEOptionCheckBox.items():
                #CvUtil.pyPrint("CGEOption: " + Option[0] + ", " + Option[1]['Section'] +  ", " + Option[1]['Key'])