I don't even know what I changed

I should be pushing updates much more often
master
Lan 3 years ago
parent 55fc6f4842
commit 81ec4922bf
  1. 1
      Kehyeedra3/ApplicationDbContext.cs
  2. 5
      Kehyeedra3/Bot.cs
  3. 16
      Kehyeedra3/Commands/Admin.cs
  4. 134
      Kehyeedra3/Commands/Economy.cs
  5. 141
      Kehyeedra3/Commands/Interactive.cs
  6. 4
      Kehyeedra3/Commands/Stuff.cs
  7. BIN
      Kehyeedra3/Discord.Addons.Interactive.dll
  8. 27
      Kehyeedra3/Extensions.cs
  9. 15
      Kehyeedra3/Kehyeedra3.csproj
  10. 294
      Kehyeedra3/Migrations/20210806204446_FarmingA.Designer.cs
  11. 47
      Kehyeedra3/Migrations/20210806204446_FarmingA.cs
  12. 38
      Kehyeedra3/Migrations/ApplicationDbContextModelSnapshot.cs
  13. 115
      Kehyeedra3/Services/ButtonService.cs
  14. 240
      Kehyeedra3/Services/Models/Farming.cs
  15. 9
      Kehyeedra3/Services/Models/Fishing.cs
  16. 2
      Kehyeedra3/Services/Models/User.cs
  17. 4
      Kehyeedra3/Services/ReminderService.cs

@ -14,5 +14,6 @@ namespace Kehyeedra3
public DbSet<StoreFront> StoreFronts { get; set; } public DbSet<StoreFront> StoreFronts { get; set; }
public DbSet<User.BattleFishObject> Battlefish { get; set; } public DbSet<User.BattleFishObject> Battlefish { get; set; }
public DbSet<Mining> Mining { get; set; } public DbSet<Mining> Mining { get; set; }
public DbSet<Farming> Farming { get; set; }
} }
} }

@ -12,6 +12,7 @@ using Kehyeedra3.Services;
using System.Threading; using System.Threading;
using Discord.Addons.Interactive; using Discord.Addons.Interactive;
using dotenv.net; using dotenv.net;
using Kehyeedra3.Buttons;
namespace Kehyeedra3 namespace Kehyeedra3
{ {
@ -138,6 +139,8 @@ namespace Kehyeedra3
try try
{ {
_bot.Ready += _bot_Ready; _bot.Ready += _bot_Ready;
ButtonService.RegisterCumButtons(_bot); // button testing
ButtonService.RegisterFarmButtons(_bot);
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();
@ -160,7 +163,7 @@ namespace Kehyeedra3
} }
} }
private async Task _bot_Ready() private async Task _bot_Ready()
{ {
IsReady = true; IsReady = true;
} }

@ -99,6 +99,14 @@ namespace Kehyeedra3.Commands
var message = await NextMessageAsync(); var message = await NextMessageAsync();
if (message != null && message.Content.ToLowerInvariant() == "yes") if (message != null && message.Content.ToLowerInvariant() == "yes")
{ {
foreach (User u in users)
{
if (u.Money < 0)
{
u.Money = 0;
u.Money -= difference;
}
}
bank.Money += difference; bank.Money += difference;
await Database.SaveChangesAsync(); await Database.SaveChangesAsync();
if (difference > 0) if (difference > 0)
@ -330,6 +338,14 @@ namespace Kehyeedra3.Commands
} }
} }
[RequireRolePrecondition(AccessLevel.ServerAdmin)]
[Command("buttontest")]
public async Task ButtonTest() // button testing
{
var components = new ComponentBuilder().WithButton("cum", "cum").WithButton("piss", "piss");
await Context.Channel.SendMessageAsync($"Greetings traveler, I've potions for you to purchase, what'd you like to have?",component:components.Build());
}
[RequireRolePrecondition(AccessLevel.ServerAdmin)] [RequireRolePrecondition(AccessLevel.ServerAdmin)]
[Command("makeimag")] [Command("makeimag")]
public async Task MakeImage() public async Task MakeImage()

