Ejemplo n.º 1
0
        public override void Use(Player p, string message)
        {
            if (p == null)
            {
                MessageInGameOnly(p); return;
            }
            if (message == "")
            {
                Help(p); return;
            }

            if (!message.CaselessEq("all") && Block.Byte(message) == Block.Invalid)
            {
                Player.Message(p, "There is no block \"" + message + "\"."); return;
            }
            int phys = p.level.physics;

            CmdPhysics.SetPhysics(p.level, 0);

            Command cmd  = Command.all.Find("replaceall");
            string  args = message.CaselessEq("all") ?
                           "lavafall waterfall lava_fast active_lava active_water " +
                           "active_hot_lava active_cold_water fast_hot_lava magma geyser" : message;

            cmd.Use(p, args + " air");

            CmdPhysics.SetPhysics(p.level, phys);
            Chat.MessageLevel(p.level, "Unflooded!");
        }
Ejemplo n.º 2
0
        static void HandleMap(Player p, string opt, string value)
        {
            bool mapOnly = !(opt == "ADD" || opt == "DELETE" || opt == "SAVE");

            if (mapOnly && !OwnsMap(p, p.level))
            {
                Player.Message(p, "You may only perform that action on your own map."); return;
            }

            if (opt == "ADD")
            {
                AddMap(p, value);
            }
            else if (opt == "PHYSICS")
            {
                if (value == "0" || value == "1" || value == "2" || value == "3" || value == "4" || value == "5")
                {
                    CmdPhysics.SetPhysics(p.level, int.Parse(value));
                }
                else
                {
                    Player.Message(p, "Accepted numbers are: 0, 1, 2, 3, 4 or 5");
                }
            }
            else if (opt == "DELETE")
            {
                DeleteMap(p, value);
            }
            else if (opt == "SAVE")
            {
                byte mapNum = 0;
                if (value == "")
                {
                    Player.Message(p, "To save one of your maps type %T/os map save [map number]");
                }
                else if (value == "1")
                {
                    Command.all.Find("save").Use(p, FirstMapName(p));
                    Player.Message(p, "Map 1 has been saved.");
                }
                else if (byte.TryParse(value, out mapNum))
                {
                    Command.all.Find("save").Use(p, p.name.ToLower() + value);
                    Player.Message(p, "Map " + value + " has been saved.");
                }
                else
                {
                    Player.MessageLines(p, mapHelp);
                }
            }
            else if (opt == "RESTORE")
            {
                Command.all.Find("restore").Use(p, value);
            }
            else if (opt == "PERVISIT")
            {
                string rank = value == "" ? Server.defaultRank : value;
                Command.all.Find("pervisit").Use(p, rank);
            }
            else if (opt == "PERBUILD")
            {
                string rank = value == "" ? Server.defaultRank : value;
                Command.all.Find("perbuild").Use(p, rank);
            }
            else if (opt == "TEXTURE")
            {
                if (value == "")
                {
                    Command.all.Find("texture").Use(p, "level normal");
                }
                else
                {
                    Command.all.Find("texture").Use(p, "level " + value);
                }
            }
            else if (opt == "TEXTUREZIP")
            {
                if (value == "")
                {
                    Command.all.Find("texture").Use(p, "levelzip normal");
                }
                else
                {
                    Command.all.Find("texture").Use(p, "levelzip " + value);
                }
            }
            else
            {
                opt = LevelOptions.Map(opt.ToLower());
                if (opt == "physicspeed" || opt == "overload" || opt == "realmowner")
                {
                    Player.Message(p, "&cYou cannot change that map option via /os map."); return;
                }
                if (CmdMap.SetMapOption(p, p.level, opt, value))
                {
                    return;
                }

                Player.MessageLines(p, mapHelp);
            }
        }