/// <summary>Gives an item to the player. Ensure slot is valid by calling various validators before calling this function.</summary> internal InventoryItem GiveItem(InventoryItem invItem, int slotId) { //_log.DebugFormat("Placing item {0}({1}) into slot {2}", invItem.Item.Name, invItem.ItemID, slotId); InventoryItem newItem = invItem.ToNewInventoryItem(); this.InvMgr[slotId] = newItem; ZoneServer.SendItemPacket(this.Client, newItem, ItemPacketType.Trade); // TODO: container contents - this may be tricky as each item (if any) in a container are sent separate from the container (above). // This means the above item probably can't have the subItems already calculated? Also probably have to recurse this routine due to // arbitrary levels of nested containers // TODO: Does loot work differently than say trading items? Orig emu had a separate giveLoot routine. Maybe clone invItem to an // invItem that doesn't have subItems calculated this.InvMgr.CalculateSubItems(InventoryLocations.Personal); CalcStatModifiers(); return this.InvMgr[slotId]; }
internal void GiveItem(InventoryItem invItem) { InventoryItem newItem = invItem.ToNewInventoryItem(); AddItem(newItem, true, true); }