示例#1
0
    def getMultiTeamsIndexes(self):
        result = {}
        for team in self.__teamsOnArena:
            teamIdx = 0
            vInfoVO = next(
                vos_collections.TeamVehiclesInfoCollection(team).iterator(
                    self), None)
            if vInfoVO is not None and vInfoVO.squadIndex > 0:
                teamIdx = vInfoVO.squadIndex
            result[team] = teamIdx

        return result
示例#2
0
    def getMultiTeamsIndexes(self):
        """Returns multi team indexes for teams, and zero for solo players.
        :return: dict(team: teamIdx, ...)
        """
        result = {}
        for team in self.__teamsOnArena:
            teamIdx = 0
            vInfoVO = next(vos_collections.TeamVehiclesInfoCollection(team).iterator(self), None)
            if vInfoVO is not None and vInfoVO.squadIndex > 0:
                teamIdx = vInfoVO.squadIndex
            result[team] = teamIdx

        return result
示例#3
0
    def onStatsDialogLoaded(self, *args):
        self._statsDialog = self._ui.movie._root.statsDialogContainer.main
        playersData = []
        arenaDP = g_sessionProvider.getArenaDP()
        collection = vos_collections.TeamVehiclesInfoCollection(arenaDP.getNumberOfTeam())
        for vInfoVO in collection.iterator(arenaDP):
            playerVO = vInfoVO.player
            playersData.append({'dbID': playerVO.accountDBID,
             'userName': playerVO.getPlayerLabel(),
             'clanAbbrev': playerVO.clanAbbrev,
             'region': None,
             'igrType': playerVO.igrType})

        self._formatedNames = self._statsDialog.as_getFormatedPlayerNames(playersData)
        if self._formatedNames is not None:
            self._formatedNames = self._formatedNames.toDict()
        return
示例#4
0
    def _updateTeamData(self, isEnemy, team, arenaDP, isFragsUpdate=True):
        pNamesList, fragsList, vNamesList, additionalDataList, pNamesListPanels = (
            [], [], [], [], [])
        valuesHashes = []
        ctx = makeTeamCtx(team, isEnemy, arenaDP,
                          int(self._battleUI.getPlayerNameLength(isEnemy)),
                          int(self._battleUI.getVehicleNameLength(isEnemy)),
                          self._battleUI.getCameraVehicleID())
        if isFragsUpdate:
            fragCorrelation = self._battleUI.fragCorrelation
            fragCorrelation.clear(team)
            collection = vos_collections.TeamVehiclesInfoCollection(team)
            for vInfoVO in collection.iterator(arenaDP):
                if not vInfoVO.isObserver():
                    fragCorrelation.addVehicle(
                        team, vInfoVO.vehicleID,
                        vInfoVO.vehicleType.getClassName(), vInfoVO.isAlive())
                    if not vInfoVO.isAlive():
                        fragCorrelation.addKilled(team)

        playerAccountID = getAvatarDatabaseID()
        inviteSendingProhibited = isEnemy or self.prbInvites.getSentInviteCount(
        ) >= 100
        if not inviteSendingProhibited:
            inviteSendingProhibited = not self._isSquadAllowToInvite(arenaDP)
        invitesReceivingProhibited = arenaDP.getVehicleInfo(
            playerAccountID).player.forbidInBattleInvitations
        isPlayerObserver = self._battleCtx.isPlayerObserver()
        if self._arenaVisitor.hasRespawns():
            sortKey = vos_collections.RespawnSortKey
        else:
            sortKey = vos_collections.VehicleInfoSortKey
        if isEnemy:
            collection = vos_collections.EnemyItemsCollection(sortKey=sortKey)
        else:
            collection = vos_collections.AllyItemsCollection(sortKey=sortKey)
        for index, (vInfoVO,
                    vStatsVO) in enumerate(collection.iterator(arenaDP)):
            if index >= PLAYERS_PANEL_LENGTH:
                LOG_WARNING('Max players in panel are', PLAYERS_PANEL_LENGTH)
                break
            if vInfoVO.isObserver() and isPlayerObserver:
                continue
            playerFullName = self._battleCtx.getPlayerFullName(
                vID=vInfoVO.vehicleID, showVehShortName=False)
            if not playerFullName:
                playerFullName = vInfoVO.player.getPlayerLabel()
            valuesHash = self._makeHash(index, playerFullName, vInfoVO,
                                        vStatsVO, ctx, playerAccountID,
                                        inviteSendingProhibited,
                                        invitesReceivingProhibited, isEnemy)
            pName, frags, vName, additionalData, pNamePanels = self._battleUI.statsForm.getFormattedStrings(
                vInfoVO, vStatsVO, ctx, playerFullName)
            pNamesList.append(pName)
            fragsList.append(frags)
            vNamesList.append(vName)
            additionalDataList.append(additionalData)
            valuesHashes.append(valuesHash)
            pNamesListPanels.append(pNamePanels)

        self._battleUI.setTeamValuesData(
            self._makeTeamValues(isEnemy, ctx, pNamesList, fragsList,
                                 vNamesList, additionalDataList, valuesHashes,
                                 pNamesListPanels))