コード例 #1
0
ファイル: battleloading.py プロジェクト: krzcho/WOTDecompiled
 def __addArenaExtraData(self, arenaDP):
     arena = getClientArena()
     if arena:
         extraData = arena.extraData or {}
         descExtra = getPrebattleFullDescription(extraData)
         arenaTypeID = getArenaTypeID()
         arenaSubType = getArenaSubTypeName(arenaTypeID)
         team = arenaDP.getNumberOfTeam()
         enemy = arenaDP.getNumberOfTeam(True)
         hasBase = isBaseExists(arenaTypeID, team)
         opponents = extraData.get('opponents', {})
         team1 = opponents.get(str(team), {}).get('name', '#menu:loading/team1')
         team2 = opponents.get(str(enemy), {}).get('name', '#menu:loading/team2')
         self.as_setTeamsS(team1, team2)
         if arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES:
             self.as_setWinTextS(i18n.makeString('#arenas:type/fallout/description'))
         else:
             self.as_setWinTextS(getBattleSubTypeWinText(arenaTypeID, 1 if hasBase else 2))
         if descExtra:
             self.as_setBattleTypeNameS(descExtra)
             self.as_setBattleTypeFrameNumS(arena.guiType + 1)
         elif arena.guiType in [constants.ARENA_GUI_TYPE.RANDOM, constants.ARENA_GUI_TYPE.TRAINING]:
             self.as_setBattleTypeNameS('#arenas:type/%s/name' % arenaSubType)
             self.as_setBattleTypeFrameNameS(getNecessaryArenaFrameName(arenaSubType, hasBase))
             if arena.guiType == constants.ARENA_GUI_TYPE.TRAINING and self.__logArenaUniID == False:
                 self.__logArenaUniID = True
                 from time import strftime, localtime
                 from debug_utils import LOG_NOTE
                 LOG_NOTE('arenaUniqueID: %d | timestamp: %s' % (arena.arenaUniqueID, strftime('%d.%m.%Y %H:%M:%S', localtime())))
         else:
             self.as_setBattleTypeNameS('#menu:loading/battleTypes/%d' % arena.guiType)
             if arena.guiType in constants.ARENA_GUI_TYPE_LABEL.LABELS:
                 self.as_setBattleTypeFrameNameS(constants.ARENA_GUI_TYPE_LABEL.LABELS[arena.guiType])
             else:
                 self.as_setBattleTypeFrameNumS(arena.guiType + 1)
コード例 #2
0
 def getData(self):
     arena = getattr(BigWorld.player(), 'arena', None)
     if arena:
         self.as_setMapNameS(arena.arenaType.name)
         self.as_setMapBGS(BattleLoading.MAP_BG_SOURCE % arena.arenaType.geometryName)
         descExtra = getPrebattleFullDescription(arena.extraData or {})
         arenaSubType = getArenaSubTypeName(BigWorld.player().arenaTypeID)
         if descExtra:
             self.as_setBattleTypeNameS(descExtra)
             self.as_setBattleTypeFrameNumS(arena.guiType + 1)
             self.__needArenaTypeUpdate = False
         elif arena.guiType == constants.ARENA_GUI_TYPE.RANDOM:
             self.as_setBattleTypeNameS('#arenas:type/%s/name' % arenaSubType)
             if arenaSubType != 'assault':
                 self.as_setBattleTypeFrameNameS(arenaSubType)
                 self.__needArenaTypeUpdate = False
         else:
             self.__needArenaTypeUpdate = False
             self.as_setBattleTypeNameS('#menu:loading/battleTypes/%d' % arena.guiType)
             self.as_setBattleTypeFrameNumS(arena.guiType + 1)
             if arena.guiType == constants.ARENA_GUI_TYPE.TRAINING and self.__logArenaUniID == False:
                 self.__logArenaUniID = True
                 from time import strftime, localtime
                 from debug_utils import LOG_NOTE
                 LOG_NOTE('arenaUniqueID: %d | timestamp: %s' % (arena.arenaUniqueID, strftime('%d.%m.%Y %H:%M:%S', localtime())))
     self.as_setTipS(tips.getTip())
     self.__updatePlayers()
     return
