2015-06-02 12:07:50 -05:00
|
|
|
from otp.ai.MagicWordGlobal import *
|
2015-03-03 16:10:12 -06:00
|
|
|
from otp.avatar.Avatar import teleportNotify
|
|
|
|
from toontown.chat import ToonChatGarbler
|
2015-06-02 12:07:50 -05:00
|
|
|
from toontown.toonbase import ToontownGlobals
|
2015-03-03 16:10:12 -06:00
|
|
|
|
|
|
|
class FriendHandle:
|
2015-06-02 12:07:50 -05:00
|
|
|
def __init__(self, doId, name, style, adminAccess, petId, isAPet = False):
|
2015-03-03 16:10:12 -06:00
|
|
|
self.doId = doId
|
|
|
|
self.style = style
|
|
|
|
self.petId = petId
|
2015-06-02 12:07:50 -05:00
|
|
|
self.adminAccess = adminAccess
|
2015-03-03 16:10:12 -06:00
|
|
|
self.isAPet = isAPet
|
|
|
|
self.chatGarbler = ToonChatGarbler.ToonChatGarbler()
|
|
|
|
self.name = name
|
|
|
|
|
|
|
|
def getDoId(self):
|
|
|
|
return self.doId
|
|
|
|
|
2015-06-02 12:07:50 -05:00
|
|
|
def getAdminAccess(self):
|
|
|
|
return self.adminAccess
|
2015-07-05 18:59:25 -05:00
|
|
|
|
2015-06-02 12:07:50 -05:00
|
|
|
def isAdmin(self):
|
|
|
|
return self.adminAccess >= MINIMUM_MAGICWORD_ACCESS
|
|
|
|
|
2015-03-03 16:10:12 -06:00
|
|
|
def getPetId(self):
|
|
|
|
return self.petId
|
|
|
|
|
|
|
|
def hasPet(self):
|
|
|
|
return self.getPetId() != 0
|
|
|
|
|
|
|
|
def isPet(self):
|
|
|
|
return self.isAPet
|
|
|
|
|
|
|
|
def getName(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
def getFont(self):
|
|
|
|
return ToontownGlobals.getToonFont()
|
|
|
|
|
|
|
|
def getStyle(self):
|
|
|
|
return self.style
|
|
|
|
|
|
|
|
def uniqueName(self, idString):
|
|
|
|
return idString + '-' + str(self.getDoId())
|
|
|
|
|
2015-05-11 14:05:59 -05:00
|
|
|
def d_battleSOS(self, sendToId):
|
2015-05-16 22:00:56 -05:00
|
|
|
base.cr.ttsFriendsManager.d_battleSOS(self.doId)
|
2015-03-03 16:10:12 -06:00
|
|
|
|
|
|
|
def d_teleportQuery(self, requesterId):
|
|
|
|
teleportNotify.debug('sending d_teleportQuery(%s)' % (requesterId,))
|
|
|
|
|
2015-05-16 22:00:56 -05:00
|
|
|
base.cr.ttsFriendsManager.d_teleportQuery(self.doId)
|
2015-03-03 16:10:12 -06:00
|
|
|
|
|
|
|
def d_teleportResponse(self, avId, available, shardId, hoodId, zoneId):
|
|
|
|
teleportNotify.debug('sending teleportResponse%s' % ((avId, available,
|
|
|
|
shardId, hoodId, zoneId),)
|
|
|
|
)
|
|
|
|
|
2015-05-16 22:00:56 -05:00
|
|
|
base.cr.ttsFriendsManager.d_teleportResponse(self.doId, available,
|
2015-03-03 16:10:12 -06:00
|
|
|
shardId, hoodId, zoneId
|
|
|
|
)
|
|
|
|
|
|
|
|
def d_teleportGiveup(self, requesterId):
|
|
|
|
teleportNotify.debug('sending d_teleportGiveup(%s)' % (requesterId,))
|
|
|
|
|
2015-05-16 22:00:56 -05:00
|
|
|
base.cr.ttsFriendsManager.d_teleportGiveup(self.doId)
|
2015-03-03 16:10:12 -06:00
|
|
|
|
|
|
|
def isUnderstandable(self):
|
2015-05-30 11:09:41 -05:00
|
|
|
if settings['speedchatPlus']:
|
|
|
|
return 1
|
2015-05-31 06:12:48 -05:00
|
|
|
elif settings['trueFriends'] and base.localAvatar.isTrueFriends(self.doId):
|
2015-05-30 11:09:41 -05:00
|
|
|
return 1
|
|
|
|
return 0
|