def handleConnected(self):
        ToontownInternalRepository.handleConnected(self)
        self.districtId = self.allocateChannel()
        self.notify.info('Creating new district (%d)...' % self.districtId)
        self.distributedDistrict = ToontownDistrictAI(self)
        self.distributedDistrict.setName(self.districtName)
        self.distributedDistrict.generateWithRequiredAndId(
            self.districtId, self.getGameDoId(), 2)

        # Claim ownership of that district...
        self.notify.info('Claiming ownership of district (%d)...' %
                         self.districtId)
        dg = PyDatagram()
        dg.addServerHeader(self.districtId, self.ourChannel,
                           STATESERVER_OBJECT_SET_AI)
        dg.addChannel(self.ourChannel)
        self.send(dg)
        self.notify.info('Creating global objects...')
        self.createGlobals()
        self.notify.info('Creating zones (Playgrounds and Cog HQs)...')
        self.createZones()

        self.statusSender.start()
        self.notify.info('Making district available to enter...')
        self.distributedDistrict.b_setAvailable(1)
        self.notify.info('District is now ready. Have fun in Toontown!')
Exemplo n.º 2
0
    def handleConnected(self):
        ToontownInternalRepository.handleConnected(self)

        # Generate our district...
        self.districtId = self.allocateChannel()
        self.district = ToontownDistrictAI(self)
        self.district.setName(self.districtName)
        self.district.generateWithRequiredAndId(self.districtId,
                                                self.getGameDoId(),
                                                OTP_ZONE_ID_DISTRICTS)

        # Claim ownership of that district...
        self.district.setAI(self.ourChannel)

        # Create our local objects.
        self.createLocals()

        # Create our global objects.
        self.createGlobals()

        # Create our zones.
        self.createZones()

        # Make our district available, and we're done.
        self.district.b_setAvailable(True)
        self.notify.info('Done.')
    def handleConnected(self):
        self.districtId = self.allocateChannel()
        self.notify.info('Creating ToontownDistrictAI(%d)...' %
                         self.districtId)
        self.distributedDistrict = ToontownDistrictAI(self)
        self.distributedDistrict.setName(self.districtName)
        self.distributedDistrict.generateWithRequiredAndId(
            self.districtId, self.getGameDoId(), 2)
        self.notify.info('Claiming ownership of channel ID: %d...' %
                         self.districtId)
        self.claimOwnership(self.districtId)

        self.districtStats = ToontownDistrictStatsAI(self)
        self.districtStats.settoontownDistrictId(self.districtId)
        self.districtStats.generateWithRequiredAndId(self.allocateChannel(),
                                                     self.getGameDoId(), 3)
        self.notify.info('Created ToontownDistrictStats(%d)' %
                         self.districtStats.doId)

        self.notify.info('Creating managers...')
        self.createManagers()
        if self.config.GetBool('want-safe-zones', True):
            self.notify.info('Creating safe zones...')
            self.createSafeZones()
        if self.config.GetBool('want-cog-headquarters', True):
            self.notify.info('Creating Cog headquarters...')
            self.createCogHeadquarters()

        self.notify.info('Starting Holiday Manager...')
        self.holidayManager.start()

        self.notify.info('Making district available...')
        self.distributedDistrict.b_setAvailable(1)
        self.notify.info('Done.')
Exemplo n.º 4
0
    def handleConnected(self):
        self.notify.info('Yarn. Waking up (This may take a while!).')
        ToontownInternalRepository.handleConnected(self)
        self.districtId = self.allocateChannel()
        self.distributedDistrict = ToontownDistrictAI(self)
        self.distributedDistrict.setName(self.districtName)
        self.distributedDistrict.generateWithRequiredAndId(
            self.districtId, self.getGameDoId(), 2)

        # Claim ownership of that district...
        dg = PyDatagram()
        dg.addServerHeader(self.districtId, self.ourChannel,
                           STATESERVER_OBJECT_SET_AI)
        dg.addChannel(self.ourChannel)
        self.send(dg)

        self.notify.info('Creating Global Managers')
        self.createGlobals()
        self.notify.info('Creating Toontown')
        self.createZones()

        self.statusSender.start()

        self.distributedDistrict.b_setAvailable(1)
        self.notify.info('District is now ready.')