コード例 #3
0
ファイル: battle.py プロジェクト: webiumsk/WOT0.9.10
 def __populateData(self, isMutlipleTeams = False):
     arena = avatar_getter.getArena()
     arenaDP = g_sessionProvider.getArenaDP()
     arenaData = ['',
      0,
      '',
      '',
      '']
     if arena:
         arenaData = [toUpper(arena.arenaType.name)]
         descExtra = getPrebattleFullDescription(arena.extraData or {})
         arenaSubType = getArenaSubTypeName(BigWorld.player().arenaTypeID)
         if descExtra:
             arenaData.extend([arena.guiType + 1, descExtra])
         elif arena.guiType in [constants.ARENA_GUI_TYPE.RANDOM, constants.ARENA_GUI_TYPE.TRAINING]:
             arenaTypeName = '#arenas:type/%s/name' % arenaSubType
             arenaData.extend([getNecessaryArenaFrameName(arenaSubType, isBaseExists(BigWorld.player().arenaTypeID, BigWorld.player().team)), arenaTypeName])
         elif arena.guiType in constants.ARENA_GUI_TYPE.RANGE:
             arenaData.append(constants.ARENA_GUI_TYPE_LABEL.LABELS[arena.guiType])
             if arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES and hasResourcePoints():
                 arenaData.append(i18n.makeString(MENU.LOADING_BATTLETYPES_RESOURCEPOINTS_UPPER))
             elif arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES and isMutlipleTeams:
                 arenaData.append(i18n.makeString(MENU.LOADING_BATTLETYPES_MIX_UPPER))
             else:
                 arenaData.append('#menu:loading/battleTypes/%d' % arena.guiType)
         else:
             arenaData.extend([arena.guiType + 1, '#menu:loading/battleTypes/%d' % arena.guiType])
         myTeamNumber = arenaDP.getNumberOfTeam()
         getTeamName = g_sessionProvider.getCtx().getTeamName
         arenaData.extend([getTeamName(myTeamNumber), getTeamName(arenaDP.getNumberOfTeam(enemy=True))])
         teamHasBase = 1 if isBaseExists(BigWorld.player().arenaTypeID, myTeamNumber) else 2
         if not isEventBattle():
             typeEvent = 'normal'
             winText = getBattleSubTypeWinText(BigWorld.player().arenaTypeID, teamHasBase)
         else:
             typeEvent = 'fallout'
             if getIsMultiteam():
                 winText = i18n.makeString(ARENAS.TYPE_FALLOUTMUTLITEAM_DESCRIPTION)
             else:
                 winText = i18n.makeString('#arenas:type/%s/description' % arenaSubType)
         arenaData.append(winText)
         arenaData.append(typeEvent)
         vehInfo = arenaDP.getVehicleInfo(arenaDP.getPlayerVehicleID())
         pqTipData = [None] * 3
         pQuests = vehInfo.player.getPotapovQuests()
         serverSettings = g_lobbyContext.getServerSettings()
         isPQEnabled = serverSettings is not None and serverSettings.isPotapovQuestEnabled()
         if isPQEnabled and (arena.guiType == constants.ARENA_GUI_TYPE.RANDOM or arena.guiType == constants.ARENA_GUI_TYPE.TRAINING and constants.IS_DEVELOPMENT):
             if len(pQuests):
                 quest = pQuests[0]
                 pqTipData = [quest.getUserName(), quest.getUserMainCondition(), quest.getUserAddCondition()]
             else:
                 pqTipData = [i18n.makeString('#ingame_gui:potapovQuests/tip'), None, None]
         arenaData.extend(pqTipData)
         arenaData.extend([getArenaIcon(_SMALL_MAP_SOURCE)])
     self.__callEx('arenaData', arenaData)
     return
コード例 #4
0
 def onLoaded(self):
     arena = getattr(BigWorld.player(), 'arena', None)
     if arena:
         if arena.guiType == constants.ARENA_GUI_TYPE.RANDOM:
             arenaSubType = getArenaSubTypeName(BigWorld.player().arenaTypeID)
             battleType = '#arenas:type/%s/name' % arenaSubType
         else:
             battleType = '#menu:loading/battleTypes/%d' % arena.guiType
         self.call('logitech.setMap', [arena.arenaType.name, battleType, self._MAP_SOURCE % arena.arenaType.geometryName])
