Ejemplo n.º 1
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                if (Potion.Deleted)
                {
                    return;
                }

                Mobile m = sender.Mobile;

                switch (info.ButtonID)
                {
                case 0:
                    break;

                case 1:
                    m.SendLocalizedMessage(1159498);     // Target the object that you wish to transfer properties FROM...
                    Potion.Source = null;
                    m.Target      = new InternalTarget(Potion, true);
                    break;

                case 2:
                    m.SendLocalizedMessage(1159499);     // Target the object you wish to transfer properties TO...
                    Potion.Destination = null;
                    m.Target           = new InternalTarget(Potion, false);
                    break;

                case 3:
                    if (!Potion.IsChildOf(m.Backpack))
                    {
                        m.SendLocalizedMessage(1062334);     // This item must be in your backpack to be used.
                        return;
                    }

                    if (Potion.Destination == null || Potion.Destination.Item == null || Potion.Destination.Item.Deleted ||
                        Potion.Source == null || Potion.Source.Item == null || Potion.Source.Item.Deleted)
                    {
                        return;
                    }

                    if (!Potion.Source.Item.IsChildOf(m.Backpack) || !Potion.Destination.Item.IsChildOf(m.Backpack))
                    {
                        Potion.Source = null;
                        m.SendLocalizedMessage(1062334);     // This item must be in your backpack to be used.
                        return;
                    }

                    Potion.Destination.Props = Mannequin.FindMagicalItemProperty(Potion.Destination.Item);

                    if (Potion.CheckMagicalItem(Potion.Destination.Props))
                    {
                        m.SendLocalizedMessage(1159504);     // The destination item must be free of any magical properties.
                        return;
                    }

                    if (Potion.Destination.Props.Except(Potion.Source.Props).Any(x => x is MedableArmorProperty))
                    {
                        m.SendLocalizedMessage(1159678);     // Both source and destination objects must allow the use of the meditation skill (medable) or both block the meditation skill (non-medable).
                    }

                    m.CloseGump(typeof(BaseTransmogrificationPotionGump));
                    m.SendGump(new BaseTransmogrificationPotionGump(Potion));

                    m.CloseGump(typeof(BaseTransmogrificationPotionConfirmGump));
                    m.SendGump(new BaseTransmogrificationPotionConfirmGump(Potion));

                    break;
                }
            }
Ejemplo n.º 2
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                Mobile m = sender.Mobile;

                switch (info.ButtonID)
                {
                case 0:
                {
                    break;
                }

                case 1:
                {
                    if (!Potion.IsChildOf(m.Backpack))
                    {
                        m.SendLocalizedMessage(1062334);     // This item must be in your backpack to be used.
                        return;
                    }

                    if (Potion.Destination == null || Potion.Destination.Item == null || Potion.Destination.Item.Deleted ||
                        Potion.Source == null || Potion.Source.Item == null || Potion.Source.Item.Deleted)
                    {
                        return;
                    }

                    if (!Potion.Source.Item.IsChildOf(m.Backpack) || !Potion.Destination.Item.IsChildOf(m.Backpack))
                    {
                        Potion.Source = null;
                        m.SendLocalizedMessage(1062334);     // This item must be in your backpack to be used.
                        return;
                    }

                    Potion.Destination.Props = Mannequin.FindMagicalItemProperty(Potion.Destination.Item);

                    if (Potion.CheckMagicalItem(Potion.Destination.Props))
                    {
                        m.SendLocalizedMessage(1159504);     // The destination item must be free of any magical properties.
                        return;
                    }

                    if (Potion.Destination.Props.Except(Potion.Source.Props).Any(x => x is MedableArmorProperty))
                    {
                        m.SendLocalizedMessage(1159678);     // Both source and destination objects must allow the use of the meditation skill (medable) or both block the meditation skill (non-medable).
                    }

                    m.CloseGump(typeof(BaseTransmogrificationPotionGump));

                    m.PlaySound(491);

                    Potion.Source.Item.AttachSocket(new Transmogrified());

                    var socket = Potion.Source.Item.GetSocket <Transmogrified>();

                    if (socket != null)
                    {
                        socket.SourceName = Potion.Source.Item.Name;
                    }

                    Potion.Source.Item.ItemID   = Potion.Destination.Item.ItemID;
                    Potion.Source.Item.Hue      = Potion.Destination.Item.Hue;
                    Potion.Source.Item.LootType = Potion.Destination.Item.LootType;
                    Potion.Source.Item.Insured  = Potion.Destination.Item.Insured;

                    Potion.Destination.Item.Delete();
                    Potion.Delete();

                    break;
                }
                }
            }
Ejemplo n.º 3
0
                protected override void OnTarget(Mobile from, object targeted)
                {
                    if (!(targeted is Item targetitem) || Potion.Deleted)
                    {
                        return;
                    }

                    if (!Potion.IsChildOf(from.Backpack) || !targetitem.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it.
                        return;
                    }

                    var ip = new ItemProps {
                        Item = targetitem, Props = Mannequin.FindMagicalItemProperty(targetitem)
                    };

                    if (IsSource)
                    {
                        Potion.Source = ip;
                    }
                    else
                    {
                        if (Potion.CheckMagicalItem(ip.Props))
                        {
                            from.SendLocalizedMessage(1159504); // The destination item must be free of any magical properties.
                            return;
                        }

                        if (targetitem.HasSocket <Transmogrified>())
                        {
                            from.Send(new AsciiMessage(-1, -1, MessageType.Label, 946, 3, "System", "This item has already been transmogrified."));
                        }
                        else
                        {
                            Potion.Destination = ip;
                        }
                    }

                    int message = 0;

                    if (targetitem.Layer != Potion.ItemLayer)
                    {
                        message = Potion.ValidFailMessage;
                    }
                    else if (Potion.Destination != null && Potion.Destination.Item != null && !Potion.Destination.Item.Deleted &&
                             Potion.Source != null && Potion.Source.Item != null && !Potion.Source.Item.Deleted)
                    {
                        if (Potion.Destination.Item == Potion.Source.Item)
                        {
                            message = 1159518; // You may not set the source and destination objects to the same object!
                        }
                        else if (RaceDefinitions.GetRequiredRace(Potion.Destination.Item) != RaceDefinitions.GetRequiredRace(Potion.Source.Item))
                        {
                            message = 1159560; // You may not set the source and destination objects to objects of different race requirements.
                        }
                        else if (!Potion.CheckRules())
                        {
                            message = Potion.ValidFailMessage;
                        }
                        else if (Potion.Destination.Props.Except(Potion.Source.Props).Any(x => x is MedableArmorProperty))
                        {
                            message = 1159678; // Both source and destination objects must allow the use of the meditation skill (medable) or both block the meditation skill (non-medable).
                        }
                    }

                    if (message == 0)
                    {
                        from.CloseGump(typeof(BaseTransmogrificationPotionGump));
                        from.SendGump(new BaseTransmogrificationPotionGump(Potion));
                    }
                    else
                    {
                        if (IsSource)
                        {
                            Potion.Source = null;
                        }
                        else
                        {
                            Potion.Destination = null;
                        }

                        from.SendLocalizedMessage(message);
                    }
                }