@ -22,10 +22,10 @@ namespace Kehyeedra3.Commands
{ {
"**Gold**,", "**Gold**,",
"**Platinum**,", "**Platinum**,",
"**Plastids**,", "a **Windows Update**,",
"a ticking **Time Bomb**,", "a ticking **Time Bomb**,",
"an **Amethyst**,", "an **Amethyst**,",
"**Germanium**,", "the **Bone Stone**,",
"a **Hotdog**,", "a **Hotdog**,",
"**Corundum**,", "**Corundum**,",
"**Quartz**,", "**Quartz**,",
@ -35,11 +35,11 @@ namespace Kehyeedra3.Commands
"**Beryllium**,", "**Beryllium**,",
"**Gallium**,", "**Gallium**,",
"an **Amber**,", "an **Amber**,",
"**Bismuth**", "**Bismuth**,",
"an **Emerald**,", "an **Emerald**,",
"a lost **Sock**,", "a lost **Sock**,",
"**Tellurium**,", "**Tellurium**,",
"**Ferrite**,", "**Bad Apple**,",
"a **Glass of Water**,", "a **Glass of Water**,",
"**Redstone**,", "**Redstone**,",
"**Racism**,", "**Racism**,",
@ -64,7 +64,7 @@ namespace Kehyeedra3.Commands
"a **Viet Cong Tunnel**,", "a **Viet Cong Tunnel**,",
"a single unit of several **Trees**,", "a single unit of several **Trees**,",
"**1,000,000₩**,", "**1,000,000₩**,",
"**Jas's Love**,", "a **Cunny Rabbit**,",
"a **Rock Golem**,", "a **Rock Golem**,",
"a piece of **Toast**,", "a piece of **Toast**,",
"**Luminite**,", "**Luminite**,",
@ -178,15 +178,7 @@ namespace Kehyeedra3.Commands
if (muser.TXp >= muser.Xp) if (muser.TXp >= muser.Xp)
{ {
muser.Lvl += 1; muser.Lvl += 1;
ulong leXp = 50; muser.Xp = muser.Lvl.GetLevelXp()[0];
for (ulong i = 0; i < muser.Lvl; i++)
{
if (i <= muser.Lvl)
{
leXp += Convert.ToUInt64(Math.Round((leXp * 0.05d + 50d), 0, MidpointRounding.ToEven));
}
}
muser.Xp = leXp;
levelup += $"You leveled up. You are now **Lvl {muser.Lvl}**"; levelup += $"You leveled up. You are now **Lvl {muser.Lvl}**";
} }
else else
@ -635,32 +627,17 @@ namespace Kehyeedra3.Commands
int times = 0; int times = 0;
if (user.TXp > 50 && user.FXp == 0) if (user.TXp > 50 && user.FXp == 0)
{ {
lvlXp = 50; ulong[] result = user.Lvl.GetLevelXp();
for (ulong i = 0; i < user.Lvl; i++) lvlXp = result[0];
{ user.FXp = result[1];
if (i <= user.Lvl)
{
lvlXp += Convert.ToUInt64(Math.Round((lvlXp * 0.05d + 50d), 0, MidpointRounding.ToEven));
}
if (i == user.Lvl - 2)
{
user.FXp = lvlXp;
}
}
} }
if (user.TXp >= user.Xp) if (user.TXp >= user.Xp)
{ {
ulong leXp = 50; ulong[] result = user.Lvl.GetLevelXp();
ulong leXp = result[0];
bool leTrig = false; bool leTrig = false;
for (ulong i = 0; i < user.Lvl; i++)
{
if (i <= user.Lvl)
{
leXp += Convert.ToUInt64(Math.Round((leXp * 0.05d + 50d), 0, MidpointRounding.ToEven));
}
}
if (leXp != user.Xp) if (leXp != user.Xp)
{ {
user.Lvl = 0; user.Lvl = 0;
@ -673,26 +650,18 @@ namespace Kehyeedra3.Commands
times += 1; times += 1;
lvlXp = 50; lvlXp = 50;
for (ulong i = 0; i < user.Lvl; i++) result = user.Lvl.GetLevelXp();
{ lvlXp = result[0];
user.FXp = result[1];
if (i <= user.Lvl)
{
lvlXp += Convert.ToUInt64(Math.Round((lvlXp * 0.05d + 50d), 0, MidpointRounding.ToEven));
}
if (i == user.Lvl - 2)
{
user.FXp = lvlXp;
}
}
user.Xp = lvlXp; user.Xp = lvlXp;
} }
toNextLvl = user.Xp - user.TXp; toNextLvl = user.Xp - user.TXp;
level = user.Lvl; level = user.Lvl;
if (leTrig) if (leTrig)
{ {
lvlUp = $"**Your level was recalculated\n to match your xp.** \nYou are now **Level {level}**"; lvlUp = $"**Your level was recalculated to match \nyour xp.** You are now **Level {level}**";
} }
else if (times > 1) else if (times > 1)
{ {
@ -970,7 +939,7 @@ namespace Kehyeedra3.Commands
} }
} }
[Command("fishinventory"), Alias("finv", "fishinv"), Summary("Shows the fish you have currently. Variables: fish tier")] [Command("fishinventory"), Alias("finv", "fishinv"), Summary("Shows your fish inventory. Variables: fish tier")]
public async Task FishInventory(int? tier = null, IGuildUser user = null) public async Task FishInventory(int? tier = null, IGuildUser user = null)
{ {
if (user == null) if (user == null)
@ -1152,7 +1121,7 @@ namespace Kehyeedra3.Commands
await Context.Channel.SendMessageAsync("Go fish nigger").ConfigureAwait(false); await Context.Channel.SendMessageAsync("Go fish nigger").ConfigureAwait(false);
} }
} }
[Command("generalinventory"),Alias("ginv", "geninv"), Summary("Shows the items you have excluding fish.")] [Command("generalinventory"),Alias("ginv", "geninv"), Summary("Shows your general items inventory.")]
public async Task GeneralInventory() public async Task GeneralInventory()
{ {
User user; User user;
@ -1163,7 +1132,21 @@ namespace Kehyeedra3.Commands
using (var Database = new ApplicationDbContextFactory().CreateDbContext()) using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{ {
user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id); user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id);
inv = user.GetGenInve(); if (user == null)
{
user = new User
{
Id = Context.User.Id
};
Database.Users.Add(user);
message += "You have no items.";
}
else
{
inv = user.GetGenInve();
}
foreach (var entry in inv) foreach (var entry in inv)
{ {
if (entry.Value[0] > 0) if (entry.Value[0] > 0)
@ -1175,6 +1158,42 @@ namespace Kehyeedra3.Commands
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n{message}"); await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n{message}");
} }
} }
[Command("farminventory"),Alias("fainv","farminv"),Summary("Shows your farm inventory, including seeds and crops.")]
public async Task FarmInventory()
{
string message = "";
List<FCrop> crops = Farming.ListCrops();
Dictionary<FarmCrop, int[]> inv = new Dictionary<FarmCrop, int[]>();
FCrop crop;
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Farming.FirstOrDefault(x => x.Id == Context.User.Id);
if (user == null)
{
user = new Farming
{
Id = Context.User.Id
};
Database.Farming.Add(user);
message += "You have no items.";
}
else
{
inv = user.GetCropInventory();
}
foreach (var entry in inv)
{
if (entry.Value[0] > 0)
{
crop = crops.FirstOrDefault(x => x.Id == entry.Key);
message += $"**{crop.Name}** : **{entry.Value[0]}** Seeds, **{entry.Value[1]}** Crops\n";
}
}
await ReplyAsync($"{Context.User.Mention}\n{message}");
}
}
[RequireRolePrecondition(AccessLevel.ServerAdmin)] [RequireRolePrecondition(AccessLevel.ServerAdmin)]
[Command("tradebuy", RunMode = RunMode.Async), Summary("Unfinished command")] [Command("tradebuy", RunMode = RunMode.Async), Summary("Unfinished command")]
public async Task TradingBuy(int amount, string itemtype, int price, [Remainder] string item) public async Task TradingBuy(int amount, string itemtype, int price, [Remainder] string item)
@ -1662,19 +1681,10 @@ namespace Kehyeedra3.Commands
user.TXp -= presXp; user.TXp -= presXp;
user.Xp = 0; user.Xp = 0;
user.Lvl = 0; user.Lvl = 0;
ulong lvlXp = 0;
while (user.TXp >= user.Xp) while (user.TXp >= user.Xp)
{ {
user.Lvl += 1; user.Lvl += 1;
lvlXp = 50; user.Xp = user.Lvl.GetLevelXp()[0];
for (ulong i = 0; i < user.Lvl; i++)
{
if (i <= user.Lvl)
{
lvlXp += Convert.ToUInt64(Math.Round((lvlXp * 0.05d + 50d), 0, MidpointRounding.ToEven));
}
}
user.Xp = lvlXp;
} }
await Database.SaveChangesAsync(); await Database.SaveChangesAsync();
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou've successfully upgraded to **P{user.Prestige}**.\nReadjusting level."); await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou've successfully upgraded to **P{user.Prestige}**.\nReadjusting level.");

