def __init__(self, baseChannel, serverId, districtName): ToontownInternalRepository.__init__(self, baseChannel, serverId, dcSuffix='AI') self.districtName = districtName self.zoneAllocator = UniqueIdAllocator( ToontownGlobals.DynamicZonesBegin, ToontownGlobals.DynamicZonesEnd) NPCToons.generateZone2NpcDict() self.use_libpandadna = simbase.config.GetBool('use-libpandadna', False) self.hoods = [] self._dnaStoreMap = {} if self.use_libpandadna: self.__loader = DNALoader() self.zoneDataStore = AIZoneDataStore() self.useAllMinigames = self.config.GetBool('want-all-minigames', False) self.doLiveUpdates = True self.wantCogdominiums = self.config.GetBool('want-cogdo', False) self.wantParties = self.config.GetBool('want-parties', False) self.wantEmblems = self.config.GetBool('want-emblems', True) self.questManager = QuestManagerAI(self) self.promotionMgr = PromotionManagerAI(self) self.cogPageManager = CogPageManagerAI(self) self.cogSuitMgr = CogSuitManagerAI(self) self.trophyMgr = DistributedTrophyMgrAI(self) self.fishManager = FishManagerAI() self.dnaStoreMap = {} self.mintMgr = MintManagerAI.MintManagerAI(self) self.factoryMgr = FactoryManagerAI.FactoryManagerAI(self) self.lawMgr = LawOfficeManagerAI.LawOfficeManagerAI(self) self.countryClubMgr = CountryClubManagerAI.CountryClubManagerAI(self) self.buildingManagers = {} self.suitPlanners = {} self.wantMegaInvasions = str( self.ourChannel // 1000000) in self.config.GetString( 'mega-invasion-shards', '402 403').split()
def createCogHeadquarters(self): if self.config.GetBool('want-sellbot-headquarters', True): self.factoryMgr = FactoryManagerAI.FactoryManagerAI(self) self.cogHeadquarters.append(SellbotHQAI.SellbotHQAI(self)) if self.config.GetBool('want-cashbot-headquarters', True): self.mintMgr = MintManagerAI.MintManagerAI(self) self.cogHeadquarters.append(CashbotHQAI.CashbotHQAI(self)) if self.config.GetBool('want-lawbot-headquarters', True): self.lawOfficeMgr = LawOfficeManagerAI.LawOfficeManagerAI(self) self.cogHeadquarters.append(LawbotHQAI.LawbotHQAI(self)) if self.config.GetBool('want-bossbot-headquarters', True): self.countryClubMgr = CountryClubManagerAI.CountryClubManagerAI( self) self.cogHeadquarters.append(BossbotHQAI.BossbotHQAI(self))
def createCogHeadquarters(self): NPCToons.generateZone2NpcDict() if self.config.GetBool('want-sellbot-headquarters', True): self.factoryMgr = FactoryManagerAI.FactoryManagerAI(self) self.cogHeadquarters.append(SellbotHQAI.SellbotHQAI(self)) if self.config.GetBool('want-cashbot-headquarters', True): self.mintMgr = MintManagerAI.MintManagerAI(self) self.cogHeadquarters.append(CashbotHQAI.CashbotHQAI(self)) if self.config.GetBool('want-lawbot-headquarters', True): self.lawOfficeMgr = LawOfficeManagerAI.LawOfficeManagerAI(self) self.cogHeadquarters.append(LawbotHQAI.LawbotHQAI(self)) if self.config.GetBool('want-bossbot-headquarters', True): self.countryClubMgr = CountryClubManagerAI.CountryClubManagerAI(self) self.cogHeadquarters.append(BossbotHQAI.BossbotHQAI(self)) if self.config.GetBool('want-bdhq', True): self.boardofficeMgr = BoardOfficeManagerAI.BoardOfficeManagerAI(self) self.cogHeadquarters.append(BoardbotHQAI.BoardbotHQAI(self))
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)