Example #1
0
    def initBattleSwf(self, flashObject):
        trace('initBattleSwf')
        try:
            self.battleFlashObject = flashObject

            # Save/restore arena data
            player = BigWorld.player()

            fileName = 'arenas_data/{0}'.format(player.arenaUniqueID)

            mcdata = minimap_circles.getMinimapCirclesData()
            vehId = player.vehicleTypeDescriptor.type.compactDescr
            if vehId and mcdata is not None and vehId == mcdata.get('vehId', None):
                # Normal battle start. Update data and save to userprefs cache
                userprefs.set(fileName, {
                    'ver': '1.0',
                    'minimap_circles': minimap_circles.getMinimapCirclesData(),
                })
            else:
                # Replay, training or restarted battle after crash. Try to restore data.
                arena_data = userprefs.get(fileName)
                if arena_data is None:
                    # Set default vehicle data if it is not available.in the cache.
                    minimap_circles.updateMinimapCirclesData(player.vehicleTypeDescriptor)
                else:
                    # Apply restored data.
                    minimap_circles.setMinimapCirclesData(arena_data['minimap_circles'])

        except Exception, ex:
            err(traceback.format_exc())
Example #2
0
 def updateTankParams(self):
     try:
         minimap_circles.updateCurrentVehicle()
         lobby = getLobbyApp()
         if lobby is not None:
             as_xfw_cmd(XVM_COMMAND.AS_UPDATE_CURRENT_VEHICLE, minimap_circles.getMinimapCirclesData())
     except Exception, ex:
         err(traceback.format_exc())
Example #3
0
 def updateTankParams(self):
     try:
         minimap_circles.updateCurrentVehicle()
         lobby = getLobbyApp()
         if lobby is not None:
             as_xfw_cmd(XVM_COMMAND.AS_UPDATE_CURRENT_VEHICLE,
                        minimap_circles.getMinimapCirclesData())
     except Exception, ex:
         err(traceback.format_exc())
Example #4
0
 def sendConfig(self, flashObject):
     #trace('sendConfig')
     if flashObject is None:
         return
     try:
         movie = flashObject.movie
         if movie is not None:
             arena = BigWorld.player().arena
             movie.invoke((AS2RESPOND.CONFIG, [
                 config.config_str,
                 config.lang_str,
                 arena.extraData.get('battleLevel', 0),
                 arena.bonusType,
                 'fallout' if arena_info.isEventBattle() else 'normal',
                 vehinfo.getVehicleInfoDataStr(),
                 simplejson.dumps(token.networkServicesSettings),
                 simplejson.dumps(minimap_circles.getMinimapCirclesData()),
                 IS_DEVELOPMENT,
             ]))
     except Exception, ex:
         err('sendConfig(): ' + traceback.format_exc())