def __setGoalsData(self):
     typeID = self.sessionProvider.arenaVisitor.type.getID()
     _, geometryID = ArenaType.parseTypeID(typeID)
     mapScenarios = self.mapsTrainingController.getConfig(
     )['scenarios'][geometryID]
     goals = mapScenarios[self.__playerTeam][self.__playerClass]['goals']
     text = backport.text(R.strings.maps_training.prebattle.targets(),
                          count=sum(goals.values()))
     self.as_updateS([{
         'vehClass': vehCls,
         'total': goals[vehCls]
     } for vehCls in VEHICLE_CLASSES_ORDER], text)
     player = BigWorld.player()
     if not player.userSeesWorld():
         g_playerEvents.onAvatarReady += self.__onAvatarReady
     else:
         self.__playSoundNotification()
    def _setGoals(self):
        if not isPlayerAvatar():
            return
        typeID = self.sessionProvider.arenaVisitor.type.getID()
        _, geometryID = ArenaType.parseTypeID(typeID)
        mapScenarios = self.mapsTrainingController.getConfig(
        )['scenarios'][geometryID]
        playerVehicle = self.sessionProvider.arenaVisitor.vehicles.getVehicleInfo(
            BigWorld.player().playerVehicleID)
        playerClass = vehicles.getVehicleClassFromVehicleType(
            playerVehicle['vehicleType'].type)
        playerTeam = playerVehicle['team']
        goals = mapScenarios[playerTeam][playerClass]['goals']
        sortedData = []
        for vehCls in VEHICLE_CLASSES_ORDER:
            goal = self.goalsByType[vehCls]
            goal['total'] = goals[vehCls]
            sortedData.append(goal)

        self.as_updateS(sortedData)
Ejemplo n.º 3
0
    def _populate(self):
        super(DemonstratorWindow, self)._populate()
        maps = dict(ctf=[], assault=[], domination=[], nations=[], ctf30x30=[], domination30x30=[])
        serverSettings = self.lobbyContext.getServerSettings()
        availableRandomMaps = serverSettings.getRandomMapsForDemonstrator()
        for arenaTypeID, arenaType in ArenaType.g_cache.iteritems():
            if arenaType.explicitRequestOnly:
                continue
            if arenaType.gameplayName not in maps:
                continue
            gameplayID, geometryID = ArenaType.parseTypeID(arenaTypeID)
            geometry = (geometryID, gameplayID)
            if any((geometry in divisionMaps for divisionMaps in availableRandomMaps.itervalues())):
                maps[arenaType.gameplayName].append({'id': arenaTypeID,
                 'name': arenaType.name,
                 'type': arenaType.gameplayName})

        sorting = lambda item: item['name']
        self.as_setDataS({'standard': sorted(maps['ctf'] + maps['ctf30x30'], key=sorting),
         'assault': sorted(maps['assault'], key=sorting),
         'encounter': sorted(maps['domination'] + maps['domination30x30'], key=sorting),
         'nations': sorted(maps['nations'], key=sorting)})