private void Craft_Click(object sender, EventArgs e) { Item itemInvent = null; foreach (Item item in requiredItem.Keys) { foreach (Item itemTemp in _invent.Inventory.Keys) { if (itemTemp.GetName == item.GetName) { itemInvent = itemTemp; } } _invent.Inventory[itemInvent] -= requiredItem[item]; if (_invent.Inventory[itemInvent] == 0) { _invent.Inventory.Remove(itemInvent); } } _invent.AddItem(new ListItems().Items[3], 1); //((Label)(ItemLists.SelectedTab.Controls.Find("LSuccess", false)[0])).Visible = true; CraftLoad(ItemLists.SelectedTab, true); }
public void Test_Inventory_AddItem() { Item itemtest = new Item("épée", 10, 120, "Epee standard", "arme"); itemtest.AddRequired("attaque physique", 7); itemtest.AddStats("attaque physique", 5); Invent invent = new Invent(null); invent.AddItem(itemtest, 2); Assert.AreEqual(true, invent.GetItem(itemtest)); }