Exemplo n.º 5
0
 def handleConnected(self):
     ToontownInternalRepository.handleConnected(self)
     self.districtId = self.allocateChannel()
     self.notify.info('Creating district (%d)...' % self.districtId)
     self.district = ToontownDistrictAI(self)
     self.district.setName(self.districtName)
     self.district.setDescription(self.districtDescription)
     self.district.generateWithRequiredAndId(self.districtId,
                                             self.getGameDoId(),
                                             OTP_ZONE_ID_MANAGEMENT)
     self.notify.info('Claiming ownership of district (%d)...' %
                      self.districtId)
     datagram = PyDatagram()
     datagram.addServerHeader(self.districtId, self.ourChannel,
                              STATESERVER_OBJECT_SET_AI)
     datagram.addChannel(self.ourChannel)
     self.send(datagram)
     self.notify.info('Creating local objects...')
     self.createLocals()
     self.notify.info('Creating global objects...')
     self.createGlobals()
     self.notify.info('Creating zones (Playgrounds and Cog HQs)...')
     self.createZones()
     self.notify.info('Making district available...')
     self.district.b_setAvailable(1)
     self.notify.info(
         'District is now ready. Have fun in Toontown Offline!')
Exemplo n.º 6
0
 def handleConnected(self):
     self.districtId = self.allocateChannel()
     self.notify.info('Creating ToontownDistrictAI(%d)...' % self.districtId)
     self.distributedDistrict = ToontownDistrictAI(self)
     self.distributedDistrict.setName(self.districtName)
     self.distributedDistrict.generateWithRequiredAndId(self.districtId, self.getGameDoId(), 2)
     self.notify.info('Claiming ownership of channel ID: %d...' % self.districtId)
     self.setAI(self.districtId, self.ourChannel)
     self.districtStats = ToontownDistrictStatsAI(self)
     self.districtStats.settoontownDistrictId(self.districtId)
     self.districtStats.generateWithRequiredAndId(self.allocateChannel(), self.getGameDoId(), 3)
     self.notify.info('Created ToontownDistrictStats(%d)' % self.districtStats.doId)
     self.notify.info('Creating managers...')
     self.createManagers()
     if self.config.GetBool('want-safe-zones', True):
         self.notify.info('Creating safe zones...')
         self.createSafeZones()
     if self.config.GetBool('want-cog-headquarters', True):
         self.notify.info('Creating Cog headquarters...')
         self.createCogHeadquarters()
     self.notify.info('Making district available...')
     self.distributedDistrict.b_setAvailable(1)
     self.notify.info('Done.')
     self.notify.info('Starting Invasion Tracker...')
     taskMgr.doMethodLater(2, self.updateInvasionTrackerTask, 'updateInvasionTracker-%d' % self.ourChannel)
     self.notify.info('Invasion Tracker Started!')
    def handleConnected(self):
        self.districtId = self.allocateChannel()
        self.distributedDistrict = ToontownDistrictAI(self)
        self.distributedDistrict.setName(self.districtName)
        self.distributedDistrict.generateWithRequiredAndId(
            simbase.air.districtId, self.getGameDoId(), 2)

        dg = PyDatagram()
        dg.addServerHeader(simbase.air.districtId, simbase.air.ourChannel,
                           STATESERVER_OBJECT_SET_AI)
        dg.addChannel(simbase.air.ourChannel)
        simbase.air.send(dg)

        self.createGlobals()
        self.createZones()
Exemplo n.º 8
0
    def handleConnected(self):
        ToontownInternalRepository.handleConnected(self)

        # Generate our district...
        self.districtId = self.allocateChannel()
        self.notify.info('Creating district (%d)...' % self.districtId)
        self.district = ToontownDistrictAI(self)
        self.district.setName(self.districtName)
        self.district.generateWithRequiredAndId(self.districtId,
                                                self.getGameDoId(),
                                                OTP_ZONE_ID_MANAGEMENT)

        # Claim ownership of that district...
        self.notify.info('Claiming ownership of district (%d)...' %
                         self.districtId)
        datagram = PyDatagram()
        datagram.addServerHeader(self.districtId, self.ourChannel,
                                 STATESERVER_OBJECT_SET_AI)
        datagram.addChannel(self.ourChannel)
        self.send(datagram)

        # Create our local objects.
        self.notify.info('Creating local objects...')
        self.createLocals()

        # Create our global objects.
        self.notify.info('Creating global objects...')
        self.createGlobals()

        # Create our zones.
        self.notify.info('Creating zones (Playgrounds and Cog HQs)...')
        self.createZones()

        # Make our district available, and we're done.
        self.notify.info('Get your districts in, and...')
        self.district.b_setAvailable(1)
        self.notify.info(
            'Districts are now complete. NOW PLAY TOONTOWN MYSTERY OR ELSE!!!!!!'
        )
