From 5f9ebe48a44bc4010ff0b1f653072e934caacbf2 Mon Sep 17 00:00:00 2001 From: Lan <50151341+Lannnnnnnnn@users.noreply.github.com> Date: Wed, 31 Mar 2021 17:18:21 +0300 Subject: [PATCH] fishing changes and stuff --- Kehyeedra3/ApplicationDbContextFactory.cs | 9 +- Kehyeedra3/Bot.cs | 4 +- Kehyeedra3/Command handler.cs | 124 +-- Kehyeedra3/Commands.cs | 2 - Kehyeedra3/Commands/Admin.cs | 790 +++++++++++------- Kehyeedra3/Commands/Economy.cs | 759 +++++++++++------ Kehyeedra3/Commands/Help.cs | 11 + Kehyeedra3/Commands/Interactive.cs | 477 ++++++----- Kehyeedra3/Commands/Stuff.cs | 2 + Kehyeedra3/Extensions.cs | 6 +- Kehyeedra3/Kehyeedra3.csproj | 11 +- .../Services/Models/BattleFishCharacters.cs | 85 ++ Kehyeedra3/Services/Models/Fishing.cs | 21 +- Kehyeedra3/Services/Models/User.cs | 64 +- Kehyeedra3/Services/ReminderService.cs | 2 +- 15 files changed, 1560 insertions(+), 807 deletions(-) create mode 100644 Kehyeedra3/Services/Models/BattleFishCharacters.cs diff --git a/Kehyeedra3/ApplicationDbContextFactory.cs b/Kehyeedra3/ApplicationDbContextFactory.cs index cab537e..085a91b 100644 --- a/Kehyeedra3/ApplicationDbContextFactory.cs +++ b/Kehyeedra3/ApplicationDbContextFactory.cs @@ -1,8 +1,12 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; +using Pomelo.EntityFrameworkCore.MySql.Infrastructure; +using Pomelo.EntityFrameworkCore.MySql.Storage; using System; using System.Collections.Generic; using System.Text; +using dotenv.net; +using System.IO; namespace Kehyeedra3 { @@ -10,9 +14,12 @@ namespace Kehyeedra3 { public ApplicationDbContext CreateDbContext(string[] args = null) { + DotEnv.Config(filePath: Path.Combine(AppContext.BaseDirectory, ".env")); + var optionsBuilder = new DbContextOptionsBuilder(); - optionsBuilder.UseMySql(Environment.GetEnvironmentVariable("KEHYEEDRA_CONNSTR")); + optionsBuilder.UseMySql(Environment.GetEnvironmentVariable("KEHYEEDRA_CONNSTR"), + x => { x.EnableRetryOnFailure(); x.CharSet(CharSet.Utf8Mb4); }); return new ApplicationDbContext(optionsBuilder.Options); } diff --git a/Kehyeedra3/Bot.cs b/Kehyeedra3/Bot.cs index e486a23..11e4c01 100644 --- a/Kehyeedra3/Bot.cs +++ b/Kehyeedra3/Bot.cs @@ -12,6 +12,7 @@ using System.Net.Http; using Kehyeedra3.Services; using System.Threading; using Discord.Addons.Interactive; +using dotenv.net; namespace Kehyeedra3 { @@ -54,6 +55,7 @@ namespace Kehyeedra3 public async Task CreateBot() { + DotEnv.Config(filePath: Path.Combine(AppContext.BaseDirectory, ".env")); var Config = Configuration.Load(); Clockboy = new System.Timers.Timer(); @@ -81,7 +83,7 @@ namespace Kehyeedra3 .AddSingleton(_bot) .AddSingleton(_cmds) .AddSingleton(AudioService) - .AddSingleton(new InteractiveService(_bot, TimeSpan.FromSeconds(30))) + .AddSingleton(new InteractiveService(_bot)) .BuildServiceProvider(); await CommandHandler.InstallCommands(); diff --git a/Kehyeedra3/Command handler.cs b/Kehyeedra3/Command handler.cs index 944cbf3..3fe2d97 100644 --- a/Kehyeedra3/Command handler.cs +++ b/Kehyeedra3/Command handler.cs @@ -81,86 +81,88 @@ namespace Kehyeedra3 { if (!arg.Author.IsBot) { - var message = arg as SocketUserMessage; - var Context = new SocketCommandContext(_bot, message); - using (var Database = new ApplicationDbContextFactory().CreateDbContext()) + if(arg is SocketUserMessage message) { - if(!Database.Users.Any(x=>x.Id == arg.Author.Id)) + if (message == null) return; + var Context = new SocketCommandContext(_bot, message); + using (var Database = new ApplicationDbContextFactory().CreateDbContext()) { - Database.Users.Add(new Services.Models.User + if (!Database.Users.Any(x => x.Id == arg.Author.Id)) { - Id = arg.Author.Id, - Avatar = arg.Author.GetAvatarUrl() ?? arg.Author.GetDefaultAvatarUrl(), - Username = arg.Author.Username - }); - await Database.SaveChangesAsync(); - } - else - { - var user = Database.Users.FirstOrDefault(x => x.Id == arg.Author.Id); - user.Username = arg.Author.Username; - user.Avatar = arg.Author.GetAvatarUrl() ?? arg.Author.GetDefaultAvatarUrl(); - await Database.SaveChangesAsync(); + Database.Users.Add(new Services.Models.User + { + Id = arg.Author.Id, + Avatar = arg.Author.GetAvatarUrl() ?? arg.Author.GetDefaultAvatarUrl(), + Username = arg.Author.Username + }); + await Database.SaveChangesAsync(); + } + else + { + var user = Database.Users.FirstOrDefault(x => x.Id == arg.Author.Id); + user.Username = arg.Author.Username; + user.Avatar = arg.Author.GetAvatarUrl() ?? arg.Author.GetDefaultAvatarUrl(); + await Database.SaveChangesAsync(); + } } - } - if (message == null) return; - int argPos = 0; - - if (message.HasMentionPrefix(_bot.CurrentUser, ref argPos)) - { - await KizunaAi(Context, message.Content); - } - if (message.Content.Contains("\uD83C\uDD71")) //B emoji detector - { - await Context.Channel.SendMessageAsync($"B emoji detected. Proceed to kill yourself, {Context.User.Mention}"); - } + int argPos = 0; - if (message.Content.ToLowerInvariant().Contains("jojo")) - { - var jojoke = WeebClient.DownloadString("https://api.skuldbot.uk/fun/jojoke/?raw"); - await Context.Channel.SendMessageAsync($"{Context.User.Mention} is that a fucksnifflerling {jojoke} reference?"); - } - - if (message.Channel is IGuildChannel chan) - { - var perms = chan.GetPermissionOverwrite(_bot.CurrentUser); - if (perms.HasValue) + if (message.HasMentionPrefix(_bot.CurrentUser, ref argPos)) { - if (perms.Value.SendMessages == PermValue.Deny) return; + await KizunaAi(Context, message.Content); + } + if (message.Content.Contains("\uD83C\uDD71")) //B emoji detector + { + await Context.Channel.SendMessageAsync($"B emoji detected. Proceed to kill yourself, {Context.User.Mention}"); } - var botGuild = _bot.GetGuild(chan.GuildId).GetUser(_bot.CurrentUser.Id); - bool exit = false; - botGuild.Roles.OrderByDescending(x => x.Position).ToList().ForEach(x => + if (message.Content.ToLowerInvariant().Contains("jojo")) { - perms = chan.GetPermissionOverwrite(x); + var jojoke = WeebClient.DownloadString("https://api.skuldbot.uk/fun/jojoke/?raw"); + await Context.Channel.SendMessageAsync($"{Context.User.Mention} is that a fucksnifflerling {jojoke} reference?"); + } + if (message.Channel is IGuildChannel chan) + { + var perms = chan.GetPermissionOverwrite(_bot.CurrentUser); if (perms.HasValue) { - if (perms.Value.SendMessages == PermValue.Deny) { exit = true; return; } + if (perms.Value.SendMessages == PermValue.Deny) return; } - }); + var botGuild = _bot.GetGuild(chan.GuildId).GetUser(_bot.CurrentUser.Id); + bool exit = false; - if (exit) return; - } + botGuild.Roles.OrderByDescending(x => x.Position).ToList().ForEach(x => + { + perms = chan.GetPermissionOverwrite(x); - if (!(message.HasStringPrefix(Configuration.Load().Prefix, ref argPos))) return; - { - var result = await _cmds.ExecuteAsync(Context, argPos, _dmap); - if (result.IsSuccess) - { - Console.ForegroundColor = ConsoleColor.Green; - Console.WriteLine("Sent successfully"); - Console.ForegroundColor = ConsoleColor.White; + if (perms.HasValue) + { + if (perms.Value.SendMessages == PermValue.Deny) { exit = true; return; } + } + }); + + if (exit) return; } - else + if (!(message.HasStringPrefix(Configuration.Load().Prefix, ref argPos))) return; { - await Context.Channel.SendMessageAsync($"Command failed with the following error:\n{result.ErrorReason}\nPlease make sure your brain is plugged in and charging."); - Console.ForegroundColor = ConsoleColor.Red; //set text red - Console.WriteLine($"Something went wrong\n{result.ErrorReason}"); - Console.ForegroundColor = ConsoleColor.White; //back to white + var result = await _cmds.ExecuteAsync(Context, argPos, _dmap); + if (result.IsSuccess) + { + Console.ForegroundColor = ConsoleColor.Green; + Console.WriteLine("Sent successfully"); + Console.ForegroundColor = ConsoleColor.White; + } + + else + { + await Context.Channel.SendMessageAsync($"Command failed with the following error:\n{result.ErrorReason}\nPlease make sure your brain is plugged in and charging."); + Console.ForegroundColor = ConsoleColor.Red; //set text red + Console.WriteLine($"Something went wrong\n{result.ErrorReason}"); + Console.ForegroundColor = ConsoleColor.White; //back to white + } } } } diff --git a/Kehyeedra3/Commands.cs b/Kehyeedra3/Commands.cs index cb7d4db..0b9be15 100644 --- a/Kehyeedra3/Commands.cs +++ b/Kehyeedra3/Commands.cs @@ -8,8 +8,6 @@ using System.Net; using System.Linq; using System.Data; using Kehyeedra3.Services; -using MySql.Data; -using MySql.Data.MySqlClient; using Kehyeedra3.Services.Models; using System.Collections.Generic; using Microsoft.EntityFrameworkCore.Internal; diff --git a/Kehyeedra3/Commands/Admin.cs b/Kehyeedra3/Commands/Admin.cs index 04a3376..dddfd09 100644 --- a/Kehyeedra3/Commands/Admin.cs +++ b/Kehyeedra3/Commands/Admin.cs @@ -1,318 +1,536 @@ using Discord; using Discord.Addons.Interactive; using Discord.Commands; +using ImageMagick; using Kehyeedra3.Preconditions; using Kehyeedra3.Services.Models; -using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; -using System.Runtime.CompilerServices; -using System.Text; using System.Threading.Tasks; namespace Kehyeedra3.Commands { - public class Admin : InteractiveBase /////////////////////////////////////////////// - { - [RequireRolePrecondition(AccessLevel.ServerAdmin)] - [Command("adddelet"), Summary("Adds a delet this image to the bot from link or image (admin only)")] - public async Task AddDelet() //Listens for attachments - { - var attachments = Context.Message.Attachments;//Gets attachments as var - foreach (var item in attachments) - { - Uri link = new Uri(item.Url); - using (WebClient _webclient = new WebClient()) - { - string location = Path.Combine(Environment.CurrentDirectory, "delet"); - if (!Directory.Exists(location)) - Directory.CreateDirectory(location); - location += "/" + item.Filename; - _webclient.DownloadFileAsync(link, location); - } - await ReplyAsync($"Delet added"); - break; - } - } - [RequireRolePrecondition(AccessLevel.ServerAdmin)] - [Command("adddelet"), Summary("Adds a delet this image to the bot from link or image (admin only)")] - public async Task AddDelet(string url) //Listens for urls - { - Uri link = new Uri(url); - using (WebClient _webclient = new WebClient()) - { - string location = Path.Combine(Environment.CurrentDirectory, $"delet"); - if (!Directory.Exists(location)) - Directory.CreateDirectory(location); - location += "/" + Guid.NewGuid() + ".jpg"; - _webclient.DownloadFileAsync(link, location); - } - await ReplyAsync($"Delet added"); - } - [RequireRolePrecondition(AccessLevel.ServerAdmin)] - [Command("say"), Summary("Sends given message to given channel (admin only)")] - public async Task Say(ITextChannel channel, [Remainder]string message) - { - await channel.SendMessageAsync(message); - } - [RequireRolePrecondition(AccessLevel.BotOwner)] - [Command("modifybot"), Summary("name")] - public async Task ModifyBot(string _name) - { - //reference current bot user - var BotCurrUser = Bot._bot.CurrentUser; - await BotCurrUser.ModifyAsync(x => - { - //sets name - x.Username = _name; - }); - //reply - await ReplyAsync($"Set name to {_name}"); - } - [RequireRolePrecondition(AccessLevel.BotOwner)] - [Command("vbi", RunMode = RunMode.Async)] - public async Task VerifyBankIntegrity() - { - using var Database = new ApplicationDbContextFactory().CreateDbContext(); + public class Admin : InteractiveBase /////////////////////////////////////////////// + { + [RequireRolePrecondition(AccessLevel.ServerAdmin)] + [Command("adddelet"), Summary("Adds a delet this image to the bot from link or image (admin only)")] + public async Task AddDelet() //Listens for attachments + { + var attachments = Context.Message.Attachments;//Gets attachments as var + foreach (var item in attachments) + { + Uri link = new Uri(item.Url); + using (WebClient _webclient = new WebClient()) + { + string location = Path.Combine(Environment.CurrentDirectory, "delet"); + if (!Directory.Exists(location)) + Directory.CreateDirectory(location); + location += "/" + item.Filename; + _webclient.DownloadFileAsync(link, location); + } + await ReplyAsync($"Delet added"); + break; + } + } + [RequireRolePrecondition(AccessLevel.ServerAdmin)] + [Command("adddelet"), Summary("Adds a delet this image to the bot from link or image (admin only)")] + public async Task AddDelet(string url) //Listens for urls + { + Uri link = new Uri(url); + using (WebClient _webclient = new WebClient()) + { + string location = Path.Combine(Environment.CurrentDirectory, $"delet"); + if (!Directory.Exists(location)) + Directory.CreateDirectory(location); + location += "/" + Guid.NewGuid() + ".jpg"; + _webclient.DownloadFileAsync(link, location); + } + await ReplyAsync($"Delet added"); + } + [RequireRolePrecondition(AccessLevel.ServerAdmin)] + [Command("say"), Summary("Sends given message to given channel (admin only)")] + public async Task Say(ITextChannel channel, [Remainder] string message) + { + await channel.SendMessageAsync(message); + } + [RequireRolePrecondition(AccessLevel.BotOwner)] + [Command("modifybot"), Summary("name")] + public async Task ModifyBot(string _name) + { + //reference current bot user + var BotCurrUser = Bot._bot.CurrentUser; + await BotCurrUser.ModifyAsync(x => + { + //sets name + x.Username = _name; + }); + //reply + await ReplyAsync($"Set name to {_name}"); + } + [RequireRolePrecondition(AccessLevel.BotOwner)] + [Command("vbi", RunMode = RunMode.Async)] + public async Task VerifyBankIntegrity() + { + using var Database = new ApplicationDbContextFactory().CreateDbContext(); - List users = Database.Users.OrderByDescending(user => user.Money).ToList(); - User bank = Database.Users.FirstOrDefault(x => x.Id == 0); + List users = Database.Users.AsQueryable().OrderByDescending(user => user.Money).ToList(); + User bank = Database.Users.FirstOrDefault(x => x.Id == 0); - int existing = 0; - users.ForEach(x => existing += Convert.ToInt32(x.Money)); - int difference = 1000000 - existing; - string content = ""; - if (difference >= 0) - { - content += $"Current stability is: {existing / 10000d}%\n"; - } - else + int existing = 0; + users.ForEach(x => existing += Convert.ToInt32(x.Money)); + int difference = 1000000 - existing; + string content = ""; + if (difference >= 0) + { + content += $"Current stability is: {existing / 10000d}%\n"; + } + else + { + content += $"Current stability is: {(1000000d / existing) * 100}%\n"; + } + if (difference != 0) + { + content += "Do you want to stabilize existing economy?"; + await Context.Channel.SendMessageAsync($"{content}"); + var message = await NextMessageAsync(); + if (message != null && message.Content.ToLowerInvariant() == "yes") + { + bank.Money += difference; + await Database.SaveChangesAsync(); + if (difference > 0) + { + await Context.Channel.SendMessageAsync($"Economy has been stabilized by adding {difference / 10000d}% to bank"); + } + else + { + await Context.Channel.SendMessageAsync($"Economy has been stabilized by removing {0 - difference / 10000d}% from bank"); + } + } + } + else + { + await Context.Channel.SendMessageAsync($"{content}"); + } + } + [RequireRolePrecondition(AccessLevel.BotOwner)] + [Command("modifymoney"), Alias("mm"), Summary("add / set")] + public async Task ModMoney(string type, int amount, IUser target = null) + { + User user; + if (type.ToLowerInvariant() == "add" || type.ToLowerInvariant() == "set") + { + using var Database = new ApplicationDbContextFactory().CreateDbContext(); + string yuser = ""; + if (target == null) + { + user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id); + yuser = $"{Context.User.Username}"; + } + else + { + user = Database.Users.FirstOrDefault(x => x.Id == target.Id); + yuser = $"{target.Username}"; + } + if (type == "add") + { + if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), amount)) + { + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, convince someone to gamble"); + return; + } + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSet **{yuser}**'s money to **{user.Money.ToYeedraDisplay()}%**."); + await Database.SaveChangesAsync(); + return; + } + else if (type == "set") + { + if (amount < 0) + { + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nCan't set to a negative."); + return; + } + else + { + if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), amount - user.Money)) + { + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, convince someone to gamble."); + return; + } + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSet **{yuser}**'s money to **{((long)amount).ToYeedraDisplay()}%**."); + await Database.SaveChangesAsync(); + return; + } + + } + } + else + { + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nInvalid type."); + } + } + + + // test commands + //[Command("cbt", RunMode = RunMode.Async)] + //public async Task CombatTest() + //{ + // string[] attackse = new string[] + // { + // "a bite", + // "a crowbar", + // "invasive odor", + // "an intense slap" + // }; + + // int hp = 100; + // int atk = 100; + // int bhp = 1000; + // int dmg = 0; + // int edg = 0; + // string cbta = ""; + // int numatt = SRandom.Next(attackse.Length); + // string at1; + // string at2; + // string eattack; + // int cb; + // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBattle against **Fishthot**\nChoose your battle fish:\n**Pistol Shrimp | Coomfish**"); + // var message = await NextMessageAsync(); + // if (message.Content.ToLowerInvariant() == "pistol shrimp") + // { + // cbta = "Pistol Shrimp"; + // at1 = "Gun"; + // at2 = "Crowbar"; + // cb = 1; + // hp = 80; + // atk = 20; + // } + // else if (message.Content.ToLowerInvariant() == "coomfish") + // { + // cbta = "Coomfish"; + // at1 = "Eruption"; + // at2 = "Smack"; + // cb = 2; + // hp = 160; + // atk = 10; + // } + // else + // { + // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nInvalid battle fish??? are you RETARDeDED??"); + // return; + // } + // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou have chosen: **{cbta}**, your stats are HP: **{hp}** ATK: **{atk}**\n\nBegin battle?"); + // message = await NextMessageAsync(); + // if (message.Content.ToLowerInvariant() == "yes") + // { + // string ment = $"{Context.User.Mention}\n"; + // while (bhp > 0 && hp > 0) + // { + // if (bhp > 0 && hp > 0) + // { + // edg = SRandom.Next(3, 16); + // dmg = SRandom.Next(atk, atk * 20); + // eattack = attackse[numatt]; + // hp -= edg; + // await Context.Channel.SendMessageAsync($"{ment}**Fishthot** attacks with {eattack}, dealing **{edg}** damage.\n**{cbta}**'s **HP** drops to {hp}."); + // ment = ""; + // if (hp <= 0) + // { + // await Context.Channel.SendMessageAsync($"Oh dear! **{cbta}** has fallen in battle.\nChoose your last ditch effort.\n**Belt** | **Punch**"); + // message = await NextMessageAsync(); + // if (message.Content.ToLowerInvariant() == "belt") + // { + // dmg = SRandom.Next(20, 100); + // bhp -= dmg; + // } + // else if (message.Content.ToLowerInvariant() == "punch") + // { + // dmg = SRandom.Next(40, 80); + // bhp -= dmg; + // } + // await Context.Channel.SendMessageAsync($"Your last ditch effort dealt **{dmg}** damage, reducing **Fishthot**'s health to {bhp}."); + // } + // else + // { + // bhp -= dmg; + // await Context.Channel.SendMessageAsync($"What will you attack with?\n**{at1}** | **{at2}**"); + // message = await NextMessageAsync(); + // if (cb == 1 && message.Content.ToLowerInvariant() == "gun") + // { + // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{cbta}** pulls out his trusty glock and shoots at **Fishthot**, dealing **{dmg}** damage.\n**Fishthot**'s HP has been reduced to **{bhp}**."); + // } + // else if (cb == 1 && message.Content.ToLowerInvariant() == "crowbar") + // { + // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{cbta}** unsheathes a menacing looking crowbar and lands a nice smack on **Fishthot**, dealing **{dmg}** damage.\n**Fishthot**'s HP has been reduced to **{bhp}**."); + // } + // else if (cb == 2 && message.Content.ToLowerInvariant() == "eruption") + // { + // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{cbta}** releases a massive ***CUM ERUPTION*** on **Fishthot**, dealing **{dmg}** damage.\n**Fishthot**'s HP has been reduced to **{bhp}**."); + // } + // else if (cb == 2 && message.Content.ToLowerInvariant() == "smack") + // { + // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{cbta}** feeds **Fishthot** a nice knuckle sandwich with his **Power Arm**, dealing **{dmg}** damage.\n**Fishthot**'s HP has been reduced to **{bhp}**."); + // } + // else + // { + // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{cbta}** did not understand your command.\n**{cbta}** is looking at you with disappointed eyes.\nYour turn is skipped, good job retard."); + // } + // } + + // } + // else + // { + // if (bhp <= 0 && hp > 0) + // { + // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**You win!** Go buy **{cbta}** a beer or something for his great accomplishments."); + // break; + // } + // else if (bhp <= 0 && hp < 0) + // { + // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{cbta}** is gone. But so is **Fishthot**. Make sure to boil him in a good broth, he would have deserved it."); + // break; + // } + // else if (hp <= 0) + // { + // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{cbta}** is gone. Now nothing stands between **Fishthot** and your frail frame."); + // break; + // } + // else + // { + // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSomething went ***REALLY*** wrong"); + // break; + // } + // } + // } + // } + // else + // { + // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nyou afraid or something? loser lmao"); + // return; + // } + //} + [RequireRolePrecondition(AccessLevel.BotOwner)] + [Command("getimag")] + public async Task TestCommand(string name) + { + name += ".png"; + string path = Path.Combine(Environment.CurrentDirectory, "btextures"); + DirectoryInfo idir = new DirectoryInfo(path); + var file = idir.GetFiles().FirstOrDefault(i => i.Name == name); + if (file != null) + { + await Context.Channel.SendFileAsync(file.FullName); + } + else + { + Console.WriteLine("File does not exist, check brain for damaged goods?"); + } + + } + [RequireRolePrecondition(AccessLevel.ServerAdmin)] + [Command("makeimag")] + public async Task MakeImage() + { + string path = Path.Combine(Environment.CurrentDirectory, "btextures"); + + using (MagickImage layer1 = new MagickImage(Path.Combine(path, "tbackground.png"), new MagickReadSettings + { + BackgroundColor = MagickColors.Transparent, + FillColor = MagickColors.White + })) + { + layer1.Compose = CompositeOperator.Over; + + using (MagickImage layer2 = new MagickImage(Path.Combine(path, "tforeground.png"), new MagickReadSettings + { + BackgroundColor = MagickColors.Transparent, + FillColor = MagickColors.Black + })) + { + layer1.Composite(layer2, 245, 158, CompositeOperator.Over); //x, y + } + + using (MagickImage layer3 = new MagickImage($"label:Haha The Machine Go BRrrrrr", new MagickReadSettings //text + { + Width = 250, + Height = 25, + TextGravity = Gravity.Center, + FillColor = MagickColors.Black, + BackgroundColor = MagickColors.None + })) + { + layer1.Composite(layer3, 245, 449, CompositeOperator.Over); + } + + MemoryStream outputStream = new MemoryStream(); + + layer1.Write(outputStream); + + outputStream.Position = 0; + + await Context.Channel.SendFileAsync(outputStream, "imaeg.png"); + } + } + [RequireRolePrecondition(AccessLevel.ServerAdmin)] + [Command("lc")] + public async Task MakeLevelCard() + { + string path = Path.Combine(Environment.CurrentDirectory, "btextures"); + string avatar = ""; + string rod = ""; + string tier = ""; + ulong lvl = 0; + ulong xp = 0; + int total = 0; + int minc = 0; + int maxc = 0; + Fishing fuser; + User user; + Dictionary inv = new Dictionary(); + + using (var Database = new ApplicationDbContextFactory().CreateDbContext()) { - content += $"Current stability is: {(1000000d / existing) * 100}%\n"; + user = Database.Users.FirstOrDefault(i => i.Id == Context.User.Id); + fuser = Database.Fishing.FirstOrDefault(i => i.Id == Context.User.Id); } - if (difference != 0) + if (fuser == null || user == null) { - content += "Do you want to stabilize existing economy?"; - await Context.Channel.SendMessageAsync($"{content}"); - var message = await NextMessageAsync(); - if (message != null && message.Content.ToLowerInvariant() == "yes") - { - bank.Money += difference; - await Database.SaveChangesAsync(); - if (difference > 0) - { - await Context.Channel.SendMessageAsync($"Economy has been stabilized by adding {difference / 10000d}% to bank"); - } - else - { - await Context.Channel.SendMessageAsync($"Economy has been stabilized by removing {0-difference / 10000d}% from bank"); - } - } + rod = "rod1.png"; + tier = "tier1.png"; } else { - await Context.Channel.SendMessageAsync($"{content}"); - } - } - [RequireRolePrecondition(AccessLevel.BotOwner)] - [Command("modifymoney"), Alias("mm"),Summary("add / set")] - public async Task ModMoney(string type, int amount, IUser target = null) - { - User user; - if (type.ToLowerInvariant() == "add" || type.ToLowerInvariant() == "set") - { - using var Database = new ApplicationDbContextFactory().CreateDbContext(); - string yuser = ""; - if (target == null) - { - user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id); - yuser = $"{Context.User.Username}"; - } - else + lvl = fuser.Lvl; + xp = fuser.TXp; + var finv = fuser.GetInventory(); + switch (fuser.RodUsed) + { + case 0: + { + rod = "rod1.png"; + tier = "tier1.png"; + } + break; + case 1: + { + rod = "rod2.png"; + tier = "tier2.png"; + } + break; + case 2: + { + rod = "rod3.png"; + tier = "tier3.png"; + } + break; + case 3: + { + rod = "rod4.png"; + tier = "tier4.png"; + } + break; + } + foreach (var fish in finv) { - user = Database.Users.FirstOrDefault(x => x.Id == target.Id); - yuser = $"{target.Username}"; + total += (fish.Value[0] + fish.Value[1] + fish.Value[2]); } - if (type == "add") - { - if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), amount)) - { - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, convince someone to gamble"); - return; - } - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSet **{yuser}**'s money to **{user.Money.ToYeedraDisplay()}%**."); - await Database.SaveChangesAsync(); - return; - } - else if (type == "set") - { - if (amount < 0) - { - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nCan't set to a negative."); - return; - } - else - { - if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), amount - user.Money)) - { - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, convince someone to gamble."); - return; - } - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSet **{yuser}**'s money to **{((long)amount).ToYeedraDisplay()}%**."); - await Database.SaveChangesAsync(); - return; - } - - } - } - else + } + + avatar = user.Avatar; + + if (avatar == "https://cdn.discordapp.com/embed/avatars/0.png") { - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nInvalid type."); + avatar = Path.Combine(path, "noavatar.png"); } - } + + using (MagickImage card = new MagickImage(Path.Combine(path, "background.png"), new MagickReadSettings //background + { + BackgroundColor = MagickColors.Transparent, + FillColor = MagickColors.Black, + })) + { + card.Compose = CompositeOperator.Over; + + using (MagickImage iavatar = new MagickImage(Path.Combine(avatar), new MagickReadSettings //avatar + { + BackgroundColor = MagickColors.None + })) + { + card.Composite(iavatar, 5, 5, CompositeOperator.Over); + } + + using (MagickImage frame = new MagickImage(Path.Combine(path, "cover.png"), new MagickReadSettings //cover + { + BackgroundColor = MagickColors.None + })) + { + card.Composite(frame, CompositeOperator.Over); + } + + using (MagickImage frame = new MagickImage(Path.Combine(path, tier), new MagickReadSettings //tier glow + { + BackgroundColor = MagickColors.None + })) + { + card.Composite(frame, 5, 5, CompositeOperator.Over); + } + + //using (MagickImage frame = new MagickImage(Path.Combine(path, rod), new MagickReadSettings //rod + //{ + // BackgroundColor = MagickColors.None + //})) + //{ + // card.Composite(frame, 79, 79, CompositeOperator.Over); + //} + + using (MagickImage frame = new MagickImage(Path.Combine(path, "frame.png"), new MagickReadSettings //frame + { + BackgroundColor = MagickColors.None + })) + { + card.Composite(frame, CompositeOperator.Over); + } + + using (MagickImage xpbar = new MagickImage(Path.Combine(path, "xpbar.png"), new MagickReadSettings //xp bar + { + BackgroundColor = MagickColors.None + })) + { + card.Composite(xpbar, 405, 5, CompositeOperator.Over); + } - // test commands - //[Command("cbt", RunMode = RunMode.Async)] - //public async Task CombatTest() - //{ - // string[] attackse = new string[] - // { - // "a bite", - // "a crowbar", - // "invasive odor", - // "an intense slap" - // }; + //using (MagickImage name = new MagickImage($"label:\n{Context.User.Username}", new MagickReadSettings + //{BackgroundColor = MagickColors.None, FillColor = MagickColors.White, FontPointsize = 20 })) + // { + // card.Composite(name, 6, 6, CompositeOperator.Over); + // } + - // int hp = 100; - // int atk = 100; - // int bhp = 1000; - // int dmg = 0; - // int edg = 0; - // string cbta = ""; - // int numatt = SRandom.Next(attackse.Length); - // string at1; - // string at2; - // string eattack; - // int cb; - // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBattle against **Fishthot**\nChoose your battle fish:\n**Pistol Shrimp | Coomfish**"); - // var message = await NextMessageAsync(); - // if (message.Content.ToLowerInvariant() == "pistol shrimp") - // { - // cbta = "Pistol Shrimp"; - // at1 = "Gun"; - // at2 = "Crowbar"; - // cb = 1; - // hp = 80; - // atk = 20; - // } - // else if (message.Content.ToLowerInvariant() == "coomfish") - // { - // cbta = "Coomfish"; - // at1 = "Eruption"; - // at2 = "Smack"; - // cb = 2; - // hp = 160; - // atk = 10; - // } - // else - // { - // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nInvalid battle fish??? are you RETARDeDED??"); - // return; - // } - // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou have chosen: **{cbta}**, your stats are HP: **{hp}** ATK: **{atk}**\n\nBegin battle?"); - // message = await NextMessageAsync(); - // if (message.Content.ToLowerInvariant() == "yes") - // { - // string ment = $"{Context.User.Mention}\n"; - // while (bhp > 0 && hp > 0) - // { - // if (bhp > 0 && hp > 0) - // { - // edg = SRandom.Next(3, 16); - // dmg = SRandom.Next(atk, atk * 20); - // eattack = attackse[numatt]; - // hp -= edg; - // await Context.Channel.SendMessageAsync($"{ment}**Fishthot** attacks with {eattack}, dealing **{edg}** damage.\n**{cbta}**'s **HP** drops to {hp}."); - // ment = ""; - // if (hp <= 0) - // { - // await Context.Channel.SendMessageAsync($"Oh dear! **{cbta}** has fallen in battle.\nChoose your last ditch effort.\n**Belt** | **Punch**"); - // message = await NextMessageAsync(); - // if (message.Content.ToLowerInvariant() == "belt") - // { - // dmg = SRandom.Next(20, 100); - // bhp -= dmg; - // } - // else if (message.Content.ToLowerInvariant() == "punch") - // { - // dmg = SRandom.Next(40, 80); - // bhp -= dmg; - // } - // await Context.Channel.SendMessageAsync($"Your last ditch effort dealt **{dmg}** damage, reducing **Fishthot**'s health to {bhp}."); - // } - // else - // { - // bhp -= dmg; - // await Context.Channel.SendMessageAsync($"What will you attack with?\n**{at1}** | **{at2}**"); - // message = await NextMessageAsync(); - // if (cb == 1 && message.Content.ToLowerInvariant() == "gun") - // { - // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{cbta}** pulls out his trusty glock and shoots at **Fishthot**, dealing **{dmg}** damage.\n**Fishthot**'s HP has been reduced to **{bhp}**."); - // } - // else if (cb == 1 && message.Content.ToLowerInvariant() == "crowbar") - // { - // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{cbta}** unsheathes a menacing looking crowbar and lands a nice smack on **Fishthot**, dealing **{dmg}** damage.\n**Fishthot**'s HP has been reduced to **{bhp}**."); - // } - // else if (cb == 2 && message.Content.ToLowerInvariant() == "eruption") - // { - // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{cbta}** releases a massive ***CUM ERUPTION*** on **Fishthot**, dealing **{dmg}** damage.\n**Fishthot**'s HP has been reduced to **{bhp}**."); - // } - // else if (cb == 2 && message.Content.ToLowerInvariant() == "smack") - // { - // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{cbta}** feeds **Fishthot** a nice knuckle sandwich with his **Power Arm**, dealing **{dmg}** damage.\n**Fishthot**'s HP has been reduced to **{bhp}**."); - // } - // else - // { - // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{cbta}** did not understand your command.\n**{cbta}** is looking at you with disappointed eyes.\nYour turn is skipped, good job retard."); - // } - // } + using (MagickImage stats = new MagickImage($"label:" + + $"\nFishing Lv : {lvl}" + + $"\nXP : {xp}" + + $"\nMax catch : {maxc}" + + $"\nMin catch : {minc}" + + $"\nTotal Fish : {total}", new MagickReadSettings + { + BackgroundColor = MagickColors.None, + FillColor = MagickColors.White, + FontPointsize = 12 + })) + { + card.Composite(stats,146,5, CompositeOperator.Over); + } + MemoryStream outputStream = new MemoryStream(); + card.Write(outputStream); + outputStream.Position = 0; + await Context.Channel.SendFileAsync(outputStream, "profile.png"); + } - // } - // else - // { - // if (bhp <= 0 && hp > 0) - // { - // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**You win!** Go buy **{cbta}** a beer or something for his great accomplishments."); - // break; - // } - // else if (bhp <= 0 && hp < 0) - // { - // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{cbta}** is gone. But so is **Fishthot**. Make sure to boil him in a good broth, he would have deserved it."); - // break; - // } - // else if (hp <= 0) - // { - // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{cbta}** is gone. Now nothing stands between **Fishthot** and your frail frame."); - // break; - // } - // else - // { - // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSomething went ***REALLY*** wrong"); - // break; - // } - // } - // } - // } - // else - // { - // await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nyou afraid or something? loser lmao"); - // return; - // } - //} + - } + } + } } diff --git a/Kehyeedra3/Commands/Economy.cs b/Kehyeedra3/Commands/Economy.cs index fd4afc7..e013118 100644 --- a/Kehyeedra3/Commands/Economy.cs +++ b/Kehyeedra3/Commands/Economy.cs @@ -8,8 +8,10 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using ImageMagick; using System.Threading.Channels; using System.Threading.Tasks; +using Kehyeedra3.Preconditions; namespace Kehyeedra3.Commands { @@ -21,7 +23,6 @@ namespace Kehyeedra3.Commands "**Platinum**,", "**Plastids**,", "a ticking **Time Bomb**,", - "**Neural Sensors**,", "an **Amethyst**,", "**Germanium**,", "a **Hotdog**,", @@ -192,19 +193,24 @@ namespace Kehyeedra3.Commands public async Task FishCommand() { ulong time = ulong.Parse(DateTime.Now.ToString("yyyyMMddHHmm")); - ulong lastfish; ulong totalXp; ulong xp; ulong level; ulong lvlXp; int prestige; int rod; + int BigBait = 0; + int RareBait = 0; + int SpecialBait = 0; + int Lettuce = 0; Dictionary inv = new Dictionary(); + Dictionary items = new Dictionary(); List fishes = Fishing.GetFishList(); using (var Database = new ApplicationDbContextFactory().CreateDbContext()) { var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id); + var guser = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id); if (user == null) { { @@ -219,8 +225,58 @@ namespace Kehyeedra3.Commands { inv = user.GetInventory(); } + + if (user.LastFish >= time) + { + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\narrrrr-right, ye scurby bastard, I know yer eager t' scour the seven seas but ye needs t' wait till the next minute t' pillage the booty'o'the depths, savvy?"); + return; + } + + items = guser.GetGenInve(); // + int[] subtract = { 0 }; + subtract[0] = -1; + if (items.TryGetValue(Items.SpecialBait, out int[] SpecB)) + { + SpecialBait = SpecB[0]; + BigBait = SpecB[0]; + RareBait = SpecB[0]; + if (SpecialBait > 0) + { + SpecB[0] -= 1; + } + else + { + if (items.TryGetValue(Items.BigBait, out int[] BigB)) + { + BigBait = BigB[0]; + if (BigBait > 0) + { + BigB[0] -= 1; + } + } + if (items.TryGetValue(Items.RareBait, out int[] RareB)) + { + RareBait = RareB[0]; + if (RareBait > 0) + { + RareB[0] -= 1; + } + } + } + } + if (items.TryGetValue(Items.Lettuce, out int[] Lettu)) + { + Lettuce = Lettu[0]; + if (Lettuce > 0) + { + Lettu[0] -= 1; + } + } + + guser.SetGenInve(items); + + level = user.Lvl; - lastfish = user.LastFish; totalXp = user.TXp; lvlXp = user.Xp; rod = user.RodUsed; @@ -228,313 +284,374 @@ namespace Kehyeedra3.Commands await Database.SaveChangesAsync(); } + + int rari = SRandom.Next(0, 2001); + int weigh = SRandom.Next(10, 1501+prestige*500); + int tierRoll = SRandom.Next(0, 20*rod+10*prestige+1); + int dCatchRoll = SRandom.Next(0, 1000+prestige*20); + + int dcatch = 1; + int rarity; + int weight; + bool bBig = false; + bool bRar = false; + bool bSpe = false; + bool bLet = false; + + if (dCatchRoll > 1000) + { + int many = 1020; + dcatch += 1; + while (many < dCatchRoll) + { + dcatch += 1; + many += 10+(dcatch*5); + } + } + if (level < 100 && prestige == 0) + { + rarity = (int)level * 10 + rari; + weight = (int)level * 5 + weigh; + } + else if (level < 100 && prestige == 1) + { + rarity = 1000 + rari; + weight = (int)level * 3 + 500 + weigh; + } + else if (level >= 100 && prestige > 1) + { + rarity = 1000 + rari; + weight = 800 + weigh; + } + else + { + rarity = 1000 + rari; + weight = 500 + weigh; + } + if (BigBait > 0) + { + weight += 1000; + bBig = true; + } + if (RareBait > 0) + { + rarity += 500; + bRar = true; + } + if (SpecialBait > 0) + { + bSpe = true; + } + if (Lettuce > 0) + { + bLet = true; + } + Fish fish; - if (lastfish < time) + if (rarity == 777 || (rarity > 2060 && rarity <= 2070) || rarity == 2777 || rarity > 2500 && rarity < 2510 && bRar ||rarity > 2510 && rarity < 2520 && bSpe) { - int rari = (SRandom.Next(0, 2001)); - int weigh = SRandom.Next(10, 1501+prestige*500); - int tierRoll = SRandom.Next(0, 81+prestige*40); - int dCatchRoll = SRandom.Next(0, 1000+prestige*20); - int dcatch = 1; - ulong rarity; - int weight; - - if (dCatchRoll > 1000) + int wRoll = SRandom.Next(0, 101); + if (wRoll == 77 && bSpe) { - int many = 1020; - dcatch += 1; - while (many+20 < dCatchRoll) - { - dcatch += 1; - many += 10+(dcatch*5); - } + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Unreasonable).ToList(); + fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; + xp = 7777; } - - if (level < 100 && prestige == 0) + else if (rod >= 3 && tierRoll > 60) + { + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T4Legendary).ToList(); + fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; + xp = 25; + } + else if (rod >= 2 && tierRoll > 40) { - rarity = level * 10 + (ulong)rari; - weight = (int)level * 5 + weigh; + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T3Legendary).ToList(); + fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; + xp = 20; } - else if (level < 100 && prestige == 1) + else if (rod >= 1 && tierRoll > 20) { - rarity = 1000 + (ulong)rari; - weight = (int)level * 2 + 500 + weigh; + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T2Legendary).ToList(); + fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; + xp = 15; } else { - rarity = 1000 + (ulong)rari; - weight = 700 + weigh; + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Legendary).ToList(); + fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; + xp = 10; } - - Fish fish; - - if (rarity == 777 || (rarity > 2060 && rarity <= 2070) || rarity == 2777) + if (rarity == 777 || rarity == 2777) { - if (rod >= 3 && tierRoll > 60) - { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T4Legendary).ToList(); - fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 25; - } - else if (rod >= 2 && tierRoll > 40) - { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T3Legendary).ToList(); - fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 20; - } - else if (rod >= 1 && tierRoll > 20) - { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T2Legendary).ToList(); - fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 15; - } - else - { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Legendary).ToList(); - fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 10; - } - if (rarity == 777 || rarity == 2777) - { - xp = 77+(77*Convert.ToUInt64(rod/2)); - } + xp = 77+ Convert.ToUInt64(77*rod/2); + } + } + else if (rarity > 1700) + { + rarity = SRandom.Next(1700, 2801); + if (bRar || bSpe) + { + rarity += 200; } - else if (rarity > 1700) + if (rod >= 3 && tierRoll > 60) { - rarity = Convert.ToUInt64(SRandom.Next(1700, 2801)); - if (rod >= 3 && tierRoll > 60) - { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T4Uncommon).ToList(); - fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 20; - } - else if (rod >= 2 && tierRoll > 40) - { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T3Uncommon).ToList(); - fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 16; - } - else if (rod >= 1 && tierRoll > 20) - { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T2Uncommon).ToList(); - fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 13; - } - else - { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Uncommon).ToList(); - fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 10; - } - if (rarity > 2600) - { - if (rod >= 3 && tierRoll > 60) - { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T4Rare).ToList(); - fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 35; - } - else if (rod >= 2 && tierRoll > 40) - { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T3Rare).ToList(); - fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 30; - } - else if (rod >= 1 && tierRoll > 20) - { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T2Rare).ToList(); - fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 25; - } - else - { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Rare).ToList(); - fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 20; - } - } - + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T4Uncommon).ToList(); + fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; + xp = 20; + } + else if (rod >= 2 && tierRoll > 40) + { + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T3Uncommon).ToList(); + fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; + xp = 16; + } + else if (rod >= 1 && tierRoll > 20) + { + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T2Uncommon).ToList(); + fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; + xp = 13; } else + { + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Uncommon).ToList(); + fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; + xp = 10; + } + if (rarity > 2600) { if (rod >= 3 && tierRoll > 60) { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T4Common).ToList(); + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T4Rare).ToList(); fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 10; + xp = 35; } else if (rod >= 2 && tierRoll > 40) { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T3Common).ToList(); + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T3Rare).ToList(); fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 8; + xp = 30; } else if (rod >= 1 && tierRoll > 20) { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T2Common).ToList(); + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T2Rare).ToList(); fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 6; + xp = 25; } else { - List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Common).ToList(); + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Rare).ToList(); fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; - xp = 5; + xp = 20; } } - FishSize size; - - if (fish.Rarity == FishRarity.Legendary || fish.Rarity == FishRarity.T2Legendary || fish.Rarity == FishRarity.T3Legendary || fish.Rarity == FishRarity.T4Legendary ) + } + else + { + if (rod >= 3 && tierRoll > 60) { - weight = 1000; + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T4Common).ToList(); + fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; + xp = 10; } - - if (weight >= (1000 - Convert.ToInt32(level * 2))) + else if (rod >= 2 && tierRoll > 40) { - weight = SRandom.Next(100, 2001) + Convert.ToInt32(level * 5 + (Convert.ToUInt64(prestige * 500))); + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T3Common).ToList(); + fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; + xp = 8; } - if (fish.Rarity == FishRarity.Legendary || fish.Rarity == FishRarity.T2Legendary || fish.Rarity == FishRarity.T3Legendary || fish.Rarity == FishRarity.T4Legendary) + else if (rod >= 1 && tierRoll > 20) { - weight = SRandom.Next(2000 + Convert.ToInt32(level * 20), 40001 + prestige * 10000); + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T2Common).ToList(); + fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; + xp = 6; } - - if (weight >= 1000) + else { - - if (weight >= 1500) - { - size = FishSize.Large; - } - else - { - size = FishSize.Medium; - } - - double w = Convert.ToDouble(weight); - xp = Convert.ToUInt64(Math.Round(xp * w / 1000, 0, MidpointRounding.ToEven))*(ulong)dcatch; + List possibleFishes = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Common).ToList(); + fish = possibleFishes[SRandom.Next(possibleFishes.Count)]; + xp = 5; + } + } - if (fish.Rarity == FishRarity.Legendary || fish.Rarity == FishRarity.T2Legendary || fish.Rarity == FishRarity.T3Legendary || fish.Rarity == FishRarity.T4Legendary) - { - if (xp < 100) - { - xp = 100; - } - } + FishSize size; + + if (weight >= (1000 - Convert.ToInt32(level * 2))) //second weight roll + { + weight = SRandom.Next(100, 2001) + Convert.ToInt32(level * 5 + (Convert.ToUInt64(prestige * 500))); + } + + if (fish.Rarity == FishRarity.Legendary || fish.Rarity == FishRarity.T2Legendary || fish.Rarity == FishRarity.T3Legendary || fish.Rarity == FishRarity.T4Legendary) + { + weight = SRandom.Next(2000 + Convert.ToInt32(level * 20), 40001 + prestige * 10000); + } + if (fish.Rarity == FishRarity.Unreasonable) + { + weight = SRandom.Next(4000, 6000); + } + + if (bBig) + { + weight += 1000; + } + + if (weight >= 1000) + { + + if (weight >= 1500) + { + size = FishSize.Large; } else { - size = FishSize.Small; + size = FishSize.Medium; } + + double w = Convert.ToDouble(weight); + xp = Convert.ToUInt64(Math.Round(xp * w / 1000, 0, MidpointRounding.ToEven))*(ulong)dcatch; - string lvlUp = ""; - - using (var Database = new ApplicationDbContextFactory().CreateDbContext()) + if (fish.Rarity == FishRarity.Legendary || fish.Rarity == FishRarity.T2Legendary || fish.Rarity == FishRarity.T3Legendary || fish.Rarity == FishRarity.T4Legendary) { - var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id); - user.LastFish = time; - await Database.SaveChangesAsync().ConfigureAwait(false); + if (xp < 100) + { + xp = 100; + } } + } + else + { + size = FishSize.Small; + } + + if (bLet) + { + xp = Convert.ToUInt64(Math.Round(xp * 1.1, 0, MidpointRounding.ToEven)) * (ulong)dcatch; + } + + string lvlUp = ""; + + using (var Database = new ApplicationDbContextFactory().CreateDbContext()) + { + var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id); + user.LastFish = time; + await Database.SaveChangesAsync().ConfigureAwait(false); + } - if (rarity > 200) + if (rarity > 200) + { + ulong toNextLvl = 0; + using (var Database = new ApplicationDbContextFactory().CreateDbContext()) { - ulong toNextLvl = 0; - using (var Database = new ApplicationDbContextFactory().CreateDbContext()) - { - var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id); + var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id); - inv = user.GetInventory(); + inv = user.GetInventory(); - int[] amounts; - if (!inv.TryGetValue(fish.Id, out amounts)) - { - amounts = new int[] { 0, 0, 0 }; - inv.Add(fish.Id, amounts); - } + int[] amounts; + if (!inv.TryGetValue(fish.Id, out amounts)) + { + amounts = new int[] { 0, 0, 0 }; + inv.Add(fish.Id, amounts); + } - int sizeIndex = (int)size; - amounts[sizeIndex] += dcatch; + int sizeIndex = (int)size; + amounts[sizeIndex] += dcatch; - user.SetInventory(inv); + user.SetInventory(inv); - user.TXp += xp; + user.TXp += xp; - toNextLvl = user.Xp - user.TXp; - int times = 0; + toNextLvl = user.Xp - user.TXp; + int times = 0; - if (user.TXp >= user.Xp) + if (user.TXp >= user.Xp) + { + ulong leXp = 50; + bool leTrig = false; + for (ulong i = 0; i < user.Lvl; i++) { - ulong leXp = 50; - bool leTrig = false; - for (ulong i = 0; i < user.Lvl; i++) - { - if (i <= user.Lvl) - { - leXp += Convert.ToUInt64(Math.Round((leXp * 0.05d + 50d), 0, MidpointRounding.ToEven)); - } - } - if (leXp != user.Xp) + if (i <= user.Lvl) { - user.Lvl = 0; - user.Xp = 0; - leTrig = true; + leXp += Convert.ToUInt64(Math.Round((leXp * 0.05d + 50d), 0, MidpointRounding.ToEven)); } - while (user.TXp >= user.Xp) + } + if (leXp != user.Xp) + { + user.Lvl = 0; + user.Xp = 0; + leTrig = true; + } + while (user.TXp >= user.Xp) + { + user.Lvl += 1; + times += 1; + lvlXp = 50; + for (ulong i = 0; i < user.Lvl; i++) { - user.Lvl += 1; - times += 1; - lvlXp = 50; - for (ulong i = 0; i < user.Lvl; i++) + if (i <= user.Lvl) { - if (i <= user.Lvl) - { - lvlXp += Convert.ToUInt64(Math.Round((lvlXp * 0.05d + 50d), 0, MidpointRounding.ToEven)); - } + lvlXp += Convert.ToUInt64(Math.Round((lvlXp * 0.05d + 50d), 0, MidpointRounding.ToEven)); } - user.Xp = lvlXp; - } - toNextLvl = user.Xp - user.TXp; - level = user.Lvl; - if (leTrig) - { - lvlUp = $"**Your level was recalculated to match your xp.** You are now **Level {level}**"; - } - else if (times > 1) - { - lvlUp = $"**You leveled up {times} times!** You are now **Level {level}.**"; - } - else - { - lvlUp = $"**You leveled up!** You are now **Level {level}**"; } + user.Xp = lvlXp; + } + toNextLvl = user.Xp - user.TXp; + level = user.Lvl; + if (leTrig) + { + lvlUp = $"**Your level was recalculated to match your xp.** You are now **Level {level}**"; + } + else if (times > 1) + { + lvlUp = $"**You leveled up {times} times!** You are now **Level {level}.**"; } else { - lvlUp = $"You need **{toNextLvl}**xp more to reach Level **{level + 1}**"; + lvlUp = $"**You leveled up!** You are now **Level {level}**"; } - - await Database.SaveChangesAsync().ConfigureAwait(false); // :] } - if (dcatch == 1) + else { - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n {fish.Emote} You have caught a {weight / 100d}kg **{fish.Name}**, rarity: {fish.Rarity}\nYou gain **{xp}**xp.\n{lvlUp}"); + lvlUp = $"You need **{toNextLvl}**xp more to reach Level **{level + 1}**"; } - else + + await Database.SaveChangesAsync().ConfigureAwait(false); + } + string baited = ""; + string baiRa = ""; + string baiBi = ""; + string baiLe = ""; + if (bRar || bBig) + { + baited += "\nYou used bait. "; + if (bRar) { - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n {fish.Emote} You have caught **{dcatch}** {weight / 100d}kg **{fish.Name}**, rarity: {fish.Rarity}\nYou gain **{xp}**xp.\n{lvlUp}"); + baiRa = "(+)"; } - + if (bBig) + { + baiBi = "(+)"; + } + } + if (bLet) + { + baited += "\nYou ate lettuce. "; + baiLe = "(+10%)"; + } + if (dcatch == 1) + { + await Context.Channel.SendMessageAsync($"{Context.User.Mention}{baited}\n{fish.Emote} You have caught a {weight / 100d}kg{baiBi} **{fish.Name}**, rarity: {fish.Rarity}{baiRa}\nYou gain **{xp}**xp{baiLe}.\n{lvlUp}"); } else { - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYour line snaps. Your disappointment is immeasurable, and your day is ruined."); + await Context.Channel.SendMessageAsync($"{Context.User.Mention}{baited}\n{fish.Emote} You have caught **{dcatch}** {weight / 100d}kg{baiBi} **{fish.Name}**, rarity: {fish.Rarity}{baiRa}\nYou gain **{xp}**xp{baiLe}.\n{lvlUp}"); } + } else { - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\narrrrr-right, ye scurby bastard, I know yer eager t' scour the seven seas but ye needs t' wait till the next minute t' pillage the booty'o'the depths, savvy?"); + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYour line snaps. Your disappointment is immeasurable, and your day is ruined."); } } @@ -549,12 +666,38 @@ namespace Kehyeedra3.Commands await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't own any fishing rods. Try **fishing**."); return; } - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou have unlocked fishing rods up to **T{user.RodOwned+1}**\nYou have currently equipped a **T{user.RodUsed+1}** rod"); + string rodtype; + if (user.RodUsed == 0) + { + rodtype = "Basic"; + } + else if (user.RodUsed == 1) + { + rodtype = "Reinforced"; + } + else if (user.RodUsed == 2) + { + rodtype = "Spectral"; + } + else if (user.RodUsed == 3) + { + rodtype = "Cosmic"; + } + else + { + rodtype = "Currently unobtainable"; + } + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou have unlocked fishing rods up to **Tier {user.RodOwned+1}**\nYou have currently equipped a **{rodtype} Fishing Rod** (T{user.RodUsed+1})."); } } [Command("setrod"),Summary("Set your fishing rod to the desired tier (for example: 'setrod 1' to set to default rod.)")] public async Task SetRod(byte tier) { + if (tier < 1) + { + tier = 1; + } + using (var Database = new ApplicationDbContextFactory().CreateDbContext()) { var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id); @@ -563,7 +706,7 @@ namespace Kehyeedra3.Commands await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't own any fishing rods. Try **fishing**."); return; } - if (tier - 1 <= user.RodOwned) + if ((tier - 1) <= user.RodOwned) { user.RodUsed = Convert.ToByte(tier - 1); string rodtype = ""; @@ -587,16 +730,131 @@ namespace Kehyeedra3.Commands { rodtype = "Currently unobtainable"; } - await Context.Channel.SendMessageAsync($"You are now using a **{rodtype} (T{tier})** rod"); + await Context.Channel.SendMessageAsync($"You are now using a **{rodtype} Fishing Rod** (T{tier})."); } else { - await Context.Channel.SendMessageAsync($"You don't have that rod. You own rods up to **T{user.RodOwned+1}**"); + await Context.Channel.SendMessageAsync($"You don't have that rod. You own rods up to **Tier {user.RodOwned+1}**."); } await Database.SaveChangesAsync().ConfigureAwait(false); } } + [Command("craft", RunMode = RunMode.Async), Alias("c"), Summary("Specify 'r' to refine ingredients.")] + public async Task Crafting(string option = null) + { + using (var Database = new ApplicationDbContextFactory().CreateDbContext()) + { + var fuser = Database.Fishing.FirstOrDefault(i => i.Id == Context.User.Id); + var user = Database.Users.FirstOrDefault(i => i.Id == Context.User.Id); + + if (fuser == null || fuser.Lvl < 30) + { + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou can't craft anything yet.\nCome back when you reach **Lvl 30**."); + return; + } + + var finv = fuser.GetInventory(); + var items = user.GetGenInve(); + + if (!items.TryGetValue(Items.UpgradeT2, out int[] T2Up)) + { + T2Up = new int[] { 0 }; + items.Add(Items.UpgradeT2, T2Up); + } + if (!items.TryGetValue(Items.RodFrame, out int[] Rod)) + { + Rod = new int[] { 0 }; + items.Add(Items.RodFrame, Rod); + } + + if (option != null && option.ToLowerInvariant().Contains("r")) //finish this area up retard + { + + var fish = finv.FirstOrDefault(f => f.Key == FishSpecies.LuckyCatfish).Value[(int)FishSize.Large]; + if (fish < 1 || user.Money < 1000) + { + string missing = ""; + if (fish < 1) + { + missing += "a **Lucky Catfish**"; + } + if (fish < 1 && user.Money < 1000) + { + missing += " & "; + } + else + { + missing += " "; + } + if (user.Money < 1000) + { + missing += $"**{(1000 - user.Money).ToYeedraDisplay()}%**"; + } + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou are missing {missing}."); + return; + } + + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nProcess 1 **Lucky Catfish** for **0.1000%**? \n(Owned: {fish})\n"); + var inp = await NextMessageAsync(); + if (inp.Content.ToLowerInvariant().Contains("yes")) + { + if (finv.TryGetValue(FishSpecies.LuckyCatfish, out int[] Fesh)) + { + Fesh[2] -= 1; + T2Up[0] += 1; + } + user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), -1000); + user.SetGenInve(items); + fuser.SetInventory(finv); + await Database.SaveChangesAsync(); + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou have obtained **Lucky Paste**"); + } + } + else + { + if (fuser.RodOwned > 0) + { + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou already have everything currently craftable."); + return; + } + + if (T2Up[0] != 0 && Rod[0] != 0) + { + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nDo you want to craft the **Reinforced Fishing Rod**?\nThis will use 1 **Lucky Paste** and 1 **Incomplete Rod**."); + var inp = await NextMessageAsync(); + if (inp.Content != null && inp.Content.ToLowerInvariant().Contains("yes")) + { + T2Up[0] -= 1; + Rod[0] -= 1; + fuser.RodOwned += 1; + user.SetGenInve(items); + await Database.SaveChangesAsync(); + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou have successfully crafted a **Reinforced Fishing Rod**, **;setrod 2** to use it."); + } + else + { + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nok retard."); + } + } + else + { + string msg = "You are missing parts.\n"; + if (T2Up[0] < 1) + { + msg += "**Lucky Paste**\n"; + } + if (Rod[0] < 1) + { + msg += "**Incomplete Rod**"; + } + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n{msg}"); + } + + } + + } + } [Command("fishinventory"), Alias("finv", "fishinv"), Summary("Shows the fish you have currently. Variables: fish tier")] public async Task FishInventory(int? tier = null, IGuildUser user = null) { @@ -639,6 +897,7 @@ namespace Kehyeedra3.Commands List fishes = Fishing.GetFishList(); + List unrfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Unreasonable).ToList(); List legfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Legendary).ToList(); List rarfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Rare).ToList(); List uncfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Uncommon).ToList(); @@ -680,6 +939,7 @@ namespace Kehyeedra3.Commands return; } + string unreasonable = ""; string legendary = ""; string rare = ""; string uncommon = ""; @@ -714,7 +974,11 @@ namespace Kehyeedra3.Commands } fishtext += $" ]\n"; - if (legfish.Any( f => f.Id == entry.Key)) + if (unrfish.Any(f => f.Id == entry.Key)) + { + unreasonable += $"{fishtext}"; + } + if (legfish.Any(f => f.Id == entry.Key)) { legendary += $"{fishtext}"; } @@ -732,6 +996,10 @@ namespace Kehyeedra3.Commands } } string locker = $""; + if (unreasonable != "") + { + locker += $"{unreasonable}\n"; + } if (legendary != "") { locker += $"{legendary}\n"; @@ -778,12 +1046,16 @@ namespace Kehyeedra3.Commands inv = user.GetGenInve(); foreach (var entry in inv) { - item = items.FirstOrDefault(x => x.Id == entry.Key); - message += $"**{item.Name}**: **{entry.Value[0]}**\n"; + if (entry.Value[0] > 0) + { + item = items.FirstOrDefault(x => x.Id == entry.Key); + message += $"**{item.Name}**: **{entry.Value[0]}**\n"; + } } await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n{message}"); } } + [RequireRolePrecondition(AccessLevel.ServerAdmin)] [Command("tradebuy", RunMode = RunMode.Async), Summary("Unfinished command")] public async Task TradingBuy(int amount, string itemtype, int price, [Remainder] string item) { @@ -826,7 +1098,7 @@ namespace Kehyeedra3.Commands if (Database.StoreFronts.Any(x => x.StoreItemType == StoreItemType.Fish)) { - var stores = Database.StoreFronts.Where(x => x.StoreItemType == StoreItemType.Fish).ToList(); + var stores = Database.StoreFronts.AsQueryable().Where(x => x.StoreItemType == StoreItemType.Fish).ToList(); stores.Shuffle(); @@ -864,6 +1136,7 @@ namespace Kehyeedra3.Commands } } } + [RequireRolePrecondition(AccessLevel.ServerAdmin)] [Command("tradesell"), Summary("Unfinished command")] public async Task TradingSell(int amount, string itemtype, int price, [Remainder] string item) { @@ -910,6 +1183,7 @@ namespace Kehyeedra3.Commands await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nInvalid trade type. Come back when the error command is fixed lmaoy").ConfigureAwait(false); } } + [RequireRolePrecondition(AccessLevel.ServerAdmin)] [Command("tradeoffers"), Summary("Unfinished command")] public async Task ShowOffers(bool localOffers = true) { @@ -918,7 +1192,7 @@ namespace Kehyeedra3.Commands StringBuilder message = new StringBuilder(); if (localOffers) { - var stores = database.StoreFronts.Where(x => x.UserId == Context.User.Id); + var stores = database.StoreFronts.AsQueryable().Where(x => x.UserId == Context.User.Id); foreach(var store in stores) { @@ -1016,7 +1290,7 @@ namespace Kehyeedra3.Commands User skuld; using (var Database = new ApplicationDbContextFactory().CreateDbContext()) { - users = Database.Users.OrderByDescending(user => user.Money).ToList(); + users = Database.Users.AsQueryable().OrderByDescending(user => user.Money).ToList(); bank = Database.Users.FirstOrDefault(x => x.Id == 0); skuld = Database.Users.FirstOrDefault(x => x.Id == 1); } @@ -1039,7 +1313,7 @@ namespace Kehyeedra3.Commands List users; using (var Database = new ApplicationDbContextFactory().CreateDbContext()) { - users = Database.Fishing.OrderByDescending(user => user.TXp).ToList(); + users = Database.Fishing.AsQueryable().OrderByDescending(user => user.TXp).ToList(); string leaderboardMessage = "**Top Ten Smelliest Fishermen**:"; int placing = 0; for (int i = 0; i < 10; i++) @@ -1151,7 +1425,7 @@ namespace Kehyeedra3.Commands } else { - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou were added to database."); + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou were added to the database."); } return; } @@ -1191,10 +1465,15 @@ namespace Kehyeedra3.Commands var muser = database.Users.FirstOrDefault(x => x.Id == Context.User.Id); string pres = ""; double cawe = 0; - if (user.Prestige > 0) + if (user.Prestige == 1) { pres = $" +{user.Prestige}P"; - cawe = 500; + cawe = 500 + user.Lvl * 3d; + } + else if (user.Prestige > 1) + { + pres = $" +{user.Prestige}P"; + cawe = 800; } else { diff --git a/Kehyeedra3/Commands/Help.cs b/Kehyeedra3/Commands/Help.cs index 06ed242..6479627 100644 --- a/Kehyeedra3/Commands/Help.cs +++ b/Kehyeedra3/Commands/Help.cs @@ -131,5 +131,16 @@ namespace Kehyeedra3.Commands } } } + [Command("serverinv"), Summary("Invite to bot server (mainly used for assets)")] + public async Task BotServerInvite() + { + await Context.Channel.SendMessageAsync("discord.gg/DAW53N9"); + } + [Command("botinv"), Summary("Post the bot invite link")] + public async Task BotInvite() + { + await Context.Channel.SendMessageAsync("Main bot: https://discordapp.com/api/oauth2/authorize?client_id=303457448168128519&scope=bot&permissions=0 \n" + + "Test bot: https://discordapp.com/api/oauth2/authorize?client_id=319942676319436810&scope=bot&permissions=0"); + } } } diff --git a/Kehyeedra3/Commands/Interactive.cs b/Kehyeedra3/Commands/Interactive.cs index bf04236..bf02b10 100644 --- a/Kehyeedra3/Commands/Interactive.cs +++ b/Kehyeedra3/Commands/Interactive.cs @@ -11,10 +11,13 @@ using System.Collections.ObjectModel; using System.IO.Enumeration; using System.IO.IsolatedStorage; using System.Linq; +using System.Reflection.Metadata; +using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Channels; using System.Threading.Tasks; +using ImageMagick; namespace Kehyeedra3.Commands { @@ -32,7 +35,7 @@ namespace Kehyeedra3.Commands using (var Database = new ApplicationDbContextFactory().CreateDbContext()) { var user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id); - var userfish = Database.Battlefish.Where(x => x.UserId == Context.User.Id); + var userfish = Database.Battlefish.AsQueryable().Where(x => x.UserId == Context.User.Id); int attb = 0; int defb = 0; @@ -47,12 +50,12 @@ namespace Kehyeedra3.Commands } else { - var fish = userfish.FirstOrDefault(x => x.FishType == user.CurrentBattlefish); - if (fish == null) + var ufish = userfish.FirstOrDefault(x => x.FishType == user.CurrentBattlefish); + if (ufish == null) { - fish = userfish.FirstOrDefault(); + ufish = userfish.FirstOrDefault(); } - switch (fish.FishType) + switch (ufish.FishType) { case Services.Models.BattleFish.Herring: { @@ -104,12 +107,188 @@ namespace Kehyeedra3.Commands string bfishlist = ""; + var fish = userfish.FirstOrDefault(x => x.FishType == user.CurrentBattlefish); + if (fish == null) + { + fish = userfish.FirstOrDefault(); + } + + StringBuilder message = new StringBuilder($"{Context.User.Mention}\n"); + + string species = $""; + string attacks = $""; + + double lvm = 20; + double lvmhp = 100; + + for (int i = 0; i < fish.Lvl; i++) + { + lvm += Math.Round((Convert.ToDouble(lvm) * 0.01d), 0, MidpointRounding.ToEven) + 5; + lvmhp += Math.Round((Convert.ToDouble(lvmhp) * 0.01d), 0, MidpointRounding.ToEven) + 10; + } + int lvlm = Convert.ToInt32(lvm) / 10; + int lvlmhp = Convert.ToInt32(lvmhp) / 10; + + int att = lvlm * attb; + int def = 5 * defb; + int hp = lvlmhp * hpb; + int ap = lvlmhp * apb; + int dg = dgb; + + string prefix = "Hatchling"; + string stats = ""; + + if (fish.Lvl >= 15) + { + prefix = "Young"; + } + if (fish.Lvl >= 30) + { + prefix = "Adolescent"; + } + if (fish.Lvl >= 50) + { + prefix = "Adult"; + } + switch ((int)fish.FishType) + { + case 0: + { + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't have a battlefish."); + } + return; + case 1: + { + species = "Herring"; + if (fish.Lvl >= 100) + { + species += $"ton"; + prefix = $"Authentic Masculine"; + } + + attacks += $"1 : **Slap** - {species} slaps the opponent."; + if (fish.Lvl >= 5) + { + attacks += $"\n2 : **Kick** - {species} kicks the opponent with his muscular fin."; + } + if (fish.Lvl >= 15) + { + attacks += $"\n3 : **Flex** - {species} flexes his fin muscles, stunning the opponent."; + } + if (fish.Lvl >= 30) + { + attacks += $"\n4 : **Restoration Wand** - {species} spins his wand to recover some health."; + } + if (fish.Lvl >= 50) + { + attacks += $"\n5 : **Fairy Nightmare** - {species} executes a devastating ultimate attack."; + } + + } + break; + case 2: + { + species = "Birgus"; + if (fish.Lvl >= 100) + { + species += $""; + prefix = $"Great Sage"; + } + + attacks += $"1 : **Staff Slam** - {species} hits the enemy with its staff."; + if (fish.Lvl >= 5) + { + attacks += $"\n2 : **Chitin Shards** - {species} summons a blast of magical shards at your opponent."; + } + if (fish.Lvl >= 15) + { + attacks += $"\n3 : **Iron Shell** - {species} materializes a hard shell, increasing defense."; + } + if (fish.Lvl >= 30) + { + attacks += $"\n4 : **Siphon Gaze** - {species} absorbs the enemy's life force with an enigmatic gaze."; + } + if (fish.Lvl >= 50) + { + attacks += $"\n5 : **Ecletic Rift** - {species} summons portals to alternate dimensions to call forth an army of raving crabs."; + } + + } + break; + case 3: + { + species = "Abama"; + if (fish.Lvl >= 100) + { + species += $""; + prefix = $"President"; + } + + attacks += $"1 : **Tentacle Slap** - {species} slaps the opponent with its tentacle."; + if (fish.Lvl >= 5) + { + attacks += $"\n2 : **Squirt Ink** - {species} shoots ink at the opponent, blinding them temporarily."; + } + if (fish.Lvl >= 15) + { + attacks += $"\n3 : **Bind** - {species} holds down the opponent with its tentacles."; + } + if (fish.Lvl >= 30) + { + attacks += $"\n4 : **Metabolism** - {species} increases metabolism to instantly remove all ailments."; + } + if (fish.Lvl >= 50) + { + attacks += $"\n5 : **Ancestral Wrath** - {species} calls into the depths to unleash its true potential."; + } + + } + break; + case 4: + { + species = "Pistashrimp"; + if (fish.Lvl >= 100) + { + species += $" XTREME"; + prefix = $"Hardboiled"; + } + + attacks += $"1 : **Pistolwhip** - {species} swings at the enemy with the back of its pistol."; + if (fish.Lvl >= 5) + { + attacks += $"\n2 : **Fire** - {species} shoots a round from its pistol."; + } + if (fish.Lvl >= 15) + { + attacks += $"\n3 : **Fedora Tip** - {species} tips its charming headwear, seducing the enemy."; + } + if (fish.Lvl >= 30) + { + attacks += $"\n4 : **Water Jet** - {species} tosses aside its silly weapon and snaps with its real claw."; + } + if (fish.Lvl >= 50) + { + attacks += $"\n5 : **Dual Jet** - {species} vaporizes the surrounding with its machine gun claws."; + } + + } + break; + } + stats = $"LVL {fish.Lvl} **{prefix} {species}**\nName: **{fish.Name}**\nStats: **ATK : {att} DEF : {def}% HP : {hp} AP : {ap}**\nActions:\n{attacks}\n\n"; + + if (opt == "") + { + message.AppendLine(stats); + await Context.Channel.SendMessageAsync(message.ToString()); + return; + } + if (opt == "change" || opt == "c") { string bfishlistname = ""; foreach (var fesh in userfish) { - string prefix = "Hatchling"; + prefix = "Hatchling"; string suffix = ""; if (fesh.Lvl >= 15) @@ -170,184 +349,11 @@ namespace Kehyeedra3.Commands } - } - - if (option == null) + } + + if (option == "name" && sec != null || option == "n" && sec != null) { - var fish = userfish.FirstOrDefault(x => x.FishType == user.CurrentBattlefish); - if (fish == null) - { - fish = userfish.FirstOrDefault(); - } - - StringBuilder message = new StringBuilder($"{Context.User.Mention}\n"); - - string species = $""; - string attacks = $""; - - double lvm = 20; - double lvmhp = 100; - int lvdf = 5; - - for (int i = 0; i < fish.Lvl; i++) - { - lvm += Math.Round((Convert.ToDouble(lvm) * 0.01d), 0, MidpointRounding.ToEven) + 5; - lvmhp += Math.Round((Convert.ToDouble(lvmhp) * 0.01d), 0, MidpointRounding.ToEven) + 10; - } - int lvlm = Convert.ToInt32(lvm) / 10; - int lvlmhp = Convert.ToInt32(lvmhp) / 10; - - int att = lvlm * attb; - int def = lvdf * defb; - int hp = lvlmhp * hpb; - int ap = lvlmhp * apb; - int dg = lvlm * dgb; - - string prefix = "Hatchling"; - - if (fish.Lvl >= 15) - { - prefix = "Young"; - } - if (fish.Lvl >= 30) - { - prefix = "Adolescent"; - } - if (fish.Lvl >= 50) - { - prefix = "Adult"; - } - switch ((int)fish.FishType) - { - case 0: - { - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't have a battlefish."); - } - return; - case 1: - { - species = "Herring"; - if (fish.Lvl >= 100) - { - species += $"ton"; - prefix = $"Authentic Masculine"; - } - - attacks += $"1 : **Slap** - {species} slaps the opponent."; - if (fish.Lvl >= 5) - { - attacks += $"\n2 : **Kick** - {species} kicks the opponent with his muscular fin."; - } - if (fish.Lvl >= 15) - { - attacks += $"\n3 : **Flex** - {species} flexes his fin muscles, stunning the opponent."; - } - if (fish.Lvl >= 30) - { - attacks += $"\n4 : **Restoration Wand** - {species} spins his wand to recover some health."; - } - if (fish.Lvl >= 50) - { - attacks += $"\n5 : **Fairy Nightmare** - {species} executes a devastating ultimate attack."; - } - - } - break; - case 2: - { - species = "Birgus"; - if (fish.Lvl >= 100) - { - species += $""; - prefix = $"Great Sage"; - } - - attacks += $"1 : **Staff Slam** - {species} hits the enemy with its staff."; - if (fish.Lvl >= 5) - { - attacks += $"\n2 : **Chitin Shards** - {species} summons a blast of magical shards at your opponent."; - } - if (fish.Lvl >= 15) - { - attacks += $"\n3 : **Iron Shell** - {species} materializes a hard shell, increasing defense."; - } - if (fish.Lvl >= 30) - { - attacks += $"\n4 : **Siphon Gaze** - {species} absorbs the enemy's life force with an enigmatic gaze."; - } - if (fish.Lvl >= 50) - { - attacks += $"\n5 : **Ecletic Rift** - {species} summons portals to alternate dimensions to call forth an army of raving crabs."; - } - - } - break; - case 3: - { - species = "Abama"; - if (fish.Lvl >= 100) - { - species += $""; - prefix = $"President"; - } - - attacks += $"1 : **Tentacle Slap** - {species} slaps the opponent with its tentacle."; - if (fish.Lvl >= 5) - { - attacks += $"\n2 : **Squirt Ink** - {species} shoots ink at the opponent, blinding them temporarily."; - } - if (fish.Lvl >= 15) - { - attacks += $"\n3 : **Bind** - {species} holds down the opponent with its tentacles."; - } - if (fish.Lvl >= 30) - { - attacks += $"\n4 : **Metabolism** - {species} increases metabolism to instantly remove all ailments."; - } - if (fish.Lvl >= 50) - { - attacks += $"\n5 : **Ancestral Wrath** - {species} calls into the depths to unleash its true potential."; - } - - } - break; - case 4: - { - species = "Pistashrimp"; - if (fish.Lvl >= 100) - { - species += $" XTREME"; - prefix = $"Hardboiled"; - } - - attacks += $"1 : **Pistolwhip** - {species} swings at the enemy with the back of its pistol."; - if (fish.Lvl >= 5) - { - attacks += $"\n2 : **Fire** - {species} shoots a round from its pistol."; - } - if (fish.Lvl >= 15) - { - attacks += $"\n3 : **Fedora Tip** - {species} tips its charming headwear, seducing the enemy."; - } - if (fish.Lvl >= 30) - { - attacks += $"\n4 : **Water Jet** - {species} tosses aside its silly weapon and snaps with its real claw."; - } - if (fish.Lvl >= 50) - { - attacks += $"\n5 : **Dual Jet** - {species} vaporizes the surrounding with its machine gun claws."; - } - - } - break; - } - message.AppendLine($"LVL {fish.Lvl} **{prefix} {species}**\nName: **{fish.Name}**\nStats: **ATK : {att} DEF : {def}% HP : {hp} AP : {ap}**\nActions:\n{attacks}\n\n"); - await Context.Channel.SendMessageAsync(message.ToString()); - } - else if (option == "name" && sec != null || option == "n" && sec != null) - { - var fish = userfish.FirstOrDefault(x => x.FishType == user.CurrentBattlefish); if (fish == null) { fish = userfish.FirstOrDefault(); @@ -400,7 +406,7 @@ namespace Kehyeedra3.Commands await Context.Channel.SendMessageAsync($"Sorry **{Context.User.Mention}**, I can't give credit.\nCome back when you're a little, ***mmmmm***, richer.\n*You're missing {(500 - user.Money)/10000d}%.*"); return; } - string species = ""; + switch ((int)rep) { case 1: @@ -502,6 +508,36 @@ namespace Kehyeedra3.Commands await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't own that."); } } + else if (option == "combat" || option == "cb") + { + int eatt = 10; + int edf = 0; + int edg = 5; + int a1 = 0; + int d1 = 0; + int d2 = 0; + bool eturn = false; + if (sec == "enemy") + { + eturn = true; + } + if (eturn) + { + a1 = eatt; + d1 = def; + d2 = dg; + } + else + { + a1 = att; + d1 = edf; + d2 = edg; + } + + int dmg = CalculateDamage(a1, d1, d2); + await Context.Channel.SendMessageAsync($"Damage is **{dmg}**"); + //await Context.Channel.SendMessageAsync($"*Combat test yeah baby*\nYour stats:\n**ATK : {att} DEF : {def}% HP : {hp} AP : {ap}**\nActions:\n{attacks}\n"); + } else { await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nAre you confused? Try **bf help** if you are having trouble with your bf."); @@ -510,6 +546,26 @@ namespace Kehyeedra3.Commands } } + public static int CalculateDamage(int a1, int d1, int d2) + { + + int roll = SRandom.Next(5, 11); + int rolldg = SRandom.Next(0, 11); + if (roll == 10) + { + a1 *= 2; + } + if (rolldg * d2 >= 50) + { + return 0; + } + else + { + return ((a1 * roll) / 10 - (a1 * d1 / 100)); + } + + } + [Command("gstore", RunMode = RunMode.Async),Alias("gs")] public async Task GeneralStore(string input = null) { @@ -551,7 +607,10 @@ namespace Kehyeedra3.Commands foreach (User.Item i in itemlist) { - itemtxt += $"{(int)i.Id} : {i.Name} for {((long)i.Price).ToYeedraDisplay()}%\n"; + if ((int)i.Id < 200) + { + itemtxt += $"{(int)i.Id} : {i.Name} for {((long)i.Price).ToYeedraDisplay()}%\n"; + } } if (input != null) @@ -565,11 +624,11 @@ namespace Kehyeedra3.Commands } else if (input == "b" || input == "buy") { - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the item.\n{itemtxt}"); + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nWhich item?\n{itemtxt}"); var inp = await NextMessageAsync(); item = itemlist.FirstOrDefault(i => (int)i.Id == int.Parse(inp.Content)); - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the amount."); + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nHow many?"); inp = await NextMessageAsync(); items = user.GetGenInve(); @@ -585,19 +644,22 @@ namespace Kehyeedra3.Commands if (int.Parse(inp.Content) * item.Price <= user.Money) { amount[0] += int.Parse(inp.Content); + int count = int.Parse(inp.Content); + + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThis will cost you {count * item.Price}.\nType 'ok' to confirm."); - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThis will cost you {ulong.Parse(inp.Content) * (ulong)item.Price}.\nType 'ok' to confirm."); inp = await NextMessageAsync(); if (inp.Content.ToLowerInvariant() == "ok") { - if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), -(amount[0] * item.Price))) + if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), -(count * item.Price))) { await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, convince someone to gamble."); return; } user.SetGenInve(items); + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBought {count} of {item.Name}."); await Database.SaveChangesAsync(); - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBought {int.Parse(inp.Content)} of {item.Name}."); + } else { @@ -724,15 +786,34 @@ namespace Kehyeedra3.Commands return; } - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the item.\n\n{locker}"); - inp = await NextMessageAsync(); - fish = fishes.FirstOrDefault(i => (int)i.Id == int.Parse(inp.Content)); - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the size. 0 = small, 1 = medium, 2 = large\n"); - inp = await NextMessageAsync(); - size = (FishSize)int.Parse(inp.Content); - await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the amount.\n"); - inp = await NextMessageAsync(); - int amount = int.Parse(inp.Content); + await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the item, size, and amount. (ID size amount)\n\n{locker}"); + inp = await NextMessageAsync(timeout: TimeSpan.FromMinutes(2)); + + var inpsep = inp.Content.Split(" "); + int siz = 0; + switch (inpsep[1].ToString().ToLowerInvariant()) + { + case "s": + { + siz = 0; + } + break; + case "m": + { + siz = 1; + } + break; + case "l": + { + siz = 2; + } + break; + } + + fish = fishes.FirstOrDefault(i => (int)i.Id == int.Parse(inpsep[0])); + size = (FishSize)siz; + int amount = int.Parse(inpsep[2]); + int amountcheck = fishinv.FirstOrDefault(f => f.Key == fish.Id).Value[(int)size]; if (amountcheck < amount) { diff --git a/Kehyeedra3/Commands/Stuff.cs b/Kehyeedra3/Commands/Stuff.cs index 2b0ced2..4f5c57b 100644 --- a/Kehyeedra3/Commands/Stuff.cs +++ b/Kehyeedra3/Commands/Stuff.cs @@ -11,6 +11,7 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using ImageMagick; namespace Kehyeedra3.Commands { @@ -322,5 +323,6 @@ namespace Kehyeedra3.Commands } } } + } } diff --git a/Kehyeedra3/Extensions.cs b/Kehyeedra3/Extensions.cs index 03615ba..7dafcdd 100644 --- a/Kehyeedra3/Extensions.cs +++ b/Kehyeedra3/Extensions.cs @@ -1,6 +1,9 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; using System.Security.Cryptography; +using System.IO; +using System.Linq; namespace Kehyeedra3 { @@ -19,7 +22,8 @@ namespace Kehyeedra3 double numb = (double)number/10000; return numb.ToString("N4"); } - + + //https://stackoverflow.com/a/1262619 public static void Shuffle(this IList list) diff --git a/Kehyeedra3/Kehyeedra3.csproj b/Kehyeedra3/Kehyeedra3.csproj index f3625ea..b9899bb 100644 --- a/Kehyeedra3/Kehyeedra3.csproj +++ b/Kehyeedra3/Kehyeedra3.csproj @@ -8,14 +8,15 @@ - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Kehyeedra3/Services/Models/BattleFishCharacters.cs b/Kehyeedra3/Services/Models/BattleFishCharacters.cs new file mode 100644 index 0000000..4958f2f --- /dev/null +++ b/Kehyeedra3/Services/Models/BattleFishCharacters.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Kehyeedra3.Services.Models +{ + public class BattleFishCharacters + { + public enum Character + { + Null = 0, + HoboShrimp = 1, + PocketSalmon = 2, + Holder2 = 3, + Holder3 = 4 + } + + public class BFCharacter + { + public Character Id; + public string Name; + public string Emote; + public string Intro; + + public int Attack; + public int Defense; + + public int BaseHealth; + public int BaseActionPoints; + + public int DodgeRate; + } + public static List GetBFCharList() + { + return new List + { + new BFCharacter() + { + Id = Character.Null, + Name = "Secret Squirrel", + Emote = "<:skirel:762643322254393364>", + Intro = "He looks defeated.", + + Attack = 5, + Defense = 0, + + BaseHealth = 25, + BaseActionPoints = 0, + + DodgeRate = 0 + }, + new BFCharacter() + { + Id = Character.HoboShrimp, + Name = "Hobo Shrimp", + Emote = "<:missingLeg:682586847830081551>", + Intro = "He's been a little down on his luck lately.", + + Attack = 5, + Defense = 5, + + BaseHealth = 5, + BaseActionPoints = 5, + + DodgeRate = 5 + }, + new BFCharacter() + { + Id = Character.PocketSalmon, + Name = "Pocket Salmon", + Emote = "<:missingLeg:682586847830081551>", + Intro = "I pray your pockets don't have holes.", + + Attack = 5, + Defense = 5, + + BaseHealth = 5, + BaseActionPoints = 5, + + DodgeRate = 5 + } + }; + } + } +} diff --git a/Kehyeedra3/Services/Models/Fishing.cs b/Kehyeedra3/Services/Models/Fishing.cs index 348f0ad..283d36f 100644 --- a/Kehyeedra3/Services/Models/Fishing.cs +++ b/Kehyeedra3/Services/Models/Fishing.cs @@ -15,7 +15,7 @@ namespace Kehyeedra3.Services.Models Common, Uncommon, Rare, Legendary, T2Rare, T2Legendary, T2Uncommon, T2Common, T3Rare, T3Legendary, T3Uncommon, T3Common, - T4Rare, T4Legendary, T4Uncommon, T4Common + T4Rare, T4Legendary, T4Uncommon, T4Common, Unreasonable } public class Fish { @@ -58,6 +58,13 @@ namespace Kehyeedra3.Services.Models { return new List { + new Fish() + { + Id = FishSpecies.Wakasagihime, + Name = "Touhoufish", + Emote = "<:wakasagihime:793084118949691433><:emptyslot:709350723199959101>", + Rarity = FishRarity.Unreasonable + }, new Fish() { Id = FishSpecies.LuckyCatfish, @@ -194,9 +201,9 @@ namespace Kehyeedra3.Services.Models new Fish() //// Tier 2 { - Id = FishSpecies.T2Circusfish, - Name = "Circusfish", - Emote = "<:missingLeg:682586847830081551>", + Id = FishSpecies.T2Leg, + Name = "Hypnofish", + Emote = "<:paska:786244602440450109><:hypnoosi:786244623478947841>", Rarity = FishRarity.T2Legendary }, new Fish() @@ -210,7 +217,7 @@ namespace Kehyeedra3.Services.Models { Id = FishSpecies.T2Gunfish, Name = "Gunfish", - Emote = "<:missingLeg:682586847830081551>", + Emote = "<:gunfishleft:793492588799590460><:gunfishright:793492625277714442>", Rarity = FishRarity.T2Uncommon }, new Fish() @@ -285,6 +292,8 @@ namespace Kehyeedra3.Services.Models public enum FishSpecies { + //unreasonable + Wakasagihime = 0, //legendary LuckyCatfish = 1, //rare @@ -309,7 +318,7 @@ namespace Kehyeedra3.Services.Models Carp = 18, Megacrab = 19, //T2 Legendary - T2Circusfish = 20, + T2Leg = 20, //T2 Rare T2Swolefish = 21, //T2 Uncommon diff --git a/Kehyeedra3/Services/Models/User.cs b/Kehyeedra3/Services/Models/User.cs index ee210e1..6888315 100644 --- a/Kehyeedra3/Services/Models/User.cs +++ b/Kehyeedra3/Services/Models/User.cs @@ -22,7 +22,7 @@ namespace Kehyeedra3.Services.Models public bool GrantMoney(User bank, long amount) { - if(bank.Money > amount) + if(bank.Money >= amount) { Money += amount; bank.Money -= amount; @@ -55,15 +55,60 @@ namespace Kehyeedra3.Services.Models new Item() { Id = Items.DirtyBoot, - Name = "Lan's Love", + Name = "Love", Price = 100 }, new Item() { Id = Items.Lettuce, - Name = "Lettuce", + Name = "Learning Lettuce", Price = 50 - } + }, + new Item() + { + Id = Items.RareBait, + Name = "Rare Bait", + Price = 50 + }, + new Item() + { + Id = Items.BigBait, + Name = "Big Bait", + Price = 20 + }, + new Item() + { + Id = Items.SpecialBait, + Name = "Master Bait", + Price = 100 + }, + new Item() + { + Id = Items.RodFrame, + Name = "Incomplete Rod", + Price = 500 + }, + + + + new Item() + { + Id = Items.UpgradeT2, + Name = "Lucky Paste", + Price = 1000 + }, + new Item() + { + Id = Items.UpgradeT3, + Name = "T2 Scraps", + Price = 2000 + }, + new Item() + { + Id = Items.UpgradeT4, + Name = "T3 Cream", + Price = 4000 + }, }; } public class Item @@ -98,7 +143,16 @@ namespace Kehyeedra3.Services.Models public enum Items { DirtyBoot = 0, - Lettuce = 1 + Lettuce = 1, + RareBait = 2, + BigBait = 3, + SpecialBait = 4, + RodFrame = 5, + + + UpgradeT2 = 200, + UpgradeT3 = 201, + UpgradeT4 = 202, } public class ItemSlot { diff --git a/Kehyeedra3/Services/ReminderService.cs b/Kehyeedra3/Services/ReminderService.cs index cd1a7b8..97c3d85 100644 --- a/Kehyeedra3/Services/ReminderService.cs +++ b/Kehyeedra3/Services/ReminderService.cs @@ -58,7 +58,7 @@ namespace Kehyeedra3.Services } catch { await (await Bot._bot.GetUser(242040333309837327).GetOrCreateDMChannelAsync()).SendMessageAsync($"Time of error ^\n" + $"A fucky wucky has occurred, uwu\nFix wemindew sewwis dimwiwt" + - $"\nThis was the reminder: {reminder.Id} {reminder.UserId} {reminder.Send.FromYeedraStamp()}"); } + $"\nThis was the reminder: {reminder.Id} \nto: {reminder.UserId} \ntime: {reminder.Send.FromYeedraStamp()}"); } } public async Task Tick()