Curse added: /shake id
, /unshake id
.
Randomises word order in IC and OOC chat.
This commit is contained in:
parent
34d6f6fa54
commit
c8142f3f53
@ -403,6 +403,8 @@ class AOProtocol(asyncio.Protocol):
|
|||||||
if pos not in ('def', 'pro', 'hld', 'hlp', 'jud', 'wit'):
|
if pos not in ('def', 'pro', 'hld', 'hlp', 'jud', 'wit'):
|
||||||
return
|
return
|
||||||
msg = text[:256]
|
msg = text[:256]
|
||||||
|
if self.client.shaken:
|
||||||
|
msg = self.client.shake_message(msg)
|
||||||
if self.client.disemvowel:
|
if self.client.disemvowel:
|
||||||
msg = self.client.disemvowel_message(msg)
|
msg = self.client.disemvowel_message(msg)
|
||||||
self.client.pos = pos
|
self.client.pos = pos
|
||||||
@ -463,6 +465,8 @@ class AOProtocol(asyncio.Protocol):
|
|||||||
except (ClientError, AreaError, ArgumentError, ServerError) as ex:
|
except (ClientError, AreaError, ArgumentError, ServerError) as ex:
|
||||||
self.client.send_host_message(ex)
|
self.client.send_host_message(ex)
|
||||||
else:
|
else:
|
||||||
|
if self.client.shaken:
|
||||||
|
args[1] = self.client.shake_message(args[1])
|
||||||
if self.client.disemvowel:
|
if self.client.disemvowel:
|
||||||
args[1] = self.client.disemvowel_message(args[1])
|
args[1] = self.client.disemvowel_message(args[1])
|
||||||
self.client.area.send_command('CT', self.client.name, args[1])
|
self.client.area.send_command('CT', self.client.name, args[1])
|
||||||
|
@ -47,6 +47,7 @@ class ClientManager:
|
|||||||
self.is_cm = False
|
self.is_cm = False
|
||||||
self.evi_list = []
|
self.evi_list = []
|
||||||
self.disemvowel = False
|
self.disemvowel = False
|
||||||
|
self.shaken = False
|
||||||
self.muted_global = False
|
self.muted_global = False
|
||||||
self.muted_adverts = False
|
self.muted_adverts = False
|
||||||
self.is_muted = False
|
self.is_muted = False
|
||||||
@ -334,6 +335,13 @@ class ClientManager:
|
|||||||
def disemvowel_message(self, message):
|
def disemvowel_message(self, message):
|
||||||
message = re.sub("[aeiou]", "", message, flags=re.IGNORECASE)
|
message = re.sub("[aeiou]", "", message, flags=re.IGNORECASE)
|
||||||
return re.sub(r"\s+", " ", message)
|
return re.sub(r"\s+", " ", message)
|
||||||
|
|
||||||
|
def shake_message(self, message):
|
||||||
|
import random
|
||||||
|
parts = message.split()
|
||||||
|
random.shuffle(parts)
|
||||||
|
return ' '.join(parts)
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, server):
|
def __init__(self, server):
|
||||||
self.clients = set()
|
self.clients = set()
|
||||||
|
@ -855,7 +855,7 @@ def ooc_cmd_undisemvowel(client, arg):
|
|||||||
try:
|
try:
|
||||||
targets = client.server.client_manager.get_targets(client, TargetType.ID, int(arg), False)
|
targets = client.server.client_manager.get_targets(client, TargetType.ID, int(arg), False)
|
||||||
except:
|
except:
|
||||||
raise ArgumentError('You must specify a target. Use /disemvowel <id>.')
|
raise ArgumentError('You must specify a target. Use /undisemvowel <id>.')
|
||||||
if targets:
|
if targets:
|
||||||
for c in targets:
|
for c in targets:
|
||||||
logger.log_server('Undisemvowelling {}.'.format(c.get_ip()), client)
|
logger.log_server('Undisemvowelling {}.'.format(c.get_ip()), client)
|
||||||
@ -865,6 +865,42 @@ def ooc_cmd_undisemvowel(client, arg):
|
|||||||
else:
|
else:
|
||||||
client.send_host_message('No targets found.')
|
client.send_host_message('No targets found.')
|
||||||
|
|
||||||
|
def ooc_cmd_shake(client, arg):
|
||||||
|
if not client.is_mod:
|
||||||
|
raise ClientError('You must be authorized to do that.')
|
||||||
|
elif len(arg) == 0:
|
||||||
|
raise ArgumentError('You must specify a target.')
|
||||||
|
try:
|
||||||
|
targets = client.server.client_manager.get_targets(client, TargetType.ID, int(arg), False)
|
||||||
|
except:
|
||||||
|
raise ArgumentError('You must specify a target. Use /shake <id>.')
|
||||||
|
if targets:
|
||||||
|
for c in targets:
|
||||||
|
logger.log_server('Shaking {}.'.format(c.get_ip()), client)
|
||||||
|
logger.log_mod('Shaking {}.'.format(c.get_ip()), client)
|
||||||
|
c.shaken = True
|
||||||
|
client.send_host_message('Shook {} existing client(s).'.format(len(targets)))
|
||||||
|
else:
|
||||||
|
client.send_host_message('No targets found.')
|
||||||
|
|
||||||
|
def ooc_cmd_unshake(client, arg):
|
||||||
|
if not client.is_mod:
|
||||||
|
raise ClientError('You must be authorized to do that.')
|
||||||
|
elif len(arg) == 0:
|
||||||
|
raise ArgumentError('You must specify a target.')
|
||||||
|
try:
|
||||||
|
targets = client.server.client_manager.get_targets(client, TargetType.ID, int(arg), False)
|
||||||
|
except:
|
||||||
|
raise ArgumentError('You must specify a target. Use /unshake <id>.')
|
||||||
|
if targets:
|
||||||
|
for c in targets:
|
||||||
|
logger.log_server('Unshaking {}.'.format(c.get_ip()), client)
|
||||||
|
logger.log_mod('Unshaking {}.'.format(c.get_ip()), client)
|
||||||
|
c.shaken = False
|
||||||
|
client.send_host_message('Unshook {} existing client(s).'.format(len(targets)))
|
||||||
|
else:
|
||||||
|
client.send_host_message('No targets found.')
|
||||||
|
|
||||||
def ooc_cmd_blockdj(client, arg):
|
def ooc_cmd_blockdj(client, arg):
|
||||||
if not client.is_mod:
|
if not client.is_mod:
|
||||||
raise ClientError('You must be authorized to do that.')
|
raise ClientError('You must be authorized to do that.')
|
||||||
|
Loading…
Reference in New Issue
Block a user