mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00:00
(kill me) DANIEL: Friends list cleanup
This commit is contained in:
parent
3e97752dff
commit
e52d47367c
6 changed files with 2 additions and 103 deletions
2
dependencies/astron/dclass/stride.dc
vendored
2
dependencies/astron/dclass/stride.dc
vendored
|
@ -3325,11 +3325,9 @@ uint32 petId;
|
|||
|
||||
dclass TTSFriendsManager : DistributedObjectGlobal {
|
||||
removeFriend(uint32) clsend;
|
||||
requestAvatarInfo(uint32[]) clsend;
|
||||
|
||||
requestFriendsList() clsend;
|
||||
|
||||
friendInfo(Friend);
|
||||
friendList(Friend []);
|
||||
|
||||
friendOnline(uint32);
|
||||
|
|
|
@ -1263,9 +1263,6 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
self.considerHeartbeat()
|
||||
return
|
||||
|
||||
def queueRequestAvatarInfo(self, avId):
|
||||
pass
|
||||
|
||||
def identifyFriend(self, doId):
|
||||
pass
|
||||
|
||||
|
|
|
@ -740,28 +740,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
self.friendsMapPending = 0
|
||||
messenger.send('friendsMapComplete')
|
||||
|
||||
def handleGetFriendsListExtended(self, resp):
|
||||
for toon in resp:
|
||||
abort = 0
|
||||
doId = toon[0]
|
||||
name = toon[1]
|
||||
if name == '':
|
||||
abort = 1
|
||||
dnaString = toon[2]
|
||||
if dnaString == '':
|
||||
abort = 1
|
||||
else:
|
||||
dna = ToonDNA.ToonDNA()
|
||||
dna.makeFromNetString(dnaString)
|
||||
adminAccess = toon[3]
|
||||
petId = toon[4]
|
||||
if not abort:
|
||||
handle = FriendHandle.FriendHandle(doId, name, dna, adminAccess, petId)
|
||||
avatarHandleList.append(handle)
|
||||
|
||||
if avatarHandleList:
|
||||
messenger.send('gotExtraFriendHandles', [avatarHandleList])
|
||||
|
||||
def handleFriendOnline(self, doId):
|
||||
self.notify.debug('Friend %d now online.' % doId)
|
||||
if doId not in self.friendsOnline:
|
||||
|
@ -946,26 +924,5 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
def _abandonShard(self):
|
||||
for doId, obj in self.doId2do.items():
|
||||
if obj.parentId == localAvatar.defaultShard and obj is not localAvatar:
|
||||
|
||||
self.deleteObject(doId)
|
||||
|
||||
def requestAvatarInfo(self, avId):
|
||||
if avId == 0:
|
||||
return
|
||||
self.ttsFriendsManager.d_requestAvatarInfo([avId])
|
||||
|
||||
def queueRequestAvatarInfo(self, avId):
|
||||
removeTask = 0
|
||||
if not hasattr(self, 'avatarInfoRequests'):
|
||||
self.avatarInfoRequests = []
|
||||
if self.avatarInfoRequests:
|
||||
taskMgr.remove('avatarRequestQueueTask')
|
||||
if avId not in self.avatarInfoRequests:
|
||||
self.avatarInfoRequests.append(avId)
|
||||
taskMgr.doMethodLater(0.1, self.sendAvatarInfoRequests, 'avatarRequestQueueTask')
|
||||
|
||||
def sendAvatarInfoRequests(self, task = None):
|
||||
if not hasattr(self, 'avatarInfoRequests'):
|
||||
return
|
||||
if len(self.avatarInfoRequests) == 0:
|
||||
return
|
||||
self.ttsFriendsManager.d_requestAvatarInfo(self.avatarInfoRequests)
|
||||
|
|
|
@ -271,8 +271,8 @@ class FriendsListPanel(DirectFrame, StateData.StateData):
|
|||
friendButton.destroy()
|
||||
del self.friends[friendId]
|
||||
|
||||
self.createButtons(admins, NametagColors[CCAdmin][0][0])
|
||||
self.createButtons(petFriends, NametagColors[CCNonPlayer][0][0])
|
||||
self.createButtons(admins, NametagColors[CCAdmin][0][0])
|
||||
self.createButtons(trueFriends, NametagColors[CCNormal][0][0])
|
||||
self.createButtons(friends, NametagColors[CCSpeedChat][0][0])
|
||||
|
||||
|
|
|
@ -6,15 +6,9 @@ class TTSFriendsManager(DistributedObjectGlobal):
|
|||
def d_removeFriend(self, friendId):
|
||||
self.sendUpdate('removeFriend', [friendId])
|
||||
|
||||
def d_requestAvatarInfo(self, friendIds):
|
||||
self.sendUpdate('requestAvatarInfo', [friendIds])
|
||||
|
||||
def d_requestFriendsList(self):
|
||||
self.sendUpdate('requestFriendsList', [])
|
||||
|
||||
def friendInfo(self, resp):
|
||||
base.cr.handleGetFriendsListExtended(resp)
|
||||
|
||||
def friendList(self, resp):
|
||||
base.cr.handleGetFriendsList(resp)
|
||||
|
||||
|
|
|
@ -117,46 +117,6 @@ class RemoveFriendOperation(OperationFSM):
|
|||
{'setFriendsList' : [friendsList]})
|
||||
self.demand('Off')
|
||||
|
||||
|
||||
# -- Avatar Details --
|
||||
class FriendDetailsOperation(OperationFSM):
|
||||
|
||||
def __init__(self, mgr, air, senderAvId, targetAvId=None, callback=None, friendIds=None):
|
||||
OperationFSM.__init__(self, mgr, air, senderAvId, targetAvId, callback)
|
||||
self.friendIds = friendIds
|
||||
|
||||
def enterStart(self):
|
||||
self.air.dbInterface.queryObject(self.air.dbId, self.sender,
|
||||
self.handleRetrieve)
|
||||
|
||||
def handleRetrieve(self, dclass, fields):
|
||||
if dclass != self.air.dclassesByName['DistributedToonUD']:
|
||||
self.demand('Error', 'Distributed Class was not a Toon.')
|
||||
return
|
||||
|
||||
self.demand('Retrieved', fields['setFriendsList'][0])
|
||||
|
||||
def enterRetrieved(self, friendsList):
|
||||
self.currId = 0
|
||||
for id in self.friendIds:
|
||||
if id in friendsList:
|
||||
self.currId = id
|
||||
self.air.dbInterface.queryObject(self.air.dbId, id,
|
||||
self.handleFriend)
|
||||
self.demand('Off')
|
||||
|
||||
def handleFriend(self, dclass, fields):
|
||||
if dclass != self.air.dclassesByName['DistributedToonUD']:
|
||||
self.demand('Error', 'Distributed Class was not a Toon.')
|
||||
return
|
||||
name = fields['setName'][0]
|
||||
dna = fields['setDNAString'][0]
|
||||
petId = fields['setPetId'][0]
|
||||
|
||||
self.mgr.sendUpdateToAvatarId(self.sender, 'friendInfo',
|
||||
[self.currId, name, dna, petId])
|
||||
|
||||
|
||||
# -- Clear List --
|
||||
class ClearListOperation(OperationFSM):
|
||||
|
||||
|
@ -221,13 +181,6 @@ class TTSFriendsManagerUD(DistributedObjectGlobalUD):
|
|||
newOperation.demand('Start')
|
||||
|
||||
# -- Avatar Info --
|
||||
def requestAvatarInfo(self, friendIdList):
|
||||
avId = self.air.getAvatarIdFromSender()
|
||||
newOperation = FriendDetailsOperation(self, self.air, avId,
|
||||
friendIds = friendIdList)
|
||||
self.operations.append(newOperation)
|
||||
newOperation.demand('Start')
|
||||
|
||||
def getAvatarDetails(self, avId):
|
||||
senderId = self.air.getAvatarIdFromSender()
|
||||
def handleToon(dclass, fields):
|
||||
|
|
Loading…
Reference in a new issue