Exemple #1
0
 def onXvmCommand(self, proxy, id, cmd, *args):
     try:
         #debug("id=" + str(id) + " cmd=" + str(cmd) + " args=" + json.dumps(args))
         if (cmd not in NO_LOG_COMMANDS):
             debug("cmd=" + str(cmd) + " args=" + json.dumps(args))
         res = None
         if cmd == COMMAND_LOG:
             log(*args)
         elif cmd == COMMAND_PING:
             res = json.dumps(ping())
         elif cmd == COMMAND_GETMODS:
             res = self.getMods()
         elif cmd == COMMAND_GETSCREENSIZE:
             res = json.dumps(list(GUI.screenResolution()))
         elif cmd == COMMAND_GETGAMEREGION:
             res = region
         elif cmd == COMMAND_GETLANGUAGE:
             res = language
         elif cmd == COMMAND_LOADBATTLESTAT:
             getBattleStat(proxy, id, args)
         elif cmd == COMMAND_LOADUSERDATA:
             getUserData(proxy, *args)
         elif cmd == COMMAND_LOAD_SETTINGS:
             pass  # TODO
         elif cmd == COMMAND_SAVE_SETTINGS:
             pass  # TODO
         else:
             err("unknown command: " + str(cmd))
         proxy.movie.invoke(('xvm.respond', [id, res]))
     except Exception, ex:
         err(traceback.format_exc(ex))
Exemple #2
0
 def onXvmCommand(self, proxy, id, cmd, *args):
     try:
         #debug("id=" + str(id) + " cmd=" + str(cmd) + " args=" + json.dumps(args))
         if (cmd not in NO_LOG_COMMANDS):
             debug("cmd=" + str(cmd) + " args=" + json.dumps(args))
         res = None
         if cmd == COMMAND_LOG:
             log(*args)
         elif cmd == COMMAND_PING:
             ping(proxy)
         elif cmd == COMMAND_GETMODS:
             res = self.getMods()
         elif cmd == COMMAND_GETSCREENSIZE:
             res = json.dumps(list(GUI.screenResolution()))
         elif cmd == COMMAND_GETGAMEREGION:
             res = region
         elif cmd == COMMAND_GETLANGUAGE:
             res = language
         elif cmd == COMMAND_GETVEHICLEINFODATA:
             res = getVehicleInfoData()
         elif cmd == COMMAND_LOADBATTLESTAT:
             getBattleStat(proxy, args)
         elif cmd == COMMAND_LOADUSERDATA:
             getUserData(proxy, args)
         elif cmd == COMMAND_LOAD_SETTINGS:
             pass # TODO
         elif cmd == COMMAND_SAVE_SETTINGS:
             pass # TODO
         else:
             err("unknown command: " + str(cmd))
         proxy.movie.invoke(('xvm.respond', [id, res]))
     except Exception, ex:
         err(traceback.format_exc(ex))
Exemple #3
0
    def onXfwCommand(self, cmd, *args):
        try:
            if IS_DEVELOPMENT and cmd in _LOG_COMMANDS:
                debug("cmd=" + str(cmd) + " args=" + simplejson.dumps(args))

            if cmd == XVM_COMMAND.REQUEST_CONFIG:
                self.respondConfig()
                return (None, True)

            if cmd == XVM_COMMAND.GET_BATTLE_LEVEL:
                arena = getattr(BigWorld.player(), 'arena', None)
                if arena is not None:
                    return (arena.extraData.get('battleLevel', 0), True)
                return (None, True)

            if cmd == XVM_COMMAND.GET_BATTLE_TYPE:
                arena = getattr(BigWorld.player(), 'arena', None)
                if arena is not None:
                    return (arena.bonusType, True)
                return (None, True)

            if cmd == XVM_COMMAND.REQUEST_DOSSIER:
                dossier.requestDossier(args)
                return (None, True)

            if cmd == XVM_COMMAND.GET_SVC_SETTINGS:
                token.getToken()
                return (token.networkServicesSettings, True)

            if cmd == XVM_COMMAND.LOAD_SETTINGS:
                default = None if len(args) < 2 else args[1]
                return (userprefs.get(args[0], default), True)

            if cmd == XVM_COMMAND.LOAD_STAT_BATTLE:
                stats.getBattleStat(args)
                return (None, True)

            if cmd == XVM_COMMAND.LOAD_STAT_BATTLE_RESULTS:
                stats.getBattleResultsStat(args)
                return (None, True)

            if cmd == XVM_COMMAND.LOAD_STAT_USER:
                stats.getUserData(args)
                return (None, True)

            if cmd == XVM_COMMAND.OPEN_URL:
                if len(args[0]):
                    utils.openWebBrowser(args[0], False)
                return (None, True)

            if cmd == XVM_COMMAND.SAVE_SETTINGS:
                userprefs.set(args[0], args[1])
                return (None, True)

        except Exception, ex:
            err(traceback.format_exc())
            return (None, True)
Exemple #4
0
 def onXvmCommand(self, proxy, id, cmd, *args):
     try:
         #debug("id=" + str(id) + " cmd=" + str(cmd) + " args=" + json.dumps(args))
         if (cmd not in NO_LOG_COMMANDS):
             debug("cmd=" + str(cmd) + " args=" + json.dumps(args))
         res = None
         if cmd == COMMAND_LOG:
             log(*args)
         elif cmd == COMMAND_PING:
             #return
             ping(proxy)
         elif cmd == COMMAND_GETMODS:
             #return
             res = self.getMods()
         elif cmd == COMMAND_GETSCREENSIZE:
             #return
             res = json.dumps(list(GUI.screenResolution()))
         elif cmd == COMMAND_GETGAMEREGION:
             #return
             res = region
         elif cmd == COMMAND_GETLANGUAGE:
             #return
             res = language
         elif cmd == COMMAND_GETVEHICLEINFODATA:
             #return
             res = getVehicleInfoData()
         elif cmd == COMMAND_GETWN8EXPECTEDDATA:
             res = getWN8ExpectedData()
         elif cmd == COMMAND_GETXVMSTATTOKENDATA:
             res = json.dumps(getXvmStatTokenData())
         elif cmd == COMMAND_LOADBATTLESTAT:
             #return
             getBattleStat(proxy, args)
         elif cmd == COMMAND_LOADBATTLERESULTSSTAT:
             getBattleResultsStat(proxy, args)
         elif cmd == COMMAND_LOADUSERDATA:
             getUserData(proxy, args)
         elif cmd == COMMAND_GETDOSSIER:
             getDossier(proxy, args)
         elif cmd == COMMAND_OPEN_URL:
             if len(args[0]) and args[0].lower().startswith(
                     'http://www.modxvm.com'):
                 BigWorld.wg_openWebBrowser(args[0])
         elif cmd == COMMAND_LOAD_SETTINGS:
             pass  # TODO
         elif cmd == COMMAND_SAVE_SETTINGS:
             pass  # TODO
         elif cmd == COMMAND_TEST:
             runTest(args)
         else:
             err("unknown command: " + str(cmd))
         proxy.movie.invoke(('xvm.respond', [id, res]))
     except Exception, ex:
         err(traceback.format_exc())
Exemple #5
0
 def onXvmCommand(self, proxy, id, cmd, *args):
     try:
         #debug("id=" + str(id) + " cmd=" + str(cmd) + " args=" + json.dumps(args))
         if (cmd not in NO_LOG_COMMANDS):
             debug("cmd=" + str(cmd) + " args=" + json.dumps(args))
         res = None
         if cmd == COMMAND_LOG:
             log(*args)
         elif cmd == COMMAND_PING:
             #return
             ping(proxy)
         elif cmd == COMMAND_GETMODS:
             #return
             res = self.getMods()
         elif cmd == COMMAND_GETSCREENSIZE:
             #return
             res = json.dumps(list(GUI.screenResolution()))
         elif cmd == COMMAND_GETGAMEREGION:
             #return
             res = region
         elif cmd == COMMAND_GETLANGUAGE:
             #return
             res = language
         elif cmd == COMMAND_GETVEHICLEINFODATA:
             #return
             res = getVehicleInfoData()
         elif cmd == COMMAND_LOADBATTLESTAT:
             #return
             getBattleStat(proxy, args)
         elif cmd == COMMAND_LOADBATTLERESULTSSTAT:
             getBattleResultsStat(proxy, args)
         elif cmd == COMMAND_LOADUSERDATA:
             getUserData(proxy, args)
         elif cmd == COMMAND_GETDOSSIER:
             getDossier(proxy, args)
         elif cmd == COMMAND_LOAD_SETTINGS:
             pass  # TODO
         elif cmd == COMMAND_SAVE_SETTINGS:
             pass  # TODO
         elif cmd == COMMAND_TEST:
             runTest(args)
         else:
             err("unknown command: " + str(cmd))
         proxy.movie.invoke(('xvm.respond', [id, res]))
     except Exception, ex:
         err(traceback.format_exc(ex))