@ -1059,10 +1059,149 @@ namespace Kehyeedra3.Commands
} }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
} }
} }
[Command("farming", RunMode = RunMode.Async), Alias("farm"), Summary("arguments: m/manage")]
public async Task FarmCommand(string input = null)
{
Dictionary<FarmCrop, int[]> items = new Dictionary<FarmCrop, int[]>();
List<FCrop> crops = Farming.ListCrops();
List<FLand> plots = Farming.ListFarmLand();
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Farming.FirstOrDefault(i => i.Id == Context.User.Id);
var buser = Database.Users.FirstOrDefault(i => i.Id == Context.User.Id);
if (user == null)
{
user = new Farming
{
Id = Context.User.Id
};
Database.Farming.Add(user);
await Database.SaveChangesAsync();
}
var plotinv = user.GetPlotInventory();
var cropinv = user.GetCropInventory();
string cropitemtxt = "";
string plotitemtxt = "";
FarmTier tier = (FarmTier)user.Tier;
foreach (FCrop i in crops)
{
if (i.Price != 0 && (int)tier >= (int)i.Tier)
{
cropitemtxt += $"{(int)i.Id} : {i.Name} Seed for {((long)i.Price).ToYeedraDisplay()}%\n";
}
}
foreach (FLand i in plots)
{
if (i.Price != 0 && (int)tier >= (int)i.Tier)
{
plotitemtxt += $"{(int)i.Id} : {i.Name} for {((long)i.Price).ToYeedraDisplay()}%\n";
}
}
input = input.ToLowerInvariant();
if (input == "manage" || input == "m")
{
await ReplyAsync($"{Context.User.Mention}\nSelect a farm");
var inp = await NextMessageAsync(timeout: TimeSpan.FromMinutes(2));
var inpsep = inp.Content.Split(" ");
}
else if (input == "seedmarket" || input == "sm")
{
await ReplyAsync($"{Context.User.Mention}\nSelect what you want to buy (id, amount).\n{cropitemtxt}");
var inp = await NextMessageAsync(timeout: TimeSpan.FromMinutes(2));
var inpsep = inp.Content.Split(" ");
FCrop crop = crops.FirstOrDefault(i => (int)i.Id == int.Parse(inpsep[0]));
items = user.GetCropInventory();
int[] amount = { 0 , 0 };
if (!items.TryGetValue(crop.Id, out amount))
{
amount = new int[] { 0, 0 };
items.Add(crop.Id, amount);
}
if (int.Parse(inpsep[1]) * crop.Price <= buser.Money)
{
amount[0] += int.Parse(inpsep[1]);
int count = int.Parse(inpsep[1]);
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThis will cost you {((long)(count * crop.Price)).ToYeedraDisplay()}.\nType 'ok' to confirm.");
inp = await NextMessageAsync();
if (inp.Content.ToLowerInvariant() == "ok")
{
if (!buser.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), -(count * crop.Price)))
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, buy more bait.");
return;
}
user.SetCropInventory(items);
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBought {count} of {crop.Name}.");
await Database.SaveChangesAsync();
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nPlease come back when you feel like spending.");
}
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nCome back when you're a little, MMMMMMmmmm, richer.");
}
}
else if (input == "propertymarket" || input == "pm")
{
FLand plot;
await ReplyAsync($"{Context.User.Mention}\nHere's a list of property you can buy right now.\n{plotitemtxt}");
var inp = await NextMessageAsync(timeout: TimeSpan.FromMinutes(2));
var inpsep = inp.Content.Split(" ");
}
else if (input == "hire" || input == "h")
{
string add = "";
int cap = (int)tier * 2 - user.EmployeeCount;
if ( cap > 0)
{
add += $"You can currently hire {cap} more farmer{(cap>1?"s":"")}.";
}
await ReplyAsync($"{Context.User.Mention}\nYou currently employ **{user.EmployeeCount} / {(int)tier*2}** farmers.\n{add}\nHow many farmers do you want to hire? (0-{(int)tier*2-user.EmployeeCount})");
var inp = await NextMessageAsync(timeout: TimeSpan.FromMinutes(2));
int numbie = int.Parse(inp.Content);
if (numbie > 0 && numbie * 100 + numbie * 100 * user.Tier < buser.Money)
{
}
else if (numbie * 100 + numbie * 100 * user.Tier > buser.Money)
{
await ReplyAsync($"{Context.User.Mention}\nCome back when you're a little, MMMMMMmmmm, richer.");
}
else
{
await ReplyAsync($"{Context.User.Mention}\nYou're poor haha loser haha");
}
}
else
{
await ReplyAsync($"Here's a list of arguments you can use:" +
$"\nmanage | m : manage a farm you own" +
$"\nseedmarket | sm : purchase seeds to use at your farm" +
$"\npropertymarket | pm : purchase new property to grow crops on" +
$"\nhire | h : hire workers for your farms");
}
}
}
} }
} }

