public void LoadItemStash(ItemStashWindow itemStashWindow, string ItemStashID) { ItemContainerSaveData savedSlots = ItemSaveIO._LoadItems(ItemStashID); if (savedSlots == null) { return; } itemStashWindow.Clear(); for (int i = 0; i < savedSlots.SavedSlots.Length; i++) { ItemSlot itemSlot = itemStashWindow.itemSlots[i]; ItemSlotSaveData savedSlot = savedSlots.SavedSlots[i]; if (savedSlot == null) { itemSlot.Item = null; itemSlot.Amount = 0; } else { itemSlot.Item = itemDatabase.GetItemCopy(savedSlot.ItemID); itemSlot.Amount = savedSlot.Amount; } } }
public void LoadInventory(Character character) { ItemContainerSaveData savedSlots = ItemSaveIO._LoadItems(InventoryFileName); if (savedSlots == null) { return; } character.inventory.Clear(); for (int i = 0; i < savedSlots.SavedSlots.Length; i++) { ItemSlot itemSlot = character.inventory.itemSlots[i]; ItemSlotSaveData savedSlot = savedSlots.SavedSlots[i]; if (savedSlot == null) { itemSlot.Item = null; itemSlot.Amount = 0; } else { itemSlot.Item = itemDatabase.GetItemCopy(savedSlot.ItemID); itemSlot.Amount = savedSlot.Amount; } } }
public void LoadEquipment(Character character) { ItemContainerSaveData savedSlots = ItemSaveIO._LoadItems(EquipmentFileName); if (savedSlots == null) { return; } foreach (ItemSlotSaveData savedSlot in savedSlots.SavedSlots) { if (savedSlot == null) { continue; } Item item = itemDatabase.GetItemCopy(savedSlot.ItemID); character.inventory.AddItem(item); character.Equip((EquippableItem)item); } }