distributed: Update to newest version of the Astron protocol.
This commit is contained in:
parent
dc48a5c6d1
commit
564e7d5d62
5 changed files with 43 additions and 45 deletions
|
@ -1476,15 +1476,13 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
def handlePlayGame(self, msgType, di):
|
||||
if self.notify.getDebug():
|
||||
self.notify.debug('handle play game got message type: ' + `msgType`)
|
||||
if msgType == CLIENT_CREATE_OBJECT_REQUIRED:
|
||||
if msgType == CLIENT_ENTER_OBJECT_REQUIRED:
|
||||
self.handleGenerateWithRequired(di)
|
||||
elif msgType == CLIENT_CREATE_OBJECT_REQUIRED_OTHER:
|
||||
elif msgType == CLIENT_ENTER_OBJECT_REQUIRED_OTHER:
|
||||
self.handleGenerateWithRequiredOther(di)
|
||||
elif msgType == CLIENT_OBJECT_UPDATE_FIELD:
|
||||
elif msgType == CLIENT_OBJECT_SET_FIELD:
|
||||
self.handleUpdateField(di)
|
||||
elif msgType == CLIENT_OBJECT_DISABLE_RESP:
|
||||
self.handleDisable(di)
|
||||
elif msgType == CLIENT_OBJECT_DELETE_RESP:
|
||||
elif msgType == CLIENT_OBJECT_LEAVING:
|
||||
self.handleDelete(di)
|
||||
else:
|
||||
self.handleMessageType(msgType, di)
|
||||
|
@ -1755,30 +1753,26 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
return Task.done
|
||||
|
||||
def handleMessageType(self, msgType, di):
|
||||
if msgType == CLIENT_GO_GET_LOST:
|
||||
if msgType == CLIENT_EJECT:
|
||||
self.handleGoGetLost(di)
|
||||
elif msgType == CLIENT_HEARTBEAT:
|
||||
self.handleServerHeartbeat(di)
|
||||
elif msgType == CLIENT_CREATE_OBJECT_REQUIRED:
|
||||
elif msgType == CLIENT_ENTER_OBJECT_REQUIRED:
|
||||
self.handleGenerateWithRequired(di)
|
||||
elif msgType == CLIENT_CREATE_OBJECT_REQUIRED_OTHER:
|
||||
elif msgType == CLIENT_ENTER_OBJECT_REQUIRED_OTHER:
|
||||
self.handleGenerateWithRequiredOther(di)
|
||||
elif msgType == CLIENT_CREATE_OBJECT_REQUIRED_OTHER_OWNER:
|
||||
elif msgType == CLIENT_ENTER_OBJECT_REQUIRED_OTHER_OWNER:
|
||||
self.handleGenerateWithRequiredOtherOwner(di)
|
||||
elif msgType == CLIENT_OBJECT_UPDATE_FIELD:
|
||||
elif msgType == CLIENT_OBJECT_SET_FIELD:
|
||||
self.handleUpdateField(di)
|
||||
elif msgType == CLIENT_OBJECT_DISABLE:
|
||||
elif msgType == CLIENT_OBJECT_LEAVING:
|
||||
self.handleDisable(di)
|
||||
elif msgType == CLIENT_OBJECT_DISABLE_OWNER:
|
||||
elif msgType == CLIENT_OBJECT_LEAVING_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_OBJECT_LOCATION:
|
||||
self.gotObjectLocationMessage(di)
|
||||
elif msgType == CLIENT_SET_WISHNAME_RESP:
|
||||
self.gotWishnameResponse(di)
|
||||
else:
|
||||
currentLoginState = self.loginFSM.getCurrentState()
|
||||
if currentLoginState:
|
||||
|
@ -1935,10 +1929,10 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
return False
|
||||
|
||||
def handleGenerateWithRequired(self, di):
|
||||
doId = di.getUint32()
|
||||
parentId = di.getUint32()
|
||||
zoneId = di.getUint32()
|
||||
classId = di.getUint16()
|
||||
doId = di.getUint32()
|
||||
dclass = self.dclassesByNumber[classId]
|
||||
if self._isInvalidPlayerAvatarGenerate(doId, dclass, parentId, zoneId):
|
||||
return
|
||||
|
@ -1947,10 +1941,10 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
dclass.stopGenerate()
|
||||
|
||||
def handleGenerateWithRequiredOther(self, di):
|
||||
doId = di.getUint32()
|
||||
parentId = di.getUint32()
|
||||
zoneId = di.getUint32()
|
||||
classId = di.getUint16()
|
||||
doId = di.getUint32()
|
||||
dclass = self.dclassesByNumber[classId]
|
||||
if self._isInvalidPlayerAvatarGenerate(doId, dclass, parentId, zoneId):
|
||||
return
|
||||
|
@ -1981,30 +1975,30 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
self.doGenerate(parentId, zoneId, classId, doId, di)
|
||||
|
||||
def handleGenerateWithRequiredOtherOwner(self, di):
|
||||
classId = di.getUint16()
|
||||
doId = di.getUint32()
|
||||
parentId = di.getUint32()
|
||||
zoneId = di.getUint32()
|
||||
classId = di.getUint16()
|
||||
dclass = self.dclassesByNumber[classId]
|
||||
dclass.startGenerate()
|
||||
distObj = self.generateWithRequiredOtherFieldsOwner(dclass, doId, di)
|
||||
dclass.stopGenerate()
|
||||
|
||||
def handleQuietZoneGenerateWithRequired(self, di):
|
||||
doId = di.getUint32()
|
||||
parentId = di.getUint32()
|
||||
zoneId = di.getUint32()
|
||||
classId = di.getUint16()
|
||||
doId = di.getUint32()
|
||||
dclass = self.dclassesByNumber[classId]
|
||||
dclass.startGenerate()
|
||||
distObj = self.generateWithRequiredFields(dclass, doId, di, parentId, zoneId)
|
||||
dclass.stopGenerate()
|
||||
|
||||
def handleQuietZoneGenerateWithRequiredOther(self, di):
|
||||
doId = di.getUint32()
|
||||
parentId = di.getUint32()
|
||||
zoneId = di.getUint32()
|
||||
classId = di.getUint16()
|
||||
doId = di.getUint32()
|
||||
dclass = self.dclassesByNumber[classId]
|
||||
dclass.startGenerate()
|
||||
distObj = self.generateWithRequiredOtherFields(dclass, doId, di, parentId, zoneId)
|
||||
|
|
|
@ -39,8 +39,7 @@ class ToontownAIRepository(ToontownInternalRepository):
|
|||
|
||||
# Claim ownership of that district...
|
||||
dg = PyDatagram()
|
||||
dg.addServerHeader(simbase.air.districtId, simbase.air.ourChannel, STATESERVER_OBJECT_SET_AI_CHANNEL)
|
||||
dg.addUint32(simbase.air.districtId)
|
||||
dg.addServerHeader(simbase.air.districtId, simbase.air.ourChannel, STATESERVER_OBJECT_SET_AI)
|
||||
dg.addChannel(simbase.air.ourChannel)
|
||||
simbase.air.send(dg)
|
||||
|
||||
|
|
|
@ -350,7 +350,9 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
localAvatar.setLocation(parentId, zoneId)
|
||||
localAvatar.generateInit()
|
||||
localAvatar.generate()
|
||||
localAvatar.updateAllRequiredFields(dclass, di)
|
||||
dclass.receiveUpdateBroadcastRequiredOwner(localAvatar, di)
|
||||
localAvatar.announceGenerate()
|
||||
localAvatar.postGenerateMessage()
|
||||
self.doId2do[avatarId] = localAvatar
|
||||
localAvatar.initInterface()
|
||||
self.sendGetFriendsListRequest()
|
||||
|
@ -747,6 +749,8 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
|
||||
def sendGetFriendsListRequest(self):
|
||||
self.notify.warning('sendGetFriendsListRequest: TODO!')
|
||||
self.friendsMapPending = 0
|
||||
messenger.send('friendsMapComplete')
|
||||
|
||||
def cleanPetsFromFriendsMap(self):
|
||||
for objId, obj in self.friendsMap.items():
|
||||
|
@ -866,10 +870,11 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
def handleGenerateWithRequiredOtherOwner(self, di):
|
||||
# Toontown only makes use of OwnerViews for LocalToon.
|
||||
if self.loginFSM.getCurrentState().getName() == 'waitForSetAvatarResponse':
|
||||
di.getUint32() # parent
|
||||
di.getUint32() # zone
|
||||
di.getUint16() # dclass
|
||||
self.handleAvatarResponseMsg(di.getUint32(), di)
|
||||
doId = di.getUint32()
|
||||
parentId = di.getUint32()
|
||||
zoneId = di.getUint32()
|
||||
dclassId = di.getUint16()
|
||||
self.handleAvatarResponseMsg(doId, di)
|
||||
|
||||
def getFirstBattle(self):
|
||||
from toontown.battle import DistributedBattleBase
|
||||
|
@ -977,10 +982,10 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
self.sendSetZoneMsg(OTPGlobals.QuietZone)
|
||||
|
||||
def handleQuietZoneGenerateWithRequired(self, di):
|
||||
doId = di.getUint32()
|
||||
parentId = di.getUint32()
|
||||
zoneId = di.getUint32()
|
||||
classId = di.getUint16()
|
||||
doId = di.getUint32()
|
||||
dclass = self.dclassesByNumber[classId]
|
||||
if dclass.getClassDef().neverDisable:
|
||||
dclass.startGenerate()
|
||||
|
@ -988,10 +993,10 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
dclass.stopGenerate()
|
||||
|
||||
def handleQuietZoneGenerateWithRequiredOther(self, di):
|
||||
doId = di.getUint32()
|
||||
parentId = di.getUint32()
|
||||
zoneId = di.getUint32()
|
||||
classId = di.getUint16()
|
||||
doId = di.getUint32()
|
||||
dclass = self.dclassesByNumber[classId]
|
||||
if dclass.getClassDef().neverDisable:
|
||||
dclass.startGenerate()
|
||||
|
|
|
@ -140,11 +140,11 @@ class QuietZoneState(StateData.StateData):
|
|||
|
||||
def handleWaitForQuietZoneResponse(self, msgType, di):
|
||||
self.notify.debug('handleWaitForQuietZoneResponse(' + 'msgType=' + str(msgType) + ', di=' + str(di) + ')')
|
||||
if msgType == CLIENT_CREATE_OBJECT_REQUIRED:
|
||||
if msgType == CLIENT_ENTER_OBJECT_REQUIRED:
|
||||
base.cr.handleQuietZoneGenerateWithRequired(di)
|
||||
elif msgType == CLIENT_CREATE_OBJECT_REQUIRED_OTHER:
|
||||
elif msgType == CLIENT_ENTER_OBJECT_REQUIRED_OTHER:
|
||||
base.cr.handleQuietZoneGenerateWithRequiredOther(di)
|
||||
elif msgType == CLIENT_OBJECT_UPDATE_FIELD:
|
||||
elif msgType == CLIENT_OBJECT_SET_FIELD:
|
||||
base.cr.handleQuietZoneUpdateField(di)
|
||||
elif msgType in QUIET_ZONE_IGNORED_LIST:
|
||||
self.notify.debug('ignoring unwanted message from previous zone')
|
||||
|
@ -153,11 +153,11 @@ class QuietZoneState(StateData.StateData):
|
|||
|
||||
def handleWaitForZoneRedirect(self, msgType, di):
|
||||
self.notify.debug('handleWaitForZoneRedirect(' + 'msgType=' + str(msgType) + ', di=' + str(di) + ')')
|
||||
if msgType == CLIENT_CREATE_OBJECT_REQUIRED:
|
||||
if msgType == CLIENT_ENTER_OBJECT_REQUIRED:
|
||||
base.cr.handleQuietZoneGenerateWithRequired(di)
|
||||
elif msgType == CLIENT_CREATE_OBJECT_REQUIRED_OTHER:
|
||||
elif msgType == CLIENT_ENTER_OBJECT_REQUIRED_OTHER:
|
||||
base.cr.handleQuietZoneGenerateWithRequiredOther(di)
|
||||
elif msgType == CLIENT_OBJECT_UPDATE_FIELD:
|
||||
elif msgType == CLIENT_OBJECT_SET_FIELD:
|
||||
base.cr.handleQuietZoneUpdateField(di)
|
||||
else:
|
||||
base.cr.handlePlayGame(msgType, di)
|
||||
|
|
|
@ -193,7 +193,7 @@ class LoginAccountFSM(OperationFSM):
|
|||
# First, if there's anybody on the account, kill 'em for redundant login:
|
||||
dg = PyDatagram()
|
||||
dg.addServerHeader(self.csm.GetAccountConnectionChannel(self.accountId),
|
||||
self.csm.air.ourChannel, CLIENTAGENT_DISCONNECT)
|
||||
self.csm.air.ourChannel, CLIENTAGENT_EJECT)
|
||||
dg.addUint16(100)
|
||||
dg.addString('This account has been logged in elsewhere.')
|
||||
self.csm.air.send(dg)
|
||||
|
@ -206,7 +206,7 @@ class LoginAccountFSM(OperationFSM):
|
|||
|
||||
# Now set their sender channel to represent their account affiliation:
|
||||
dg = PyDatagram()
|
||||
dg.addServerHeader(self.target, self.csm.air.ourChannel, CLIENTAGENT_SET_SENDER_ID)
|
||||
dg.addServerHeader(self.target, self.csm.air.ourChannel, CLIENTAGENT_SET_CLIENT_ID)
|
||||
dg.addChannel(self.accountId << 32) # accountId in high 32 bits, 0 in low (no avatar)
|
||||
self.csm.air.send(dg)
|
||||
|
||||
|
@ -650,11 +650,11 @@ class LoadAvatarFSM(AvatarOperationFSM):
|
|||
otherCount += 1
|
||||
|
||||
dg = PyDatagram()
|
||||
dg.addServerHeader(self.csm.air.serverId, self.csm.air.ourChannel, STATESERVER_OBJECT_GENERATE_WITH_REQUIRED_OTHER)
|
||||
dg.addServerHeader(self.csm.air.serverId, self.csm.air.ourChannel, STATESERVER_CREATE_OBJECT_WITH_REQUIRED_OTHER)
|
||||
dg.addUint32(self.avId)
|
||||
dg.addUint32(0)
|
||||
dg.addUint32(0)
|
||||
dg.addUint16(dclass.getNumber())
|
||||
dg.addUint32(self.avId)
|
||||
dg.appendData(requiredPacker.getString())
|
||||
dg.addUint16(otherCount)
|
||||
dg.appendData(otherPacker.getString())
|
||||
|
@ -684,13 +684,13 @@ class LoadAvatarFSM(AvatarOperationFSM):
|
|||
|
||||
# Now set their sender channel to represent their account affiliation:
|
||||
dg = PyDatagram()
|
||||
dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_SET_SENDER_ID)
|
||||
dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_SET_CLIENT_ID)
|
||||
dg.addChannel(self.target<<32 | self.avId) # accountId in high 32 bits, avatar in low
|
||||
self.csm.air.send(dg)
|
||||
|
||||
# Finally, grant ownership and shut down.
|
||||
dg = PyDatagram()
|
||||
dg.addServerHeader(self.avId, self.csm.air.ourChannel, STATESERVER_OBJECT_SET_OWNER_RECV)
|
||||
dg.addServerHeader(self.avId, self.csm.air.ourChannel, STATESERVER_OBJECT_SET_OWNER)
|
||||
dg.addChannel(self.target<<32 | self.avId) # accountId in high 32 bits, avatar in low
|
||||
self.csm.air.send(dg)
|
||||
|
||||
|
@ -722,7 +722,7 @@ class UnloadAvatarFSM(OperationFSM):
|
|||
|
||||
# Reset sender channel:
|
||||
dg = PyDatagram()
|
||||
dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_SET_SENDER_ID)
|
||||
dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_SET_CLIENT_ID)
|
||||
dg.addChannel(self.target<<32) # accountId in high 32 bits, no avatar in low
|
||||
self.csm.air.send(dg)
|
||||
|
||||
|
@ -763,7 +763,7 @@ class ClientServicesManagerUD(DistributedObjectGlobalUD):
|
|||
|
||||
def killConnection(self, connId, reason):
|
||||
dg = PyDatagram()
|
||||
dg.addServerHeader(connId, self.air.ourChannel, CLIENTAGENT_DISCONNECT)
|
||||
dg.addServerHeader(connId, self.air.ourChannel, CLIENTAGENT_EJECT)
|
||||
dg.addUint16(122)
|
||||
dg.addString(reason)
|
||||
self.air.send(dg)
|
||||
|
|
Loading…
Reference in a new issue