Exemple #1
0
    def toonDefeatedCJ(self, av, infoDict):
        # Update the account stats
        accountStats = self.statsCache.getStats(av.doId)

        accountStats['CJS_DEFEATED'][infoDict['toonCount']] += 1
        if infoDict['finalHit']:
            accountStats['CJ_FINAL_HITS'] += 1
        accountStats['CJ_DAMAGE_DEALT'] += infoDict['damageDealt']
        accountStats['CJ_COGS_STUNNED'] += infoDict['cogsStunned']
        accountStats['CJ_JURORS_SEATED'] += infoDict['jurorsSeated']

        previousTime = accountStats['CJ_TIMES'][infoDict['toonCount']]
        if previousTime > infoDict['time'] or previousTime == 0:
            accountStats['CJ_TIMES'][infoDict['toonCount']] = infoDict['time']

        self.modifyAccountStats(av.getStatsId(), {'CJS_DEFEATED': accountStats['CJS_DEFEATED'],
                                                  'CJ_FINAL_HITS': accountStats['CJ_FINAL_HITS'],
                                                  'CJ_DAMAGE_DEALT': accountStats['CJ_DAMAGE_DEALT'],
                                                  'CJ_COGS_STUNNED': accountStats['CJ_COGS_STUNNED'],
                                                  'CJ_JURORS_SEATED': accountStats['CJ_JURORS_SEATED'],
                                                  'CJ_TIMES': accountStats['CJ_TIMES']})

        possibleAchievements = Achievements.getAchievementsOfType('CJAchievement')
        possibleAchievements.extend(Achievements.getAchievementsOfType('CJJurorAchievement'))
        for achievementId in possibleAchievements:
            Achievements.doAchievement(achievementId, [av])
Exemple #2
0
    def toonDefeatedCEO(self, av, infoDict):
        # Update the account stats
        accountStats = self.statsCache.getStats(av.doId)

        accountStats['CEOS_DEFEATED'][infoDict['toonCount']] += 1
        if infoDict['finalHit']:
            accountStats['CEO_FINAL_HITS'] += 1
        accountStats['CEO_DAMAGE_DEALT'] += infoDict['damageDealt']
        accountStats['CEO_GOLF_HITS'] += infoDict['golfHits']
        accountStats['CEO_SNACKS_EATEN'] += infoDict['snacksEaten']
        accountStats['CEO_COGS_SERVED'] += infoDict['cogsServed']
        accountStats['FIRES_EARNED'] += infoDict['fires']

        previousTime = accountStats['CEO_TIMES'][infoDict['toonCount']]
        if previousTime > infoDict['time'] or previousTime == 0:
            accountStats['CEO_TIMES'][infoDict['toonCount']] = infoDict['time']

        self.modifyAccountStats(av.getStatsId(), {'CEOS_DEFEATED': accountStats['CEOS_DEFEATED'],
                                                  'CEO_FINAL_HITS': accountStats['CEO_FINAL_HITS'],
                                                  'CEO_DAMAGE_DEALT': accountStats['CEO_DAMAGE_DEALT'],
                                                  'CEO_GOLF_HITS': accountStats['CEO_GOLD_HITS'],
                                                  'CEO_SNACKS_EATEN': accountStats['CEO_SNACKS_EATEN'],
                                                  'CEO_COGS_SERVED': accountStats['CEO_COGS_SERVED'],
                                                  'FIRES_EARNED': accountStats['FIRES_EARNED'],
                                                  'CEO_TIMES': accountStats['CEO_TIMES']})

        possibleAchievements = Achievements.getAchievementsOfType('CEOAchievement')
        possibleAchievements.extend(Achievements.getAchievementsOfType('CEOSnackAchievement'))
        for achievementId in possibleAchievements:
            Achievements.doAchievement(achievementId, [av])
Exemple #3
0
    def toonDefeatedCFO(self, av, infoDict):
        # Update the account stats
        accountStats = self.statsCache.getStats(av.doId)

        accountStats['CFOS_DEFEATED'][infoDict['toonCount']] += 1
        if infoDict['finalHit']:
            accountStats['CFO_FINAL_HITS'] += 1
        accountStats['CFO_STUNS'] += infoDict['stuns']
        accountStats['CFO_DAMAGE_DEALT'] += infoDict['damageDealt']
        accountStats['CFO_GOONS_HIT'] += infoDict['goonsHit']
        accountStats['CFO_SAFES_HIT'] += infoDict['safesHit']
        accountStats['CFO_HELMETS_REMOVED'] += infoDict['helmetsRemoved']

        previousTime = accountStats['CFO_TIMES'][infoDict['toonCount']]
        if previousTime > infoDict['time'] or previousTime == 0:
            accountStats['CFO_TIMES'][infoDict['toonCount']] = infoDict['time']

        self.modifyAccountStats(av.getStatsId(), {'CFOS_DEFEATED': accountStats['CFOS_DEFEATED'],
                                                  'CFO_FINAL_HITS': accountStats['CFO_FINAL_HITS'],
                                                  'CFO_STUNS': accountStats['CFO_STUNS'],
                                                  'CFO_DAMAGE_DEALT': accountStats['CFO_DAMAGE_DEALT'],
                                                  'CFO_GOONS_HIT': accountStats['CFO_GOONS_HIT'],
                                                  'CFO_SAFES_HIT': accountStats['CFO_SAFES_HIT'],
                                                  'CFO_HELMETS_REMOVED': accountStats['CFO_HELMETS_REMOVED'],
                                                  'CFO_TIMES': accountStats['CFO_TIMES']})

        possibleAchievements = Achievements.getAchievementsOfType('CFOAchievement')
        for achievementId in possibleAchievements:
            Achievements.doAchievement(achievementId, [av])
