public async Task ShipWaifu(string name, ulong userId, ulong guildId = 0) { Program.GetPrefix(Context); if (guildId == 0) { guildId = Context.Guild.Id; } var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name), this); if (waifu == null) { return; } if (UserInventoryDb.OwnsWaifu(userId, waifu, guildId)) { await Context.Channel.SendMessageAsync($"They already own **{waifu.Name}**"); return; } await UserInventoryDb.AddWaifu(userId, waifu, guildId); await Context.Channel.SendMessageAsync($"**{waifu.Name}** shipped!"); }
public async Task ShipWaifu(IUser user, [Remainder] string name) { var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(name), this); if (waifu == null) { return; } if (waifu.Tier < 1 || waifu.Tier > 3) { if (!(Context.Guild.Id == 738291903770132646 && waifu.Tier == 825)) { await Context.Channel.SendMessageAsync(embed : new EmbedBuilderPrepared(Context.User) .WithDescription($"*~ You can only ship Tier 1-3 waifus ~*") .Build()); return; } } if (UserInventoryDb.OwnsWaifu(user.Id, waifu, Context.Guild.Id)) { await Context.Channel.SendMessageAsync($"They already own **{waifu.Name}**"); return; } await UserInventoryDb.AddWaifu(user.Id, waifu, Context.Guild.Id); await Context.Channel.SendMessageAsync($"**{waifu.Name}** shipped!", embed : WaifuUtil.WaifuEmbedBuilder(waifu).Build()); }
public async Task SellWaifu([Remainder] string str = "") { var waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(str, false, UserInventoryDb.GetWaifus(Context.User.Id, Context.Guild.Id)), this); //waifus existance if (waifu == null) { return; } int worth = WaifuUtil.GetSalePrice(waifu.Tier); var sell = new DialogueBoxOption(); sell.Action = async(IUserMessage message) => { if (!UserInventoryDb.OwnsWaifu(Context.User.Id, waifu, Context.Guild.Id)) { await message.ModifyAsync(x => { x.Embed = new EmbedBuilderPrepared(Context.User).WithDescription("You tried :star:").Build(); }); return; } try { await BalanceDb.AddToasties(Context.User.Id, worth, Context.Guild.Id); } catch (Exception ex) { await Context.Channel.SendMessageAsync(ex.Message); } //removing waifu + confirmation await UserInventoryDb.DeleteWaifu(Context.User.Id, waifu, Context.Guild.Id); await message.ModifyAsync(x => { x.Content = $"You sold **{waifu.Name}** for **{worth.ToString("n0")}** toasties."; x.Embed = ToastieUtil.ToastieEmbed(Context.User, BalanceDb.GetToasties(Context.User.Id, Context.Guild.Id)).Build(); }); }; sell.After = OnExecute.RemoveReactions; var cancel = new DialogueBoxOption(); cancel.After = OnExecute.Delete; var dia = new DialogueBox(); dia.Options.Add(Emote.Parse("<:TickYes:577838859107303424>"), sell); dia.Options.Add(Emote.Parse("<:TickNo:577838859077943306>"), cancel); dia.Timeout = new TimeSpan(0, 1, 0); dia.Embed = new EmbedBuilder() .WithAuthor(Context.User) .WithColor(BasicUtil.RandomColor()) .WithDescription($"Sell **{waifu.Name}** for **{worth.ToString("n0")}** toasties?").Build(); await DialogueReplyAsync(dia); return; }
public async Task WishWaifu([Remainder] string str = "") { var user = Context.User; Waifu waifu = await WaifuUtil.ProcessWaifuListAndRespond(await WaifuDb.SearchWaifus(str), this); if (waifu == null) { return; } var waifus = await WaifuWishlistDb.GetWishlist(user.Id, Context.Guild.Id); int cap = 5; if (PremiumDb.IsPremium(Context.User.Id, ProType.ProPlus)) { cap = 12; } string prefix = Program.GetPrefix(Context); if (waifus.Count >= cap) { await Context.Channel.SendMessageAsync(embed : new EmbedBuilderPrepared(Context.User) .WithDescription($"You have reached your wishlist limit of **{cap}**.\n" + $"Try `{prefix}rww` to remove a waifu.") .WithFooter($"Increase the limit: `{prefix}pro`") .Build()); return; } if (waifus.Any(x => x.Name == waifu.Name)) { await Context.Channel.SendMessageAsync($"**{waifu.Name}** is already in your wishlist. Baka."); return; } if (UserInventoryDb.OwnsWaifu(user.Id, waifu, Context.Guild.Id)) { await Context.Channel.SendMessageAsync($"You already own **{waifu.Name}**. Baka."); return; } await WaifuWishlistDb.AddWaifuWish(Context.User.Id, waifu, Context.Guild.Id); waifus = await WaifuWishlistDb.GetWishlist(user.Id, Context.Guild.Id); await Context.Channel.SendMessageAsync($"Added **{waifu.Name}** to your wishlist!", false, WaifuUtil.WishlistEmbed(waifus, (SocketGuildUser)user).Build()); }
public async Task Open([Remainder] string str = "") { var boxes = await LootBoxDb.GetAll(Context.User.Id, Context.Guild.Id); if (boxes.Count == 0) { await Context.Channel.SendMessageAsync("", false, ToastieUtil.NoBoxEmbed(Context.User).Build()); return; } LootBox box = null; if (boxes.Count == 1) { box = boxes[0]; } else { var listMsg = await Context.Channel.SendMessageAsync(embed : ToastieUtil.BoxListEmbed(boxes, Context.User) .WithFooter("Times out in 23 seconds") .WithDescription("Enter the number of the Lootbox you wish to open.") .Build()); var response = await NextMessageAsync( new Criteria <IMessage>() .AddCriterion(new EnsureSourceUserCriterion()) .AddCriterion(new EnsureSourceChannelCriterion()) .AddCriterion(new EnsureRangeCriterion(boxes.Count, Program.GetPrefix(Context))), new TimeSpan(0, 0, 23)); _ = listMsg.DeleteAsync(); int i = 0; try { i = int.Parse(response.Content); } catch { _ = Context.Message.DeleteAsync(); return; } _ = response.DeleteAsync(); box = boxes[i - 1]; } var type = LootboxStats.Lootboxes[box.Type]; try { await LootBoxDb.AddLootbox(Context.User.Id, box.Type, -1, box.GuildId); } catch { await Context.Channel.SendMessageAsync("You tried."); return; } var msg = await Context.Channel.SendMessageAsync("", false, ToastieUtil.BoxOpeningEmbed(Context.User).Build()); await ProfileDb.IncrementLootboxOpened(Context.User.Id); int waitms = 4200; if (type.IsWaifu()) { bool isPremium = PremiumDb.IsPremium(Context.User.Id, ProType.Pro); var waifu = await ToastieUtil.UnboxWaifu(type, isPremium, Context.User.Id, Context.Guild.Id); while (UserInventoryDb.OwnsWaifu(Context.User.Id, waifu, Context.Guild.Id)) { waifu = await ToastieUtil.UnboxWaifu(type, isPremium, Context.User.Id, Context.Guild.Id); } await UserInventoryDb.AddWaifu(Context.User.Id, waifu, Context.Guild.Id); await Task.Delay(waitms); var embed = WaifuUtil.WaifuEmbedBuilder(waifu, Context).Build(); await msg.ModifyAsync(x => { x.Embed = embed; x.Content = $"{Context.User.Mention} Congratulations! You found **{waifu.Name}**!"; }); return; } var amountWon = type.GetRandomToasties(); await BalanceDb.AddToasties(Context.User.Id, amountWon, Context.Guild.Id); var bal = BalanceDb.GetToasties(Context.User.Id, Context.Guild.Id); await Task.Delay(waitms); await msg.ModifyAsync(x => { x.Embed = new EmbedBuilder() .WithAuthor($"{Context.User} | {box.Type.ToString()}", Context.User.GetAvatarUrl(), LinkHelper.GetRedirectUrl(LinkHelper.Patreon, "Patreon", "cmd-embed-lootbox")) .WithColor(BasicUtil.RandomColor()) .WithThumbnailUrl("https://i.imgur.com/4JQmxa6.png") .WithDescription($"Congratulations! You found **{amountWon.ToString("n0")}** {ToastieUtil.RandomEmote()}!\nNow you have **{bal.ToString("n0")}** {ToastieUtil.RandomEmote()}!") .Build(); }); }