Beispiel #1
0
        public ContainerGump(AEntity containerItem, int gumpID)
            : base(containerItem.Serial, 0)
        {
            m_data = ContainerData.GetData(gumpID);
            m_item = (Container)containerItem;
            m_item.OnContentsUpdated += OnItemContentsUpdate;

            IsMoveable = true;

            AddControl(new GumpPicContainer(this, 0, 0, m_data.GumpID, 0, m_item));
        }
        public SpellbookData(Container spellbook, ContainerContentPacket contents)
        {
            Serial = spellbook.Serial;
            ItemID = (ushort)spellbook.ItemID;

            BookType = GetSpellBookTypeFromItemID(spellbook.ItemID);
            if (BookType == SpellBookTypes.Unknown)
                return;

            int offset = GetOffsetFromSpellBookType(BookType);

            foreach (ItemInContainer i in contents.Items)
            {
                ulong spellBit = ((ulong)1) << ((i.Amount - offset) & 0x0000003F);
                SpellsBitfield |= spellBit;
            }
        }
 private void DropHeldItemToContainer(Container container, int x, int y)
 {
     Rectangle containerBounds = ContainerData.GetData(container.ItemID).Bounds;
     IResourceProvider provider = ServiceRegistry.GetService<IResourceProvider>();
     Texture2D itemTexture = provider.GetItemTexture(HeldItem.DisplayItemID);
     if (x < containerBounds.Left) x = containerBounds.Left;
     if (x > containerBounds.Right - itemTexture.Width) x = containerBounds.Right - itemTexture.Width;
     if (y < containerBounds.Top) y = containerBounds.Top;
     if (y > containerBounds.Bottom - itemTexture.Height) y = containerBounds.Bottom - itemTexture.Height;
     m_Network.Send(new DropItemPacket(HeldItem.Serial, (ushort)x, (ushort)y, 0, 0, container.Serial));
     ClearHolding();
 }
 private void DropHeldItemToContainer(Container container)
 {
     // get random coords and drop the item there.
     Rectangle bounds = ContainerData.GetData(container.ItemID).Bounds;
     int x = Utility.RandomValue(bounds.Left, bounds.Right);
     int y = Utility.RandomValue(bounds.Top, bounds.Bottom);
     DropHeldItemToContainer(container, x, y);
 }
 public GumpPicContainer(AControl owner, int x, int y, int gumpID, int hue, Container containerItem)
     : base(owner, x, y, gumpID, hue)
 {
     m_containerItem = containerItem;
 }
Beispiel #6
0
        public SpellbookData(Container spellbook, ContainerContentPacket contents)
        {
            Serial = spellbook.Serial;
            ItemID = (ushort)spellbook.ItemID;

            BookType = GetSpellBookTypeFromItemID(spellbook.ItemID);
            if (BookType == SpellBookTypes.Unknown)
                return;

            int offset = GetOffsetFromSpellBookType(BookType);

            foreach (ItemInContainer i in contents.Items)
            {
                int index = ((i.Amount - offset) & 0x0000003F);
                int circle = (index / 8);
                index = index % 8;
                index = ((3 - circle % 4) + (circle / 4) * 4) * 8 + (index);
                ulong flag = ((ulong)1) << index;

                SpellsBitfield |= flag;
            }
        }
Beispiel #7
0
 private void DropHeldItemToContainer(Container container, int x, int y)
 {
     Rectangle containerBounds = IO.ContainerData.GetData(container.ItemID).Bounds;
     Texture2D itemTexture = IO.ArtData.GetStaticTexture(HeldItem.DisplayItemID);
     if (x < containerBounds.Left) x = containerBounds.Left;
     if (x > containerBounds.Right - itemTexture.Width) x = containerBounds.Right - itemTexture.Width;
     if (y < containerBounds.Top) y = containerBounds.Top;
     if (y > containerBounds.Bottom - itemTexture.Height) y = containerBounds.Bottom - itemTexture.Height;
     m_Network.Send(new DropItemPacket(HeldItem.Serial, (ushort)x, (ushort)y, 0, 0, container.Serial));
     ClearHolding();
 }