mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-24 12:12:36 -06:00
Mongo
This commit is contained in:
parent
7505459b59
commit
7cb50fc828
2 changed files with 11 additions and 2 deletions
|
@ -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)
|
||||||
|
|
|
@ -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]
|
||||||
|
|
Loading…
Reference in a new issue