From bba3117cc487bd20970b74d9170e4046a3947a83 Mon Sep 17 00:00:00 2001 From: Open Toontown Date: Fri, 8 Nov 2019 20:45:22 -0500 Subject: [PATCH] general: working on astron stuff --- otp/distributed/OTPClientRepository.py | 97 +++++++++++++++----------- otp/login/AstronLoginScreen.py | 6 ++ otp/login/LoginAstronAccount.py | 20 ++++++ 3 files changed, 81 insertions(+), 42 deletions(-) create mode 100644 otp/login/AstronLoginScreen.py create mode 100644 otp/login/LoginAstronAccount.py diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index 87bf2fe..9ad534e 100644 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -30,6 +30,7 @@ from otp.login import LoginTTSpecificDevAccount from otp.login import AccountServerConstants from otp.login.CreateAccountScreen import CreateAccountScreen from otp.login import LoginScreen +from otp.login import AstronLoginScreen from otp.otpgui import OTPDialog from otp.avatar import DistributedAvatar from otp.otpbase import OTPLocalizer @@ -38,6 +39,7 @@ from otp.login import LoginGoAccount from otp.login.LoginWebPlayTokenAccount import LoginWebPlayTokenAccount from otp.login.LoginDISLTokenAccount import LoginDISLTokenAccount from otp.login import LoginTTAccount +from otp.login import LoginAstronAccount from otp.login import HTTPUtil from otp.otpbase import OTPGlobals from otp.otpbase import OTPLauncherGlobals @@ -169,12 +171,16 @@ class OTPClientRepository(ClientRepositoryBase): else: self.http = HTTPClient() - self.allocateDcFile() + #self.allocateDcFile() self.accountOldAuth = config.GetBool('account-old-auth', 0) self.accountOldAuth = config.GetBool('%s-account-old-auth' % game.name, self.accountOldAuth) self.useNewTTDevLogin = base.config.GetBool('use-tt-specific-dev-login', False) - if self.useNewTTDevLogin: + self.astronSupport = config.GetBool('astron-support', True) + if self.astronSupport: + self.loginInterface = LoginAstronAccount.LoginAstronAccount(self) + self.notify.info('loginInterface: LoginAstronAccount') + elif self.useNewTTDevLogin: self.loginInterface = LoginTTSpecificDevAccount.LoginTTSpecificDevAccount(self) self.notify.info('loginInterface: LoginTTSpecificDevAccount') elif self.accountOldAuth: @@ -525,7 +531,10 @@ class OTPClientRepository(ClientRepositoryBase): def enterLogin(self): self.sendSetAvatarIdMsg(0) self.loginDoneEvent = 'loginDone' - self.loginScreen = LoginScreen.LoginScreen(self, self.loginDoneEvent) + if self.astronSupport: + self.loginScreen = AstronLoginScreen.AstronLoginScreen(self, self.loginDoneEvent) + else: + self.loginScreen = LoginScreen.LoginScreen(self, self.loginDoneEvent) self.accept(self.loginDoneEvent, self.__handleLoginDone) self.loginScreen.load() self.loginScreen.enter() @@ -1921,47 +1930,51 @@ class OTPClientRepository(ClientRepositoryBase): return Task.done def handleMessageType(self, msgType, di): - if msgType == CLIENT_GO_GET_LOST: - self.handleGoGetLost(di) - elif msgType == CLIENT_HEARTBEAT: - self.handleServerHeartbeat(di) - elif msgType == CLIENT_SYSTEM_MESSAGE: - self.handleSystemMessage(di) - elif msgType == CLIENT_SYSTEMMESSAGE_AKNOWLEDGE: - self.handleSystemMessageAknowledge(di) - elif msgType == CLIENT_CREATE_OBJECT_REQUIRED: - self.handleGenerateWithRequired(di) - elif msgType == CLIENT_CREATE_OBJECT_REQUIRED_OTHER: - self.handleGenerateWithRequiredOther(di) - elif msgType == CLIENT_CREATE_OBJECT_REQUIRED_OTHER_OWNER: - self.handleGenerateWithRequiredOtherOwner(di) - elif msgType == CLIENT_OBJECT_UPDATE_FIELD: - self.handleUpdateField(di) - elif msgType == CLIENT_OBJECT_DISABLE: - self.handleDisable(di) - elif msgType == CLIENT_OBJECT_DISABLE_OWNER: - self.handleDisable(di, ownerView=True) - elif msgType == CLIENT_OBJECT_DELETE_RESP: - self.handleDelete(di) - elif msgType == CLIENT_DONE_INTEREST_RESP: - self.gotInterestDoneMessage(di) - elif msgType == CLIENT_GET_STATE_RESP: - pass - elif msgType == CLIENT_OBJECT_LOCATION: - self.gotObjectLocationMessage(di) - elif msgType == CLIENT_SET_WISHNAME_RESP: - self.gotWishnameResponse(di) + if self.astronSupport: + if msgType == CLIENT_EJECT: + self.handleGoGetLost(di) else: - currentLoginState = self.loginFSM.getCurrentState() - if currentLoginState: - currentLoginStateName = currentLoginState.getName() + if msgType == CLIENT_GO_GET_LOST: + self.handleGoGetLost(di) + elif msgType == CLIENT_HEARTBEAT: + self.handleServerHeartbeat(di) + elif msgType == CLIENT_SYSTEM_MESSAGE: + self.handleSystemMessage(di) + elif msgType == CLIENT_SYSTEMMESSAGE_AKNOWLEDGE: + self.handleSystemMessageAknowledge(di) + elif msgType == CLIENT_CREATE_OBJECT_REQUIRED: + self.handleGenerateWithRequired(di) + elif msgType == CLIENT_CREATE_OBJECT_REQUIRED_OTHER: + self.handleGenerateWithRequiredOther(di) + elif msgType == CLIENT_CREATE_OBJECT_REQUIRED_OTHER_OWNER: + self.handleGenerateWithRequiredOtherOwner(di) + elif msgType == CLIENT_OBJECT_UPDATE_FIELD: + self.handleUpdateField(di) + elif msgType == CLIENT_OBJECT_DISABLE: + self.handleDisable(di) + elif msgType == CLIENT_OBJECT_DISABLE_OWNER: + self.handleDisable(di, ownerView=True) + elif msgType == CLIENT_OBJECT_DELETE_RESP: + self.handleDelete(di) + elif msgType == CLIENT_DONE_INTEREST_RESP: + self.gotInterestDoneMessage(di) + elif msgType == CLIENT_GET_STATE_RESP: + pass + elif msgType == CLIENT_OBJECT_LOCATION: + self.gotObjectLocationMessage(di) + elif msgType == CLIENT_SET_WISHNAME_RESP: + self.gotWishnameResponse(di) else: - currentLoginStateName = 'None' - currentGameState = self.gameFSM.getCurrentState() - if currentGameState: - currentGameStateName = currentGameState.getName() - else: - currentGameStateName = 'None' + currentLoginState = self.loginFSM.getCurrentState() + if currentLoginState: + currentLoginStateName = currentLoginState.getName() + else: + currentLoginStateName = 'None' + currentGameState = self.gameFSM.getCurrentState() + if currentGameState: + currentGameStateName = currentGameState.getName() + else: + currentGameStateName = 'None' def gotInterestDoneMessage(self, di): if self.deferredGenerates: diff --git a/otp/login/AstronLoginScreen.py b/otp/login/AstronLoginScreen.py new file mode 100644 index 0000000..60e7b8b --- /dev/null +++ b/otp/login/AstronLoginScreen.py @@ -0,0 +1,6 @@ +from direct.directnotify import DirectNotifyGlobal +from otp.login.LoginScreen import LoginScreen + +class AstronLoginScreen(LoginScreen): + def handleWaitForLoginResponse(self, msgType, di): + self.cr.handleMessageType(msgType, di) diff --git a/otp/login/LoginAstronAccount.py b/otp/login/LoginAstronAccount.py new file mode 100644 index 0000000..9dae871 --- /dev/null +++ b/otp/login/LoginAstronAccount.py @@ -0,0 +1,20 @@ +from direct.directnotify import DirectNotifyGlobal +from otp.login.LoginBase import LoginBase + +class LoginAstronAccount(LoginBase): + notify = DirectNotifyGlobal.directNotify.newCategory('LoginAstronAccount') + + def __init__(self, cr): + LoginBase.__init__(self, cr) + + def authorize(self, username, password): + self.notify.info(username) + self.notify.info(password) + + def sendLoginMsg(self): + self.notify.info('LOG ME IN!!!!!!!!!!!!') + + def supportsRelogin(self): + if __debug__: + return 1 + return 0