I have no idea what I changed

It has been too long, the things just piled up
master
Lan 4 years ago
parent f5edaf545d
commit 2b8312c0c6
  1. 1
      Kehyeedra3/ApplicationDbContext.cs
  2. 7
      Kehyeedra3/Bot.cs
  3. 317
      Kehyeedra3/Commands/Interactive.cs
  4. 239
      Kehyeedra3/Migrations/20200531192223_boofboof.Designer.cs
  5. 17
      Kehyeedra3/Migrations/20200531192223_boofboof.cs
  6. 230
      Kehyeedra3/Migrations/20200531193428_oofboof.Designer.cs
  7. 75
      Kehyeedra3/Migrations/20200531193428_oofboof.cs
  8. 233
      Kehyeedra3/Migrations/20200531204543_oofoof.Designer.cs
  9. 37
      Kehyeedra3/Migrations/20200531204543_oofoof.cs
  10. 20
      Kehyeedra3/Migrations/ApplicationDbContextModelSnapshot.cs
  11. 37
      Kehyeedra3/Services/Models/User.cs
  12. 9
      Kehyeedra3/Services/ReminderService.cs

@ -12,5 +12,6 @@ namespace Kehyeedra3
public DbSet<Reminder> Reminders { get; set; } public DbSet<Reminder> Reminders { get; set; }
public DbSet<Fishing> Fishing { get; set; } public DbSet<Fishing> Fishing { get; set; }
public DbSet<StoreFront> StoreFronts { get; set; } public DbSet<StoreFront> StoreFronts { get; set; }
public DbSet<User.BattleFishObject> Battlefish { get; set; }
} }
} }

