Fixed the /invite and /uninvite commands so they work as they claim they do.

- You can now invite and uninvite by IDs.
This commit is contained in:
Cerapter 2018-08-12 02:17:07 +02:00
parent d444eb6dce
commit 00b5af9b60
2 changed files with 5 additions and 5 deletions

View File

@ -168,7 +168,7 @@ class ClientManager:
def change_area(self, area): def change_area(self, area):
if self.area == area: if self.area == area:
raise ClientError('User already in specified area.') raise ClientError('User already in specified area.')
if area.is_locked and not self.is_mod and not self.ipid in area.invite_list: if area.is_locked and not self.is_mod and not self.id in area.invite_list:
#self.send_host_message('This area is locked - you will be unable to send messages ICly.') #self.send_host_message('This area is locked - you will be unable to send messages ICly.')
raise ClientError("That area is locked!") raise ClientError("That area is locked!")
old_area = self.area old_area = self.area

View File

@ -577,7 +577,7 @@ def ooc_cmd_area_lock(client, arg):
client.area.is_locked = True client.area.is_locked = True
client.area.send_host_message('Area is locked.') client.area.send_host_message('Area is locked.')
for i in client.area.clients: for i in client.area.clients:
client.area.invite_list[i.ipid] = None client.area.invite_list[i.id] = None
return return
else: else:
raise ClientError('Only CM can lock the area.') raise ClientError('Only CM can lock the area.')
@ -599,7 +599,7 @@ def ooc_cmd_invite(client, arg):
raise ClientError('You must be authorized to do that.') raise ClientError('You must be authorized to do that.')
try: try:
c = client.server.client_manager.get_targets(client, TargetType.ID, int(arg), False)[0] c = client.server.client_manager.get_targets(client, TargetType.ID, int(arg), False)[0]
client.area.invite_list[c.ipid] = None client.area.invite_list[c.id] = None
client.send_host_message('{} is invited to your area.'.format(c.get_char_name())) client.send_host_message('{} is invited to your area.'.format(c.get_char_name()))
c.send_host_message('You were invited and given access to {}.'.format(client.area.name)) c.send_host_message('You were invited and given access to {}.'.format(client.area.name))
except: except:
@ -620,7 +620,7 @@ def ooc_cmd_uninvite(client, arg):
client.send_host_message("You have removed {} from the whitelist.".format(c.get_char_name())) client.send_host_message("You have removed {} from the whitelist.".format(c.get_char_name()))
c.send_host_message("You were removed from the area whitelist.") c.send_host_message("You were removed from the area whitelist.")
if client.area.is_locked: if client.area.is_locked:
client.area.invite_list.pop(c.ipid) client.area.invite_list.pop(c.id)
except AreaError: except AreaError:
raise raise
except ClientError: except ClientError:
@ -653,7 +653,7 @@ def ooc_cmd_area_kick(client, arg):
c.change_area(area) c.change_area(area)
c.send_host_message("You were kicked from the area to area {}.".format(output)) c.send_host_message("You were kicked from the area to area {}.".format(output))
if client.area.is_locked: if client.area.is_locked:
client.area.invite_list.pop(c.ipid) client.area.invite_list.pop(c.id)
except AreaError: except AreaError:
raise raise
except ClientError: except ClientError: