Example #1
0
        internal static List <CorpseItem> CorpsesInRange(int range)
        {
            List <CorpseItem> list = new List <CorpseItem>();

            if (World.Player == null)
            {
                return(list);
            }

            foreach (Item m in World.Items.Values)
            {
                if (m.ItemID == 0x2006)
                {
                    CorpseItem corpse = m as CorpseItem;
                    if (corpse != null)
                    {
                        if (Utility.InRange(World.Player.Position, corpse.Position, range))
                        {
                            list.Add(corpse);
                        }
                    }
                }
            }

            return(list);
        }
Example #2
0
        public static Item Factory(Serial serial, UInt32 itemID)
        {
            // during drag operation item may be removed from World
            if (itemID == 0 && DragDropManager.Holding != null && DragDropManager.Holding.Serial == serial)
            {
                // Dropping this item, but already deleted so use ItemID from dead one
                // Because the itemID of dragged items is not on a drop packet
                itemID = DragDropManager.Holding.ItemID;
            }
            Item item = null;

            switch (itemID)
            {
            case 0x14EC:
                item = new MapItem(serial);
                break;

            case 0x2006:
                item = new CorpseItem(serial);
                break;

            case 0:
                item = new Item(serial);
                break;

            default:
                item = new Item(serial);
                break;
            }
            if (item != null)
            {
                item.ItemID = (ushort)itemID;
            }
            return(item);
        }