@ -246,7 +246,7 @@ namespace Kehyeedra3.Commands
} }
else else
{ {
var dmchannel = await Bot._bot.GetUser(Context.User.Id).GetOrCreateDMChannelAsync(); var dmchannel = await Bot._bot.GetUser(Context.User.Id).CreateDMChannelAsync();
await dmchannel.SendMessageAsync($"**You literally just told me to DM you:**\n\n{r}"); await dmchannel.SendMessageAsync($"**You literally just told me to DM you:**\n\n{r}");
} }
} }
@ -381,7 +381,7 @@ namespace Kehyeedra3.Commands
[Command("changenick")] [Command("changenick")]
public async Task ChangeNickname(IGuildUser usr = null, [Remainder]string name = null) public async Task ChangeNickname(IGuildUser usr = null, [Remainder]string name = null)
{ {
if (Context.Guild.Id != 691361760300761139) if (Context.Guild.Id != 691361760300761139 && Context.Guild.Id != 912778610300039198)
{ {
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nWrong server retard"); await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nWrong server retard");
return; return;

@ -26,6 +26,33 @@ namespace Kehyeedra3
return numb.ToString("N4"); return numb.ToString("N4");
} }
public static ulong[] GetLevelXp(this ulong lvl)
{
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
lvl += 1;
ulong lvlXp = 50;
ulong lvlFloor = 0;
for (ulong i = 0; i < lvl; i++)
{
if (i <= lvl)
{
lvlXp += Convert.ToUInt64(Math.Round((lvlXp * 0.05d + 50d), 0, MidpointRounding.ToEven));
}
if (i == lvl - 2)
{
lvlFloor = lvlXp;
}
}
ulong[] numbies = new ulong[]
{
lvlXp,
lvlFloor
};
return numbies;
}
}
public static double Remap(this int value, double min1, double max1, double min2, double max2) public static double Remap(this int value, double min1, double max1, double min2, double max2)
=> ((double)value).Remap(min1, max1, min2, max2); => ((double)value).Remap(min1, max1, min2, max2);

