Пример #1
0
        public async Task <string> Take(string input, Player player)
        {
            //determine what the player wants to take by comparing the subject of their sentence with items in the current cell, attempt to add that item to their inventory
            var response = "";
            var itemName = input.RemoveWordsFromString(0, 1);


            var cell = await _cellLogic.GetPlayerCell(player);

            var item = cell.Inventory.Entities.FirstOrDefault(x => x.Name.ToLower().Contains(itemName));

            if (item != null)
            {
                await _mudDataAccess.UpdateEntityInventory(cell.Inventory, player.Inventory, item);

                response += $"You pickup {item.Name}";
                await Replicate($"{player.Name} picks up {item.Name.GetAOrAnFromInput()} {item.Name}", player);
            }
            else
            {
                response = $"You do not see {item.Name.GetAOrAnFromInput()} {itemName}";
            }

            return(response);
        }