mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-24 04:02:40 -06:00
Speedchat Plus toggle!
This commit is contained in:
parent
b48fb01fb0
commit
c513032a49
4 changed files with 8 additions and 11 deletions
|
@ -148,7 +148,7 @@ class Avatar(Actor, ShadowCaster):
|
|||
self.understandable = 1
|
||||
self.setPlayerType(NametagGlobals.CCNormal)
|
||||
elif settings['trueFriends'] and base.cr.getFriendFlags(self.doId) & OTPGlobals.FriendChat:
|
||||
self.understandable = 1
|
||||
self.understandable = 2
|
||||
self.setPlayerType(NametagGlobals.CCNormal)
|
||||
elif settings['speedchatPlus']:
|
||||
self.understandable = 1
|
||||
|
|
|
@ -186,7 +186,9 @@ class DistributedPlayer(DistributedAvatar.DistributedAvatar, PlayerBase.PlayerBa
|
|||
return
|
||||
if base.localAvatar.isIgnored(self.doId):
|
||||
return
|
||||
if base.whiteList:
|
||||
if not self.understandable:
|
||||
chat = self.chatGarbler.garble(self, chat)
|
||||
elif base.whiteList and self.understandable < 2:
|
||||
chat = base.whiteList.processThroughAll(chat, self, self.chatGarbler)
|
||||
self.displayTalk(chat)
|
||||
|
||||
|
|
|
@ -5,19 +5,14 @@ class ChatGarbler:
|
|||
def __init__(self, messages):
|
||||
self.messages = messages
|
||||
|
||||
def garble(self, avatar, message, type=0):
|
||||
def garble(self, avatar, message):
|
||||
newMessage = ''
|
||||
|
||||
if avatar.style:
|
||||
avatarType = avatar.style.getType()
|
||||
wordList = self.messages[avatarType if avatarType in self.messages else 'default']
|
||||
|
||||
if type == 0:
|
||||
numWords = 1
|
||||
elif type == 1:
|
||||
numWords = random.randint(1, 7)
|
||||
elif type == 2:
|
||||
numWords = len(message.split(' '))
|
||||
numWords = len(message.split(' '))
|
||||
|
||||
for i in xrange(1, numWords + 1):
|
||||
wordIndex = random.randint(0, len(wordList) - 1)
|
||||
|
@ -26,4 +21,4 @@ class ChatGarbler:
|
|||
if i < numWords:
|
||||
newMessage = newMessage + ' '
|
||||
|
||||
return newMessage
|
||||
return '\x01WLDisplay\x01%s\x02' % newMessage
|
|
@ -19,7 +19,7 @@ class WhiteList:
|
|||
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 '\x01WLRed\x01%s\x02' % text if not garbler else garbler.garble(av, text)
|
||||
|
||||
def processText(self, text, av=None, garbler=None):
|
||||
if (not self.words) or text.startswith('~'):
|
||||
|
|
Loading…
Reference in a new issue