friends: Move makeFriends to AI repository
This commit is contained in:
parent
8f2cf3604c
commit
9bd593f139
|
|
@ -311,9 +311,8 @@ class FriendManagerAI(DistributedObjectGlobalAI):
|
||||||
|
|
||||||
def makeFriends(self, invite):
|
def makeFriends(self, invite):
|
||||||
# The invitee agreed to make friends.
|
# The invitee agreed to make friends.
|
||||||
if __astron__ and hasattr(self.air, 'toontownFriendsManager') and self.air.toontownFriendsManager:
|
self.air.makeFriends(invite.inviteeId, invite.inviterId, 0,
|
||||||
self.air.toontownFriendsManager.makeFriends(invite.inviteeId, invite.inviterId, 0,
|
invite.context)
|
||||||
invite.context)
|
|
||||||
self.down_friendResponse(invite.inviterId, 1, invite.context)
|
self.down_friendResponse(invite.inviterId, 1, invite.context)
|
||||||
# The reply will clear the context out when it comes in.
|
# The reply will clear the context out when it comes in.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,8 @@ class ToontownAIRepository(ToontownInternalRepository):
|
||||||
if __astron__:
|
if __astron__:
|
||||||
# Create our Toontown friends manager...
|
# Create our Toontown friends manager...
|
||||||
# TODO: Is this Astron specific?
|
# 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):
|
def generateHood(self, hoodConstructor, zoneId):
|
||||||
# Bossbot HQ doesn't use DNA, so we skip over that.
|
# Bossbot HQ doesn't use DNA, so we skip over that.
|
||||||
|
|
@ -466,3 +467,15 @@ class ToontownAIRepository(ToontownInternalRepository):
|
||||||
|
|
||||||
def trueUniqueName(self, idString):
|
def trueUniqueName(self, idString):
|
||||||
return self.uniqueName(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)
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,7 @@ class ToontownFriendsManagerAI(DistributedObjectGlobalAI):
|
||||||
datagram.addUint8(whitelistChatFlags) # whitelistChatFlags
|
datagram.addUint8(whitelistChatFlags) # whitelistChatFlags
|
||||||
self.sendUpdateToAvatarId(avId, 'friendOnline', [datagram.getMessage()])
|
self.sendUpdateToAvatarId(avId, 'friendOnline', [datagram.getMessage()])
|
||||||
|
|
||||||
def makeFriends(self, avatarAId, avatarBId, flags, context):
|
def sendMakeFriends(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.
|
|
||||||
"""
|
|
||||||
self.sendUpdate('makeFriends', [avatarAId, avatarBId, flags, context])
|
self.sendUpdate('makeFriends', [avatarAId, avatarBId, flags, context])
|
||||||
|
|
||||||
def makeFriendsResponse(self, avatarAId, avatarBId, result, context):
|
def makeFriendsResponse(self, avatarAId, avatarBId, result, context):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue