Esempio n. 1
0
 def __doneVictory(self, avIds):
     self.d_setBattleExperience()
     self.b_setState('Reward')
     BattleExperienceAI.assignRewards(self.involvedToons,
                                      self.toonSkillPtsGained,
                                      self.suitsKilled,
                                      ToontownGlobals.dept2cogHQ(self.dept),
                                      self.helpfulToons)
     for toonId in self.involvedToons:
         toon = self.air.doId2do.get(toonId)
         if toon:
             configMax = simbase.config.GetInt('max-sos-cards', 16)
             if configMax == 8:
                 maxNumCalls = 1
             else:
                 maxNumCalls = 2
             if not toon.attemptAddNPCFriend(self.cagedToonNpcId,
                                             numCalls=maxNumCalls):
                 self.notify.info('%s.unable to add NPCFriend %s to %s.' %
                                  (self.doId, self.cagedToonNpcId, toonId))
             if self.__shouldPromoteToon(toon):
                 toon.b_promote(self.deptIndex)
                 self.sendUpdateToAvatarId(toonId, 'toonPromoted', [1])
             else:
                 self.sendUpdateToAvatarId(toonId, 'toonPromoted', [0])
    def __doneVictory(self, avIds):

        # Tell the client the information it needs to generate a
        # reward movie.
        self.d_setBattleExperience()

        # First, move the clients into the reward start.  They'll
        # build the reward movies immediately.
        self.b_setState("Reward")

        # Now that the clients have started to build their reward
        # movies, we can actually assign all the experience and
        # rewards.  If we did this sooner, the quest reward panel
        # would show the rewards being applied twice.

        # There is no race condition between AI and client here
        # because these messages are sent sequentially on the wire.

        BattleExperienceAI.assignRewards(
            self.involvedToons, self.toonSkillPtsGained,
            self.suitsKilled,
            ToontownGlobals.dept2cogHQ(self.dept), self.helpfulToons)

        # Don't forget to give the toon the resistance chat reward and the
        # promotion!

        for toonId in self.involvedToons:
            toon = self.air.doId2do.get(toonId)
            if toon:
                toon.addResistanceMessage(self.rewardId)
                toon.b_promote(self.deptIndex)
 def __doneVictory(self, avIds):
     self.d_setBattleExperience()
     self.b_setState('Reward')
     BattleExperienceAI.assignRewards(self.involvedToons,
                                      self.toonSkillPtsGained,
                                      self.suitsKilled,
                                      ToontownGlobals.dept2cogHQ(self.dept),
                                      self.helpfulToons)
     preferredDept = random.randrange(len(SuitDNA.suitDepts))
     typeWeights = ['single'] * 3 + ['building'] * 60 + ['invasion'] * 37
     preferredSummonType = random.choice(typeWeights)
     for toonId in self.involvedToons:
         toon = self.air.doId2do.get(toonId)
         if toon:
             self.giveCogSummonReward(toon, preferredDept,
                                      preferredSummonType)
             toon.b_promote(self.deptIndex)
             toon.addStat(ToontownGlobals.STATS_CJ)
             simbase.air.questManager.toonDefeatedBoss(
                 toon, ToontownGlobals.dept2cogHQ(self.dept), self.dna.dept,
                 self.involvedToons)
         if len(self.involvedToons[:]) == 1 and self.begunSolo:
             isSolo = 1
         else:
             isSolo = 0
         self.air.achievementsManager.cj(toonId, solo=isSolo)
 def __doneVictory(self, avIds):
     self.d_setBattleExperience()
     self.b_setState('Reward')
     BattleExperienceAI.assignRewards(self.involvedToons,
                                      self.toonSkillPtsGained,
                                      self.suitsKilled,
                                      ToontownGlobals.dept2cogHQ(self.dept),
                                      self.helpfulToons)
     for toonId in self.involvedToons:
         toon = self.air.doId2do.get(toonId)
         if toon:
             toon.addResistanceMessage(self.rewardId)
             if self.bonusUnites:
                 for x in xrange(self.bonusUnites):
                     toon.addResistanceMessage(ResistanceChat.getRandomId())
             toon.b_promote(self.deptIndex)
             toon.addStat(ToontownGlobals.STATS_CFO)
             simbase.air.questManager.toonDefeatedBoss(
                 toon, ToontownGlobals.dept2cogHQ(self.dept), self.dna.dept,
                 self.involvedToons)
         if len(self.involvedToons[:]) == 1 and self.begunSolo:
             isSolo = 1
         else:
             isSolo = 0
         self.air.achievementsManager.cfo(toonId, solo=isSolo)
 def __doneVictory(self, avIds):
     self.d_setBattleExperience()
     self.b_setState('Reward')
     BattleExperienceAI.assignRewards(self.involvedToons, self.toonSkillPtsGained, self.suitsKilled, ToontownGlobals.dept2cogHQ(self.dept), self.helpfulToons)
     for toonId in self.involvedToons:
         toon = self.air.doId2do.get(toonId)
         if toon:
             self.givePinkSlipReward(toon)
             toon.b_promote(self.deptIndex)
