Example #1
0
 public static void BeginTarget(PlayerMobile m, string speech)
 {
     if (m != null && !String.IsNullOrWhiteSpace(speech))
     {
         GenericSelectTarget <IPoint3D> .Begin(m, (user, target) => HandleTarget(m, target, speech), null);
     }
 }
Example #2
0
        public static void Say(Mobile m, string speech)
        {
            if (m == null || m.Deleted || !(m is PlayerMobile))
            {
                return;
            }

            GenericSelectTarget <IPoint3D> .Begin(
                m,
                (from, target) =>
            {
                if (target == null)
                {
                    return;
                }

                if (target is Item)
                {
                    var item = (Item)target;
                    item.PublicOverheadMessage(MessageType.Regular, m.SpeechHue, true, speech);
                    return;
                }

                if (target is Mobile)
                {
                    var mobile = (Mobile)target;
                    mobile.Say(speech);
                    return;
                }

                from.SendMessage("Invalid Target.");
            },
                from => { });
        }
Example #3
0
        public void BeginTarget(Mobile m, CellarStyle style)
        {
            if (m == null || m.Deleted || !this.CheckDoubleClick(m, false, false, 2, true))             //soft dclick check
            {
                return;
            }

            m.SendMessage("Pick a place for your cellar stairs.");
            GenericSelectTarget <IPoint3D> .Begin(m, (tm, to) => EndTarget(tm, style, to), OnTargetFail, -1, true);
        }
Example #4
0
        public static void OnExportPoint3D(Mobile m, string speech, string comment)
        {
            if (m == null || m.Deleted || !(m is PlayerMobile))
            {
                return;
            }

            if (String.IsNullOrWhiteSpace(speech))
            {
                speech = "Points";
            }

            GenericSelectTarget <IPoint3D> .Begin(
                m,
                (from, p) =>
                IOUtility.EnsureFile(
                    VitaNexCore.DataDirectory + "/Exported Points/3D/" + IOUtility.GetSafeFileName(speech) + ".txt")
                .AppendText(false, String.Format("new Point3D({0}, {1}, {2}), //{3}", p.X, p.Y, p.Z, comment ?? String.Empty)),
                null,
                -1,
                true);
        }
Example #5
0
        private static void OnCommand(CommandEventArgs e)
        {
            if (e == null || e.Mobile == null || !(e.Mobile is PlayerMobile))
            {
                return;
            }

            PlayerMobile m = (PlayerMobile)e.Mobile;

            if (e.Arguments == null || e.Arguments.Length == 0)
            {
                return;
            }

            string shapeName = e.Arguments[0].Trim().ToLower();
            int    val1, val2;

            if (e.Arguments.Length < 2 || !Int32.TryParse(e.Arguments[1].Trim(), out val1))
            {
                val1 = 5;
            }

            if (e.Arguments.Length < 3 || !Int32.TryParse(e.Arguments[2].Trim(), out val2))
            {
                val2 = 5;
            }

            val1 = Math.Max(0, Math.Min(10, val1));
            val2 = e.Arguments.Length < 3 ? val1 : Math.Max(0, Math.Min(10, val2));

            GenericSelectTarget <IPoint3D> .Begin(
                m,
                (mob, targ) =>
            {
                Point3D loc = targ.Clone3D(0, 0, Math.Max(val1, val2) * 5);

                Shape3D shape;

                switch (shapeName)
                {
                case "sphere":
                    shape = new Sphere3D(loc, val1, false);
                    break;

                case "ring":
                    shape = new Ring3D(loc, val1, val2);
                    break;

                case "disc":
                    shape = new Disc3D(loc, val1, false);
                    break;

                case "cylendar":
                    shape = new Cylendar3D(loc, val1, false);
                    break;

                case "cube":
                    shape = new Cube3D(loc, val1, false);
                    break;

                default:
                    return;
                }

                shape.ForEach(
                    b =>
                {
                    Static block = new Static(1801);

                    block.MoveToWorld(b, m.Map);
                });
            },
                mob => { },
                -1,
                true);
        }