Exemplo n.º 9
0
 def handleConnected(self):
     ToontownInternalRepository.handleConnected(self)
     if self.holidayPasscode != '':
         self.initServerHoliday()
     self.districtId = self.allocateChannel()
     self.notify.info('Creating district (%d)...' % self.districtId)
     self.distributedDistrict = ToontownDistrictAI(self)
     self.distributedDistrict.setName(self.districtName)
     self.distributedDistrict.setDescription(self.serverDescription)
     self.distributedDistrict.setHolidayPasscode(self.holidayValue)
     self.distributedDistrict.generateWithRequiredAndId(
         self.districtId, self.getGameDoId(), OTP_ZONE_ID_MANAGEMENT)
     self.notify.info('Claiming ownership of district (%d)...' %
                      self.districtId)
     dg = PyDatagram()
     dg.addServerHeader(self.districtId, self.ourChannel,
                        STATESERVER_OBJECT_SET_AI)
     dg.addChannel(self.ourChannel)
     self.send(dg)
     self.notify.info('Creating global objects...')
     self.createGlobals()
     self.notify.info('Creating zones (Playgrounds and Cog HQs)...')
     self.createZones()
Exemplo n.º 10
0
    def createObjects(self):
        # First, load up all of our DNA files for the world.
        self.loadDNA()

        # Create a new district (aka shard) for this AI:
        self.district = ToontownDistrictAI(self, self.districtName)
        self.district.generateOtpObject(OTP_DO_ID_TOONTOWN,
                                        OTP_ZONE_ID_DISTRICTS,
                                        doId=self.districtId)

        # The Time manager.  This negotiates a timestamp exchange for
        # the purposes of synchronizing clocks between client and
        # server with a more accurate handshaking protocol than we
        # would otherwise get.
        #
        # We must create this object first, so clients who happen to
        # come into the world while the AI is still coming up
        # (particularly likely if the AI crashed while players were
        # in) will get a chance to synchronize.
        self.timeManager = TimeManagerAI.TimeManagerAI(self)
        self.timeManager.generateOtpObject(self.district.getDoId(),
                                           OTPGlobals.UberZone)

        self.partyManager = DistributedPartyManagerAI.DistributedPartyManagerAI(
            self)
        self.partyManager.generateOtpObject(self.district.getDoId(),
                                            OTPGlobals.UberZone)

        self.inGameNewsMgr = DistributedInGameNewsMgrAI.DistributedInGameNewsMgrAI(
            self)
        self.inGameNewsMgr.generateOtpObject(self.district.getDoId(),
                                             OTPGlobals.UberZone)

        self.whitelistMgr = DistributedWhitelistMgrAI.DistributedWhitelistMgrAI(
            self)
        self.whitelistMgr.generateOtpObject(self.district.getDoId(),
                                            OTPGlobals.UberZone)

        self.cpuInfoMgr = DistributedCpuInfoMgrAI.DistributedCpuInfoMgrAI(self)
        self.cpuInfoMgr.generateOtpObject(self.district.getDoId(),
                                          OTPGlobals.UberZone)

        #self.securityMgr = DistributedSecurityMgrAI.DistributedSecurityMgrAI(self)
        #self.securityMgr.generateOtpObject(self.district.getDoId(), OTPGlobals.UberZone)

        #if ConfigVariableBool('want-code-redemption', 1).getValue():
        #    self.codeRedemptionManager = TTCodeRedemptionMgrAI(self)
        #    self.codeRedemptionManager.generateOtpObject(self.district.getDoId(), OTPGlobals.UberZone)

        self.randomSourceManager = NonRepeatableRandomSourceAI(self)
        # QuietZone so that the client doesn't get a generate
        self.randomSourceManager.generateOtpObject(self.district.getDoId(),
                                                   OTPGlobals.QuietZone)

        self.welcomeValleyManager = WelcomeValleyManagerAI.WelcomeValleyManagerAI(
            self)
        self.welcomeValleyManager.generateWithRequired(OTPGlobals.UberZone)

        # The trophy manager should be created before the building
        # managers.
        self.trophyMgr = DistributedTrophyMgrAI.DistributedTrophyMgrAI(self)
        self.trophyMgr.generateWithRequired(OTPGlobals.UberZone)

        # The bank manager handles banking transactions
        self.bankMgr = DistributedBankMgrAI.DistributedBankMgrAI(self)
        self.bankMgr.generateWithRequired(OTPGlobals.UberZone)

        # The Friend Manager
        self.friendManager = FriendManagerAI.FriendManagerAI(self)
        self.friendManager.generateWithRequired(OTPGlobals.UberZone)

        # The Delete Manager
        self.deleteManager = DeleteManagerAI.DeleteManagerAI(self)
        self.deleteManager.generateWithRequired(OTPGlobals.UberZone)

        # The Safe Zone manager
        self.safeZoneManager = SafeZoneManagerAI.SafeZoneManagerAI(self)
        self.safeZoneManager.generateWithRequired(OTPGlobals.UberZone)

        # The Magic Word Manager
        magicWordString = ConfigVariableString('want-magic-words',
                                               '1').getValue()
        if magicWordString not in ('', '0', '#f'):
            self.magicWordManager = ToontownMagicWordManagerAI.ToontownMagicWordManagerAI(
                self)
            self.magicWordManager.generateWithRequired(OTPGlobals.UberZone)

        # The Tutorial manager
        self.tutorialManager = TutorialManagerAI.TutorialManagerAI(self)
        self.tutorialManager.generateWithRequired(OTPGlobals.UberZone)

        # The Catalog Manager
        self.catalogManager = CatalogManagerAI.CatalogManagerAI(self)
        self.catalogManager.generateWithRequired(OTPGlobals.UberZone)

        # The Quest manager
        self.questManager = QuestManagerAI.QuestManagerAI(self)

        # The Fish manager
        self.fishManager = FishManagerAI.FishManagerAI(self)

        # The Cog Page manager
        self.cogPageManager = CogPageManagerAI.CogPageManagerAI(self)

        # The Suit Invasion Manager
        self.suitInvasionManager = SuitInvasionManagerAI.SuitInvasionManagerAI(
            self)

        # The Firework Manager: This object really only exists so we can
        # fire off fireworks with magic words. Normally this is a holiday
        # manager driven event and therefore the constructor needs a
        # holidayId. Pass in fourth of july as default.  To do: override
        # holiday ID with a magic word
        self.fireworkManager = FireworkManagerAI.FireworkManagerAI(
            self, NEWYEARS_FIREWORKS)

        # Create an NPC Dialogue manager that manages conversations
        # amongst a set of NPC's
        self.dialogueManager = NPCDialogueManagerAI.NPCDialogueManagerAI()

        # The News manager
        self.newsManager = NewsManagerAI.NewsManagerAI(self)
        self.newsManager.generateWithRequired(OTPGlobals.UberZone)

        # The Factory Manager
        self.factoryMgr = FactoryManagerAI.FactoryManagerAI(self)

        # The Mint Manager
        self.mintMgr = MintManagerAI.MintManagerAI(self)

        #the Law Office Manager
        self.lawMgr = LawOfficeManagerAI.LawOfficeManagerAI(self)

        # The Cog Country Club Manager
        self.countryClubMgr = CountryClubManagerAI.CountryClubManagerAI(self)

        if simbase.wantKarts:
            # The Race Manager
            self.raceMgr = RaceManagerAI.RaceManagerAI(self)

        self.cogSuitMgr = CogSuitManagerAI.CogSuitManagerAI(self)
        self.promotionMgr = PromotionManagerAI.PromotionManagerAI(self)

        # Housing
        self.estateMgr = EstateManagerAI.EstateManagerAI(self)
        self.estateMgr.generateWithRequired(OTPGlobals.UberZone)

        if simbase.wantPets:
            # Pets -- must be created after estateMgr
            self.petMgr = PetManagerAI.PetManagerAI(self)

        # Now create the neighborhood-specific objects.
        self.startupHood(TTHoodDataAI.TTHoodDataAI(self))
        self.startupHood(DDHoodDataAI.DDHoodDataAI(self))
        self.startupHood(MMHoodDataAI.MMHoodDataAI(self))
        self.startupHood(DGHoodDataAI.DGHoodDataAI(self))
        self.startupHood(BRHoodDataAI.BRHoodDataAI(self))
        self.startupHood(DLHoodDataAI.DLHoodDataAI(self))
        self.startupHood(CSHoodDataAI.CSHoodDataAI(self))
        self.startupHood(GSHoodDataAI.GSHoodDataAI(self))
        self.startupHood(OZHoodDataAI.OZHoodDataAI(self))
        self.startupHood(GZHoodDataAI.GZHoodDataAI(self))
        self.startupHood(CashbotHQDataAI.CashbotHQDataAI(self))
        self.startupHood(LawbotHQDataAI.LawbotHQDataAI(self))
        self.startupHood(BossbotHQDataAI.BossbotHQDataAI(self))

        # The Holiday Manager should be instantiated after the each
        # of the hoods and estateMgrAI are generated because Bingo Night
        # needs to reference the HoodDataAI and EstateMgrAI for pond
        # information. (JJT - 7/22/04)
        self.holidayManager = HolidayManagerAI.HolidayManagerAI(self)

        self.banManager = BanManagerAI.BanManagerAI()

        # Now that we've created all the suit planners, any one of
        # them can be used to fill the world with requests for suit
        # buildings.
        if self.suitPlanners:
            list(self.suitPlanners.values())[0].assignInitialSuitBuildings()

        # mark district as avaliable
        self.district.b_setAvailable(1)

        # Now that everything's created, start checking the leader
        # boards for correctness.  We only need to check every 30
        # seconds or so.
        self.__leaderboardFlush(None)
        taskMgr.doMethodLater(30,
                              self.__leaderboardFlush,
                              'leaderboardFlush',
                              appendTask=True)