def awardCups(self): """Award the cups and laff boost. Also update self.newCups.""" stillPlaying = self.getStillPlayingAvIds() for avId in stillPlaying: av = simbase.air.doId2do.get(avId) if av: oldHistory = self.startingHistory[avId] endingHistory = self.endingHistory[avId] oldCups = GolfGlobals.calcCupListFromHistory(oldHistory) endingCups = GolfGlobals.calcCupListFromHistory(endingHistory) # now figure out which trophies he just got newCups = [] for index in xrange(len(oldCups)): if not oldCups[index] and endingCups[index]: self.notify.debug('New Trophy %d' % index) newCups.append(True) self.air.writeServerEvent("golf_cup", avId, "%s" % (index)) newMaxHp = av.getMaxHp() + 1 av.b_setMaxHp(newMaxHp) # Also, give them a full heal av.toonUp(newMaxHp) else: newCups.append(False) self.newCups[avId] = newCups
def awardCups(self): stillPlaying = self.getStillPlayingAvIds() for avId in stillPlaying: av = simbase.air.doId2do.get(avId) if av: oldHistory = self.startingHistory[avId] endingHistory = self.endingHistory[avId] oldCups = GolfGlobals.calcCupListFromHistory(oldHistory) endingCups = GolfGlobals.calcCupListFromHistory(endingHistory) newCups = [] for index in xrange(len(oldCups)): if not oldCups[index] and endingCups[index]: self.notify.debug('New Trophy %d' % index) newCups.append(True) self.air.writeServerEvent('golf_cup', avId, '%s' % index) newMaxHp = av.getMaxHp() + 1 av.b_setMaxHp(newMaxHp) av.toonUp(newMaxHp) continue newCups.append(False) self.newCups[avId] = newCups