Exemplo n.º 1
0
    def __onEventNotificationsChanged(self, diff):
        from gui.shared.utils.HangarSpace import g_hangarSpace
        isPremium = g_hangarSpace.isPremium
        hasChanged = False
        for notification in diff['removed']:
            if notification['type'] == _SERVER_CMD_CHANGE_HANGAR:
                if _EVENT_HANGAR_PATHS.has_key(False):
                    del _EVENT_HANGAR_PATHS[False]
                if not isPremium:
                    hasChanged = True
            elif notification['type'] == _SERVER_CMD_CHANGE_HANGAR_PREM:
                if _EVENT_HANGAR_PATHS.has_key(True):
                    del _EVENT_HANGAR_PATHS[True]
                if isPremium:
                    hasChanged = True

        for notification in diff['added']:
            if not notification['data']:
                continue
            if notification['type'] == _SERVER_CMD_CHANGE_HANGAR:
                _EVENT_HANGAR_PATHS[False] = notification['data']
                if not isPremium:
                    hasChanged = True
            elif notification['type'] == _SERVER_CMD_CHANGE_HANGAR_PREM:
                _EVENT_HANGAR_PATHS[True] = notification['data']
                if isPremium:
                    hasChanged = True

        if hasChanged and g_hangarSpace.inited:
            g_hangarSpace.refreshSpace(isPremium, True)
Exemplo n.º 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')
Exemplo n.º 3
0
    def __onEventNotificationsChanged(self, notificationsDiff):
        from gui.shared.utils.HangarSpace import g_hangarSpace
        isPremium = g_hangarSpace.isPremium
        hasChanged = False
        for notification in notificationsDiff['removed']:
            if notification['type'] == _SERVER_CMD_CHANGE_HANGAR:
                if _EVENT_HANGAR_PATHS.has_key(False):
                    del _EVENT_HANGAR_PATHS[False]
                if not isPremium:
                    hasChanged = True
            elif notification['type'] == _SERVER_CMD_CHANGE_HANGAR_PREM:
                if _EVENT_HANGAR_PATHS.has_key(True):
                    del _EVENT_HANGAR_PATHS[True]
                if isPremium:
                    hasChanged = True

        for notification in notificationsDiff['added']:
            if not notification.has_key('data') or notification['data'] == '':
                continue
            if notification['type'] == _SERVER_CMD_CHANGE_HANGAR:
                _EVENT_HANGAR_PATHS[False] = notification['data']
                if not isPremium:
                    hasChanged = True
            elif notification['type'] == _SERVER_CMD_CHANGE_HANGAR_PREM:
                _EVENT_HANGAR_PATHS[True] = notification['data']
                if isPremium:
                    hasChanged = True

        if hasChanged:
            g_hangarSpace.refreshSpace(isPremium, True)
Exemplo n.º 4
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')
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')
Exemplo n.º 6
0
 def setPath(self, path, isPremium = None):
     if path is not None and not path.startswith('spaces/'):
         path = 'spaces/' + path
     from gui.shared.utils.HangarSpace import g_hangarSpace
     if isPremium is None:
         isPremium = g_hangarSpace.isPremium
     if path is not None:
         _EVENT_HANGAR_PATHS[isPremium] = path
     elif _EVENT_HANGAR_PATHS.has_key(isPremium):
         del _EVENT_HANGAR_PATHS[isPremium]
     g_hangarSpace.refreshSpace(g_hangarSpace.isPremium, True)
Exemplo n.º 7
0
 def setPath(self, path, isPremium=None):
     if path is not None and not path.startswith('spaces/'):
         path = 'spaces/' + path
     from gui.shared.utils.HangarSpace import g_hangarSpace
     if isPremium is None:
         isPremium = g_hangarSpace.isPremium
     if path is not None:
         _EVENT_HANGAR_PATHS[isPremium] = path
     elif _EVENT_HANGAR_PATHS.has_key(isPremium):
         del _EVENT_HANGAR_PATHS[isPremium]
     g_hangarSpace.refreshSpace(g_hangarSpace.isPremium, True)
     return
