mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-24 20:22:33 -06:00
30 lines
908 B
Python
30 lines
908 B
Python
|
import string
|
||
|
import random
|
||
|
from otp.otpbase import OTPLocalizer
|
||
|
|
||
|
class ChatGarbler:
|
||
|
|
||
|
def garble(self, avatar, message):
|
||
|
newMessage = ''
|
||
|
numWords = random.randint(1, 7)
|
||
|
wordlist = OTPLocalizer.ChatGarblerDefault
|
||
|
for i in xrange(1, numWords + 1):
|
||
|
wordIndex = random.randint(0, len(wordlist) - 1)
|
||
|
newMessage = newMessage + wordlist[wordIndex]
|
||
|
if i < numWords:
|
||
|
newMessage = newMessage + ' '
|
||
|
|
||
|
return newMessage
|
||
|
|
||
|
def garbleSingle(self, avatar, message):
|
||
|
newMessage = ''
|
||
|
numWords = 1
|
||
|
wordlist = OTPLocalizer.ChatGarblerDefault
|
||
|
for i in xrange(1, numWords + 1):
|
||
|
wordIndex = random.randint(0, len(wordlist) - 1)
|
||
|
newMessage = newMessage + wordlist[wordIndex]
|
||
|
if i < numWords:
|
||
|
newMessage = newMessage + ' '
|
||
|
|
||
|
return newMessage
|