fishing changes and stuff

master
Lan 4 years ago
parent 2b8312c0c6
commit 5f9ebe48a4
  1. 9
      Kehyeedra3/ApplicationDbContextFactory.cs
  2. 4
      Kehyeedra3/Bot.cs
  3. 124
      Kehyeedra3/Command handler.cs
  4. 2
      Kehyeedra3/Commands.cs
  5. 790
      Kehyeedra3/Commands/Admin.cs
  6. 759
      Kehyeedra3/Commands/Economy.cs
  7. 11
      Kehyeedra3/Commands/Help.cs
  8. 477
      Kehyeedra3/Commands/Interactive.cs
  9. 2
      Kehyeedra3/Commands/Stuff.cs
  10. 6
      Kehyeedra3/Extensions.cs
  11. 11
      Kehyeedra3/Kehyeedra3.csproj
  12. 85
      Kehyeedra3/Services/Models/BattleFishCharacters.cs
  13. 21
      Kehyeedra3/Services/Models/Fishing.cs
  14. 64
      Kehyeedra3/Services/Models/User.cs
  15. 2
      Kehyeedra3/Services/ReminderService.cs

@ -1,8 +1,12 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design; using Microsoft.EntityFrameworkCore.Design;
using Pomelo.EntityFrameworkCore.MySql.Infrastructure;
using Pomelo.EntityFrameworkCore.MySql.Storage;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using dotenv.net;
using System.IO;
namespace Kehyeedra3 namespace Kehyeedra3
{ {
@ -10,9 +14,12 @@ namespace Kehyeedra3
{ {
public ApplicationDbContext CreateDbContext(string[] args = null) public ApplicationDbContext CreateDbContext(string[] args = null)
{ {
DotEnv.Config(filePath: Path.Combine(AppContext.BaseDirectory, ".env"));
var optionsBuilder = new DbContextOptionsBuilder<ApplicationDbContext>(); var optionsBuilder = new DbContextOptionsBuilder<ApplicationDbContext>();
optionsBuilder.UseMySql(Environment.GetEnvironmentVariable("KEHYEEDRA_CONNSTR")); optionsBuilder.UseMySql(Environment.GetEnvironmentVariable("KEHYEEDRA_CONNSTR"),
x => { x.EnableRetryOnFailure(); x.CharSet(CharSet.Utf8Mb4); });
return new ApplicationDbContext(optionsBuilder.Options); return new ApplicationDbContext(optionsBuilder.Options);
} }

@ -12,6 +12,7 @@ using System.Net.Http;
using Kehyeedra3.Services; using Kehyeedra3.Services;
using System.Threading; using System.Threading;
using Discord.Addons.Interactive; using Discord.Addons.Interactive;
using dotenv.net;
namespace Kehyeedra3 namespace Kehyeedra3
{ {
@ -54,6 +55,7 @@ namespace Kehyeedra3
public async Task CreateBot() public async Task CreateBot()
{ {
DotEnv.Config(filePath: Path.Combine(AppContext.BaseDirectory, ".env"));
var Config = Configuration.Load(); var Config = Configuration.Load();
Clockboy = new System.Timers.Timer(); Clockboy = new System.Timers.Timer();
@ -81,7 +83,7 @@ namespace Kehyeedra3
.AddSingleton(_bot) .AddSingleton(_bot)
.AddSingleton(_cmds) .AddSingleton(_cmds)
.AddSingleton(AudioService) .AddSingleton(AudioService)
.AddSingleton(new InteractiveService(_bot, TimeSpan.FromSeconds(30))) .AddSingleton(new InteractiveService(_bot))
.BuildServiceProvider(); .BuildServiceProvider();
await CommandHandler.InstallCommands(); await CommandHandler.InstallCommands();

@ -81,86 +81,88 @@ namespace Kehyeedra3
{ {
if (!arg.Author.IsBot) if (!arg.Author.IsBot)
{ {
var message = arg as SocketUserMessage; if(arg is SocketUserMessage message)
var Context = new SocketCommandContext(_bot, message);
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{ {
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, Database.Users.Add(new Services.Models.User
Avatar = arg.Author.GetAvatarUrl() ?? arg.Author.GetDefaultAvatarUrl(), {
Username = arg.Author.Username Id = arg.Author.Id,
}); Avatar = arg.Author.GetAvatarUrl() ?? arg.Author.GetDefaultAvatarUrl(),
await Database.SaveChangesAsync(); Username = arg.Author.Username
} });
else await Database.SaveChangesAsync();
{ }
var user = Database.Users.FirstOrDefault(x => x.Id == arg.Author.Id); else
user.Username = arg.Author.Username; {
user.Avatar = arg.Author.GetAvatarUrl() ?? arg.Author.GetDefaultAvatarUrl(); var user = Database.Users.FirstOrDefault(x => x.Id == arg.Author.Id);
await Database.SaveChangesAsync(); user.Username = arg.Author.Username;
user.Avatar = arg.Author.GetAvatarUrl() ?? arg.Author.GetDefaultAvatarUrl();
await Database.SaveChangesAsync();
}
} }
}
if (message == null) return; int argPos = 0;
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}");
}
if (message.Content.ToLowerInvariant().Contains("jojo")) if (message.HasMentionPrefix(_bot.CurrentUser, ref argPos))
{
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) 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.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; if (perms.HasValue)
{ {
var result = await _cmds.ExecuteAsync(Context, argPos, _dmap); if (perms.Value.SendMessages == PermValue.Deny) { exit = true; return; }
if (result.IsSuccess) }
{ });
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Sent successfully"); if (exit) return;
Console.ForegroundColor = ConsoleColor.White;
} }
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."); var result = await _cmds.ExecuteAsync(Context, argPos, _dmap);
Console.ForegroundColor = ConsoleColor.Red; //set text red if (result.IsSuccess)
Console.WriteLine($"Something went wrong\n{result.ErrorReason}"); {
Console.ForegroundColor = ConsoleColor.White; //back to white 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
}
} }
} }
} }

