diff options
| author | Cerapter <cerap@protonmail.com> | 2018-09-15 18:39:37 +0200 |
|---|---|---|
| committer | Cerapter <cerap@protonmail.com> | 2018-09-15 18:39:37 +0200 |
| commit | 54dc437f5ddab385d1f4cb9d8f1052b924620da4 (patch) | |
| tree | 70016bc0438b65a2b066395ef542cd6559c131b2 | |
| parent | cc854adb51ab14ad65b645bb91c71780fe940c91 (diff) | |
Changed how `/rollp` works, now announces the results to CM too.
| -rw-r--r-- | server/commands.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/server/commands.py b/server/commands.py index a6e2999e..57b0c3fb 100644 --- a/server/commands.py +++ b/server/commands.py @@ -140,13 +140,13 @@ def ooc_cmd_rollp(client, arg): if not 1 <= val[0] <= roll_max: raise ArgumentError('Roll value must be between 1 and {}.'.format(roll_max)) except ValueError: - raise ArgumentError('Wrong argument. Use /roll [<max>] [<num of rolls>]') + raise ArgumentError('Wrong argument. Use /rollp [<max>] [<num of rolls>]') else: val = [6] if len(val) == 1: val.append(1) if len(val) > 2: - raise ArgumentError('Too many arguments. Use /roll [<max>] [<num of rolls>]') + raise ArgumentError('Too many arguments. Use /rollp [<max>] [<num of rolls>]') if val[1] > 20 or val[1] < 1: raise ArgumentError('Num of rolls must be between 1 and 20') roll = '' @@ -156,10 +156,15 @@ def ooc_cmd_rollp(client, arg): if val[1] > 1: roll = '(' + roll + ')' client.send_host_message('{} rolled {} out of {}.'.format(client.get_char_name(), roll, val[0])) - client.area.send_host_message('{} rolled.'.format(client.get_char_name(), roll, val[0])) - SALT = ''.join(random.choices(string.ascii_uppercase + string.digits, k=16)) + + for c in client.area.clients: + if c.is_cm: + c.send_host_message('{} secretly rolled {} out of {}.'.format(client.get_char_name(), roll, val[0])) + else: + c.send_host_message('{} rolled in secret.'.format(client.get_char_name())) + logger.log_server( - '[{}][{}]Used /roll and got {} out of {}.'.format(client.area.abbreviation, client.get_char_name(), hashlib.sha1((str(roll) + SALT).encode('utf-8')).hexdigest() + '|' + SALT, val[0]), client) + '[{}][{}]Used /rollp and got {} out of {}.'.format(client.area.abbreviation, client.get_char_name(), roll, val[0]), client) def ooc_cmd_currentmusic(client, arg): if len(arg) != 0: |
