def generateWithRequired(self, zoneId):
        DistributedObjectAI.generateWithRequired(self, zoneId)

        self.npc = NPCToons.createNPC(self.air, self.npcId,
                                      NPCToons.NPCToonDict[self.npcId],
                                      self.zoneId)
        self.npc.setScienceFair(self)
    def __init__(self, air, hostId, zoneId, partyInfo):
        DistributedObjectAI.__init__(self, air)

        self.hostId = hostId
        self.zoneId = zoneId
        self.partyInfo = partyInfo

        self.startTime = datetime.strftime(datetime.now(ToontownTimeZone()), '%Y-%m-%d %H:%M:%S')
        self.partyState = PartyGlobals.PartyStatus.Pending
        self.participants = []

        for activity in self.partyInfo['activities']:
            if activity[0] == PartyGlobals.ActivityIds.PartyClock:
                self.partyClockInfo = (activity[1], activity[2], activity[3])

        self.hostName = ''
        self.cannonActivityGenerated = 0

        host = self.air.doId2do.get(self.hostId)
        if host is not None:
            self.hostName = host.getName()
        else:
            self.air.dbInterface.queryObject(self.air.dbId, self.hostId, self.__gotHost)

        self.activities = []
    def generate(self):
        DistributedObjectAI.generate(self)

        for activityInfo in self.partyInfo['activities']:

            if activityInfo[0] not in self.ACTIVITIES:
                self.notify.warning('Tried to generate invalid activity %s' % activityInfo[0])
                continue

            if activityInfo[0] == PartyGlobals.ActivityIds.PartyCannon:
                if not self.cannonActivityGenerated:
                    self.cannonActivity = DistributedPartyCannonActivityAI(self.air, self, activityInfo)
                    self.cannonActivity.generateWithRequired(self.zoneId)
                    self.cannonActivityGenerated = 1

                activity = DistributedPartyCannonAI(self.air)
                activity.setActivityDoId(self.cannonActivity.doId)
                x = PartyUtils.convertDistanceFromPartyGrid(activityInfo[1], 0)
                y = PartyUtils.convertDistanceFromPartyGrid(activityInfo[2], 1)
                h = activityInfo[3] * PartyGlobals.PartyGridHeadingConverter
                activity.setPosHpr(x, y, 0, h, 0, 0)
            else:
                activity = self.ACTIVITIES[activityInfo[0]](self.air, self, activityInfo)

            activity.generateWithRequired(self.zoneId)
            self.activities.append(activity)
    def announceGenerate(self):
        DistributedObjectAI.announceGenerate(self)

        # We want to handle shard status queries so that a ShardStatusReceiver
        # being created after we're generated will know where we're at:
        self.air.accept('queryShardStatus', self.handleShardStatusQuery)
        taskMgr.doMethodLater(15, self.__countGroups, self.uniqueName('countGroups'))
 def delete(self):
     self._interior.removeGameFSM(self.fsm)
     self._interior = None
     self.fsm = None
     self.loadFSM = None
     DistributedObjectAI.delete(self)
     return
    def __init__(self, air):
        DistributedObjectAI.__init__(self, air)
        self.toons = [0, 0, 0, 0, 0, 0]
        self.items = [[], [], [], [], [], []]
        self.decorData = []
        self.estateType = 0 # NOT SURE IF THIS HAS ANY USE BUT THANKS DISNEY
        self.cloudType = 0
        self.dawnTime = 0
        self.lastEpochTimestamp = 0
        self.rentalTimestamp = 0
        self.houses = [None] * 6
        
        self.pond = None
        self.spots = []
        
        self.targets = []

        self.owner = None
        
        self.info = info
        self.activities = []
        self.cannonActivity = None
        self.avIdsAtParty = []
        
        for activity in self.info['activities']:
            if activity[0] == ActivityIds.PartyClock:
                self.partyClockInfo = (activity[1], activity[2], activity[3])
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     FSM.__init__(self, 'AnimProp')
     self.state = 'Attract'
     self.lastTime = globalClockDelta.getRealNetworkTime()
     self.propId = 0
     self.currentAvatar = 0
    def announceGenerate(self):
        DistributedObjectAI.announceGenerate(self)

        self.sendUpdate('setState', ['vaultClosed', 0])

        delay = 3600 - (int(time.time()) % 3600)  # Time until the next hour.
        taskMgr.doMethodLater(delay, self.createBankCollectable, 'createBankCollectable')
Esempio n. 9
0
    def __init__(self, air):
        DistributedObjectAI.__init__(self, air)
        self.gameActive = True
        self.winners = []
        self.artPaintings = []
        self.nextGameId = 0
        self.timeout = globalClock.getFrameTime() + Globals.GameLengthSeconds
        self.expireTask = taskMgr.doMethodLater(Globals.GameLengthSeconds, self.expireGame, 'expireGame')
        self.deleteGameTask = None

        # Get a unique zoneId to put game objects (like the players)
        # in.
        self.objZone = self.air.zoneAllocator.allocate()

        self.maxNumPlayers = 0

        # Player ID's in the game.
        self.playerIds = []

        # Player ID's about to join the game.
        self.waitingIds = []

        # Mapping of player url -> server url for player posters.
        self.playerPosterMap = {}

        self.accept('newPlayer', self.newPlayer)
        self.accept('deletePlayer', self.deletePlayer)
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     self.avId = None
     self.pondDoId = None
     self.posHpr = [None, None, None, None, None, None]
     self.cast = False
     self.lastFish = [None, None, None, None]
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     self.air = air
     self.currentContext = 0
     self.requests = {}
     self.tfCodes = {}
     taskMgr.add(self.__tfCodesTask, 'TrueFriendsCodesClearTask')
Esempio n. 12
0
    def announceGenerate(self):
        DistributedObjectAI.announceGenerate(self)
        self.interiorZone = self.air.allocateZone()

        self.door = DistributedHouseDoorAI(self.air, self.getDoId(), DoorTypes.EXT_STANDARD)
        self.door.setSwing(3)
        self.door.generateWithRequired(self.zoneId)

        self.interiorDoor = DistributedHouseDoorAI(self.air, self.getDoId(), DoorTypes.INT_STANDARD)
        self.interiorDoor.setSwing(3)
        self.interiorDoor.setOtherDoor(self.door)
        self.interiorDoor.generateWithRequired(self.interiorZone)

        self.door.setOtherDoor(self.interiorDoor)

        self.interior = DistributedHouseInteriorAI(self.air, self)
        self.interior.setHouseIndex(self.housePos)
        self.interior.setHouseId(self.getDoId())
        self.interior.generateWithRequired(self.interiorZone)

        if self.avatarId:
            self.mailbox = DistributedMailboxAI(self.air, self)
            self.mailbox.generateWithRequired(self.zoneId)

        if not self.isInteriorInitialized:
            self.notify.info('Initializing interior...')
            self.interior.initialize()
            self.b_setInteriorInitialized(1)

        self.sendUpdate('setHouseReady', [])
Esempio n. 13
0
    def announceGenerate(self):
        DistributedObjectAI.announceGenerate(self)

        self.finishEvent = self.uniqueName("CogdoMazeGameDone")
        self.gameOverEvent = self.uniqueName("CogdoMazeGameLose")

        self.resetRequests()
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     self.air = air
     self.pad = None
     self.currentMovie = False
     self.avId = 0
     self.posHpr = [0, 0, 0, 0, 0, 0]
 def announceGenerate(self):
     DistributedObjectAI.announceGenerate(self)
     self._contextGen = SerialMaskedGen((1 << 32) - 1)
     self._requests = {}
     self._sampleTask = self.doMethodLater(
         3 * 60, self._sampleRandomTask, self.uniqueName('sampleRandom'))
     self._sampleRandom()
Esempio n. 16
0
    def __init__(self, air):
        DistributedObjectAI.__init__(self, air)
        self.name = None
        self.color = None
        self.score = 0
        self.artBonus = 0
        self.game = None
        self.gameId = 0
        self.avId = 0
        self.scoreDirty = False

        # The player's poster, if set.  This can be set either from
        # the AI side, or from the client side through the normal
        # DistributedObject channels (it is set directly to the server
        # via a separate POST operation, since JavaScript can't read a
        # file locally).
        self.posterData = ('', 0)

        # The cell onto which this player's poster is/will be applied.
        self.posterCell = None

        self.updateScoreTask = None

        # Which cell the player's avatar appears to be standing in.
        self.cellLocation = None

        # A dictionary of other player avatars we've painted on.
        self.paintedAvatars = {}

        # Cells that we've painted.
        self.paintedCells = []

        self.accept('deleteAvatar', self.deleteAvatar)
    def delete(self):
        self.ignore('leaderboardChanged')
        self.ignore('leaderboardFlush')
        self.ignore('setLeaderBoard')
        self.ignore('AIStarted')

        DistributedObjectAI.delete(self)
Esempio n. 18
0
    def __init__(self, air):
        DistributedObjectAI.__init__(self, air)

        self.estate2toons = {}
        self.toon2estate = {}
        self.estate2timeout = {}
        self.zoneId2owner = {}
Esempio n. 19
0
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     self.air = air
     self.currentContext = 0
     self.requests = {}
     self.tfFsms = {}
     self.connectToDatabase()
    def delete(self):
        for act in self.activities:
            act.requestDelete()

        if self.cannonActivity:
            self.cannonActivity.requestDelete()
        DistributedObjectAI.delete(self)
    def announceGenerate(self):
        if self.air.newsManager.isHolidayRunning(ToontownGlobals.FISH_BINGO, ToontownGlobals.SILLY_SATURDAY):
            self.startBingo()

        self.accept('startBingo', self.startBingo)
        self.accept('stopBingo', self.stopBingo)
        DistributedObjectAI.announceGenerate(self)
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     # Define the default events we want for this year
     self.events = [EventRandomDialogue,
                    EventRandomEffects,
                    EventEstateGravity,
                    EventGlobalGravity]
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     self.toons = [0,
      0,
      0,
      0,
      0,
      0]
     self.items = [[],
      [],
      [],
      [],
      [],
      []]
     self.decorData = []
     self.estateType = 0
     self.cloudType = 0
     self.dawnTime = 0
     self.lastEpochTimestamp = 0
     self.rentalTimestamp = 0
     self.houses = [None] * 6
     self.pond = None
     self.spots = []
     self.targets = []
     self.treasurePlanner = None
     self.rentalType = 0
     self.rentalHandle = None
     self.targets = []
     self.owner = None
Esempio n. 24
0
 def announceGenerate(self):
     DistributedObjectAI.announceGenerate(self)
     self.suitManager = DistributedSuitManagerAI(self.air)
     self.suitManager.setBattle(self)
     self.suitManager.generateWithRequired(self.zoneId)
     self.turretMgr = DistributedPieTurretManagerAI(self.air)
     self.turretMgr.generateWithRequired(self.zoneId)
 def generate(self):
     DistributedObjectAI.generate(self)
     actId2Class = {
         ActivityIds.PartyJukebox: DistributedPartyJukeboxActivityAI,
         ActivityIds.PartyTrampoline: DistributedPartyTrampolineActivityAI,
         ActivityIds.PartyVictoryTrampoline: DistributedPartyVictoryTrampolineActivityAI,
         ActivityIds.PartyCatch: DistributedPartyCatchActivityAI,
         ActivityIds.PartyDance: DistributedPartyDanceActivityAI, 
         ActivityIds.PartyTugOfWar: DistributedPartyTugOfWarActivityAI,
         ActivityIds.PartyFireworks: DistributedPartyFireworksActivityAI,
         ActivityIds.PartyJukebox40: DistributedPartyJukebox40ActivityAI,
         ActivityIds.PartyDance20: DistributedPartyDance20ActivityAI,
         ActivityIds.PartyCog: DistributedPartyCogActivityAI,
     }
     for activity in self.info['activities']:
         actId = activity[0]
         if actId in actId2Class:
             act = actId2Class[actId](self.air, self.doId, activity)
             act.generateWithRequired(self.zoneId)
             self.activities.append(act)
         elif actId == ActivityIds.PartyCannon:
             if not self.cannonActivity:
                 self.cannonActivity = DistributedPartyCannonActivityAI(self.air, self.doId, activity)
                 self.cannonActivity.generateWithRequired(self.zoneId)
             act = DistributedPartyCannonAI(self.air)
             act.setActivityDoId(self.cannonActivity.doId)
             x, y, h = activity[1:]
             x = PartyUtils.convertDistanceFromPartyGrid(x, 0)
             y = PartyUtils.convertDistanceFromPartyGrid(y, 1)
             h *= PartyGridHeadingConverter
             act.setPosHpr(x,y,0,h,0,0)
             act.generateWithRequired(self.zoneId)
             self.activities.append(act)
    def __init__(self, block, air, zoneId):
        DistributedObjectAI.__init__(self, air)

        self.block = block
        self.zoneId = zoneId

        self.bankCollectable = None
    def __init__(self, air):
        DistributedObjectAI.__init__(self, air)

        self.area = None
        self.targets = {}
        self.spots = {}
        self.bingoMgr = None
Esempio n. 28
0
 def delete(self):
     self.door.requestDelete()
     self.interiorDoor.requestDelete()
     self.interior.requestDelete()
     if self.avatarId:
         self.mailbox.requestDelete()
     self.air.deallocateZone(self.interiorZone)
     DistributedObjectAI.delete(self)
    def __init__(self, air):
        DistributedObjectAI.__init__(self, air)
        FSM.__init__(self, 'DistributedTrolleyAI')

        self.trolleyCountdownTime = config.GetFloat('trolley-countdown-time', TROLLEY_COUNTDOWN_TIME)

        self.slots = [None, None, None, None]
        self.boardable = False
 def __init__(self, air, parent, activityTuple):
     DistributedObjectAI.__init__(self, air)
     self.parent = parent
     x, y, h = activityTuple[1:] # ignore activity ID
     self.x = PartyUtils.convertDistanceFromPartyGrid(x, 0)
     self.y = PartyUtils.convertDistanceFromPartyGrid(y, 1)
     self.h = h * PartyGlobals.PartyGridHeadingConverter
     self.toonsPlaying = []
Esempio n. 31
0
    def __init__(self, air, teleportMgr, teleportFsm, avatar):
        DistributedObjectAI.__init__(self, air)

        self.teleportMgr = teleportMgr
        self.avatar = avatar
        self.teleportFsm = teleportFsm
    def delete(self):
        for item in self.items:
            item.destroy()

        DistributedObjectAI.delete(self)
    def __init__(self, air):
        DistributedObjectAI.__init__(self, air)
        self.zoneAllocator = self.air.zoneAllocator

        self.currentAllocatedZones = {}
	def generate(self):
		DistributedObjectAI.generate(self)
	def avatarEnter(self):
		DistributedObjectAI.avatarEnter(self)
    def __init__(self, air):
        DistributedObjectAI.__init__(self, air)
        FSM.__init__(self, self.__class__.__name__)

        self.participants = []
Esempio n. 37
0
    def __init__(self, air):
        DistributedObjectAI.__init__(self, air)

        self.avId2fsm = {}
Esempio n. 38
0
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     self.area = None
Esempio n. 39
0
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     self.leaderInfo = ([], [], [])
    def announceGenerate(self):
        DistributedObjectAI.announceGenerate(self)

        taskMgr.add(self.__updateTask, self.uniqueName('battleZoneUpdate'))
Esempio n. 41
0
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     FSM.__init__(self, 'GreenToonFSM')
     self.air = air
Esempio n. 42
0
    def __init__(self, air):
        DistributedObjectAI.__init__(self, air)

        backup = self.load()
        self.leaderInfo = backup[0]
        self.trophyScores = backup[1]
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     self.name = ''
     self.available = False
Esempio n. 44
0
    def announceGenerate(self):
        DistributedObjectAI.announceGenerate(self)

        # We want to handle shard status queries so that a ShardStatusReceiver
        # being created after we're generated will know where we're at:
        self.air.netMessenger.accept('queryShardStatus', self, self.handleShardStatusQuery)
Esempio n. 45
0
    def announceGenerate(self):
        DistributedObjectAI.announceGenerate(self)

        self.accept('avatarEntered', self.__handleAvatarEntered)
Esempio n. 46
0
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     self.districtId = 0
     self.avatarCount = 0
     self.newAvatarCount = 0
     self.invasionStatus = 0
	def avatarExit(self):
		DistributedObjectAI.avatarExit(self)
Esempio n. 48
0
 def announceGenerate(self):
     DistributedObjectAI.announceGenerate(self)
     taskMgr.doMethodLater(10, self.__startGame, self.uniqueName('startGame'))
 def __init__(self, block, air, zoneId):
     DistributedObjectAI.__init__(self, air)
     self.zoneId = zoneId
     self.block = block
     self.tutorialNpcId = 0
Esempio n. 50
0
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     self.enabled = 0
     self.power = 0
     self.time = 0
     self.highScore = 0
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     self.av2tut = {}
Esempio n. 52
0
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     self.setStartTime(globalClockDelta.getRealNetworkTime(bits=32))
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     FSM.__init__(self, 'ResistanceFSM')
     self.air = air
 def delete(self):
     self.roomList = []
     DistributedObjectAI.delete(self)
 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
    def announceGenerate(self):
        DistributedObjectAI.announceGenerate(self)

        for item in self.items:
            item.generateWithRequired(self.zoneId)
    def announceGenerate(self):
        DistributedObjectAI.announceGenerate(self)

        self.furnitureManager.generateWithRequired(self.zoneId)
    def delete(self):
        DistributedObjectAI.delete(self)

        self.furnitureManager.delete()
    def generate(self):
        DistributedObjectAI.generate(self)

        self.updateIndicatorFlag()
Esempio n. 60
0
 def announceGenerate(self):
     DistributedObjectAI.announceGenerate(self)