mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00:00
DANIEL: Work on whitelist
This commit is contained in:
parent
33f99305df
commit
b48fb01fb0
15 changed files with 58 additions and 302 deletions
|
@ -182,30 +182,27 @@ class DistributedPlayer(DistributedAvatar.DistributedAvatar, PlayerBase.PlayerBa
|
|||
pass
|
||||
|
||||
def setTalk(self, chat):
|
||||
if not base.cr.verifyMessage(chat):
|
||||
if not base.cr.chatAgent.verifyMessage(chat):
|
||||
return
|
||||
if base.localAvatar.isIgnored(self.doId):
|
||||
return
|
||||
#newText, scrubbed = self.scrubTalk(chat, mods)
|
||||
if base.whiteList:
|
||||
chat = base.whiteList.processThroughAll(chat, self, self.chatGarbler)
|
||||
self.displayTalk(chat)
|
||||
|
||||
def setTalkWhisper(self, avId, chat):
|
||||
if not base.cr.verifyMessage(chat):
|
||||
if not base.cr.chatAgent.verifyMessage(chat):
|
||||
return
|
||||
if base.localAvatar.isIgnored(avId):
|
||||
return
|
||||
self.displayTalkWhisper(avId, chat)
|
||||
|
||||
def displayTalk(self, chat):
|
||||
print 'displaytalk AV'
|
||||
print 'Talk: %s' % chat
|
||||
|
||||
def displayTalkWhisper(self, avId, chat):
|
||||
print 'TalkWhisper from %s: %s' % (avId, chat)
|
||||
|
||||
def scrubTalk(self, chat, mods):
|
||||
return chat
|
||||
|
||||
def b_setSC(self, msgIndex):
|
||||
self.setSC(msgIndex)
|
||||
self.d_setSC(msgIndex)
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
# TODO: OTP should not depend on Toontown... Hrrm.
|
||||
from toontown.chat.TTWhiteList import TTWhiteList
|
||||
|
||||
class ChatAgentAI:
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("ChatAgentAI")
|
||||
|
@ -9,7 +7,4 @@ class ChatAgentAI:
|
|||
pass
|
||||
|
||||
def chatMessage(self, todo0):
|
||||
pass
|
||||
|
||||
def setWhiteList(self, todo0):
|
||||
pass
|
|
@ -5,14 +5,19 @@ class ChatGarbler:
|
|||
def __init__(self, messages):
|
||||
self.messages = messages
|
||||
|
||||
def garble(self, avatar, message, isRandom=False):
|
||||
def garble(self, avatar, message, type=0):
|
||||
newMessage = ''
|
||||
|
||||
if avatar.style:
|
||||
avatarType = avatar.style.getType()
|
||||
wordList = self.messages[avatarType if avatarType in self.messages else 'default']
|
||||
|
||||
numWords = random.randint(1, 7) if isRandom else 1
|
||||
if type == 0:
|
||||
numWords = 1
|
||||
elif type == 1:
|
||||
numWords = random.randint(1, 7)
|
||||
elif type == 2:
|
||||
numWords = len(message.split(' '))
|
||||
|
||||
for i in xrange(1, numWords + 1):
|
||||
wordIndex = random.randint(0, len(wordList) - 1)
|
||||
|
|
|
@ -47,12 +47,9 @@ class ChatInputWhiteListFrame(FSM.FSM, DirectFrame):
|
|||
self.history = ['']
|
||||
self.historySize = base.config.GetInt('chat-history-size', 10)
|
||||
self.historyIndex = 0
|
||||
self.promoteWhiteList = 0
|
||||
self.whiteList = None
|
||||
self.active = 0
|
||||
self.autoOff = 0
|
||||
self.sendBy = 'Mode'
|
||||
self.prefilter = 1
|
||||
from direct.gui import DirectGuiGlobals
|
||||
self.chatEntry.bind(DirectGuiGlobals.TYPE, self.applyFilter)
|
||||
self.chatEntry.bind(DirectGuiGlobals.ERASE, self.applyFilter)
|
||||
|
@ -129,30 +126,15 @@ class ChatInputWhiteListFrame(FSM.FSM, DirectFrame):
|
|||
|
||||
def sendChat(self, text, overflow = False):
|
||||
if not (len(text) > 0 and text[0] in ['~', '>']):
|
||||
if self.prefilter:
|
||||
words = text.split(' ')
|
||||
newwords = []
|
||||
for word in words:
|
||||
if word == '' or self.whiteList.isWord(word) or self.promoteWhiteList:
|
||||
newwords.append(word)
|
||||
else:
|
||||
newwords.append(base.whiteList.defaultWord)
|
||||
|
||||
text = ' '.join(newwords)
|
||||
else:
|
||||
text = self.chatEntry.get(plain=True)
|
||||
text = self.chatEntry.get(plain=True)
|
||||
|
||||
if text:
|
||||
self.chatEntry.set('')
|
||||
|
||||
try:
|
||||
text.decode('ascii')
|
||||
self.sendChatBySwitch(text)
|
||||
|
||||
if self.wantHistory:
|
||||
self.addToHistory(text)
|
||||
except UnicodeEncodeError:
|
||||
base.localAvatar.setSystemMessage(0, OTPLocalizer.AsciiNotSupported)
|
||||
if not base.cr.chatAgent.verifyMessage(text):
|
||||
return
|
||||
|
||||
self.sendChatBySwitch(text)
|
||||
|
||||
if not overflow:
|
||||
self.hide()
|
||||
|
@ -203,24 +185,6 @@ class ChatInputWhiteListFrame(FSM.FSM, DirectFrame):
|
|||
self.historyIndex -= 1
|
||||
self.historyIndex %= len(self.history)
|
||||
|
||||
def applyFilter(self, keyArgs, strict = False):
|
||||
text = self.chatEntry.get(plain=True)
|
||||
|
||||
if not text.startswith('~'):
|
||||
words = text.split(' ')
|
||||
newwords = []
|
||||
self.notify.debug('%s' % words)
|
||||
for word in words:
|
||||
if word == '' or self.whiteList.isWord(word):
|
||||
newwords.append(word)
|
||||
else:
|
||||
newwords.append('\x01WLEnter\x01' + word + '\x02')
|
||||
|
||||
if not strict:
|
||||
lastword = words[-1]
|
||||
if lastword == '' or self.whiteList.isPrefix(lastword):
|
||||
newwords[-1] = lastword
|
||||
else:
|
||||
newwords[-1] = '\x01WLEnter\x01' + lastword + '\x02'
|
||||
newtext = ' '.join(newwords)
|
||||
self.chatEntry.set(newtext)
|
||||
def applyFilter(self, keyArgs):
|
||||
if base.whiteList:
|
||||
self.chatEntry.set(base.whiteList.processThroughAll(self.chatEntry.get(plain=True)))
|
|
@ -12,7 +12,6 @@ from otp.otpbase import OTPGlobals
|
|||
from otp.otpbase import OTPLocalizer
|
||||
from otp.speedchat import SCDecoders
|
||||
from toontown.chat.ChatGlobals import *
|
||||
from toontown.chat.TTWhiteList import TTWhiteList
|
||||
|
||||
|
||||
ThoughtPrefix = '.'
|
||||
|
@ -23,16 +22,13 @@ class TalkAssistant(DirectObject.DirectObject):
|
|||
|
||||
def __init__(self):
|
||||
self.logWhispers = 1
|
||||
self.whiteList = None
|
||||
self.clearHistory()
|
||||
self.zeroTimeDay = time.time()
|
||||
self.zeroTimeGame = globalClock.getRealTime()
|
||||
self.floodThreshold = 10.0
|
||||
self.useWhiteListFilter = base.config.GetBool('white-list-filter-openchat', 0)
|
||||
self.lastWhisperDoId = None
|
||||
self.lastWhisper = None
|
||||
self.SCDecoder = SCDecoders
|
||||
self.whiteList = TTWhiteList()
|
||||
return
|
||||
|
||||
def clearHistory(self):
|
||||
|
@ -45,7 +41,6 @@ class TalkAssistant(DirectObject.DirectObject):
|
|||
self.spamDictByDoId = {}
|
||||
self.handleDict = {}
|
||||
self.messageCount = 0
|
||||
self.shownWhiteListWarning = 0
|
||||
|
||||
def delete(self):
|
||||
self.ignoreAll()
|
||||
|
@ -91,42 +86,6 @@ class TalkAssistant(DirectObject.DirectObject):
|
|||
def getHandle(self, doId):
|
||||
return self.handleDict.get(doId)
|
||||
|
||||
def doWhiteListWarning(self):
|
||||
pass
|
||||
|
||||
def addToHistoryDoId(self, message, doId, scrubbed = 0):
|
||||
if message.getTalkType() == TALK_WHISPER and doId != localAvatar.doId:
|
||||
self.lastWhisperDoId = doId
|
||||
self.lastWhisper = self.lastWhisperDoId
|
||||
if doId not in self.historyByDoId:
|
||||
self.historyByDoId[doId] = []
|
||||
self.historyByDoId[doId].append(message)
|
||||
if not self.shownWhiteListWarning and scrubbed and doId == localAvatar.doId:
|
||||
self.doWhiteListWarning()
|
||||
self.shownWhiteListWarning = 1
|
||||
if doId not in self.floodDataByDoId:
|
||||
self.floodDataByDoId[doId] = [0.0, self.stampTime(), message]
|
||||
else:
|
||||
oldTime = self.floodDataByDoId[doId][1]
|
||||
newTime = self.stampTime()
|
||||
timeDiff = newTime - oldTime
|
||||
oldRating = self.floodDataByDoId[doId][0]
|
||||
contentMult = 1.0
|
||||
if len(message.getBody()) < 6:
|
||||
contentMult += 0.2 * float(6 - len(message.getBody()))
|
||||
if self.floodDataByDoId[doId][2].getBody() == message.getBody():
|
||||
contentMult += 1.0
|
||||
floodRating = max(0, 3.0 * contentMult + oldRating - timeDiff)
|
||||
self.floodDataByDoId[doId] = [floodRating, self.stampTime(), message]
|
||||
if floodRating > self.floodThreshold:
|
||||
if oldRating < self.floodThreshold:
|
||||
self.floodDataByDoId[doId] = [floodRating + 3.0, self.stampTime(), message]
|
||||
return 1
|
||||
else:
|
||||
self.floodDataByDoId[doId] = [oldRating - timeDiff, self.stampTime(), message]
|
||||
return 2
|
||||
return 0
|
||||
|
||||
def addToHistoryDISLId(self, message, dISLId, scrubbed = 0):
|
||||
if dISLId not in self.historyByDISLId:
|
||||
self.historyByDISLId[dISLId] = []
|
||||
|
@ -150,36 +109,6 @@ class TalkAssistant(DirectObject.DirectObject):
|
|||
|
||||
return info.getName() if info else ''
|
||||
|
||||
def whiteListFilterMessage(self, text):
|
||||
if not self.useWhiteListFilter:
|
||||
return text
|
||||
elif not base.whiteList:
|
||||
return 'no list'
|
||||
words = text.split(' ')
|
||||
newwords = []
|
||||
for word in words:
|
||||
if word == '' or base.whiteList.isWord(word):
|
||||
newwords.append(word)
|
||||
else:
|
||||
newwords.append(base.whiteList.defaultWord)
|
||||
|
||||
newText = ' '.join(newwords)
|
||||
return newText
|
||||
|
||||
def colorMessageByWhiteListFilter(self, text):
|
||||
if not base.whiteList:
|
||||
return text
|
||||
words = text.split(' ')
|
||||
newwords = []
|
||||
for word in words:
|
||||
if word == '' or base.whiteList.isWord(word):
|
||||
newwords.append(word)
|
||||
else:
|
||||
newwords.append('\x01WLRed\x01' + word + '\x02')
|
||||
|
||||
newText = ' '.join(newwords)
|
||||
return newText
|
||||
|
||||
def isThought(self, message):
|
||||
if not message:
|
||||
return 0
|
||||
|
@ -260,6 +189,5 @@ class TalkAssistant(DirectObject.DirectObject):
|
|||
avatarName = avatar.getName()
|
||||
newMessage = TalkMessage(self.countMessage(), self.stampTime(), message, localAvatar.doId, localAvatar.getName(), localAvatar.DISLid, localAvatar.DISLname, receiverId, avatarName, None, None, TALK_WHISPER, None)
|
||||
self.historyComplete.append(newMessage)
|
||||
self.addToHistoryDoId(newMessage, localAvatar.doId)
|
||||
messenger.send('NewOpenMessage', [newMessage])
|
||||
return error
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
from bisect import bisect_left
|
||||
|
||||
class WhiteList:
|
||||
def __init__(self, words):
|
||||
|
||||
def setWords(self, words):
|
||||
self.words = words
|
||||
self.numWords = len(self.words)
|
||||
|
||||
def cleanText(self, text):
|
||||
text = text.strip('.,?!')
|
||||
return text.lower()
|
||||
return text.strip('.,?!').lower()
|
||||
|
||||
def isWord(self, text):
|
||||
return self.cleanText(text) in self.words
|
||||
|
@ -16,25 +16,32 @@ class WhiteList:
|
|||
text = self.cleanText(text)
|
||||
i = bisect_left(self.words, text)
|
||||
|
||||
if i == self.numWords:
|
||||
return False
|
||||
return i != self.numWords and self.words[i].startswith(text)
|
||||
|
||||
def getReplacement(self, text, av=None, garbler=None):
|
||||
return '\x01%s\x01%s\x02' % ('WLDisplay' if garbler else 'WLRed', text if not garbler else garbler.garble(av, text, 2))
|
||||
|
||||
return self.words[i].startswith(text)
|
||||
def processText(self, text, av=None, garbler=None):
|
||||
if (not self.words) or text.startswith('~'):
|
||||
return text
|
||||
|
||||
def prefixCount(self, text):
|
||||
text = self.cleanText(text)
|
||||
i = bisect_left(self.words, text)
|
||||
j = i
|
||||
while j < self.numWords and self.words[j].startswith(text):
|
||||
j += 1
|
||||
words = text.split(' ')
|
||||
newWords = []
|
||||
|
||||
return j - i
|
||||
for word in words:
|
||||
if (not word) or self.isWord(word):
|
||||
newWords.append(word)
|
||||
else:
|
||||
newWords.append(self.getReplacement(word, av, garbler))
|
||||
|
||||
def prefixList(self, text):
|
||||
text = self.cleanText(text)
|
||||
i = bisect_left(self.words, text)
|
||||
j = i
|
||||
while j < self.numWords and self.words[j].startswith(text):
|
||||
j += 1
|
||||
lastWord = words[-1]
|
||||
|
||||
return self.words[i:j]
|
||||
if (not lastWord) or self.isPrefix(lastWord):
|
||||
newWords[-1] = lastWord
|
||||
else:
|
||||
newWords[-1] = self.getReplacement(lastWord, av, garbler)
|
||||
|
||||
return ' '.join(newWords)
|
||||
|
||||
def processThroughAll(self, text, av=None, garbler=None):
|
||||
return self.processText(text, av, garbler)
|
|
@ -1,5 +1,6 @@
|
|||
from direct.showbase.ShowBase import ShowBase
|
||||
from otp.ai.MagicWordGlobal import *
|
||||
from otp.chat import WhiteList, WhiteListData
|
||||
from pandac.PandaModules import Camera, TPLow, VBase4, ColorWriteAttrib, Filename, getModelPath, NodePath, Vec4
|
||||
import OTPGlobals, OTPRender, math
|
||||
|
||||
|
@ -19,6 +20,12 @@ class OTPBase(ShowBase):
|
|||
self.enviroCam = None
|
||||
self.pixelZoomSetup = False
|
||||
self.gameOptionsCode = ''
|
||||
self.whiteList = None
|
||||
|
||||
if config.GetBool('want-whitelist', True):
|
||||
self.whiteList = WhiteList.WhiteList()
|
||||
self.whiteList.setWords(WhiteListData.WHITELIST)
|
||||
|
||||
if base.cam:
|
||||
if self.wantEnviroDR:
|
||||
base.cam.node().setCameraMask(OTPRender.MainCameraBitmask)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
from otp.ai.AIMsgTypes import *
|
||||
TTAIMsgName2Id = {'DBSERVER_GET_ESTATE': 1040,
|
||||
'DBSERVER_GET_ESTATE_RESP': 1041,
|
||||
'PARTY_MANAGER_UD_TO_ALL_AI': 1042,
|
||||
'WHITELIST_MANAGER_UD_TO_ALL_AI': 1044}
|
||||
'PARTY_MANAGER_UD_TO_ALL_AI': 1042}
|
||||
TTAIMsgId2Names = invertDictLossless(TTAIMsgName2Id)
|
||||
globals().update(TTAIMsgName2Id)
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from otp.chat.ChatInputWhiteListFrame import ChatInputWhiteListFrame
|
||||
from toontown.chat.TTWhiteList import TTWhiteList
|
||||
from direct.showbase import DirectObject
|
||||
from otp.otpbase import OTPGlobals
|
||||
import sys
|
||||
|
@ -32,8 +31,6 @@ class TTChatInputWhiteList(ChatInputWhiteListFrame):
|
|||
'text': '',
|
||||
'sortOrder': DGG.FOREGROUND_SORT_INDEX}
|
||||
ChatInputWhiteListFrame.__init__(self, entryOptions, parent, **kw)
|
||||
self.whiteList = TTWhiteList()
|
||||
base.whiteList = self.whiteList
|
||||
base.ttwl = self
|
||||
self.autoOff = 1
|
||||
self.sendBy = 'Data'
|
||||
|
@ -92,7 +89,6 @@ class TTChatInputWhiteList(ChatInputWhiteListFrame):
|
|||
ChatInputWhiteListFrame.destroy(self)
|
||||
|
||||
def delete(self):
|
||||
base.whiteList = None
|
||||
ChatInputWhiteListFrame.delete(self)
|
||||
return
|
||||
|
||||
|
@ -154,35 +150,4 @@ class TTChatInputWhiteList(ChatInputWhiteListFrame):
|
|||
self.whisperLabel['text'] = OTPLocalizer.ChatInputWhisperLabel % self.whisperName
|
||||
self.whisperLabel.show()
|
||||
else:
|
||||
self.whisperLabel.hide()
|
||||
|
||||
def applyFilter(self, keyArgs, strict = False):
|
||||
text = self.chatEntry.get(plain=True)
|
||||
|
||||
if not text.startswith('~'):
|
||||
words = text.split(' ')
|
||||
newwords = []
|
||||
flag = 0
|
||||
for friendId, flags in base.localAvatar.friendsList:
|
||||
if flags & ToontownGlobals.FriendChat:
|
||||
flag = 1
|
||||
|
||||
for word in words:
|
||||
if word == '' or self.whiteList.isWord(word) or not settings['speedchatPlus']:
|
||||
newwords.append(word)
|
||||
else:
|
||||
if flag:
|
||||
newwords.append('\x01WLDisplay\x01' + word + '\x02')
|
||||
else:
|
||||
newwords.append('\x01WLEnter\x01' + word + '\x02')
|
||||
|
||||
if not strict:
|
||||
lastword = words[-1]
|
||||
if lastword == '' or self.whiteList.isPrefix(lastword) or not settings['speedchatPlus']:
|
||||
newwords[-1] = lastword
|
||||
elif flag:
|
||||
newwords[-1] = '\x01WLDisplay\x01' + lastword + '\x02'
|
||||
else:
|
||||
newwords[-1] = '\x01WLEnter\x01' + lastword + '\x02'
|
||||
newtext = ' '.join(newwords)
|
||||
self.chatEntry.set(newtext)
|
||||
self.whisperLabel.hide()
|
|
@ -1,11 +0,0 @@
|
|||
from otp.chat.WhiteList import WhiteList
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.chat import WhiteListData
|
||||
|
||||
class TTWhiteList(WhiteList):
|
||||
notify = directNotify.newCategory('TTWhiteList')
|
||||
|
||||
def __init__(self):
|
||||
WhiteList.__init__(self, WhiteListData.WHITELIST)
|
||||
|
||||
self.defaultWord = TTLocalizer.ChatGarblerDefault[0]
|
|
@ -65,45 +65,3 @@ class FriendHandle:
|
|||
elif settings['trueFriends'] and base.cr.getFriendFlags(self.doId) & ToontownGlobals.FriendChat:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def scrubTalk(self, message, mods):
|
||||
scrubbed = 0
|
||||
text = copy.copy(message)
|
||||
for mod in mods:
|
||||
index = mod[0]
|
||||
length = mod[1] - mod[0] + 1
|
||||
newText = text[0:index] + length * '\x07' + text[index + length:]
|
||||
text = newText
|
||||
|
||||
words = text.split(' ')
|
||||
newwords = []
|
||||
for word in words:
|
||||
if word == '':
|
||||
newwords.append(word)
|
||||
elif word[0] == '\x07':
|
||||
newwords.append('\x01WLDisplay\x01' + self.chatGarbler.garble(self, word) + '\x02')
|
||||
scrubbed = 1
|
||||
elif base.whiteList.isWord(word):
|
||||
newwords.append(word)
|
||||
else:
|
||||
newwords.append('\x01WLDisplay\x01' + word + '\x02')
|
||||
scrubbed = 1
|
||||
|
||||
newText = ' '.join(newwords)
|
||||
return (newText, scrubbed)
|
||||
|
||||
def replaceBadWords(self, text):
|
||||
words = text.split(' ')
|
||||
newwords = []
|
||||
for word in words:
|
||||
if word == '':
|
||||
newwords.append(word)
|
||||
elif word[0] == '\x07':
|
||||
newwords.append('\x01WLRed\x01' + self.chatGarbler.garble(self, word) + '\x02')
|
||||
elif base.whiteList.isWord(word):
|
||||
newwords.append(word)
|
||||
else:
|
||||
newwords.append('\x01WLRed\x01' + word + '\x02')
|
||||
|
||||
newText = ' '.join(newwords)
|
||||
return newText
|
||||
|
|
|
@ -457,13 +457,6 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
|
|||
|
||||
def isAvFriend(self, avId):
|
||||
return base.cr.isFriend(avId)
|
||||
|
||||
def setTalk(self, chat):
|
||||
if not base.cr.chatAgent.verifyMessage(chat):
|
||||
return
|
||||
if base.localAvatar.isIgnored(self.doId):
|
||||
return
|
||||
self.displayTalk(chat)
|
||||
|
||||
def setTalkWhisper(self, avId, chat):
|
||||
if not base.cr.chatAgent.verifyMessage(chat):
|
||||
|
@ -2373,56 +2366,6 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
|
|||
reply.status = newStatus
|
||||
break
|
||||
|
||||
def scrubTalk(self, message, mods):
|
||||
scrubbed = 0
|
||||
text = copy.copy(message)
|
||||
for mod in mods:
|
||||
index = mod[0]
|
||||
length = mod[1] - mod[0] + 1
|
||||
newText = text[0:index] + length * '\x07' + text[index + length:]
|
||||
text = newText
|
||||
|
||||
words = text.split(' ')
|
||||
newwords = []
|
||||
for word in words:
|
||||
if word == '':
|
||||
newwords.append(word)
|
||||
elif word[0] == '\x07' or len(word) > 1 and word[0] == '.' and word[1] == '\x07':
|
||||
newwords.append('\x01WLDisplay\x01' + self.chatGarbler.garble(self, word) + '\x02')
|
||||
scrubbed = 1
|
||||
elif not base.whiteList.isWord(word):
|
||||
newwords.append(word)
|
||||
else:
|
||||
flag = 0
|
||||
for friendId, flags in self.friendsList:
|
||||
if not flags & ToontownGlobals.FriendChat:
|
||||
flag = 1
|
||||
|
||||
if flag:
|
||||
scrubbed = 1
|
||||
newwords.append('\x01WLDisplay\x01' + word + '\x02')
|
||||
else:
|
||||
newwords.append(word)
|
||||
|
||||
newText = ' '.join(newwords)
|
||||
return (newText, scrubbed)
|
||||
|
||||
def replaceBadWords(self, text):
|
||||
words = text.split(' ')
|
||||
newwords = []
|
||||
for word in words:
|
||||
if word == '':
|
||||
newwords.append(word)
|
||||
elif word[0] == '\x07':
|
||||
newwords.append('\x01WLRed\x01' + self.chatGarbler.garble(self, word) + '\x02')
|
||||
elif not base.whiteList.isWord(word):
|
||||
newwords.append(word)
|
||||
else:
|
||||
newwords.append('\x01WLRed\x01' + word + '\x02')
|
||||
|
||||
newText = ' '.join(newwords)
|
||||
return newText
|
||||
|
||||
def toonUp(self, hpGained, hasInteractivePropBonus = False):
|
||||
if self.hp == None or hpGained < 0:
|
||||
return
|
||||
|
|
|
@ -427,12 +427,14 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
|
|||
self.d_updateGMNameTag()
|
||||
|
||||
def displayTalkWhisper(self, avId, chat):
|
||||
# SKRUB PLZ
|
||||
sender = base.cr.identifyAvatar(avId)
|
||||
|
||||
if not sender:
|
||||
return
|
||||
|
||||
if base.whiteList:
|
||||
chat = base.whiteList.processThroughAll(chat, sender, self.chatGarbler)
|
||||
|
||||
name = sender.getName()
|
||||
chatString = '%s: %s' % (name, chat)
|
||||
whisper = WhisperPopup(chatString, OTPGlobals.getInterfaceFont(), WTNormal)
|
||||
|
|
|
@ -129,10 +129,7 @@ class ToonBase(OTPBase.OTPBase):
|
|||
tpMgr = TextPropertiesManager.getGlobalPtr()
|
||||
WLDisplay = TextProperties()
|
||||
WLDisplay.setSlant(0.3)
|
||||
WLEnter = TextProperties()
|
||||
WLEnter.setTextColor(1.0, 0.0, 0.0, 1)
|
||||
tpMgr.setProperties('WLDisplay', WLDisplay)
|
||||
tpMgr.setProperties('WLEnter', WLEnter)
|
||||
del tpMgr
|
||||
self.lastScreenShotTime = globalClock.getRealTime()
|
||||
self.accept('InputState-forward', self.__walking)
|
||||
|
|
Loading…
Reference in a new issue