A bunch of stuff

Battlefish stuff, economy stuff, fixes, additions, everything else that I didn't remember to mention
master
Lan 4 years ago
parent 9d760420c7
commit db91305859
  1. 40
      Kehyeedra3/Command handler.cs
  2. 407
      Kehyeedra3/Commands/Admin.cs
  3. 243
      Kehyeedra3/Commands/Economy.cs
  4. 485
      Kehyeedra3/Commands/Interactive.cs
  5. 46
      Kehyeedra3/Commands/Stuff.cs
  6. 227
      Kehyeedra3/Migrations/20200428191620_Bootlefish.Designer.cs
  7. 23
      Kehyeedra3/Migrations/20200428191620_Bootlefish.cs
  8. 236
      Kehyeedra3/Migrations/20200502180209_Beatlefish.Designer.cs
  9. 46
      Kehyeedra3/Migrations/20200502180209_Beatlefish.cs
  10. 41
      Kehyeedra3/Migrations/ApplicationDbContextModelSnapshot.cs
  11. 8
      Kehyeedra3/Services/Models/Fishing.cs
  12. 3
      Kehyeedra3/Services/Models/Store.cs
  13. 62
      Kehyeedra3/Services/Models/User.cs

@ -81,6 +81,8 @@ namespace Kehyeedra3
{
if (!arg.Author.IsBot)
{
var message = arg as SocketUserMessage;
var Context = new SocketCommandContext(_bot, message);
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
if(!Database.Users.Any(x=>x.Id == arg.Author.Id))
@ -93,42 +95,31 @@ namespace Kehyeedra3
});
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();
}
}
var message = arg as SocketUserMessage;
if (message == null) return;
int argPos = 0;
var context = new SocketCommandContext(_bot, message);
if (message.HasMentionPrefix(_bot.CurrentUser, ref argPos))
{
await KizunaAi(context, message.Content);
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}");
await Context.Channel.SendMessageAsync($"B emoji detected. Proceed to kill yourself, {Context.User.Mention}");
}
var jrole = context.Guild.GetRole(375289794999091201);
var euser = context.Guild.GetUser(context.User.Id);
//var jas = await context.Guild.GetUserAsync(236952555265982464).ConfigureAwait(false);
//var cat = await context.Guild.GetUserAsync(194439970797256706).ConfigureAwait(false);
//if (euser.RoleIds.Any(id => id == 682109241363922965))
//{
// if (message.Content.ToLowerInvariant().Contains("thot begone"))
// {
// await jas.AddRoleAsync(jrole);
// await cat.AddRoleAsync(jrole);
// }
// if (message.Content.ToLowerInvariant().Contains("thot return"))
// {
// await jas.RemoveRoleAsync(jrole);
// await cat.RemoveRoleAsync(jrole);
// }
//}
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?");
await Context.Channel.SendMessageAsync($"{Context.User.Mention} is that a fucksnifflerling {jojoke} reference?");
}
if (message.Channel is IGuildChannel chan)
@ -156,8 +147,7 @@ namespace Kehyeedra3
if (!(message.HasStringPrefix(Configuration.Load().Prefix, ref argPos))) return;
{
var result = await _cmds.ExecuteAsync(context, argPos, _dmap);
var result = await _cmds.ExecuteAsync(Context, argPos, _dmap);
if (result.IsSuccess)
{
Console.ForegroundColor = ConsoleColor.Green;
@ -167,7 +157,7 @@ namespace Kehyeedra3
else
{
await context.Channel.SendMessageAsync($"Command failed with the following error:\n{result.ErrorReason}\nPlease make sure your brain is plugged in and charging.");
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

@ -3,11 +3,13 @@ using Discord.Addons.Interactive;
using Discord.Commands;
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;
@ -115,185 +117,260 @@ namespace Kehyeedra3.Commands
await Context.Channel.SendMessageAsync($"{content}");
}
}
// 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"
// };
[RequireRolePrecondition(AccessLevel.BotOwner)]
[Command("modifymoney"), Alias("mm")]
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 / 10000d}%**.");
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 **{amount / 10000d}%**.");
await Database.SaveChangesAsync();
return;
}
}
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nInvalid type.");
}
}
// 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
//[Command("hello")]
//public async Task Hello(int a, int b)
//{
// int x = a - b;
// string message = "";
// if (x < 0)
// {
// await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nInvalid battle fish??? are you RETARDeDED??");
// return;
// message += "The result is negative!";
// }
// 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")
// else if (x > 0)
// {
// 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;
// }
// }
// }
// message += "The result is positive!";
// }
// else
// {
// await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nyou afraid or something? loser lmao");
// return;
// message += "The result is 0!";
// }
// await Context.Channel.SendMessageAsync($"The result is {x}\n{message}");
//}
// 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("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;
// }
//}
}
//[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;
// }
//}
}
}

