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