@ -18,6 +18,7 @@ namespace Kehyeedra3
public class Bot public class Bot
{ {
/// Star Vars /// Star Vars
public static bool IsReady { get; private set; }
public static DiscordSocketClient _bot; public static DiscordSocketClient _bot;
public static System.Timers.Timer Clockboy; public static System.Timers.Timer Clockboy;
public static AudioService AudioService; public static AudioService AudioService;
@ -140,6 +141,7 @@ namespace Kehyeedra3
{ {
try try
{ {
_bot.Ready += _bot_Ready;
await _bot.LoginAsync(TokenType.Bot, Configuration.Load().Token); await _bot.LoginAsync(TokenType.Bot, Configuration.Load().Token);
await _bot.StartAsync(); await _bot.StartAsync();
Clockboy.Start(); Clockboy.Start();
@ -162,6 +164,11 @@ namespace Kehyeedra3
} }
} }
private async Task _bot_Ready()
{
IsReady = true;
}
public static void EnsureConfigExists() public static void EnsureConfigExists()
{ {
string storage = Environment.CurrentDirectory; string storage = Environment.CurrentDirectory;

@ -3,12 +3,15 @@ using Discord.Addons.Interactive;
using Discord.Commands; using Discord.Commands;
using Kehyeedra3.Preconditions; using Kehyeedra3.Preconditions;
using Kehyeedra3.Services.Models; using Kehyeedra3.Services.Models;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
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.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;
@ -23,34 +26,169 @@ namespace Kehyeedra3.Commands
"" ""
}; };
[RequireRolePrecondition(AccessLevel.BotOwner)]
[Command("battlefish", RunMode = RunMode.Async),Alias("bf"),Summary("Type **bf help** or **bf h** for help with this command.")] [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) public async Task BattleFish(string option = null, [Remainder]string sec = null)
{ {
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);
if (user.BattleFish.Any() == false) var userfish = Database.Battlefish.Where(x => x.UserId == Context.User.Id);
int attb = 0;
int defb = 0;
int hpb = 0;
int apb = 0;
int dgb = 0;
if (!userfish.Any() && option == null)
{ {
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't have a battlefish."); await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't have any battlefish.");
return; return;
} }
else
{
var fish = userfish.FirstOrDefault(x => x.FishType == user.CurrentBattlefish);
if (fish == null)
{
fish = userfish.FirstOrDefault();
}
switch (fish.FishType)
{
case Services.Models.BattleFish.Herring:
{
attb = 9;
defb = 9;
hpb = 9;
apb = 3;
dgb = 2;
}
break;
case Services.Models.BattleFish.Birgus:
{
attb = 10;
defb = 6;
hpb = 5;
apb = 9;
dgb = 4;
}
break;
case Services.Models.BattleFish.Abama:
{
attb = 4;
defb = 3;
hpb = 5;
apb = 18;
dgb = 8;
}
break;
case Services.Models.BattleFish.Pistashrimp:
{
attb = 15;
defb = 4;
hpb = 5;
apb = 6;
dgb = 6;
}
break;
}
}
string opt = "";
BattleFish type = 0;
if (option != null)
{
opt = option.ToLowerInvariant();
}
string bfishlist = "";
if (opt == "change" || opt == "c")
{
string bfishlistname = "";
foreach (var fesh in userfish)
{
string prefix = "Hatchling";
string suffix = "";
if (fesh.Lvl >= 15)
{
prefix = "Young";
}
if (fesh.Lvl >= 30)
{
prefix = "Adolescent";
}
if (fesh.Lvl >= 50)
{
prefix = "Adult";
}
switch ((int)fesh.FishType)
{
case 1:
{
if (fesh.Lvl >= 100)
{
bfishlistname += $"ton";
suffix = $"Authentic Masculine";
}
bfishlistname = $"{prefix} Herring{suffix}";
}
break;
case 2:
{
if (fesh.Lvl >= 100)
{
prefix = $"Great Sage";
}
bfishlistname = $"{prefix} Birgus";
}
break;
case 3:
{
if (fesh.Lvl >= 100)
{
prefix = $"President";
}
bfishlistname = $"{prefix} Abama";
}
break;
case 4:
{
if (fesh.Lvl >= 100)
{
suffix += $" XTREME";
prefix = $"Hardboiled";
}
bfishlistname = $"{prefix} Pistashrimp{suffix}";
}
break;
}
bfishlist += $"{(byte)fesh.FishType} : LVL {fesh.Lvl} {bfishlistname}\n";
}
}
if (option == null)
{
var fish = userfish.FirstOrDefault(x => x.FishType == user.CurrentBattlefish);
if (fish == null)
{
fish = userfish.FirstOrDefault();
}
var fish = user.BattleFish.FirstOrDefault(); StringBuilder message = new StringBuilder($"{Context.User.Mention}\n");
string species = $""; string species = $"";
string attacks = $""; string attacks = $"";
int att = 0;
int def = 0;
int dg = 0;
int hp = 0;
int ap = 0;
double lvm = 20; double lvm = 20;
double lvmhp = 100; double lvmhp = 100;
int lvdf = 5;
if (option == null)
{
for (int i = 0; i < fish.Lvl; i++) for (int i = 0; i < fish.Lvl; i++)
{ {
lvm += Math.Round((Convert.ToDouble(lvm) * 0.01d), 0, MidpointRounding.ToEven) + 5; lvm += Math.Round((Convert.ToDouble(lvm) * 0.01d), 0, MidpointRounding.ToEven) + 5;
@ -58,6 +196,13 @@ namespace Kehyeedra3.Commands
} }
int lvlm = Convert.ToInt32(lvm) / 10; int lvlm = Convert.ToInt32(lvm) / 10;
int lvlmhp = Convert.ToInt32(lvmhp) / 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"; string prefix = "Hatchling";
if (fish.Lvl >= 15) if (fish.Lvl >= 15)
@ -72,7 +217,7 @@ namespace Kehyeedra3.Commands
{ {
prefix = "Adult"; prefix = "Adult";
} }
switch (fish.FishType) switch ((int)fish.FishType)
{ {
case 0: case 0:
{ {
@ -106,12 +251,6 @@ namespace Kehyeedra3.Commands
attacks += $"\n5 : **Fairy Nightmare** - {species} executes a devastating ultimate attack."; 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; break;
case 2: case 2:
@ -141,12 +280,6 @@ namespace Kehyeedra3.Commands
attacks += $"\n5 : **Ecletic Rift** - {species} summons portals to alternate dimensions to call forth an army of raving crabs."; 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; break;
case 3: case 3:
@ -176,12 +309,6 @@ namespace Kehyeedra3.Commands
attacks += $"\n5 : **Ancestral Wrath** - {species} calls into the depths to unleash its true potential."; 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; break;
case 4: case 4:
@ -211,20 +338,27 @@ namespace Kehyeedra3.Commands
attacks += $"\n5 : **Dual Jet** - {species} vaporizes the surrounding with its machine gun claws."; 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; 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}"); 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) else if (option == "name" && sec != null || option == "n" && sec != null)
{ {
var fish = userfish.FirstOrDefault(x => x.FishType == user.CurrentBattlefish);
if (fish == null)
{
fish = userfish.FirstOrDefault();
}
if (fish == null)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou can't name a fish you don't own!");
return;
}
if (sec.Length > 16) if (sec.Length > 16)
{ {
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThe maximum name length is 16 characters. \nStop jassing."); await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThe maximum name length is 16 characters. \nStop jassing.");
@ -250,8 +384,13 @@ namespace Kehyeedra3.Commands
$"\n3 : **Abama** - A cephalopod rogue with a heavy focus on debuffs. It is very agile.\nModifiers: **ATK 4, DEF 3, HP 5, AP 18**" + $"\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**"); $"\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(); var reply = await NextMessageAsync();
byte rep = byte.Parse(reply.Content); BattleFish rep = (BattleFish)byte.Parse(reply.Content);
if (rep > 4 || rep < 1) if (userfish.Any(x => x.FishType == rep))
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou already have one of those, please don't neglect it and make it sad.");
return;
}
if ((int)rep > 4 || (int)rep < 1)
{ {
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nWhat you're looking for does not exist."); await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nWhat you're looking for does not exist.");
return; return;
@ -261,7 +400,8 @@ 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;
} }
switch (rep) string species = "";
switch ((int)rep)
{ {
case 1: case 1:
{ {
@ -293,8 +433,15 @@ namespace Kehyeedra3.Commands
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;
} }
//create fish here pls let there fish be
fish.FishType = rep; var bfish = new User.BattleFishObject
{
FishType = rep,
UserId = Context.User.Id
};
Database.Battlefish.Add(bfish);
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThank you for your purchase."); await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThank you for your purchase.");
await Database.SaveChangesAsync(); await Database.SaveChangesAsync();
} }
@ -341,7 +488,19 @@ namespace Kehyeedra3.Commands
} }
else if (option == "change" || option == "c") else if (option == "change" || option == "c")
{ {
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nPlease select your battlefish\n{bfishlist}");
var fens = await NextMessageAsync();
type = (BattleFish)byte.Parse(fens.Content);
if (userfish.Any(x => x.FishType == type))
{
user.CurrentBattlefish = type;
await Database.SaveChangesAsync();
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBattlefish changed.");
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't own that.");
}
} }
else else
{ {
@ -703,76 +862,6 @@ namespace Kehyeedra3.Commands
[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();
}
}
} }
} }

@ -0,0 +1,239 @@
// <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("20200531192223_boofboof")]
partial class boofboof
{
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<int>("Prestige")
.HasColumnType("int");
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,17 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Kehyeedra3.Migrations
{
public partial class boofboof : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

@ -0,0 +1,230 @@
// <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("20200531193428_oofboof")]
partial class oofboof
{
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<int>("Prestige")
.HasColumnType("int");
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.ToTable("Battlefish");
});
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,75 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Kehyeedra3.Migrations
{
public partial class oofboof : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_BattleFishObject_Users_UserId",
table: "BattleFishObject");
migrationBuilder.DropPrimaryKey(
name: "PK_BattleFishObject",
table: "BattleFishObject");
migrationBuilder.DropIndex(
name: "IX_BattleFishObject_UserId",
table: "BattleFishObject");
migrationBuilder.RenameTable(
name: "BattleFishObject",
newName: "Battlefish");
migrationBuilder.AlterColumn<ulong>(
name: "UserId",
table: "Battlefish",
nullable: false,
oldClrType: typeof(ulong),
oldType: "bigint unsigned",
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_Battlefish",
table: "Battlefish",
column: "FishId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_Battlefish",
table: "Battlefish");
migrationBuilder.RenameTable(
name: "Battlefish",
newName: "BattleFishObject");
migrationBuilder.AlterColumn<ulong>(
name: "UserId",
table: "BattleFishObject",
type: "bigint unsigned",
nullable: true,
oldClrType: typeof(ulong));
migrationBuilder.AddPrimaryKey(
name: "PK_BattleFishObject",
table: "BattleFishObject",
column: "FishId");
migrationBuilder.CreateIndex(
name: "IX_BattleFishObject_UserId",
table: "BattleFishObject",
column: "UserId");
migrationBuilder.AddForeignKey(
name: "FK_BattleFishObject_Users_UserId",
table: "BattleFishObject",
column: "UserId",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,233 @@
// <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("20200531204543_oofoof")]
partial class oofoof
{
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<int>("Prestige")
.HasColumnType("int");
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<int>("CurrentBattlefish")
.HasColumnType("int");
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<int>("FishType")
.HasColumnType("int");
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.ToTable("Battlefish");
});
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,37 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Kehyeedra3.Migrations
{
public partial class oofoof : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "CurrentBattlefish",
table: "Users",
nullable: false,
defaultValue: 0);
migrationBuilder.AlterColumn<int>(
name: "FishType",
table: "Battlefish",
nullable: false,
oldClrType: typeof(byte),
oldType: "tinyint unsigned");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CurrentBattlefish",
table: "Users");
migrationBuilder.AlterColumn<byte>(
name: "FishType",
table: "Battlefish",
type: "tinyint unsigned",
nullable: false,
oldClrType: typeof(int));
}
}
}

@ -163,6 +163,9 @@ namespace Kehyeedra3.Migrations
b.Property<string>("Avatar") b.Property<string>("Avatar")
.HasColumnType("longtext CHARACTER SET utf8mb4"); .HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<int>("CurrentBattlefish")
.HasColumnType("int");
b.Property<string>("GeneralInventory") b.Property<string>("GeneralInventory")
.HasColumnType("LONGTEXT"); .HasColumnType("LONGTEXT");
@ -186,8 +189,8 @@ namespace Kehyeedra3.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned"); .HasColumnType("bigint unsigned");
b.Property<byte>("FishType") b.Property<int>("FishType")
.HasColumnType("tinyint unsigned"); .HasColumnType("int");
b.Property<int>("Lvl") b.Property<int>("Lvl")
.HasColumnType("int"); .HasColumnType("int");
@ -198,7 +201,7 @@ namespace Kehyeedra3.Migrations
b.Property<ulong>("NextXp") b.Property<ulong>("NextXp")
.HasColumnType("bigint unsigned"); .HasColumnType("bigint unsigned");
b.Property<ulong?>("UserId") b.Property<ulong>("UserId")
.HasColumnType("bigint unsigned"); .HasColumnType("bigint unsigned");
b.Property<ulong>("Xp") b.Property<ulong>("Xp")
@ -206,9 +209,7 @@ namespace Kehyeedra3.Migrations
b.HasKey("FishId"); b.HasKey("FishId");
b.HasIndex("UserId"); b.ToTable("Battlefish");
b.ToTable("BattleFishObject");
}); });
modelBuilder.Entity("Kehyeedra3.Services.Models.ItemOffer", b => modelBuilder.Entity("Kehyeedra3.Services.Models.ItemOffer", b =>
@ -224,13 +225,6 @@ namespace Kehyeedra3.Migrations
.WithMany("Items") .WithMany("Items")
.HasForeignKey("StoreFrontId"); .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 #pragma warning restore 612, 618
} }
} }

