master
Lan 5 years ago
parent 24b3839947
commit c623734a72
  1. 13
      Kehyeedra3/Command handler.cs
  2. 154
      Kehyeedra3/Commands.cs
  3. 58
      Kehyeedra3/Event handlers.cs
  4. 6
      Kehyeedra3/Services/Models/Fishing.cs

@ -107,18 +107,19 @@ namespace Kehyeedra3
{ {
await context.Channel.SendMessageAsync($"B emoji detected. Proceed to kill yourself, {context.User.Mention}"); await context.Channel.SendMessageAsync($"B emoji detected. Proceed to kill yourself, {context.User.Mention}");
} }
var erole = context.Guild.GetRole(674970145268957194); var jrole = context.Guild.GetRole(375289794999091201);
var euser = await context.Guild.GetUserAsync(context.User.Id).ConfigureAwait(false); var euser = await context.Guild.GetUserAsync(context.User.Id).ConfigureAwait(false);
if (!euser.RoleIds.Any(id => id == 674970145268957194)) var jas = await context.Guild.GetUserAsync(236952555265982464).ConfigureAwait(false);
if (euser.RoleIds.Any(id => id == 682109241363922965))
{ {
if (message.Content.Contains("<@&674970145268957194>")) //everyone role if (message.Content.Contains("thot begone")) //add
{ {
await euser.AddRoleAsync(erole); await jas.AddRoleAsync(jrole);
} }
} }
if (message.Content.Contains("cock and ball torture is a sexual activity involving the torture of the male genitals")) //remove role if (message.Content.Contains("thot return")) //remove
{ {
await euser.RemoveRoleAsync(erole); await jas.RemoveRoleAsync(jrole);
} }
if (message.Content.ToLowerInvariant().Contains("jojo")) if (message.Content.ToLowerInvariant().Contains("jojo"))
{ {

@ -263,6 +263,34 @@ namespace Kehyeedra3
} }
await Context.Channel.SendMessageAsync($"{Context.User.Mention} Ok, I'll remind you in {d}d {h}h {m}m"); await Context.Channel.SendMessageAsync($"{Context.User.Mention} Ok, I'll remind you in {d}d {h}h {m}m");
} }
[Command("grant")]
public async Task Daycare(IGuildUser ouser)
{
var user = await Context.Guild.GetUserAsync(Context.User.Id).ConfigureAwait(false);
var drole = Context.Guild.GetRole(682109241363922965);
if (user.RoleIds.Any(id => id == 682109241363922965))
{
await ouser.AddRoleAsync(drole);
await user.RemoveRoleAsync(drole);
await Context.Channel.SendMessageAsync($"*{ouser.Mention} the power of daycare rests in the palm of your hands*");
}
else
{
await Context.Channel.SendMessageAsync($"HNNNNG you do not possess this power HNNNGGGG");
}
}
[Command("dab")]
public async Task Dab(IGuildUser user = null)
{
if (user == null)
{
await Context.Channel.SendMessageAsync($"You put a dab of creamy sauce on your delicious, crunchy fishstick.\nYou have gained +5 calories.");
}
else
{
await Context.Channel.SendMessageAsync($"You give your good friend {user.Mention} a dab of creamy sauce to enjoy with their delicious, crunchy fishstick.\n{user.Mention} has gained +5 calories.");
}
}
} }
public class Economy : ModuleBase<ICommandContext> public class Economy : ModuleBase<ICommandContext>
@ -351,25 +379,52 @@ namespace Kehyeedra3
FishSpecies.Blobfish, FishSpecies.Blobfish,
FishSpecies.Psychedelica FishSpecies.Psychedelica
}; };
readonly string[] rfishmotes = new string[]
{
"<:doomfish:651879988232060949>",
"<:missingRar:682586847100403715>[Clownfish]",
"<a:teracrableft:681872487901954123><a:teracrabright:681872487264681984>",
"<:missingRar:682586847100403715>[Blobfish]",
"<a:psychedelicaleft:682606276592664666><a:psychedelicaright:682606278354141249>"
};
readonly FishSpecies[] ufish = new FishSpecies[] readonly FishSpecies[] ufish = new FishSpecies[]
{ {
FishSpecies.Gigacrab, FishSpecies.Gigacrab,
FishSpecies.Frogfish, FishSpecies.Dopefish,
FishSpecies.Stargazer, FishSpecies.Stargazer,
FishSpecies.Isopod, FishSpecies.Isopod,
FishSpecies.Sheephead, FishSpecies.Sheephead,
}; };
readonly string[] ufishmotes = new string[]
{
"<:gigacrab:681871426382594208>",
"<:missingUnc:682586846857003064>[Dopefish]",
"<:missingUnc:682586846857003064>[Stargazer]",
"<:missingUnc:682586846857003064>[Isopod]",
"<:sheepheadleft:681200891810021376><:sheepheadright:681200891608563767>"
};
readonly FishSpecies[] cfish = new FishSpecies[] readonly FishSpecies[] cfish = new FishSpecies[]
{ {
FishSpecies.Cod, FishSpecies.Cod,
FishSpecies.Salmon, FishSpecies.Salmon,
FishSpecies.Bass, FishSpecies.Shrimp,
FishSpecies.Crayfish, FishSpecies.Crayfish,
FishSpecies.Betta, FishSpecies.Betta,
FishSpecies.Pufferfish, FishSpecies.Pufferfish,
FishSpecies.Carp, FishSpecies.Carp,
FishSpecies.Megacrab FishSpecies.Megacrab
}; };
readonly string[] cfishmotes = new string[]
{
"<:codleft:681182238448418891><:codright:681182238628511747>",
"<:missingCom:682586847079432217> [Salmon]",
"<:missingCom:682586847079432217> [Shrimp]",
"<:missingCom:682586847079432217> [Crayfish]",
"<:missingCom:682586847079432217> [Betta]",
"<:missingCom:682586847079432217> [Pufferfish]",
"<:missingCom:682586847079432217> [Carp]",
"<:megacrab:681871426319286302>"
};
readonly string o = "<:ye:677089325208305665>"; readonly string o = "<:ye:677089325208305665>";
readonly string n = "<:no:677091514249248778>"; readonly string n = "<:no:677091514249248778>";
readonly string ye = "<:ya:677179974154715146>"; readonly string ye = "<:ya:677179974154715146>";
@ -498,6 +553,7 @@ namespace Kehyeedra3
lastfish = user.LastFish; lastfish = user.LastFish;
totalXp = user.TXp; totalXp = user.TXp;
lvlXp = user.Xp; lvlXp = user.Xp;
await Database.SaveChangesAsync(); await Database.SaveChangesAsync();
} }
@ -506,36 +562,52 @@ namespace Kehyeedra3
if (lastfish < time) if (lastfish < time)
{ {
int rari = (SRandom.Next(0, 201)); int rari = (SRandom.Next(0, 201));
ulong rarity = level + (ulong)rari; int weight = SRandom.Next(1, 151);
ulong rarity;
if (level < 100)
{
rarity = level + (ulong)rari;
}
else
{
rarity = 100 + (ulong)rari;
}
FishRarity rarmult; FishRarity rarmult;
string rar = ""; string rar = "";
FishSpecies fish ; FishSpecies fish;
if (rarity > 180) string emote = "";
if (rarity > 200)
{ {
rar = "*Rare*"; rar = "*Rare*";
rarmult = FishRarity.Rare; rarmult = FishRarity.Rare;
int num = SRandom.Next(rfish.Length); int num = SRandom.Next(rfish.Length);
fish = rfish[num]; fish = rfish[num];
xp = 3; emote = rfishmotes[num];
xp = 20;
} }
else else
{ {
if (rarity > 120) if (rarity > 180)
{ {
rar = "*Uncommon*"; rar = "*Uncommon*";
rarmult = FishRarity.Uncommon; rarmult = FishRarity.Uncommon;
int num = SRandom.Next(ufish.Length); int num = SRandom.Next(ufish.Length);
fish = ufish[num]; fish = ufish[num];
xp = 2; emote = ufishmotes[num];
xp = 10;
} }
else else
{ {
if (rarity == 77) if (rarity == 207)
{ {
rar = "***Legendary***"; rar = "***Legendary***";
rarmult = FishRarity.Legendary; rarmult = FishRarity.Legendary;
fish = FishSpecies.LuckyCatfish; fish = FishSpecies.LuckyCatfish;
xp = 7; weight = SRandom.Next(200, 4001);
emote = "<a:catfishleft:682655661422542888><a:catfishright:682655661481525284>";
xp = 100;
} }
else else
{ {
@ -543,20 +615,20 @@ namespace Kehyeedra3
rarmult = FishRarity.Common; rarmult = FishRarity.Common;
int num = SRandom.Next(cfish.Length); int num = SRandom.Next(cfish.Length);
fish = cfish[num]; fish = cfish[num];
xp = 1; emote = cfishmotes[num];
xp = 5;
} }
} }
} }
int weight = SRandom.Next(1, 151);
FishWeight size; FishWeight size;
if (weight >= 75) if (weight >= 75)
{ {
size = FishWeight.Medium; size = FishWeight.Medium;
if (weight >= 100) if (weight >= (100-Convert.ToInt32(level)))
{ {
weight = SRandom.Next(1, 201); weight = SRandom.Next(100, 201);
} }
} }
else else
@ -564,16 +636,27 @@ namespace Kehyeedra3
size = FishWeight.Small; size = FishWeight.Small;
} }
if (weight >= 150 || rarmult == FishRarity.Legendary) if (weight >= 150)
{ {
size = FishWeight.Large; size = FishWeight.Large;
} }
string lvlUp = "";
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
user.LastFish = time;
await Database.SaveChangesAsync().ConfigureAwait(false);
}
if (rarity > 20) if (rarity > 20)
{ {
ulong toNextLvl = 0;
using (var Database = new ApplicationDbContextFactory().CreateDbContext()) using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{ {
var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id); var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
if (inv.Any(x => x.Fish.Species == fish && x.Fish.Weight == size && x.Fish.Rarity == rarmult)) if (inv.Any(x => x.Fish.Species == fish && x.Fish.Weight == size && x.Fish.Rarity == rarmult))
{ {
inv.FirstOrDefault(x => x.Fish.Species == fish && x.Fish.Weight == size && x.Fish.Rarity == rarmult).Amount += 1; inv.FirstOrDefault(x => x.Fish.Species == fish && x.Fish.Weight == size && x.Fish.Rarity == rarmult).Amount += 1;
@ -594,14 +677,36 @@ namespace Kehyeedra3
user.SetInventory(inv); user.SetInventory(inv);
user.LastFish = time;
user.TXp += xp; user.TXp += xp;
toNextLvl = user.Xp - user.TXp;
if (user.TXp >= user.Xp)
{
user.Lvl += 1;
lvlXp = 50;
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;
toNextLvl = user.Xp - user.TXp;
level = user.Lvl;
lvlUp = $"**You leveled up!** You are now **Level {level}**";
}
else
{
lvlUp = $"You need **{toNextLvl}**xp more to reach Level **{level + 1}**";
}
await Database.SaveChangesAsync().ConfigureAwait(false); // :] await Database.SaveChangesAsync().ConfigureAwait(false); // :]
} }
await Context.Channel.SendMessageAsync($"{Context.User.Mention} You have caught a {weight / 10d}kg **{fish}**, rarity: {rar}"); await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n {emote} You have caught a {weight / 10d}kg **{fish}**, rarity: {rar}\nYou gain **{xp}**xp.\n{lvlUp}");
} }
else else
{ {
@ -610,7 +715,7 @@ namespace Kehyeedra3
} }
else else
{ {
await Context.Channel.SendMessageAsync($"{Context.User.Mention} arrrrr-right you scurby bastard, I know you're eager to scour the seven seas but you need to wait till the next minute to access the treasure cove'o'tha depths"); await Context.Channel.SendMessageAsync($"{Context.User.Mention} arrrrr-right, ye scurby bastard, I know yer eager t' scour the seven seas but ye needs t' wait till the next minute t' pillage the booty'o'the depths, savvy?");
} }
} }
@ -642,16 +747,17 @@ namespace Kehyeedra3
if(inv.Any()) if(inv.Any())
{ {
EmbedBuilder embed = new EmbedBuilder(); EmbedBuilder embed = new EmbedBuilder
{
embed.Description = $"{Context.User.Mention}'s Inventory"; Description = $"{Context.User.Mention}'s Inventory"
};
inv.ForEach(x => inv.ForEach(x =>
{ {
embed.AddField(x.Fish.ToString(), x.Amount.ToString(), true); string content = $"{x.Fish.Weight.ToString()} {x.Fish.Species.ToString()} ";
embed.AddField(content, x.Amount.ToString(), true);
}); });
//fishgohere
await Context.Channel.SendMessageAsync(embed: embed.Build()).ConfigureAwait(false); await Context.Channel.SendMessageAsync(embed: embed.Build()).ConfigureAwait(false);
} }
else else

