/// <summary> /// Get the item in the specified slot. /// </summary> /// <param name="s"></param> /// <returns></returns> public Item GetItemInSlot(Constants.SlotNumber s) { uint address = Addresses.Player.SlotHead + 12 * ((uint)s - 1); uint id = client.Memory.ReadUInt32(address); if (id > 0) { byte count = client.Memory.ReadByte(address + Addresses.Player.DistanceSlotCount); return(new Item(client, id, count, "", ItemLocation.FromSlot(s))); } else { return(null); } }
public IEnumerable <Item> GetSlotItems() { uint address = Addresses.Player.SlotHead; for (int i = 0; i < Addresses.Player.MaxSlots; i++, address += 12) { uint id = client.Memory.ReadUInt32(address); if (id > 0) { yield return(new Item(client, id, client.Memory.ReadByte(address + +Addresses.Player.DistanceSlotCount), "", ItemLocation.FromSlot((Constants.SlotNumber)i))); } } }
public static ItemLocation FromItemLocation(ItemLocation location) { switch (location.Type) { case Tibia.Constants.ItemLocationType.Container: return(ItemLocation.FromContainer(location.ContainerId, location.ContainerSlot)); case Tibia.Constants.ItemLocationType.Ground: return(ItemLocation.FromLocation(location.GroundLocation, location.StackOrder)); case Tibia.Constants.ItemLocationType.Slot: return(ItemLocation.FromSlot(location.Slot)); default: return(null); } }