public InventoryMenu(IEnumerable <InventoryItem> items) { Blocks = new List <BlockMessage> { BlockMessage.Divider() }; Blocks.AddRange(items.Aggregate(new List <BlockMessage>(), (list, item) => list.Concat(ItemSection(item)).ToList())); }
public ShopMenu(IEnumerable <Item> items) { Blocks = new List <BlockMessage> { BlockMessage.TextSection(DougMessages.ShopSpeech), BlockMessage.Divider() }; Blocks.AddRange(items.Select(ShopItemSection)); Blocks.Add(BlockMessage.Divider()); }
private static List <BlockMessage> ItemSection(InventoryItem item) { var blocks = new List <BlockMessage>(); var textBlock = TextBlock.MarkdownTextBlock($"{item.Item.Icon} *{item.Item.Name}* \n {item.Item.Description}"); var itemOptions = ItemActionsAccessory(item.InventoryPosition, item.Item.Price / 2); blocks.Add(new BlockMessage { Type = "section", Text = textBlock, Accessory = itemOptions }); blocks.Add(BlockMessage.Context(string.Format(DougMessages.Quantity, item.Quantity))); blocks.Add(BlockMessage.Divider()); return(blocks); }