From f3e9d691afbf70ec992fe4726865c9b9e83fac1b Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 15 Sep 2018 15:00:41 +0200 Subject: [PATCH] Forbade spectators from interacting IC. --- server/aoprotocol.py | 9 +++++++++ server/area_manager.py | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/server/aoprotocol.py b/server/aoprotocol.py index 4712656..f07571d 100644 --- a/server/aoprotocol.py +++ b/server/aoprotocol.py @@ -577,6 +577,9 @@ class AOProtocol(asyncio.Protocol): if not self.client.is_dj: self.client.send_host_message('You were blockdj\'d by a moderator.') return + if area.cannot_ic_interact(self.client): + self.client.send_host_message("You are not on the area's invite list, and thus, you cannot change music!") + return if not self.validate_net_cmd(args, self.ArgType.STR, self.ArgType.INT) and not self.validate_net_cmd(args, self.ArgType.STR, self.ArgType.INT, self.ArgType.STR): return if args[1] != self.client.char_id: @@ -629,6 +632,9 @@ class AOProtocol(asyncio.Protocol): if not self.client.can_wtce: self.client.send_host_message('You were blocked from using judge signs by a moderator.') return + if self.client.area.cannot_ic_interact(self.client): + self.client.send_host_message("You are not on the area's invite list, and thus, you cannot use the WTCE buttons!") + return if not self.validate_net_cmd(args, self.ArgType.STR) and not self.validate_net_cmd(args, self.ArgType.STR, self.ArgType.INT): return if args[0] == 'testimony1': @@ -658,6 +664,9 @@ class AOProtocol(asyncio.Protocol): if self.client.is_muted: # Checks to see if the client has been muted by a mod self.client.send_host_message("You have been muted by a moderator") return + if self.client.area.cannot_ic_interact(self.client): + self.client.send_host_message("You are not on the area's invite list, and thus, you cannot change the Confidence bars!") + return if not self.validate_net_cmd(args, self.ArgType.INT, self.ArgType.INT): return try: diff --git a/server/area_manager.py b/server/area_manager.py index 328a231..68eea42 100644 --- a/server/area_manager.py +++ b/server/area_manager.py @@ -237,11 +237,14 @@ class AreaManager: def can_send_message(self, client): - if self.is_locked != self.Locked.FREE and not client.is_mod and not client.id in self.invite_list: + if self.cannot_ic_interact(client): client.send_host_message('This is a locked area - ask the CM to speak.') return False return (time.time() * 1000.0 - self.next_message_time) > 0 + def cannot_ic_interact(self, client): + return self.is_locked != self.Locked.FREE and not client.is_mod and not client.id in self.invite_list + def change_hp(self, side, val): if not 0 <= val <= 10: raise AreaError('Invalid penalty value.')