@ -2,14 +2,17 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<AssemblyVersion>2020.5.2.0</AssemblyVersion> <AssemblyVersion>2020.5.2.0</AssemblyVersion>
<FileVersion>2020.5.2.0</FileVersion> <FileVersion>2020.5.2.0</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Discord.Addons.Interactive" Version="2.0.0" /> <PackageReference Include="Discord.Net.Labs.Commands" Version="2.3.4" />
<PackageReference Include="Discord.Net" Version="2.3.1" /> <PackageReference Include="Discord.Net.Labs.Core" Version="2.3.9-pre" />
<PackageReference Include="Discord.Net.Labs.Rest" Version="2.3.9-pre" />
<PackageReference Include="Discord.Net.Labs.Webhook" Version="2.3.3" />
<PackageReference Include="Discord.Net.Labs.WebSocket" Version="2.3.9-pre" />
<PackageReference Include="dotenv.net" Version="2.1.3" /> <PackageReference Include="dotenv.net" Version="2.1.3" />
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="7.23.3" /> <PackageReference Include="Magick.NET-Q16-AnyCPU" Version="7.23.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.11"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.11">
@ -19,6 +22,12 @@
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.2.4" /> <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.2.4" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Reference Include="Discord.Addons.Interactive">
<HintPath>Discord.Addons.Interactive.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="libsodium.dll"> <None Update="libsodium.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>

