def shutDown(self): if self.isShutdown: self.notify.warning('Got shutDown twice') return self.isShutdown = 1 from toontown.minigame import MinigameCreatorAI playAgainNum = self.getNumPlayAgain() if playAgainNum > 0: playAgainList = self.getPlayAgainList() newVotesArray = self.getVotesArrayMatchingPlayAgainList(playAgainList) newRound = self.metagameRound newbieIdsToPass = [] if newRound > -1: newbieIdsToPass = self.newbieIds if newRound < TravelGameGlobals.FinalMetagameRoundIndex: newRound += 1 else: newRound = 0 newVotesArray = [TravelGameGlobals.DefaultStartingVotes] * len(playAgainList) if len(playAgainList) == 1 and simbase.config.GetBool('metagame-min-2-players', 1): newRound = -1 MinigameCreatorAI.createMinigame(self.air, playAgainList, self.trolleyZone, minigameZone=self.zoneId, previousGameId=self.previousMinigameId, newbieIds=newbieIdsToPass, startingVotes=newVotesArray, metagameRound=newRound, desiredNextGame=self.desiredNextGame) else: MinigameCreatorAI.releaseMinigameZone(self.zoneId) self.requestDelete() self.ignoreAll() return None
def shutDown(self): if self.isShutdown: # We no longer own the zoneId. If we accidentally come by # here again, we don't want to try to deallocate it again (or # hand it off to another minigame). # Note: We cannot set the zoneId to None because the AIRepository # needs to remove us from the zoneId2doIds dict # Maybe someone called shutDown twice. self.notify.warning("Got shutDown twice") return self.isShutdown = 1 # This must be imported here rather than at the top of the # file in order to avoid circular imports. from toontown.minigame import MinigameCreatorAI # Does anyone want to play again? playAgainNum = self.getNumPlayAgain() assert (playAgainNum >= 0 and playAgainNum <= 4) # If so, start a minigame in this zone if playAgainNum > 0: playAgainList = self.getPlayAgainList() newVotesArray = self.getVotesArrayMatchingPlayAgainList( playAgainList) newRound = self.metagameRound newbieIdsToPass = [] if newRound > -1: newbieIdsToPass = self.newbieIds # we must pass this on if newRound < TravelGameGlobals.FinalMetagameRoundIndex: newRound += 1 else: newRound = 0 newVotesArray = [TravelGameGlobals.DefaultStartingVotes ] * len(playAgainList) # but if we only have one player left, don't start the metagame if len(playAgainList) == 1 and \ simbase.config.GetBool('metagame-min-2-players', 1): newRound = -1 MinigameCreatorAI.createMinigame( self.air, playAgainList, self.trolleyZone, minigameZone=self.zoneId, previousGameId=self.previousMinigameId, newbieIds=newbieIdsToPass, startingVotes=newVotesArray, metagameRound=newRound, desiredNextGame=self.desiredNextGame) # If not, deallocate this zone, so it can be reused in the future. else: MinigameCreatorAI.releaseMinigameZone(self.zoneId) # That's it for us! self.requestDelete() # Don't listen for any more unexpected avatar exit events. self.ignoreAll() return None
def shutDown(self): if self.isShutdown: self.notify.warning('Got shutDown twice') return self.isShutdown = 1 from toontown.minigame import MinigameCreatorAI playAgainNum = self.getNumPlayAgain() if playAgainNum > 0: MinigameCreatorAI.createMinigame(self.air, self.getPlayAgainList(), self.trolleyZone, minigameZone=self.zoneId, previousGameId=self.previousMinigameId, newbieIds=self.newbieIds) else: MinigameCreatorAI.releaseMinigameZone(self.zoneId) self.requestDelete() self.ignoreAll() return None
def trolleyLeft(self): numPlayers = self.countFullSeats() if numPlayers > 0: newbieIds = [] for avId in self.seats: if avId: toon = self.air.doId2do.get(avId) if toon: if Quests.avatarHasTrolleyQuest(toon): if not Quests.avatarHasCompletedTrolleyQuest(toon): newbieIds.append(avId) playerArray = [] for i in self.seats: if i not in [None, 0]: playerArray.append(i) mgDict = MinigameCreatorAI.createMinigame( self.air, playerArray, self.zoneId, newbieIds=newbieIds) minigameZone = mgDict['minigameZone'] minigameId = mgDict['minigameId'] for seatIndex in xrange(len(self.seats)): avId = self.seats[seatIndex] if avId: self.sendUpdateToAvatarId(avId, 'setMinigameZone', [minigameZone, minigameId]) self.clearFullNow(seatIndex) else: self.notify.warning('The trolley left, but was empty.') self.enter()
def trolleyLeft(self): numPlayers = self.countFullSeats() if numPlayers > 0: newbieIds = [] for avId in self.seats: if avId: toon = self.air.doId2do.get(avId) if toon: if Quests.avatarHasTrolleyQuest(toon): if not Quests.avatarHasCompletedTrolleyQuest(toon): newbieIds.append(avId) playerArray = [] for i in self.seats: if i not in [None, 0]: playerArray.append(i) startingVotes = None metagameRound = -1 trolleyGoesToMetagame = simbase.config.GetBool('want-travel-game', 0) if trolleyGoesToMetagame: metagameRound = 0 if len(playerArray) == 1: metagameRound = -1 mgDict = MinigameCreatorAI.createMinigame( self.air, playerArray, self.zoneId, newbieIds=newbieIds, startingVotes=startingVotes, metagameRound=metagameRound) minigameZone = mgDict['minigameZone'] minigameId = mgDict['minigameId'] for seatIndex in xrange(len(self.seats)): avId = self.seats[seatIndex] if avId: self.sendUpdateToAvatarId(avId, 'setMinigameZone', [minigameZone, minigameId]) self.clearFullNow(seatIndex) else: self.notify.warning('The trolley left, but was empty.') self.enter()
def shutDown(self): if self.isShutdown: self.notify.warning('Got shutDown twice') return self.isShutdown = 1 from toontown.minigame import MinigameCreatorAI playAgainNum = self.getNumPlayAgain() if playAgainNum > 0: MinigameCreatorAI.createMinigame( self.air, self.getPlayAgainList(), self.trolleyZone, minigameZone=self.zoneId, previousGameId=self.previousMinigameId, newbieIds=self.newbieIds) else: MinigameCreatorAI.releaseMinigameZone(self.zoneId) self.requestDelete() self.ignoreAll() return None
def trolleyLeft(self): numPlayers = self.countFullSeats() if numPlayers > 0: newbieIds = [] for avId in self.seats: if avId: toon = self.air.doId2do.get(avId) if toon: if Quests.avatarHasTrolleyQuest(toon): if not Quests.avatarHasCompletedTrolleyQuest(toon): newbieIds.append(avId) playerArray = [] for i in self.seats: if i not in [None, 0]: playerArray.append(i) continue startingVotes = None metagameRound = -1 trolleyGoesToMetagame = simbase.config.GetBool( 'trolley-goes-to-metagame', 0) trolleyHoliday = bboard.get( TrolleyHolidayMgrAI.TrolleyHolidayMgrAI.PostName) trolleyWeekend = bboard.get( TrolleyWeekendMgrAI.TrolleyWeekendMgrAI.PostName) if trolleyGoesToMetagame and trolleyHoliday or trolleyWeekend: metagameRound = 0 if simbase.config.GetBool('metagame-min-2-players', 1) and len(playerArray) == 1: metagameRound = -1 mgDict = MinigameCreatorAI.createMinigame( self.air, playerArray, self.zoneId, newbieIds=newbieIds, startingVotes=startingVotes, metagameRound=metagameRound) minigameZone = mgDict['minigameZone'] minigameId = mgDict['minigameId'] for seatIndex in range(len(self.seats)): avId = self.seats[seatIndex] if avId: self.sendUpdateToAvatarId(avId, 'setMinigameZone', [minigameZone, minigameId]) self.clearFullNow(seatIndex) continue else: self.notify.warning('The trolley left, but was empty.') self.enter()
def trolleyLeft(self): numPlayers = self.countFullSeats() if numPlayers > 0: newbieIds = [] for avId in self.seats: if avId: toon = self.air.doId2do.get(avId) if toon: if Quests.avatarHasTrolleyQuest(toon): if not Quests.avatarHasCompletedTrolleyQuest(toon): newbieIds.append(avId) playerArray = [] for i in self.seats: if i not in [None, 0]: playerArray.append(i) startingVotes = None metagameRound = -1 trolleyGoesToMetagame = simbase.config.GetBool('trolley-goes-to-metagame', 0) trolleyHoliday = bboard.get(TrolleyHolidayMgrAI.TrolleyHolidayMgrAI.PostName) trolleyWeekend = bboard.get(TrolleyWeekendMgrAI.TrolleyWeekendMgrAI.PostName) if trolleyGoesToMetagame or trolleyHoliday or trolleyWeekend: metagameRound = 0 if simbase.config.GetBool('metagame-min-2-players', 1) and len(playerArray) == 1: metagameRound = -1 mgDict = MinigameCreatorAI.createMinigame(self.air, playerArray, self.zoneId, newbieIds=newbieIds, startingVotes=startingVotes, metagameRound=metagameRound) minigameZone = mgDict['minigameZone'] minigameId = mgDict['minigameId'] for seatIndex in range(len(self.seats)): avId = self.seats[seatIndex] if avId: self.sendUpdateToAvatarId(avId, 'setMinigameZone', [minigameZone, minigameId]) self.clearFullNow(seatIndex) else: self.notify.warning('The trolley left, but was empty.') self.enter() return
def trolleyLeft(self): numPlayers = self.countFullSeats() if numPlayers > 0: newbieIds = [] for avId in self.seats: if avId: toon = self.air.doId2do.get(avId) if toon: if Quests.avatarHasTrolleyQuest(toon): if not Quests.avatarHasCompletedTrolleyQuest(toon): newbieIds.append(avId) playerArray = [] for i in self.seats: if i not in [None, 0]: playerArray.append(i) startingVotes = None metagameRound = -1 trolleyGoesToMetagame = simbase.config.GetBool('want-travel-game', 0) trolleyHoliday = simbase.air.holidayManager.isHolidayRunning(TROLLEY_HOLIDAY) or\ simbase.air.holidayManager.isHolidayRunning(SILLY_SATURDAY_TROLLEY) trolleyWeekend = simbase.air.holidayManager.isHolidayRunning(TROLLEY_WEEKEND) if trolleyGoesToMetagame and (trolleyHoliday or trolleyWeekend): metagameRound = 0 if len(playerArray) == 1: metagameRound = -1 mgDict = MinigameCreatorAI.createMinigame( self.air, playerArray, self.zoneId, newbieIds=newbieIds, startingVotes=startingVotes, metagameRound=metagameRound) minigameZone = mgDict['minigameZone'] minigameId = mgDict['minigameId'] for seatIndex in xrange(len(self.seats)): avId = self.seats[seatIndex] if avId: self.sendUpdateToAvatarId(avId, 'setMinigameZone', [minigameZone, minigameId]) self.clearFullNow(seatIndex) else: self.notify.warning('The trolley left, but was empty.') self.enter()
def trolleyLeft(self): numPlayers = self.countFullSeats() # It is possible the players exited the district if (numPlayers > 0): # create a list of ids of players that have never ridden the # trolley, before we inform the quest manager that they've # ridden newbieIds = [] for avId in self.seats: if avId: toon = self.air.doId2do.get(avId) if toon: if Quests.avatarHasTrolleyQuest(toon): if not Quests.avatarHasCompletedTrolleyQuest(toon): newbieIds.append(avId) """ This was moved to NewbiePurchaseManagerAI. We want to make sure that newbies go through the gag tutorial. Therefore we only mark their quest as complete when they exit the tutorial purchase screen through normal means. toonRodeTrolley() was only being used for the single first-time trolley quest, so I renamed it to toonRodeTrolleyFirstTime() and only call it from the newbie PurchaseMgr. # Update the quest manager in case any toon had a trolley quest for avId in self.seats: if avId: toon = self.air.doId2do.get(avId) self.air.questManager.toonRodeTrolley(toon) """ # Make a nice list for the minigame playerArray = [] for i in self.seats: if i not in [None, 0]: playerArray.append(i) # Create a minigame startingVotes = None metagameRound = -1 trolleyGoesToMetagame = simbase.config.GetBool('trolley-goes-to-metagame', 0) trolleyHoliday = bboard.get( TrolleyHolidayMgrAI.TrolleyHolidayMgrAI.PostName) trolleyWeekend = bboard.get( TrolleyWeekendMgrAI.TrolleyWeekendMgrAI.PostName) if trolleyGoesToMetagame or trolleyHoliday or trolleyWeekend: metagameRound = 0 if simbase.config.GetBool('metagame-min-2-players', 1) and \ len(playerArray) == 1: # but if there's only 1, bring it back to a regular minigame metagameRound = -1 mgDict = MinigameCreatorAI.createMinigame(self.air, playerArray, self.zoneId, newbieIds=newbieIds, startingVotes = startingVotes, metagameRound = metagameRound) minigameZone = mgDict["minigameZone"] minigameId = mgDict["minigameId"] for seatIndex in range(len(self.seats)): avId = self.seats[seatIndex] # Tell each player on the trolley that they should enter the # minigame now. if avId: assert(avId > 0) self.sendUpdateToAvatarId(avId, "setMinigameZone", [minigameZone, minigameId]) # Clear the fill slot self.clearFullNow(seatIndex) else: self.notify.warning("The trolley left, but was empty.") # Switch back into entering mode. self.enter()