Пример #1
0
def onAccountShowGUI(ctx):
    g_lobbyContext.onAccountShowGUI(ctx)
    yield g_itemsCache.update()
    yield g_questsCache.update()
    yield g_settingsCache.update()
    if not g_itemsCache.isSynced():
        return
    g_settingsCore.serverSettings.applySettings()
    game_control.g_instance.onAccountShowGUI(g_lobbyContext.getGuiCtx())
    accDossier = g_itemsCache.items.getAccountDossier()
    g_rareAchievesCache.request(accDossier.getRecord('rareAchievements'))
    MusicController.g_musicController.setAccountAttrs(
        g_itemsCache.items.stats.attributes)
    MusicController.g_musicController.play(MusicController.MUSIC_EVENT_LOBBY)
    MusicController.g_musicController.play(MusicController.AMBIENT_EVENT_LOBBY)
    premium = isPremiumAccount(g_itemsCache.items.stats.attributes)
    if g_hangarSpace.inited:
        g_hangarSpace.refreshSpace(premium)
    else:
        g_hangarSpace.init(premium)
    g_currentVehicle.init()
    g_windowsManager.onAccountShowGUI(g_lobbyContext.getGuiCtx())
    yield g_windowsManager.window.tooltipManager.request()
    g_prbLoader.onAccountShowGUI(g_lobbyContext.getGuiCtx())
    SoundGroups.g_instance.enableLobbySounds(True)
    onCenterIsLongDisconnected(True)
    Waiting.hide('enter')
Пример #2
0
def onAccountShowGUI(ctx):
    g_lobbyContext.onAccountShowGUI(ctx)
    yield g_itemsCache.update()
    yield g_questsCache.update()
    yield g_settingsCache.update()
    if not g_itemsCache.isSynced():
        return
    g_settingsCore.serverSettings.applySettings()
    game_control.g_instance.onAccountShowGUI(g_lobbyContext.getGuiCtx())
    accDossier = g_itemsCache.items.getAccountDossier()
    g_rareAchievesCache.request(accDossier.getRecord('rareAchievements'))
    MusicController.g_musicController.setAccountAttrs(g_itemsCache.items.stats.attributes)
    MusicController.g_musicController.play(MusicController.MUSIC_EVENT_LOBBY)
    MusicController.g_musicController.play(MusicController.AMBIENT_EVENT_LOBBY)
    premium = isPremiumAccount(g_itemsCache.items.stats.attributes)
    if g_hangarSpace.inited:
        g_hangarSpace.refreshSpace(premium)
    else:
        g_hangarSpace.init(premium)
    g_currentVehicle.init()
    g_windowsManager.onAccountShowGUI(g_lobbyContext.getGuiCtx())
    yield g_windowsManager.window.tooltipManager.request()
    g_prbLoader.onAccountShowGUI(g_lobbyContext.getGuiCtx())
    SoundGroups.g_instance.enableLobbySounds(True)
    onCenterIsLongDisconnected(True)
    Waiting.hide('enter')
Пример #3
0
 def _requestImageID(self, imgType):
     g_rareAchievesCache.request([self._rareID])
     memImgID = None
     iconData = g_rareAchievesCache.getImageData(imgType, self._rareID)
     if iconData and imghdr.what(None, iconData) is not None:
         memImgID = str(uuid.uuid4())
         BigWorld.wg_addTempScaleformTexture(memImgID, iconData)
     return memImgID
Пример #4
0
 def _requestImageID(self, imgType):
     g_rareAchievesCache.request([self._rareID])
     memImgID = None
     iconData = g_rareAchievesCache.getImageData(imgType, self._rareID)
     if iconData and imghdr.what(None, iconData) is not None:
         memImgID = str(uuid.uuid4())
         BigWorld.wg_addTempScaleformTexture(memImgID, iconData)
     return memImgID
Пример #5
0
 def requestImageID(self):
     import imghdr, uuid
     g_rareAchievesCache.request([self.rareID])
     iconId = None
     iconData = g_rareAchievesCache.getImageData(self.rareID)
     if iconData and imghdr.what(None, iconData) is not None:
         iconId = str(uuid.uuid4())
         BigWorld.wg_addTempScaleformTexture(iconId, iconData)
     return iconId