@ -178,7 +178,8 @@ namespace Kehyeedra3.Commands
if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), end))
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention} Bank has no money, convince someone to gamble");
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, convince someone to gamble.");
return;
}
await Database.SaveChangesAsync();
@ -444,8 +445,24 @@ namespace Kehyeedra3.Commands
toNextLvl = user.Xp - user.TXp;
int times = 0;
if (user.TXp >= user.Xp)
{
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)
{
user.Lvl = 0;
user.Xp = 0;
leTrig = true;
}
while (user.TXp >= user.Xp)
{
user.Lvl += 1;
@ -462,7 +479,11 @@ namespace Kehyeedra3.Commands
}
toNextLvl = user.Xp - user.TXp;
level = user.Lvl;
if (times > 1)
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}.**";
}
@ -498,7 +519,12 @@ namespace Kehyeedra3.Commands
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
await Context.Channel.SendMessageAsync($"You have unlocked fishing rods up to **T{user.RodOwned+1}**\nYou have currently equipped a **T{user.RodUsed+1}** rod");
if (user == null)
{
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");
}
}
[Command("setrod"),Summary("Set your fishing rod to the desired tier (for example: 'setrod 1' to set to default rod)")]
@ -507,6 +533,11 @@ namespace Kehyeedra3.Commands
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
if (user == null)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't own any fishing rods. Try **fishing**.");
return;
}
if (tier - 1 <= user.RodOwned)
{
user.RodUsed = Convert.ToByte(tier - 1);
@ -568,7 +599,6 @@ namespace Kehyeedra3.Commands
await Database.SaveChangesAsync().ConfigureAwait(false);
}
if (inv.Any())
{
Dictionary<FishSpecies, int> small = new Dictionary<FishSpecies, int>();
@ -899,79 +929,52 @@ namespace Kehyeedra3.Commands
[Command("bet"), Summary("Gamble %coins in units of 0.0001%")]
public async Task Gamble(int wager)
{
Random ran = new Random(SRandom.Next(0, 100000000) + int.Parse(Context.User.AvatarId + Context.User.Discriminator));
int res1 = ran.Next(0, 11);
if (res1 >= 5)
{
res1 = ran.Next(50, 101);
}
else
{
res1 = ran.Next(0, 50);
}
if (wager < 0)
{
wager = 0;
}
int res1 = SRandom.Next(0, 101);
int res2 = SRandom.Next(0, 101);
int loss = wager;
if (res1 == 100)
{
wager = wager * 4;
}
else if (res1 >= 95)
{
wager = wager * 3;
}
else if (res1 == 77)
{
wager = wager * 7;
}
else if (res1 < 50)
if (res1 > res2)
{
wager = 0;
wager += wager;
}
else
else if (res1 < res2)
{
wager = wager * 2;
loss += wager;
}
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id);
var buser = Database.Users.FirstOrDefault(x => x.Id == 0);
if (user.Money < loss)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention} You can't afford that, go back to the mines.");
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n You can't afford that, go back to the mines.");
}
else
{
if (buser.Money > 100)
{
if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), (wager) - loss))
if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), wager - loss))
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention} Bank has no money, gamble more and lose please.");
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, gamble more and lose please.");
return;
}
await Database.SaveChangesAsync();
EmbedBuilder embed = new EmbedBuilder();
if (res1 == 77)
{
embed.AddField($"**Rolled: Lucky cat!**", $"Result: +{((wager) - loss) / 10000d}%\nBalance: {(user.Money) / 10000d}%");
await ReplyAsync($"{Context.User.Mention}", false, embed.Build());
}
else if (((wager) - loss) > 0)
string result = "";
if ((wager - loss) > 0)
{
embed.AddField($"**Rolled: {res1}**", $"Result: +{((wager) - loss) / 10000d}%\nBalance: {(user.Money) / 10000d}%");
await ReplyAsync($"{Context.User.Mention}", false, embed.Build());
result = $"Rolled: **{res1}** against **{res2}**\nResult: +{(wager - loss) / 10000d}%\nBalance: {user.Money / 10000d}%";
await ReplyAsync($"{Context.User.Mention}\n{result}");
}
if (((wager) - loss) < 0)
if ((wager - loss) < 0)
{
embed.AddField($"**Rolled: {res1}**", $"Result: {((wager) - loss) / 10000d}%\nBalance: {(user.Money) / 10000d}%");
await ReplyAsync($"{Context.User.Mention}", false, embed.Build());
result = $"Rolled: **{res1}** against **{res2}**\nResult: {(wager - loss) / 10000d}%\nBalance: {user.Money / 10000d}%";
await ReplyAsync($"{Context.User.Mention}\n{result}");
}
}
else
{
await ReplyAsync($"Hey, stop that.");
await ReplyAsync($"{Context.User.Mention}\nHey, stop that.");
}
}
}
@ -1076,22 +1079,154 @@ namespace Kehyeedra3.Commands
[Command("stats"),Summary("View a user's stats")]
public async Task StatProfile(IUser otherUser = null)
{
Dictionary<FishSpecies, int[]> inv = new Dictionary<FishSpecies, int[]>();
Dictionary<FishSpecies, int> small = new Dictionary<FishSpecies, int>();
Dictionary<FishSpecies, int> med = new Dictionary<FishSpecies, int>();
Dictionary<FishSpecies, int> large = new Dictionary<FishSpecies, int>();
Fishing feeshUser;
int scount = 0;
int mcount = 0;
int lcount = 0;
using (var database = new ApplicationDbContextFactory().CreateDbContext())
{
if (otherUser == null)
{
feeshUser = database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
}
else
{
feeshUser = database.Fishing.FirstOrDefault(x => x.Id == otherUser.Id);
}
if (feeshUser == null)
{
if (otherUser != null)
{
feeshUser = new Fishing
{
Id = otherUser.Id
};
}
else
{
feeshUser = new Fishing
{
Id = Context.User.Id
};
}
database.Fishing.Add(feeshUser);
await database.SaveChangesAsync();
if (otherUser != null)
{
await Context.Channel.SendMessageAsync($"**{otherUser.Username}** Was added to the database.");
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou were added to database.");
}
return;
}
else
{
inv = feeshUser.GetInventory();
}
foreach (var entry in inv)
{
if (entry.Value.Count() > 0)
{
if (entry.Value[0] > 0)
{
scount += entry.Value[0];
}
}
if (entry.Value.Count() > 1)
{
if (entry.Value[1] > 0)
{
mcount += entry.Value[1];
}
}
if (entry.Value.Count() > 2)
{
if (entry.Value[2] > 0)
{
lcount += entry.Value[2];
}
}
}
if (otherUser == null)
{
var user = database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
var muser = database.Users.FirstOrDefault(x => x.Id == Context.User.Id);
await Context.Channel.SendMessageAsync($"{Context.User.Mention}'s stats\nFishing level: **{user.Lvl}**\nFishing xp: **{user.TXp}**\nBalance: **{muser.Money/10000d}%**");
await Context.Channel.SendMessageAsync($"{Context.User.Mention}'s stats\nFishing level: **{user.Lvl}**\nMax catch weight: **{(user.Lvl * 5 + 2000d) / 100}kg**\nFishing xp: **{user.TXp}**\nTotal fish: **{scount + mcount + lcount}** *(Large: {lcount} Medium: {mcount} Small: {scount})*\nBalance: **{muser.Money / 10000d}%**");
}
else
{
var user = database.Fishing.FirstOrDefault(x => x.Id == otherUser.Id);
var muser = database.Users.FirstOrDefault(x => x.Id == otherUser.Id);
await Context.Channel.SendMessageAsync($"{otherUser.Mention}'s stats\nFishing level: **{user.Lvl}**\nFishing xp: **{user.TXp}**\nBalance: **{muser.Money/10000d}%**");
await Context.Channel.SendMessageAsync($"{otherUser.Mention}'s stats\nFishing level: **{user.Lvl}**\nMax catch weight: **{(user.Lvl * 5 + 2000d) / 100}kg**\nFishing xp: **{user.TXp}**\nTotal fish: **{scount + mcount + lcount}** *(Large: {lcount} Medium: {mcount} Small: {scount}*)\nBalance: **{muser.Money / 10000d}%**");
}
}
}
[Command("xptolevel"),Alias("tolv")]
public async Task XpToNextLevl(ulong lvl)
{
ulong lvlXp = 50;
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
if (user == null)
{
await Context.Channel.SendMessageAsync($"Sorry, **{Context.User.Username}**, my dad was too lazy to ");
return;
}
if (lvl > 1 && lvl <= 200)
{
for (ulong i = 1; i < lvl; i++)
{
if (i <= lvl)
{
lvlXp += Convert.ToUInt64(Math.Round((lvlXp * 0.05d + 50d), 0, MidpointRounding.ToEven));
}
};
}
else if (lvl == 1)
{
lvlXp = 50;
}
else if (lvl < 1)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThat's not really possible?");
return;
}
else if (lvl > 200)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**Lvl 200** is the maximum lvl");
return;
}
else
{
await Context.Channel.SendMessageAsync($"<@242040333309837327>\nA fucky wucky has occurred with {Context.User.Mention}'s command");
return;
}
if (user.Lvl >= lvl)
{
await Context.Channel.SendMessageAsync($"XP required for **Lvl {lvl} : {lvlXp}**" +
$"\nXP since you reached **Lvl {lvl} : {user.TXp - lvlXp}**");
}
else
{
await Context.Channel.SendMessageAsync($"XP required for **Lvl {lvl} : {lvlXp}**" +
$"\nXP left until **Lvl {lvl} : {lvlXp - user.TXp}**");
}
}
}
}
}

@ -0,0 +1,485 @@
using Discord;
using Discord.Addons.Interactive;
using Discord.Commands;
using Kehyeedra3.Preconditions;
using Kehyeedra3.Services.Models;
using Microsoft.EntityFrameworkCore.Storage;
using System;
using System.Collections.Generic;
using System.IO.IsolatedStorage;
using System.Linq;
using System.Text;
using System.Threading.Channels;
using System.Threading.Tasks;
namespace Kehyeedra3.Commands
{
public class Interactive : InteractiveBase<SocketCommandContext>
{
readonly string[] attacks = new string[]
{
"",
""
};
[RequireRolePrecondition(AccessLevel.BotOwner)]
[Command("battlefish", RunMode = RunMode.Async),Alias("bf"),Summary("Type **bf help** or **bf h** for help with this command.")]
public async Task BattleFish(string option = null, [Remainder]string sec = null)
{
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id);
if (user.BattleFish.Any() == false)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't have a battlefish.");
}
var fish = user.BattleFish.FirstOrDefault();
string species = $"";
string attacks = $"";
int att = 0;
int def = 0;
int dg = 0;
int hp = 0;
int ap = 0;
double lvm = 20;
double lvmhp = 100;
if (option == null)
{
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;
string prefix = "Hatchling";
if (fish.Lvl >= 15)
{
prefix = "Young";
}
if (fish.Lvl >= 30)
{
prefix = "Adolescent";
}
if (fish.Lvl >= 50)
{
prefix = "Adult";
}
switch (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.";
}
att = 9 * lvlm;
def = 9 * lvlm;
hp = 9 * lvlmhp;
ap = 3 * lvlmhp;
dg = 2 * lvlm;
}
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.";
}
att = 10 * lvlm;
def = 6 * lvlm;
hp = 5 * lvlmhp;
ap = 9 * lvlmhp;
dg = 4 * lvlm;
}
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.";
}
att = 4 * lvlm;
def = 3 * lvlm;
hp = 5 * lvlmhp;
ap = 18 * lvlmhp;
dg = 8 * lvlm;
}
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.";
}
att = 15 * lvlm;
def = 4 * lvlm;
hp = 5 * lvlmhp;
ap = 6 * lvlmhp;
dg = 6 * lvlm;
}
break;
}
await Context.Channel.SendMessageAsync($"{Context.User.Mention}'s LVL {fish.Lvl} **{prefix} {species}**\nName: **{fish.Name}**\nStats: **ATK : {att} DEF : {def} HP : {hp} AP : {ap}**\nActions:\n{attacks}");
}
else if (option == "name" && sec != null|| option == "n" && sec != null)
{
if (sec.Length > 16)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThe maximum name length is 16 characters. \nStop jassing.");
return;
}
else if (fish.FishType != 0)
{
fish.Name = sec;
await Database.SaveChangesAsync();
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou have changed the name of your battlefish to **{sec}**.");
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou can't manage a fish if you don't have one.");
}
}
else if (option == "buy" || option == "b")
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nHere is a list of available battlefish. Please choose one by its respective number. All battlefish cost 0.05%." +
$"\n1 : **Herring** - An unarmed melee fighter with well balanced stats. It is not very agile.\nModifiers: **ATK 9, DEF 9, HP 9, AP 2**" +
$"\n2 : **Birgus** - A crustacean mage with a focus on AP and DMG. It is slightly agile.\nModifiers: **ATK 10, DEF 6, HP 5, AP 9**" +
$"\n3 : **Abama** - A cephalopod rogue with a heavy focus on debuffs. It is very agile.\nModifiers: **ATK 4, DEF 3, HP 5, AP 18**" +
$"\n4 : **Pistashrimp** - A crustacean ranger with a heavy focus on DPS. It is somewhat agile.\nModifiers: **ATK 15, DEF 4, HP 5, AP 6**");
var reply = await NextMessageAsync();
byte rep = byte.Parse(reply.Content);
if (rep > 4 || rep < 1)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nWhat you're looking for does not exist.");
return;
}
else if (user.Money < 500)
{
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;
}
switch (rep)
{
case 1:
{
species = "a Herring";
}
break;
case 2:
{
species = "a Birgus";
}
break;
case 3:
{
species = "an Abama";
}
break;
case 4:
{
species = "a Pistashrimp";
}
break;
}
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou want **{species}**? It's yours my friend, as long as you have enough **%**.\n *This cannot be reverted. Type 'confirm' to confirm.*");
reply = await NextMessageAsync();
if (reply.Content.ToLowerInvariant() == "confirm")
{
if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), -500))
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, convince someone to gamble.");
return;
}
//create fish here pls let there fish be
fish.FishType = rep;
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThank you for your purchase.");
await Database.SaveChangesAsync();
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYour purchase is cancelled.");
}
}
else if (option == "info" || option == "i")
{
string info = "";
if (sec.ToLowerInvariant() == "herring")
{
info = "Equipment type: Enhancing clothing.\nBonus info: Only males of this species exist. I don't know how they reproduce, and I might not want to know.";
}
else if (sec.ToLowerInvariant() == "birgus")
{
info = "Equipment type: Staves.\nBonus info: Exceptional Birguses may live for centuries, their powers increasing with age. While breeding, they part with much of their potential power, so few of them actually do so.";
}
else if (sec.ToLowerInvariant() == "abama")
{
info = "Equipment type: Enhancing clothing.\nBonus info: The tentacles are not just for show. Being highly agile and stealthy, Abamas are experts at grabbing things unnoticed.";
}
else if (sec.ToLowerInvariant() == "pistashrimp")
{
info = "Equipment type: Firearms.\nBonus info: Despite making up only 13% of the underwater wildlife, Pistashrimps account for 100% of the unarmed firearm robberies. Few of them are righteous, but the ones that are make for great detectives.";
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nNot a valid fish.");
return;
}
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n{info}");
}
else if (option == "help" || option == "h")
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}" +
$"\n**name or n** to name your fish." +
$"\n**buy or b** to buy a fish." +
$"\n**info or i** along with **name of bf** to get further info on a battlefish." +
$"\n**help or h** to view this." +
$"\n**change or c** to change battlefish to any owned fish." +
$"\nSpecify **no option** to view your battlefish stats.");
}
else if (option == "change" || option == "c")
{
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nAre you confused? Try **bf help** if you are having trouble with your bf.");
}
}
}
[RequireRolePrecondition(AccessLevel.BotOwner)]
[Command("gstore", RunMode = RunMode.Async),Alias("gs")]
public async Task GeneralStore(string input = null)
{
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var fuser = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
var user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id);
var inv = fuser.GetInventory();
if (input != null)
{
input = input.ToLowerInvariant();
}
if (input == null)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nHere's a list of available items.");
}
else if (input == "b" || input == "buy")
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the item.");
var inp = await NextMessageAsync();
switch (Convert.ToInt32(inp))
{
case 1:
{
}
break;
case 2:
{
}
break;
case 3:
{
}
break;
case 4:
{
}
break;
case 5:
{
}
break;
}
}
else if (input == "s" || input == "sell")
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the item.");
var inp = await NextMessageAsync();
}
}
}
[RequireRolePrecondition(AccessLevel.BotOwner)]
[Command("setbf")]
public async Task SetBattleFish(byte type, IUser usar = null)
{
string species = "";
switch (type)
{
case 0:
{
species = "None";
}
break;
case 1:
{
species = "Herring";
}
break;
case 2:
{
species = "Birgus";
}
break;
case 3:
{
species = "Abama";
}
break;
case 4:
{
species = "Pistashrimp";
}
break;
}
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
if (usar == null)
{
var user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id).BattleFish.FirstOrDefault();
user.FishType = type;
await Context.Channel.SendMessageAsync($"Changed **{Context.User.Username}**'s bf type to {species}.");
}
else
{
var user = Database.Users.FirstOrDefault(x => x.Id == usar.Id).BattleFish.FirstOrDefault();
user.FishType = type;
await Context.Channel.SendMessageAsync($"Changed **{usar.Username}**'s bf type to {species}.");
}
await Database.SaveChangesAsync();
}
}
[RequireRolePrecondition(AccessLevel.BotOwner)]
[Command("setbflv")]
public async Task SetBattleFishLevel(int lv, IUser usar = null)
{
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
if (usar == null)
{
var user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id).BattleFish.FirstOrDefault();
user.Lvl = lv;
await Context.Channel.SendMessageAsync($"Changed **{Context.User.Username}**'s bf lvl to {lv}.");
}
else
{
var user = Database.Users.FirstOrDefault(x => x.Id == usar.Id).BattleFish.FirstOrDefault();
user.Lvl = lv;
await Context.Channel.SendMessageAsync($"Changed **{usar.Username}**'s bf lvl to {lv}.");
}
await Database.SaveChangesAsync();
}
}
}
}

@ -16,24 +16,20 @@ namespace Kehyeedra3.Commands
{
[Command("delet"), Summary("Posts a delet this image. Can be used on other channels.")]
public async Task DeletThis()
public async Task DeletThis(ITextChannel channel = null)
{
string imgdirpath = Path.Combine(Environment.CurrentDirectory, "Delet");
DirectoryInfo imgdir = new DirectoryInfo(imgdirpath);
var files = imgdir.GetFiles();
var item = files[Bot._rnd.Next(0, files.Length)];
await Context.Channel.SendFileAsync(item.FullName);
}
[Command("delet"), Summary("Posts a delet this image. Can be used on other channels.")]
public async Task DeletThis(ITextChannel channel)
{
string imgdirpath = Path.Combine(Environment.CurrentDirectory, "Delet");
DirectoryInfo imgdir = new DirectoryInfo(imgdirpath);
var files = imgdir.GetFiles();
var item = files[Bot._rnd.Next(0, files.Length)];
await channel.SendFileAsync(item.FullName);
if (channel == null)
{
await Context.Channel.SendFileAsync(item.FullName);
}
else
{
await channel.SendFileAsync(item.FullName);
}
}
[Command("ratetrap"), Summary("Rates your or another person's trap potential as a percentage")]
@ -47,11 +43,11 @@ namespace Kehyeedra3.Commands
if (trapRating0 == 100)
{
int trapRating1 = rando1.Next(0, 1001);
await Context.Channel.SendMessageAsync($"I'd say right now you're {trapRating1}% passable");
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nI'd say right now you're {trapRating1}% passable");
}
else
{
await Context.Channel.SendMessageAsync($"I'd say right now you're {trapRating0}% passable");
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nI'd say right now you're {trapRating0}% passable");
}
}
else
@ -62,11 +58,11 @@ namespace Kehyeedra3.Commands
if (trapRating0 == 100)
{
int trapRating1 = rando1.Next(0, 1001);
await Context.Channel.SendMessageAsync($"I'd say right now {name} is {trapRating1}% passable");
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nI'd say right now {name} is {trapRating1}% passable");
}
else
{
await Context.Channel.SendMessageAsync($"I'd say right now {name} is {trapRating0}% passable");
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nI'd say right now {name} is {trapRating0}% passable");
}
}
@ -75,7 +71,7 @@ namespace Kehyeedra3.Commands
[Command("ratertrap"), Summary("ratertrap")]
public async Task RaterTrap()
{
await Context.Channel.SendMessageAsync("Please do not be like this man http://tinyurl.com/y7lj6nob");
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nPlease do not be like this man http://tinyurl.com/y7lj6nob");
}
[Command("8b"), Summary("Gives a prediction like a generic 8ball command that every self respecting discord bot must have")]
public async Task VapeBall([Remainder] string input)
@ -91,7 +87,7 @@ namespace Kehyeedra3.Commands
};
int randomIndex = rando.Next(predictions.Length);
string text = predictions[randomIndex];
await ReplyAsync(text + " " + Context.User.Mention);
await ReplyAsync($"{Context.User.Mention}\n{text}");
}
[Command("math"), Summary("It's a calculator, that's what compooter do")]
public async Task Mathboi([Remainder] string input)
@ -104,7 +100,7 @@ namespace Kehyeedra3.Commands
{
int dinput = int.Parse(input.Substring(input.IndexOf("d")).Replace("d", ""));
int output = SRandom.Next(dinput);
await Context.Channel.SendMessageAsync("" + output + 1);
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n{output+1}");
}
[Command("remind"), Summary("Reminds you in a given time. (days, hours, minutes) Eg. 'remind 1 2 3 wash hands' would remind you in 1 day, 2 hours, 3 minutes to wash your hands")]
public async Task Reminder(ulong d, ulong h, ulong m, [Remainder] string r)
@ -146,24 +142,24 @@ namespace Kehyeedra3.Commands
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention} Are you sure you need a reminder 2 years in the future..? \nAre you stupid?");
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n Are you sure you need a reminder 2 years in the future..? \nAre you stupid?");
return;
}
if (d > 0)
{
remin += $"{d} days ";
remin += $" {d} days";
}
if (h > 0)
{
remin += $"{h} hours ";
remin += $" {h} hours";
}
if (m > 0)
{
remin += $"{m} minutes ";
remin += $" {m} minutes";
}
await Context.Channel.SendMessageAsync($"{Context.User.Mention} Ok, I'll remind you in {remin}");
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n Ok, I'll remind you in{remin}.");
}
[Command("dab"), Summary("Dabs a person")]

