Пример #1
0
 def fini(self, woEvents = False):
     if self.__watcher is not None:
         self.__watcher.stop()
         self.__watcher = None
     g_lobbyContext.getServerSettings().onServerSettingsChange -= self.__onServerSettingChanged
     super(SandboxQueueFunctional, self).fini(woEvents)
     return
Пример #2
0
 def _populate(self):
     battle_selector_items.create()
     super(LobbyHeader, self)._populate()
     self.startGlobalListening()
     self.app.containerManager.onViewAddedToContainer += self.__onViewAddedToContainer
     game_control.g_instance.wallet.onWalletStatusChanged += self.__onWalletChanged
     game_control.g_instance.gameSession.onPremiumNotify += self.__onPremiumTimeChanged
     game_control.g_instance.igr.onIgrTypeChanged += self.__onIGRChanged
     g_lobbyContext.getServerSettings().onServerSettingsChange += self.__onServerSettingChanged
     g_currentVehicle.onChanged += self.__onVehicleChanged
     g_eventsCache.onSyncCompleted += self.__onEventsCacheResync
     g_itemsCache.onSyncCompleted += self.__onItemsChanged
     self.__falloutCtrl = getFalloutCtrl()
     self.__falloutCtrl.onVehiclesChanged += self.__updateFalloutSettings
     self.__falloutCtrl.onSettingsChanged += self.__updateFalloutSettings
     self.addListener(events.FightButtonEvent.FIGHT_BUTTON_UPDATE, self.__handleFightButtonUpdated, scope=EVENT_BUS_SCOPE.LOBBY)
     self.addListener(events.CoolDownEvent.PREBATTLE, self.__handleSetPrebattleCoolDown, scope=EVENT_BUS_SCOPE.LOBBY)
     self.addListener(events.BubbleTooltipEvent.SHOW, self.__showBubbleTooltip, scope=EVENT_BUS_SCOPE.LOBBY)
     self.addListener(events.CloseWindowEvent.GOLD_FISH_CLOSED, self.__onGoldFishWindowClosed, scope=EVENT_BUS_SCOPE.LOBBY)
     g_clientUpdateManager.addCallbacks({'stats.credits': self.__setCredits,
      'stats.gold': self.__setGold,
      'stats.freeXP': self.__setFreeXP,
      'stats.clanInfo': self.__setClanInfo,
      'goodies': self.__updateGoodies,
      'account.premiumExpiryTime': self.__onPremiumExpireTimeChanged,
      'cache.SPA': self.__onSPAUpdated})
     self.as_setFightButtonS(i18n.makeString('#menu:headerButtons/battle'))
     self.as_setWalletStatusS(game_control.g_instance.wallet.componentsStatuses)
     self.updateAccountInfo()
     self.__updateServerName()
     if not isTimeToShowGoldFishPromo():
         enabledVal = isGoldFishActionActive()
         tooltip = TOOLTIPS.HEADER_REFILL_ACTION if enabledVal else TOOLTIPS.HEADER_REFILL
         self.as_setGoldFishEnabledS(enabledVal, False, tooltip, TOOLTIP_TYPES.COMPLEX)
     Waiting.hide('enter')
