Example #1
0
        private static void Dupe_OnCommand(Server.Commands.CommandEventArgs e)
        {
            int amount = 1;

            if (e.Length >= 1)
            {
                amount = e.GetInt32(0);
            }
            e.Mobile.Target = new DupeTarget(false, amount > 0 ? amount : 1);
            e.Mobile.SendMessage("What do you wish to dupe?");
        }
Example #2
0
        public static void Randomize_OnCommand(Server.Commands.CommandEventArgs args)
        {
            Mobile m = args.Mobile;

            if (args.Length != 4)
            {
                m.SendMessage("Format: Randomize <starting itemID> <ending itemID> <Z level> <bool includeNonFlooring>");
                return;
            }

            int  start = args.GetInt32(0);
            int  end   = args.GetInt32(1);
            int  z     = args.GetInt32(2);
            bool walls = args.GetBoolean(3);

            object[] state = new object[4] {
                start, end, z, walls
            };

            BoundingBoxPicker.Begin(m, new BoundingBoxCallback(BoxPickerCallback), state);
        }
Example #3
0
 private static void Light_OnCommand(Server.Commands.CommandEventArgs e)
 {
     if (e.Length >= 1)
     {
         LevelOverride = e.GetInt32(0);
         e.Mobile.SendAsciiMessage("Global light level override has been changed to {0}.", m_LevelOverride);
     }
     else
     {
         LevelOverride = int.MinValue;
         e.Mobile.SendAsciiMessage("Global light level override has been cleared.");
     }
 }
Example #4
0
        public override void Execute(Server.Commands.CommandEventArgs e, object obj)
        {
            Mobile from = e.Mobile;

            if (e.Length == 1)
            {
                int    index = e.GetInt32(0);
                Mobile mob   = (Mobile)obj;

                CommandLogging.WriteLine(from, "{0} {1} playing sound {2} for {3}", from.AccessLevel, CommandLogging.Format(from), index, CommandLogging.Format(mob));
                mob.Send(new PlaySound(index, mob.Location));
            }
            else
            {
                from.SendMessage("Format: PrivSound <index>");
            }
        }
Example #5
0
        private static void Props_OnCommand(Server.Commands.CommandEventArgs e)
        {
            if (e.Length == 1)
            {
                IEntity ent = World.FindEntity(e.GetInt32(0));

                if (ent == null)
                {
                    e.Mobile.SendMessage("No object with that serial was found.");
                }
                else if (!BaseCommand.IsAccessible(e.Mobile, ent))
                {
                    e.Mobile.SendMessage("That is not accessible.");
                }
                else
                {
                    e.Mobile.SendGump(new PropertiesGump(e.Mobile, ent));
                }
            }
            else
            {
                e.Mobile.Target = new PropsTarget(true);
            }
        }
Example #6
0
        public static void CheckLos_OnCommand(Server.Commands.CommandEventArgs args)
        {
            try
            {
                DateTime start = DateTime.Now;

                ClearLOS_OnCommand(args);

                LOSItemPacket.Reset();

                Mobile m     = args.Mobile;
                Map    map   = m.Map;
                int    range = 12;
                if (args.Length > 0)
                {
                    range = args.GetInt32(0);
                }

                if (range > 20)
                {
                    range = 20;
                }
                else if (range < 1)
                {
                    range = 1;
                }

                m.SendMessage("Calculating...");
                int minx, maxx;
                int miny, maxy;

                Point3D from = map.GetPoint(m, true);

                minx = m.Location.X - range;
                maxx = m.Location.X + range;

                miny = m.Location.Y - range;
                maxy = m.Location.Y + range;

                for (int x = minx; x <= maxx; x++)
                {
                    for (int y = miny; y <= maxy; y++)
                    {
                        {
                            LandTile tile = map.Tiles.GetLandTile(x, y);

                            ItemData id = TileData.ItemTable[tile.ID & 0x3FFF];

                            if (!tile.Ignored && id.Surface)
                            {
                                int     z   = tile.Z + id.CalcHeight;
                                Point3D loc = new Point3D(x, y, z);
                                int     hue;
                                if (loc == m.Location)
                                {
                                    hue = 0x35; // yellow
                                }
                                else if (map.LineOfSight(from, loc))
                                {
                                    hue = 0x3F; // green
                                }
                                else
                                {
                                    hue = 0x26; // red
                                }
                                m.Send(new LOSItemPacket(hue, loc));
                            }
                        }

                        StaticTile[] tiles = map.Tiles.GetStaticTiles(x, y, true);

                        for (int i = 0; i < tiles.Length; i++)
                        {
                            StaticTile tile = (StaticTile)tiles[i];

                            ItemData id = TileData.ItemTable[tile.ID & 0x3FFF];

                            if (id.Surface) // land doesnt use same flags, so just allow it
                            {
                                int     z   = tile.Z + id.CalcHeight;
                                Point3D loc = new Point3D(x, y, z);
                                int     hue;
                                if (loc == m.Location)
                                {
                                    hue = 0x35; // yellow
                                }
                                else if (map.LineOfSight(from, loc))
                                {
                                    hue = 0x3F; // green
                                }
                                else
                                {
                                    hue = 0x26; // red
                                }
                                m.Send(new LOSItemPacket(hue, loc));
                            }
                        }
                    }
                }
                m.SendAsciiMessage("Completed LOS check in {0}s", (DateTime.Now - start).TotalSeconds);
            }
            catch (Exception e)
            {
                args.Mobile.SendMessage("CRASHED : {0}", e.Message);
            }
        }