コード例 #1
0
 def onPlayerStateChanged(self, entity, roster, accountInfo):
     stateString = formatters.getPlayerStateString(accountInfo.state)
     vContourIcon = ''
     vShortName = ''
     vLevel = ''
     if accountInfo.isVehicleSpecified():
         vehicle = accountInfo.getVehicle()
         vContourIcon = vehicle.iconContour
         vShortName = vehicle.shortUserName
         vLevel = int2roman(vehicle.level)
     if roster == PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1:
         self.as_setPlayerStateInTeam1S(accountInfo.dbID, stateString,
                                        vContourIcon, vShortName, vLevel,
                                        accountInfo.igrType)
     elif roster == PREBATTLE_ROSTER.ASSIGNED_IN_TEAM2:
         self.as_setPlayerStateInTeam2S(accountInfo.dbID, stateString,
                                        vContourIcon, vShortName, vLevel,
                                        accountInfo.igrType)
     else:
         self.as_setPlayerStateInOtherS(accountInfo.dbID, stateString,
                                        vContourIcon, vShortName, vLevel,
                                        accountInfo.igrType)
     creator = self.__getCreatorFromRosters()
     if accountInfo.dbID == creator.dbID:
         self.__showSettings(entity)
     self._updateStartButton(entity)
コード例 #2
0
 def onPlayerStateChanged(self, entity, roster, accountInfo):
     if not self.__currentPlayerIsOut and accountInfo.isCurrentPlayer(
     ) and not accountInfo.isReady():
         self.__currentPlayerIsOut = True
     stateString = formatters.getPlayerStateString(accountInfo.state)
     vContourIcon = ''
     vShortName = ''
     vLevel = ''
     if accountInfo.isVehicleSpecified():
         vehicle = accountInfo.getVehicle()
         vContourIcon = vehicle.iconContour
         vShortName = vehicle.shortUserName
         vLevel = int2roman(vehicle.level)
     badge = accountInfo.getBadge()
     badgeVO = badge.getBadgeVO(ICONS_SIZES.X24,
                                {'isAtlasSource': False}) if badge else {}
     if roster == PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1:
         self.as_setPlayerStateInTeam1S(accountInfo.dbID, stateString,
                                        vContourIcon, vShortName, vLevel,
                                        accountInfo.igrType, badgeVO)
     elif roster == PREBATTLE_ROSTER.ASSIGNED_IN_TEAM2:
         self.as_setPlayerStateInTeam2S(accountInfo.dbID, stateString,
                                        vContourIcon, vShortName, vLevel,
                                        accountInfo.igrType, badgeVO)
     else:
         self.as_setPlayerStateInOtherS(accountInfo.dbID, stateString,
                                        vContourIcon, vShortName, vLevel,
                                        accountInfo.igrType, badgeVO)
     creator = self.__getCreatorFromRosters()
     if accountInfo.dbID == creator.dbID:
         self.__showSettings(entity)
     self._updateStartButton(entity)
コード例 #3
0
    def __makeAccountsData(self, accounts, label = None):
        listData = []
        isPlayerSpeaking = self.bwProto.voipController.isPlayerSpeaking
        accounts = sorted(accounts, cmp=getPlayersComparator())
        getUser = self.usersStorage.getUser
        for account in accounts:
            vContourIcon = ''
            vShortName = ''
            vLevel = ''
            dbID = account.dbID
            user = getUser(dbID)
            if account.isVehicleSpecified():
                vehicle = account.getVehicle()
                vContourIcon = vehicle.iconContour
                vShortName = vehicle.shortUserName
                vLevel = int2roman(vehicle.level)
            listData.append({'accID': account.accID,
             'dbID': account.dbID,
             'userName': account.name,
             'fullName': account.getFullName(),
             'stateString': formatters.getPlayerStateString(account.state),
             'icon': vContourIcon,
             'vShortName': vShortName,
             'vLevel': vLevel,
             'tags': list(user.getTags()) if user else [],
             'isPlayerSpeaking': bool(isPlayerSpeaking(account.dbID)),
             'clanAbbrev': account.clanAbbrev,
             'region': g_lobbyContext.getRegionCode(account.dbID),
             'igrType': account.igrType})

        if label is not None:
            label = text_styles.main(i18n.makeString(label, total=text_styles.stats(str(len(listData)))))
        result = {'listData': listData,
         'teamLabel': label}
        return result
