コード例 #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
ファイル: AOProtocol.cs プロジェクト: Ziiella/AOServer
        public static void net_cmd_mc(Client c, string[] args)
        {
            AreaManager.Area area = AreaManager.get_area_by_name(args[0]);
            if (area != null)
            {
                try
                {
                    c.change_area(area);
                }
                catch (Exceptions.ClientError)
                {
                    Console.WriteLine("Error.");
                }
            }
            else
            {
                if (c.is_muted)
                {
                    c.send_host_message("You have been muted by a moderator.");
                    return;
                }
                if (!c.is_dj)
                {
                    c.send_host_message("You were blockdj\'d by a moderator.");
                    return;
                }

                //if not self.validate_net_cmd(args, self.ArgType.STR, self.ArgType.INT):
                //    return

                if (int.Parse(args[1]) != c.char_id)
                {
                    return;
                }
                //    return

                //if self.client.change_music_cd():
                //    self.client.send_host_message('You changed song too much times. Please try again after {} seconds.'.format(int(self.client.change_music_cd())))
                //    return

                //try:
                //    name, length = self.server.get_song_data(args[0])
                c.area.play_music(args[0], int.Parse(args[1]));
                //    self.client.area.play_music(name, self.client.char_id, length)
                //    self.client.area.add_music_playing(self.client, name)
                Logger.log_server($"[{c.area.id}][{c.get_char_name()}]Changed music to {args[0]}.");
            }
        }
コード例 #3
0
            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}"));
            }
コード例 #4
0
 public void follow_area(AreaManager.Area area)
 {
 }