oldschool-toontown/otp/friends/AvatarFriendInfo.py
2019-11-02 18:27:54 -04:00

41 lines
1.4 KiB
Python

from otp.avatar.AvatarHandle import AvatarHandle
class AvatarFriendInfo(AvatarHandle):
def __init__(self, avatarName = '', playerName = '', playerId = 0, onlineYesNo = 0, openChatEnabledYesNo = 0, openChatFriendshipYesNo = 0, wlChatEnabledYesNo = 0):
self.avatarName = avatarName
self.playerName = playerName
self.playerId = playerId
self.onlineYesNo = onlineYesNo
self.openChatEnabledYesNo = openChatEnabledYesNo
self.openChatFriendshipYesNo = openChatFriendshipYesNo
self.wlChatEnabledYesNo = wlChatEnabledYesNo
self.understandableYesNo = self.isUnderstandable()
def calcUnderstandableYesNo(self):
self.understandableYesNo = self.isUnderstandable()
def getName(self):
if self.avatarName:
return self.avatarName
elif self.playerName:
return self.playerName
else:
return ''
def isUnderstandable(self):
result = False
try:
if self.openChatFriendshipYesNo:
result = True
elif self.openChatEnabledYesNo and base.cr.openChatEnabled:
result = True
elif self.wlChatEnabledYesNo and base.cr.whiteListChatEnabled:
result = True
except:
pass
return result
def isOnline(self):
return self.onlineYesNo