Exemple #4
0
    def toonMadeFriend(self, avId):
        av = self.air.doId2do.get(avId)
        if av is None:
            return

        # Update the account stats
        accountStats = self.statsCache.getStats(avId)
        accountStats['FRIENDS_MADE'] += 1

        self.modifyAccountStats(av.getStatsId(), {'FRIENDS_MADE': accountStats['FRIENDS_MADE']})

        possibleAchievements = Achievements.getAchievementsOfType('FriendAchievement')
        for achievementId in possibleAchievements:
            Achievements.doAchievement(achievementId, [av])
Exemple #5
0
    def toonCompletedQuest(self, avId):
        av = self.air.doId2do.get(avId)
        if av is None:
            return

        # Update the account stats
        accountStats = self.statsCache.getStats(avId)
        accountStats['QUESTS_COMPLETED'] += 1

        self.modifyAccountStats(av.getStatsId(), {'QUESTS_COMPLETED': accountStats['QUESTS_COMPLETED']})

        possibleAchievements = Achievements.getAchievementsOfType('QuestTierAchievement')
        possibleAchievements.extend(Achievements.getAchievementsOfType('QuestCountAchievement'))
        for achievementId in possibleAchievements:
            Achievements.doAchievement(achievementId, [av])
Exemple #6
0
    def toonDefeatedBuilding(self, avId, track, floorCount):
        av = self.air.doId2do.get(avId)
        if av is None:
            return

        index = (ToontownGlobals.cogDept2index[track] * 5) + floorCount

        # Update the account stats
        accountStats = self.statsCache.getStats(avId)
        accountStats['BUILDINGS_COMPLETED'][index] += 1
        accountStats['BUILDING_FLOORS_COMPLETED'] += floorCount + 1

        self.modifyAccountStats(av.getStatsId(), {'BUILDINGS_COMPLETED': accountStats['BUILDINGS_COMPLETED'],
                                                  'BUILDING_FLOORS_COMPLETED': accountStats['BUILDING_FLOORS_COMPLETED']})

        possibleAchievements = Achievements.getAchievementsOfType('BuildingAchievement')
        for achievementId in possibleAchievements:
            Achievements.doAchievement(achievementId, [av])
Exemple #7
0
    def toonDefeatedBossCog(self, avId, bossDept, infoDict):
        av = self.air.doId2do.get(avId)
        if av is None:
            return

        if bossDept == 's':
            self.toonDefeatedVP(av, infoDict)
        elif bossDept == 'm':
            self.toonDefeatedCFO(av, infoDict)
        elif bossDept == 'l':
            self.toonDefeatedCJ(av, infoDict)
        elif bossDept == 'c':
            self.toonDefeatedCEO(av, infoDict)
        else:
            self.notify.warning('Avatar %s defeated unknown boss: %s' % (avId, bossDept))
            return

        possibleAchievements = Achievements.getAchievementsOfType('HasRequiredAchievements')
        for achievementId in possibleAchievements:
            Achievements.doAchievement(achievementId, [av])
Exemple #8
0
    def toonDefeatedVP(self, av, infoDict):
        # Update the account stats
        accountStats = self.statsCache.getStats(av.doId)

        accountStats['VPS_DEFEATED'][infoDict['toonCount']] += 1
        if infoDict['finalHit']:
            accountStats['VP_FINAL_HITS'] += 1
        accountStats['VP_STUNS'] += infoDict['stuns']
        accountStats['VP_DAMAGE_DEALT'] += infoDict['damageDealt']

        previousTime = accountStats['VP_TIMES'][infoDict['toonCount']]
        if previousTime > infoDict['time'] or previousTime == 0:
            accountStats['VP_TIMES'][infoDict['toonCount']] = infoDict['time']

        self.modifyAccountStats(av.getStatsId(), {'VPS_DEFEATED': accountStats['VPS_DEFEATED'],
                                                  'VP_FINAL_HITS': accountStats['VP_FINAL_HITS'],
                                                  'VP_STUNS': accountStats['VP_STUNS'],
                                                  'VP_DAMAGE_DEALT': accountStats['VP_DAMAGE_DEALT'],
                                                  'VP_TIMES': accountStats['VP_TIMES']})

        possibleAchievements = Achievements.getAchievementsOfType('VPAchievement')
        possibleAchievements.extend(Achievements.getAchievementsOfType('VPStunAchievement'))
        for achievementId in possibleAchievements:
            Achievements.doAchievement(achievementId, [av])