Пример #3
0
def getEnabledPQTabs():
    tabs = list(PQ_TABS)
    if not g_lobbyContext.getServerSettings().isRegularQuestEnabled():
        tabs.remove(_QA.SEASON_VIEW_TAB_RANDOM)
    if not g_lobbyContext.getServerSettings().isFalloutQuestEnabled():
        tabs.remove(_QA.SEASON_VIEW_TAB_FALLOUT)
    return tabs
 def _getDetailedData(self, data):
     targetData = data[0]
     dataList = []
     if g_lobbyContext.getServerSettings().isFortsEnabled():
         dataList.append(_getDetailedStatisticsData(PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_FORTBATTLES, self.__fortBattlesTargetData, isCurrentUser=self._isCurrentUser, layout=FORT_STATISTICS_LAYOUT))
     dataList.append(_getDetailedStatisticsData(PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_FORTSORTIE, targetData, isCurrentUser=self._isCurrentUser))
     specificData = []
     battlesCount = self.__fortBattlesTargetData.getBattlesCount()
     lossesCount = self.__fortBattlesTargetData.getLossesCount()
     winsCount = self.__fortBattlesTargetData.getWinsCount()
     formattedBattlesCount = BigWorld.wg_getIntegralFormat(battlesCount)
     specificDataColumn1 = []
     if g_lobbyContext.getServerSettings().isFortsEnabled():
         specificDataColumn1.append(PUtils.getLabelDataObject(PROFILE.SECTION_STATISTICS_BODYPARAMS_LABEL_FORTBATTLES, (DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTTOTALBATTLES, formattedBattlesCount, PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_BATTLES, PUtils.createToolTipData((BigWorld.wg_getIntegralFormat(winsCount), BigWorld.wg_getIntegralFormat(lossesCount)))),
          DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLESTOTALWINS, PUtils.getFormattedWinsEfficiency(self.__fortBattlesTargetData), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLESWINS),
          DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_LOOTING, self.__fortMiscTargetData.getEnemyBasePlunderNumber(), PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_LOOTING),
          DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLES_ATTACKS, self.__fortMiscTargetData.getAttackNumber(), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_ATTACKS),
          DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLES_DEFENCES, self.__fortMiscTargetData.getDefenceHours(), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_DEFENCES))))
     battlesCount = targetData.getBattlesCount()
     lossesCount = targetData.getLossesCount()
     winsCount = targetData.getWinsCount()
     drawsCount = targetData.getDrawsCount()
     formattedBattlesCount = BigWorld.wg_getIntegralFormat(battlesCount)
     specificDataColumn1.append(PUtils.getLabelDataObject(PROFILE.SECTION_STATISTICS_BODYPARAMS_LABEL_FORTSORTIE, (DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORT_SORTIE, formattedBattlesCount, PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_SORTIE, PUtils.createToolTipData((BigWorld.wg_getIntegralFormat(winsCount), BigWorld.wg_getIntegralFormat(lossesCount), BigWorld.wg_getIntegralFormat(drawsCount)))), DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTSORTIETOTALWINS, self._formattedWinsEfficiency, PROFILE.PROFILE_PARAMS_TOOLTIP_FORTSORTIEWINS))))
     specificData.append(specificDataColumn1)
     resourcesDataList = [DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTSORTIES_AVGRESOURCES, self.__avgFortSortiesLoot, PROFILE.PROFILE_PARAMS_TOOLTIP_FORTSORTIES_AVGRESOURCES), DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTSORTIES_TOTALRESOURCES, BigWorld.wg_getIntegralFormat(self.__totalSortiesLoot), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTSORTIES_TOTALRESOURCES)]
     specificDataColumn2 = []
     if g_lobbyContext.getServerSettings().isFortsEnabled():
         resourcesDataList.append(DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLES_TOTALRESOURCES, BigWorld.wg_getIntegralFormat(self.__fortMiscTargetData.getLootInBattles()), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_TOTALRESOURCES))
         resourcesDataList.append(DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLES_MAXRESOURCES, BigWorld.wg_getIntegralFormat(self.__fortMiscTargetData.getMaxLootInBattles()), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_MAXRESOURCES))
     specificDataColumn2.append(PUtils.getLabelDataObject(PROFILE.SECTION_STATISTICS_BODYPARAMS_LABEL_RESOURCE, resourcesDataList))
     specificData.append(specificDataColumn2)
     dataList.append(PUtils.getLabelViewTypeDataObject(PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_SPECIFIC, specificData, PUtils.VIEW_TYPE_TABLES))
     return dataList
Пример #5
0
 def _dispose(self):
     battle_selector_items.clear()
     g_clientUpdateManager.removeObjectCallbacks(self)
     self.stopGlobalListening()
     self.removeListener(events.FightButtonEvent.FIGHT_BUTTON_UPDATE, self.__handleFightButtonUpdated, scope=EVENT_BUS_SCOPE.LOBBY)
     self.removeListener(events.CoolDownEvent.PREBATTLE, self.__handleSetPrebattleCoolDown, scope=EVENT_BUS_SCOPE.LOBBY)
     self.removeListener(events.BubbleTooltipEvent.SHOW, self.__showBubbleTooltip, scope=EVENT_BUS_SCOPE.LOBBY)
     self.removeListener(events.CloseWindowEvent.GOLD_FISH_CLOSED, self.__onGoldFishWindowClosed, scope=EVENT_BUS_SCOPE.LOBBY)
     game_control.g_instance.gameSession.onPremiumNotify -= self.__onPremiumTimeChanged
     game_control.g_instance.wallet.onWalletStatusChanged -= self.__onWalletChanged
     game_control.g_instance.igr.onIgrTypeChanged -= self.__onIGRChanged
     g_lobbyContext.getServerSettings().onServerSettingsChange -= self.__onServerSettingChanged
     g_currentVehicle.onChanged -= self.__onVehicleChanged
     g_currentPreviewVehicle.onChanged -= self.__onVehicleChanged
     g_eventsCache.onSyncCompleted -= self.__onEventsCacheResync
     g_itemsCache.onSyncCompleted -= self.__onItemsChanged
     self.__falloutCtrl.onVehiclesChanged -= self.__updateFalloutSettings
     self.__falloutCtrl.onSettingsChanged -= self.__updateFalloutSettings
     self.__falloutCtrl = None
     self.app.containerManager.onViewAddedToContainer -= self.__onViewAddedToContainer
     game_control.g_instance.boosters.onBoosterChangeNotify -= self.__onUpdateGoodies
     g_preDefinedHosts.onPingPerformed -= self.__onPingPerformed
     g_settingsCore.onSettingsChanged -= self.__onSettingsChanged
     super(LobbyHeader, self)._dispose()
     return
Пример #6
0
 def start(self, clanCache):
     if self.isStarted():
         LOG_WARNING('Fort provider already is ready')
         return
     else:
         self.__initial |= FORT_PROVIDER_INITIAL_FLAGS.STARTED
         self.__clan = weakref.proxy(clanCache)
         self.__listeners = _ClientFortListeners()
         self.__keeper = FortSubscriptionKeeper()
         self.__keeper.onAutoUnsubscribed += self.__onAutoUnsubscribed
         fortMgr = getClientFortMgr()
         if fortMgr:
             fortMgr.onFortResponseReceived += self.__onFortResponseReceived
             fortMgr.onFortUpdateReceived += self.__onFortUpdateReceived
             fortMgr.onFortStateChanged += self.__onFortStateChanged
         else:
             LOG_ERROR('Fort manager is not found')
         g_lobbyContext.getServerSettings().onServerSettingsChange += self.__onServerSettingChanged
         g_playerEvents.onCenterIsLongDisconnected += self.__onCenterIsLongDisconnected
         self.__controller = controls.createInitial()
         self.__controller.init(self.__clan, self.__listeners)
         states.create(self)
         if not g_lobbyContext.getServerSettings().isFortsEnabled() and self.__cachedState is not None:
             if self.__cachedState.getStateID() not in (CLIENT_FORT_STATE.UNSUBSCRIBED, CLIENT_FORT_STATE.DISABLED):
                 SystemMessages.pushI18nMessage(I18N_SM.FORTIFICATION_NOTIFICATION_TURNEDOFF, type=SystemMessages.SM_TYPE.Warning)
                 showFortDisabledDialog()
         return
Пример #7
0
 def _getNextState(self):
     state = None
     if connectionManager.isConnected():
         if g_lobbyContext.getServerSettings().roaming.isInRoaming():
             state = ClanRoamingState(self._clanCtrl)
         elif not g_lobbyContext.getServerSettings().clanProfile.isEnabled():
             state = ClanDisabledState(self._clanCtrl)
     else:
         state = ClanUndefinedState(self._clanCtrl)
     return state
Пример #8
0
 def fini(self, woEvents = False):
     if self.__watcher is not None:
         self.__watcher.stop()
         self.__watcher = None
     if not woEvents and self._flags & FUNCTIONAL_FLAG.SWITCH == 0:
         if self._flags & FUNCTIONAL_FLAG.RANDOM_BATTLES == FUNCTIONAL_FLAG.RANDOM_BATTLES:
             self.storage.suspend()
     g_lobbyContext.getServerSettings().onServerSettingsChange -= self.__onServerSettingChanged
     super(SandboxQueueFunctional, self).fini(woEvents)
     return
 def _populate(self):
     super(FortBattlesRoomView, self)._populate()
     self.startFortListening()
     minLevel, maxLvl = self._getDivisionLvls()
     if maxLvl == minLevel:
         self.__updateVehiclesLabelSingle(fort_formatters.getTextLevel(maxLvl))
     else:
         self._updateVehiclesLabel(fort_formatters.getTextLevel(minLevel), fort_formatters.getTextLevel(maxLvl))
     g_lobbyContext.getServerSettings().onServerSettingsChange += self.__onSettingsChanged
     self.addListener(events.CoolDownEvent.PREBATTLE, self._handleChangedDivision, scope=EVENT_BUS_SCOPE.LOBBY)
     self._setChangeDivisionCooldown()
Пример #10
0
 def stop(self):
     if not self.isStarted():
         LOG_DEBUG('Fort provider already is stopped')
         return
     self.__cachedState = self.__state
     self.__initial = 0
     self.clear()
     fortMgr = getClientFortMgr()
     if fortMgr:
         fortMgr.onFortResponseReceived -= self.__onFortResponseReceived
         fortMgr.onFortUpdateReceived -= self.__onFortUpdateReceived
         fortMgr.onFortStateChanged -= self.__onFortStateChanged
     g_playerEvents.onCenterIsLongDisconnected -= self.__onCenterIsLongDisconnected
     g_lobbyContext.getServerSettings().onServerSettingsChange -= self.__onServerSettingChanged
Пример #11
0
 def _populate(self):
     self.__updateHangarMenuData()
     battle_selector_items.create()
     super(LobbyHeader, self)._populate()
     self.startGlobalListening()
     self.app.containerManager.onViewAddedToContainer += self.__onViewAddedToContainer
     game_control.g_instance.wallet.onWalletStatusChanged += self.__onWalletChanged
     game_control.g_instance.gameSession.onPremiumNotify += self.__onPremiumTimeChanged
     game_control.g_instance.igr.onIgrTypeChanged += self.__onIGRChanged
     g_lobbyContext.getServerSettings().onServerSettingsChange += self.__onServerSettingChanged
     g_currentVehicle.onChanged += self.__onVehicleChanged
     g_currentPreviewVehicle.onChanged += self.__onVehicleChanged
     g_eventsCache.onSyncCompleted += self.__onEventsCacheResync
     g_itemsCache.onSyncCompleted += self.__onItemsChanged
     game_control.g_instance.boosters.onBoosterChangeNotify += self.__onUpdateGoodies
     self.__falloutCtrl = getFalloutCtrl()
     self.__falloutCtrl.onVehiclesChanged += self.__updateFalloutSettings
     self.__falloutCtrl.onSettingsChanged += self.__updateFalloutSettings
     self.addListener(events.FightButtonEvent.FIGHT_BUTTON_UPDATE, self.__handleFightButtonUpdated, scope=EVENT_BUS_SCOPE.LOBBY)
     self.addListener(events.CoolDownEvent.PREBATTLE, self.__handleSetPrebattleCoolDown, scope=EVENT_BUS_SCOPE.LOBBY)
     self.addListener(events.BubbleTooltipEvent.SHOW, self.__showBubbleTooltip, scope=EVENT_BUS_SCOPE.LOBBY)
     self.addListener(events.CloseWindowEvent.GOLD_FISH_CLOSED, self.__onGoldFishWindowClosed, scope=EVENT_BUS_SCOPE.LOBBY)
     g_clientUpdateManager.addCallbacks({'stats.credits': self.__setCredits,
      'stats.gold': self.__setGold,
      'stats.freeXP': self.__setFreeXP,
      'stats.clanInfo': self.__setClanInfo,
      'goodies': self.__updateGoodies,
      'account.premiumExpiryTime': self.__onPremiumExpireTimeChanged,
      'cache.SPA': self.__onSPAUpdated})
     self.as_setFightButtonS(i18n.makeString('#menu:headerButtons/battle'))
     self.as_setWalletStatusS(game_control.g_instance.wallet.componentsStatuses)
     self.as_setPremShopDataS(RES_ICONS.MAPS_ICONS_LOBBY_ICON_PREMSHOP, MENU.HEADERBUTTONS_BTNLABEL_PREMSHOP, TOOLTIPS.HEADER_PREMSHOP, TOOLTIP_TYPES.COMPLEX)
     self.as_initOnlineCounterS(constants.IS_SHOW_SERVER_STATS)
     if constants.IS_SHOW_SERVER_STATS:
         game_control.g_instance.serverStats.onStatsReceived += self.__onStatsReceived
         self.__onStatsReceived()
     self.updateAccountInfo()
     self.__updateServerData()
     if not isTimeToShowGoldFishPromo():
         enabledVal = isGoldFishActionActive()
         tooltip = TOOLTIPS.HEADER_REFILL_ACTION if enabledVal else TOOLTIPS.HEADER_REFILL
         self.as_setGoldFishEnabledS(enabledVal, False, tooltip, TOOLTIP_TYPES.COMPLEX)
     g_preDefinedHosts.onPingPerformed += self.__onPingPerformed
     g_preDefinedHosts.requestPing()
     g_settingsCore.onSettingsChanged += self.__onSettingsChanged
     encyclopediaController = game_control.getEncyclopediaController()
     encyclopediaController.onNewRecommendationReceived += self.__onNewEncyclopediaRecommendation
     encyclopediaController.onStateChanged += self.__updateHangarMenuData
     Waiting.hide('enter')
Пример #12
0
 def isServerAvailable(self, serverID = None):
     if serverID is None:
         serverID = connectionManager.peripheryID
     servSettings = g_lobbyContext.getServerSettings()
     if servSettings is not None and len(self.getForbiddenHours(serverID)) == time_utils.HOURS_IN_DAY + 1:
         return False
     return True