@ -8,8 +8,6 @@ using System.Net;
using System.Linq; using System.Linq;
using System.Data; using System.Data;
using Kehyeedra3.Services; using Kehyeedra3.Services;
using MySql.Data;
using MySql.Data.MySqlClient;
using Kehyeedra3.Services.Models; using Kehyeedra3.Services.Models;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Internal;

@ -1,318 +1,536 @@
using Discord; using Discord;
using Discord.Addons.Interactive; using Discord.Addons.Interactive;
using Discord.Commands; using Discord.Commands;
using ImageMagick;
using Kehyeedra3.Preconditions; using Kehyeedra3.Preconditions;
using Kehyeedra3.Services.Models; using Kehyeedra3.Services.Models;
using Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Kehyeedra3.Commands namespace Kehyeedra3.Commands
{ {
public class Admin : InteractiveBase /////////////////////////////////////////////// public class Admin : InteractiveBase ///////////////////////////////////////////////
{ {
[RequireRolePrecondition(AccessLevel.ServerAdmin)] [RequireRolePrecondition(AccessLevel.ServerAdmin)]
[Command("adddelet"), Summary("Adds a delet this image to the bot from link or image (admin only)")] [Command("adddelet"), Summary("Adds a delet this image to the bot from link or image (admin only)")]
public async Task AddDelet() //Listens for attachments public async Task AddDelet() //Listens for attachments
{ {
var attachments = Context.Message.Attachments;//Gets attachments as var var attachments = Context.Message.Attachments;//Gets attachments as var
foreach (var item in attachments) foreach (var item in attachments)
{ {
Uri link = new Uri(item.Url); Uri link = new Uri(item.Url);
using (WebClient _webclient = new WebClient()) using (WebClient _webclient = new WebClient())
{ {
string location = Path.Combine(Environment.CurrentDirectory, "delet"); string location = Path.Combine(Environment.CurrentDirectory, "delet");
if (!Directory.Exists(location)) if (!Directory.Exists(location))
Directory.CreateDirectory(location); Directory.CreateDirectory(location);
location += "/" + item.Filename; location += "/" + item.Filename;
_webclient.DownloadFileAsync(link, location); _webclient.DownloadFileAsync(link, location);
} }
await ReplyAsync($"Delet added"); await ReplyAsync($"Delet added");
break; break;
} }
} }
[RequireRolePrecondition(AccessLevel.ServerAdmin)] [RequireRolePrecondition(AccessLevel.ServerAdmin)]
[Command("adddelet"), Summary("Adds a delet this image to the bot from link or image (admin only)")] [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 public async Task AddDelet(string url) //Listens for urls
{ {
Uri link = new Uri(url); Uri link = new Uri(url);
using (WebClient _webclient = new WebClient()) using (WebClient _webclient = new WebClient())
{ {
string location = Path.Combine(Environment.CurrentDirectory, $"delet"); string location = Path.Combine(Environment.CurrentDirectory, $"delet");
if (!Directory.Exists(location)) if (!Directory.Exists(location))
Directory.CreateDirectory(location); Directory.CreateDirectory(location);
location += "/" + Guid.NewGuid() + ".jpg"; location += "/" + Guid.NewGuid() + ".jpg";
_webclient.DownloadFileAsync(link, location); _webclient.DownloadFileAsync(link, location);
} }
await ReplyAsync($"Delet added"); await ReplyAsync($"Delet added");
} }
[RequireRolePrecondition(AccessLevel.ServerAdmin)] [RequireRolePrecondition(AccessLevel.ServerAdmin)]
[Command("say"), Summary("Sends given message to given channel (admin only)")] [Command("say"), Summary("Sends given message to given channel (admin only)")]
public async Task Say(ITextChannel channel, [Remainder]string message) public async Task Say(ITextChannel channel, [Remainder] string message)
{ {
await channel.SendMessageAsync(message); await channel.SendMessageAsync(message);
} }
[RequireRolePrecondition(AccessLevel.BotOwner)] [RequireRolePrecondition(AccessLevel.BotOwner)]
[Command("modifybot"), Summary("name")] [Command("modifybot"), Summary("name")]
public async Task ModifyBot(string _name) public async Task ModifyBot(string _name)
{ {
//reference current bot user //reference current bot user
var BotCurrUser = Bot._bot.CurrentUser; var BotCurrUser = Bot._bot.CurrentUser;
await BotCurrUser.ModifyAsync(x => await BotCurrUser.ModifyAsync(x =>
{ {
//sets name //sets name
x.Username = _name; x.Username = _name;
}); });
//reply //reply
await ReplyAsync($"Set name to {_name}"); await ReplyAsync($"Set name to {_name}");
} }
[RequireRolePrecondition(AccessLevel.BotOwner)] [RequireRolePrecondition(AccessLevel.BotOwner)]
[Command("vbi", RunMode = RunMode.Async)] [Command("vbi", RunMode = RunMode.Async)]
public async Task VerifyBankIntegrity() public async Task VerifyBankIntegrity()
{ {
using var Database = new ApplicationDbContextFactory().CreateDbContext(); using var Database = new ApplicationDbContextFactory().CreateDbContext();
List<User> users = Database.Users.OrderByDescending(user => user.Money).ToList(); List<User> users = Database.Users.AsQueryable().OrderByDescending(user => user.Money).ToList();
User bank = Database.Users.FirstOrDefault(x => x.Id == 0); User bank = Database.Users.FirstOrDefault(x => x.Id == 0);
int existing = 0; int existing = 0;
users.ForEach(x => existing += Convert.ToInt32(x.Money)); users.ForEach(x => existing += Convert.ToInt32(x.Money));
int difference = 1000000 - existing; int difference = 1000000 - existing;
string content = ""; string content = "";
if (difference >= 0) if (difference >= 0)
{ {
content += $"Current stability is: {existing / 10000d}%\n"; content += $"Current stability is: {existing / 10000d}%\n";
} }
else 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<FishSpecies, int[]> inv = new Dictionary<FishSpecies, int[]>();
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?"; rod = "rod1.png";
await Context.Channel.SendMessageAsync($"{content}"); tier = "tier1.png";
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 else
{ {
await Context.Channel.SendMessageAsync($"{content}"); lvl = fuser.Lvl;
} xp = fuser.TXp;
} var finv = fuser.GetInventory();
[RequireRolePrecondition(AccessLevel.BotOwner)] switch (fuser.RodUsed)
[Command("modifymoney"), Alias("mm"),Summary("add / set")] {
public async Task ModMoney(string type, int amount, IUser target = null) case 0:
{ {
User user; rod = "rod1.png";
if (type.ToLowerInvariant() == "add" || type.ToLowerInvariant() == "set") tier = "tier1.png";
{ }
using var Database = new ApplicationDbContextFactory().CreateDbContext(); break;
string yuser = ""; case 1:
if (target == null) {
{ rod = "rod2.png";
user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id); tier = "tier2.png";
yuser = $"{Context.User.Username}"; }
} break;
else 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); total += (fish.Value[0] + fish.Value[1] + fish.Value[2]);
yuser = $"{target.Username}";
} }
if (type == "add") }
{
if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), amount)) avatar = user.Avatar;
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, convince someone to gamble"); if (avatar == "https://cdn.discordapp.com/embed/avatars/0.png")
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."); 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 //using (MagickImage name = new MagickImage($"label:\n{Context.User.Username}", new MagickReadSettings
//[Command("cbt", RunMode = RunMode.Async)] //{BackgroundColor = MagickColors.None, FillColor = MagickColors.White, FontPointsize = 20 }))
//public async Task CombatTest() // {
//{ // card.Composite(name, 6, 6, CompositeOperator.Over);
// string[] attackse = new string[] // }
// {
// "a bite",
// "a crowbar",
// "invasive odor",
// "an intense slap"
// };
// int hp = 100; using (MagickImage stats = new MagickImage($"label:" +
// int atk = 100; $"\nFishing Lv : {lvl}" +
// int bhp = 1000; $"\nXP : {xp}" +
// int dmg = 0; $"\nMax catch : {maxc}" +
// int edg = 0; $"\nMin catch : {minc}" +
// string cbta = ""; $"\nTotal Fish : {total}", new MagickReadSettings
// int numatt = SRandom.Next(attackse.Length); {
// string at1; BackgroundColor = MagickColors.None,
// string at2; FillColor = MagickColors.White,
// string eattack; FontPointsize = 12
// int cb; }))
// await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBattle against **Fishthot**\nChoose your battle fish:\n**Pistol Shrimp | Coomfish**"); {
// var message = await NextMessageAsync(); card.Composite(stats,146,5, CompositeOperator.Over);
// if (message.Content.ToLowerInvariant() == "pistol shrimp") }
// { MemoryStream outputStream = new MemoryStream();
// cbta = "Pistol Shrimp"; card.Write(outputStream);
// at1 = "Gun"; outputStream.Position = 0;
// at2 = "Crowbar"; await Context.Channel.SendFileAsync(outputStream, "profile.png");
// 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;
// }
//}
} }
}
} }

