Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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 => { });
        }
Ejemplo n.º 3
0
        protected virtual void BeginTarget(Mobile m)
        {
            if (_Target != null)
            {
                if (_Target.User != null && _Target.User.Target == _Target)
                {
                    _Target.Cancel(_Target.User, TargetCancelType.Overriden);
                }

                _Target = null;
            }

            m.SendMessage("Target an object to recolor...");

            _Target = new GenericSelectTarget <TEntity>(
                (u, t) =>
            {
                _Target = null;
                OpenGump(u, t);
            },
                u =>
            {
                OnTargetFail(u);
                _Target = null;
            });

            m.Target = _Target;
        }
Ejemplo n.º 4
0
        public override void OnDelete()
        {
            base.OnDelete();

            _Gump   = null;
            _Target = null;

            Hues.Free(true);
        }
Ejemplo n.º 5
0
        public override void OnDelete()
        {
            base.OnDelete();

            _Gump   = null;
            _Target = null;

            _Hues.Clear();
            _Hues.TrimExcess();
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        /// <summary>
        ///     Begin targeting for the specified Mobile with definded handlers
        /// </summary>
        /// <param name="m">Mobile owner of the new GenericSelectTarget instance</param>
        /// <param name="success">Success callback</param>
        /// <param name="fail">Failure callback</param>
        /// <param name="range">Maximum distance allowed</param>
        /// <param name="allowGround">Allow ground as valid target</param>
        /// <param name="flags">Target flags determine the target action</param>
        public static GenericSelectTarget <TObj> BeginTarget <TObj>(
            this Mobile m,
            Action <Mobile, TObj> success,
            Action <Mobile> fail,
            int range         = -1,
            bool allowGround  = false,
            TargetFlags flags = TargetFlags.None)
        {
            if (m == null || m.Deleted)
            {
                return(null);
            }

            var t = new GenericSelectTarget <TObj>(success, fail, range, allowGround, flags);

            m.Target = t;

            return(t);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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);
        }