Beispiel #1
0
        public static void OnEnterRegion(OnEnterRegionEventArgs e)
        {
            Mobile m = e.From;

            if (!m.Player || e.OldRegion == null || e.NewRegion == null || m.Backpack == null)
            {
                return;
            }

            if (e.OldRegion.IsPartOf("Wrong") && !e.NewRegion.IsPartOf("Wrong"))
            {
                bool found = false;

                m.Backpack.Items.IterateReverse(i =>
                {
                    EnchantedHotItemSocket socket = i.GetSocket <EnchantedHotItemSocket>();

                    if (socket != null)
                    {
                        found = true;
                        socket.Remove();
                    }
                });

                if (found)
                {
                    m.SendLocalizedMessage(1152085); // The curse is removed from the item you stole!
                }
            }
        }
Beispiel #2
0
        public static bool CheckDrop(Mobile from, Container droppedTo, Item dropped)
        {
            EnchantedHotItemSocket socket = dropped.GetSocket <EnchantedHotItemSocket>();

            if (socket != null)
            {
                Container c = socket.Container;

                if (droppedTo != c && droppedTo != from.Backpack)
                {
                    from.SendLocalizedMessage(1152083); // The stolen item magically returns to the trunk where you found it.

                    if (c != null)
                    {
                        c.DropItem(dropped);
                    }
                    else
                    {
                        dropped.Delete();
                    }

                    return(false);
                }
            }

            return(true);
        }
Beispiel #3
0
        public override bool DropToWorld(Mobile from, Point3D p)
        {
            bool drop = base.DropToWorld(from, p);

            EnchantedHotItemSocket.CheckDrop(from, this);

            return(drop);
        }
Beispiel #4
0
        public override bool TryDropItem(Mobile from, Item dropped, bool sendFullMessage)
        {
            if (!CheckHold(from, dropped, sendFullMessage, !CheckStack(from, dropped)))
            {
                return(false);
            }

            if (dropped.QuestItem && from.Backpack != this)
            {
                from.SendLocalizedMessage(1074769); // An item must be in your backpack (and not in a container within) to be toggled as a quest item.
                return(false);
            }

            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (house != null && house.IsLockedDown(this))
            {
                if (dropped is VendorRentalContract || (dropped is Container && ((Container)dropped).FindItemByType(typeof(VendorRentalContract)) != null))
                {
                    from.SendLocalizedMessage(1062492); // You cannot place a rental contract in a locked down container.
                    return(false);
                }

                if (!house.LockDown(from, dropped, false))
                {
                    return(false);
                }
            }

            List <Item> list = Items;

            for (int i = 0; i < list.Count; ++i)
            {
                Item item = list[i];

                if (!(item is Container) && item.StackWith(from, dropped, false))
                {
                    return(true);
                }
            }

            DropItem(dropped);

            ItemFlags.SetTaken(dropped, true);

            EventSink.InvokeContainerDroppedTo(new ContainerDroppedToEventArgs(from, this, dropped));

            if (!EnchantedHotItemSocket.CheckDrop(from, this, dropped))
            {
                return(false);
            }

            return(true);
        }
Beispiel #5
0
        public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
        {
            if (!CheckHold(from, item, true, true))
            {
                return(false);
            }

            if (item.QuestItem && from.Backpack != this)
            {
                from.SendLocalizedMessage(1074769); // An item must be in your backpack (and not in a container within) to be toggled as a quest item.
                return(false);
            }

            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (house != null && house.IsLockedDown(this))
            {
                if (item is VendorRentalContract || (item is Container && ((Container)item).FindItemByType(typeof(VendorRentalContract)) != null))
                {
                    from.SendLocalizedMessage(1062492); // You cannot place a rental contract in a locked down container.
                    return(false);
                }

                if (!house.LockDown(from, item, false))
                {
                    return(false);
                }
            }

            item.Location = new Point3D(p.X, p.Y, 0);

            AddItem(item);

            from.SendSound(GetDroppedSound(item), GetWorldLocation());

            ItemFlags.SetTaken(item, true);

            EventSink.InvokeContainerDroppedTo(new ContainerDroppedToEventArgs(from, this, item));

            if (!EnchantedHotItemSocket.CheckDrop(from, this, item))
            {
                return(false);
            }

            return(true);
        }
