Example #1
0
    def awardTrophies(self):
        """Award the trophies. Also update self.newTrophies."""
        stillPlaying = self.getStillPlayingAvIds()
        for avId in stillPlaying:
            av = simbase.air.doId2do.get(avId)
            if av:
                oldHistory = self.startingHistory[avId]
                endingHistory = self.endingHistory[avId]
                oldTrophies = GolfGlobals.calcTrophyListFromHistory(oldHistory)
                endingTrophies = GolfGlobals.calcTrophyListFromHistory(
                    endingHistory)
                av.b_setGolfHistory(endingHistory)

                # now figure out which trophies he just got
                newTrophies = []
                for index in xrange(len(oldTrophies)):
                    if not oldTrophies[index] and endingTrophies[index]:
                        self.notify.debug('New Trophy %d' % index)
                        self.air.writeServerEvent("golf_trophy", avId,
                                                  "%s" % (index))
                        newTrophies.append(True)
                        self.trophyListLen = self.trophyListLen + 1
                    else:
                        newTrophies.append(False)
                self.newTrophies[avId] = newTrophies
 def awardTrophies(self):
     stillPlaying = self.getStillPlayingAvIds()
     for avId in stillPlaying:
         av = simbase.air.doId2do.get(avId)
         if av:
             oldHistory = self.startingHistory[avId]
             endingHistory = self.endingHistory[avId]
             oldTrophies = GolfGlobals.calcTrophyListFromHistory(oldHistory)
             endingTrophies = GolfGlobals.calcTrophyListFromHistory(endingHistory)
             av.b_setGolfHistory(endingHistory)
             newTrophies = []
             for index in xrange(len(oldTrophies)):
                 if not oldTrophies[index] and endingTrophies[index]:
                     self.notify.debug('New Trophy %d' % index)
                     self.air.writeServerEvent('golf_trophy', avId, '%s' % index)
                     newTrophies.append(True)
                     self.trophyListLen = self.trophyListLen + 1
                     continue
                 newTrophies.append(False)
             self.newTrophies[avId] = newTrophies
    def awardTrophies(self):
        stillPlaying = self.getStillPlayingAvIds()
        for avId in stillPlaying:
            av = simbase.air.doId2do.get(avId)
            if av:
                oldHistory = self.startingHistory[avId]
                endingHistory = self.endingHistory[avId]
                oldTrophies = GolfGlobals.calcTrophyListFromHistory(oldHistory)
                endingTrophies = GolfGlobals.calcTrophyListFromHistory(endingHistory)
                av.b_setGolfHistory(endingHistory)
                newTrophies = []
                for index in xrange(len(oldTrophies)):
                    if not oldTrophies[index] and endingTrophies[index]:
                        self.notify.debug('New Trophy %d' % index)
                        self.air.writeServerEvent('golf_trophy', avId, '%s' % index)
                        newTrophies.append(True)
                        self.trophyListLen = self.trophyListLen + 1
                    else:
                        newTrophies.append(False)

                self.newTrophies[avId] = newTrophies
    def awardTrophies(self):
        stillPlaying = self.getStillPlayingAvIds()
        for avId in stillPlaying:
            av = simbase.air.doId2do.get(avId)
            if av:
                oldHistory = self.startingHistory[avId]
                endingHistory = self.endingHistory[avId]
                oldTrophies = GolfGlobals.calcTrophyListFromHistory(oldHistory)
                endingTrophies = GolfGlobals.calcTrophyListFromHistory(endingHistory)
                av.b_setGolfHistory(endingHistory)
                av.addStat(ToontownGlobals.STAT_GOLF)
                newTrophies = []
                for index in xrange(len(oldTrophies)):
                    if not oldTrophies[index] and endingTrophies[index]:
                        self.notify.debug("New Trophy %d" % index)
                        self.air.writeServerEvent("golf_trophy", avId, "%s" % index)
                        newTrophies.append(True)
                        self.trophyListLen = self.trophyListLen + 1
                    else:
                        newTrophies.append(False)

                self.newTrophies[avId] = newTrophies