コード例 #5
0
 def __populateData(self, isMutlipleTeams = False):
     arena = avatar_getter.getArena()
     arenaDP = g_sessionProvider.getArenaDP()
     arenaData = ['',
      0,
      '',
      '',
      '']
     if arena:
         arenaData = [toUpper(arena.arenaType.name)]
         descExtra = getPrebattleFullDescription(arena.extraData or {})
         arenaSubType = getArenaSubTypeName(BigWorld.player().arenaTypeID)
         if descExtra:
             arenaData.extend([arena.guiType + 1, descExtra])
         elif arena.guiType in [constants.ARENA_GUI_TYPE.RANDOM, constants.ARENA_GUI_TYPE.TRAINING]:
             arenaTypeName = '#arenas:type/%s/name' % arenaSubType
             arenaData.extend([getNecessaryArenaFrameName(arenaSubType, isBaseExists(BigWorld.player().arenaTypeID, BigWorld.player().team)), arenaTypeName])
         elif arena.guiType in constants.ARENA_GUI_TYPE.RANGE:
             arenaData.append(constants.ARENA_GUI_TYPE_LABEL.LABELS[arena.guiType])
             if arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES and hasResourcePoints():
                 arenaData.append(i18n.makeString(MENU.LOADING_BATTLETYPES_RESOURCEPOINTS_UPPER))
             elif arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES and isMutlipleTeams:
                 arenaData.append(i18n.makeString(MENU.LOADING_BATTLETYPES_MIX_UPPER))
             else:
                 arenaData.append('#menu:loading/battleTypes/%d' % arena.guiType)
         else:
             arenaData.extend([arena.guiType + 1, '#menu:loading/battleTypes/%d' % arena.guiType])
         myTeamNumber = arenaDP.getNumberOfTeam()
         getTeamName = g_sessionProvider.getCtx().getTeamName
         arenaData.extend([getTeamName(myTeamNumber), getTeamName(arenaDP.getNumberOfTeam(enemy=True))])
         teamHasBase = 1 if isBaseExists(BigWorld.player().arenaTypeID, myTeamNumber) else 2
         if not isEventBattle():
             typeEvent = 'normal'
             winText = getBattleSubTypeWinText(BigWorld.player().arenaTypeID, teamHasBase)
         else:
             typeEvent = 'fallout'
             if getIsMultiteam():
                 winText = i18n.makeString(ARENAS.TYPE_FALLOUTMUTLITEAM_DESCRIPTION)
             else:
                 winText = i18n.makeString('#arenas:type/%s/description' % arenaSubType)
         arenaData.append(winText)
         arenaData.append(typeEvent)
         vehInfo = arenaDP.getVehicleInfo(arenaDP.getPlayerVehicleID())
         pqTipData = [None] * 3
         pQuests = vehInfo.player.getPotapovQuests()
         serverSettings = g_lobbyContext.getServerSettings()
         isPQEnabled = serverSettings is not None and serverSettings.isPotapovQuestEnabled()
         if isPQEnabled and (arena.guiType == constants.ARENA_GUI_TYPE.RANDOM or arena.guiType == constants.ARENA_GUI_TYPE.TRAINING and constants.IS_DEVELOPMENT):
             if len(pQuests):
                 quest = pQuests[0]
                 pqTipData = [quest.getUserName(), quest.getUserMainCondition(), quest.getUserAddCondition()]
             else:
                 pqTipData = [i18n.makeString('#ingame_gui:potapovQuests/tip'), None, None]
         arenaData.extend(pqTipData)
         arenaData.extend([getArenaIcon(_SMALL_MAP_SOURCE)])
     self.__callEx('arenaData', arenaData)
コード例 #6
0
 def _addArenaExtraData(self, arenaDP):
     arena = getClientArena()
     if arena:
         arenaType = arena.arenaType
         extraData = arena.extraData or {}
         descExtra = getPrebattleFullDescription(extraData)
         arenaTypeID = getArenaTypeID()
         arenaSubType = getArenaSubTypeName(arenaTypeID)
         team = arenaDP.getNumberOfTeam()
         enemy = arenaDP.getNumberOfTeam(True)
         hasBase = isBaseExists(arenaTypeID, team)
         allyTeamName, enemyTeamName = self._battleCtx.getTeamName(
             team), self._battleCtx.getTeamName(enemy)
         if arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES:
             winText = i18n.makeString('#arenas:type/%s/description' %
                                       arenaSubType)
         else:
             winText = getBattleSubTypeWinText(arenaTypeID,
                                               1 if hasBase else 2)
         if descExtra:
             battleTypeLocaleStr = descExtra
             if arena.guiType != constants.ARENA_GUI_TYPE.UNKNOWN and arena.guiType in constants.ARENA_GUI_TYPE_LABEL.LABELS:
                 battleTypeFrameLabel = constants.ARENA_GUI_TYPE_LABEL.LABELS[
                     arena.guiType]
             else:
                 battleTypeFrameLabel = 'neutral'
         elif arena.guiType in [
                 constants.ARENA_GUI_TYPE.RANDOM,
                 constants.ARENA_GUI_TYPE.TRAINING
         ]:
             battleTypeLocaleStr = '#arenas:type/%s/name' % arenaSubType
             battleTypeFrameLabel = getNecessaryArenaFrameName(
                 arenaSubType, hasBase)
         elif arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES and hasResourcePoints(
         ):
             battleTypeFrameLabel = 'resourcePoints'
             battleTypeLocaleStr = MENU.LOADING_BATTLETYPES_RESOURCEPOINTS
         else:
             battleTypeLocaleStr = '#menu:loading/battleTypes/%d' % arena.guiType
             if arena.guiType != constants.ARENA_GUI_TYPE.UNKNOWN and arena.guiType in constants.ARENA_GUI_TYPE_LABEL.LABELS:
                 battleTypeFrameLabel = constants.ARENA_GUI_TYPE_LABEL.LABELS[
                     arena.guiType]
             else:
                 battleTypeFrameLabel = 'neutral'
         arenaInfoData = {
             'mapName': arenaType.name,
             'winText': winText,
             'battleTypeLocaleStr': battleTypeLocaleStr,
             'battleTypeFrameLabel': battleTypeFrameLabel,
             'allyTeamName': allyTeamName,
             'enemyTeamName': enemyTeamName
         }
         self._setArenaInfo(arenaInfoData)
コード例 #7
0
 def setUI(self, ui):
     if not ui:
         return
     self.__ui = weakref.proxy(ui)
     typeID = arena_info.getArenaTypeID()
     if typeID and getArenaSubTypeName(typeID) not in _ENEMY_OFFSET_DISABLED_BY_GAMEPLAY:
         self.__ui.setOffsetForEnemyPoints()
     playerTeam = self.__battleCtx.getArenaDP().getNumberOfTeam()
     for clientID, (points, stopped) in self.__points.iteritems():
         if clientID in self.__captured:
             self.__ui.addCapturedTeamBase(clientID, playerTeam)
         elif points:
             self.__ui.addCapturingTeamBase(clientID, playerTeam, points, self._getProgressRate(), stopped)
コード例 #8
0
 def _setWinCondition(self):
     from gui.battle_control import g_sessionProvider
     arenaSubType = getArenaSubTypeName(BigWorld.player().arenaTypeID)
     arenaDP = g_sessionProvider.getArenaDP()
     if self._preBattleTimerUI is not None:
         if not arena_info.isFalloutBattle():
             winText = getBattleSubTypeWinText(BigWorld.player().arenaTypeID, arenaDP.getNumberOfTeam())
         elif arena_info.isFalloutMultiTeam():
             winText = i18n.makeString(ARENAS.TYPE_FALLOUTMUTLITEAM_DESCRIPTION)
         else:
             winText = i18n.makeString('#arenas:type/%s/description' % arenaSubType)
         self._preBattleTimerUI.setWinConditionText(winText)
     return
コード例 #9
0
 def onLoaded(self):
     arena = getattr(BigWorld.player(), 'arena', None)
     if arena:
         if arena.guiType == constants.ARENA_GUI_TYPE.RANDOM:
             arenaSubType = getArenaSubTypeName(
                 BigWorld.player().arenaTypeID)
             battleType = '#arenas:type/%s/name' % arenaSubType
         else:
             battleType = '#menu:loading/battleTypes/%d' % arena.guiType
         self.call('logitech.setMap', [
             arena.arenaType.name, battleType,
             self._MAP_SOURCE % arena.arenaType.geometryName
         ])
