I don't even know what I changed

I should be pushing updates much more often
This commit is contained in:
Lan
2021-11-29 02:33:30 +02:00
parent 55fc6f4842
commit 81ec4922bf
17 changed files with 1023 additions and 73 deletions

View File

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

View File

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

View File

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

View File

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

View File

@@ -14,7 +14,7 @@ namespace Kehyeedra3.Services
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).CreateDMChannelAsync();
if (dmchannel != null)
{
ulong m = (reminder.Send - reminder.Created) / 60;
@@ -61,7 +61,7 @@ namespace Kehyeedra3.Services
catch { if (LanChannel is null)
{
IUser Lan = Bot._bot.GetUser(242040333309837327);
LanChannel = await Lan.GetOrCreateDMChannelAsync();
LanChannel = await Lan.CreateDMChannelAsync();
}
await LanChannel.SendMessageAsync($"Time of error ^\n" +