@ -0,0 +1,227 @@
// <auto-generated />
using System;
using Kehyeedra3;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Kehyeedra3.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20200428191620_Bootlefish")]
partial class Bootlefish
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.2")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Kehyeedra3.Services.Models.BattleFish", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<byte>("Equipment")
.HasColumnType("tinyint unsigned");
b.Property<byte>("FishType")
.HasColumnType("tinyint unsigned");
b.Property<int>("Lvl")
.HasColumnType("int");
b.Property<string>("Name")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<ulong>("NextXp")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Xp")
.HasColumnType("bigint unsigned");
b.HasKey("Id");
b.ToTable("BattleFish");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.Fishing", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<string>("Inventory")
.HasColumnType("LONGTEXT");
b.Property<ulong>("LastFish")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Lvl")
.HasColumnType("bigint unsigned");
b.Property<byte>("RodOwned")
.HasColumnType("tinyint unsigned");
b.Property<byte>("RodUsed")
.HasColumnType("tinyint unsigned");
b.Property<ulong>("TXp")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Xp")
.HasColumnType("bigint unsigned");
b.HasKey("Id");
b.ToTable("Fishing");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.ItemOffer", b =>
{
b.Property<ulong>("OfferId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<int>("Amount")
.HasColumnType("int");
b.Property<ulong>("BuyerId")
.HasColumnType("bigint unsigned");
b.Property<bool>("IsPurchaseFromStore")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsSellOffer")
.HasColumnType("tinyint(1)");
b.Property<ulong>("ItemId")
.HasColumnType("bigint unsigned");
b.Property<int>("OfferAmount")
.HasColumnType("int");
b.Property<ulong?>("StoreFrontId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("StoreId")
.HasColumnType("bigint unsigned");
b.HasKey("OfferId");
b.HasIndex("StoreFrontId");
b.ToTable("ItemOffer");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.Reminder", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<ulong>("Created")
.HasColumnType("bigint unsigned");
b.Property<string>("Message")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<ulong>("Send")
.HasColumnType("bigint unsigned");
b.Property<ulong>("UserId")
.HasColumnType("bigint unsigned");
b.HasKey("Id");
b.ToTable("Reminders");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.StoreFront", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<int>("StoreItemType")
.HasColumnType("int");
b.Property<ulong>("UserId")
.HasColumnType("bigint unsigned");
b.HasKey("Id");
b.ToTable("StoreFronts");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.StoreInventory", b =>
{
b.Property<ulong>("InvId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<int>("Amount")
.HasColumnType("int");
b.Property<string>("Item")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<int>("Price")
.HasColumnType("int");
b.Property<ulong?>("StoreFrontId")
.HasColumnType("bigint unsigned");
b.HasKey("InvId");
b.HasIndex("StoreFrontId");
b.ToTable("StoreInventory");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.User", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<string>("Avatar")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<string>("GeneralInventory")
.HasColumnType("LONGTEXT");
b.Property<ulong>("LastMine")
.HasColumnType("bigint unsigned");
b.Property<long>("Money")
.HasColumnType("bigint");
b.Property<string>("Username")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.ItemOffer", b =>
{
b.HasOne("Kehyeedra3.Services.Models.StoreFront", null)
.WithMany("Offers")
.HasForeignKey("StoreFrontId");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.StoreInventory", b =>
{
b.HasOne("Kehyeedra3.Services.Models.StoreFront", null)
.WithMany("Items")
.HasForeignKey("StoreFrontId");
});
#pragma warning restore 612, 618
}
}
}

@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Kehyeedra3.Migrations
{
public partial class Bootlefish : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "GeneralInventory",
table: "Users",
type: "LONGTEXT",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "GeneralInventory",
table: "Users");
}
}
}

@ -0,0 +1,236 @@
// <auto-generated />
using System;
using Kehyeedra3;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Kehyeedra3.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20200502180209_Beatlefish")]
partial class Beatlefish
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.2")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Kehyeedra3.Services.Models.Fishing", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<string>("Inventory")
.HasColumnType("LONGTEXT");
b.Property<ulong>("LastFish")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Lvl")
.HasColumnType("bigint unsigned");
b.Property<byte>("RodOwned")
.HasColumnType("tinyint unsigned");
b.Property<byte>("RodUsed")
.HasColumnType("tinyint unsigned");
b.Property<ulong>("TXp")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Xp")
.HasColumnType("bigint unsigned");
b.HasKey("Id");
b.ToTable("Fishing");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.ItemOffer", b =>
{
b.Property<ulong>("OfferId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<int>("Amount")
.HasColumnType("int");
b.Property<ulong>("BuyerId")
.HasColumnType("bigint unsigned");
b.Property<bool>("IsPurchaseFromStore")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsSellOffer")
.HasColumnType("tinyint(1)");
b.Property<ulong>("ItemId")
.HasColumnType("bigint unsigned");
b.Property<int>("OfferAmount")
.HasColumnType("int");
b.Property<ulong?>("StoreFrontId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("StoreId")
.HasColumnType("bigint unsigned");
b.HasKey("OfferId");
b.HasIndex("StoreFrontId");
b.ToTable("ItemOffer");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.Reminder", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<ulong>("Created")
.HasColumnType("bigint unsigned");
b.Property<string>("Message")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<ulong>("Send")
.HasColumnType("bigint unsigned");
b.Property<ulong>("UserId")
.HasColumnType("bigint unsigned");
b.HasKey("Id");
b.ToTable("Reminders");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.StoreFront", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<int>("StoreItemType")
.HasColumnType("int");
b.Property<ulong>("UserId")
.HasColumnType("bigint unsigned");
b.HasKey("Id");
b.ToTable("StoreFronts");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.StoreInventory", b =>
{
b.Property<ulong>("InvId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<int>("Amount")
.HasColumnType("int");
b.Property<string>("Item")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<int>("Price")
.HasColumnType("int");
b.Property<ulong?>("StoreFrontId")
.HasColumnType("bigint unsigned");
b.HasKey("InvId");
b.HasIndex("StoreFrontId");
b.ToTable("StoreInventory");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.User", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<string>("Avatar")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<string>("GeneralInventory")
.HasColumnType("LONGTEXT");
b.Property<ulong>("LastMine")
.HasColumnType("bigint unsigned");
b.Property<long>("Money")
.HasColumnType("bigint");
b.Property<string>("Username")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.User+BattleFishObject", b =>
{
b.Property<ulong>("FishId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<byte>("FishType")
.HasColumnType("tinyint unsigned");
b.Property<int>("Lvl")
.HasColumnType("int");
b.Property<string>("Name")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<ulong>("NextXp")
.HasColumnType("bigint unsigned");
b.Property<ulong?>("UserId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Xp")
.HasColumnType("bigint unsigned");
b.HasKey("FishId");
b.HasIndex("UserId");
b.ToTable("BattleFishObject");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.ItemOffer", b =>
{
b.HasOne("Kehyeedra3.Services.Models.StoreFront", null)
.WithMany("Offers")
.HasForeignKey("StoreFrontId");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.StoreInventory", b =>
{
b.HasOne("Kehyeedra3.Services.Models.StoreFront", null)
.WithMany("Items")
.HasForeignKey("StoreFrontId");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.User+BattleFishObject", b =>
{
b.HasOne("Kehyeedra3.Services.Models.User", null)
.WithMany("BattleFish")
.HasForeignKey("UserId");
});
#pragma warning restore 612, 618
}
}
}

@ -0,0 +1,46 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Kehyeedra3.Migrations
{
public partial class Beatlefish : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "BattleFishObject",
columns: table => new
{
FishId = table.Column<ulong>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
FishType = table.Column<byte>(nullable: false),
Xp = table.Column<ulong>(nullable: false),
NextXp = table.Column<ulong>(nullable: false),
Lvl = table.Column<int>(nullable: false),
Name = table.Column<string>(nullable: true),
UserId = table.Column<ulong>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BattleFishObject", x => x.FishId);
table.ForeignKey(
name: "FK_BattleFishObject_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_BattleFishObject_UserId",
table: "BattleFishObject",
column: "UserId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BattleFishObject");
}
}
}

@ -160,6 +160,9 @@ namespace Kehyeedra3.Migrations
b.Property<string>("Avatar")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<string>("GeneralInventory")
.HasColumnType("LONGTEXT");
b.Property<ulong>("LastMine")
.HasColumnType("bigint unsigned");
@ -174,6 +177,37 @@ namespace Kehyeedra3.Migrations
b.ToTable("Users");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.User+BattleFishObject", b =>
{
b.Property<ulong>("FishId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<byte>("FishType")
.HasColumnType("tinyint unsigned");
b.Property<int>("Lvl")
.HasColumnType("int");
b.Property<string>("Name")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<ulong>("NextXp")
.HasColumnType("bigint unsigned");
b.Property<ulong?>("UserId")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Xp")
.HasColumnType("bigint unsigned");
b.HasKey("FishId");
b.HasIndex("UserId");
b.ToTable("BattleFishObject");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.ItemOffer", b =>
{
b.HasOne("Kehyeedra3.Services.Models.StoreFront", null)
@ -187,6 +221,13 @@ namespace Kehyeedra3.Migrations
.WithMany("Items")
.HasForeignKey("StoreFrontId");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.User+BattleFishObject", b =>
{
b.HasOne("Kehyeedra3.Services.Models.User", null)
.WithMany("BattleFish")
.HasForeignKey("UserId");
});
#pragma warning restore 612, 618
}
}

@ -75,7 +75,7 @@ namespace Kehyeedra3.Services.Models
{
Id = FishSpecies.Clownfish,
Name = "Clownfish",
Emote = "<:missingRar:682586847100403715>[Clownfish]",
Emote = "<a:clownfishleft:704404973441515661><:clownfishright:704404973076611123>",
Rarity = FishRarity.Rare
},
new Fish()
@ -89,14 +89,14 @@ namespace Kehyeedra3.Services.Models
{
Id = FishSpecies.Blobfish,
Name = "Blobfish",
Emote = "<:missingRar:682586847100403715>[Blobfish]",
Emote = "<a:blobfishleft:704386995996065885><a:blobfishright:704386996369358888>",
Rarity = FishRarity.Rare
},
new Fish()
{
Id = FishSpecies.Psychedelica,
Name = "Psychedelica",
Emote = "<a:psychedelicaleft:682606276592664666><a:psychedelicaright:682606278354141249>",
Emote = "<a:psychedelicaleft:704406253966721135><a:psychedelicaright:704406252125421698>",
Rarity = FishRarity.Rare
},
new Fish()
@ -131,7 +131,7 @@ namespace Kehyeedra3.Services.Models
{
Id = FishSpecies.Sheephead,
Name = "Sheephead",
Emote = "<:sheepheadleft:681200891810021376><:sheepheadright:681200891608563767>",
Emote = "<:sheepheadleft:704406846584127581><:sheepheadright:704406846831722606>",
Rarity = FishRarity.Uncommon
},
new Fish()

@ -18,7 +18,8 @@ namespace Kehyeedra3.Services.Models
public enum StoreItemType
{
Fish = 0,
Reminders = 1
Items = 1,
Reminders = 2
}
public class StoreInventory

@ -1,12 +1,22 @@
namespace Kehyeedra3.Services.Models
using Newtonsoft.Json;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace Kehyeedra3.Services.Models
{
public class User
{
[Key]
public ulong Id { get; set; } = 0;
public string Avatar { get; set; } = null;
public string Username { get; set; } = null;
public long Money { get; set; } = 0;
public ulong LastMine { get; set; } = 0;
[Column(TypeName = "LONGTEXT")]
public string GeneralInventory { get; set; } = "{}";
public ICollection<BattleFishObject> BattleFish { get; set; }
public bool GrantMoney(User bank, long amount)
{
@ -19,5 +29,55 @@
return false;
}
public void SetGenInv(List<Item> newInv)
{
GeneralInventory = JsonConvert.SerializeObject(newInv);
}
public List<Item> GetGenInv()
{
return JsonConvert.DeserializeObject<List<Item>>(GeneralInventory);
}
public static List<Item> ListItems()
{
return new List<Item>
{
new Item()
{
Id = Items.Item1,
Name = "Item1"
},
new Item()
{
Id = Items.Item2,
Name = "Item1"
},
};
}
public class Item
{
public Items Id { get; set; }
public string Name { get; set; }
}
public class BattleFishObject
{
[Key]
public ulong FishId { get; set; }
public byte FishType { get; set; } = 0;
public ulong Xp { get; set; } = 0;
public ulong NextXp { get; set; } = 50;
public int Lvl { get; set; } = 0;
public string Name { get; set; } = "Unnamed";
}
}
public enum Items
{
Item1 = 0,
Item2 = 1,
}
public class ItemSlot
{
public int Id;
public int Amount;
}
}

Loading…
Cancel
Save