diff --git a/otp/friends/FriendManagerAI.py b/otp/friends/FriendManagerAI.py index 1478122..5082c89 100644 --- a/otp/friends/FriendManagerAI.py +++ b/otp/friends/FriendManagerAI.py @@ -311,9 +311,8 @@ class FriendManagerAI(DistributedObjectGlobalAI): def makeFriends(self, invite): # The invitee agreed to make friends. - if __astron__ and hasattr(self.air, 'toontownFriendsManager') and self.air.toontownFriendsManager: - self.air.toontownFriendsManager.makeFriends(invite.inviteeId, invite.inviterId, 0, - invite.context) + self.air.makeFriends(invite.inviteeId, invite.inviterId, 0, + invite.context) self.down_friendResponse(invite.inviterId, 1, invite.context) # The reply will clear the context out when it comes in. diff --git a/toontown/ai/ToontownAIRepository.py b/toontown/ai/ToontownAIRepository.py index dba02dc..abfe426 100644 --- a/toontown/ai/ToontownAIRepository.py +++ b/toontown/ai/ToontownAIRepository.py @@ -216,7 +216,8 @@ class ToontownAIRepository(ToontownInternalRepository): if __astron__: # Create our Toontown friends manager... # TODO: Is this Astron specific? - self.toontownFriendsManager = self.generateGlobalObject(OTP_DO_ID_TOONTOWN_FRIENDS_MANAGER, 'ToontownFriendsManager') + self.toontownFriendsManager = self.generateGlobalObject(OTP_DO_ID_TOONTOWN_FRIENDS_MANAGER, + 'ToontownFriendsManager') def generateHood(self, hoodConstructor, zoneId): # Bossbot HQ doesn't use DNA, so we skip over that. @@ -466,3 +467,15 @@ class ToontownAIRepository(ToontownInternalRepository): def trueUniqueName(self, idString): return self.uniqueName(idString) + + def makeFriends(self, avatarAId, avatarBId, flags, context): + """ + Requests to make a friendship between avatarA and avatarB with + the indicated flags (or upgrade an existing friendship with + the indicated flags). The context is any arbitrary 32-bit + integer. When the friendship is made, or the operation fails, + the "makeFriendsReply" event is generated, with two + parameters: an integer result code, and the supplied context. + """ + if __astron__: + self.toontownFriendsManager.sendMakeFriends(avatarAId, avatarBId, flags, context) diff --git a/toontown/friends/ToontownFriendsManagerAI.py b/toontown/friends/ToontownFriendsManagerAI.py index 6118543..0ec104d 100644 --- a/toontown/friends/ToontownFriendsManagerAI.py +++ b/toontown/friends/ToontownFriendsManagerAI.py @@ -13,15 +13,7 @@ class ToontownFriendsManagerAI(DistributedObjectGlobalAI): datagram.addUint8(whitelistChatFlags) # whitelistChatFlags self.sendUpdateToAvatarId(avId, 'friendOnline', [datagram.getMessage()]) - def makeFriends(self, avatarAId, avatarBId, flags, context): - """ - Requests to make a friendship between avatarA and avatarB with - the indicated flags (or upgrade an existing friendship with - the indicated flags). The context is any arbitrary 32-bit - integer. When the friendship is made, or the operation fails, - the "makeFriendsReply" event is generated, with two - parameters: an integer result code, and the supplied context. - """ + def sendMakeFriends(self, avatarAId, avatarBId, flags, context): self.sendUpdate('makeFriends', [avatarAId, avatarBId, flags, context]) def makeFriendsResponse(self, avatarAId, avatarBId, result, context):