def enterFrameworkCleanup(self):
        self.notify.debug('BASE: enterFrameworkCleanup: normalExit=%s' % self.normalExit)
        scoreMult = MinigameGlobals.getScoreMult(self.getSafezoneId())
        if not self.hasScoreMult():
            scoreMult = 1.0
        self.notify.debug('score multiplier: %s' % scoreMult)
        for avId in self.avIdList:
            self.scoreDict[avId] *= scoreMult

        scoreList = []
        for avId in self.avIdList:
            if self.normalExit:
                score = int(self.scoreDict[avId] + 0.5)
            else:
                score = 0
            if simbase.air.newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY) or simbase.air.newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH):
                score *= MinigameGlobals.JellybeanTrolleyHolidayScoreMultiplier
            logEvent = False
            if score > 255:
                score = 255
                logEvent = True
            elif score < 0:
                score = 0
                logEvent = True
            if logEvent:
                self.air.writeServerEvent('suspicious', avId, 'got %s jellybeans playing minigame %s in zone %s' % (score, self.minigameId, self.getSafezoneId()))
            scoreList.append(score)

        self.requestDelete()
        self.handleRegularPurchaseManager(scoreList)
        self.frameworkFSM.request('frameworkOff')
Ejemplo n.º 2
0
    def enterFrameworkCleanup(self):
        self.notify.debug("BASE: enterFrameworkCleanup: normalExit=%s" %
                          self.normalExit)

        # scale the scores based on the neighborhood
        # use self.getSafezoneId to pick up debug overrides
        scoreMult = MinigameGlobals.getScoreMult(self.getSafezoneId())
        if not self.hasScoreMult():
            scoreMult = 1.0
        self.notify.debug('score multiplier: %s' % scoreMult)
        for avId in self.avIdList:
            assert avId not in [0, None]
            self.scoreDict[avId] *= scoreMult

        # create a score list that parallels the avIdList
        scoreList = []
        if not self.normalExit:
            # if game exited abnormally, pick a uniform number of points
            # for all toons
            randReward = random.randrange(DEFAULT_POINTS, MAX_POINTS + 1)
        for avId in self.avIdList:
            assert avId not in [0, None]
            # put in some bogus points if we have requested abort
            if self.normalExit:
                score = int(self.scoreDict[avId] + .5)
                if score > 255:
                    self.notify.warning(
                        'avatar %s got %s jellybeans playing minigame %s in zone %s'
                        % (avId, score, self.minigameId, self.getSafezoneId()))
                    score = 255
                elif score < 0:
                    # RAU just in case I miss something in ice game
                    score = 0
                scoreList.append(score)
            else:
                scoreList.append(randReward)

        # Delete yourself
        self.requestDelete()

        if self.metagameRound > -1:
            self.handleMetagamePurchaseManager(scoreList)
        else:
            self.handleRegularPurchaseManager(scoreList)

        self.frameworkFSM.request('frameworkOff')
    def enterFrameworkCleanup(self):
        self.notify.debug('BASE: enterFrameworkCleanup: normalExit=%s' %
                          self.normalExit)
        scoreMult = MinigameGlobals.getScoreMult(self.getSafezoneId())
        if not self.hasScoreMult():
            scoreMult = 1.0

        self.notify.debug('score multiplier: %s' % scoreMult)
        for avId in self.avIdList:
            self.scoreDict[avId] *= scoreMult

        scoreList = []
        if not self.normalExit:
            randReward = random.randrange(DEFAULT_POINTS, MAX_POINTS + 1)

        for avId in self.avIdList:
            if self.normalExit:
                score = int(self.scoreDict[avId] + 0.5)
            else:
                score = randReward
            if ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY in simbase.air.holidayManager.currentHolidays or ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH in simbase.air.holidayManager.currentHolidays:
                score *= MinigameGlobals.JellybeanTrolleyHolidayScoreMultiplier

            logEvent = False
            if score > 255:
                score = 255
                logEvent = True
            elif score < 0:
                score = 0
                logEvent = True

            if logEvent:
                self.air.writeServerEvent(
                    'suspicious', avId,
                    'got %s jellybeans playing minigame %s in zone %s' %
                    (score, self.minigameId, self.getSafezoneId()))

            scoreList.append(score)

        self.requestDelete()
        if self.metagameRound > -1:
            self.handleMetagamePurchaseManager(scoreList)
        else:
            self.handleRegularPurchaseManager(scoreList)
        self.frameworkFSM.request('frameworkOff')
 def enterFrameworkCleanup(self):
     self.notify.debug('BASE: enterFrameworkCleanup: normalExit=%s' % self.normalExit)
     scoreMult = MinigameGlobals.getScoreMult(self.getSafezoneId())
     if not self.hasScoreMult():
         scoreMult = 1.0
     
     self.notify.debug('score multiplier: %s' % scoreMult)
     for avId in self.avIdList:
         self.scoreDict[avId] *= scoreMult
     
     scoreList = []
     if not self.normalExit:
         randReward = random.randrange(DEFAULT_POINTS, MAX_POINTS + 1)
     
     for avId in self.avIdList:
         if self.normalExit:
             score = int(self.scoreDict[avId] + 0.5)
         else:
             score = randReward
         if ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY in simbase.air.holidayManager.currentHolidays or ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH in simbase.air.holidayManager.currentHolidays:
             score *= MinigameGlobals.JellybeanTrolleyHolidayScoreMultiplier
         
         logEvent = False
         if score > 255:
             score = 255
             logEvent = True
         elif score < 0:
             score = 0
             logEvent = True
         
         if logEvent:
             self.air.writeServerEvent('suspicious', avId, 'got %s jellybeans playing minigame %s in zone %s' % (score, self.minigameId, self.getSafezoneId()))
         
         scoreList.append(score)
     
     self.requestDelete()
     if self.metagameRound > -1:
         self.handleMetagamePurchaseManager(scoreList)
     else:
         self.handleRegularPurchaseManager(scoreList)
     self.frameworkFSM.request('frameworkOff')
    def enterFrameworkCleanup(self):
        self.notify.debug("BASE: enterFrameworkCleanup: normalExit=%s" % self.normalExit)
        scoreMult = MinigameGlobals.getScoreMult(self.getSafezoneId())
        if not self.hasScoreMult():
            scoreMult = 1.0
        self.notify.debug("score multiplier: %s" % scoreMult)
        for avId in self.avIdList:
            self.scoreDict[avId] *= scoreMult

        scoreList = []
        for avId in self.avIdList:
            if self.normalExit:
                score = int(self.scoreDict[avId] + 0.5)
            else:
                score = 0
            if simbase.air.newsManager.isHolidayRunning(
                ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY
            ) or simbase.air.newsManager.isHolidayRunning(ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH):
                score *= MinigameGlobals.JellybeanTrolleyHolidayScoreMultiplier
            logEvent = False
            if score > 255:
                score = 255
                logEvent = True
            elif score < 0:
                score = 0
                logEvent = True
            if logEvent:
                self.air.writeServerEvent(
                    "suspicious",
                    avId,
                    "got %s jellybeans playing minigame %s in zone %s" % (score, self.minigameId, self.getSafezoneId()),
                )
            scoreList.append(score)

        self.requestDelete()
        self.handleRegularPurchaseManager(scoreList)
        self.frameworkFSM.request("frameworkOff")