Poodletooth-iLand/otp/friends/FriendInfo.py

47 lines
1.6 KiB
Python
Raw Normal View History

2015-03-03 16:10:12 -06:00
from otp.avatar.AvatarHandle import AvatarHandle
class FriendInfo(AvatarHandle):
def __init__(self, avatarName = '', playerName = '', onlineYesNo = 0, openChatEnabledYesNo = 0, openChatFriendshipYesNo = 0, wlChatEnabledYesNo = 0, location = '', sublocation = '', timestamp = 0, avatarId = 0, friendPrivs = 0, tokenPrivs = 0):
self.avatarName = avatarName
self.playerName = playerName
self.onlineYesNo = onlineYesNo
self.openChatEnabledYesNo = openChatEnabledYesNo
self.openChatFriendshipYesNo = openChatFriendshipYesNo
self.wlChatEnabledYesNo = wlChatEnabledYesNo
self.location = location
self.sublocation = sublocation
self.timestamp = timestamp
self.avatarId = avatarId
self.friendPrivs = friendPrivs
self.tokenPrivs = tokenPrivs
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
2015-04-06 07:48:06 -05:00
elif self.wlChatEnabledYesNo and settings['speedchatPlus']:
2015-03-03 16:10:12 -06:00
result = True
except:
pass
return result
def isOnline(self):
return self.onlineYesNo