Пример #13
0
 def _getClanBtnsParams(self, appsCount):
     if self.clansCtrl.isAvailable():
         isAvailable = True
         searchClanTooltip = TOOLTIPS.HEADER_ACCOUNTPOPOVER_SEARCHCLAN
         requestInviteBtnTooltip = TOOLTIPS.HEADER_ACCOUNTPOPOVER_INVITEREQUESTBTN
         btnTooltip = str()
     else:
         isAvailable = False
         searchClanTooltip = TOOLTIPS.HEADER_ACCOUNTPOPOVER_SEARCHCLAN_UNAVAILABLE
         requestInviteBtnTooltip = TOOLTIPS.HEADER_ACCOUNTPOPOVER_INVITEREQUESTBTN_UNAVAILABLE
         btnTooltip = str()
     btnEnabled = not BigWorld.player().isLongDisconnectedFromCenter and self.__infoBtnEnabled
     if self.clansCtrl.isEnabled():
         btnEnabled = self.clansCtrl.isAvailable()
         if not btnEnabled:
             btnTooltip = TOOLTIPS.HEADER_ACCOUNTPOPOVER_CLANPROFILE_UNAVAILABLE
     elif not g_lobbyContext.getServerSettings().isFortsEnabled():
         btnEnabled = False
         btnTooltip = TOOLTIPS.HEADER_ACCOUNTPOPOVER_CLANPROFILE_UNAVAILABLE
     return {'searchClanTooltip': searchClanTooltip,
      'btnEnabled': btnEnabled,
      'requestInviteBtnTooltip': requestInviteBtnTooltip,
      'btnTooltip': btnTooltip,
      'isOpenInviteBtnEnabled': isAvailable,
      'isSearchClanBtnEnabled': isAvailable}
    def __createData(self):
        fort = self.fortCtrl.getFort()
        peripheryList = self.__getPeripheryList()
        currentPeripheryID = fort.peripheryID
        isServerValid = False
        for i in xrange(len(peripheryList)):
            if peripheryList[i]['id'] == currentPeripheryID:
                isServerValid = True
                break

        if not isServerValid:
            currentPeripheryID = -1
        _, defenceMin = adjustDefenceHourToLocal(0)
        return {
            'peripheryData':
            peripheryList,
            'peripherySelectedID':
            currentPeripheryID,
            'holidayData':
            self._getDayoffsList(),
            'holidaySelectedID':
            fort.getLocalOffDay(),
            'hour':
            -1,
            'minutes':
            defenceMin,
            'isWrongLocalTime':
            self._isWrongLocalTime(),
            'skipValues':
            adjustDefenceHoursListToLocal(g_lobbyContext.getServerSettings().
                                          getForbiddenFortDefenseHours()),
            'isTwelveHoursFormat':
            self.app.utilsManager.isTwelveHoursFormat()
        }
Пример #15
0
    def __getCommonQuestsIterator(self):
        questsData = self.__getQuestsData()
        questsData.update(self.__getFortQuestsData())
        questsData.update(self.__getPersonalQuestsData())
        questsData.update(self.__getPotapovHiddenQuests())
        for qID, qData in questsData.iteritems():
            yield (qID, self._makeQuest(qID, qData))

        currentESportSeasonID = g_lobbyContext.getServerSettings().eSportCurrentSeason.getID()
        eSportQuests = clubs_quests.g_cache.getLadderQuestsBySeasonID(currentESportSeasonID) or []
        for questDescr in eSportQuests:
            yield (
                questDescr.questID,
                self._makeQuest(
                    questDescr.questID,
                    questDescr.questData,
                    maker=_clubsQuestMaker,
                    seasonID=currentESportSeasonID,
                    questDescr=questDescr,
                ),
            )

        motiveQuests = motivation_quests.g_cache.getAllQuests() or []
        for questDescr in motiveQuests:
            yield (
                questDescr.questID,
                self._makeQuest(questDescr.questID, questDescr.questData, maker=_motiveQuestMaker),
            )
Пример #16
0
 def canCreateChannel(self):
     roaming = g_lobbyContext.getServerSettings().roaming
     if g_settings.server.XMPP.isEnabled():
         canCreate = roaming.isSameRealm(self.databaseID)
     else:
         canCreate = not roaming.isInRoaming() and not roaming.isPlayerInRoaming(self.databaseID) and self.isOnline
     return canCreate