コード例 #10
0
 def setUI(self, ui):
     if not ui:
         return
     self.__ui = weakref.proxy(ui)
     typeID = arena_info.getArenaTypeID()
     if typeID and getArenaSubTypeName(typeID) not in _ENEMY_OFFSET_DISABLED_BY_GAMEPLAY:
         self.__ui.setOffsetForEnemyPoints()
     playerTeam = self.__battleCtx.getArenaDP().getNumberOfTeam()
     for clientID, (points, stopped) in self.__points.iteritems():
         if clientID in self.__captured:
             self.__ui.addCapturedTeamBase(clientID, playerTeam)
         elif points:
             self.__ui.addCapturingTeamBase(clientID, playerTeam, points, self._getProgressRate(), stopped)
コード例 #11
0
 def setViewComponents(self, panel):
     """
     Sets view component.
     :param panel: instance of view component.
     """
     if not panel:
         return
     self.__ui = panel
     typeID = arena_info.getArenaTypeID()
     if typeID and getArenaSubTypeName(typeID) not in _ENEMY_OFFSET_DISABLED_BY_GAMEPLAY:
         self.__ui.setOffsetForEnemyPoints()
     playerTeam = self.__battleCtx.getArenaDP().getNumberOfTeam()
     for clientID, (points, timeLeft, invadersCnt, stopped) in self.__points.iteritems():
         if clientID in self.__captured:
             self.__ui.addCapturedTeamBase(clientID, playerTeam, timeLeft, invadersCnt)
         elif points:
             self.__ui.addCapturingTeamBase(clientID, playerTeam, points, self._getProgressRate(), timeLeft, invadersCnt, stopped)
コード例 #12
0
ファイル: battle.py プロジェクト: webiumsk/WOT0.10.0
 def __populateData(self, isMutlipleTeams = False):
     arena = avatar_getter.getArena()
     arenaDP = g_sessionProvider.getArenaDP()
     arenaData = ['',
      0,
      '',
      '',
      '']
     if arena:
         arenaData = [toUpper(arena.arenaType.name)]
         descExtra = getPrebattleFullDescription(arena.extraData or {})
         arenaSubType = getArenaSubTypeName(BigWorld.player().arenaTypeID)
         if descExtra:
             arenaData.extend([arena.guiType + 1, descExtra])
         elif arena.guiType in [constants.ARENA_GUI_TYPE.RANDOM, constants.ARENA_GUI_TYPE.TRAINING]:
             arenaTypeName = '#arenas:type/%s/name' % arenaSubType
             arenaData.extend([getNecessaryArenaFrameName(arenaSubType, isBaseExists(BigWorld.player().arenaTypeID, BigWorld.player().team)), arenaTypeName])
         elif arena.guiType in constants.ARENA_GUI_TYPE.RANGE:
             arenaData.append(constants.ARENA_GUI_TYPE_LABEL.LABELS[arena.guiType])
             if arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES and hasResourcePoints():
                 arenaData.append(i18n.makeString(MENU.LOADING_BATTLETYPES_RESOURCEPOINTS_UPPER))
             elif arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES and isMutlipleTeams:
                 arenaData.append(i18n.makeString(MENU.LOADING_BATTLETYPES_MIX_UPPER))
             else:
                 arenaData.append('#menu:loading/battleTypes/%d' % arena.guiType)
         else:
             arenaData.extend([arena.guiType + 1, '#menu:loading/battleTypes/%d' % arena.guiType])
         myTeamNumber = arenaDP.getNumberOfTeam()
         getTeamName = g_sessionProvider.getCtx().getTeamName
         arenaData.extend([getTeamName(myTeamNumber), getTeamName(arenaDP.getNumberOfTeam(enemy=True))])
         teamHasBase = 1 if isBaseExists(BigWorld.player().arenaTypeID, myTeamNumber) else 2
         if not isEventBattle():
             typeEvent = 'normal'
             winText = getBattleSubTypeWinText(BigWorld.player().arenaTypeID, teamHasBase)
         else:
             typeEvent = 'fallout'
             if getIsMultiteam():
                 winText = i18n.makeString(ARENAS.TYPE_FALLOUTMUTLITEAM_DESCRIPTION)
             else:
                 winText = i18n.makeString('#arenas:type/%s/description' % arenaSubType)
         arenaData.append(winText)
         arenaData.append(typeEvent)
         arenaData.extend(_getQuestsTipData(arena, arenaDP))
         arenaData.extend([getArenaIcon(_SMALL_MAP_SOURCE)])
     self.__callEx('arenaData', arenaData)