@ -15,7 +15,9 @@ namespace Kehyeedra3.Services.Models
public ulong LastMine { get; set; } = 0; public ulong LastMine { get; set; } = 0;
[Column(TypeName = "LONGTEXT")] [Column(TypeName = "LONGTEXT")]
public string GeneralInventory { get; set; } = "{}"; public string GeneralInventory { get; set; } = "{}";
public ICollection<BattleFishObject> BattleFish { get; set; } [Column(TypeName = "TINYINT")]
public BattleFish CurrentBattlefish { get; set; } = 0;
public bool GrantMoney(User bank, long amount) public bool GrantMoney(User bank, long amount)
@ -30,18 +32,6 @@ namespace Kehyeedra3.Services.Models
return false; return false;
} }
//public void SetGenInv(List<Item> newInv)
//{
// GeneralInventory = JsonConvert.SerializeObject(newInv);
//}
//public List<Item> GetGenInv()
//{
// if (string.IsNullOrEmpty(GeneralInventory))
// {
// return new List<Item>();
// }
// return JsonConvert.DeserializeObject<List<Item>>(GeneralInventory);
//}
public Dictionary<Items, int[]> GetGenInve() public Dictionary<Items, int[]> GetGenInve()
{ {
@ -68,6 +58,12 @@ namespace Kehyeedra3.Services.Models
Name = "Lan's Love", Name = "Lan's Love",
Price = 100 Price = 100
}, },
new Item()
{
Id = Items.Lettuce,
Name = "Lettuce",
Price = 50
}
}; };
} }
public class Item public class Item
@ -76,20 +72,33 @@ namespace Kehyeedra3.Services.Models
public string Name { get; set; } public string Name { get; set; }
public int Price { get; set; } public int Price { get; set; }
} }
public class BattleFishObject public class BattleFishObject
{ {
[Key] [Key]
public ulong FishId { get; set; } public ulong FishId { get; set; }
public byte FishType { get; set; } = 0; [Required]
public ulong UserId { get; set; }
[Column(TypeName = "TINYINT")]
public BattleFish FishType { get; set; } = 0;
public ulong Xp { get; set; } = 0; public ulong Xp { get; set; } = 0;
public ulong NextXp { get; set; } = 50; public ulong NextXp { get; set; } = 50;
public int Lvl { get; set; } = 0; public int Lvl { get; set; } = 0;
public string Name { get; set; } = "Unnamed"; public string Name { get; set; } = "Unnamed";
} }
} }
public enum BattleFish
{
None = 0,
Herring = 1,
Birgus = 2,
Abama = 3,
Pistashrimp = 4
}
public enum Items public enum Items
{ {
DirtyBoot = 0, DirtyBoot = 0,
Lettuce = 1
} }
public class ItemSlot public class ItemSlot
{ {

@ -11,6 +11,7 @@ namespace Kehyeedra3.Services
{ {
private static async Task SendReminderAsync(Reminder reminder) private static async Task SendReminderAsync(Reminder reminder)
{ {
try {
var dmchannel = await Bot._bot.GetUser(reminder.UserId).GetOrCreateDMChannelAsync(); var dmchannel = await Bot._bot.GetUser(reminder.UserId).GetOrCreateDMChannelAsync();
if (dmchannel != null) if (dmchannel != null)
{ {
@ -55,10 +56,17 @@ namespace Kehyeedra3.Services
await dmchannel.SendMessageAsync($"**Reminder from{remin} ago:**\n\n''{reminder.Message}''"); await dmchannel.SendMessageAsync($"**Reminder from{remin} ago:**\n\n''{reminder.Message}''");
} }
} }
catch { await (await Bot._bot.GetUser(242040333309837327).GetOrCreateDMChannelAsync()).SendMessageAsync($"Time of error ^\n" +
$"A fucky wucky has occurred, uwu\nFix wemindew sewwis dimwiwt" +
$"\nThis was the reminder: {reminder.Id} {reminder.UserId} {reminder.Send.FromYeedraStamp()}"); }
}
public async Task Tick() public async Task Tick()
{ {
while (true) while (true)
{ {
if(Bot.IsReady)
{
using (var Database = new ApplicationDbContextFactory().CreateDbContext()) using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{ {
var reminders = Database.Reminders.ToList(); var reminders = Database.Reminders.ToList();
@ -81,6 +89,7 @@ namespace Kehyeedra3.Services
} }
} }
} }
}
await Task.Delay(250); await Task.Delay(250);
} }
} }

Loading…
Cancel
Save