Example #1
0
            protected override void OnTarget(Mobile m, object o)
            {
                Item item = o as Item;

                if (item == null || !(m is PlayerMobile))
                {
                    m.SendLocalizedMessage(1079576); // You cannot imbue this item.
                    return;
                }

                ImbuingContext context = Imbuing.GetContext(m);

                int mod    = context.Imbue_Mod;
                int modInt = context.Imbue_ModInt;

                if (!Imbuing.CanImbueItem(m, item) || !Imbuing.OnBeforeImbue(m, item, mod, modInt) || !Imbuing.CanImbueProperty(m, item, mod))
                {
                    ImbueGump.SendGumpDelayed((PlayerMobile)m);
                }
                else
                {
                    Imbuing.TryImbueItem(m, item, mod, modInt);
                    ImbueGump.SendGumpDelayed((PlayerMobile)m);
                }
            }
Example #2
0
        public override void OnResponse(RelayInfo info)
        {
            ImbuingContext context = Imbuing.GetContext(User);

            switch (info.ButtonID)
            {
            case 0:     // Close
            case 1:
            {
                User.EndAction(typeof(Imbuing));

                break;
            }

            case 10005:                             // Imbue Item
            {
                User.SendLocalizedMessage(1079589); //Target an item you wish to imbue.

                User.Target = new ImbueItemTarget();
                User.Target.BeginTimeout(User, TimeSpan.FromSeconds(10.0));

                break;
            }

            case 10006:      // Reimbue Last
            {
                Item item   = context.LastImbued;
                int  mod    = context.Imbue_Mod;
                int  modint = context.Imbue_ModInt;

                if (item == null || mod < 0 || modint == 0)
                {
                    User.SendLocalizedMessage(1113572);         // You haven't imbued anything yet!
                    User.EndAction(typeof(Imbuing));
                    break;
                }

                if (Imbuing.CanImbueItem(User, item) && Imbuing.OnBeforeImbue(User, item, mod, modint))
                {
                    Imbuing.TryImbueItem(User, item, mod, modint);
                    ImbueGump.SendGumpDelayed(User);
                }
                break;
            }

            case 10007:      // Imbue Last Item
            {
                Item item   = context.LastImbued;
                int  mod    = context.Imbue_Mod;
                int  modint = context.Imbue_ModInt;

                if (context.LastImbued == null)
                {
                    User.SendLocalizedMessage(1113572);         // You haven't imbued anything yet!
                    User.EndAction(typeof(Imbuing));
                    break;
                }

                ImbueStep1(User, item);
                break;
            }

            case 10008:      // Imbue Last Property
            {
                context.LastImbued = null;
                int mod    = context.Imbue_Mod;
                int modint = context.Imbue_ModInt;

                if (modint < 0)
                {
                    modint = 0;
                }

                if (mod < 0)
                {
                    User.SendLocalizedMessage(1113572);         // You haven't imbued anything yet!
                    User.EndAction(typeof(Imbuing));
                    break;
                }

                ImbueLastProp(User, mod, modint);

                break;
            }

            case 10010:                             // Unravel Item
            {
                User.SendLocalizedMessage(1080422); // Target an item you wish to magically unravel.

                User.Target = new UnravelTarget();
                User.Target.BeginTimeout(User, TimeSpan.FromSeconds(10.0));

                break;
            }

            case 10011:                             // Unravel Container
            {
                User.SendLocalizedMessage(1080422); // Target an item you wish to magically unravel.

                User.Target = new UnravelContainerTarget();
                User.Target.BeginTimeout(User, TimeSpan.FromSeconds(10.0));

                break;
            }
            }
        }