Exemplo n.º 1
0
        private async Task AddBlockCommandAsync(int segmentId, int x, int y, string type)
        {
            var blockType = Enum.Parse <BlockType>(type, true);

            if (await _inventoryRepository.RemoveFromInventoryAsync(blockType, 1, Context.User).ConfigureAwait(false))
            {
                if (!await _segmentRepository.AddBlockAsync(segmentId, x - 1, y - 1, blockType).ConfigureAwait(false))
                {
                    await _inventoryRepository.AddToInventoryAsync(blockType, 1, Context.User).ConfigureAwait(false);
                }
                await _tacZapController.ShowSegmentAsync(Context, segmentId).ConfigureAwait(false);

                return;
            }

            await ReplyAsync(Responses.ShopAdvisoryMessage).ConfigureAwait(false);
        }
Exemplo n.º 2
0
 public async Task AddBlock(int x, int y)
 {
     await _segmentRepository.AddBlockAsync(_segmentId, x, y, BlockType.Energy);
 }