Esempio n. 1
0
        public MessageResult GetView(CommandModel cmdModel)
        {
            var embed = new EmbedBuilder()
            {
                Title       = "SecretShop! :convenience_store:",
                Description = ":shopping_cart: Buy items with `m!pet buy {itemIndex}`\n" +
                              $"**Update time:** {ShopJsonController.GetConfigValues().UpdateDate.ToShortTimeString()}",
                Color = Color.Orange
            };
            var embedFields = _GetShopFields(ShopJsonController.GetItems());

            foreach (var field in embedFields)
            {
                embed.AddField(field);
            }
            return(new MessageResult.EmbedView(embed.Build()));
        }
Esempio n. 2
0
        public override MessageResult Invoke()
        {
            var shop   = ShopJsonController.GetConfigValues();
            var itemId = Convert.ToInt32(Command.GetArgs[0]);

            if (shop.RndItemsId.Contains(itemId))
            {
                var buyItem = ShopJsonController.GetItems().FirstOrDefault(item => item.Id == itemId);
                if (Pet.Money >= buyItem.Price)
                {
                    Pet.Backpack.Add(Command.GetArgs[0]);
                    Pet.Money -= buyItem.Price;
                    return(new MessageResult.BooleanView(true));
                }
                return(new MessageResult.ErrorView("You dont have enough money!"));
            }
            else
            {
                Console.WriteLine(itemId);
                return(new MessageResult.BooleanView(false));
            }
        }