public void LootItem(ushort id)
{
sbyte freeslot;
bool gotslot = GetFreeInventorySlot(out freeslot);
Drop drop;
if (Map.Drops.TryGetValue(id, out drop))
{
if (!drop.CanTake || Vector2.Distance(this.Position, drop.Position) >= 500)
{
Handler12.ObtainedItem(this, drop.Item, ObtainedItemStatus.FAILED);
return;
}
else if (!gotslot)
{
Handler12.ObtainedItem(this, drop.Item, ObtainedItemStatus.INV_FULL);
return;
}
drop.CanTake = false; //just to be sure
Map.RemoveDrop(drop);
Item item = null;
if (drop.Item is DroppedEquip)
{
item = new Equip(drop.Item as DroppedEquip, this, freeslot);
}
else
{
item = new Item(drop.Item, this, freeslot);
}
Handler12.ObtainedItem(this, drop.Item, ObtainedItemStatus.OBTAINED);
Handler12.ModifyInventorySlot(this, 0x24, (byte)freeslot, 0, item);
}
}