mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 03:35:12 -06:00
Friends list bug fix
This commit is contained in:
parent
e2d7b9b674
commit
9d43264adc
3 changed files with 20 additions and 23 deletions
|
@ -637,15 +637,13 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
if doId in self.friendsMap:
|
||||
teleportNotify.debug('friend %s in friendsMap' % doId)
|
||||
return self.friendsMap[doId]
|
||||
avatar = None
|
||||
if doId in self.doId2do:
|
||||
teleportNotify.debug('found friend %s in doId2do' % doId)
|
||||
avatar = self.doId2do[doId]
|
||||
return self.doId2do[doId]
|
||||
elif self.cache.contains(doId):
|
||||
teleportNotify.debug('found friend %s in cache' % doId)
|
||||
avatar = self.cache.dict[doId]
|
||||
return self.cache.dict[doId]
|
||||
self.notify.warning("Don't know who friend %s is." % doId)
|
||||
return
|
||||
|
||||
def identifyAvatar(self, doId):
|
||||
if doId in self.doId2do:
|
||||
|
@ -661,6 +659,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
if base.wantPets and base.localAvatar.hasPet():
|
||||
if base.localAvatar.getPetId() not in self.friendsMap:
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
def removeFriend(self, avatarId):
|
||||
|
@ -736,16 +735,14 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
def handleFriendOnline(self, doId):
|
||||
self.notify.debug('Friend %d now online.' % doId)
|
||||
if doId not in self.friendsOnline:
|
||||
self.friendsOnline[doId] = self.identifyFriend(doId)
|
||||
self.friendsOnline[doId] = self.identifyAvatar(doId)
|
||||
messenger.send('friendOnline', [doId])
|
||||
|
||||
def handleFriendOffline(self, doId):
|
||||
self.notify.debug('Friend %d now offline.' % doId)
|
||||
try:
|
||||
if doId in self.friendsOnline:
|
||||
del self.friendsOnline[doId]
|
||||
messenger.send('friendOffline', [doId])
|
||||
except:
|
||||
pass
|
||||
|
||||
def handleGenerateWithRequiredOtherOwner(self, di):
|
||||
# Toontown only makes use of OwnerViews for LocalToon.
|
||||
|
|
|
@ -6,6 +6,7 @@ from toontown.friends import ToontownFriendSecret
|
|||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from otp.nametag.NametagGroup import *
|
||||
from otp.nametag.NametagConstants import *
|
||||
from otp.otpbase import OTPGlobals
|
||||
FLPPets = 1
|
||||
FLPOnline = 2
|
||||
|
@ -241,7 +242,6 @@ class FriendsListPanel(DirectFrame, StateData.StateData):
|
|||
|
||||
def __updateScrollList(self):
|
||||
petFriends = []
|
||||
admins = []
|
||||
trueFriends = []
|
||||
friends = []
|
||||
|
||||
|
@ -257,9 +257,7 @@ class FriendsListPanel(DirectFrame, StateData.StateData):
|
|||
base.cr.fillUpFriendsMap()
|
||||
return
|
||||
|
||||
if handle.isAdmin():
|
||||
admins.insert(0, friendId)
|
||||
elif base.localAvatar.isTrueFriends(friendId):
|
||||
if base.localAvatar.isTrueFriends(friendId):
|
||||
trueFriends.insert(0, friendId)
|
||||
else:
|
||||
friends.insert(0, friendId)
|
||||
|
|
|
@ -65,7 +65,6 @@ class FriendsListOperation(OperationFSM):
|
|||
self.demand('Error', 'Friend was not a Toon')
|
||||
return
|
||||
friendId = self.friendsList[self.friendIndex]
|
||||
|
||||
self.realFriendsList.append([friendId, fields['setName'][0],
|
||||
fields['setDNAString'][0], fields['setAdminAccess'][0], fields['setPetId'][0]])
|
||||
|
||||
|
@ -98,8 +97,10 @@ class RemoveFriendOperation(OperationFSM):
|
|||
self.demand('Retrieved', fields['setFriendsList'][0], fields['setTrueFriends'][0])
|
||||
|
||||
def enterRetrieved(self, friendsList, trueFriendsList):
|
||||
friendsList.remove(self.target)
|
||||
trueFriendsList.remove(self.target)
|
||||
if self.target in friendsList:
|
||||
friendsList.remove(self.target)
|
||||
if self.target in trueFriendsList:
|
||||
trueFriendsList.remove(self.target)
|
||||
if self.sender in self.mgr.onlineToons:
|
||||
dg = self.air.dclassesByName['DistributedToonUD'].aiFormatUpdate(
|
||||
'setFriendsList', self.sender, self.sender,
|
||||
|
@ -115,7 +116,7 @@ class RemoveFriendOperation(OperationFSM):
|
|||
|
||||
self.air.dbInterface.updateObject(self.air.dbId, self.sender,
|
||||
self.air.dclassesByName['DistributedToonUD'],
|
||||
{'setFriendsList' : [friendsList], 'setTrueFriends' : [trueFriendsList]})
|
||||
{'setFriendsList' : [friendsList], 'setTrueFriends': [trueFriendsList]})
|
||||
self.demand('Off')
|
||||
|
||||
# -- Clear List --
|
||||
|
@ -201,7 +202,7 @@ class TTSFriendsManagerUD(DistributedObjectGlobalUD):
|
|||
|
||||
self.sendUpdateToAvatarId(senderId, 'friendDetails', [avId, inventory, trackAccess, trophies, hp, maxHp, defaultShard, lastHood, dnaString, experience, trackBonusLevel])
|
||||
self.air.dbInterface.queryObject(self.air.dbId, avId, handleToon)
|
||||
|
||||
|
||||
def getPetDetails(self, avId):
|
||||
senderId = self.air.getAvatarIdFromSender()
|
||||
def handlePet(dclass, fields):
|
||||
|
@ -235,9 +236,10 @@ class TTSFriendsManagerUD(DistributedObjectGlobalUD):
|
|||
self.air.send(dg)
|
||||
|
||||
for friend in friendsList:
|
||||
if friend[0] in self.onlineToons:
|
||||
self.sendUpdateToAvatarId(doId, 'friendOnline', [friend[0]])
|
||||
self.sendUpdateToAvatarId(friend[0], 'friendOnline', [doId])
|
||||
friendId = friend[0]
|
||||
if friendId in self.onlineToons:
|
||||
self.sendUpdateToAvatarId(doId, 'friendOnline', [friendId])
|
||||
self.sendUpdateToAvatarId(friendId, 'friendOnline', [doId])
|
||||
|
||||
def goingOffline(self, avId):
|
||||
self.toonOffline(avId)
|
||||
|
@ -249,9 +251,9 @@ class TTSFriendsManagerUD(DistributedObjectGlobalUD):
|
|||
if dclass != self.air.dclassesByName['DistributedToonUD']:
|
||||
return
|
||||
friendsList = fields['setFriendsList'][0]
|
||||
for friendId in friendsList:
|
||||
if friendId in self.onlineToons:
|
||||
self.sendUpdateToAvatarId(friendId, 'friendOffline', [doId])
|
||||
for friend in friendsList:
|
||||
if friend in self.onlineToons:
|
||||
self.sendUpdateToAvatarId(friend, 'friendOffline', [doId])
|
||||
if doId in self.onlineToons:
|
||||
self.onlineToons.remove(doId)
|
||||
if doId in self.toon2data:
|
||||
|
|
Loading…
Reference in a new issue