コード例 #13
0
ファイル: battle_loading.py プロジェクト: webiumsk/WOT0.9.10
 def _addArenaExtraData(self, arenaDP):
     arena = getClientArena()
     if arena:
         arenaType = arena.arenaType
         extraData = arena.extraData or {}
         descExtra = getPrebattleFullDescription(extraData)
         arenaTypeID = getArenaTypeID()
         arenaSubType = getArenaSubTypeName(arenaTypeID)
         team = arenaDP.getNumberOfTeam()
         enemy = arenaDP.getNumberOfTeam(True)
         hasBase = isBaseExists(arenaTypeID, team)
         allyTeamName, enemyTeamName = self._battleCtx.getTeamName(team), self._battleCtx.getTeamName(enemy)
         if arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES:
             winText = i18n.makeString('#arenas:type/%s/description' % arenaSubType)
         else:
             winText = getBattleSubTypeWinText(arenaTypeID, 1 if hasBase else 2)
         if descExtra:
             battleTypeLocaleStr = descExtra
             if arena.guiType != constants.ARENA_GUI_TYPE.UNKNOWN and arena.guiType in constants.ARENA_GUI_TYPE_LABEL.LABELS:
                 battleTypeFrameLabel = constants.ARENA_GUI_TYPE_LABEL.LABELS[arena.guiType]
             else:
                 battleTypeFrameLabel = 'neutral'
         elif arena.guiType in [constants.ARENA_GUI_TYPE.RANDOM, constants.ARENA_GUI_TYPE.TRAINING]:
             battleTypeLocaleStr = '#arenas:type/%s/name' % arenaSubType
             battleTypeFrameLabel = getNecessaryArenaFrameName(arenaSubType, hasBase)
         elif arena.guiType == constants.ARENA_GUI_TYPE.EVENT_BATTLES and hasResourcePoints():
             battleTypeFrameLabel = 'resourcePoints'
             battleTypeLocaleStr = MENU.LOADING_BATTLETYPES_RESOURCEPOINTS
         else:
             battleTypeLocaleStr = '#menu:loading/battleTypes/%d' % arena.guiType
             if arena.guiType != constants.ARENA_GUI_TYPE.UNKNOWN and arena.guiType in constants.ARENA_GUI_TYPE_LABEL.LABELS:
                 battleTypeFrameLabel = constants.ARENA_GUI_TYPE_LABEL.LABELS[arena.guiType]
             else:
                 battleTypeFrameLabel = 'neutral'
         arenaInfoData = {'mapName': arenaType.name,
          'winText': winText,
          'battleTypeLocaleStr': battleTypeLocaleStr,
          'battleTypeFrameLabel': battleTypeFrameLabel,
          'allyTeamName': allyTeamName,
          'enemyTeamName': enemyTeamName}
         self._setArenaInfo(arenaInfoData)
コード例 #14
0
 def setViewComponents(self, panel):
     """
     Sets view component.
     :param panel: instance of view component.
     """
     if not panel:
         return
     self.__ui = panel
     typeID = arena_info.getArenaTypeID()
     if typeID and getArenaSubTypeName(
             typeID) not in _ENEMY_OFFSET_DISABLED_BY_GAMEPLAY:
         self.__ui.setOffsetForEnemyPoints()
     playerTeam = self.__battleCtx.getArenaDP().getNumberOfTeam()
     for clientID, (points, timeLeft, invadersCnt,
                    stopped) in self.__points.iteritems():
         if clientID in self.__captured:
             self.__ui.addCapturedTeamBase(clientID, playerTeam, timeLeft,
                                           invadersCnt)
         elif points:
             self.__ui.addCapturingTeamBase(clientID, playerTeam, points,
                                            self._getProgressRate(),
                                            timeLeft, invadersCnt, stopped)
コード例 #15
0
 def getDescriptionString(self, isInBattle = True):
     return i18n.makeString('#arenas:type/{}/name'.format(functions.getArenaSubTypeName(self._visitor.type.getID())))
コード例 #16
0
    def __updatePlayers(self, *args):
        if self.__needArenaTypeUpdate:
            arena = getattr(BigWorld.player(), 'arena', None)
            if arena:
                descExtra = getPrebattleFullDescription(arena.extraData or {})
                if not descExtra:
                    arenaSubType = getArenaSubTypeName(BigWorld.player().arenaTypeID)
                    if arenaSubType == 'assault':
                        team = getattr(BigWorld.player(), 'team', None)
                        if team:
                            arenaSubType += '1' if isBaseExists(BigWorld.player().arenaTypeID, team) else '2'
                            self.as_setBattleTypeFrameNameS(arenaSubType)
                            self.__needArenaTypeUpdate = False
        stat = {1: [],
         2: []}
        squads = {1: {},
         2: {}}
        player = BigWorld.player()
        if player is None:
            return
        elif self.__arena is None:
            return
        else:
            vehicles = self.__arena.vehicles
            userGetter = self.usersStorage.getUser
            for vId, vData in vehicles.items():
                team = vData['team']
                if 'name' in vData:
                    name = g_battleContext.getFullPlayerName(vData, showVehShortName=False)
                else:
                    name = i18n.makeString('#ingame_gui:players_panel/unknown_name')
                if vData['vehicleType'] is not None:
                    vShortName = vData['vehicleType'].type.shortUserString
                    vName = vData['vehicleType'].type.userString
                    vIcon = self.CONTOUR_ICONS_MASK % {'unicName': vData['vehicleType'].type.name.replace(':', '-')}
                    vType = set(VEHICLE_CLASS_TAGS.intersection(vData['vehicleType'].type.tags)).pop()
                else:
                    vName = vShortName = i18n.makeString('#ingame_gui:players_panel/unknown_vehicle')
                    vIcon = self.CONTOUR_ICONS_MASK % {'unicName': 'unknown'}
                    vType = 100
                if vData['isAlive']:
                    isAlive = vData['isAvatarReady']
                    vehActions = VehicleActions.getBitMask(vData.get('events', {}))
                    if vData['prebattleID']:
                        if vData['prebattleID'] not in squads[team].keys():
                            squads[team][vData['prebattleID']] = 1
                        else:
                            squads[team][vData['prebattleID']] += 1
                    user = userGetter(vData['accountDBID'])
                    isMuted = user and user.getRoster() & USERS_ROSTER_VOICE_MUTED != 0
                else:
                    isMuted = False
                stat[team].append([name,
                 vIcon,
                 vShortName,
                 not isAlive,
                 vId,
                 vData['prebattleID'],
                 vType,
                 vName,
                 not vData['isAlive'],
                 vData['name'],
                 vData['accountDBID'],
                 isMuted,
                 vehActions,
                 self.app.voiceChatManager.isPlayerSpeaking(vData['accountDBID']),
                 vData['isTeamKiller'],
                 vData['vehicleType'].level,
                 vData['igrType'],
                 vData['clanAbbrev']])

            squadsSorted = dict()
            squadsSorted[1] = sorted(squads[1].iteritems(), cmp=lambda x, y: cmp(x[0], y[0]))
            squadsSorted[2] = sorted(squads[2].iteritems(), cmp=lambda x, y: cmp(x[0], y[0]))
            squadsFiltered = dict()
            squadsFiltered[1] = [ id for id, num in squadsSorted[1] if 1 < num < 4 and self.__arena.guiType == constants.ARENA_GUI_TYPE.RANDOM ]
            squadsFiltered[2] = [ id for id, num in squadsSorted[2] if 1 < num < 4 and self.__arena.guiType == constants.ARENA_GUI_TYPE.RANDOM ]
            playerVehicleID = -1
            if hasattr(player, 'playerVehicleID'):
                playerVehicleID = player.playerVehicleID
            playerSquadID = -1
            for team in (1, 2):
                data = sorted(stat[team], cmp=_playerComparator)
                for item in data:
                    if playerVehicleID == item[4]:
                        playerSquadID = squadsFiltered[team].index(item[5]) + 1 if item[5] in squadsFiltered[team] else 0
                        break

            result = {'playerID': playerVehicleID,
             'squadID': playerSquadID,
             'team1': list(),
             'team2': list()}
            for team in (1, 2):
                thisTeam = 'team2'
                thisTeamMembers = list()
                data = sorted(stat[team], cmp=_playerComparator)
                for item in data:
                    item[5] = squadsFiltered[team].index(item[5]) + 1 if item[5] in squadsFiltered[team] else 0
                    if item[9] == player.name and result['playerID'] == -1 or item[4] == playerVehicleID:
                        result['playerID'] = item[4]
                        thisTeam = 'team1'
                        self.setTeams(team)
                        if not self.__winTextInit:
                            self.__winTextInit = True
                            teamHasBase = 1 if isBaseExists(BigWorld.player().arenaTypeID, team) else 2
                            winText = getBattleSubTypeWinText(BigWorld.player().arenaTypeID, teamHasBase)
                            self.as_setWinTextS(winText)
                    thisTeamMembers.append({'id': item[10],
                     'muted': item[11],
                     'playerID': item[4],
                     'label': item[0],
                     'icon': item[1],
                     'vehicle': item[2],
                     'enabled': not item[3],
                     'squad': item[5],
                     'vehAction': item[12],
                     'speak': item[13],
                     'isTeamKiller': item[14],
                     'isIGR': item[16] != constants.IGR_TYPE.NONE,
                     'clanAbbrev': item[17]})

                result[thisTeam] = thisTeamMembers

            self.as_setTeamValuesS(result)
            return
