Ejemplo n.º 1
0
    def toonExitDemand(self):
        DistributedPartyCatchActivityAI.notify.debug("toonJoinRequest")
        toonId = self.air.getAvatarIdFromSender()
        # make sure this toon is currently playing
        if toonId not in self.toonIds:
            return
        if toonId in self.toonIdsToScores:
            reward = self.toonIdsToScores[toonId]

            # if it's jelly bean day give us more jelly beans!
            if self.air.holidayManager.isHolidayRunning(
                    ToontownGlobals.JELLYBEAN_DAY):
                reward *= PartyGlobals.JellyBeanDayMultiplier

            if reward > PartyGlobals.CatchMaxTotalReward:
                # put a cap so we don't go beyond something ridiculous
                reward = PartyGlobals.CatchMaxTotalReward
                self.toonIdsToJellybeanRewards[toonId] = reward
            self.sendUpdateToAvatarId(toonId, "showJellybeanReward", [
                reward, self.air.doId2do[toonId].getMoney(),
                TTLocalizer.PartyCatchRewardMessage %
                (self.toonIdsToScores[toonId], reward)
            ])
            del self.toonIdsToScores[toonId]
            self.toonIdsToJellybeanRewards[toonId] = reward
            self.issueJellybeanRewardToToonId(toonId)
        DistributedPartyActivityAI.toonExitDemand(self)
        if toonId in self._playerIds:
            self._playerIds.remove(toonId)
        # number of players changed, start a new generation of drops
        self._setUpNextGenScheduleTask(globalClock.getRealTime() -
                                       self.activityStartTime)
 def toonExitDemand(self):
     avId = self.air.getAvatarIdFromSender()
     if not avId in self.toonsPlaying:
         self.air.writeServerEvent(
             'suspicious',
             avId=avId,
             issue='Toon tried to exit a party game they\'re not using!')
         return
     catches = self.player2catches[avId]
     del self.player2catches[avId]
     av = self.air.doId2do.get(avId, None)
     if not av:
         self.air.writeServerEvent(
             'suspicious',
             avId=avId,
             issue='Toon tried to award beans while not in district!')
         return
     if catches > PartyGlobals.CatchMaxTotalReward:
         catches = PartyGlobals.CatchMaxTotalReward
     self.sendUpdateToAvatarId(avId, 'showJellybeanReward', [
         catches,
         av.getMoney(), TTLocalizer.PartyCatchRewardMessage %
         (catches, catches)
     ])
     av.addMoney(catches)
     DistributedPartyActivityAI.toonExitDemand(self)
 def toonExitDemand(self):
     avId = self.air.getAvatarIdFromSender()
     if avId not in self.toonsPlaying:
         self.air.writeServerEvent('suspicious', avId=avId, issue="Toon tried to exit a party game they're not using!")
         return
     catches = self.player2catches[avId]
     del self.player2catches[avId]
     av = self.air.doId2do.get(avId, None)
     if not av:
         self.air.writeServerEvent('suspicious', avId=avId, issue='Toon tried to award beans while not in district!')
         return
     if catches > PartyGlobals.CatchMaxTotalReward:
         catches = PartyGlobals.CatchMaxTotalReward
     self.sendUpdateToAvatarId(avId, 'showJellybeanReward', [catches, av.getMoney(), TTLocalizer.PartyCatchRewardMessage % (catches, catches)])
     av.addMoney(catches)
     DistributedPartyActivityAI.toonExitDemand(self)