public SpellbookData(ContainerItem 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; } }
void DropHeldItemToContainer(ContainerItem container) { // get random coords and drop the item there. Rectangle bounds = ContainerData.Get(container.ItemID).Bounds; int x = Utility.RandomValue(bounds.Left, bounds.Right); int y = Utility.RandomValue(bounds.Top, bounds.Bottom); DropHeldItemToContainer(container, x, y); }
void DropHeldItemToContainer(ContainerItem container, int x, int y) { Rectangle bounds = ContainerData.Get(container.ItemID).Bounds; IResourceProvider provider = Service.Get<IResourceProvider>(); Texture2D itemTexture = provider.GetItemTexture(HeldItem.DisplayItemID); if (x < bounds.Left) x = bounds.Left; if (x > bounds.Right - itemTexture.Width) x = bounds.Right - itemTexture.Width; if (y < bounds.Top) y = bounds.Top; if (y > bounds.Bottom - itemTexture.Height) y = bounds.Bottom - itemTexture.Height; m_Network.Send(new DropItemPacket(HeldItem.Serial, (ushort)x, (ushort)y, 0, 0, container.Serial)); ClearHolding(); }
public GumpPicContainer(AControl parent, int x, int y, int gumpID, int hue, ContainerItem containerItem) : base(parent, x, y, gumpID, hue) { m_containerItem = containerItem; }