コード例 #1
0
            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);
                }
            }
コード例 #2
0
            public void change_character(int char_id, bool force = false)
            {
                if (!Server.is_valid_char_id(char_id))
                {
                    throw new Exceptions.ClientError(this, "Invalid Character ID.");
                }

                if (!area.is_char_avaliable(char_id))
                {
                    if (this.char_id != char_id)
                    {
                        if (force)
                        {
                            foreach (var client in area.clients)
                            {
                                if (client.char_id == char_id)
                                {
                                    client.char_select();
                                }
                            }
                        }
                        else
                        {
                            throw new Exceptions.ClientError(this, "Character not available.");
                        }
                    }
                }

                //if (!area.is_char_available(char_id))
                //{
                //    if(this.char_id != char_id)
                //    {

                //    }
                //}

                string old_char = get_char_name();

                this.char_id = char_id;
                pos          = "wit";

                send_command(new Command("PV", id.ToString(), "CID", char_id.ToString()));
                //            logger.log_server('[{}]Changed character from {} to {}.'
                //                              .format(self.area.id, old_char, self.get_char_name()), self)
            }