This commit is contained in:
Loudrob 2015-07-18 12:57:36 -04:00
parent 7505459b59
commit 7cb50fc828
2 changed files with 11 additions and 2 deletions

View file

@ -17,6 +17,15 @@ class ToontownInternalRepository(AstronInternalRepository):
def handleConnected(self): def handleConnected(self):
self.__messenger = ToontownNetMessengerAI(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=[]): def sendNetEvent(self, message, sentArgs=[]):
self.__messenger.send(message, sentArgs) self.__messenger.send(message, sentArgs)

View file

@ -28,11 +28,11 @@ class PetManagerAI:
self.seeds['day'] = getDayId() self.seeds['day'] = getDayId()
def getAvailablePets(self, seed, safezoneId): def getAvailablePets(self, safezoneId):
if self.seeds.get('day', -1) != getDayId(): if self.seeds.get('day', -1) != getDayId():
self.generateSeeds() 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): def createNewPetFromSeed(self, avId, seed, nameIndex, gender, safeZoneId):
av = self.air.doId2do[avId] av = self.air.doId2do[avId]