From 895ad8c560b77e68b54efc45a295e87765ce1069 Mon Sep 17 00:00:00 2001 From: John Cote Date: Mon, 26 Jul 2021 23:43:23 -0400 Subject: [PATCH] friends: Add post remove for going offline --- etc/toon.dc | 1 + otp/login/AstronLoginManagerUD.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/etc/toon.dc b/etc/toon.dc index 60c68b3..efe2ece 100755 --- a/etc/toon.dc +++ b/etc/toon.dc @@ -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); diff --git a/otp/login/AstronLoginManagerUD.py b/otp/login/AstronLoginManagerUD.py index bdc6c93..d1d1c5a 100644 --- a/otp/login/AstronLoginManagerUD.py +++ b/otp/login/AstronLoginManagerUD.py @@ -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()