Esempio n. 6
0
 def __doneVictory(self, avIds):
     self.d_setBattleExperience()
     self.b_setState('Reward')
     BattleExperienceAI.assignRewards(self.involvedToons, self.toonSkillPtsGained, self.suitsKilled, ToontownGlobals.dept2cogHQ(self.dept), self.helpfulToons)
     for toonId in self.involvedToons:
         toon = self.air.doId2do.get(toonId)
         if toon:
             toon.addResistanceMessage(self.rewardId)
             toon.b_promote(self.deptIndex)
Esempio n. 7
0
 def __doneVictory(self, avIds):
     self.d_setBattleExperience()
     self.b_setState('Reward')
     BattleExperienceAI.assignRewards(self.involvedToons, self.toonSkillPtsGained, self.suitsKilled, ToontownGlobals.dept2cogHQ(self.dept), self.helpfulToons)
     for toonId in self.involvedToons:
         toon = self.air.doId2do.get(toonId)
         if toon:
             if not toon.attemptAddNPCFriend(self.cagedToonNpcId, numCalls=1):
                 self.notify.info('%s.unable to add NPCFriend %s to %s.' % (self.doId, self.cagedToonNpcId, toonId))
             toon.b_promote(self.deptIndex)
Esempio n. 8
0
 def __doneVictory(self, avIds):
     self.d_setBattleExperience()
     self.b_setState('Reward')
     BattleExperienceAI.assignRewards(self.involvedToons, self.toonSkillPtsGained, self.suitsKilled, ToontownGlobals.dept2cogHQ(self.dept), self.helpfulToons)
     for toonId in self.involvedToons:
         toon = self.air.doId2do.get(toonId)
         if toon:
             if not toon.attemptAddNPCFriend(self.cagedToonNpcId, numCalls=1):
                 self.notify.info('%s.unable to add NPCFriend %s to %s.' % (self.doId, self.cagedToonNpcId, toonId))
             toon.b_promote(self.deptIndex)
 def __doneVictory(self, avIds):
     self.d_setBattleExperience()
     self.b_setState('Reward')
     BattleExperienceAI.assignRewards(self.involvedToons, self.toonSkillPtsGained, self.suitsKilled, ToontownGlobals.dept2cogHQ(self.dept), self.helpfulToons)
     for toonId in self.involvedToons:
         toon = self.air.doId2do.get(toonId)
         if toon:
             for i in xrange(5):
                 toon.addResistanceMessage(self.rewardId)
             toon.b_promote(self.deptIndex)
