public void change_area(AreaManager.Area area) { if (this.area == area) { throw new Exceptions.ClientError(this, "User is already in target area."); } if (area.is_locked && !is_mod && !is_gm) //and not(self.ipid in area.invite_list): { throw new Exceptions.ClientError(this, "That area is locked!"); } if (area.is_gmlocked && !is_mod && !is_gm) //and not(self.ipid in area.invite_list): { throw new Exceptions.ClientError(this, "That area is gm-locked!"); } if (area.is_gmlocked && !is_mod) //and not(self.ipid in area.invite_list): { throw new Exceptions.ClientError(this, "That area is mod-locked!"); } AreaManager.Area old_area = this.area; if (!area.is_char_avaliable(char_id)) { int new_char_id = area.get_rand_avail_char_id(); if (new_char_id == null) { throw new Exceptions.ClientError(this, "No available characters in that area."); } else { change_character(new_char_id); send_host_message($"Character taken, switched to {get_char_name()}."); } } this.area.remove_client(this); this.area = area; area.new_client(this); send_host_message($"Changed area to {area.name}.");//[{area.status}] //logger.log_server( // '[{}]Changed area from {} ({}) to {} ({}).'.format(self.get_char_name(), old_area.name, old_area.id, // self.area.name, self.area.id), self) //#logger.log_rp( //# '[{}]Changed area from {} ({}) to {} ({}).'.format(self.get_char_name(), old_area.name, old_area.id, //# self.area.name, self.area.id), self) send_command(new Command("HP", 1.ToString(), area.hp_def.ToString())); send_command(new Command("HP", 2.ToString(), area.hp_pro.ToString())); send_command(new Command("BN", area.background)); //self.send_command('LE', *self.area.get_evidence_list(self)) // if (followedby != null) { followedby.follow_area(area); } }
public Client(WebSocket transport, int ipid, int user_id) { area = AreaManager.default_area(); area.new_client(this); this.transport = transport; is_muted = false; hdid = "REPLACEME"; pos = "wit"; is_mod = false; is_cm = false; is_gm = false; is_dj = true; char_id = -1; id = user_id; this.ipid = ipid; send_command(new Command("decryptor", $"{34}")); }