コード例 #4
0
ファイル: trainingroom.py プロジェクト: wotmods/WOTDecompiled
    def __makeAccountsData(self, accounts):
        result = []
        isPlayerSpeaking = self.app.voiceChatManager.isPlayerSpeaking
        accounts = sorted(accounts, cmp=getPlayersComparator())
        getUser = self.usersStorage.getUser
        for account in accounts:
            vContourIcon = ''
            vShortName = ''
            vLevel = ''
            dbID = account.dbID
            user = getUser(dbID)
            if account.isVehicleSpecified():
                vehicle = account.getVehicle()
                vContourIcon = vehicle.iconContour
                vShortName = vehicle.shortUserName
                vLevel = int2roman(vehicle.level)
            result.append({'accID': account.accID,
             'dbID': account.dbID,
             'userName': account.name,
             'fullName': account.getFullName(),
             'himself': account.isCurrentPlayer(),
             'stateString': formatters.getPlayerStateString(account.state),
             'icon': vContourIcon,
             'vShortName': vShortName,
             'vLevel': vLevel,
             'chatRoster': user.getRoster() if user else 0,
             'isPlayerSpeaking': bool(isPlayerSpeaking(account.dbID)),
             'clanAbbrev': account.clanAbbrev,
             'region': g_lobbyContext.getRegionCode(account.dbID),
             'igrType': account.igrType})

        return result
コード例 #5
0
ファイル: trainingroom.py プロジェクト: kblw/wot_client
 def onPlayerStateChanged(self, functional, roster, accountInfo):
     stateString = formatters.getPlayerStateString(accountInfo.state)
     vContourIcon = ""
     vShortName = ""
     vLevel = ""
     if accountInfo.isVehicleSpecified():
         vehicle = accountInfo.getVehicle()
         vContourIcon = vehicle.iconContour
         vShortName = vehicle.shortUserName
         vLevel = int2roman(vehicle.level)
     if roster == PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1:
         self.as_setPlayerStateInTeam1S(
             accountInfo.dbID, stateString, vContourIcon, vShortName, vLevel, accountInfo.igrType
         )
     elif roster == PREBATTLE_ROSTER.ASSIGNED_IN_TEAM2:
         self.as_setPlayerStateInTeam2S(
             accountInfo.dbID, stateString, vContourIcon, vShortName, vLevel, accountInfo.igrType
         )
     else:
         self.as_setPlayerStateInOtherS(
             accountInfo.dbID, stateString, vContourIcon, vShortName, vLevel, accountInfo.igrType
         )
     creator = self.__getCreatorFromRosters()
     if accountInfo.dbID == creator.dbID:
         self.__showSettings(functional)
     self.__updateStartButton(functional)
コード例 #6
0
    def __makeAccountsData(self, accounts):
        result = []
        isPlayerSpeaking = self.app.voiceChatManager.isPlayerSpeaking
        accounts = sorted(accounts, cmp=getPlayersComparator())
        getUser = self.usersStorage.getUser
        for account in accounts:
            vContourIcon = ''
            vShortName = ''
            vLevel = ''
            dbID = account.dbID
            user = getUser(dbID)
            if account.isVehicleSpecified():
                vehicle = account.getVehicle()
                vContourIcon = vehicle.iconContour
                vShortName = vehicle.shortUserName
                vLevel = int2roman(vehicle.level)
            result.append({'accID': account.accID,
             'uid': account.dbID,
             'userName': account.name,
             'fullName': account.getFullName(),
             'himself': account.isCurrentPlayer(),
             'stateString': formatters.getPlayerStateString(account.state),
             'icon': vContourIcon,
             'vShortName': vShortName,
             'vLevel': vLevel,
             'chatRoster': user.getRoster() if user else 0,
             'isPlayerSpeaking': bool(isPlayerSpeaking(account.dbID))})

        return result
コード例 #7
0
    def __makeAccountsDataForLane(self, accounts, lane, label=None):
        listData = []
        isPlayerSpeaking = self.app.voiceChatManager.isPlayerSpeaking
        accounts = sorted(accounts, cmp=getPlayersComparator())
        getUser = self.usersStorage.getUser
        lanecounter = [0, 0, 0]
        for account in accounts:
            lanecounter[account.group - 1] += 1
            if lane >= 0 and lane == account.group:
                vContourIcon = ''
                vShortName = ''
                vLevel = ''
                dbID = account.dbID
                user = getUser(dbID)
                if account.isVehicleSpecified():
                    vehicle = account.getVehicle()
                    vContourIcon = vehicle.iconContour
                    vShortName = vehicle.shortUserName
                    vLevel = int2roman(vehicle.level)
                listData.append({
                    'accID':
                    account.accID,
                    'dbID':
                    account.dbID,
                    'userName':
                    account.name,
                    'fullName':
                    account.getFullName(),
                    'stateString':
                    formatters.getPlayerStateString(account.state),
                    'icon':
                    vContourIcon,
                    'vShortName':
                    vShortName,
                    'vLevel':
                    vLevel,
                    'tags':
                    list(user.getTags()) if user else [],
                    'isPlayerSpeaking':
                    bool(isPlayerSpeaking(account.dbID)),
                    'clanAbbrev':
                    account.clanAbbrev,
                    'region':
                    self.lobbyContext.getRegionCode(account.dbID),
                    'igrType':
                    account.igrType
                })

        if label is not None:
            label = text_styles.main(
                i18n.makeString(label,
                                lane1=str(lanecounter[0]),
                                lane2=str(lanecounter[1]),
                                lane3=str(lanecounter[2])))
        result = {'listData': listData, 'teamLabel': label, 'lane': lane}
        return result
コード例 #8
0
 def onPlayerStateChanged(self, functional, roster, accountInfo):
     stateString = formatters.getPlayerStateString(accountInfo.state)
     vContourIcon = ''
     vShortName = ''
     vLevel = ''
     if accountInfo.isVehicleSpecified():
         vehicle = accountInfo.getVehicle()
         vContourIcon = vehicle.iconContour
         vShortName = vehicle.shortUserName
         vLevel = int2roman(vehicle.level)
     if roster == PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1:
         self.as_setPlayerStateInTeam1S(accountInfo.dbID, stateString, vContourIcon, vShortName, vLevel)
     elif roster == PREBATTLE_ROSTER.ASSIGNED_IN_TEAM2:
         self.as_setPlayerStateInTeam2S(accountInfo.dbID, stateString, vContourIcon, vShortName, vLevel)
     else:
         self.as_setPlayerStateInOtherS(accountInfo.dbID, stateString, vContourIcon, vShortName, vLevel)
     self.__updateStartButton(functional)
コード例 #9
0
ファイル: trainingroom.py プロジェクト: kblw/wot_client
    def __makeAccountsData(self, accounts, label=None):
        listData = []
        isPlayerSpeaking = self.app.voiceChatManager.isPlayerSpeaking
        accounts = sorted(accounts, cmp=getPlayersComparator())
        getUser = self.usersStorage.getUser
        for account in accounts:
            vContourIcon = ""
            vShortName = ""
            vLevel = ""
            dbID = account.dbID
            user = getUser(dbID)
            if account.isVehicleSpecified():
                vehicle = account.getVehicle()
                vContourIcon = vehicle.iconContour
                vShortName = vehicle.shortUserName
                vLevel = int2roman(vehicle.level)
            listData.append(
                {
                    "accID": account.accID,
                    "dbID": account.dbID,
                    "userName": account.name,
                    "fullName": account.getFullName(),
                    "stateString": formatters.getPlayerStateString(account.state),
                    "icon": vContourIcon,
                    "vShortName": vShortName,
                    "vLevel": vLevel,
                    "tags": list(user.getTags()) if user else [],
                    "isPlayerSpeaking": bool(isPlayerSpeaking(account.dbID)),
                    "clanAbbrev": account.clanAbbrev,
                    "region": g_lobbyContext.getRegionCode(account.dbID),
                    "igrType": account.igrType,
                }
            )

        if label is not None:
            label = text_styles.main(i18n.makeString(label, total=text_styles.stats(str(len(listData)))))
        result = {"listData": listData, "teamLabel": label}
        return result