コード例 #1
0
ファイル: ImbueLastPropTarget.cs プロジェクト: uotools/xrunuo
        protected override void OnTarget(Mobile from, object targeted)
        {
            Item item = targeted as Item;

            if (Imbuing.Check(from, item))
            {
                IImbuable imbuable = item as IImbuable;

                if (imbuable != null && m_Attribute.CanHold(item) && Imbuing.ValidateFlags(imbuable.ImbuingFlags, m_Attribute.Flags) && m_Attribute.Validate(item))
                {
                    Gump confirm = SelectPropGump.SelectProp(from, item, m_Attribute);

                    if (confirm != null)
                    {
                        from.SendGump(confirm);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1114291);                       // You cannot imbue the last property on that item.
                    from.EndAction(typeof(Imbuing));
                }
            }
            else
            {
                from.EndAction(typeof(Imbuing));
            }
        }
コード例 #2
0
ファイル: ImbuingMainGump.cs プロジェクト: uotools/xrunuo
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            switch (info.ButtonID)
            {
            default:
            case 0:                     // Cancel
            {
                from.EndAction(typeof(Imbuing));

                break;
            }

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

                from.Target = new ImbueTarget();
                from.Target.BeginTimeout(from, TimeSpan.FromSeconds(10.0));

                break;
            }

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

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

                break;
            }

            case 3:                     // Imbue Last Item
            {
                Item item = ImbuingContext.GetLastItem(from);

                if (item == null)
                {
                    from.SendLocalizedMessage(1113572);                                       // You haven't imbued anything yet!
                    from.EndAction(typeof(Imbuing));
                }
                else if (Imbuing.Check(from, item))
                {
                    from.SendGump(new SelectPropGump(item));
                }

                break;
            }

            case 4:                     // Reimbue Last
            {
                ImbuingContext context = ImbuingContext.GetContext(from);

                if (context == null)
                {
                    from.SendLocalizedMessage(1113572);                                       // You haven't imbued anything yet!
                    from.EndAction(typeof(Imbuing));
                }
                else
                {
                    ConfirmationGump confirm = SelectPropGump.SelectProp(from, context.Item, context.Property);

                    if (confirm != null)
                    {
                        confirm.ChangeIntensity(from, context.Intensity);
                        confirm.OnResponse(sender, new RelayInfo(302, new int[0], new TextRelay[0]));
                    }
                }

                break;
            }

            case 5:                     // Imbue Last Property
            {
                BaseAttrInfo attribute = ImbuingContext.GetLastProperty(from);

                if (attribute == null)
                {
                    from.SendLocalizedMessage(1113572);                                       // You haven't imbued anything yet!
                    from.EndAction(typeof(Imbuing));
                }
                else
                {
                    from.SendLocalizedMessage(1079589);                                       // Target an item you wish to imbue.

                    from.Target = new ImbueLastPropTarget(attribute);
                    from.Target.BeginTimeout(from, TimeSpan.FromSeconds(10.0));
                }

                break;
            }

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

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

                break;
            }
            }
        }