コード例 #17
0
def getArenaSubTypeString(arenaTypeID):
    arenaSubTypeName = getArenaSubTypeName(arenaTypeID)
    return i18n.makeString('#arenas:type/%s/name' % arenaSubTypeName)
コード例 #18
0
 def getFrameLabel(self):
     return getNecessaryArenaFrameName(functions.getArenaSubTypeName(self._arena.arenaType.id), self.isBaseExists())
コード例 #19
0
ファイル: trainingsformatters.py プロジェクト: aevitas/wotsdk
def getArenaSubTypeString(arenaTypeID):
    arenaSubTypeName = getArenaSubTypeName(arenaTypeID)
    return i18n.makeString('#arenas:type/%s/name' % arenaSubTypeName)
コード例 #20
0
 def getWinString(self, isInBattle = True):
     if isInBattle and self._arena.guiType == ARENA_GUI_TYPE.FALLOUT_MULTITEAM:
         return i18n.makeString(ARENAS.TYPE_FALLOUTMUTLITEAM_DESCRIPTION)
     else:
         return i18n.makeString('#arenas:type/{}/description'.format(functions.getArenaSubTypeName(self._arena.arenaType.id)))
コード例 #21
0
 def getWinString(self, isInBattle=True):
     lessonId = self._visitor.getArenaExtraData().get('lessonId', 0)
     return i18n.makeString('#arenas:type/{}/description{}'.format(functions.getArenaSubTypeName(self._visitor.type.getID()), lessonId))
コード例 #22
0
 def getFrameLabel(self):
     return getNecessaryArenaFrameName(
         functions.getArenaSubTypeName(self._visitor.type.getID()),
         self.isBaseExists())
コード例 #23
0
 def getDescriptionString(self, isInBattle=True):
     return i18n.makeString('#arenas:type/{}/name'.format(
         functions.getArenaSubTypeName(self._visitor.type.getID())))
コード例 #24
0
 def getFrameLabel(self):
     return getNecessaryArenaFrameName(functions.getArenaSubTypeName(self._visitor.type.getID()), self.isBaseExists())
コード例 #25
0
 def getWinString(self, isInBattle=True):
     if isInBattle and self._visitor.gui.isFalloutMultiTeam():
         return i18n.makeString(ARENAS.TYPE_FALLOUTMUTLITEAM_DESCRIPTION)
     else:
         return i18n.makeString('#arenas:type/{}/description'.format(
             functions.getArenaSubTypeName(self._visitor.type.getID())))
コード例 #26
0
 def getWinString(self, isInBattle = True):
     if isInBattle and self._visitor.gui.isFalloutMultiTeam():
         return i18n.makeString(ARENAS.TYPE_FALLOUTMUTLITEAM_DESCRIPTION)
     else:
         return i18n.makeString('#arenas:type/{}/description'.format(functions.getArenaSubTypeName(self._visitor.type.getID())))