/// <summary> /// The player drop the selected item on the current cell /// </summary> /// <param name="player"></param> /// <param name="itemName"></param> public void DropItem(Player player, string itemName) { GameItem item = GameItemGlossary.Parse(itemName); if (item != null) { if (player.Inventory.RemoveItems(item, 1)) { GetCell(player.X, player.Y).AddItem(item); } } }
/// <summary> /// Craft the item from his name. /// The crafted item is placed in the inventory. /// If it can't be placed in the character inventory, it will be placed in the cell. /// </summary> /// <param name="name"></param> /// <param name="inventory"></param> /// <param name="c"></param> public void CraftItem(string name, Inventory inventory, Cell c) { GameItem item = GameItemGlossary.Parse(name); if (item == null) { return; } if (receipes.TryGetValue(name, out Receipe receipe)) { receipe.CraftItem(inventory, c); } }