Poodletooth-iLand/otp/friends/AvatarFriendInfo.py
2015-04-06 15:48:06 +03: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 settings['speedchatPlus']:
result = True
except:
pass
return result
def isOnline(self):
return self.onlineYesNo