From bab8474cb959f108ded05ac0c4b9d7d58134ad17 Mon Sep 17 00:00:00 2001 From: John Cote Date: Sun, 17 Nov 2019 18:15:48 -0500 Subject: [PATCH] general: Fix some issues, cleanup --- otp/distributed/OTPClientRepository.py | 94 ++++++++++--------- .../distributed/ToontownClientRepository.py | 1 + toontown/hood/Hood.py | 2 +- toontown/shtiker/OptionsPage.py | 2 +- 4 files changed, 52 insertions(+), 47 deletions(-) diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index ad0295c..3a8ad27 100644 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -1169,9 +1169,14 @@ class OTPClientRepository(ClientRepositoryBase): else: self.startPeriodTimer() - @report(types=['args', 'deltaStamp'], dConfigParam='teleport') - def handleAvatarResponseMsg(self, di): - pass + if not config.GetBool('astron-support', True): + @report(types=['args', 'deltaStamp'], dConfigParam='teleport') + def handleAvatarResponseMsg(self, di): + pass + else: + @report(types=['args', 'deltaStamp'], dConfigParam='teleport') + def handleAvatarResponseMsg(self, avatarId, di): + pass @report(types=['args', 'deltaStamp'], dConfigParam='teleport') def handleWaitForSetAvatarResponse(self, msgType, di): @@ -1676,17 +1681,15 @@ class OTPClientRepository(ClientRepositoryBase): def handlePlayGame(self, msgType, di): if self.notify.getDebug(): self.notify.debug('handle play game got message type: ' + `msgType`) + if self.__recordObjectMessage(msgType, di): + return if msgType == CLIENT_ENTER_OBJECT_REQUIRED: self.handleGenerateWithRequired(di) elif msgType == CLIENT_ENTER_OBJECT_REQUIRED_OTHER: - self.handleGenerateWithRequiredOther(di) + self.handleGenerateWithRequired(di, other=True) elif msgType == CLIENT_OBJECT_SET_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: + elif msgType == CLIENT_OBJECT_LEAVING: self.handleDelete(di) else: self.handleMessageType(msgType, di) @@ -1970,42 +1973,8 @@ class OTPClientRepository(ClientRepositoryBase): messenger.send('periodTimerExpired') return Task.done - def handleMessageType(self, msgType, di): - if self.astronSupport: - if self.__recordObjectMessage(msgType, di): - return - 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.handleGenerateWithRequired(di, other=True) - 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 not config.GetBool('astron-support', True): + def handleMessageType(self, msgType, di): if msgType == CLIENT_GO_GET_LOST: self.handleGoGetLost(di) elif msgType == CLIENT_HEARTBEAT: @@ -2047,6 +2016,41 @@ class OTPClientRepository(ClientRepositoryBase): currentGameStateName = currentGameState.getName() else: currentGameStateName = 'None' + else: + def handleMessageType(self, msgType, di): + if self.__recordObjectMessage(msgType, di): + return + 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.handleGenerateWithRequired(di, other=True) + 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' def gotInterestDoneMessage(self, di): if self.deferredGenerates: diff --git a/toontown/distributed/ToontownClientRepository.py b/toontown/distributed/ToontownClientRepository.py index 215d7ed..3c374bd 100644 --- a/toontown/distributed/ToontownClientRepository.py +++ b/toontown/distributed/ToontownClientRepository.py @@ -1130,6 +1130,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): dclass.stopGenerate() def handleGenerateWithRequiredOtherOwner(self, di): + # OwnerViews are only used for LocalToon in Toontown. if self.loginFSM.getCurrentState().getName() == 'waitForSetAvatarResponse': doId = di.getUint32() parentId = di.getUint32() diff --git a/toontown/hood/Hood.py b/toontown/hood/Hood.py index 8e8eb7b..381c122 100644 --- a/toontown/hood/Hood.py +++ b/toontown/hood/Hood.py @@ -58,7 +58,7 @@ class Hood(StateData.StateData): self.titleText.setColor(Vec4(*self.titleColor)) self.titleText.clearColorScale() self.titleText.setFg(self.titleColor) - self.titleTextSeq = Sequence(Wait(0.1), Wait(6.0), self.titleText.colorScaleInterval(0.5, Vec4(1.0, 1.0, 1.0, 0.0), Vec4(1.0, 1.0, 1.0, 1.0)), Func(self.hideTitleText)) + self.titleTextSeq = Sequence(Wait(0.1), Wait(6.0), self.titleText.colorScaleInterval(0.5, Vec4(1.0, 1.0, 1.0, 0.0)), Func(self.hideTitleText)) self.titleTextSeq.start() def hideTitleText(self): diff --git a/toontown/shtiker/OptionsPage.py b/toontown/shtiker/OptionsPage.py index cc6f611..dabc187 100644 --- a/toontown/shtiker/OptionsPage.py +++ b/toontown/shtiker/OptionsPage.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -from libotp import Settings +from libotp import * import ShtikerPage from toontown.toontowngui import TTDialog from direct.gui.DirectGui import *