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
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
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