general: some cleanup

This commit is contained in:
John Cote 2019-11-28 00:17:22 -05:00
parent 17ba625f73
commit 9f56161955
19 changed files with 76 additions and 27 deletions

View file

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

View file

@ -1,5 +1,6 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectUD import DistributedObjectUD
class AccountUD(DistributedObjectUD):
notify = DirectNotifyGlobal.directNotify.newCategory('AccountUD')

View file

@ -1,5 +1,6 @@
from direct.distributed import DistributedObject
class AstronAccount(DistributedObject.DistributedObject):
def __init__(self, cr):

View file

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

View file

@ -1,5 +1,6 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectUD import DistributedObjectUD
class AstronAccountUD(DistributedObjectUD):
notify = DirectNotifyGlobal.directNotify.newCategory('AstronAccountUD')

View file

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

View file

@ -1,5 +1,6 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectUD import DistributedObjectUD
class CentralLoggerUD(DistributedObjectUD):
notify = DirectNotifyGlobal.directNotify.newCategory('CentralLoggerUD')

View file

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

View file

@ -1,6 +1,7 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedDistrictAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDistrictAI')

View file

@ -1,5 +1,6 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectUD import DistributedObjectUD
class DistributedDistrictUD(DistributedObjectUD):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDistrictUD')

View file

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

View file

@ -1,6 +1,7 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.AstronInternalRepository import AstronInternalRepository
# TODO: Remove Astron dependence.
class OTPInternalRepository(AstronInternalRepository):
@ -8,7 +9,8 @@ class OTPInternalRepository(AstronInternalRepository):
dbId = 4003
def __init__(self, baseChannel, serverId, dcFileNames, dcSuffix, connectMethod, threadedNet):
AstronInternalRepository.__init__(self, baseChannel, serverId=serverId, dcFileNames=dcFileNames, dcSuffix=dcSuffix, connectMethod=connectMethod, threadedNet=threadedNet)
AstronInternalRepository.__init__(self, baseChannel, serverId=serverId, dcFileNames=dcFileNames,
dcSuffix=dcSuffix, connectMethod=connectMethod, threadedNet=threadedNet)
def handleConnected(self):
AstronInternalRepository.handleConnected(self)

View file

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

View file

@ -1,5 +1,6 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectUD import DistributedObjectUD
class ObjectServerUD(DistributedObjectUD):
notify = DirectNotifyGlobal.directNotify.newCategory('ObjectServerUD')

View file

@ -4,8 +4,10 @@ from datetime import datetime
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal
from otp.uberdog.AccountDetailRecord import AccountDetailRecord
class AstronLoginManager(DistributedObjectGlobal):
notify = DirectNotifyGlobal.directNotify.newCategory('AstronLoginManager')

View file

