general: Fix some issues, cleanup

This commit is contained in:
John Cote 2019-11-17 18:15:48 -05:00
parent f199fd055d
commit bab8474cb9
4 changed files with 52 additions and 47 deletions

View file

@ -1169,9 +1169,14 @@ class OTPClientRepository(ClientRepositoryBase):
else: else:
self.startPeriodTimer() self.startPeriodTimer()
@report(types=['args', 'deltaStamp'], dConfigParam='teleport') if not config.GetBool('astron-support', True):
def handleAvatarResponseMsg(self, di): @report(types=['args', 'deltaStamp'], dConfigParam='teleport')
pass def handleAvatarResponseMsg(self, di):
pass
else:
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def handleAvatarResponseMsg(self, avatarId, di):
pass
@report(types=['args', 'deltaStamp'], dConfigParam='teleport') @report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def handleWaitForSetAvatarResponse(self, msgType, di): def handleWaitForSetAvatarResponse(self, msgType, di):
@ -1676,17 +1681,15 @@ class OTPClientRepository(ClientRepositoryBase):
def handlePlayGame(self, msgType, di): def handlePlayGame(self, msgType, di):
if self.notify.getDebug(): if self.notify.getDebug():
self.notify.debug('handle play game got message type: ' + `msgType`) self.notify.debug('handle play game got message type: ' + `msgType`)
if self.__recordObjectMessage(msgType, di):
return
if msgType == CLIENT_ENTER_OBJECT_REQUIRED: if msgType == CLIENT_ENTER_OBJECT_REQUIRED:
self.handleGenerateWithRequired(di) self.handleGenerateWithRequired(di)
elif msgType == CLIENT_ENTER_OBJECT_REQUIRED_OTHER: elif msgType == CLIENT_ENTER_OBJECT_REQUIRED_OTHER:
self.handleGenerateWithRequiredOther(di) self.handleGenerateWithRequired(di, other=True)
elif msgType == CLIENT_OBJECT_SET_FIELD: elif msgType == CLIENT_OBJECT_SET_FIELD:
self.handleUpdateField(di) self.handleUpdateField(di)
elif msgType == CLIENT_OBJECT_DISABLE: elif msgType == CLIENT_OBJECT_LEAVING:
self.handleDisable(di)
elif msgType == CLIENT_OBJECT_DISABLE_OWNER:
self.handleDisable(di, ownerView=True)
elif msgType == CLIENT_OBJECT_DELETE_RESP:
self.handleDelete(di) self.handleDelete(di)
else: else:
self.handleMessageType(msgType, di) self.handleMessageType(msgType, di)
@ -1970,42 +1973,8 @@ class OTPClientRepository(ClientRepositoryBase):
messenger.send('periodTimerExpired') messenger.send('periodTimerExpired')
return Task.done return Task.done
def handleMessageType(self, msgType, di): if not config.GetBool('astron-support', True):
if self.astronSupport: 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'
else:
if msgType == CLIENT_GO_GET_LOST: if msgType == CLIENT_GO_GET_LOST:
self.handleGoGetLost(di) self.handleGoGetLost(di)
elif msgType == CLIENT_HEARTBEAT: elif msgType == CLIENT_HEARTBEAT:
@ -2047,6 +2016,41 @@ class OTPClientRepository(ClientRepositoryBase):
currentGameStateName = currentGameState.getName() currentGameStateName = currentGameState.getName()
else: else:
currentGameStateName = 'None' 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): def gotInterestDoneMessage(self, di):
if self.deferredGenerates: if self.deferredGenerates:

View file

@ -1130,6 +1130,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
dclass.stopGenerate() dclass.stopGenerate()
def handleGenerateWithRequiredOtherOwner(self, di): def handleGenerateWithRequiredOtherOwner(self, di):
# OwnerViews are only used for LocalToon in Toontown.
if self.loginFSM.getCurrentState().getName() == 'waitForSetAvatarResponse': if self.loginFSM.getCurrentState().getName() == 'waitForSetAvatarResponse':
doId = di.getUint32() doId = di.getUint32()
parentId = di.getUint32() parentId = di.getUint32()

View file

@ -58,7 +58,7 @@ class Hood(StateData.StateData):
self.titleText.setColor(Vec4(*self.titleColor)) self.titleText.setColor(Vec4(*self.titleColor))
self.titleText.clearColorScale() self.titleText.clearColorScale()
self.titleText.setFg(self.titleColor) 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() self.titleTextSeq.start()
def hideTitleText(self): def hideTitleText(self):

View file

@ -1,5 +1,5 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from libotp import Settings from libotp import *
import ShtikerPage import ShtikerPage
from toontown.toontowngui import TTDialog from toontown.toontowngui import TTDialog
from direct.gui.DirectGui import * from direct.gui.DirectGui import *