From 9ccc007b3fc3184b43f0991026111d70935bdd26 Mon Sep 17 00:00:00 2001 From: Lan <50151341+Lannnnnnnnn@users.noreply.github.com> Date: Tue, 14 Apr 2020 21:04:37 +0300 Subject: [PATCH] minor improvements made it possible to get multiple fishing levels at once, fixed up reminder command, commented test commands --- Kehyeedra3/Commands/Admin.cs | 211 ++++++++++++++++++++++---- Kehyeedra3/Commands/Economy.cs | 30 +++- Kehyeedra3/Commands/Stuff.cs | 65 +++++--- Kehyeedra3/Services/Models/Fishing.cs | 4 +- 4 files changed, 245 insertions(+), 65 deletions(-) diff --git a/Kehyeedra3/Commands/Admin.cs b/Kehyeedra3/Commands/Admin.cs index 31f1afc..b01f0cc 100644 --- a/Kehyeedra3/Commands/Admin.cs +++ b/Kehyeedra3/Commands/Admin.cs @@ -115,40 +115,185 @@ namespace Kehyeedra3.Commands await Context.Channel.SendMessageAsync($"{content}"); } } - /* - [RequireRolePrecondition(AccessLevel.BotOwner)] - [Command("getstamp")] - public async Task YeedraStamp() - { - ulong stamp = DateTime.UtcNow.ToYeedraStamp(); - await ReplyAsync($"{Context.User.Mention} {stamp}"); - } - [RequireRolePrecondition(AccessLevel.BotOwner)] - [Command("savefile")] + // test commands + //[RequireRolePrecondition(AccessLevel.BotOwner)] + //[Command("cbt", RunMode = RunMode.Async)] + //public async Task CombatTest() + //{ + // string[] attackse = new string[] + // { + // "a bite", + // "a crowbar", + // "invasive odor", + // "an intense slap" + // }; - public async Task SaveFile(string fday, string fscore) - { - string location = Path.Combine(Environment.CurrentDirectory, "drawtasks"); - string tlocation = ($"{location}/days.txt"); - var attachments = Context.Message.Attachments; - string fname = $"{fday}-{fscore}"; - if (File.Exists(location + "/days.txt")) - { + // 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 = "Firearm"; + // 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() == "firearm") + // { + // 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("getstamp")] + //public async Task YeedraStamp() + //{ + // ulong stamp = DateTime.UtcNow.ToYeedraStamp(); + // await ReplyAsync($"{Context.User.Mention} {stamp}"); + //} + //[RequireRolePrecondition(AccessLevel.BotOwner)] + //[Command("savefile")] + + //public async Task SaveFile(string fday, string fscore) + //{ + // string location = Path.Combine(Environment.CurrentDirectory, "drawtasks"); + // string tlocation = ($"{location}/days.txt"); + // var attachments = Context.Message.Attachments; + // string fname = $"{fday}-{fscore}"; + // if (File.Exists(location + "/days.txt")) + // { - } - foreach (var item in attachments) - { - Uri link = new Uri(item.Url); - using (WebClient _webclient = new WebClient()) - { - if (!Directory.Exists(location)) - Directory.CreateDirectory(location); - location += ($"/{fday}-{fscore}.jpg"); - _webclient.DownloadFileAsync(link, location); - } - await ReplyAsync($"Post archived"); - break; - } - }*/ + // } + // foreach (var item in attachments) + // { + // Uri link = new Uri(item.Url); + // using (WebClient _webclient = new WebClient()) + // { + // if (!Directory.Exists(location)) + // Directory.CreateDirectory(location); + // location += ($"/{fday}-{fscore}.jpg"); + // _webclient.DownloadFileAsync(link, location); + // } + // await ReplyAsync($"Post archived"); + // break; + // } + //} + + } } diff --git a/Kehyeedra3/Commands/Economy.cs b/Kehyeedra3/Commands/Economy.cs index 93228ec..cd02555 100644 --- a/Kehyeedra3/Commands/Economy.cs +++ b/Kehyeedra3/Commands/Economy.cs @@ -443,21 +443,33 @@ namespace Kehyeedra3.Commands user.TXp += xp; toNextLvl = user.Xp - user.TXp; + int times = 0; if (user.TXp >= user.Xp) { - user.Lvl += 1; - lvlXp = 50; - for (ulong i = 0; i < user.Lvl; i++) + while (user.TXp >= user.Xp) { - if (i <= user.Lvl) + user.Lvl += 1; + times += 1; + lvlXp = 50; + for (ulong i = 0; i < user.Lvl; i++) { - lvlXp += Convert.ToUInt64(Math.Round((lvlXp * 0.05d + 50d), 0, MidpointRounding.ToEven)); + if (i <= user.Lvl) + { + lvlXp += Convert.ToUInt64(Math.Round((lvlXp * 0.05d + 50d), 0, MidpointRounding.ToEven)); + } } + user.Xp = lvlXp; } - user.Xp = lvlXp; toNextLvl = user.Xp - user.TXp; level = user.Lvl; - lvlUp = $"**You leveled up!** You are now **Level {level}**"; + if (times > 1) + { + lvlUp = $"**You leveled up {times} times!** You are now **Level {level}.**"; + } + else + { + lvlUp = $"**You leveled up!** You are now **Level {level}**"; + } } else { @@ -511,6 +523,10 @@ namespace Kehyeedra3.Commands { rodtype = "Spectral"; } + else if (tier == 4) + { + rodtype = "Cosmic"; + } else { rodtype = "Currently unobtainable"; diff --git a/Kehyeedra3/Commands/Stuff.cs b/Kehyeedra3/Commands/Stuff.cs index 34d8cc7..0eb4d1a 100644 --- a/Kehyeedra3/Commands/Stuff.cs +++ b/Kehyeedra3/Commands/Stuff.cs @@ -108,41 +108,60 @@ namespace Kehyeedra3.Commands DateTime dt = DateTime.UtcNow; string time = dt.ToString("dd/MM/yyyy HH:mm"); - + string remin = ""; + ulong sen = (d * 86400) + (h * 3600) + (m * 60); ulong yeedraStamp = DateTime.UtcNow.ToYeedraStamp(); - var reminder = new Reminder + while (m > 60) { - UserId = Context.User.Id, - Message = ($"At **UTC {time}** you wanted me to remind you:\n**'{r}'**"), - Created = yeedraStamp, - Send = ((d * 86400) + (h * 3600) + (m * 60)) + yeedraStamp - }; + h += 1; + m -= 60; + } + while (h > 24) + { + d += 1; + h -= 24; + } - using (var Database = new ApplicationDbContextFactory().CreateDbContext()) + if (sen < 63072000) { - Database.Reminders.Add(reminder); + var reminder = new Reminder + { + UserId = Context.User.Id, + Message = ($"At **UTC {time}** you wanted me to remind you:\n**'{r}'**"), + Created = yeedraStamp, + Send = sen + yeedraStamp + }; - await Database.SaveChangesAsync().ConfigureAwait(false); + using (var Database = new ApplicationDbContextFactory().CreateDbContext()) + { + Database.Reminders.Add(reminder); + + await Database.SaveChangesAsync().ConfigureAwait(false); + } } - await Context.Channel.SendMessageAsync($"{Context.User.Mention} Ok, I'll remind you in {d}d {h}h {m}m"); - } - [Command("grant"), Summary("Bambi Sit janksie")] - public async Task Daycare(IGuildUser ouser) - { - var user = Context.Guild.GetUser(Context.User.Id); - var drole = Context.Guild.GetRole(682109241363922965); - if (user.Roles.Any(x => x.Id == 682109241363922965)) + else { - await user.RemoveRoleAsync(drole); - await ouser.AddRoleAsync(drole); - await Context.Channel.SendMessageAsync($"*{ouser.Mention} the power of daycare rests in the palm of your hands*"); + await Context.Channel.SendMessageAsync($"{Context.User.Mention} Are you sure you need a reminder 2 years in the future..? \nAre you stupid?"); + return; } - else + + + if (d > 0) + { + remin += $"{d} days "; + } + if (h > 0) + { + remin += $"{h} hours "; + } + if (m > 0) { - await Context.Channel.SendMessageAsync($"HNNNNG you do not possess this power HNNNGGGG"); + remin += $"{m} minutes "; } + await Context.Channel.SendMessageAsync($"{Context.User.Mention} Ok, I'll remind you in {remin}"); } + [Command("dab"), Summary("Dabs a person")] public async Task Dab(IGuildUser user = null) { diff --git a/Kehyeedra3/Services/Models/Fishing.cs b/Kehyeedra3/Services/Models/Fishing.cs index 109a01b..aaea4e4 100644 --- a/Kehyeedra3/Services/Models/Fishing.cs +++ b/Kehyeedra3/Services/Models/Fishing.cs @@ -236,7 +236,7 @@ namespace Kehyeedra3.Services.Models }, new Fish() { - Id = FishSpecies.T3Unc, + Id = FishSpecies.T3Flameworm, Name = "Spectral Flameworm", Emote = "<:missingLeg:682586847830081551>", Rarity = FishRarity.T3Uncommon @@ -320,7 +320,7 @@ namespace Kehyeedra3.Services.Models //T3 Rare T3Crab = 25, //T3 Uncommon - T3Unc = 26, + T3Flameworm = 26, //T3 Common T3Com = 27, //T4 Legendary