Esempio n. 10
0
 def __doneVictory(self, avIds):
     self.d_setBattleExperience()
     self.b_setState('Reward')
     BattleExperienceAI.assignRewards(self.involvedToons, self.toonSkillPtsGained, self.suitsKilled, ToontownGlobals.dept2cogHQ(self.dept), self.helpfulToons)
     preferredDept = random.randrange(len(SuitDNA.suitDepts))
     typeWeights = ['single'] * 70 + ['building'] * 27 + ['invasion'] * 3
     preferredSummonType = random.choice(typeWeights)
     for toonId in self.involvedToons:
         toon = self.air.doId2do.get(toonId)
         if toon:
             self.giveCogSummonReward(toon, preferredDept, preferredSummonType)
             toon.b_promote(self.deptIndex)
 def __doneVictory(self, avIds):
     self.d_setBattleExperience()
     self.b_setState('Reward')
     BattleExperienceAI.assignRewards(self.involvedToons, self.toonSkillPtsGained, self.suitsKilled, ToontownGlobals.dept2cogHQ(self.dept), self.helpfulToons)
     preferredDept = random.randrange(len(SuitDNA.suitDepts))
     typeWeights = ['single'] * 70 + ['building'] * 27 + ['invasion'] * 3
     preferredSummonType = random.choice(typeWeights)
     for toonId in self.involvedToons:
         toon = self.air.doId2do.get(toonId)
         if toon:
             self.giveCogSummonReward(toon, preferredDept, preferredSummonType)
             toon.b_promote(self.deptIndex)
Esempio n. 12
0
 def _DistributedBossbotBossAI__doneVictory(self, avIds):
     self.d_setBattleExperience()
     self.b_setState('Reward')
     BattleExperienceAI.assignRewards(self.involvedToons,
                                      self.toonSkillPtsGained,
                                      self.suitsKilled,
                                      ToontownGlobals.dept2cogHQ(self.dept),
                                      self.helpfulToons)
     for toonId in self.involvedToons:
         toon = self.air.doId2do.get(toonId)
         if toon:
             self.givePinkSlipReward(toon)
             toon.b_promote(self.deptIndex)
             continue
 def __doneVictory(self, avIds):
     self.d_setBattleExperience()
     self.b_setState('Reward')
     BattleExperienceAI.assignRewards(self.involvedToons, self.toonSkillPtsGained, self.suitsKilled, ToontownGlobals.dept2cogHQ(self.dept), self.helpfulToons)
     for toonId in self.involvedToons:
         toon = self.air.doId2do.get(toonId)
         if toon:
             self.givePinkSlipReward(toon)
             toon.b_promote(self.deptIndex)
             toon.addStat(ToontownGlobals.STATS_CEO)
         if len(self.involvedToons) == 1 and self.begunSolo:
             isSolo = 1
         else:
             isSolo = 0
         self.air.achievementsManager.ceo(toonId, solo=isSolo)
Esempio n. 14
0
 def __doneVictory(self, avIds):
     self.d_setBattleExperience()
     self.b_setState('Reward')
     BattleExperienceAI.assignRewards(self.involvedToons, self.toonSkillPtsGained, self.suitsKilled, ToontownGlobals.dept2cogHQ(self.dept), self.helpfulToons)
     for toonId in self.involvedToons:
         toon = self.air.doId2do.get(toonId)
         if toon:
             if not toon.attemptAddNPCFriend(self.cagedToonNpcId, numCalls=self.numSos):
                 self.notify.info('%s.unable to add NPCFriend %s to %s.' % (self.doId, self.cagedToonNpcId, toonId))
             toon.b_promote(self.deptIndex)
             toon.addStat(ToontownGlobals.STATS_VP)
             simbase.air.questManager.toonDefeatedBoss(toon, ToontownGlobals.dept2cogHQ(self.dept), self.dna.dept, self.involvedToons)
         if len(self.involvedToons[:]) == 1 and self.begunSolo:
             isSolo = 1
         else:
             isSolo = 0
         self.air.achievementsManager.vp(toonId, solo = isSolo)