mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-25 04:32:33 -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.understandable = 1
|
||||||
self.setPlayerType(NametagGlobals.CCNormal)
|
self.setPlayerType(NametagGlobals.CCNormal)
|
||||||
elif settings['trueFriends'] and base.cr.getFriendFlags(self.doId) & OTPGlobals.FriendChat:
|
elif settings['trueFriends'] and base.cr.getFriendFlags(self.doId) & OTPGlobals.FriendChat:
|
||||||
self.understandable = 1
|
self.understandable = 2
|
||||||
self.setPlayerType(NametagGlobals.CCNormal)
|
self.setPlayerType(NametagGlobals.CCNormal)
|
||||||
elif settings['speedchatPlus']:
|
elif settings['speedchatPlus']:
|
||||||
self.understandable = 1
|
self.understandable = 1
|
||||||
|
|
|
@ -186,7 +186,9 @@ class DistributedPlayer(DistributedAvatar.DistributedAvatar, PlayerBase.PlayerBa
|
||||||
return
|
return
|
||||||
if base.localAvatar.isIgnored(self.doId):
|
if base.localAvatar.isIgnored(self.doId):
|
||||||
return
|
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)
|
chat = base.whiteList.processThroughAll(chat, self, self.chatGarbler)
|
||||||
self.displayTalk(chat)
|
self.displayTalk(chat)
|
||||||
|
|
||||||
|
|
|
@ -5,18 +5,13 @@ class ChatGarbler:
|
||||||
def __init__(self, messages):
|
def __init__(self, messages):
|
||||||
self.messages = messages
|
self.messages = messages
|
||||||
|
|
||||||
def garble(self, avatar, message, type=0):
|
def garble(self, avatar, message):
|
||||||
newMessage = ''
|
newMessage = ''
|
||||||
|
|
||||||
if avatar.style:
|
if avatar.style:
|
||||||
avatarType = avatar.style.getType()
|
avatarType = avatar.style.getType()
|
||||||
wordList = self.messages[avatarType if avatarType in self.messages else 'default']
|
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):
|
for i in xrange(1, numWords + 1):
|
||||||
|
@ -26,4 +21,4 @@ class ChatGarbler:
|
||||||
if i < numWords:
|
if i < numWords:
|
||||||
newMessage = newMessage + ' '
|
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)
|
return i != self.numWords and self.words[i].startswith(text)
|
||||||
|
|
||||||
def getReplacement(self, text, av=None, garbler=None):
|
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):
|
def processText(self, text, av=None, garbler=None):
|
||||||
if (not self.words) or text.startswith('~'):
|
if (not self.words) or text.startswith('~'):
|
||||||
|
|
Loading…
Reference in a new issue