aboutsummaryrefslogtreecommitdiff
path: root/server/tsuserver.py
diff options
context:
space:
mode:
authorCerapter <cerap@protonmail.com>2018-09-03 15:55:34 +0200
committerCerapter <cerap@protonmail.com>2018-09-03 15:55:34 +0200
commitbecf58dd4f9432364a64dc7af006b3938245127b (patch)
tree90eea8f6e0cf4da3a3cf3fb2d9285b065e31d7b4 /server/tsuserver.py
parente45e138fb5c8856e3047b5c60c957782a90f5598 (diff)
Area list added.
- Accessible with the ingame A/M button, or by `/switch_am`. - The music list now only lists music. - The area list lists the areas. - It describes general area properties (playercount, status, CM, locked). - Automatically updates as these change. - Clicking on an area behaves the same way as clicking on an area in the music list previously did.
Diffstat (limited to 'server/tsuserver.py')
-rw-r--r--server/tsuserver.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/server/tsuserver.py b/server/tsuserver.py
index 97b4b905..8f5bf859 100644
--- a/server/tsuserver.py
+++ b/server/tsuserver.py
@@ -258,6 +258,40 @@ class TsuServer3:
if self.config['use_district']:
self.district_client.send_raw_message('NEED#{}#{}#{}#{}'.format(char_name, area_name, area_id, msg))
+ def send_arup(self, args):
+ """ Updates the area properties on the Case Café Custom Client.
+
+ Playercount:
+ ARUP#0#<area1_p: int>#<area2_p: int>#...
+ Status:
+ ARUP#1##<area1_s: string>##<area2_s: string>#...
+ CM:
+ ARUP#2##<area1_cm: string>##<area2_cm: string>#...
+ Lockedness:
+ ARUP#3##<area1_l: bool>##<area2_l: bool>#...
+
+ """
+ if len(args) < 2:
+ # An argument count smaller than 2 means we only got the identifier of ARUP.
+ return
+ if args[0] not in (0,1,2,3):
+ return
+
+ if args[0] in (0, 3):
+ for part_arg in args[1:]:
+ try:
+ sanitised = int(part_arg)
+ except:
+ return
+ elif args[0] in (1, 2):
+ for part_arg in args[1:]:
+ try:
+ sanitised = str(part_arg)
+ except:
+ return
+
+ self.send_all_cmd_pred('ARUP', *args, pred=lambda x: True)
+
def refresh(self):
with open('config/config.yaml', 'r') as cfg:
self.config['motd'] = yaml.load(cfg)['motd'].replace('\\n', ' \n')