From 2dcf73d3da628354c3a6376078dd91e033eb1354 Mon Sep 17 00:00:00 2001 From: Open Toontown Date: Fri, 8 Nov 2019 21:10:31 -0500 Subject: [PATCH] general: More Astron progress --- otp/distributed/OTPClientRepository.py | 32 +++++++++++++++++++++++++- otp/login/AstronLoginScreen.py | 7 +++++- otp/login/LoginAstronAccount.py | 11 ++++++--- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index 9ad534e..f51553e 100644 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -520,7 +520,8 @@ class OTPClientRepository(ClientRepositoryBase): return self.startReaderPollTask() - self.startHeartbeat() + if not self.astronSupport: + self.startHeartbeat() newInstall = launcher.getIsNewInstallation() newInstall = base.config.GetBool('new-installation', newInstall) if newInstall: @@ -1933,6 +1934,35 @@ class OTPClientRepository(ClientRepositoryBase): if self.astronSupport: if msgType == CLIENT_EJECT: self.handleGoGetLost(di) + elif msgType == CLIENT_HEARTBEAT: + self.handleServerHeartbeat(di) + elif msgtype == CLIENT_ENTER_OBJECT_REQUIRED: + self.handleGenerateWithRequired(di) + elif msgType == CLIENT_ENTER_OBJECT_REQUIRED_OTHER: + self.handleGenerateWithRequiredOther(di) + elif msgType == CLIENT_ENTER_OBJECT_REQUIRED_OTHER_OWNER: + self.handleGenerateWithRequiredOtherOwner(di) + elif msgType == CLIENT_OBJECT_SET_FIELD: + self.handleUpdateField(di) + elif msgType == CLIENT_OBJECT_LEAVING: + self.handleDisable(di) + elif msgType == CLIENT_OBJECT_LEAVING_OWNER: + self.handleDisable(di, ownerView=True) + elif msgType == CLIENT_DONE_INTEREST_RESP: + self.gotInterestDoneMessage(di) + elif msgType == CLIENT_OBJECT_LOCATION: + self.gotObjectLocationMessage(di) + else: + currentLoginState = self.loginFSM.getCurrentState() + if currentLoginState: + currentLoginStateName = currentLoginState.getName() + else: + currentLoginStateName = 'None' + currentGameState = self.gameFSM.getCurrentState() + if currentGameState: + currentGameStateName = currentGameState.getName() + else: + currentGameStateName = 'None' else: if msgType == CLIENT_GO_GET_LOST: self.handleGoGetLost(di) diff --git a/otp/login/AstronLoginScreen.py b/otp/login/AstronLoginScreen.py index 60e7b8b..135315a 100644 --- a/otp/login/AstronLoginScreen.py +++ b/otp/login/AstronLoginScreen.py @@ -1,6 +1,11 @@ from direct.directnotify import DirectNotifyGlobal from otp.login.LoginScreen import LoginScreen +from direct.distributed.MsgTypes import * class AstronLoginScreen(LoginScreen): def handleWaitForLoginResponse(self, msgType, di): - self.cr.handleMessageType(msgType, di) + if msgType == CLIENT_HELLO_RESP: + # Now we can start the heartbeat: + self.cr.startHeartbeat() + else: + self.cr.handleMessageType(msgType, di) diff --git a/otp/login/LoginAstronAccount.py b/otp/login/LoginAstronAccount.py index 9dae871..a9b5b04 100644 --- a/otp/login/LoginAstronAccount.py +++ b/otp/login/LoginAstronAccount.py @@ -1,5 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from otp.login.LoginBase import LoginBase +from direct.distributed.PyDatagram import PyDatagram +from direct.distributed.MsgTypes import * class LoginAstronAccount(LoginBase): notify = DirectNotifyGlobal.directNotify.newCategory('LoginAstronAccount') @@ -8,11 +10,14 @@ class LoginAstronAccount(LoginBase): LoginBase.__init__(self, cr) def authorize(self, username, password): - self.notify.info(username) - self.notify.info(password) + pass def sendLoginMsg(self): - self.notify.info('LOG ME IN!!!!!!!!!!!!') + datagram = PyDatagram() + datagram.addUint16(CLIENT_HELLO) + datagram.addUint32(self.cr.hashVal) + datagram.addString(self.cr.serverVersion) + self.cr.send(datagram) def supportsRelogin(self): if __debug__: