Ejemplo n.º 1
0
def makeAchievementFromPersonal(results):
    popUps = results.get('dossierPopUps', [])
    for achievementID, value in popUps:
        record = DB_ID_TO_RECORD[achievementID]
        if record in layouts.IGNORED_BY_BATTLE_RESULTS or not layouts.isAchievementRegistered(record):
            continue
        factory = getAchievementFactory(record)
        if factory is not None:
            achievement = factory.create(value=value)
            if record == achievements.MARK_ON_GUN_RECORD:
                if 'typeCompDescr' in results:
                    try:
                        nationID = vehicles_core.parseIntCompactDescr(results['typeCompDescr'])[1]
                        achievement.setVehicleNationID(nationID)
                    except:
                        LOG_CURRENT_EXCEPTION()

                if 'damageRating' in results:
                    achievement.setDamageRating(results['damageRating'])
            if achievement.getName() in achievements.BATTLE_ACHIEVES_RIGHT:
                yield (1, achievement)
            else:
                yield (-1, achievement)

    return
Ejemplo n.º 2
0
    def getAchievements(self):
        result = []
        for achievementID in self.achievementsIDs:
            record = DB_ID_TO_RECORD[achievementID]
            factory = getAchievementFactory(record)
            if factory is not None and layouts.isAchievementRegistered(record):
                achievement = factory.create(value=0)
                if not achievement.isApproachable():
                    result.append((achievement, True))

        return sorted(result, key=sort_keys.AchievementSortKey)
Ejemplo n.º 3
0
    def getAchievements(self):
        """Gets list of received "in-battle" achievements that are reviced by player's vehicles."""
        achievements = []
        for achievementID in self.achievementsIDs:
            record = DB_ID_TO_RECORD[achievementID]
            factory = getAchievementFactory(record)
            if factory is not None and layouts.isAchievementRegistered(record):
                achievement = factory.create(value=0)
                if not achievement.isApproachable():
                    achievements.append((achievement, True))

        return sorted(achievements, key=sort_keys.AchievementSortKey)