public void InventoryUnequipItem() { IInventory inventory = new Inventory(60); IItemInfo info = new ItemArmorInfo(ItemType.ClothCap, InventorySlot.Head, 10, 5); IItem testItem = new Item(Guid.NewGuid(), info, null, ItemQualityCode.Superior, 1); IEntityStats stats = new EntityStats(); IEntityAbility abilities = new EntityAbility(GeneralAbilities.All, ItemAbilities.None, EntityAbilities.ModifyInterationAbilities, EffectAbilities.ModifyMagicAbilities, AIAbilities.None); inventory.Set(testItem, InventorySlot.Inventory1, stats); Assert.AreEqual(inventory.Remaining, 59); // equip the item bool equipSuccess = inventory.Swap(InventorySlot.Inventory1, InventorySlot.Head, stats); Assert.IsTrue(equipSuccess); Assert.AreEqual(inventory.Remaining, 60); bool unequipSuccess = inventory.Swap(InventorySlot.Head, InventorySlot.Inventory1, stats); Assert.IsTrue(unequipSuccess); Assert.AreEqual(inventory.Remaining, 59); // the item should be back in the zero'th position IItem getItem = inventory.Get(InventorySlot.Inventory1, stats); Assert.AreEqual(inventory.Remaining, 60); Assert.IsNotNull(getItem); }
private IItem GetDummyArmor() { IItemInfo info = new ItemArmorInfo(ItemType.ClothCap, InventorySlot.Head, 10, 5); Guid id = Guid.NewGuid(); Item item = new Item(id, info, null, ItemQualityCode.Superior, 1); return(item); }
public void InventoryEquipItem() { IInventory inventory = new Inventory(60); IItemInfo info = new ItemArmorInfo(ItemType.ClothCap, InventorySlot.Head, 10, 5); IItem testItem = new Item(Guid.NewGuid(), info, null, ItemQualityCode.Superior, 1); IEntityAbility abilities = new EntityAbility(GeneralAbilities.All, ItemAbilities.None, EntityAbilities.ModifyInterationAbilities, EffectAbilities.ModifyMagicAbilities, AIAbilities.None); IEntityStats stats = new EntityStats(); inventory.Set(testItem, InventorySlot.Inventory1, null); bool equipSuccess = inventory.Swap(InventorySlot.Inventory1, InventorySlot.Head, stats); Assert.IsTrue(equipSuccess); // ensure we can no longer get the item IItem getItem = inventory.Get(0, null); Assert.IsNull(getItem); }