Beispiel #6
0
        public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
        {
            if (!CheckHold(from, item, true, true))
            {
                return(false);
            }

            if (item.QuestItem && from.Backpack != this)
            {
                from.SendLocalizedMessage(1074769); // An item must be in your backpack (and not in a container within) to be toggled as a quest item.
                return(false);
            }

            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (house != null && house.IsLockedDown(this))
            {
                if (item is VendorRentalContract || (item is Container && ((Container)item).FindItemByType(typeof(VendorRentalContract)) != null))
                {
                    from.SendLocalizedMessage(1062492); // You cannot place a rental contract in a locked down container.
                    return(false);
                }

                if (!house.LockDown(from, item, false))
                {
                    return(false);
                }
            }

            item.Location = new Point3D(p.X, p.Y, 0);

            AddItem(item);

            from.SendSound(GetDroppedSound(item), GetWorldLocation());

            ItemFlags.SetTaken(item, true);

            var honestySocket = item.GetSocket <HonestyItemSocket>();

            if (honestySocket != null && honestySocket.HonestyPickup == DateTime.MinValue)
            {
                honestySocket.HonestyPickup = DateTime.UtcNow;
                honestySocket.StartHonestyTimer();

                if (honestySocket.HonestyOwner == null)
                {
                    Server.Services.Virtues.HonestyVirtue.AssignOwner(honestySocket);
                }

                from.SendLocalizedMessage(1151536); // You have three hours to turn this item in for Honesty credit, otherwise it will cease to be a quest item.
            }

            if (Siege.SiegeShard && this != from.Backpack && from is PlayerMobile && ((PlayerMobile)from).BlessedItem != null && ((PlayerMobile)from).BlessedItem == item)
            {
                ((PlayerMobile)from).BlessedItem = null;
                item.LootType = LootType.Regular;

                from.SendLocalizedMessage(1075292, item.Name != null ? item.Name : "#" + item.LabelNumber.ToString()); // ~1_NAME~ has been unblessed.
            }

            if (!EnchantedHotItemSocket.CheckDrop(from, this, item))
            {
                return(false);
            }

            return(true);
        }
Beispiel #7
0
        public override bool TryDropItem(Mobile from, Item dropped, bool sendFullMessage)
        {
            if (!CheckHold(from, dropped, sendFullMessage, !CheckStack(from, dropped)))
            {
                return(false);
            }

            if (dropped.QuestItem && from.Backpack != this)
            {
                from.SendLocalizedMessage(1074769); // An item must be in your backpack (and not in a container within) to be toggled as a quest item.
                return(false);
            }

            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (house != null && house.IsLockedDown(this))
            {
                if (dropped is VendorRentalContract || (dropped is Container && ((Container)dropped).FindItemByType(typeof(VendorRentalContract)) != null))
                {
                    from.SendLocalizedMessage(1062492); // You cannot place a rental contract in a locked down container.
                    return(false);
                }

                if (!house.LockDown(from, dropped, false))
                {
                    return(false);
                }
            }

            List <Item> list = Items;

            for (int i = 0; i < list.Count; ++i)
            {
                Item item = list[i];

                if (!(item is Container) && item.StackWith(from, dropped, false))
                {
                    return(true);
                }
            }

            DropItem(dropped);

            ItemFlags.SetTaken(dropped, true);

            var honestySocket = dropped.GetSocket <HonestyItemSocket>();

            if (honestySocket != null && honestySocket.HonestyPickup == DateTime.MinValue)
            {
                honestySocket.HonestyPickup = DateTime.UtcNow;
                honestySocket.StartHonestyTimer();

                if (honestySocket.HonestyOwner == null)
                {
                    Server.Services.Virtues.HonestyVirtue.AssignOwner(honestySocket);
                }

                from.SendLocalizedMessage(1151536); // You have three hours to turn this item in for Honesty credit, otherwise it will cease to be a quest item.
            }

            if (Siege.SiegeShard && this != from.Backpack && from is PlayerMobile && ((PlayerMobile)from).BlessedItem != null && ((PlayerMobile)from).BlessedItem == dropped)
            {
                ((PlayerMobile)from).BlessedItem = null;
                dropped.LootType = LootType.Regular;

                from.SendLocalizedMessage(1075292, dropped.Name != null ? dropped.Name : "#" + dropped.LabelNumber.ToString()); // ~1_NAME~ has been unblessed.
            }

            if (!EnchantedHotItemSocket.CheckDrop(from, this, dropped))
            {
                return(false);
            }

            return(true);
        }