@ -10,7 +10,7 @@ namespace Kehyeedra3
public static void InstallEventHandlers() public static void InstallEventHandlers()
{ {
_bot.Log += _bot_Log; _bot.Log += _bot_Log;
_bot.UserVoiceStateUpdated += _bot_UserVoiceStateUpdated; //_bot.UserVoiceStateUpdated += _bot_UserVoiceStateUpdated;
_cmds.CommandExecuted += _cmds_CommandExecuted; _cmds.CommandExecuted += _cmds_CommandExecuted;
} }
@ -30,34 +30,34 @@ namespace Kehyeedra3
} }
//voice join/leave add/remove role //voice join/leave add/remove role
static async Task _bot_UserVoiceStateUpdated(Discord.WebSocket.SocketUser arg1, Discord.WebSocket.SocketVoiceState arg2, Discord.WebSocket.SocketVoiceState arg3) //static async Task _bot_UserVoiceStateUpdated(Discord.WebSocket.SocketUser arg1, Discord.WebSocket.SocketVoiceState arg2, Discord.WebSocket.SocketVoiceState arg3)
{ //{
if (!arg1.IsBot) // if (!arg1.IsBot)
{ // {
if (arg2.VoiceChannel == null && arg3.VoiceChannel != null) // if (arg2.VoiceChannel == null && arg3.VoiceChannel != null)
{ // {
IGuild guild = arg3.VoiceChannel.Guild; // IGuild guild = arg3.VoiceChannel.Guild;
if (guild.Id == 296739813380587521) // if (guild.Id == 296739813380587521)
{ // {
Console.WriteLine($"{arg1.Username} joined voice on Gulag"); // Console.WriteLine($"{arg1.Username} joined voice on Gulag");
var role = guild.GetRole(411185260819251211); // var role = guild.GetRole(411185260819251211);
var user = await guild.GetUserAsync(arg1.Id); // var user = await guild.GetUserAsync(arg1.Id);
await user.AddRoleAsync(role); // await user.AddRoleAsync(role);
} // }
} // }
if (arg2.VoiceChannel != null && arg3.VoiceChannel == null) // if (arg2.VoiceChannel != null && arg3.VoiceChannel == null)
{ // {
IGuild guild = arg2.VoiceChannel.Guild; // IGuild guild = arg2.VoiceChannel.Guild;
if (guild.Id == 296739813380587521) // if (guild.Id == 296739813380587521)
{ // {
Console.WriteLine($"{arg1.Username} left voice on Gulag"); // Console.WriteLine($"{arg1.Username} left voice on Gulag");
var role = guild.GetRole(411185260819251211); // var role = guild.GetRole(411185260819251211);
var user = await guild.GetUserAsync(arg1.Id); // var user = await guild.GetUserAsync(arg1.Id);
await user.RemoveRoleAsync(role); // await user.RemoveRoleAsync(role);
} // }
} // }
} // }
} //}
private static Task _bot_Log(LogMessage message) private static Task _bot_Log(LogMessage message)
{ {

@ -8,7 +8,7 @@ namespace Kehyeedra3.Services.Models
{ {
public ulong Id { get; set; } = 0; // this is userid incase you get alzheimers you stupid baby waa waa public ulong Id { get; set; } = 0; // this is userid incase you get alzheimers you stupid baby waa waa
public ulong LastFish { get; set; } = 0; public ulong LastFish { get; set; } = 0;
public ulong Xp { get; set; } = 0; public ulong Xp { get; set; } = 50;
public ulong TXp { get; set; } = 0; public ulong TXp { get; set; } = 0;
public ulong Lvl { get; set; } = 0; public ulong Lvl { get; set; } = 0;
@ -49,7 +49,7 @@ namespace Kehyeedra3.Services.Models
Psychedelica = 6, Psychedelica = 6,
//uncommon //uncommon
Gigacrab = 7, Gigacrab = 7,
Frogfish = 8, Dopefish = 8,
Stargazer = 9, Stargazer = 9,
Isopod = 10, Isopod = 10,
Sheephead = 11, Sheephead = 11,
@ -57,7 +57,7 @@ namespace Kehyeedra3.Services.Models
Cod = 12, Cod = 12,
Salmon = 13, Salmon = 13,
Pufferfish = 14, Pufferfish = 14,
Bass = 15, Shrimp = 15,
Crayfish = 16, Crayfish = 16,
Betta = 17, Betta = 17,
Carp = 18, Carp = 18,

Loading…
Cancel
Save