def toonJoinRequest(self, team): av = self._getCaller() if not av: return if not self.fsm.state in ('WaitForEnough', 'WaitToStart'): self.sendUpdateToAvatarId(av.doId, 'joinTeamRequestDenied', [PartyGlobals.DenialReasons.Default]) return if len(self.toonIds[team]) >= self.getPlayersPerTeam()[1]: self.sendUpdateToAvatarId(av.doId, 'joinTeamRequestDenied', [PartyGlobals.DenialReasons.Full]) return if av.doId in self.toonsPlaying: self.air.writeServerEvent( 'suspicious', av.doId, 'tried to join party team activity again!') self.sendUpdateToAvatarId(av.doId, 'joinTeamRequestDenied', [PartyGlobals.DenialReasons.Default]) return # idgaf if they exit unexpectedly in this case self.toonIds[team].append(av.doId) DistributedPartyActivityAI.toonJoinRequest(self) self.__update()
def __init__(self, air, partyDoId, x, y, h, eventId=PartyGlobals.FireworkShows.Summer, showStyle=0): """ air: instance of ToontownAIRepository eventId: a PartyGlobals.FireworkShows value that tells us which show to run """ DistributedPartyFireworksActivityAI.notify.debug("__init__") DistributedPartyActivityAI.__init__( self, air, partyDoId, x, y, h, PartyGlobals.ActivityIds.PartyFireworks, PartyGlobals.ActivityTypes.HostInitiated, ) self.eventId = eventId self.showStyle = showStyle self.activityFSM = FireworksActivityFSM(self)
def toonExitRequest(self, team): av = self._getCaller() if not av: return if not self.fsm.state in ('WaitForEnough', 'WaitToStart'): self.sendUpdateToAvatarId(av.doId, 'exitRequestDenied', [PartyGlobals.DenialReasons.Default]) return if not (av.doId in self.toonIds[0] or av.doId in self.toonIds[1]): self.air.writeServerEvent('suspicious', avId, 'tried to switch DistributedPartyActivityAI team, but not in one') self.sendUpdateToAvatarId(av.doId, 'exitRequestDenied', [PartyGlobals.DenialReasons.Default]) return currentTeam = (1, 0)[av.doId in self.toonIds[0]] self.toonIds[currentTeam].remove(av.doId) DistributedPartyActivityAI.toonExitRequest(self) self.__update()
def toonJoinRequest(self, team): av = self._getCaller() if not av: return if not self.fsm.state in ('WaitForEnough', 'WaitToStart'): self.sendUpdateToAvatarId(av.doId, 'joinTeamRequestDenied', [PartyGlobals.DenialReasons.Default]) return if len(self.toonIds[team]) >= self.getPlayersPerTeam()[1]: self.sendUpdateToAvatarId(av.doId, 'joinTeamRequestDenied', [PartyGlobals.DenialReasons.Full]) return if av.doId in self.toonsPlaying: self.air.writeServerEvent('suspicious', av.doId, 'tried to join party team activity again!') self.sendUpdateToAvatarId(av.doId, 'joinTeamRequestDenied', [PartyGlobals.DenialReasons.Default]) return # idgaf if they exit unexpectedly in this case self.toonIds[team].append(av.doId) DistributedPartyActivityAI.toonJoinRequest(self) self.__update()
def announceGenerate(self): self.b_setState('WaitForEnough') DistributedPartyActivityAI.announceGenerate(self)
def __init__(self, air, parent, activityTuple): self.toonIds = ([], []) self.responses = set() self.fsm = TeamActivityAIFSM(self) DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
def delete(self): DistributedPartyFireworksActivityAI.notify.debug("delete") if hasattr(self, 'activityFSM'): self.activityFSM.request('Disabled') del self.activityFSM DistributedPartyActivityAI.delete(self)