def _onMatchmakingTimerChanged(self, event): data = event.ctx isBattleTimerVisible = False wfbDescr = None playerClanName = None enemyClanName = None currentBattle = data['currentBattle'] mapId = currentBattle.getMapId() if currentBattle else 0 enemyclanData = data['enemyClan'] enemyVisible = enemyclanData is not None isInBattle = self.prbEntity.getFlags().isInArena() textid = data['textid'] maxLvl = data['maxLevel'] level = int2roman(maxLvl) if data['isSortie']: headerDescr = i18n.makeString(FORTIFICATIONS.STRONGHOLDINFO_SORTIE) % {'level': level} timetext = None if textid == FORTIFICATIONS.SORTIE_INTROVIEW_FORTBATTLES_ENDOFBATTLESOON: timetext = time_utils.getTimeLeftFormat(data['dtime']) elif textid == FORTIFICATIONS.SORTIE_INTROVIEW_FORTBATTLES_NEXTTIMEOFBATTLESOON: timetext = time_utils.getTimeLeftFormat(data['dtime']) elif textid == FORTIFICATIONS.SORTIE_INTROVIEW_FORTBATTLES_NEXTTIMEOFBATTLETOMORROW: timetext = BigWorld.wg_getShortTimeFormat(data['peripheryStartTimestamp']) elif textid == FORTIFICATIONS.SORTIE_INTROVIEW_FORTBATTLES_NEXTTIMEOFBATTLETODAY: timetext = BigWorld.wg_getShortTimeFormat(data['peripheryStartTimestamp']) wfbDescr = i18n.makeString(textid, nextDate=timetext) else: direction = vo_converters.getDirection(data['direction']) headerDescr = i18n.makeString(FORTIFICATIONS.STRONGHOLDINFO_STRONGHOLD) % {'direction': direction} if textid != FORTIFICATIONS.ROSTERINTROWINDOW_INTROVIEW_FORTBATTLES_NEXTTIMEOFBATTLESOON: timetext = None if textid == FORTIFICATIONS.SORTIE_INTROVIEW_FORTBATTLES_NEXTTIMEOFBATTLETOMORROW: timetext = BigWorld.wg_getShortTimeFormat(data['matchmakerNextTick']) elif textid == FORTIFICATIONS.SORTIE_INTROVIEW_FORTBATTLES_NEXTTIMEOFBATTLETODAY: timetext = BigWorld.wg_getShortTimeFormat(data['matchmakerNextTick']) wfbDescr = i18n.makeString(textid, nextDate=timetext) else: isBattleTimerVisible = True fontColors = GUI_SETTINGS.lookup('StrongholdsTimerColors') colorRegular = fontColors.get('regular', '#FFDD99') colorAlarm = fontColors.get('alarm', '#ff7f00') enemyClanName = '?' if enemyVisible: clColor = enemyclanData.getColor() clColor = '#%06x' % clColor if clColor else '#ffffff' enemyClanName = "<b><font face='$FieldFont' color='{0}'>[{1}]</font></b>".format(clColor, enemyclanData.getTag()) clan = data['clan'] if clan: clColor = clan.getColor() clColor = '#%06x' % clColor if clColor else '#ffffff' playerClanName = "<b><font face='$FieldFont' color='{0}'>[{1}]</font></b>".format(clColor, clan.getTag()) self.as_setTimerDeltaS(vo_converters.makeClanBattleTimerVO(data['dtime'] if not isInBattle else 0, "<font face='$FieldFont' size='18' color='{0}'>###</font>".format(colorRegular), "<font face='$FieldFont' size='18' color='{0}'>###</font>".format(colorAlarm), self.TIMER_GLOW_COLORS.NORMAL, self.TIMER_GLOW_COLORS.ALERT, '00', 0 if data['isFirstBattle'] else 1)) self.as_updateReadyStatusS(self.prbEntity.getFlags().isInQueue(), self.__enemyReadyIndicator) self.as_setBattleRoomDataS(vo_converters.makeFortClanBattleRoomVO(mapId, headerDescr, playerClanName, enemyClanName, wfbDescr, enemyVisible, isBattleTimerVisible, data['isSortie'])) if data['forceUpdateBuildings']: self.__forceUpdateBuildings() return
def _makeFortClanBattleRoomVO(self, mapId, headerDescr, mineClanName, enemyClanName, waitForBattleDescr, isMapEnabled, isBattleTimerVisible, isSortie): vo = vo_converters.makeFortClanBattleRoomVO( mapId, headerDescr, mineClanName, enemyClanName, waitForBattleDescr, isMapEnabled, isBattleTimerVisible, isSortie) vo['levelsRange'] = self.prbEntity.getRosterSettings().getLevelsRange() return vo
def onUpdateHeader(self, header, isFirstBattle, isUnitFreezed): self._updateMiniMapData(header.getCurrentBattle(), header.getClan()) self._updateTableHeader(header.getMaxPlayersCount(), header.getMaxLegionariesCount()) self._updateBuildings(header.getCurrentBattle(), header.getEnemyClan(), header.getBattleIdx()) self._updateTitle(header.isSortie(), header.getDirection(), header.getIndustrialResourceMultiplier()) self._updateConfigureButtonState(isFirstBattle, not isUnitFreezed) self.__setReadyStatus() self._updateMembersData() self._updateRallyData() if not self.__firstShowMainForm: self.__firstShowMainForm = True self.as_setBattleRoomDataS(vo_converters.makeFortClanBattleRoomVO(0, '', '', '', '', False, False, header.isSortie())) self.addListener(events.StrongholdEvent.STRONGHOLD_ON_TIMER, self._onMatchmakingTimerChanged, scope=EVENT_BUS_SCOPE.STRONGHOLD) self.prbEntity.forceTimerEvent()