Exemplo n.º 8
0
 def setPath(self, path, isPremium = None):
     if path is not None and not path.startswith('spaces/'):
         path = 'spaces/' + path
     from gui.shared.utils.HangarSpace import g_hangarSpace
     if isPremium is None:
         isPremium = g_hangarSpace.isPremium
     if path is not None:
         _EVENT_HANGAR_PATHS[isPremium] = path
     elif _EVENT_HANGAR_PATHS.has_key(isPremium):
         del _EVENT_HANGAR_PATHS[isPremium]
     readHangarSettings('igrPremHangarPath' + ('CN' if constants.IS_CHINA else ''))
     g_hangarSpace.refreshSpace(g_hangarSpace.isPremium, True)
     return
Exemplo n.º 9
0
    def __onEventNotificationsChanged(self, diff):
        from gui.shared.utils.HangarSpace import g_hangarSpace
        isPremium = g_hangarSpace.isPremium
        hasChanged = False
        for notification in diff['removed']:
            if notification['type'] == _SERVER_CMD_CHANGE_HANGAR:
                if _EVENT_HANGAR_PATHS.has_key(False):
                    del _EVENT_HANGAR_PATHS[False]
                if not isPremium:
                    hasChanged = True
            elif notification['type'] == _SERVER_CMD_CHANGE_HANGAR_PREM:
                if _EVENT_HANGAR_PATHS.has_key(True):
                    del _EVENT_HANGAR_PATHS[True]
                if isPremium:
                    hasChanged = True

        for notification in diff['added']:
            if not notification['data']:
                continue
            visibilityMask = 4294967295L
            path = None
            try:
                data = json.loads(notification['data'])
                path = data['hangar']
                visibilityMask = int(data.get('visibilityMask',
                                              visibilityMask),
                                     base=16)
            except:
                path = notification['data']

            if notification['type'] == _SERVER_CMD_CHANGE_HANGAR:
                _EVENT_HANGAR_PATHS[False] = path
                _EVENT_HANGAR_VISIBILITY_MASK[False] = visibilityMask
                if not isPremium:
                    hasChanged = True
            elif notification['type'] == _SERVER_CMD_CHANGE_HANGAR_PREM:
                _EVENT_HANGAR_PATHS[True] = path
                _EVENT_HANGAR_VISIBILITY_MASK[True] = visibilityMask
                if isPremium:
                    hasChanged = True

        if hasChanged and g_hangarSpace.inited:
            g_hangarSpace.refreshSpace(isPremium, True)
        return
Exemplo n.º 10
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')
Exemplo n.º 11
0
    def __onEventNotificationsChanged(self, diff):
        from gui.shared.utils.HangarSpace import g_hangarSpace
        isPremium = g_hangarSpace.isPremium
        hasChanged = False
        for notification in diff['removed']:
            if notification['type'] == _SERVER_CMD_CHANGE_HANGAR:
                if _EVENT_HANGAR_PATHS.has_key(False):
                    del _EVENT_HANGAR_PATHS[False]
                if not isPremium:
                    hasChanged = True
            elif notification['type'] == _SERVER_CMD_CHANGE_HANGAR_PREM:
                if _EVENT_HANGAR_PATHS.has_key(True):
                    del _EVENT_HANGAR_PATHS[True]
                if isPremium:
                    hasChanged = True

        for notification in diff['added']:
            if not notification['data']:
                continue
            visibilityMask = 4294967295L
            path = None
            try:
                data = json.loads(notification['data'])
                path = data['hangar']
                visibilityMask = int(data.get('visibilityMask', visibilityMask), base=16)
            except:
                path = notification['data']

            if notification['type'] == _SERVER_CMD_CHANGE_HANGAR:
                _EVENT_HANGAR_PATHS[False] = path
                _EVENT_HANGAR_VISIBILITY_MASK[False] = visibilityMask
                if not isPremium:
                    hasChanged = True
            elif notification['type'] == _SERVER_CMD_CHANGE_HANGAR_PREM:
                _EVENT_HANGAR_PATHS[True] = path
                _EVENT_HANGAR_VISIBILITY_MASK[True] = visibilityMask
                if isPremium:
                    hasChanged = True

        if hasChanged and g_hangarSpace.inited:
            g_hangarSpace.refreshSpace(isPremium, True)
        return
