friends: Add post remove for going offline

This commit is contained in:
John Cote 2021-07-26 23:43:23 -04:00
parent 8d909ba01a
commit 895ad8c560
2 changed files with 12 additions and 3 deletions

View File

@ -2857,6 +2857,7 @@ dclass ToontownFriendsManager : DistributedObject {
getFriendsListResponse(blob);
friendOnline(blob);
friendOffline(blob);
goingOffline(uint32);
getAvatarDetailsRequest(uint32) clsend;
getAvatarDetailsResponse(blob);
makeFriends(uint32, uint32, uint8, uint32);

View File

@ -751,8 +751,8 @@ class LoadAvatarOperation(AvatarOperation):
# Get the client channel.
channel = self.loginManager.GetAccountConnectionChannel(self.sender)
# We will first assign a POST_REMOVE that will unload the
# avatar in the event of them disconnecting while we are working.
# We will first assign a POST_REMOVE that will unload the
# avatar in the event of them disconnecting while we are working.
cleanupDatagram = PyDatagram()
cleanupDatagram.addServerHeader(self.avId, channel, STATESERVER_OBJECT_DELETE_RAM)
cleanupDatagram.addUint32(self.avId)
@ -784,7 +784,15 @@ class LoadAvatarOperation(AvatarOperation):
self.loginManager.air.setOwner(self.avId, channel)
friendsList = [friendId for friendId, _ in self.avatar['setFriendsList'][0]]
self.loginManager.air.toontownFriendsManager.comingOnline(self.avId, friendsList)
friendsManager = self.loginManager.air.toontownFriendsManager
friendsManager.comingOnline(self.avId, friendsList)
cleanupDatagram = friendsManager.dclass.aiFormatUpdate('goingOffline', friendsManager.doId, friendsManager.doId, self.loginManager.air.ourChannel, [self.avId])
datagram = PyDatagram()
datagram.addServerHeader(channel, self.loginManager.air.ourChannel, CLIENTAGENT_ADD_POST_REMOVE)
datagram.addUint16(cleanupDatagram.getLength())
datagram.appendData(cleanupDatagram.getMessage())
self.loginManager.air.send(datagram)
self._handleDone()