2015-03-03 16:10:12 -06:00
|
|
|
from direct.directnotify import DirectNotifyGlobal
|
|
|
|
from direct.showbase import DirectObject
|
|
|
|
from otp.chat.ChatGlobals import *
|
|
|
|
from toontown.chat.ChatGlobals import *
|
2015-05-30 14:47:29 -05:00
|
|
|
import ChatUtil
|
2015-03-03 16:10:12 -06:00
|
|
|
|
|
|
|
class TalkAssistant(DirectObject.DirectObject):
|
|
|
|
notify = DirectNotifyGlobal.directNotify.newCategory('TalkAssistant')
|
|
|
|
|
|
|
|
def delete(self):
|
|
|
|
self.ignoreAll()
|
|
|
|
|
|
|
|
def start(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def stop(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def sendOpenTalk(self, message):
|
2015-06-20 07:42:38 -05:00
|
|
|
if len(message) > 0 and message[0] == '~':
|
2015-03-03 16:10:12 -06:00
|
|
|
messenger.send('magicWord', [message])
|
|
|
|
else:
|
|
|
|
chatFlags = CFSpeech | CFTimeout
|
2015-05-30 14:47:29 -05:00
|
|
|
if ChatUtil.isThought(message):
|
2015-03-03 16:10:12 -06:00
|
|
|
chatFlags = CFThought
|
|
|
|
base.cr.chatAgent.sendChatMessage(message)
|
|
|
|
messenger.send('chatUpdate', [message, chatFlags])
|
|
|
|
|
|
|
|
def sendWhisperTalk(self, message, receiverAvId):
|
2015-05-16 22:00:56 -05:00
|
|
|
base.cr.ttsFriendsManager.sendUpdate('sendTalkWhisper', [receiverAvId, message])
|
2015-03-03 16:10:12 -06:00
|
|
|
|
|
|
|
def sendOpenSpeedChat(self, type, messageIndex):
|
|
|
|
if type == SPEEDCHAT_NORMAL:
|
|
|
|
messenger.send(SCChatEvent)
|
|
|
|
messenger.send('chatUpdateSC', [messageIndex])
|
|
|
|
base.localAvatar.b_setSC(messageIndex)
|
|
|
|
elif type == SPEEDCHAT_EMOTE:
|
|
|
|
messenger.send('chatUpdateSCEmote', [messageIndex])
|
|
|
|
messenger.send(SCEmoteChatEvent)
|
|
|
|
base.localAvatar.b_setSCEmote(messageIndex)
|
|
|
|
elif type == SPEEDCHAT_CUSTOM:
|
|
|
|
messenger.send('chatUpdateSCCustom', [messageIndex])
|
|
|
|
messenger.send(SCCustomChatEvent)
|
|
|
|
base.localAvatar.b_setSCCustom(messageIndex)
|
|
|
|
|
|
|
|
def sendAvatarWhisperSpeedChat(self, type, messageIndex, receiverId):
|
|
|
|
if type == SPEEDCHAT_NORMAL:
|
2015-04-23 17:18:16 -05:00
|
|
|
base.localAvatar.whisperSCTo(messageIndex, receiverId)
|
2015-03-03 16:10:12 -06:00
|
|
|
elif type == SPEEDCHAT_EMOTE:
|
2015-04-23 17:18:16 -05:00
|
|
|
base.localAvatar.whisperSCEmoteTo(messageIndex, receiverId)
|
2015-03-03 16:10:12 -06:00
|
|
|
elif type == SPEEDCHAT_CUSTOM:
|
2015-04-23 17:18:16 -05:00
|
|
|
base.localAvatar.whisperSCCustomTo(messageIndex, receiverId)
|