Beispiel #1
0
 def __new__(cls,
             dbID=0,
             team=0,
             name=results_fmts.getUnknownPlayerName(),
             prebattleID=0,
             igrType=0,
             clanAbbrev='',
             clanDBID=0):
     return super(_PlayerData,
                  cls).__new__(cls, dbID, team, name, prebattleID, igrType,
                               clanAbbrev, clanDBID)
 def __new__(cls, dbID = 0, team = 0, name = results_fmts.getUnknownPlayerName(), prebattleID = 0, igrType = 0, clanAbbrev = '', clanDBID = 0):
     return super(_PlayerData, cls).__new__(cls, dbID, team, name, prebattleID, igrType, clanAbbrev, clanDBID)
 def getPlayerData(self, playerDbID, botName):
     return self.__players.get(playerDbID, _PlayerData(dbID=playerDbID, name=botName or results_fmts.getUnknownPlayerName()))
from messenger.proto.xmpp.spa_requesters import NicknameResolver

class _PlayerData(namedtuple('_PlayerData', 'dbID team name prebattleID igrType clanAbbrev clanDBID')):

    def __new__(cls, dbID = 0, team = 0, name = results_fmts.getUnknownPlayerName(), prebattleID = 0, igrType = 0, clanAbbrev = '', clanDBID = 0):
        return super(_PlayerData, cls).__new__(cls, dbID, team, name, prebattleID, igrType, clanAbbrev, clanDBID)

    def getFullName(self):
        return g_lobbyContext.getPlayerFullName(self.name, clanAbbrev=self.clanAbbrev, pDBID=self.dbID)

    def getRegionCode(self):
        return g_lobbyContext.getRegionCode(self.dbID)


_PlayerInfo = namedtuple('_PlayerInfo', 'name clanAbbrev')
_PlayerInfo.__new__.__defaults__ = (results_fmts.getUnknownPlayerName(), '')

class _PlayersInfoGetter(object):

    def __init__(self):
        self._infoCache = {}

    @async
    def invalidate(self, results, callback):
        callback(True)

    def getInfo(self, playerDbID):
        return self._infoCache.get(playerDbID, _PlayerInfo())


class _PlayersInfoFromDataGetter(_PlayersInfoGetter):
Beispiel #5
0
 def getPlayerData(self, playerDbID, botName):
     return self.__players.get(
         playerDbID,
         _PlayerData(dbID=playerDbID,
                     name=botName or results_fmts.getUnknownPlayerName()))
Beispiel #6
0
                clanDBID=0):
        return super(_PlayerData,
                     cls).__new__(cls, dbID, team, name, prebattleID, igrType,
                                  clanAbbrev, clanDBID)

    def getFullName(self):
        return g_lobbyContext.getPlayerFullName(self.name,
                                                clanAbbrev=self.clanAbbrev,
                                                pDBID=self.dbID)

    def getRegionCode(self):
        return g_lobbyContext.getRegionCode(self.dbID)


_PlayerInfo = namedtuple('_PlayerInfo', 'name clanAbbrev')
_PlayerInfo.__new__.__defaults__ = (results_fmts.getUnknownPlayerName(), '')


class _PlayersInfoGetter(object):
    def __init__(self):
        self._infoCache = {}

    @async
    def invalidate(self, results, callback):
        callback(True)

    def getInfo(self, playerDbID):
        return self._infoCache.get(playerDbID, _PlayerInfo())


class _PlayersInfoFromDataGetter(_PlayersInfoGetter):