Exemplo n.º 12
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")
Exemplo n.º 13
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")
    def __onEventNotificationsChanged(self, diff):
        from gui.shared.utils.HangarSpace import g_hangarSpace
        isPremium = g_hangarSpace.isPremium
        hasChanged = False
        for notification in diff['removed']:
            if notification['type'] == _SERVER_CMD_CHANGE_HANGAR:
                if _EVENT_HANGAR_PATHS.has_key(False):
                    del _EVENT_HANGAR_PATHS[False]
                if not isPremium:
                    hasChanged = True
            if notification['type'] == _SERVER_CMD_CHANGE_HANGAR_PREM:
                if _EVENT_HANGAR_PATHS.has_key(True):
                    del _EVENT_HANGAR_PATHS[True]
                if isPremium:
                    hasChanged = True

        for notification in diff['added']:
            if not notification['data']:
                continue
            path = None
            try:
                data = json.loads(notification['data'])
                path = data['hangar']
            except Exception:
                path = notification['data']

            if notification['type'] == _SERVER_CMD_CHANGE_HANGAR:
                _EVENT_HANGAR_PATHS[False] = path
                if not isPremium:
                    hasChanged = True
            if notification['type'] == _SERVER_CMD_CHANGE_HANGAR_PREM:
                _EVENT_HANGAR_PATHS[True] = path
                if isPremium:
                    hasChanged = True

        if hasChanged and g_hangarSpace.inited:
            g_hangarSpace.refreshSpace(isPremium, True)
        return
Exemplo n.º 15
0
 def setAccountsAttrs(self, attrs, premiumExpiryTime = 0):
     if not GUI_SETTINGS.goldTransfer and attrs & constants.ACCOUNT_ATTR.TRADING:
         attrs ^= constants.ACCOUNT_ATTR.TRADING
     isPremiumAccount = account_helpers.isPremiumAccount(attrs)
     if g_hangarSpace.inited:
         g_hangarSpace.refreshSpace(isPremiumAccount)
     self.as_setProfileTypeS(makeHtmlString('html_templates:lobby/header', 'premium-account-label' if isPremiumAccount else 'base-account-label'))
     if not (isPremiumAccount and premiumExpiryTime > 0):
         raise AssertionError
         lExpiryTime = makeLocalServerTime(premiumExpiryTime)
         delta = datetime.datetime.utcfromtimestamp(lExpiryTime) - datetime.datetime.utcnow()
         if delta.days > 0:
             timeLeft = delta.days + 1 if delta.seconds > 0 else delta.days
             timeMetric = makeString('#menu:header/account/premium/days')
         elif not delta.days:
             import math
             timeLeft = math.ceil(delta.seconds / 3600.0)
             timeMetric = makeString('#menu:header/account/premium/hours')
         else:
             LOG_ERROR('timedelta with negative days', premiumExpiryTime, delta)
             return
         self.as_setPremiumParamsS(makeHtmlString('html_templates:lobby/header', 'premium-time-label', {'timeMetric': timeMetric,
          'timeLeft': timeLeft}), makeString('#menu:common/premiumContinue'), delta.days > 360)
     self.as_premiumResponseS(isPremiumAccount)
 def setPremium(self, isPremium):
     from gui.shared.utils.HangarSpace import g_hangarSpace
     g_hangarSpace.refreshSpace(isPremium, True)
Exemplo n.º 17
0
 def setPremium(self, isPremium):
     from gui.shared.utils.HangarSpace import g_hangarSpace
     g_hangarSpace.refreshSpace(isPremium, True)