File diff suppressed because it is too large Load Diff

@ -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");
}
} }
} }

@ -11,10 +11,13 @@ using System.Collections.ObjectModel;
using System.IO.Enumeration; using System.IO.Enumeration;
using System.IO.IsolatedStorage; using System.IO.IsolatedStorage;
using System.Linq; using System.Linq;
using System.Reflection.Metadata;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Text; using System.Text;
using System.Threading.Channels; using System.Threading.Channels;
using System.Threading.Tasks; using System.Threading.Tasks;
using ImageMagick;
namespace Kehyeedra3.Commands namespace Kehyeedra3.Commands
{ {
@ -32,7 +35,7 @@ namespace Kehyeedra3.Commands
using (var Database = new ApplicationDbContextFactory().CreateDbContext()) using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{ {
var user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id); 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 attb = 0;
int defb = 0; int defb = 0;
@ -47,12 +50,12 @@ namespace Kehyeedra3.Commands
} }
else else
{ {
var fish = userfish.FirstOrDefault(x => x.FishType == user.CurrentBattlefish); var ufish = userfish.FirstOrDefault(x => x.FishType == user.CurrentBattlefish);
if (fish == null) if (ufish == null)
{ {
fish = userfish.FirstOrDefault(); ufish = userfish.FirstOrDefault();
} }
switch (fish.FishType) switch (ufish.FishType)
{ {
case Services.Models.BattleFish.Herring: case Services.Models.BattleFish.Herring:
{ {
@ -104,12 +107,188 @@ namespace Kehyeedra3.Commands
string bfishlist = ""; 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") if (opt == "change" || opt == "c")
{ {
string bfishlistname = ""; string bfishlistname = "";
foreach (var fesh in userfish) foreach (var fesh in userfish)
{ {
string prefix = "Hatchling"; prefix = "Hatchling";
string suffix = ""; string suffix = "";
if (fesh.Lvl >= 15) 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) if (fish == null)
{ {
fish = userfish.FirstOrDefault(); 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}%.*"); 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; return;
} }
string species = "";
switch ((int)rep) switch ((int)rep)
{ {
case 1: case 1:
@ -502,6 +508,36 @@ namespace Kehyeedra3.Commands
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't own that."); 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 else
{ {
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nAre you confused? Try **bf help** if you are having trouble with your bf."); 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")] [Command("gstore", RunMode = RunMode.Async),Alias("gs")]
public async Task GeneralStore(string input = null) public async Task GeneralStore(string input = null)
{ {
@ -551,7 +607,10 @@ namespace Kehyeedra3.Commands
foreach (User.Item i in itemlist) 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) if (input != null)
@ -565,11 +624,11 @@ namespace Kehyeedra3.Commands
} }
else if (input == "b" || input == "buy") 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(); var inp = await NextMessageAsync();
item = itemlist.FirstOrDefault(i => (int)i.Id == int.Parse(inp.Content)); 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(); inp = await NextMessageAsync();
items = user.GetGenInve(); items = user.GetGenInve();
@ -585,19 +644,22 @@ namespace Kehyeedra3.Commands
if (int.Parse(inp.Content) * item.Price <= user.Money) if (int.Parse(inp.Content) * item.Price <= user.Money)
{ {
amount[0] += int.Parse(inp.Content); 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(); inp = await NextMessageAsync();
if (inp.Content.ToLowerInvariant() == "ok") 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."); await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, convince someone to gamble.");
return; return;
} }
user.SetGenInve(items); user.SetGenInve(items);
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBought {count} of {item.Name}.");
await Database.SaveChangesAsync(); await Database.SaveChangesAsync();
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBought {int.Parse(inp.Content)} of {item.Name}.");
} }
else else
{ {
@ -724,15 +786,34 @@ namespace Kehyeedra3.Commands
return; return;
} }
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the item.\n\n{locker}"); await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the item, size, and amount. (ID size amount)\n\n{locker}");
inp = await NextMessageAsync(); inp = await NextMessageAsync(timeout: TimeSpan.FromMinutes(2));
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"); var inpsep = inp.Content.Split(" ");
inp = await NextMessageAsync(); int siz = 0;
size = (FishSize)int.Parse(inp.Content); switch (inpsep[1].ToString().ToLowerInvariant())
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the amount.\n"); {
inp = await NextMessageAsync(); case "s":
int amount = int.Parse(inp.Content); {
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]; int amountcheck = fishinv.FirstOrDefault(f => f.Key == fish.Id).Value[(int)size];
if (amountcheck < amount) if (amountcheck < amount)
{ {

@ -11,6 +11,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using ImageMagick;
namespace Kehyeedra3.Commands namespace Kehyeedra3.Commands
{ {
@ -322,5 +323,6 @@ namespace Kehyeedra3.Commands
} }
} }
} }
} }
} }

@ -1,6 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.IO;
using System.Linq;
namespace Kehyeedra3 namespace Kehyeedra3
{ {
@ -19,7 +22,8 @@ namespace Kehyeedra3
double numb = (double)number/10000; double numb = (double)number/10000;
return numb.ToString("N4"); return numb.ToString("N4");
} }
//https://stackoverflow.com/a/1262619 //https://stackoverflow.com/a/1262619
public static void Shuffle<T>(this IList<T> list) public static void Shuffle<T>(this IList<T> list)

@ -8,14 +8,15 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Discord.Addons.Interactive" Version="1.0.1" /> <PackageReference Include="Discord.Addons.Interactive" Version="2.0.0" />
<PackageReference Include="Discord.Net" Version="2.1.1" /> <PackageReference Include="Discord.Net" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.2" /> <PackageReference Include="dotenv.net" Version="2.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.2"> <PackageReference Include="Magick.NET-Q16-AnyCPU" Version="7.22.2.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.11">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.1" /> <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.2.4" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -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<BFCharacter> GetBFCharList()
{
return new List<BFCharacter>
{
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
}
};
}
}
}

@ -15,7 +15,7 @@ namespace Kehyeedra3.Services.Models
Common, Uncommon, Rare, Legendary, Common, Uncommon, Rare, Legendary,
T2Rare, T2Legendary, T2Uncommon, T2Common, T2Rare, T2Legendary, T2Uncommon, T2Common,
T3Rare, T3Legendary, T3Uncommon, T3Common, T3Rare, T3Legendary, T3Uncommon, T3Common,
T4Rare, T4Legendary, T4Uncommon, T4Common T4Rare, T4Legendary, T4Uncommon, T4Common, Unreasonable
} }
public class Fish public class Fish
{ {
@ -58,6 +58,13 @@ namespace Kehyeedra3.Services.Models
{ {
return new List<Fish> return new List<Fish>
{ {
new Fish()
{
Id = FishSpecies.Wakasagihime,
Name = "Touhoufish",
Emote = "<:wakasagihime:793084118949691433><:emptyslot:709350723199959101>",
Rarity = FishRarity.Unreasonable
},
new Fish() new Fish()
{ {
Id = FishSpecies.LuckyCatfish, Id = FishSpecies.LuckyCatfish,
@ -194,9 +201,9 @@ namespace Kehyeedra3.Services.Models
new Fish() //// Tier 2 new Fish() //// Tier 2
{ {
Id = FishSpecies.T2Circusfish, Id = FishSpecies.T2Leg,
Name = "Circusfish", Name = "Hypnofish",
Emote = "<:missingLeg:682586847830081551>", Emote = "<:paska:786244602440450109><:hypnoosi:786244623478947841>",
Rarity = FishRarity.T2Legendary Rarity = FishRarity.T2Legendary
}, },
new Fish() new Fish()
@ -210,7 +217,7 @@ namespace Kehyeedra3.Services.Models
{ {
Id = FishSpecies.T2Gunfish, Id = FishSpecies.T2Gunfish,
Name = "Gunfish", Name = "Gunfish",
Emote = "<:missingLeg:682586847830081551>", Emote = "<:gunfishleft:793492588799590460><:gunfishright:793492625277714442>",
Rarity = FishRarity.T2Uncommon Rarity = FishRarity.T2Uncommon
}, },
new Fish() new Fish()
@ -285,6 +292,8 @@ namespace Kehyeedra3.Services.Models
public enum FishSpecies public enum FishSpecies
{ {
//unreasonable
Wakasagihime = 0,
//legendary //legendary
LuckyCatfish = 1, LuckyCatfish = 1,
//rare //rare
@ -309,7 +318,7 @@ namespace Kehyeedra3.Services.Models
Carp = 18, Carp = 18,
Megacrab = 19, Megacrab = 19,
//T2 Legendary //T2 Legendary
T2Circusfish = 20, T2Leg = 20,
//T2 Rare //T2 Rare
T2Swolefish = 21, T2Swolefish = 21,
//T2 Uncommon //T2 Uncommon

@ -22,7 +22,7 @@ namespace Kehyeedra3.Services.Models
public bool GrantMoney(User bank, long amount) public bool GrantMoney(User bank, long amount)
{ {
if(bank.Money > amount) if(bank.Money >= amount)
{ {
Money += amount; Money += amount;
bank.Money -= amount; bank.Money -= amount;
@ -55,15 +55,60 @@ namespace Kehyeedra3.Services.Models
new Item() new Item()
{ {
Id = Items.DirtyBoot, Id = Items.DirtyBoot,
Name = "Lan's Love", Name = "Love",
Price = 100 Price = 100
}, },
new Item() new Item()
{ {
Id = Items.Lettuce, Id = Items.Lettuce,
Name = "Lettuce", Name = "Learning Lettuce",
Price = 50 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 public class Item
@ -98,7 +143,16 @@ namespace Kehyeedra3.Services.Models
public enum Items public enum Items
{ {
DirtyBoot = 0, DirtyBoot = 0,
Lettuce = 1 Lettuce = 1,
RareBait = 2,
BigBait = 3,
SpecialBait = 4,
RodFrame = 5,
UpgradeT2 = 200,
UpgradeT3 = 201,
UpgradeT4 = 202,
} }
public class ItemSlot public class ItemSlot
{ {

@ -58,7 +58,7 @@ namespace Kehyeedra3.Services
} }
catch { await (await Bot._bot.GetUser(242040333309837327).GetOrCreateDMChannelAsync()).SendMessageAsync($"Time of error ^\n" + catch { await (await Bot._bot.GetUser(242040333309837327).GetOrCreateDMChannelAsync()).SendMessageAsync($"Time of error ^\n" +
$"A fucky wucky has occurred, uwu\nFix wemindew sewwis dimwiwt" + $"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() public async Task Tick()

Loading…
Cancel
Save