@ -2,15 +2,17 @@ import anydbm
import dumbdbm
import json
import sys
from datetime import datetime
import time
from datetime import datetime
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectGlobalUD import DistributedObjectGlobalUD
from direct.distributed.PyDatagram import *
from toontown.makeatoon.NameGenerator import NameGenerator
from toontown.toon.ToonDNA import ToonDNA
from toontown.toonbase import TTLocalizer
from toontown.makeatoon.NameGenerator import NameGenerator
class AccountDB:
"""
@ -89,7 +91,8 @@ class LoginOperation:
self.__handleCreateAccount()
def __handleRetrieveAccount(self):
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.accountId, self.__handleAccountRetrieved)
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.accountId,
self.__handleAccountRetrieved)
def __handleAccountRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['AstronAccountUD']:
@ -107,7 +110,9 @@ class LoginOperation:
'LAST_LOGIN': time.ctime(),
'ACCOUNT_ID': str(self.databaseId)}
self.loginManager.air.dbInterface.createObject(self.loginManager.air.dbId, self.loginManager.air.dclassesByName['AstronAccountUD'], self.account, self.__handleAccountCreated)
self.loginManager.air.dbInterface.createObject(self.loginManager.air.dbId,
self.loginManager.air.dclassesByName['AstronAccountUD'],
self.account, self.__handleAccountCreated)
def __handleAccountCreated(self, accountId):
if not accountId:
@ -130,7 +135,8 @@ class LoginOperation:
def __handleSetAccount(self):
# if somebody's already logged into this account, disconnect them
datagram = PyDatagram()
datagram.addServerHeader(self.loginManager.GetAccountConnectionChannel(self.accountId), self.loginManager.air.ourChannel, CLIENTAGENT_EJECT)
datagram.addServerHeader(self.loginManager.GetAccountConnectionChannel(self.accountId),
self.loginManager.air.ourChannel, CLIENTAGENT_EJECT)
datagram.addUint16(100)
datagram.addString('This account has been logged in elsewhere.')
self.loginManager.air.send(datagram)
@ -202,7 +208,8 @@ class GetAvatarsOperation:
self.avatarFields = None
def start(self):
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender, self.__handleAccountRetrieved)
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender,
self.__handleAccountRetrieved)
def __handleAccountRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['AstronAccountUD']:
@ -221,6 +228,7 @@ class GetAvatarsOperation:
for avId in self.avList:
if avId:
self.pendingAvatars.add(avId)
def response(dclass, fields, avId=avId):
if dclass != self.loginManager.air.dclassesByName['DistributedToonUD']:
# mayonnaise
@ -289,7 +297,8 @@ class CreateAvatarOperation:
self.__handleRetrieveAccount()
def __handleRetrieveAccount(self):
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender, self.__handleAccountRetrieved)
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender,
self.__handleAccountRetrieved)
def __handleAccountRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['AstronAccountUD']:
@ -318,7 +327,9 @@ class CreateAvatarOperation:
'setDNAString': (self.avDNA,),
'setDISLid': (self.sender,)}
self.loginManager.air.dbInterface.createObject(self.loginManager.air.dbId, self.loginManager.air.dclassesByName['DistributedToonUD'], toonFields, self.__handleToonCreated)
self.loginManager.air.dbInterface.createObject(self.loginManager.air.dbId,
self.loginManager.air.dclassesByName['DistributedToonUD'],
toonFields, self.__handleToonCreated)
def __handleToonCreated(self, avId):
if not avId:
@ -330,7 +341,8 @@ class CreateAvatarOperation:
def __handleStoreAvatar(self):
self.avList[self.avPosition] = self.avId
self.loginManager.air.dbInterface.updateObject(self.loginManager.air.dbId, self.sender, self.loginManager.air.dclassesByName['AstronAccountUD'],
self.loginManager.air.dbInterface.updateObject(self.loginManager.air.dbId, self.sender,
self.loginManager.air.dclassesByName['AstronAccountUD'],
{'ACCOUNT_AV_SET': self.avList},
{'ACCOUNT_AV_SET': self.account['ACCOUNT_AV_SET']},
self.__handleAvatarStored)
@ -362,7 +374,8 @@ class SetNamePatternOperation:
self.__handleRetrieveAccount()
def __handleRetrieveAccount(self):
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender, self.__handleAccountRetrieved)
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender,
self.__handleAccountRetrieved)
def __handleAccountRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['AstronAccountUD']:
@ -381,7 +394,8 @@ class SetNamePatternOperation:
# It's you!
return
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.avId, self.__handleAvatarRetrieved)
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.avId,
self.__handleAvatarRetrieved)
def __handleAvatarRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['DistributedToonUD']:
@ -413,7 +427,8 @@ class SetNamePatternOperation:
name = ' '.join(parts)
self.loginManager.air.dbInterface.updateObject(self.loginManager.air.dbId, self.avId, self.loginManager.air.dclassesByName['DistributedToonUD'],
self.loginManager.air.dbInterface.updateObject(self.loginManager.air.dbId, self.avId,
self.loginManager.air.dclassesByName['DistributedToonUD'],
{'WishNameState': ('LOCKED',),
'WishName': ('',),
'setName': (name,)})
@ -441,7 +456,8 @@ class SetNameTypedOperation:
self.__handleJudgeName()
def __handleRetrieveAccount(self):
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender, self.__handleAccountRetrieved)
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender,
self.__handleAccountRetrieved)
def __handleAccountRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['AstronAccountUD']:
@ -460,7 +476,8 @@ class SetNameTypedOperation:
# Hahaha
return
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.avId, self.__handleAvatarRetrieved)
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.avId,
self.__handleAvatarRetrieved)
def __handleAvatarRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['DistributedToonUD']:
@ -500,7 +517,8 @@ class AcknowledgeNameOperation:
self.__handleRetrieveAccount()
def __handleRetrieveAccount(self):
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender, self.__handleAccountRetrieved)
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender,
self.__handleAccountRetrieved)
def __handleAccountRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['AstronAccountUD']:
@ -518,7 +536,8 @@ class AcknowledgeNameOperation:
# welp
return
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.avId, self.__handleAvatarRetrieved)
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.avId,
self.__handleAvatarRetrieved)
def __handleAvatarRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['DistributedToonUD']:
@ -564,7 +583,8 @@ class RemoveAvatarOperation:
def start(self, avId):
self.avId = avId
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender, self.__handleAccountRetrieved)
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender,
self.__handleAccountRetrieved)
def __handleAccountRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['AstronAccountUD']:
@ -593,7 +613,8 @@ class RemoveAvatarOperation:
{'setSlot%sToonId' % index: [0],
'setSlot%sItems' % index: [[]]})
self.loginManager.air.dbInterface.updateObject(self.loginManager.air.dbId, self.sender, self.loginManager.air.dclassesByName['AstronAccountUD'],
self.loginManager.air.dbInterface.updateObject(self.loginManager.air.dbId, self.sender,
self.loginManager.air.dclassesByName['AstronAccountUD'],
{'ACCOUNT_AV_SET': self.avList,
'ACCOUNT_AV_SET_DEL': avatarsRemoved},
{'ACCOUNT_AV_SET': self.account['ACCOUNT_AV_SET'],
@ -613,6 +634,7 @@ class RemoveAvatarOperation:
for avId in self.avList:
if avId:
self.pendingAvatars.add(avId)
def response(dclass, fields, avId=avId):
if dclass != self.loginManager.air.dclassesByName['DistributedToonUD']:
# mayonnaise
@ -669,7 +691,8 @@ class LoadAvatarOperation:
self.__handleRetrieveAccount()
def __handleRetrieveAccount(self):
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender, self.__handleAccountRetrieved)
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.sender,
self.__handleAccountRetrieved)
def __handleAccountRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['AstronAccountUD']:
@ -686,7 +709,8 @@ class LoadAvatarOperation:
if self.avId not in self.avList:
return
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.avId, self.__handleAvatarRetrieved)
self.loginManager.air.dbInterface.queryObject(self.loginManager.air.dbId, self.avId,
self.__handleAvatarRetrieved)
def __handleAvatarRetrieved(self, dclass, fields):
if dclass != self.loginManager.air.dclassesByName['DistributedToonUD']:

View file

@ -1,8 +1,11 @@
from direct.directnotify import DirectNotifyGlobal
from otp.login.LoginScreen import LoginScreen
from direct.distributed.MsgTypes import *
from otp.login.LoginScreen import LoginScreen
class AstronLoginScreen(LoginScreen):
notify = DirectNotifyGlobal.directNotify.newCategory('AstronLoginScreen')
def handleWaitForLoginResponse(self, msgType, di):
if msgType == CLIENT_HELLO_RESP:

View file

@ -1,11 +1,14 @@
from direct.directnotify import DirectNotifyGlobal
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
from otp.distributed.DistributedDirectoryAI import DistributedDirectoryAI
from otp.distributed.OtpDoGlobals import *
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
# TODO: Remove Astron dependence.
class ToontownUDRepository(ToontownInternalRepository):
notify = DirectNotifyGlobal.directNotify.newCategory('ToontownUDRepository')
def __init__(self, baseChannel, serverId):
ToontownInternalRepository.__init__(self, baseChannel, serverId, dcSuffix='UD')

View file

@ -1,9 +1,11 @@
import __builtin__
class game:
name = 'uberDog'
process = 'server'
__builtin__.game = game
from panda3d.core import *