void TransferItem(DaggerfallUnityItem item, ItemCollection from, ItemCollection to) { // Block transfer of horse or cart if (item.IsOfTemplate(ItemGroups.Transportation, (int)Transportation.Horse) || item.IsOfTemplate(ItemGroups.Transportation, (int)Transportation.Small_cart)) { return; } // When transferring gold to player simply add to player's gold count if (item.IsOfTemplate(ItemGroups.Currency, (int)Currency.Gold_pieces) && PlayerEntity.Items == to) { playerEntity.GoldPieces += item.stackCount; from.RemoveItem(item); Refresh(false); return; } to.Transfer(item, from, preferredOrder); Refresh(false); }
/// <summary> /// Transfers a single item from another collection to this collection. /// Item will be removed from source collection and placed in this collection. /// UID will be retained. /// </summary> /// <param name="item">Item to transfer.</param> /// <param name="source">Source collection to transfer from.</param> /// <param name="position">Position in list to transfer item.</param> public void Transfer(DaggerfallUnityItem item, ItemCollection source, AddPosition position = AddPosition.DontCare) { if (item == null || source == null) return; source.RemoveItem(item); AddItem(item, position); }