DANIEL: Nametag color shit

This commit is contained in:
John 2015-06-02 20:44:55 +03:00 committed by Loudrob
parent 702260b1b7
commit 3e97752dff
5 changed files with 21 additions and 24 deletions

View file

@ -1024,7 +1024,7 @@ class CatalogScreen(DirectFrame):
def __makeFFlist(self):
for id, handle in base.cr.friendsMap.items():
self.ffList.append((id, handle.getName(), NametagGlobals.getFriendColor(id)))
self.ffList.append((id, handle.getName(), NametagGlobals.getFriendColor(handle)))
def __makeScrollList(self):
for ff in self.ffList:

View file

@ -651,25 +651,8 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
elif self.cache.contains(doId):
teleportNotify.debug('found friend %s in cache' % doId)
avatar = self.cache.dict[doId]
else:
self.notify.warning("Don't know who friend %s is." % doId)
return
if not ((isinstance(avatar, DistributedToon.DistributedToon) and avatar.__class__ is DistributedToon.DistributedToon) or isinstance(avatar, DistributedPet.DistributedPet)):
self.notify.warning('friendsNotify%s: invalid friend object %s' % (choice(source, '(%s)' % source, ''), doId))
return
if base.wantPets:
if avatar.isPet():
if avatar.bFake:
handle = PetHandle.PetHandle(avatar)
else:
handle = avatar
else:
handle = FriendHandle.FriendHandle(doId, avatar.getName(), avatar.style, avatar.adminAccess, avatar.getPetId())
else:
handle = FriendHandle.FriendHandle(doId, avatar.getName(), avatar.style, avatar.adminAccess, '')
teleportNotify.debug('adding %s to friendsMap' % doId)
self.friendsMap[doId] = handle
return handle
self.notify.warning("Don't know who friend %s is." % doId)
return
def identifyAvatar(self, doId):
if doId in self.doId2do:

View file

@ -109,7 +109,7 @@ class ToonStatueSelectionGUI(DirectFrame):
handle = base.cr.identifyFriend(friendId)
if handle and not self.checkFamily(friendId):
if hasattr(handle, 'getName'):
newFF = (friendId, handle.getName(), NametagGlobals.getFriendColor(friendId))
newFF = (friendId, handle.getName(), NametagGlobals.getFriendColor(handle))
self.ffList.append(newFF)
else:
self.notify.warning('Bad Handle for getName in makeFFlist')

View file

@ -237,6 +237,7 @@ class FriendsListPanel(DirectFrame, StateData.StateData):
def __updateScrollList(self):
petFriends = []
admins = []
trueFriends = []
friends = []
@ -246,7 +247,15 @@ class FriendsListPanel(DirectFrame, StateData.StateData):
for friendId in base.localAvatar.friendsList:
if self.panelType != FLPOnline or base.cr.isFriendOnline(friendId):
if base.localAvatar.isTrueFriends(friendId):
handle = base.cr.identifyFriend(friendId)
if not handle:
base.cr.fillUpFriendsMap()
return
if handle.isAdmin():
admins.insert(0, friendId)
elif base.localAvatar.isTrueFriends(friendId):
trueFriends.insert(0, friendId)
else:
friends.insert(0, friendId)
@ -262,6 +271,7 @@ 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(trueFriends, NametagColors[CCNormal][0][0])
self.createButtons(friends, NametagColors[CCSpeedChat][0][0])

View file

@ -134,8 +134,12 @@ def getModelWidthHeight(model):
height = maxPoint.getZ() - minPoint.getZ()
return (width, height)
def getFriendColor(id):
return CCNormal if settings['trueFriends'] and base.localAvatar.isTrueFriends(id) else CCNormal
def getFriendColor(handle):
if handle.isAdmin():
return CCAdmin
elif settings['trueFriends'] and base.localAvatar.isTrueFriends(handle.doId):
return CCNormal
return CCSpeedChat
# Foreground, background:
NametagColors = {