def onAccountShowGUI(ctx):
    global onCenterIsLongDisconnected
    ServicesLocator.statsCollector.noteHangarLoadingState(
        HANGAR_LOADING_STATE.SHOW_GUI)
    ServicesLocator.lobbyContext.onAccountShowGUI(ctx)
    yield ServicesLocator.itemsCache.update(CACHE_SYNC_REASON.SHOW_GUI,
                                            notify=False)
    Waiting.show('enter')
    ServicesLocator.statsCollector.noteHangarLoadingState(
        HANGAR_LOADING_STATE.QUESTS_SYNC)
    ServicesLocator.eventsCache.start()
    yield ServicesLocator.eventsCache.update()
    ServicesLocator.statsCollector.noteHangarLoadingState(
        HANGAR_LOADING_STATE.USER_SERVER_SETTINGS_SYNC)
    yield ServicesLocator.settingsCache.update()
    if not ServicesLocator.itemsCache.isSynced():
        g_appLoader.goToLoginByError('#menu:disconnect/codes/0')
        return
    eula = EULADispatcher()
    yield eula.processLicense()
    eula.fini()
    g_playerEvents.onGuiCacheSyncCompleted(ctx)
    code = yield AccountValidator().validate()
    if code > 0:
        g_appLoader.goToLoginByError('#menu:disconnect/codes/%d' % code)
        return
    ServicesLocator.itemsCache.onSyncCompleted(CACHE_SYNC_REASON.SHOW_GUI, {})
    ServicesLocator.settingsCore.serverSettings.applySettings()
    ServicesLocator.gameState.onAccountShowGUI(
        ServicesLocator.lobbyContext.getGuiCtx())
    accDossier = ServicesLocator.itemsCache.items.getAccountDossier()
    g_rareAchievesCache.request(accDossier.getBlock('rareAchievements'))
    premium = isPremiumAccount(
        ServicesLocator.itemsCache.items.stats.attributes)
    if g_hangarSpace.inited:
        g_hangarSpace.refreshSpace(premium)
    else:
        g_hangarSpace.init(premium)
    g_currentVehicle.init()
    g_currentPreviewVehicle.init()
    ServicesLocator.webCtrl.start()
    ServicesLocator.soundCtrl.start()
    g_appLoader.showLobby()
    g_prbLoader.onAccountShowGUI(ServicesLocator.lobbyContext.getGuiCtx())
    serverSettings = ServicesLocator.lobbyContext.getServerSettings()
    if serverSettings.wgcg.getLoginOnStart():
        yield ServicesLocator.webCtrl.login()
    if serverSettings.isElenEnabled():
        yield ServicesLocator.eventsController.getEvents(
            onlySettings=True, onLogin=True, prefetchKeyArtBig=False)
        yield ServicesLocator.eventsController.getHangarFlag(onLogin=True)
    g_prbLoader.onAccountShowGUI(ServicesLocator.lobbyContext.getGuiCtx())
    g_clanCache.onAccountShowGUI()
    SoundGroups.g_instance.enableLobbySounds(True)
    onCenterIsLongDisconnected(True)
    guiModsSendEvent('onAccountShowGUI', ctx)
    Waiting.hide('enter')
Пример #7
0
 def requestImageID(self):
     import imghdr, uuid
     g_rareAchievesCache.request([self.rareID])
     iconId = None
     iconData = g_rareAchievesCache.getImageData(self.rareID)
     if iconData and imghdr.what(None, iconData) is not None:
         iconId = str(uuid.uuid4())
         BigWorld.wg_addTempScaleformTexture(iconId, iconData)
     return iconId
Пример #8
0
def onAccountShowGUI(ctx):
    global onCenterIsLongDisconnected
    g_statistics.noteHangarLoadingState(HANGAR_LOADING_STATE.SHOW_GUI)
    g_lobbyContext.onAccountShowGUI(ctx)
    yield g_itemsCache.update(CACHE_SYNC_REASON.SHOW_GUI)
    g_statistics.noteHangarLoadingState(HANGAR_LOADING_STATE.QUESTS_SYNC)
    g_eventsCache.start()
    yield g_eventsCache.update()
    g_statistics.noteHangarLoadingState(
        HANGAR_LOADING_STATE.USER_SERVER_SETTINGS_SYNC)
    yield g_settingsCache.update()
    if not g_itemsCache.isSynced():
        g_appLoader.goToLoginByError('#menu:disconnect/codes/0')
        return
    eula = EULADispatcher()
    yield eula.processLicense()
    eula.fini()
    g_playerEvents.onGuiCacheSyncCompleted(ctx)
    code = yield AccountValidator().validate()
    if code > 0:
        g_appLoader.goToLoginByError('#menu:disconnect/codes/%d' % code)
        return
    g_settingsCore.serverSettings.applySettings()
    game_control.g_instance.onAccountShowGUI(g_lobbyContext.getGuiCtx())
    accDossier = g_itemsCache.items.getAccountDossier()
    g_rareAchievesCache.request(accDossier.getBlock('rareAchievements'))
    premium = isPremiumAccount(g_itemsCache.items.stats.attributes)
    if g_hangarSpace.inited:
        g_hangarSpace.refreshSpace(premium)
    else:
        g_hangarSpace.init(premium)
    g_currentVehicle.init()
    g_currentPreviewVehicle.init()
    g_appLoader.showLobby()
    g_prbLoader.onAccountShowGUI(g_lobbyContext.getGuiCtx())
    g_clanCache.onAccountShowGUI()
    g_clubsCtrl.start()
    g_clanCtrl.start()
    g_soundsCtrl.start()
    SoundGroups.g_instance.enableLobbySounds(True)
    onCenterIsLongDisconnected(True)
    guiModsSendEvent('onAccountShowGUI', ctx)
    Waiting.hide('enter')
Пример #9
0
def onAccountShowGUI(ctx):
    global onCenterIsLongDisconnected
    g_statistics.noteHangarLoadingState(HANGAR_LOADING_STATE.SHOW_GUI)
    g_lobbyContext.onAccountShowGUI(ctx)
    yield g_itemsCache.update(CACHE_SYNC_REASON.SHOW_GUI)
    g_statistics.noteHangarLoadingState(HANGAR_LOADING_STATE.QUESTS_SYNC)
    g_eventsCache.start()
    yield g_eventsCache.update()
    g_statistics.noteHangarLoadingState(HANGAR_LOADING_STATE.USER_SERVER_SETTINGS_SYNC)
    yield g_settingsCache.update()
    if not g_itemsCache.isSynced():
        g_appLoader.goToLoginByError("#menu:disconnect/codes/0")
        return
    eula = EULADispatcher()
    yield eula.processLicense()
    eula.fini()
    g_playerEvents.onGuiCacheSyncCompleted(ctx)
    code = yield AccountValidator().validate()
    if code > 0:
        g_appLoader.goToLoginByError("#menu:disconnect/codes/%d" % code)
        return
    g_settingsCore.serverSettings.applySettings()
    game_control.g_instance.onAccountShowGUI(g_lobbyContext.getGuiCtx())
    accDossier = g_itemsCache.items.getAccountDossier()
    g_rareAchievesCache.request(accDossier.getBlock("rareAchievements"))
    premium = isPremiumAccount(g_itemsCache.items.stats.attributes)
    if g_hangarSpace.inited:
        g_hangarSpace.refreshSpace(premium)
    else:
        g_hangarSpace.init(premium)
    g_currentVehicle.init()
    g_currentPreviewVehicle.init()
    g_appLoader.showLobby()
    g_prbLoader.onAccountShowGUI(g_lobbyContext.getGuiCtx())
    g_clanCache.onAccountShowGUI()
    g_clubsCtrl.start()
    g_clanCtrl.start()
    g_soundsCtrl.start()
    SoundGroups.g_instance.enableLobbySounds(True)
    onCenterIsLongDisconnected(True)
    guiModsSendEvent("onAccountShowGUI", ctx)
    Waiting.hide("enter")
Пример #10
0
def onAccountShowGUI(ctx):
    global onCenterIsLongDisconnected
    g_lobbyContext.onAccountShowGUI(ctx)
    yield g_itemsCache.update(CACHE_SYNC_REASON.SHOW_GUI)
    g_eventsCache.start()
    yield g_eventsCache.update()
    yield g_settingsCache.update()
    if not g_itemsCache.isSynced():
        return
    eula = EULADispatcher()
    yield eula.processLicense()
    eula.fini()
    g_playerEvents.onGuiCacheSyncCompleted(ctx)
    code = yield AccountValidator().validate()
    if code > 0:
        from gui import DialogsInterface

        DialogsInterface.showDisconnect("#menu:disconnect/codes/%d" % code)
        return
    g_settingsCore.serverSettings.applySettings()
    game_control.g_instance.onAccountShowGUI(g_lobbyContext.getGuiCtx())
    accDossier = g_itemsCache.items.getAccountDossier()
    g_rareAchievesCache.request(accDossier.getBlock("rareAchievements"))
    MusicController.g_musicController.setAccountAttrs(g_itemsCache.items.stats.attributes)
    MusicController.g_musicController.play(MusicController.MUSIC_EVENT_LOBBY)
    MusicController.g_musicController.play(MusicController.AMBIENT_EVENT_LOBBY)
    premium = isPremiumAccount(g_itemsCache.items.stats.attributes)
    if g_hangarSpace.inited:
        g_hangarSpace.refreshSpace(premium)
    else:
        g_hangarSpace.init(premium)
    g_currentVehicle.init()
    g_appLoader.showLobby()
    g_prbLoader.onAccountShowGUI(g_lobbyContext.getGuiCtx())
    g_clanCache.onAccountShowGUI()
    g_clubsCtrl.start()
    SoundGroups.g_instance.enableLobbySounds(True)
    onCenterIsLongDisconnected(True)
    guiModsSendEvent("onAccountShowGUI", ctx)
    Waiting.hide("enter")
Пример #11
0
    def __invalidateData(self, callback = lambda *args: None):
        self.__clearCache()
        self.__clearInvalidateCallback()
        self.__waitForSync = True
        self.onSyncStarted()

        def mergeValues(a, b):
            result = list(a)
            result.extend(b)
            return result

        for action in self.getActions().itervalues():
            for modifier in action.getModifiers():
                section = modifier.getSection()
                type = modifier.getType()
                itemType = modifier.getItemType()
                values = modifier.getValues(action)
                currentSection = self.__actionsCache[section][type]
                if itemType is not None:
                    currentSection = currentSection.setdefault(itemType, {})
                for k in values:
                    if k in currentSection:
                        currentSection[k] = mergeValues(currentSection[k], values[k])
                    else:
                        currentSection[k] = values[k]

        rareAchieves = set()
        invalidateTimeLeft = sys.maxint
        for q in self.getCurrentEvents().itervalues():
            dossierBonuses = q.getBonuses('dossier')
            if len(dossierBonuses):
                storage = self.__questsDossierBonuses[q.getID()]
                for bonus in dossierBonuses:
                    records = bonus.getRecords()
                    storage.update(records)
                    rareAchieves |= set((r for r in records if r[0] == ACHIEVEMENT_BLOCK.RARE))

            timeLeftInfo = q.getNearestActivityTimeLeft()
            if timeLeftInfo is not None:
                isAvailable, errorMsg = q.isAvailable()
                if not isAvailable:
                    if errorMsg in ('invalid_weekday', 'invalid_time_interval'):
                        invalidateTimeLeft = min(invalidateTimeLeft, timeLeftInfo[0])
                else:
                    intervalBeginTimeLeft, (intervalStart, intervalEnd) = timeLeftInfo
                    invalidateTimeLeft = min(invalidateTimeLeft, intervalBeginTimeLeft + intervalEnd - intervalStart)
            else:
                invalidateTimeLeft = min(invalidateTimeLeft, q.getFinishTimeLeft())

        g_rareAchievesCache.request(rareAchieves)
        for q in self.getFutureEvents().itervalues():
            timeLeftInfo = q.getNearestActivityTimeLeft()
            if timeLeftInfo is None:
                startTime = q.getStartTimeLeft()
            else:
                startTime = timeLeftInfo[0]
            invalidateTimeLeft = min(invalidateTimeLeft, startTime)

        if invalidateTimeLeft != sys.maxint:
            self.__loadInvalidateCallback(invalidateTimeLeft)
        self.__waitForSync = False
        self.onSyncCompleted()
        callback(True)
        from gui.shared import g_eventBus
        g_eventBus.handleEvent(events.LobbySimpleEvent(events.LobbySimpleEvent.EVENTS_UPDATED))
        return
