示例#1
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])
示例#2
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])
示例#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])
示例#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])
示例#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])
 def toonPlayedMinigame(self, av):
     possibleAchievements = Achievements.getAchievementsOfType(Achievements.TrolleyAchievement)
     
     for achievementId in possibleAchievements:
         if not achievementId in av.getAchievements():
             if Achievements.AchievementsDict[achievementId].hasComplete(av):
                 av.addAchievement(achievementId)
    def toonPlayedMinigame(self, av):
        possibleAchievements = Achievements.getAchievementsOfType(Achievements.TrolleyAchievement)

        for achievementId in possibleAchievements:
            if not achievementId in av.getAchievements():
                if Achievements.AchievementsDict[achievementId].hasComplete(av):
                    av.addAchievement(achievementId)
    def catalog(self, av, items):
        possibleAchievements = Achievements.getAchievementsOfType(Achievements.CatalogAchievement)

        for achievementId in possibleAchievements:
            if not achievementId in av.getAchievements():
                if Achievements.AchievementsDict[achievementId].hasComplete(av, items):
                    av.addAchievement(achievementId)
    def __init__(self, achievementId, faded=False, locked=False):
        NodePath.__init__(
            self,
            hidden.attachNewNode('achievement-%s-%s' %
                                 (achievementId, id(self))))

        self.achievementId = achievementId
        self.category = Achievements.getAchievementCategory(self.achievementId)

        CategoryModels[self.category].copyTo(self)

        if not faded:
            self.generateAchievementInfo()

            if locked:
                cm = CardMaker('lock')
                lock = self.attachNewNode(cm.generate())
                lock.setTransparency(TransparencyAttrib.MAlpha)
                lock.setTexture(lockTexture)
                lock.setScale(0.35)
                lock.setPos(1.5, 0, -0.025)
                lock.setColorScale(0, 0, 0, 0.6)

        if faded:
            self.setColorScale(0, 0, 0, 0.1)

        self.flattenStrong()
    def disguise(self, av, dept):
        av = self.air.doId2do.get(av)
        possibleAchievements = Achievements.getAchievementsOfType(Achievements.DisguiseAchievement)
		
        for achievementId in possibleAchievements:
            if not achievementId in av.getAchievements():
                if Achievements.AchievementsDict[achievementId].hasComplete(av, dept):
                    av.addAchievement(achievementId)
示例#11
0
 def rideTrolley(self, av):
     possibleAchievements = Achievements.getAchievementsOfType(
         Achievements.TrolleyAchievement)
     for achievementId in possibleAchievements:
         if achievementId not in av.getAchievements():
             if Achievements.AchievementsDict[achievementId].hasComplete(
                     av):
                 av.addAchievement(achievementId)
    def cogs(self, av):
        av = self.air.doId2do.get(av)
        possibleAchievements = Achievements.getAchievementsOfType(Achievements.CogAchievement)
		
        for achievementId in possibleAchievements:
            if not achievementId in av.getAchievements():
                if Achievements.AchievementsDict[achievementId].hasComplete(av):
                    av.addAchievement(achievementId)
示例#13
0
 def zone(self, av, zone):
     av = self.air.doId2do.get(av)
     possibleAchievements = Achievements.getAchievementsOfType(
         Achievements.ZoneAchievement)
     for achievementId in possibleAchievements:
         if achievementId not in av.getAchievements():
             if Achievements.AchievementsDict[achievementId].hasComplete(
                     av, zone):
                 av.addAchievement(achievementId)
示例#14
0
 def loopysBalls(self, av):
     av = self.air.doId2do.get(av)
     possibleAchievements = Achievements.getAchievementsOfType(
         Achievements.LoopysBallsAchievement)
     for achievementId in possibleAchievements:
         if achievementId not in av.getAchievements():
             if Achievements.AchievementsDict[achievementId].hasComplete(
                     av):
                 av.addAchievement(achievementId)
示例#15
0
 def ceo(self, av, solo=0):
     av = self.air.doId2do.get(av)
     possibleAchievements = Achievements.getAchievementsOfType(
         Achievements.CEOAchievement)
     for achievementId in possibleAchievements:
         if achievementId not in av.getAchievements():
             if Achievements.AchievementsDict[achievementId].hasComplete(
                     av, solo):
                 av.addAchievement(achievementId)
示例#16
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])
    def friends(self, avId):
        av = self.air.doId2do.get(avId)
        if not av:
            return

        possibleAchievements = Achievements.getAchievementsOfType(Achievements.FriendAchievement)
        for achievementId in possibleAchievements:
            if not achievementId in av.getAchievements():
                if Achievements.AchievementsDict[achievementId].hasComplete(av):
                    av.addAchievement(achievementId)
示例#18
0
    def toonMadeFriend(self, avId):
        av = self.air.doId2do.get(avId)
        if not av:
            return

        possibleAchievements = Achievements.getAchievementsOfType(Achievements.FriendAchievement)

        for achievementId in possibleAchievements:
            if not achievementId in av.getAchievements():
                if Achievements.AchievementsDict[achievementId].hasComplete(av):
                    av.addAchievement(achievementId)
示例#19
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])
示例#20
0
    def handleAccountStatsRecieved(self, accountStats):
        accountStats['ACHIEVEMENTS'].append(self.achievementId)
        accountStats['ACHIEVEMENT_POINTS'] += Achievements.getAchievementScore(self.achievementId)

        # Update the account stats:
        self.air.dbInterface.updateObject(
            self.air.dbId,
            self.av.getStatsId(),
            self.air.dclassesByName['AccountStats'],
            {'ACHIEVEMENTS': accountStats['ACHIEVEMENTS'],
             'ACHIEVEMENT_POINTS': accountStats['ACHIEVEMENT_POINTS']})

        # Set the av's achievements:
        self.av.b_setAchievements(accountStats['ACHIEVEMENTS'], accountStats['ACHIEVEMENT_POINTS'])
        self.demand('Done')
示例#21
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])
示例#22
0
    def toonsFinishedVP(self, toons):
        possibleAchievements = Achievements.getAchievementsOfType(Achievements.VPAchievement)

        for avId in toons:
            av = self.air.doId2do.get(int(avId))
            if not av:
                continue

            for achievementId in possibleAchievements:
                if not achievementId in av.getAchievements():
                    solo = avId in self.vpSoloPlayers
                    laff = avId in self.vpLaffPlayers

                    if Achievements.AchievementsDict[achievementId].hasComplete(laff, solo):
                        av.addAchievement(achievementId)

            while avId in self.vpSoloPlayers:
                self.vpSoloPlayers.remove(avId)

            while avId in self.vpLaffPlayers:
                self.vpLaffPlayers.remove(avId)
 def toonsFinishedVP(self, toons):
     possibleAchievements = Achievements.getAchievementsOfType(Achievements.VPAchievement)
     
     for avId in toons:
         av = self.air.doId2do.get(int(avId))
         if not av:
             continue
         
         for achievementId in possibleAchievements:
             if not achievementId in av.getAchievements():
                 solo = avId in self.vpSoloPlayers
                 laff = avId in self.vpLaffPlayers
                 
                 if Achievements.AchievementsDict[achievementId].hasComplete(laff, solo):
                     av.addAchievement(achievementId)
                 
         while avId in self.vpSoloPlayers:
             self.vpSoloPlayers.remove(avId)
             
         while avId in self.vpLaffPlayers:
             self.vpLaffPlayers.remove(avId)
    def __init__(self, achievementId, faded=False, locked=False):
        NodePath.__init__(self, hidden.attachNewNode('achievement-%s-%s' % (achievementId, id(self))))

        self.achievementId = achievementId
        self.category = Achievements.getAchievementCategory(self.achievementId)

        CategoryModels[self.category].copyTo(self)

        if not faded:
            self.generateAchievementInfo()

            if locked:
                cm = CardMaker('lock')
                lock = self.attachNewNode(cm.generate())
                lock.setTransparency(TransparencyAttrib.MAlpha)
                lock.setTexture(lockTexture)
                lock.setScale(0.35)
                lock.setPos(1.5, 0, -0.025)
                lock.setColorScale(0, 0, 0, 0.6)

        if faded:
            self.setColorScale(0, 0, 0, 0.1)

        self.flattenStrong()