def _packAchievement(self, achieve, dossierCompDescr): isRare = isRareAchievement(achieve) rareID = None name = achieve.name if isRare: rareID = achieve.requestImageID() name = 'rare%d' % achieve.rareID return { 'name': name, 'value': achieve.getValue(), 'section': achieve.getSection(), 'type': achieve.getType(), 'dossierCompDescr': dossierCompDescr, 'rareIconId': rareID, 'isRare': isRare, 'isDone': achieve.isDone, 'lvlUpTotalValue': achieve.getLevelUpTotalValue(), 'lvlUpValue': achieve.lvlUpValue, 'isDossierForCurrentUser': self.itemID is None, 'description': achieve.description, 'userName': achieve.userName, 'icon': achieve.icon, 'dossierType': self._getDossierType(), 'isInDossier': achieve.isInDossier() }
def showTooltip(self, cmd): tooltipType = cmd.tooltipType itemId = cmd.itemId args = [] withLongIntArgs = (TC.AWARD_SHELL,) withLongOnlyArgs = (TC.AWARD_VEHICLE, TC.AWARD_MODULE, TC.INVENTORY_BATTLE_BOOSTER, TC.BOOSTERS_BOOSTER_INFO, TC.BADGE, TC.TECH_CUSTOMIZATION_ITEM) if tooltipType in withLongIntArgs: args = [itemId, 0] elif tooltipType in withLongOnlyArgs: args = [itemId] elif tooltipType == TC.ACHIEVEMENT: dossier = self.itemsCache.items.getAccountDossier() dossierCompDescr = dumpDossier(self.itemsCache.items.getAccountDossier()) achievement = dossier.getTotalStats().getAchievement((cmd.blockId, itemId)) args = [dossier.getDossierType(), dossierCompDescr, achievement.getBlock(), cmd.itemId, isRareAchievement(achievement)] self.__getTooltipMgr().onCreateTypedTooltip(tooltipType, args, 'INFO')
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 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 _packAchievement(self, achieve, dossierCompDescr): isRare = isRareAchievement(achieve) rareID = None name = achieve.name if isRare: rareID = achieve.requestImageID() name = 'rare%d' % achieve.rareID return {'name': name, 'value': achieve.getValue(), 'section': achieve.getSection(), 'type': achieve.getType(), 'dossierCompDescr': dossierCompDescr, 'rareIconId': rareID, 'isRare': isRare, 'isDone': achieve.isDone, 'lvlUpTotalValue': achieve.getLevelUpTotalValue(), 'lvlUpValue': achieve.lvlUpValue, 'isDossierForCurrentUser': self.itemID is None, 'description': achieve.description, 'userName': achieve.userName, 'icon': achieve.icon, 'dossierType': self._getDossierType(), 'isInDossier': achieve.isInDossier()}