Пример #12
0
    def __invalidateData(self, callback=lambda *args: None):
        self.__clearCache()
        self.__clearInvalidateCallback()
        self.__waitForSync = True
        self.onSyncStarted()
        self.__updateCommonQuests()
        for action in self.getActions().itervalues():
            for modifier in action.getModifiers():
                section = modifier.getSection()
                type = modifier.getType()
                itemType = modifier.getItemType()
                values = modifier.getValues(action)
                currentSection = self.__actionsCache[section][type]
                if itemType is not None:
                    currentSection = currentSection.setdefault(itemType, {})
                for k in values:
                    if k in currentSection:
                        currentSection[k] += values[k]
                    else:
                        currentSection[k] = values[k]

        rareAchieves = set()
        invalidateTimeLeft = sys.maxint
        for q in self.getCurrentEvents().itervalues():
            dossierBonuses = q.getBonuses('dossier')
            if dossierBonuses:
                storage = self.__questsDossierBonuses[q.getID()]
                for bonus in dossierBonuses:
                    records = bonus.getRecords()
                    storage.update(set(bonus.getRecords().keys()))
                    rareAchieves |= set((rId for r, rId in records.iteritems()
                                         if r[0] == ACHIEVEMENT_BLOCK.RARE))

            timeLeftInfo = q.getNearestActivityTimeLeft()
            if timeLeftInfo is not None:
                isAvailable, errorMsg = q.isAvailable()
                if not isAvailable:
                    if errorMsg in ('invalid_weekday',
                                    'invalid_time_interval'):
                        invalidateTimeLeft = min(invalidateTimeLeft,
                                                 timeLeftInfo[0])
                else:
                    intervalBeginTimeLeft, (intervalStart,
                                            intervalEnd) = timeLeftInfo
                    invalidateTimeLeft = min(
                        invalidateTimeLeft,
                        intervalBeginTimeLeft + intervalEnd - intervalStart)
            else:
                invalidateTimeLeft = min(invalidateTimeLeft,
                                         q.getFinishTimeLeft())

        g_rareAchievesCache.request(rareAchieves)
        for q in self.getFutureEvents().itervalues():
            timeLeftInfo = q.getNearestActivityTimeLeft()
            if timeLeftInfo is None:
                startTime = q.getStartTimeLeft()
            else:
                startTime = timeLeftInfo[0]
            invalidateTimeLeft = min(invalidateTimeLeft, startTime)

        if invalidateTimeLeft != sys.maxint:
            self.__loadInvalidateCallback(invalidateTimeLeft)
        self.__waitForSync = False
        self.__prefetcher.ask()
        self.__syncActionsWithQuests()
        self.__invalidateCompensations()
        self.onSyncCompleted()
        callback(True)
        from gui.shared import g_eventBus
        g_eventBus.handleEvent(
            events.LobbySimpleEvent(events.LobbySimpleEvent.EVENTS_UPDATED))
        return
 def request(self, data):
     dossier = g_itemsCache.items.getAccountDossier(data)
     if dossier is not None:
         g_rareAchievesCache.request(dossier.getRecord('rareAchievements'))
     return
 def request(self, data):
     dossier = g_itemsCache.items.getAccountDossier(data)
     if dossier is not None:
         g_rareAchievesCache.request(dossier.getRecord('rareAchievements'))
     return