GetShop() public static method

public static GetShop ( ulong guildId, ShopType type, bool overrideNew = false ) : Task
guildId ulong
type ShopType
overrideNew bool
return Task
Beispiel #1
0
        public async Task ModShop([Remainder] string str = "")
        {
            WaifuShop shop = await WaifuUtil.GetShop(Context.Guild.Id, ShopType.Mod);

            int              count  = Constants.shoplimitedamount + Constants.shopt1amount + Constants.shopt2amount + Constants.shopt3amount;
            string           prefix = Program.GetPrefix(Context);
            List <ShopWaifu> waifus = new List <ShopWaifu>();

            if (shop != null)
            {
                waifus = shop.ShopWaifus;
            }

            waifus = waifus.OrderBy(x => x.Waifu.Tier).ThenBy(x => x.Waifu.Source).ThenBy(x => x.Waifu.Name).ToList();

            if (waifus.Count <= count)
            {
                var eb = WaifuUtil.NewShopEmbed(waifus, prefix, Context.Guild.Id, ShopType.Mod);
                await Context.Channel.SendMessageAsync("", false, eb.Build());

                return;
            }

            await PagedReplyAsync(WaifuUtil.PaginatedShopMessage(waifus, count, prefix, Context.Guild.Id, ShopType.Mod));
        }
Beispiel #2
0
        public async Task ResetWaifuShop()
        {
            await WaifuUtil.GetShop(Context.Guild.Id, ShopType.Waifu, true);

            await WaifuUtil.GetShop(Context.Guild.Id, ShopType.Gacha, true);

            await Context.Channel.SendMessageAsync("Waifu Shop and Gacha Shop reset.");
        }
Beispiel #3
0
        public async Task GachaShop([Remainder] string str = "")
        {
            WaifuShop shop = await WaifuUtil.GetShop(Context.Guild.Id, ShopType.Gacha);

            string prefix = Program.GetPrefix(Context);
            var    waifus = shop.ShopWaifus.OrderByDescending(x => x.Limited).ThenBy(x => x.Waifu.Tier).ThenBy(x => x.Waifu.Source).ToList();

            var eb = WaifuUtil.NewShopEmbed(waifus, prefix, Context.Guild.Id, ShopType.Gacha);
            await Context.Channel.SendMessageAsync("", false, eb.Build());
        }
Beispiel #4
0
        public async Task ModShopRemoveWaifu([Remainder] string name = "")
        {
            var shop = await WaifuUtil.GetShop(Context.Guild.Id, ShopType.Mod);

            var waifus = shop.ShopWaifus.Select(x => x.Waifu);

            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name, false, waifus), this);

            if (waifu == null)
            {
                return;
            }

            await WaifuShopDb.RemoveItem(shop.ShopWaifus.FirstOrDefault(x => x.Waifu.Name.Equals(waifu.Name)));

            await Context.Channel.SendMessageAsync(embed : new EmbedBuilderPrepared(Context.User)
                                                   .WithDescription($"*~ **{waifu.Name}** removed from the Mod Shop ~*")
                                                   .Build());

            return;
        }
Beispiel #5
0
        public async Task WaifuShopSlides([Remainder] string str = "")
        {
            List <ShopWaifu> waifus = (await WaifuUtil.GetShop(Context.Guild.Id, ShopType.Waifu)).ShopWaifus;

            waifus.RemoveAt(0);

            var lockObj = new Object();

            if (slideLock.ContainsKey(Context.Channel.Id))
            {
                slideLock.Remove(Context.Channel.Id);
            }
            slideLock.Add(Context.Channel.Id, lockObj);

            var eb  = WaifuUtil.WaifuShopSlideEmbed(waifus[0].Waifu);
            var msg = await Context.Channel.SendMessageAsync("", false, eb.Build());

            await Task.Delay(5000);

            for (int i = 1; i < waifus.Count; i++)
            {
                if (slideLock.GetValueOrDefault(Context.Channel.Id) != lockObj)
                {
                    break;
                }
                eb = WaifuUtil.WaifuShopSlideEmbed(waifus[i].Waifu);
                await msg.ModifyAsync(x => x.Embed = eb.Build());

                await Task.Delay(5000);
            }

            eb = WaifuUtil.WaifuShopSlideEmbed(waifus[new Random().Next(waifus.Count)].Waifu);
            eb.WithFooter("Slideshow ended.");
            await msg.ModifyAsync(x => x.Embed = eb.Build());

            if (slideLock.GetValueOrDefault(Context.Channel.Id) == lockObj)
            {
                slideLock.Remove(Context.Channel.Id);
            }
        }
Beispiel #6
0
        public async Task ModShopAddWaifu([Remainder] string name)
        {
            var prefix = Program.GetPrefix(Context);

            if (!PremiumDb.IsPremium(Context.Guild.Id, ProType.GuildPlus))
            {
                await Context.Channel.SendMessageAsync(embed : new EmbedBuilderPrepared(Context.User)
                                                       .WithDescription($"*~ This command requires Pro Guild+ ~*")
                                                       .WithFooter($"`{prefix}pro`")
                                                       .Build());

                return;
            }

            var shop = await WaifuUtil.GetShop(Context.Guild.Id, ShopType.Mod);

            var waifus = shop.ShopWaifus.Select(x => x.Waifu);

            var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name), this);

            if (waifu == null)
            {
                return;
            }

            if (waifu.Tier < 1 || waifu.Tier > 3)
            {
                await Context.Channel.SendMessageAsync(embed : new EmbedBuilderPrepared(Context.User)
                                                       .WithDescription($"*~ You can only add Tier 1-3 waifus ~*")
                                                       .Build());

                return;
            }
            if (shop.ShopWaifus.Count >= 15)
            {
                await Context.Channel.SendMessageAsync(embed : new EmbedBuilderPrepared(Context.User)
                                                       .WithDescription($"*~ The Mod Shop is limited to 15 waifus. `{prefix}msrw` to remove ~*")
                                                       .Build());

                return;
            }
            if (waifus.Any(x => x.Name.Equals(waifu.Name)))
            {
                await Context.Channel.SendMessageAsync(embed : new EmbedBuilderPrepared(Context.User)
                                                       .WithDescription($"*~ **{waifu.Name}** is already in the mod shop ~*")
                                                       .Build());

                return;
            }

            await WaifuShopDb.UpdateItem(new ShopWaifu
            {
                Discount  = 0,
                Limited   = -1,
                WaifuShop = shop,
                Waifu     = waifu
            });

            await Context.Channel.SendMessageAsync($"Added **{waifu.Name}** to the Mod Shop", embed : WaifuUtil.WaifuEmbedBuilder(waifu).Build());

            return;
        }