Exemple #6
0
    def onXfwCommand(self, cmd, *args):
        try:
            if IS_DEVELOPMENT and cmd in _LOG_COMMANDS:
                debug("cmd=" + str(cmd) + " args=" + simplejson.dumps(args))

            # common

            if cmd == XVM_COMMAND.REQUEST_CONFIG:
                self.respondConfig()
                return (None, True)

            if cmd == XVM_COMMAND.PYTHON_MACRO:
                return (python_macro.process_python_macro(args[0]), True)

            if cmd == XVM_COMMAND.GET_PLAYER_NAME:
                return (BigWorld.player().name, True)

            if cmd == XVM_COMMAND.GET_SVC_SETTINGS:
                return (config.networkServicesSettings.__dict__, True)

            if cmd == XVM_COMMAND.LOAD_SETTINGS:
                default = None if len(args) < 2 else args[1]
                return (userprefs.get(args[0], default), True)

            if cmd == XVM_COMMAND.SAVE_SETTINGS:
                userprefs.set(args[0], args[1])
                return (None, True)

            # battle

            if cmd == XVM_COMMAND.GET_CLAN_ICON:
                return (stats.getClanIcon(int(args[0])), True)

            # lobby

            if cmd == XVM_COMMAND.REQUEST_DOSSIER:
                dossier.requestDossier(args)
                return (None, True)

            # stat

            if cmd == XVM_COMMAND.LOAD_STAT_BATTLE:
                stats.getBattleStat(args, as_xfw_cmd)
                return (None, True)

            if cmd == XVM_COMMAND.LOAD_STAT_BATTLE_RESULTS:
                stats.getBattleResultsStat(args)
                return (None, True)

            if cmd == XVM_COMMAND.LOAD_STAT_USER:
                stats.getUserData(args)
                return (None, True)

            # profiler

            if cmd in (XVM_PROFILER_COMMAND.BEGIN, XVM_PROFILER_COMMAND.END):
                g_eventBus.handleEvent(events.HasCtxEvent(cmd, args[0]))
                return (None, True)

        except Exception, ex:
            err(traceback.format_exc())
            return (None, True)
Exemple #7
0
    def onXfwCommand(self, cmd, *args):
        try:
            if IS_DEVELOPMENT and cmd in _LOG_COMMANDS:
                debug("cmd=" + str(cmd) + " args=" + simplejson.dumps(args))

            # common

            if cmd == XVM_COMMAND.REQUEST_CONFIG:
                self.respondConfig()
                return (None, True)

            if cmd == XVM_COMMAND.PYTHON_MACRO:
                return (python_macro.process_python_macro(args[0]), True)

            if cmd == XVM_COMMAND.GET_PLAYER_ID:
                return (getCurrentAccountDBID(), True)

            if cmd == XVM_COMMAND.GET_PLAYER_NAME:
                return (avatar_getter.getPlayerName(), True)

            if cmd == XVM_COMMAND.GET_PLAYER_CLAN_ID:
                return (utils.getClanDBID(), True)

            if cmd == XVM_COMMAND.GET_PLAYER_CLAN_NAME:
                return (utils.getClanAbbrev(), True)

            if cmd == XVM_COMMAND.GET_PLAYER_DOSSIER_VALUE:
                return (dossier.getAccountDossierValue(args[0]), True)

            if cmd == XVM_COMMAND.GET_CURRENT_VEH_CD:
                return (g_currentVehicle.item.intCD if g_currentVehicle.item else 0, True)

            if cmd == XVM_COMMAND.GET_SVC_SETTINGS:
                return (config.networkServicesSettings.__dict__, True)

            if cmd == XVM_COMMAND.LOAD_SETTINGS:
                default = None if len(args) < 2 else args[1]
                return (userprefs.get(args[0], default), True)

            if cmd == XVM_COMMAND.SAVE_SETTINGS:
                userprefs.set(args[0], args[1])
                return (None, True)

            if cmd == XVM_COMMAND.IS_IN_BOOTCAMP:
                return (isInBootcamp(), True)

            # battle

            if cmd == XVM_COMMAND.GET_CLAN_ICON:
                return (stats.getClanIcon(int(args[0])), True)

            # lobby

            if cmd == XVM_COMMAND.REQUEST_DOSSIER:
                dossier.requestDossier(args)
                return (None, True)

            # stat

            if cmd == XVM_COMMAND.LOAD_STAT_BATTLE:
                stats.getBattleStat(args, as_xfw_cmd)
                return (None, True)

            if cmd == XVM_COMMAND.LOAD_STAT_BATTLE_RESULTS:
                stats.getBattleResultsStat(args)
                return (None, True)

            if cmd == XVM_COMMAND.LOAD_STAT_USER:
                stats.getUserData(args)
                return (None, True)

            # profiler

            if cmd in (XVM_PROFILER_COMMAND.BEGIN, XVM_PROFILER_COMMAND.END):
                g_eventBus.handleEvent(events.HasCtxEvent(cmd, args[0]))
                return (None, True)

        except Exception, ex:
            err(traceback.format_exc())
            return (None, True)
Exemple #8
0
    def onXfwCommand(self, cmd, *args):
        try:
            if IS_DEVELOPMENT and cmd in _LOG_COMMANDS:
                debug("cmd=" + str(cmd) + " args=" + simplejson.dumps(args))

            # common

            if cmd == XVM_COMMAND.REQUEST_CONFIG:
                self.respondConfig()
                return (None, True)

            if cmd == XVM_COMMAND.PYTHON_MACRO:
                return (python_macro.process_python_macro(args[0]), True)

            if cmd == XVM_COMMAND.GET_PLAYER_NAME:
                return (BigWorld.player().name, True)

            if cmd == XVM_COMMAND.GET_SVC_SETTINGS:
                return (config.networkServicesSettings.__dict__, True)

            if cmd == XVM_COMMAND.LOAD_SETTINGS:
                default = None if len(args) < 2 else args[1]
                return (userprefs.get(args[0], default), True)

            if cmd == XVM_COMMAND.SAVE_SETTINGS:
                userprefs.set(args[0], args[1])
                return (None, True)

            # battle

            if cmd == XVM_COMMAND.GET_CLAN_ICON:
                return (stats.getClanIcon(int(args[0])), True)

            # lobby

            if cmd == XVM_COMMAND.REQUEST_DOSSIER:
                dossier.requestDossier(args)
                return (None, True)

            # stat

            if cmd == XVM_COMMAND.LOAD_STAT_BATTLE:
                stats.getBattleStat(args, as_xfw_cmd)
                return (None, True)

            if cmd == XVM_COMMAND.LOAD_STAT_BATTLE_RESULTS:
                stats.getBattleResultsStat(args)
                return (None, True)

            if cmd == XVM_COMMAND.LOAD_STAT_USER:
                stats.getUserData(args)
                return (None, True)

            # profiler

            if cmd in (XVM_PROFILER_COMMAND.BEGIN, XVM_PROFILER_COMMAND.END):
                g_eventBus.handleEvent(events.HasCtxEvent(cmd, args[0]))
                return (None, True)

        except Exception, ex:
            err(traceback.format_exc())
            return (None, True)
Exemple #9
0
 def onXvmCommand(self, proxy, id, cmd, *args):
     try:
         #debug("id=" + str(id) + " cmd=" + str(cmd) + " args=" + json.dumps(args))
         if (cmd not in NO_LOG_COMMANDS):
             debug("cmd=" + str(cmd) + " args=" + json.dumps(args))
         res = None
         if cmd == COMMAND_LOG:
             log(*args)
         elif cmd == COMMAND_LOAD_FILE:
             fn = os.path.join(XVM_DIR, args[0])
             res = load_file(fn) if os.path.exists(fn) else None
         elif cmd == COMMAND_SET_CONFIG:
             log('setConfig')
             self.config_str = args[0]
             self.config = json.loads(self.config_str)
         elif cmd == COMMAND_GET_CONFIG:
             res = self.config_str
         elif cmd == COMMAND_PING:
             #return
             ping(proxy)
         elif cmd == COMMAND_GETMODS:
             #return
             res = self.getMods()
         elif cmd == COMMAND_GETSCREENSIZE:
             #return
             res = json.dumps(list(GUI.screenResolution()))
         elif cmd == COMMAND_GETGAMEREGION:
             #return
             res = region
         elif cmd == COMMAND_GETLANGUAGE:
             #return
             res = language
         elif cmd == COMMAND_GETVEHICLEINFODATA:
             #return
             res = getVehicleInfoData()
         elif cmd == COMMAND_GETWN8EXPECTEDDATA:
             res = getWN8ExpectedData()
         elif cmd == COMMAND_GETXVMSTATTOKENDATA:
             res = json.dumps(getXvmStatTokenData())
         elif cmd == COMMAND_LOADBATTLESTAT:
             getBattleStat(proxy, args)
         elif cmd == COMMAND_LOADBATTLERESULTSSTAT:
             getBattleResultsStat(proxy, args)
         elif cmd == COMMAND_LOADUSERDATA:
             getUserData(proxy, args)
         elif cmd == COMMAND_GETDOSSIER:
             getDossier(proxy, args)
         elif cmd == COMMAND_OPEN_URL:
             if len(args[0]) and args[0].lower().startswith('http://www.modxvm.com'):
                 utils.openWebBrowser(args[0], False)
         elif cmd == COMMAND_LOAD_SETTINGS:
             pass # TODO
         elif cmd == COMMAND_SAVE_SETTINGS:
             pass # TODO
         elif cmd == COMMAND_TEST:
             runTest(args)
         else:
             err("unknown command: " + str(cmd))
         proxy.movie.invoke(('xvm.respond', [id, res]))
     except Exception, ex:
         err(traceback.format_exc())