Beispiel #1
0
 def __init__(self, personal):
     super(PersonalInfo, self).__init__()
     if _RECORD.PERSONAL_AVATAR in personal and personal[
             _RECORD.PERSONAL_AVATAR] is not None:
         self.__avatar = _PersonalAvatarInfo(
             **personal[_RECORD.PERSONAL_AVATAR])
     else:
         self.__avatar = _PersonalAvatarInfo()
         self._addUnpackedItemID(_RECORD.PERSONAL_AVATAR)
     self.__vehicles = []
     self.__isObserver = False
     self.__isTeamKiller = False
     self.__premiumMask = 0
     self.__isAddXPBonusApplied = False
     self._economicsRecords = _EconomicsRecordsChains()
     self.__lifeTimeInfo = _LifeTimeInfo(False, 0)
     self.__questsProgress = {}
     self.__PM2Progress = {}
     self.__c11nProgress = {}
     self.__rankInfo = PostBattleRankInfo(0, 0, 0, 0, 0, 0, 0, 0, {}, {},
                                          False, 0, 0)
     self.__dogTags = {}
     self.__goldBankGain = 0
     if not self.hasUnpackedItems():
         self.__collectRequiredData(personal)
     return
Beispiel #2
0
    def __collectRequiredData(self, info):
        getItemByCD = self.itemsCache.items.getItemByCD
        items = sorted(map(getItemByCD, filter(lambda key: isinstance(key, (int, long, float)), info.keys())))
        lifeTimes = []
        infoAvatar = info['avatar']
        if infoAvatar:
            self.__questsProgress.update(infoAvatar.get('questsProgress', {}))
            self.__rankInfo = PostBattleRankInfo.fromDict(infoAvatar)
        for item in items:
            intCD = item.intCD
            if not intCD in info:
                raise AssertionError
                data = info[intCD]
                if data is None:
                    self._addUnpackedItemID(intCD)
                    continue
                self.__vehicles.append(intCD)
                self.__economicsRecords.addResults(intCD, data)
                if not self.__isObserver:
                    self.__isObserver = item.isObserver
                killerID = data['killerID'] if 'killerID' in data else 0
                lifeTime = data['lifeTime'] if 'lifeTime' in data else 0
                if killerID and lifeTime:
                    lifeTimes.append(lifeTime)
                self.__isPremium = not self.__isPremium and data.get('isPremium', False) and True
            self.__questsProgress.update(data.get('questsProgress', {}))

        if lifeTimes:
            self.__lifeTimeInfo = _LifeTimeInfo(True, min(lifeTimes))
        return
Beispiel #3
0
 def __init__(self, personal):
     super(PersonalInfo, self).__init__()
     if _RECORD.PERSONAL_AVATAR in personal and personal[_RECORD.PERSONAL_AVATAR] is not None:
         self.__avatar = _PersonalAvatarInfo(**personal[_RECORD.PERSONAL_AVATAR])
     else:
         self.__avatar = _PersonalAvatarInfo()
         self._addUnpackedItemID(_RECORD.PERSONAL_AVATAR)
     self.__vehicles = []
     self.__isObserver = False
     self.__isPremium = False
     self.__economicsRecords = _EconomicsRecordsChains()
     self.__lifeTimeInfo = _LifeTimeInfo(False, 0)
     self.__questsProgress = {}
     self.__rankInfo = PostBattleRankInfo(0, 0, 0, 0, 0, 0, 0, 0, 0, {}, {})
     if not self.hasUnpackedItems():
         self.__collectRequiredData(personal)
     return
    def __collectRequiredData(self, info):
        getItemByCD = self.itemsCache.items.getItemByCD
        itemCDs = [
            key for key in info.keys() if isinstance(key, (int, long, float))
        ]
        items = sorted((getItemByCD(itemCD) for itemCD in itemCDs))
        lifeTimes = []
        infoAvatar = info['avatar']
        if infoAvatar:
            self.__questsProgress.update(infoAvatar.get('questsProgress', {}))
            self.__PM2Progress.update(infoAvatar.get('PM2Progress', {}))
            self.__rankInfo = PostBattleRankInfo.fromDict(infoAvatar)
            self.__progressiveReward = infoAvatar.get('progressiveReward')
            self.__dogTags.update(infoAvatar.get('dogTags', {}))
            self.__goldBankGain = infoAvatar.get('goldBankGain', 0)
            self.__replayURL = infoAvatar.get('replayURL', '')
        for item in items:
            intCD = item.intCD
            data = info[intCD]
            if data is None:
                self._addUnpackedItemID(intCD)
                continue
            self.__vehicles.append(intCD)
            self._economicsRecords.addResults(intCD, data)
            if not self.__isObserver:
                self.__isObserver = item.isObserver
            killerID = data['killerID'] if 'killerID' in data else 0
            lifeTime = data['lifeTime'] if 'lifeTime' in data else 0
            if killerID and lifeTime:
                lifeTimes.append(lifeTime)
            self.__isTeamKiller = data[
                'isTeamKiller'] if 'isTeamKiller' in data else False
            self.__premiumMask = data.get('premMask', PREMIUM_TYPE.NONE)
            self.__questsProgress.update(data.get('questsProgress', {}))
            self.__PM2Progress.update(data.get('PM2Progress', {}))
            self.__c11nProgress[intCD] = data.get('c11nProgress', {})
            self.__xpProgress[intCD] = {
                'xp': data.get('xp', 0),
                'xpByTmen': data.get('xpByTmen', [])
            }

        if lifeTimes:
            self.__lifeTimeInfo = _LifeTimeInfo(True, min(lifeTimes))
        return
Beispiel #5
0
    def __collectRequiredData(self, info):
        getItemByCD = self.itemsCache.items.getItemByCD
        itemCDs = [
            key for key in info.keys() if isinstance(key, (int, long, float))
        ]
        items = sorted((getItemByCD(itemCD) for itemCD in itemCDs))
        lifeTimes = []
        infoAvatar = info['avatar']
        if infoAvatar:
            self.__questsProgress.update(infoAvatar.get('questsProgress', {}))
            self.__PM2Progress.update(infoAvatar.get('PM2Progress', {}))
            self.__rankInfo = PostBattleRankInfo.fromDict(infoAvatar)
            self.__progressiveReward = infoAvatar.get('progressiveReward')
            self.__battleRoyale = {
                'brPointsChanges': infoAvatar.get('brPointsChanges', 0),
                'accBRTitle': infoAvatar.get('accBRTitle', (1, 0)),
                'prevBRTitle': infoAvatar.get('prevBRTitle', (1, 0)),
                'maxAchievedBRTitle': infoAvatar.get('maxAchievedBRTitle',
                                                     (1, 0))
            }
        for item in items:
            intCD = item.intCD
            data = info[intCD]
            if data is None:
                self._addUnpackedItemID(intCD)
                continue
            self.__vehicles.append(intCD)
            self._economicsRecords.addResults(intCD, data)
            if not self.__isObserver:
                self.__isObserver = item.isObserver
            killerID = data['killerID'] if 'killerID' in data else 0
            lifeTime = data['lifeTime'] if 'lifeTime' in data else 0
            if killerID and lifeTime:
                lifeTimes.append(lifeTime)
            self.__isTeamKiller = data[
                'isTeamKiller'] if 'isTeamKiller' in data else False
            self.__premiumMask = data.get('premMask', PREMIUM_TYPE.NONE)
            self.__questsProgress.update(data.get('questsProgress', {}))
            self.__PM2Progress.update(data.get('PM2Progress', {}))
            self.__c11nProgress[intCD] = data.get('c11nProgress', {})

        if lifeTimes:
            self.__lifeTimeInfo = _LifeTimeInfo(True, min(lifeTimes))
        return