diff --git a/toontown/distributed/ToontownInternalRepository.py b/toontown/distributed/ToontownInternalRepository.py index 3bf1b399..8a083f4b 100755 --- a/toontown/distributed/ToontownInternalRepository.py +++ b/toontown/distributed/ToontownInternalRepository.py @@ -17,6 +17,15 @@ class ToontownInternalRepository(AstronInternalRepository): def handleConnected(self): self.__messenger = ToontownNetMessengerAI(self) + if config.GetBool('want-mongo', False): + import pymongo + self.dbConn = pymongo.MongoClient(config.GetString('mongodb-url', 'localhost')) + self.dbGlobalCursor = self.dbConn.toontownstride + self.dbCursor = self.dbGlobalCursor['air-%d' % self.ourChannel] + else: + self.dbConn = None + self.dbGlobalCursor = None + self.dbCursor = None def sendNetEvent(self, message, sentArgs=[]): self.__messenger.send(message, sentArgs) diff --git a/toontown/pets/PetManagerAI.py b/toontown/pets/PetManagerAI.py index 1e1f081f..a7128304 100755 --- a/toontown/pets/PetManagerAI.py +++ b/toontown/pets/PetManagerAI.py @@ -28,11 +28,11 @@ class PetManagerAI: self.seeds['day'] = getDayId() - def getAvailablePets(self, seed, safezoneId): + def getAvailablePets(self, safezoneId): if self.seeds.get('day', -1) != getDayId(): self.generateSeeds() - return list(set(self.seeds.get(safezoneId, [seed]))) + return list(set(self.seeds.get(safezoneId, [random.randint(0, 255)]))) def createNewPetFromSeed(self, avId, seed, nameIndex, gender, safeZoneId): av = self.air.doId2do[avId]