def packAchievement(achievement, dossierType, dossierCompDescr, isDossierForCurrentUser, defaultShowProgress = True, defaultSeriesCounter = None): atype = achievement.getType() total = achievement.getLevelUpTotalValue() or 0 lvlUpValue = achievement.getLevelUpValue() or 0 current = total - lvlUpValue progress = None section = achievement.getSection() if atype == ACHIEVEMENT_TYPE.REPEATABLE: if section == ACHIEVEMENT_SECTION.SPECIAL or section == ACHIEVEMENT_SECTION.BATTLE: if total > 0: progress = (0, current, total) elif atype == ACHIEVEMENT_TYPE.SERIES: if section == ACHIEVEMENT_SECTION.SPECIAL: minRecordValue = -1 if atype == ACHIEVEMENT_TYPE.SERIES and section == ACHIEVEMENT_SECTION.SPECIAL: minRecordValue = RECORD_CONFIGS.get(achievement.getName()) MIN_PROGRESS_PERCENT = 0.9 divisionVal = 0 if total != 0: divisionVal = current / total if divisionVal >= MIN_PROGRESS_PERCENT or current != 0 and lvlUpValue < minRecordValue: progress = (0, current, total) elif atype == ACHIEVEMENT_TYPE.CUSTOM: if section == ACHIEVEMENT_SECTION.SPECIAL: if current != total: progress = (0, current, total) else: progress = (0, current, total) elif atype == ACHIEVEMENT_TYPE.CLASS: if current != total: progress = (0, current, total) elif atype == ACHIEVEMENT_TYPE.SINGLE: if current != total and not achievement.getValue(): progress = (0, current, total) isRare = isRareAchievement(achievement) if isRare: rareIconID = achievement.requestImageID() else: rareIconID = None if not defaultShowProgress or not isDossierForCurrentUser: progress = None commonData = AchievementsUtils.getCommonAchievementData(achievement, dossierType, dossierCompDescr, 1 if achievement.isInDossier() else 0.2) commonData.update({'isRare': isRare, 'rareIconId': rareIconID, 'counterType': AchievementsUtils.getCounterType(achievement, defaultSeriesCounter), 'progress': progress, 'isDossierForCurrentUser': isDossierForCurrentUser}) return commonData
def _getValue(self): result = dict() achievement = self._tooltip.item if achievement and achievement.getType() == 'class': result['classParams'] = RECORD_CONFIGS.get(achievement.getName()) return result