@ -0,0 +1,294 @@
// <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("20210806204446_FarmingA")]
partial class FarmingA
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.11")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Kehyeedra3.Services.Models.Farming", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<string>("CropInventory")
.HasColumnType("LONGTEXT");
b.Property<int>("EmployeeCount")
.HasColumnType("int");
b.Property<ulong>("FXp")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Lvl")
.HasColumnType("bigint unsigned");
b.Property<string>("PlotInventory")
.HasColumnType("LONGTEXT");
b.Property<ulong>("TXp")
.HasColumnType("bigint unsigned");
b.Property<int>("Tier")
.HasColumnType("int");
b.Property<ulong>("Xp")
.HasColumnType("bigint unsigned");
b.HasKey("Id");
b.ToTable("Farming");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.Fishing", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<ulong>("FXp")
.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.Mining", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<ulong>("LastMine")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Lvl")
.HasColumnType("bigint unsigned");
b.Property<ulong>("TXp")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Xp")
.HasColumnType("bigint unsigned");
b.HasKey("Id");
b.ToTable("Mining");
});
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<sbyte>("CurrentBattlefish")
.HasColumnType("TINYINT");
b.Property<string>("GeneralInventory")
.HasColumnType("LONGTEXT");
b.Property<long>("Money")
.HasColumnType("bigint");
b.Property<ulong>("OwnerId")
.HasColumnType("bigint unsigned");
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<sbyte>("FishType")
.HasColumnType("TINYINT");
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,47 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Kehyeedra3.Migrations
{
public partial class FarmingA : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<ulong>(
name: "OwnerId",
table: "Users",
nullable: false,
defaultValue: 0ul);
migrationBuilder.CreateTable(
name: "Farming",
columns: table => new
{
Id = table.Column<ulong>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Tier = table.Column<int>(nullable: false),
EmployeeCount = table.Column<int>(nullable: false),
Lvl = table.Column<ulong>(nullable: false),
Xp = table.Column<ulong>(nullable: false),
FXp = table.Column<ulong>(nullable: false),
TXp = table.Column<ulong>(nullable: false),
CropInventory = table.Column<string>(type: "LONGTEXT", nullable: true),
PlotInventory = table.Column<string>(type: "LONGTEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Farming", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Farming");
migrationBuilder.DropColumn(
name: "OwnerId",
table: "Users");
}
}
}

@ -17,6 +17,41 @@ namespace Kehyeedra3.Migrations
.HasAnnotation("ProductVersion", "3.1.11") .HasAnnotation("ProductVersion", "3.1.11")
.HasAnnotation("Relational:MaxIdentifierLength", 64); .HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Kehyeedra3.Services.Models.Farming", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<string>("CropInventory")
.HasColumnType("LONGTEXT");
b.Property<int>("EmployeeCount")
.HasColumnType("int");
b.Property<ulong>("FXp")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Lvl")
.HasColumnType("bigint unsigned");
b.Property<string>("PlotInventory")
.HasColumnType("LONGTEXT");
b.Property<ulong>("TXp")
.HasColumnType("bigint unsigned");
b.Property<int>("Tier")
.HasColumnType("int");
b.Property<ulong>("Xp")
.HasColumnType("bigint unsigned");
b.HasKey("Id");
b.ToTable("Farming");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.Fishing", b => modelBuilder.Entity("Kehyeedra3.Services.Models.Fishing", b =>
{ {
b.Property<ulong>("Id") b.Property<ulong>("Id")
@ -198,6 +233,9 @@ namespace Kehyeedra3.Migrations
b.Property<long>("Money") b.Property<long>("Money")
.HasColumnType("bigint"); .HasColumnType("bigint");
b.Property<ulong>("OwnerId")
.HasColumnType("bigint unsigned");
b.Property<string>("Username") b.Property<string>("Username")
.HasColumnType("longtext CHARACTER SET utf8mb4"); .HasColumnType("longtext CHARACTER SET utf8mb4");

@ -0,0 +1,115 @@
using Discord;
using Discord.Addons.Interactive;
using Discord.Commands;
using Discord.WebSocket;
using Kehyeedra3.Services.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kehyeedra3.Buttons
{
public static class ButtonService // button testing
{
public static void RegisterCumButtons(DiscordSocketClient client)
{
client.InteractionCreated += HandleCumButtons;
}
private static async Task HandleCumButtons(SocketInteraction arg)
{
if (arg.Type == InteractionType.MessageComponent)
{
var parsedArg = (SocketMessageComponent)arg;
switch (parsedArg.Data.CustomId)
{
case "cum":
{
await parsedArg.Message.ModifyAsync(z => { z.Components = null; });
await parsedArg.FollowupAsync("You have selected cum, prepare to die");
}
break;
case "piss":
{
await parsedArg.Message.ModifyAsync(z => { z.Components = null; });
await parsedArg.FollowupAsync("You have selected piss, prepare to shit");
}
break;
}
}
}
public static void RegisterFarmButtons(DiscordSocketClient client)
{
client.InteractionCreated += HandleFarmButtons;
}
private static async Task HandleFarmButtons(SocketInteraction arg)
{
if (arg.Type == InteractionType.MessageComponent)
{
var parsedArg = (SocketMessageComponent)arg;
Dictionary<FarmCrop, int[]> items = new Dictionary<FarmCrop, int[]>();
List<FCrop> crops = Farming.ListCrops();
List<FLand> plots = Farming.ListFarmLand();
FarmTier tier = FarmTier.T0;
string cropitemtxt = "";
string plotitemtxt = "";
switch (parsedArg.Data.CustomId)
{
//case "crop":
// {
// foreach (FCrop i in crops)
// {
// if (i.Price > 0 && (int)tier >= (int)i.Tier)
// {
// cropitemtxt += $"{(int)i.Id} : {i.Name} Seed for {((long)i.Price).ToYeedraDisplay()}%\n";
// }
// }
// await parsedArg.Message.ModifyAsync(z => { z.Components = null; });
// if (cropitemtxt != "")
// {
// await parsedArg.FollowupAsync($"Select an item\n{cropitemtxt}");
// }
// else
// {
// await parsedArg.FollowupAsync($"There is nothing you can buy right now.");
// }
// }
// break;
//case "plot":
// {
// foreach (FLand i in plots)
// {
// if (i.Price > 0 && (int)tier >= (int)i.Tier)
// {
// plotitemtxt += $"{(int)i.Id} : {i.Name} for {((long)i.Price).ToYeedraDisplay()}%\n";
// }
// }
// await parsedArg.Message.ModifyAsync(z => { z.Components = null; });
// if (plotitemtxt != "")
// {
// await parsedArg.FollowupAsync($"Select an item\n{plotitemtxt}");
// }
// else
// {
// await parsedArg.FollowupAsync($"There is nothing you can buy right now.");
// }
// }
// break;
}
}
}
}
}

@ -0,0 +1,240 @@
using System;
using System.Text;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace Kehyeedra3.Services.Models
{
public class Farming
{
[Key]
public ulong Id { get; set; } = 0;
public int Tier { get; set; } = 0;
public int EmployeeCount { get; set; } = 0;
public ulong Lvl { get; set; } = 0;
public ulong Xp { get; set; } = 50;
public ulong FXp { get; set; } = 0;
public ulong TXp { get; set; } = 0;
[Column(TypeName = "LONGTEXT")]
public string CropInventory { get; set; } = "{}";
[Column(TypeName = "LONGTEXT")]
public string PlotInventory { get; set; } = "{}";
public Dictionary<FarmCrop, int[]> GetCropInventory()
{
return JsonConvert.DeserializeObject<Dictionary<FarmCrop, int[]>>(CropInventory);
}
public Dictionary<FarmLand, int[]> GetPlotInventory()
{
return JsonConvert.DeserializeObject<Dictionary<FarmLand, int[]>>(PlotInventory);
}
public void SetCropInventory(Dictionary<FarmCrop, int[]> inv)
{
Dictionary<int, int[]> temp = new Dictionary<int, int[]>();
foreach (var entry in inv)
{
temp.Add((int)entry.Key, entry.Value);
}
CropInventory = JsonConvert.SerializeObject(temp);
}
public void SetPlotInventory(Dictionary<FarmLand, int[]> inv)
{
Dictionary<int, int[]> temp = new Dictionary<int, int[]>();
foreach (var entry in inv)
{
temp.Add((int)entry.Key, entry.Value);
}
PlotInventory = JsonConvert.SerializeObject(temp);
}
public static List<FCrop> ListCrops()
{
return new List<FCrop>
{
new FCrop()
{
Id = FarmCrop.Wheat,
Name = "Wheat",
Description = "Common wheat, 'Triticum aestivum' is the most widely grown cereal grain, you should get in on it before we reach peak wheat.",
Type = FarmType.Plant,
Tier = FarmTier.T0,
GrowTime = 10,
Price = 100,
},
new FCrop()
{
Id = FarmCrop.Rye,
Name = "Rye",
Description = "Rye, 'Secale cereale' is a hardy cereal grain, grows slower than wheat, but also tastes better.",
Type = FarmType.Plant,
Tier = FarmTier.T1,
GrowTime = 15,
Price = 150,
},
new FCrop()
{
Id = FarmCrop.Lettuce,
Name = "Lettuce",
Description = "Lettuce, 'Lactuca sativa' is an annual daisy plant first cultivated in ancient Egypt, worshipped as ancient viagra. Incidentally, it can be harvested very often.",
Type = FarmType.Plant,
Tier = FarmTier.T2,
GrowTime = 5,
Price = 200,
},
new FCrop()
{
Id = FarmCrop.Leek,
Name = "Leek",
Description = "Leek, 'Allium ampeloprasum' is an onion, the word leek is derived from the old english word 'leac', it has a medium growth time. I know what you're thinking about doing and I want you to stop right now.",
Type = FarmType.Plant,
Tier = FarmTier.T3,
GrowTime = 13,
Price = 250,
},
new FCrop()
{
Id = FarmCrop.Bookweed,
Name = "Bookweed",
Description = "Bookweed, 'Lactuca liber' is an enchanted variant of lettuce used for special crafting. Eating it by itself is said to give you diarrhea.",
Type = FarmType.Plant,
Tier = FarmTier.T4,
GrowTime = 50,
Price = 0,
},
new FCrop()
{
Id = FarmCrop.LuckyLeek,
Name = "Polkka",
Description = "Polkka, 'Allium dexter' is an enchanted variant of leek used for special crafting. It contains a natural power to spin, and can be used as a green energy source. If you're a huge faggot.",
Type = FarmType.Plant,
Tier = FarmTier.T5,
GrowTime = 50,
Price = 0,
},
};
}
public static List<FLand> ListFarmLand()
{
return new List<FLand>
{
new FLand()
{
Id = FarmLand.Backyard,
Name = "Backyard",
Type = FarmType.Plant,
Tier = FarmTier.T0,
WorkerMax = 1,
Price = 0
},
new FLand()
{
Id = FarmLand.SPlot,
Name = "Small Plot",
Type = FarmType.Plant,
Tier = FarmTier.T1,
WorkerMax = 2,
Price = 600
},
new FLand()
{
Id = FarmLand.MPlot,
Name = "Medium Plot",
Type = FarmType.Plant,
Tier = FarmTier.T3,
WorkerMax = 4,
Price = 1000
},
new FLand()
{
Id = FarmLand.LPlot,
Name = "Large Plot",
Type = FarmType.Plant,
Tier = FarmTier.T5,
WorkerMax = 6,
Price = 1400
},
};
}
}
public enum FarmLand
{
Backyard = 0,
Bathtub = 1,
SPlot = 2,
MPlot = 3,
LPlot = 4,
}
public enum FarmType
{
Plant = 0,
Fish = 1,
}
public enum FarmCrop
{
Wheat = 0,
Rye = 1,
Lettuce = 2,
Leek = 3,
LuckyLeek = 100,
Bookweed = 101,
}
public enum FarmTier
{
T0 = 0,
T1 = 1,
T2 = 2,
T3 = 3,
T4 = 4,
T5 = 5,
}
public class FLand
{
public FarmLand Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public FarmType Type { get; set; }
public FarmTier Tier { get; set; }
public int WorkerMax { get; set; }
public int Price { get; set; }
}
public class FCrop
{
public FarmCrop Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public FarmType Type { get; set; }
public FarmTier Tier { get; set; }
public int GrowTime { get; set; }
public int Price { get; set; }
}
public class PlotObject
{
[Key]
public ulong PlotId { get; set; } = 0;
[Required]
public ulong UserId { get; set; } = 0;
public ulong Planted { get; set; } = 0;
public ulong Grown { get; set; } = 0;
public int FarmType { get; set; } = 0;
public int WorkerAmount { get; set; } = 0;
}
public class FCropSlot
{
public int Id;
public int Seeds;
public int Produce;
}
public class FPlotSlot
{
public int Id;
public int Amount;
}
}

@ -276,6 +276,14 @@ namespace Kehyeedra3.Services.Models
Tier = FishTier.T2 Tier = FishTier.T2
}, },
new Fish() new Fish()
{
Id = FishSpecies.Wololo,
Name = "Wololo",
Rarity = FishRarity.Rare,
Tier = FishTier.T2
},
new Fish()
{ {
Id = FishSpecies.Gunfish, Id = FishSpecies.Gunfish,
Name = "Gunfish", Name = "Gunfish",
@ -444,6 +452,7 @@ namespace Kehyeedra3.Services.Models
//T2 Rare //T2 Rare
Swolefish = 21, Swolefish = 21,
Dogfish = 22, Dogfish = 22,
Wololo = 23,
//T2 Uncommon //T2 Uncommon
Gunfish = 30, Gunfish = 30,
Dingus = 31, Dingus = 31,

@ -16,6 +16,7 @@ namespace Kehyeedra3.Services.Models
public string GeneralInventory { get; set; } = "{}"; public string GeneralInventory { get; set; } = "{}";
[Column(TypeName = "TINYINT")] [Column(TypeName = "TINYINT")]
public BattleFish CurrentBattlefish { get; set; } = 0; public BattleFish CurrentBattlefish { get; set; } = 0;
public ulong OwnerId { get; set; } = 0;
@ -152,6 +153,7 @@ namespace Kehyeedra3.Services.Models
UpgradeT2 = 200, UpgradeT2 = 200,
UpgradeT3 = 201, UpgradeT3 = 201,
UpgradeT4 = 202, UpgradeT4 = 202,
} }
public class ItemSlot public class ItemSlot
{ {

@ -14,7 +14,7 @@ namespace Kehyeedra3.Services
private static async Task SendReminderAsync(Reminder reminder) private static async Task SendReminderAsync(Reminder reminder)
{ {
try { try {
var dmchannel = await Bot._bot.GetUser(reminder.UserId).GetOrCreateDMChannelAsync(); var dmchannel = await Bot._bot.GetUser(reminder.UserId).CreateDMChannelAsync();
if (dmchannel != null) if (dmchannel != null)
{ {
ulong m = (reminder.Send - reminder.Created) / 60; ulong m = (reminder.Send - reminder.Created) / 60;
@ -61,7 +61,7 @@ namespace Kehyeedra3.Services
catch { if (LanChannel is null) catch { if (LanChannel is null)
{ {
IUser Lan = Bot._bot.GetUser(242040333309837327); IUser Lan = Bot._bot.GetUser(242040333309837327);
LanChannel = await Lan.GetOrCreateDMChannelAsync(); LanChannel = await Lan.CreateDMChannelAsync();
} }
await LanChannel.SendMessageAsync($"Time of error ^\n" + await LanChannel.SendMessageAsync($"Time of error ^\n" +

Loading…
Cancel
Save