Пример #17
0
    def attachStickers(self, model, parentNode, isDamaged):
        self.detachStickers()
        self.__model = model
        self.__parentNode = parentNode
        self.__isDamaged = isDamaged
        self.__parentNode.attach(self.__stickerModel)
        replayCtrl = BattleReplay.g_replayCtrl
        for slotType, slots in self.__slotsByType.iteritems():
            if slotType != SlotTypes.CLAN or self.__clanID == 0 or replayCtrl.isPlaying and replayCtrl.isOffline:
                if slotType != SlotTypes.CLAN:
                    self.__doAttachStickers(slotType)
            elif slotType == SlotTypes.CLAN:
                serverSettings = g_lobbyContext.getServerSettings()
                if serverSettings is not None and serverSettings.roaming.isInRoaming() or self.__isLoadingClanEmblems:
                    continue
                self.__isLoadingClanEmblems = True
                accountRep = Account.g_accountRepository
                if accountRep is None:
                    LOG_ERROR('Failed to attach stickers to the vehicle - account repository is not initialized')
                    continue
                fileCache = accountRep.customFilesCache
                fileServerSettings = accountRep.fileServerSettings
                clan_emblems = fileServerSettings.get('clan_emblems')
                if clan_emblems is None:
                    continue
                url = None
                try:
                    url = clan_emblems['url_template'] % self.__clanID
                except:
                    LOG_ERROR('Failed to attach stickers to the vehicle - server returned incorrect url format: %s' % clan_emblems['url_template'])
                    continue

                fileCache.get(url, self.__onClanEmblemLoaded)

        return
 def getTooltipData(self, itemData):
     if itemData is None:
         return ''
     elif itemData == PREBATTLE_ACTION_NAME.RANDOM_QUEUE:
         return TOOLTIPS.BATTLETYPES_STANDART
     elif itemData == PREBATTLE_ACTION_NAME.UNIT:
         return TOOLTIPS.BATTLETYPES_UNIT
     elif itemData == PREBATTLE_ACTION_NAME.COMPANY:
         return self.__getCompanyAvailabilityData()
     else:
         if itemData == PREBATTLE_ACTION_NAME.FORT:
             if not g_lobbyContext.getServerSettings().isFortsEnabled():
                 return TOOLTIPS.BATTLETYPES_FORTIFICATION_DISABLED
             elif not g_clanCache.isInClan:
                 return '#tooltips:fortification/disabled/no_clan'
             elif not isStartingScriptDone():
                 return '#tooltips:fortification/disabled/no_fort'
             else:
                 return TOOLTIPS.BATTLETYPES_FORTIFICATION
         else:
             if itemData == PREBATTLE_ACTION_NAME.TRAINING:
                 return TOOLTIPS.BATTLETYPES_TRAINING
             if itemData == PREBATTLE_ACTION_NAME.SPEC_BATTLE:
                 return TOOLTIPS.BATTLETYPES_SPEC
             if itemData == PREBATTLE_ACTION_NAME.BATTLE_TUTORIAL:
                 return TOOLTIPS.BATTLETYPES_BATTLETUTORIAL
             if itemData == PREBATTLE_ACTION_NAME.FALLOUT:
                 return TOOLTIPS.BATTLETYPES_FALLOUT
             if itemData == PREBATTLE_ACTION_NAME.SANDBOX:
                 return makeTooltip(TOOLTIPS.BATTLETYPES_BATTLETEACHING_HEADER, i18n.makeString(TOOLTIPS.BATTLETYPES_BATTLETEACHING_BODY, map1=i18n.makeString(ARENAS.C_100_THEPIT_NAME), map2=i18n.makeString(ARENAS.C_10_HILLS_NAME), battles=BATTLES_TO_SELECT_RANDOM_MIN_LIMIT))
         return ''
Пример #19
0
 def __getStatsBlock(self, dossier):
     if self._battlesType == PROFILE_DROPDOWN_KEYS.ALL:
         return dossier.getRandomStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FALLOUT:
         return dossier.getFalloutStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.HISTORICAL:
         return dossier.getHistoricalStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.TEAM:
         return dossier.getTeam7x7Stats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.STATICTEAM:
         return dossier.getRated7x7Stats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FORTIFICATIONS:
         return dossier.getFortSortiesStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.CLAN:
         return dossier.getGlobalMapStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.STATICTEAM_SEASON:
         currentSeasonID = g_lobbyContext.getServerSettings().eSportCurrentSeason.getID()
         return dossier.getSeasonRated7x7Stats(currentSeasonID)
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FORTIFICATIONS_BATTLES:
         return dossier.getFortBattlesStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FORTIFICATIONS_SORTIES:
         return dossier.getFortSortiesStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.COMPANY:
         return dossier.getCompanyStats()
     raise ValueError('_Dossier: Unknown battle type: ' + self._battlesType)
Пример #20
0
    def _setInitData(self, battlesType, accountDossier = None):
        dropDownProvider = [self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.ALL),
         self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.FALLOUT),
         self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.HISTORICAL),
         self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.TEAM),
         self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.STATICTEAM),
         self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.CLAN)]
        if g_lobbyContext.getServerSettings().isFortsEnabled():
            dropDownProvider.append(self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.FORTIFICATIONS))
        seasonItems = [self._dataProviderEntry(PROFILE_DROPDOWN_KEYS.STATICTEAM, PROFILE.PROFILE_SEASONSDROPDOWN_ALL)]
        if accountDossier is not None:
            seasons = accountDossier.getRated7x7Seasons()
            if len(seasons):
                seasonItems.append(self._dataProviderEntry(PROFILE_DROPDOWN_KEYS.STATICTEAM_SEASON, PROFILE.PROFILE_SEASONSDROPDOWN_CURRENT))
                completedSeasons = self.clubsCtrl.getCompletedSeasons()
                for seasonID, _ in accountDossier.getRated7x7Seasons().iteritems():
                    if seasonID in completedSeasons:
                        sID = _packProviderType(PROFILE_DROPDOWN_KEYS.STATICTEAM, seasonID)
                        seasonUserName = self.clubsCtrl.getSeasonUserName(seasonID)
                        if seasonUserName:
                            seasonItems.append(self._dataProviderEntry(sID, seasonUserName))

        seasonIndex = 0
        for idx, season in enumerate(seasonItems):
            if season['key'] == _packProviderType(self._battlesType, self._seasonID):
                seasonIndex = idx

        self.as_setInitDataS({'dropDownProvider': dropDownProvider,
         'seasonItems': seasonItems,
         'seasonIndex': seasonIndex,
         'seasonEnabled': len(seasonItems) > 1})
        return
