mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
Fix a mistake I made.
This commit is contained in:
parent
2e6cc13c56
commit
5c776d6cc8
2 changed files with 13 additions and 7 deletions
|
@ -205,20 +205,17 @@ class DistributedBuildingMgrAI:
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
blocks = {}
|
blocks = {}
|
||||||
|
|
||||||
if not self.air.dbConn:
|
if not self.air.dbConn:
|
||||||
blocks = simbase.backups.load('block-info', (self.air.districtId, self.branchId), default={})
|
blocks = simbase.backups.load('block-info', (self.air.districtId, self.branchId), default={})
|
||||||
return blocks
|
return blocks
|
||||||
|
|
||||||
self.air.mongodb.toontown.blockinfo.ensure_index([('ai', 1), ('branch', 1)])
|
self.air.mongodb.toontown.blockinfo.ensure_index([('ai', 1), ('branch', 1)])
|
||||||
|
|
||||||
street = {'ai': self.shard, 'branch': self.branchID}
|
street = {'ai': self.shard, 'branch': self.branchID}
|
||||||
try:
|
try:
|
||||||
doc = self.air.mongodb.toontown.blockinfo.find_one(street)
|
doc = self.air.mongodb.toontown.blockinfo.find_one(street)
|
||||||
except AutoReconnect:
|
except AutoReconnect:
|
||||||
return blocks
|
return blocks
|
||||||
|
|
||||||
if not doc:
|
if not doc:
|
||||||
return blocks
|
return blocks
|
||||||
|
for building in doc.get('buildings', []):
|
||||||
return doc
|
blocks[int(building['block'])] = building
|
||||||
|
return blocks
|
||||||
|
|
|
@ -6,7 +6,16 @@ class LeaderboardMgrAI:
|
||||||
|
|
||||||
def __init__(self, air):
|
def __init__(self, air):
|
||||||
self.air = air
|
self.air = air
|
||||||
self.database = simbase.backups.load('leaderboard', (self.air.districtId,), default=({}))
|
self.database = {}
|
||||||
|
if not self.air.dbConn:
|
||||||
|
self.database = simbase.backups.load('leaderboard', (self.air.districtId,), default=({}))
|
||||||
|
else:
|
||||||
|
self.air.mongodb.toontown.leaderboard.ensure_index([('ai', 1)])
|
||||||
|
street = {'ai': self.air.districtId}
|
||||||
|
try:
|
||||||
|
doc = self.air.mongodb.toontown.leaderboard.find_one(street)
|
||||||
|
except AutoReconnect:
|
||||||
|
return blocks
|
||||||
|
|
||||||
def getDatabase(self):
|
def getDatabase(self):
|
||||||
return self.database
|
return self.database
|
||||||
|
|
Loading…
Reference in a new issue