friends: True friends code from over a month ago

This commit is contained in:
John Cote 2021-09-17 20:44:25 -04:00
parent 895ad8c560
commit 4c49f0c938
5 changed files with 25 additions and 2 deletions

View File

@ -2863,6 +2863,7 @@ dclass ToontownFriendsManager : DistributedObject {
makeFriends(uint32, uint32, uint8, uint32);
makeFriendsResponse(uint32, uint32, uint8, uint32) airecv;
removeFriend(uint32) clsend;
requestSecret(uint32);
};
dclass TTSpeedchatRelay : SpeedchatRelay {

View File

@ -186,8 +186,8 @@ class FriendManagerAI(DistributedObjectGlobalAI):
Sent by the client to the AI to request a new "secret" for the
user.
"""
# TODO
self.notify.info('TODO: requestSecret')
avId = self.air.getAvatarIdFromSender()
self.air.requestSecret(avId)
### Messages sent from AI to inviter client

View File

@ -490,3 +490,18 @@ class ToontownAIRepository(ToontownInternalRepository):
"""
if __astron__:
self.toontownFriendsManager.sendMakeFriends(avatarAId, avatarBId, flags, context)
def requestSecret(self, requesterId):
"""
Requests a "secret" from the friends manager. This is a
unique string that will be associated with the indicated
requesterId, for the purposes of authenticating true-life
friends.
When the secret is ready, a "requestSecretReply" message will
be thrown with three parameters: the result code (0 or 1,
indicating failure or success), the generated secret, and the
requesterId again.
"""
if __astron__:
self.toontownFriendsManager.sendRequestSecret(requesterId)

View File

@ -25,3 +25,6 @@ class ToontownFriendsManagerAI(DistributedObjectGlobalAI):
self.sendFriendOnline(avatarBId, avatarAId, 0, 1)
messenger.send("makeFriendsReply", [result, context])
def sendRequestSecret(self, requesterId):
self.sendUpdate('requestSecret', [requesterId])

View File

@ -421,6 +421,7 @@ class ToontownFriendsManagerUD(DistributedObjectGlobalUD):
def __init__(self, air):
DistributedObjectGlobalUD.__init__(self, air)
self.operations = []
self.secrets = []
def sendMakeFriendsResponse(self, avatarAId, avatarBId, result, context):
self.sendUpdate('makeFriendsResponse', [avatarAId, avatarBId, result, context])
@ -499,3 +500,6 @@ class ToontownFriendsManagerUD(DistributedObjectGlobalUD):
def goingOffline(self, avId):
self.runServerOperation(GoingOfflineOperation, avId)
def requestSecret(self, requesterId):
print('requestSecret')