Пример #21
0
 def _getNecessaryStats(self, accountDossier = None):
     if accountDossier is None:
         accountDossier = g_itemsCache.items.getAccountDossier(self._userID)
     if self._battlesType == PROFILE_DROPDOWN_KEYS.ALL:
         data = self._getTotalStatsBlock(accountDossier)
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.TEAM:
         data = accountDossier.getTeam7x7Stats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.STATICTEAM:
         if self._seasonID is not None:
             data = accountDossier.getSeasonRated7x7Stats(int(self._seasonID))
         else:
             data = accountDossier.getRated7x7Stats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.STATICTEAM_SEASON:
         currentSeasonID = g_lobbyContext.getServerSettings().eSportCurrentSeason.getID()
         data = accountDossier.getSeasonRated7x7Stats(currentSeasonID)
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.HISTORICAL:
         data = accountDossier.getHistoricalStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FORTIFICATIONS:
         data = self._receiveFortDossier(accountDossier)
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FORTIFICATIONS_SORTIES:
         data = accountDossier.getFortSortiesStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FORTIFICATIONS_BATTLES:
         data = accountDossier.getFortBattlesStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.COMPANY:
         data = accountDossier.getCompanyStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.CLAN:
         data = accountDossier.getGlobalMapStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FALLOUT:
         data = accountDossier.getFalloutStats()
     else:
         raise ValueError('ProfileSection: Unknown battle type: ' + self._battlesType)
     return data
Пример #22
0
 def __updateHangarMenuData(self):
     tabDataProvider = [{'label': MENU.HEADERBUTTONS_HANGAR,
       'value': self.TABS.HANGAR,
       'textColor': 16764006,
       'textColorOver': 16768409,
       'tooltip': TOOLTIPS.HEADER_BUTTONS_HANGAR},
      {'label': MENU.HEADERBUTTONS_SHOP,
       'value': STORE_CONSTANTS.STORE,
       'tooltip': TOOLTIPS.HEADER_BUTTONS_SHOP},
      {'label': MENU.HEADERBUTTONS_PROFILE,
       'value': self.TABS.PROFILE,
       'tooltip': TOOLTIPS.HEADER_BUTTONS_PROFILE},
      {'label': MENU.HEADERBUTTONS_TECHTREE,
       'value': self.TABS.TECHTREE,
       'tooltip': TOOLTIPS.HEADER_BUTTONS_TECHTREE,
       'subValues': [self.TABS.RESEARCH]},
      {'label': MENU.HEADERBUTTONS_BARRACKS,
       'value': self.TABS.BARRACKS,
       'tooltip': TOOLTIPS.HEADER_BUTTONS_BARRACKS}]
     if constants.IS_CHINA:
         tabDataProvider.append({'label': MENU.HEADERBUTTONS_BROWSER,
          'value': self.TABS.BROWSER,
          'tooltip': TOOLTIPS.HEADER_BUTTONS_BROWSER})
     fortEnabled = g_lobbyContext.getServerSettings().isFortsEnabled()
     tabDataProvider.append({'label': MENU.HEADERBUTTONS_FORTS,
      'value': FORTIFICATION_ALIASES.FORTIFICATIONS_VIEW_ALIAS,
      'tooltip': TOOLTIPS.HEADER_BUTTONS_FORTS if fortEnabled else TOOLTIPS.HEADER_BUTTONS_FORTS_TURNEDOFF,
      'enabled': fortEnabled})
     self.as_setHangarMenuDataS({'tabDataProvider': tabDataProvider})
 def _populate(self):
     super(FortIntelligenceClanFilterPopover, self)._populate()
     headerText = text_styles.highTitle(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_HEADER))
     clanLevelText = text_styles.standard(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_CLANLEVEL))
     startHourRangeText = text_styles.standard(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_STARTHOURRANGE))
     self.as_setDescriptionsTextS(headerText, clanLevelText, startHourRangeText)
     defaultButtonText = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_DEFAULTBUTTONTEXT)
     applyButtonText = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_APPLYBUTTONTEXT)
     cancelButtonText = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_CANCELBUTTONTEXT)
     self.as_setButtonsTextS(defaultButtonText, applyButtonText, cancelButtonText)
     defaultButtonTooltip = TOOLTIPS.FORTIFICATION_FORTINTELLIGENCECLANFILTERPOPOVER_DEFAULT
     applyButtonTooltip = TOOLTIPS.FORTIFICATION_FORTINTELLIGENCECLANFILTERPOPOVER_APPLY
     self.as_setButtonsTooltipsS(defaultButtonTooltip, applyButtonTooltip)
     minClanLevel = FORTIFICATION_ALIASES.CLAN_FILTER_MIN_LEVEL
     maxClanLevel = FORTIFICATION_ALIASES.CLAN_FILTER_MAX_LEVEL
     startDefenseHour = FORTIFICATION_ALIASES.CLAN_FILTER_MIN_HOUR
     startDefenseMin = 0
     cache = self.fortCtrl.getPublicInfoCache()
     if cache:
         minClanLevel, maxClanLevel, startDefenseHour, availability = cache.getDefaultFilterData()
         selectedDate = time.localtime(time_utils.getTimeForLocal(time_utils.getCurrentTimestamp(), max(0, startDefenseHour)))
         startDefenseMin = selectedDate.tm_min
     data = {'minClanLevel': minClanLevel,
      'maxClanLevel': maxClanLevel,
      'startDefenseHour': startDefenseHour,
      'startDefenseMinutes': startDefenseMin,
      'isTwelveHoursFormat': self.app.utilsManager.isTwelveHoursFormat(),
      'isWrongLocalTime': self._isWrongLocalTime(),
      'skipValues': adjustDefenceHoursListToLocal(g_lobbyContext.getServerSettings().getForbiddenFortDefenseHours())}
     defenceStart, _ = self.fortCtrl.getFort().getLocalDefenceHour()
     if defenceStart != NOT_ACTIVATED:
         data['yourOwnClanStartDefenseHour'] = defenceStart
     self.as_setDataS(data)
Пример #24
0
 def __isEnabledInRoaming(self, dbID):
     roaming = g_lobbyContext.getServerSettings().roaming
     if g_settings.server.XMPP.isEnabled():
         isEnabled = roaming.isSameRealm(dbID)
     else:
         isEnabled = not roaming.isInRoaming() and not roaming.isPlayerInRoaming(dbID)
     return isEnabled
Пример #25
0
 def isInRoaming(self):
     if not self.isCurrentUser():
         from gui.LobbyContext import g_lobbyContext
         serverSettings = g_lobbyContext.getServerSettings()
         if serverSettings is not None:
             roaming = serverSettings.roaming
             return roaming.isInRoaming() or roaming.isPlayerInRoaming(self._playerDBID)
     return False
Пример #26
0
 def getRegionCode(self, dbID):
     regionCode = None
     serverSettings = g_lobbyContext.getServerSettings()
     if serverSettings:
         roaming = serverSettings.roaming
         if dbID and not roaming.isSameRealm(dbID):
             _, regionCode = roaming.getPlayerHome(dbID)
     return regionCode
Пример #27
0
def getRegionCode(accountDBID):
    regionCode = None
    serverSettings = g_lobbyContext.getServerSettings()
    if serverSettings is not None:
        roaming = serverSettings.roaming
        if accountDBID and not roaming.isSameRealm(accountDBID):
            _, regionCode = roaming.getPlayerHome(accountDBID)
    return regionCode
Пример #28
0
 def _selectLastTab(self):
     tabID = self._navInfo.tabID
     if not tabID:
         if g_lobbyContext.getServerSettings().isPotapovQuestEnabled():
             tabID = _QA.TAB_PERSONAL_QUESTS
         else:
             tabID = _QA.TAB_COMMON_QUESTS
     self.as_selectTabS(tabID)
     return tabID
Пример #29
0
 def openClanStatistic(self):
     if g_lobbyContext.getServerSettings().clanProfile.isEnabled():
         clanID, _ = g_itemsCache.items.getClanInfo(self._userID)
         if clanID != 0:
             shared_events.showClanProfileWindow(clanID)
     elif self.__isFortClanProfileAvailable():
         self.fireEvent(events.LoadViewEvent(FORTIFICATION_ALIASES.FORT_CLAN_STATISTICS_WINDOW_ALIAS), EVENT_BUS_SCOPE.LOBBY)
     else:
         LOG_ERROR('Fort Clan Profile Statistics is Unavailable for current user profile')
Пример #30
0
 def _getInitData(self, accountDossier = None, isFallout = False):
     dropDownProvider = [self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.ALL), self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.FALLOUT)]
     if accountDossier is not None and accountDossier.getHistoricalStats().getVehicles():
         dropDownProvider.append(self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.HISTORICAL))
     dropDownProvider.extend((self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.TEAM), self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.STATICTEAM), self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.CLAN)))
     if g_lobbyContext.getServerSettings().isFortsEnabled():
         dropDownProvider.extend((self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.FORTIFICATIONS_SORTIES), self._dataProviderEntryAutoTranslate(PROFILE_DROPDOWN_KEYS.FORTIFICATIONS_BATTLES)))
     return {'dropDownProvider': dropDownProvider,
      'tableHeader': self._getTableHeader(isFallout)}