private CommandResponse SellItem(string itemLabel, Inventory locationItems, Player player) { if (!(player.Inventory.ItemList.ContainsKey(itemLabel))) return new CommandResponse("There is no such item"); else { Item item = player.Inventory.GetItem(itemLabel); player.Inventory.RemoveItem(item); locationItems.AddItem(item); player.Inventory.GetGold().Total += item.Value; return new CommandResponse("You've sold the item: " + itemLabel); } }
private CommandResponse DropItemToLocation(String itemLabel, Inventory locationItems, Player player) { if (itemLabel == "gold") { int amount = player.Inventory.GetGold().Total; player.Inventory.RemoveMoney(amount); player.CurrentLocation.Items.AddMoney(amount); return new CommandResponse("You dropped " + amount + " gold"); } Item item = player.Inventory.GetItem(itemLabel); player.Inventory.RemoveItem(item); locationItems.AddItem(item); return new CommandResponse("You dropped the item: " + itemLabel); }