ai: AI server progress

This commit is contained in:
Open Toontown 2019-11-10 19:46:41 -05:00
parent d047b77154
commit 1f8044c25e
22 changed files with 209 additions and 2 deletions

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class AccountAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('AccountAI')

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class CentralLoggerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('CentralLoggerAI')

View file

@ -0,0 +1,36 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedDistrictAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDistrictAI')
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
self.name = ''
self.available = False
def setName(self, name):
self.name = name
def d_setName(self, name):
self.sendUpdate('setName', [name])
def b_setName(self, name):
self.setName(name)
self.d_setName(name)
def getName(self):
return self.name
def setAvailable(self, available):
self.available = available
def d_setAvailable(self, available):
self.sendUpdate('setAvailable', [available])
def b_setAvailable(self, available):
self.setAvailable(available)
self.d_setAvailable(available)
def getAvailable(self):
return self.available

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class ObjectServerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('ObjectServerAI')

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class GuildManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('GuildManagerAI')

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class SnapshotDispatcherAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('SnapshotDispatcherAI')

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class SnapshotRendererAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('SnapshotRendererAI')

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedChatManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedChatManagerAI')

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class OtpAvatarManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('OtpAvatarManagerAI')

5
otp/web/SettingsMgrAI.py Normal file
View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class SettingsMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('SettingsMgrAI')

42
toontown/ai/AIStart.py Normal file
View file

@ -0,0 +1,42 @@
import __builtin__
class game:
name = 'toontown'
process = 'server'
__builtin__.game = game
from panda3d.core import *
loadPrcFile('etc/Configrc.prc')
from otp.ai.AIBaseGlobal import *
from toontown.ai.ToontownAIRepository import ToontownAIRepository
aiConfig = ''
aiConfig += 'air-base-channel %s\n' % 101000000
aiConfig += 'air-channel-allocation %s\n' % 999999
aiConfig += 'air-stateserver %s\n' % 4002
aiConfig += 'district-name %s\n' % 'Toon Valley'
aiConfig += 'air-connect %s\n' % '127.0.0.1:7199'
aiConfig += 'eventlog-host %s\n' % '127.0.0.1:7197'
loadPrcFileData('AI Config', aiConfig)
simbase.air = ToontownAIRepository(config.GetInt('air-base-channel', 1000000), config.GetInt('air-stateserver', 4002), config.GetString('district-name', 'Toon Valley'))
host = config.GetString('air-connect', '127.0.0.1:7199')
port = 7199
if ':' in host:
host, port = host.split(':', 1)
port = int(port)
simbase.air.connect(host, port)
try:
run()
except SystemExit:
raise
except Exception:
from otp.otpbase import PythonUtil
print PythonUtil.describeException()
raise

View file

@ -0,0 +1,22 @@
from direct.directnotify import DirectNotifyGlobal
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
from toontown.distributed.ToontownDistrictAI import ToontownDistrictAI
from otp.distributed.OtpDoGlobals import *
class ToontownAIRepository(ToontownInternalRepository):
notify = DirectNotifyGlobal.directNotify.newCategory('ToontownAIRepository')
def __init__(self, baseChannel, serverId, districtName):
ToontownInternalRepository.__init__(self, baseChannel, serverId, dcSuffix='AI')
self.districtName = districtName
self.districtId = None
self.district = None
def handleConnected(self):
ToontownInternalRepository.handleConnected(self)
# Generate our district...
self.districtId = self.allocateChannel()
self.district = ToontownDistrictAI(self)
self.district.setName(self.districtName)
self.district.generateWithRequiredAndId(self.districtId, self.getGameDoId(), OTP_ZONE_ID_DISTRICTS)

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class TTCodeRedemptionMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('TTCodeRedemptionMgrAI')

View file

@ -1,5 +1,22 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from otp.distributed.DistributedDistrictAI import DistributedDistrictAI
class ToontownDistrictAI(DistributedObjectAI):
class ToontownDistrictAI(DistributedDistrictAI):
notify = DirectNotifyGlobal.directNotify.newCategory('ToontownDistrictAI')
def __init__(self, air):
DistributedDistrictAI.__init__(self, air)
self.ahnnLog = False
def allowAHNNLog(self, ahnnLog):
self.ahnnLog = ahnnLog
def d_allowAHNNLog(self, ahnnLog):
self.sendUpdate('allowAHNNLog', [ahnnLog])
def b_allowAHNNLog(self, ahnnLog):
self.allowAHNNLog(ahnnLog)
self.d_allowAHNNLog(ahnnLog)
def getAllowAHNNLog(self):
return self.ahnnLog

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedCpuInfoMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCpuInfoMgrAI')

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedDataStoreManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDataStoreManagerAI')

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedDeliveryManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDeliveryManagerAI')

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedInGameNewsMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedInGameNewsMgrAI')

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedMailManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedMailManagerAI')

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedPartyManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPartyManagerAI')

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedSecurityMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedSecurityMgrAI')

View file

@ -0,0 +1,5 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedWhitelistMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedWhitelistMgrAI')