oh yeah woo yeah
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1809 lines
74 KiB

5 years ago
using Discord;
using Discord.Addons.Interactive;
using Discord.Commands;
using Kehyeedra3.Services.Models;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Storage;
5 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ImageMagick;
using System.Threading.Channels;
5 years ago
using System.Threading.Tasks;
using Kehyeedra3.Preconditions;
using System.IO;
5 years ago
namespace Kehyeedra3.Commands
{
5 years ago
public class Economy : InteractiveBase<SocketCommandContext>
{
readonly string[] ores = new string[]
{
"**Gold**,",
"**Platinum**,",
"a **Windows Update**,",
5 years ago
"a ticking **Time Bomb**,",
"an **Amethyst**,",
"the **Bone Stone**,",
5 years ago
"a **Hotdog**,",
"**Corundum**,",
"**Quartz**,",
"**Lithium**,",
"**Stone**,",
"a lost **Tribe of Ethiopians**,",
"**Beryllium**,",
"**Gallium**,",
"an **Amber**,",
"**Bismuth**,",
5 years ago
"an **Emerald**,",
"a lost **Sock**,",
"**Tellurium**,",
"**Bad Apple**,",
5 years ago
"a **Glass of Water**,",
"**Redstone**,",
"**Racism**,",
"**Bronze Ore**,",
"**Chlorophyte**,",
"a **Mysterious Artifact of Great Power**,",
"**Goblite**,",
"**Ligmanite**,",
"**Ramen's Friendship**,",
"an unidentified **Skeleton**,",
"a piece of **Gravel**,",
"**Copper**,",
"**Volatile Motes**,",
"a **Diamond**,",
"a **Girlfriend**,",
"**Thorium**,",
"a **Fresh Apple**,",
"**Raid Shadow Legends** sponsorship money,",
"a **Boot**,",
"**Runite**,",
"a **WinRAR license key**,",
"a **Viet Cong Tunnel**,",
"a single unit of several **Trees**,",
"**1,000,000₩**,",
"a **Cunny Rabbit**,",
5 years ago
"a **Rock Golem**,",
"a piece of **Toast**,",
"**Luminite**,",
"a **Funky Lava Lamp**,",
"the **Cum Chalice**, you raise a toast to Nick.",
"a **#%**,",
"the **Master Sword**,",
"your **True Calling in Life**,",
"the **Ocarina of Time**,",
"**Phosphophyllite**,",
"a **Brain**,",
"**Tom's Penis**,",
"**Oil**,",
"a **Can of Peaches**,",
"a **Used Deodorant Stick**,"
};
readonly string[] discards = new string[]
{
"you presume it is worthless and toss it away",
"you drop it and lose it",
"a vicious furry takes it from you",
"it appears to have vanished",
"but it seems like you were hallucinating",
"but it is seized by the communists",
"you mistake it for a chance to succeed in life and throw it away",
"you get scared and curb stomp it, shattering it",
"the **Goblins** claim rightful possession of it"
};
readonly string o = "<:ye:677089325208305665>";
readonly string n = "<:no:677091514249248778>";
readonly string ye = "<:ya:677179974154715146>";
[Command("mine"), Ratelimit(10, 2, Measure.Minutes), Summary("Mines %coins.")]
5 years ago
public async Task Mine()
{
ulong time = ulong.Parse(DateTime.Now.ToString("yyyyMMddHHmm"));
ulong lastmine;
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id);
var muser = Database.Mining.FirstOrDefault(x => x.Id == Context.User.Id);
if (muser == null)
{
muser = new Mining
{
Id = Context.User.Id
};
Database.Mining.Add(muser);
}
lastmine = muser.LastMine;
muser.LastMine = time;
user.Username = Context.User.Username;
if (lastmine < time)
{
int res = SRandom.Next((int)muser.Lvl, 101);
long end = 0;
string marks = $"{n}{n}{n}";
int num = SRandom.Next(ores.Length);
int numd = SRandom.Next(discards.Length);
string bns = "";
string lucky = "";
string ore = ores[num];
string discard = discards[numd];
if (res >= 20)
5 years ago
{
res += SRandom.Next(0, 101);
5 years ago
end = 2;
marks = $"{o}{n}{n}";
if (res >= 100)
5 years ago
{
res += SRandom.Next(0, 101);
end += 2;
marks = $"{o}{o}{n}";
if (res >= 200)
5 years ago
{
res = SRandom.Next(0, 6) * 4;
marks = $"{o}{o}{o}";
string bonus = "";
end += (long)res + 3;
for (int i = 0; i < 5; i++)
{
if (i < res / 4)
{
bonus += $"{ye}";
}
else
{
bonus += $"{n}";
}
}
bns = $" **+** {bonus}";
if (res == 0)
5 years ago
{
lucky = $" **Lucky strike!** Bonus: {ore}";
5 years ago
}
else
{
lucky = $" **Lucky strike!** Bonus: {res},";
5 years ago
}
}
}
}
string levelup = $"\nYou gain **{end+1}**xp.\n";
muser.TXp += (ulong)end+1;
if (muser.TXp >= muser.Xp)
{
muser.Lvl += 1;
muser.Xp = muser.Lvl.GetLevelXp()[0];
levelup += $"You leveled up. You are now **Lvl {muser.Lvl}**";
}
else
{
levelup += $"You need **{muser.Xp - muser.TXp}**xp more to reach Lvl **{muser.Lvl+1}**";
}
5 years ago
if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), end))
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, buy more bait.");
return;
5 years ago
}
await Database.SaveChangesAsync();
if (end <= 0)
{
await Context.Channel.SendMessageAsync($"{marks}\n{Context.User.Mention} You have found {ore} {discard}.{levelup}");
}
else
{
await Context.Channel.SendMessageAsync($"{marks}{bns}\n{Context.User.Mention}{lucky}\nYou earned **{end.ToYeedraDisplay()}**%{levelup}");
}
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention} wait 1 minute ok next minute yeah? yeah buddy?");
5 years ago
}
}
}
[Command("fish"), Ratelimit(6, 2, Measure.Minutes), Summary("Cast your line into the abyss, see if something bites?")]
public async Task FishCommand(string nocard = "")
5 years ago
{
ulong time = ulong.Parse(DateTime.Now.ToString("yyyyMMddHHmm"));
ulong totalXp = 0;
ulong xp = 0;
ulong level = 0;
ulong lvlXp = 0;
int prestige = 0;
int rod = 0;
int BigBait = 0;
int RareBait = 0;
int SpecialBait = 0;
int Lettuce = 0;
5 years ago
Dictionary<FishSpecies, int[]> inv = new Dictionary<FishSpecies, int[]>();
5 years ago
List<Fish> fishes = Fishing.GetFishList();
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
var guser = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id);
5 years ago
if (user == null)
{
{
user = new Fishing
{
Id = Context.User.Id,
};
Database.Fishing.Add(user);
}
}
else
{
inv = user.GetInventory();
}
if (user.LastFish >= time)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\narrrrr-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?");
return;
}
if (guser.GeneralInventory == null)
{
guser.GeneralInventory = "{}";
}
Dictionary<Items, int[]> items = new Dictionary<Items, int[]>();
items = guser.GetGenInve();
int[] subtract = { 0 };
subtract[0] = -1;
if (items.TryGetValue(Items.SpecialBait, out int[] SpecB))
{
SpecialBait = SpecB[0];
BigBait = SpecB[0];
RareBait = SpecB[0];
if (SpecialBait > 0)
{
SpecB[0] -= 1;
}
else
{
if (items.TryGetValue(Items.BigBait, out int[] BigB))
{
BigBait = BigB[0];
if (BigBait > 0)
{
BigB[0] -= 1;
}
}
if (items.TryGetValue(Items.RareBait, out int[] RareB))
{
RareBait = RareB[0];
if (RareBait > 0)
{
RareB[0] -= 1;
}
}
}
}
if (items.TryGetValue(Items.Lettuce, out int[] Lettu))
{
Lettuce = Lettu[0];
if (Lettuce > 0)
{
Lettu[0] -= 1;
}
}
guser.SetGenInve(items);
5 years ago
level = user.Lvl;
totalXp = user.TXp;
lvlXp = user.Xp;
rod = user.RodUsed;
prestige = user.Prestige;
5 years ago
await Database.SaveChangesAsync();
}
int rari = SRandom.Next(0, 2001);
int weigh = SRandom.Next(10, 1501+prestige*500);
int tierRoll = SRandom.Next(0, (20*rod)+(10*prestige)+11);
int dCatchRoll = SRandom.Next(1, 1000)+prestige*20;
int dcatch = 1;
int rarity;
int weight;
bool bBig = false;
bool bRar = false;
bool bSpe = false;
bool bLet = false;
if (dCatchRoll > 1000)
{
int many = 1020;
dcatch += 1;
while (many < dCatchRoll)
{
dcatch += 1;
many += 10+(dcatch*5);
}
}
5 years ago
if (level < 100 && prestige == 0)
{
rarity = (int)level * 10 + rari;
weight = (int)level * 5 + weigh;
}
else if (level < 100 && prestige == 1)
{
rarity = 1000 + rari;
weight = (int)level * 3 + 500 + weigh;
}
else if (level >= 100 && prestige > 1)
{
rarity = 1000 + rari;
weight = 800 + weigh;
}
else
{
rarity = 1000 + rari;
weight = 500 + weigh;
}
if (BigBait > 0)
{
weight += 1000;
bBig = true;
}
if (RareBait > 0)
{
rarity += 500;
bRar = true;
}
if (SpecialBait > 0)
{
bSpe = true;
}
if (Lettuce > 0)
{
bLet = true;
}
5 years ago
if (bSpe || bRar)
{
tierRoll += 10;
}
Fish fish;
List<Fish> fishTiers;
List<Fish> fishRarities = fishes.ToList();
FishTier ftier;
if (tierRoll > 60 && rod >= 3)
{
fishTiers = fishes.Where(f => f.Tier == FishTier.T4).ToList();
ftier = FishTier.T4;
}
else if (tierRoll > 40 && rod >= 2)
{
fishTiers = fishes.Where(f => f.Tier == FishTier.T3).ToList();
ftier = FishTier.T3;
}
else if (tierRoll > 20 && rod >= 1)
{
fishTiers = fishes.Where(f => f.Tier == FishTier.T2).ToList();
ftier = FishTier.T2;
}
else
{
fishTiers = fishes.Where(f => f.Tier == FishTier.T1).ToList();
ftier = FishTier.T1;
}
5 years ago
if (rarity == 777 || (rarity > 2060 && rarity <= 2070) || rarity == 2777 || rarity > 2500 && rarity < 2510 && bRar ||rarity > 2510 && rarity < 2520 && bSpe)
5 years ago
{
fishRarities = fishTiers.Where(f => (int)f.Rarity == (int)FishRarity.Legendary).ToList();
int wRoll = SRandom.Next(0, 101);
switch (ftier)
5 years ago
{
case FishTier.T1:
{
xp = 10;
}
break;
case FishTier.T2:
{
xp = 15;
}
break;
case FishTier.T3:
{
xp = 20;
}
break;
case FishTier.T4:
{
xp = 25;
}
break;
5 years ago
}
if (rarity == 777 || rarity == 1777 || rarity == 2777)
{
xp = 77 + Convert.ToUInt64(77 * rod / 2);
}
if (wRoll == 77 && bSpe)
5 years ago
{
fishRarities = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Unreasonable).ToList();
xp = 7777;
5 years ago
}
}
else if (rarity > 1700)
{
fishRarities = fishTiers.Where(f => (int)f.Rarity == (int)FishRarity.Uncommon).ToList();
switch (ftier)
{
case FishTier.T1:
{
xp = 10;
}
break;
case FishTier.T2:
{
xp = 13;
}
break;
case FishTier.T3:
{
xp = 16;
}
break;
case FishTier.T4:
{
xp = 20;
}
break;
}
rarity = SRandom.Next(1700, 2801);
if (bRar || bSpe)
5 years ago
{
rarity += 200;
}
if (rarity > 2600)
5 years ago
{
fishRarities = fishTiers.Where(f => (int)f.Rarity == (int)FishRarity.Rare).ToList();
switch (ftier)
{
case FishTier.T1:
{
xp = 20;
}
break;
case FishTier.T2:
{
xp = 25;
}
break;
case FishTier.T3:
{
xp = 30;
}
break;
case FishTier.T4:
{
xp = 35;
}
break;
}
5 years ago
}
}
else
{
fishRarities = fishTiers.Where(f => (int)f.Rarity == (int)FishRarity.Common).ToList();
switch (ftier)
5 years ago
{
case FishTier.T1:
{
xp = 5;
}
break;
case FishTier.T2:
{
xp = 7;
}
break;
case FishTier.T3:
{
xp = 9;
}
break;
case FishTier.T4:
{
xp = 11;
}
break;
}
}
fish = fishRarities[SRandom.Next(fishRarities.Count)];
FishSize size;
if (weight >= (1000 - Convert.ToInt32(level * 2))) //second weight roll
{
if (level < 100)
{
weight = SRandom.Next(300, 2001 + prestige * 500) + Convert.ToInt32(level * 5);
}
else
{
weight = SRandom.Next(300, 2001 + prestige * 500) + 500;
}
}
if (fish.Rarity == FishRarity.Legendary)
{
weight = SRandom.Next(2000 + Convert.ToInt32(level * 20), 40001 + prestige * 10000);
}
if (bBig)
{
weight += 500;
}
if (fish.Rarity == FishRarity.Unreasonable)
{
weight = SRandom.Next(4000, 6000);
}
if (weight >= 1000)
{
if (weight >= 1500)
{
size = FishSize.Large;
5 years ago
}
else
{
size = FishSize.Medium;
5 years ago
}
double w = Convert.ToDouble(weight);
xp = Convert.ToUInt64(Math.Round(xp * w / 1000, 0, MidpointRounding.ToEven))*(ulong)dcatch;
5 years ago
if (fish.Rarity == FishRarity.Legendary)
5 years ago
{
if (xp < 50+50*(ulong)fish.Tier)
{
xp = 50+50*(ulong)fish.Tier;
}
5 years ago
}
}
else
{
size = FishSize.Small;
}
if (bLet)
{
xp = Convert.ToUInt64(Math.Round(xp * 1.1, 0, MidpointRounding.ToEven));
}
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);
}
5 years ago
if (rarity > 200)
{
ulong toNextLvl = 0;
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
5 years ago
{
var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
5 years ago
inv = user.GetInventory();
5 years ago
int[] amounts;
if (!inv.TryGetValue(fish.Id, out amounts))
{
amounts = new int[] { 0, 0, 0 };
inv.Add(fish.Id, amounts);
}
5 years ago
int sizeIndex = (int)size;
amounts[sizeIndex] += dcatch;
5 years ago
user.SetInventory(inv);
5 years ago
user.TXp += xp;
5 years ago
toNextLvl = user.Xp - user.TXp;
int times = 0;
if (user.TXp > 50 && user.FXp == 0)
{
ulong[] result = user.Lvl.GetLevelXp();
lvlXp = result[0];
user.FXp = result[1];
}
if (user.TXp >= user.Xp)
{
ulong[] result = user.Lvl.GetLevelXp();
ulong leXp = result[0];
bool leTrig = false;
if (leXp != user.Xp)
{
user.Lvl = 0;
user.Xp = 0;
leTrig = true;
}
while (user.TXp >= user.Xp)
{
times += 1;
lvlXp = 50;
result = user.Lvl.GetLevelXp();
user.Lvl += 1;
lvlXp = result[0];
user.FXp = result[1];
user.Xp = lvlXp;
}
toNextLvl = user.Xp - user.TXp;
level = user.Lvl;
if (leTrig)
{
lvlUp = $"**Your level was recalculated to match \nyour xp.** You are now **Level {level}**";
}
else if (times > 1)
{
lvlUp = $"**You leveled up {times} times!** \nYou are now **Level {level}.**";
5 years ago
}
else
{
lvlUp = $"**You leveled up!** \nYou are now **Level {level}**";
5 years ago
}
}
else
{
lvlUp = $"You need **{toNextLvl}**xp to reach Level **{level + 1}**";
}
await Database.SaveChangesAsync().ConfigureAwait(false);
string baited = "";
string baiRa = "";
string baiBi = "";
string baiLe = "";
if (bRar || bBig)
{
baited += "\nYou used bait. ";
if (bRar)
{
baiRa = "(+)";
}
if (bBig)
{
baiBi = "(+)";
}
}
if (bLet)
{
baited += "\nYou ate lettuce. ";
baiLe = "(+10%)";
}
if (nocard.ToLowerInvariant() != "nocard")
{
var (cardCollection, outFormatEnum, outFormat) = await Helpers.MakeFishCardAsync(fish, user.TXp, user.FXp, user.Xp, lvlUp, weight, xp, dcatch, bRar, bBig, bLet);
MemoryStream outputStream = new MemoryStream();
cardCollection.Write(outputStream, outFormatEnum);
outputStream.Position = 0;
await Context.Channel.SendFileAsync(outputStream, $"fish.{outFormat}", $"{Context.User.Mention}");
}
else
{
if (dcatch == 1)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}{baited}\n{fish.Emote} You have caught a {weight / 100d}kg{baiBi} **{fish.Name}**, rarity: {fish.Rarity}{baiRa}\nYou gain **{xp}**xp{baiLe}.\n{lvlUp}");
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}{baited}\n{fish.Emote} You have caught **{dcatch}** {weight / 100d}kg{baiBi} **{fish.Name}**, rarity: {fish.Rarity}{baiRa}\nYou gain **{xp}**xp{baiLe}.\n{lvlUp}");
}
}
}
5 years ago
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYour line snaps. Your disappointment is immeasurable, and your day is ruined.");
5 years ago
}
}
[Command("checkrod"),Summary("Displays what fishing rods you can use, as well as your currently equipped fishing rod.")]
public async Task CheckRod()
{
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
if (user == null)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't own any fishing rods. Try **fishing**.");
return;
}
string rodtype;
if (user.RodUsed == 0)
{
rodtype = "Basic";
}
else if (user.RodUsed == 1)
{
rodtype = "Reinforced";
}
else if (user.RodUsed == 2)
{
rodtype = "Spectral";
}
else if (user.RodUsed == 3)
{
rodtype = "Cosmic";
}
else
{
rodtype = "Currently unobtainable";
}
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou have unlocked fishing rods up to **Tier {user.RodOwned+1}**\nYou have currently equipped a **{rodtype} Fishing Rod** (T{user.RodUsed+1}).");
}
}
[Command("setrod"),Summary("Set your fishing rod to the desired tier (for example: 'setrod 1' to set to default rod.)")]
public async Task SetRod(byte tier)
{
if (tier < 1)
{
tier = 1;
}
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
if (user == null)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't own any fishing rods. Try **fishing**.");
return;
}
if ((tier - 1) <= user.RodOwned)
{
user.RodUsed = Convert.ToByte(tier - 1);
string rodtype = "";
if (tier == 1)
{
rodtype = "Basic";
}
else if (tier == 2)
{
rodtype = "Reinforced";
}
else if (tier == 3)
{
rodtype = "Spectral";
}
else if (tier == 4)
{
rodtype = "Cosmic";
}
else
{
rodtype = "Currently unobtainable";
}
await Context.Channel.SendMessageAsync($"You are now using a **{rodtype} Fishing Rod** (T{tier}).");
}
else
{
await Context.Channel.SendMessageAsync($"You don't have that rod. You own rods up to **Tier {user.RodOwned+1}**.");
}
await Database.SaveChangesAsync().ConfigureAwait(false);
}
}
[Command("craft", RunMode = RunMode.Async), Alias("c"), Summary("Specify 'r' to refine ingredients.")]
public async Task Crafting(string option = null)
{
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var fuser = Database.Fishing.FirstOrDefault(i => i.Id == Context.User.Id);
var user = Database.Users.FirstOrDefault(i => i.Id == Context.User.Id);
if (fuser == null || fuser.Lvl < 30)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou can't craft anything yet.\nCome back when you reach **Lvl 30**.");
return;
}
var finv = fuser.GetInventory();
var items = user.GetGenInve();
if (!items.TryGetValue(Items.UpgradeT2, out int[] T2Up))
{
T2Up = new int[] { 0 };
items.Add(Items.UpgradeT2, T2Up);
}
if (!items.TryGetValue(Items.RodFrame, out int[] Rod))
{
Rod = new int[] { 0 };
items.Add(Items.RodFrame, Rod);
}
if (option != null && option.ToLowerInvariant().Contains("r")) //finish this area up retard
{
var fish = finv.FirstOrDefault(f => f.Key == FishSpecies.LuckyCatfish).Value[(int)FishSize.Large];
if (fish < 1 || user.Money < 1000)
{
string missing = "";
if (fish < 1)
{
missing += "a **Lucky Catfish**";
}
if (fish < 1 && user.Money < 1000)
{
missing += " & ";
}
else
{
missing += " ";
}
if (user.Money < 1000)
{
missing += $"**{(1000 - user.Money).ToYeedraDisplay()}%**";
}
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou are missing {missing}.");
return;
}
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nProcess 1 **Lucky Catfish** for **0.1000%**? \n(Owned: {fish})\nType 'yes' to continue.");
var inp = await NextMessageAsync();
if (inp.Content.ToLowerInvariant().Contains("yes"))
{
if (finv.TryGetValue(FishSpecies.LuckyCatfish, out int[] Fesh))
{
Fesh[2] -= 1;
T2Up[0] += 1;
}
user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), -1000);
user.SetGenInve(items);
fuser.SetInventory(finv);
await Database.SaveChangesAsync();
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou have obtained **Lucky Paste**");
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nok retard.");
}
}
else
{
if (fuser.RodOwned > 0)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou already have everything currently craftable.");
return;
}
if (T2Up[0] != 0 && Rod[0] != 0)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nDo you want to craft the **Reinforced Fishing Rod**?\nThis will use 1 **Lucky Paste** and 1 **Incomplete Rod**.\nType 'yes' to continue.");
var inp = await NextMessageAsync();
if (inp.Content != null && inp.Content.ToLowerInvariant().Contains("yes"))
{
T2Up[0] -= 1;
Rod[0] -= 1;
fuser.RodOwned += 1;
user.SetGenInve(items);
await Database.SaveChangesAsync();
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou have successfully crafted a **Reinforced Fishing Rod**, **;setrod 2** to use it.");
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nok retard.");
}
}
else
{
string msg = "You are missing parts.\n";
if (T2Up[0] < 1)
{
msg += "**Lucky Paste**\n";
}
if (Rod[0] < 1)
{
msg += "**Incomplete Rod**";
}
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n{msg}");
}
}
}
}
[Command("fishinventory"), Alias("finv", "fishinv"), Summary("Shows your fish inventory. Variables: fish tier")]
public async Task FishInventory(int? tier = null, IGuildUser user = null)
5 years ago
{
if (user == null)
{
5 years ago
user = Context.User as IGuildUser;
}
if (tier == null)
{
tier = 1;
}
5 years ago
Fishing feeshUser;
Dictionary<FishSpecies, int[]> inv = new Dictionary<FishSpecies, int[]>();
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
feeshUser = Database.Fishing.FirstOrDefault(x => x.Id == user.Id);
if (feeshUser == null)
{
feeshUser = new Fishing
{
Id = user.Id
};
Database.Fishing.Add(feeshUser);
}
else
{
inv = feeshUser.GetInventory();
}
await Database.SaveChangesAsync().ConfigureAwait(false);
}
if (inv.Any())
{
5 years ago
Dictionary<FishSpecies, int> small = new Dictionary<FishSpecies, int>();
Dictionary<FishSpecies, int> med = new Dictionary<FishSpecies, int>();
Dictionary<FishSpecies, int> large = new Dictionary<FishSpecies, int>();
List<Fish> fishes = Fishing.GetFishList();
List<Fish> fishTiers = Fishing.GetFishList();
if (tier >= 1 && tier < 5)
{
switch (tier)
{
case 1:
{
fishTiers = fishes.Where(f => (int)f.Tier == (int)FishTier.T1).ToList();
}
break;
case 2:
{
fishTiers = fishes.Where(f => (int)f.Tier == (int)FishTier.T2).ToList();
}
break;
case 3:
{
fishTiers = fishes.Where(f => (int)f.Tier == (int)FishTier.T3).ToList();
}
break;
case 4:
{
fishTiers = fishes.Where(f => (int)f.Tier == (int)FishTier.T4).ToList();
}
break;
}
}
else if (tier < 1 || tier > 4)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nTier not available.");
return;
}
List<Fish> unrfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Unreasonable).ToList();
List<Fish> legfish = fishTiers.Where(f => (int)f.Rarity == (int)FishRarity.Legendary).ToList();
List<Fish> rarfish = fishTiers.Where(f => (int)f.Rarity == (int)FishRarity.Rare).ToList();
List<Fish> uncfish = fishTiers.Where(f => (int)f.Rarity == (int)FishRarity.Uncommon).ToList();
List<Fish> comfish = fishTiers.Where(f => (int)f.Rarity == (int)FishRarity.Common).ToList();
string unreasonable = "";
string legendary = "";
string rare = "";
string uncommon = "";
string common = "";
string fishmote = "";
string fishtext = "";
5 years ago
foreach (var entry in inv)
{
if (!fishes.Any(x => x.Id == entry.Key))
{
inv.Remove(entry.Key);
continue;
}
fishmote = fishes.FirstOrDefault(x => x.Id == entry.Key).Emote;
if (!fishmote.Contains("><"))
5 years ago
{
fishmote += "<:emptyslot:709350723199959101>";
5 years ago
}
if (fishmote.Contains("missingLeg"))
5 years ago
{
fishmote = fishes.FirstOrDefault(x => x.Id == entry.Key).Name;
5 years ago
}
fishtext = $"{fishmote} [";
if (entry.Value[0] > 0)
{
fishtext += $" **S**-{entry.Value[0]}";
}
if (entry.Value[1] > 0)
{
fishtext += $" **M**-{entry.Value[1]}";
}
if (entry.Value[2] > 0)
{
fishtext += $" **L**-{entry.Value[2]}";
}
fishtext += $" ]\n";
5 years ago
if (unrfish.Any(f => f.Id == entry.Key))
{
unreasonable += $"{fishtext}";
}
if (legfish.Any(f => f.Id == entry.Key))
5 years ago
{
legendary += $"{fishtext}";
}
if (rarfish.Any(f => f.Id == entry.Key))
5 years ago
{
rare += $"{fishtext}";
5 years ago
}
if (uncfish.Any(f => f.Id == entry.Key))
5 years ago
{
uncommon += $"{fishtext}";
}
if (comfish.Any(f => f.Id == entry.Key))
5 years ago
{
common += $"{fishtext}";
5 years ago
}
}
string locker = $"";
if (unreasonable != "")
{
locker += $"{unreasonable}\n";
}
if (legendary != "")
{
locker += $"{legendary}\n";
}
if (rare != "")
{
locker += $"{rare}\n";
}
if (uncommon != "")
{
locker += $"{uncommon}\n";
}
locker += $"{common}";
if (locker == "")
{
await Context.Channel.SendMessageAsync($"there be nothin' in this locker, cap'n");
return;
}
if (user.Id != Context.User.Id)
5 years ago
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n{user.Username}'s inventory\n{locker}");
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n{locker}");
5 years ago
}
}
else
{
await Context.Channel.SendMessageAsync("Go fish nigger").ConfigureAwait(false);
}
}
[Command("generalinventory"),Alias("ginv", "geninv"), Summary("Shows your general items inventory.")]
public async Task GeneralInventory()
{
User user;
Dictionary<Items, int[]> inv = new Dictionary<Items, int[]>();
List<User.Item> items = User.ListItems();
User.Item item;
string message = "";
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id);
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)
{
if (entry.Value[0] > 0)
{
item = items.FirstOrDefault(x => x.Id == entry.Key);
message += $"**{item.Name}**: **{entry.Value[0]}**\n";
}
}
if (message == $"")
{
message += "You have no items.";
}
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.BotOwner)]
[Command("tradebuy", RunMode = RunMode.Async), Summary("Unfinished command")]
5 years ago
public async Task TradingBuy(int amount, string itemtype, int price, [Remainder] string item)
{
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var KehUser = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id);
if (itemtype.ToLowerInvariant() == "fish")
{
FishSize size = 0;
FishSpecies species = 0;
List<Fish> fishes = Fishing.GetFishList();
if (item.ToLowerInvariant().Contains("large"))
{
size = FishSize.Large;
}
else if (item.ToLowerInvariant().Contains("medium"))
{
size = FishSize.Medium;
}
else if (item.ToLowerInvariant().Contains("small"))
{
size = FishSize.Small;
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention} Your size is not up to my standards.");
return;
}
if (fishes.Any(z => item.ToLowerInvariant().Contains(z.Name.ToLowerInvariant())))
{
species = fishes.FirstOrDefault(z => item.ToLowerInvariant().Contains(z.Name.ToLowerInvariant())).Id;
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention} The goo pool contains no such fish.");
return;
}
if (Database.StoreFronts.Any(x => x.StoreItemType == StoreItemType.Fish))
{
var stores = Database.StoreFronts.AsQueryable().Where(x => x.StoreItemType == StoreItemType.Fish).ToList();
5 years ago
stores.Shuffle();
var store = stores.FirstOrDefault();
if (store.Items.Any(x => x.Item.ToLowerInvariant() == item.ToLowerInvariant()))
{
var itm = store.Items.FirstOrDefault(x => x.Item.ToLowerInvariant() == item.ToLowerInvariant());
if (itm.Price * amount <= KehUser.Money)
{
if (itm.Amount >= amount)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nTrade offer to buy item **{size} {species}** for **{((long)price).ToYeedraDisplay()}%**").ConfigureAwait(false);
5 years ago
}
else
{
await ReplyAsync("Whoa slow down there buckaroo, they ain't selling that much, go sit in the corner and think about what you've done").ConfigureAwait(false);
}
}
else
{
await ReplyAsync("Nigger slow down, you aint got the cash monee to make that purchase smh frfr onjah").ConfigureAwait(false);
}
}
}
else
{
await ReplyAsync("No one is selling, so you can't buy lmao, big stinky");
}
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nInvalid trade type. Come back when the error command is fixed lmaoy").ConfigureAwait(false);
}
}
}
[RequireRolePrecondition(AccessLevel.BotOwner)]
[Command("tradesell"), Summary("Unfinished command")]
5 years ago
public async Task TradingSell(int amount, string itemtype, int price, [Remainder] string item)
{
string contents = "trade info";
FishSize size = 0;
FishSpecies species = 0;
List<Fish> fishes = Fishing.GetFishList();
if (itemtype.ToLowerInvariant() == "fish")
{
if (item.ToLowerInvariant().Contains("large"))
{
size = FishSize.Large;
}
else if (item.ToLowerInvariant().Contains("medium"))
{
size = FishSize.Medium;
}
else if (item.ToLowerInvariant().Contains("small"))
{
size = FishSize.Small;
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention} Your size is not up to my standards.");
return;
}
if (fishes.Any(z => item.ToLowerInvariant().Contains(z.Name.ToLowerInvariant())))
{
species = fishes.FirstOrDefault(z => item.ToLowerInvariant().Contains(z.Name.ToLowerInvariant())).Id;
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention} The goo pool contains no such fish.");
return;
}
contents += $"\ntype: sell\nitem: {size} {species}\namount: {amount}\nprice: {((long)price).ToYeedraDisplay()}%\n";
5 years ago
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nTrade offer to sell item **{size} {species}** for **{((long)price).ToYeedraDisplay()}%**").ConfigureAwait(false);
5 years ago
await Context.Channel.SendMessageAsync($"{contents}").ConfigureAwait(false);
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nInvalid trade type. Come back when the error command is fixed lmaoy").ConfigureAwait(false);
}
}
[RequireRolePrecondition(AccessLevel.BotOwner)]
[Command("tradeoffers"), Summary("Unfinished command")]
5 years ago
public async Task ShowOffers(bool localOffers = true)
{
using (var database = new ApplicationDbContextFactory().CreateDbContext())
{
StringBuilder message = new StringBuilder();
if (localOffers)
{
var stores = database.StoreFronts.AsQueryable().Where(x => x.UserId == Context.User.Id);
5 years ago
foreach(var store in stores)
{
if(store.Offers.Any())
{
foreach(var offer in store.Offers)
{
message.AppendLine($"Offer found in **{store.StoreItemType} Store** from: <@{offer.BuyerId}> for **{store.Items.FirstOrDefault(x => x.InvId == offer.ItemId).Item}** @ **{offer.OfferAmount}**");
}
}
else
{
message.AppendLine($"**{store.StoreItemType} Store** has no offers currently");
}
}
await Context.Channel.SendMessageAsync($"{message}");
5 years ago
}
}
}
[Command("balance"), Alias("bal", "money"), Summary("Displays the percentage of the total currency you own.")]
5 years ago
public async Task Shekels([Remainder] IUser otherUser = null)
{
User user;
User buser;
User suser;
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
user = Database.Users.FirstOrDefault(x => x.Id == (otherUser == null ? Context.User.Id : otherUser.Id));
buser = Database.Users.FirstOrDefault(x => x.Id == 0);
suser = Database.Users.FirstOrDefault(x => x.Id == 1);
}
if (otherUser == null)
{
if (user == null)
{
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
user = new User
{
Id = Context.User.Id,
Avatar = Context.User.GetAvatarUrl() ?? Context.User.GetDefaultAvatarUrl(),
Username = Context.User.Username
};
Database.Users.Add(user);
await Database.SaveChangesAsync();
}
}
await Context.Channel.SendMessageAsync($"{Context.User.Mention} You own {user.Money.ToYeedraDisplay()}%\nWhich is ~{Math.Round(((user.Money * 100d) / (1000000d - buser.Money - suser.Money)), 2, MidpointRounding.ToEven)}% of the money in circulation");
5 years ago
}
else
{
if (user == null)
{
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
user = new User
{
Id = Context.User.Id,
Avatar = Context.User.GetAvatarUrl() ?? Context.User.GetDefaultAvatarUrl(),
Username = Context.User.Username
};
Database.Users.Add(user);
await Database.SaveChangesAsync();
}
}
await Context.Channel.SendMessageAsync($"{otherUser.Mention} owns {user.Money.ToYeedraDisplay()}%\nWhich is ~{Math.Round(((user.Money * 100d) / (1000000d - buser.Money - suser.Money)), 2, MidpointRounding.ToEven)}% of the money in circulation");
5 years ago
}
}
[Command("bank"), Summary("Displays the percentage of total currency the bank owns.")]
5 years ago
public async Task BankBalance()
{
User user;
User suser;
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
user = Database.Users.FirstOrDefault(x => x.Id == 0);
suser = Database.Users.FirstOrDefault(x => x.Id == 1);
}
await Context.Channel.SendMessageAsync($"Bank has {(suser.Money + user.Money).ToYeedraDisplay()}% left"/*\nSkuld can currently sell a maximum of {suser.Money * 64}₩ at 0.0001% = 64₩ exchange rate*/);
5 years ago
}
[Command("leaderboard"), Alias("top", "lb"), Summary("Shows the top 10 people in a leaderboard, currently available leaderboards: 'f, fish', 'm, money', 'mi, mining'.")]
public async Task Leaderboard(string type = null)
5 years ago
{
if (type == null)
5 years ago
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nPlease specify the leaderboard you want to view (f or fish for fish, m or money for money, mi or mining for mining)");
5 years ago
}
else if (type == "m" || type == "money")
{
List<User> users;
User bank;
User skuld;
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
users = Database.Users.AsQueryable().OrderByDescending(user => user.Money).ToList();
bank = Database.Users.FirstOrDefault(x => x.Id == 0);
skuld = Database.Users.FirstOrDefault(x => x.Id == 1);
}
users.Remove(bank);
users.Remove(skuld);
5 years ago
int placing = 0;
string leaderboardMessage = "**Top Ten Greediest Jews**:";
for (int i = 0; i < 10; i++)
{
placing += 1;
string percent = $"{users[i].Money.ToYeedraDisplay()}";
string percentCirculating = $"{Math.Round(((users[i].Money * 100d) / (1000000d - bank.Money - skuld.Money)), 2, MidpointRounding.ToEven)}";
leaderboardMessage += $"\n**#{placing} : {users[i].Username}**\n{percent}% ~ *{percentCirculating}% circulating*";
}
await Context.Channel.SendMessageAsync(leaderboardMessage);
}
else if (type == "f" || type == "fish")
5 years ago
{
List<Fishing> users;
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
users = Database.Fishing.AsQueryable().OrderByDescending(user => user.TXp+(ulong)user.Prestige*500000).ToList();
string leaderboardMessage = "**Top Ten Smelliest Fishermen**:";
int placing = 0;
for (int i = 0; i < 10; i++)
{
placing += 1;
var user = Database.Users.FirstOrDefault(x => x.Id == users[i].Id);
string xp = $"{users[i].TXp}";
string level = $"{users[i].Lvl}";
if (users[i].Prestige > 0)
{
level += $" + {users[i].Prestige}P";
}
leaderboardMessage += $"\n**#{placing} : {user.Username}** Lvl : **{level}**\n*{xp}xp*";
}
await Context.Channel.SendMessageAsync(leaderboardMessage);
}
}
else if (type == "mi" || type == "mining")
{
List<Mining> users;
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
users = Database.Mining.AsQueryable().OrderByDescending(user => user.TXp).ToList();
string leaderboardMessage = "**Top Ten Sweatiest Miners**:";
int placing = 0;
for (int i = 0; i < 10; i++)
{
if (users.Count <= i)
{
for (int p = i; p < 10; p++)
{
placing += 1;
leaderboardMessage += $"\n**#{placing} : John Placeholder** Lvl : **0**\n*0xp*";
}
break;
}
placing += 1;
var user = Database.Users.FirstOrDefault(x => x.Id == users[i].Id);
string xp = $"{users[i].TXp}";
string level = $"{users[i].Lvl}";
leaderboardMessage += $"\n**#{placing} : {user.Username}** Lvl : **{level}**\n*{xp}xp*";
}
await Context.Channel.SendMessageAsync(leaderboardMessage);
}
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nCan't find the leaderboard you were looking for. \nPlease type fish or f for fish leaderboard, m or money for money leaderboard.");
5 years ago
}
}
[Command("give"), Summary("Give a user money. Eg. 'give @user [amount]'")]
public async Task GiveShekel(IGuildUser person, int amount)
{
if (amount > 0)
{
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id);
var pers = Database.Users.FirstOrDefault(x => x.Id == person.Id);
5 years ago
if (user.Money < amount)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't have that much money??");
5 years ago
}
else
{
if (user.Id == person.Id)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou have transferred your money to yourself???");
5 years ago
}
else
{
if (pers.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), amount) && user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), -amount))
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{((long)amount).ToYeedraDisplay()}%** has been transferred from your account.");
}
else
5 years ago
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou can't afford that, go back to the mines.");
5 years ago
}
await Database.SaveChangesAsync();
}
}
}
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nNothing has been transferred from your account.\nGood job kiddo.");
5 years ago
}
}
[Command("stats"),Summary("View a user's stats")]
public async Task StatProfile(IUser otherUser = null)
{
Dictionary<FishSpecies, int[]> inv = new Dictionary<FishSpecies, int[]>();
Dictionary<FishSpecies, int> small = new Dictionary<FishSpecies, int>();
Dictionary<FishSpecies, int> med = new Dictionary<FishSpecies, int>();
Dictionary<FishSpecies, int> large = new Dictionary<FishSpecies, int>();
Fishing feeshUser;
int scount = 0;
int mcount = 0;
int lcount = 0;
using (var database = new ApplicationDbContextFactory().CreateDbContext())
{
if (otherUser == null)
{
feeshUser = database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
}
else
{
feeshUser = database.Fishing.FirstOrDefault(x => x.Id == otherUser.Id);
}
if (feeshUser == null)
{
if (otherUser != null)
{
feeshUser = new Fishing
{
Id = otherUser.Id
};
}
else
{
feeshUser = new Fishing
{
Id = Context.User.Id
};
}
database.Fishing.Add(feeshUser);
await database.SaveChangesAsync();
if (otherUser != null)
{
await Context.Channel.SendMessageAsync($"**{otherUser.Username}** Was added to the database.");
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou were added to the database.");
}
return;
}
else
{
inv = feeshUser.GetInventory();
}
List<Fish> fishes = Fishing.GetFishList();
foreach (var entry in inv)
{
if (!fishes.Any(x => x.Id == entry.Key))
{
inv.Remove(entry.Key);
continue;
}
if (entry.Value.Count() > 0)
{
if (entry.Value[0] > 0)
{
scount += entry.Value[0];
}
}
if (entry.Value.Count() > 1)
{
if (entry.Value[1] > 0)
{
mcount += entry.Value[1];
}
}
if (entry.Value.Count() > 2)
{
if (entry.Value[2] > 0)
{
lcount += entry.Value[2];
}
}
}
if (otherUser == null)
{
var user = database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
var muser = database.Users.FirstOrDefault(x => x.Id == Context.User.Id);
var minuser = database.Mining.FirstOrDefault(x => x.Id == Context.User.Id);
string pres = "";
double cawe = 0;
if (user.Prestige == 1)
{
pres = $" +{user.Prestige}P";
cawe = 500 + user.Lvl * 3d;
}
else if (user.Prestige > 1)
{
pres = $" +{user.Prestige}P";
cawe = 800;
}
else
{
cawe = user.Lvl * 5d + 10d;
}
await Context.Channel.SendMessageAsync($"{Context.User.Mention}'s stats\nFishing level: **{user.Lvl}{pres}**\nMax catch weight: **{(user.Lvl * 5 + 2000d + user.Prestige*500d) / 100}kg**\nMin catch weight: **{cawe /100}kg**\n" +
$"Fishing xp: **{user.TXp}**\nTotal fish: **{scount + mcount + lcount}** *(Large: {lcount} Medium: {mcount} Small: {scount})*\nMining level: **{minuser.Lvl}**\nMining xp: **{minuser.TXp}**\nBalance: **{muser.Money.ToYeedraDisplay()}%**");
}
else
{
var user = database.Fishing.FirstOrDefault(x => x.Id == otherUser.Id);
var muser = database.Users.FirstOrDefault(x => x.Id == otherUser.Id);
var minuser = database.Mining.FirstOrDefault(x => x.Id == otherUser.Id);
string pres = "";
double cawe = 0;
if (user.Prestige > 0)
{
pres = $" +{user.Prestige}P";
cawe = 500;
}
else
{
cawe = user.Lvl * 5d + 10d;
}
await Context.Channel.SendMessageAsync($"{otherUser.Mention}'s stats\nFishing level: **{user.Lvl}{pres}**\nMax catch weight: **{(user.Lvl * 5 + 2000d + user.Prestige*500d) / 100}kg**\nMin catch weight: **{cawe / 100}kg**\n" +
$"Fishing xp: **{user.TXp}**\nTotal fish: **{scount + mcount + lcount}** *(Large: {lcount} Medium: {mcount} Small: {scount}*)\nMining level: **{minuser.Lvl}**\nMining xp: **{minuser.TXp}**\nBalance: **{muser.Money.ToYeedraDisplay()}%**");
}
}
}
[Command("prestige",RunMode = RunMode.Async),Summary("Sacrifice a load of XP for benefits and growth potential.")]
public async Task PrestigeCommand()
{
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
if (user == null)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYour first prestige is available at **Lvl 100** in **130503xp**.");
return;
}
else
{
ulong presXp = 50;
if (user.Prestige > 0 || user.TXp >= 130503)
{
for (ulong i = 1; i < 100 + (ulong)user.Prestige*5; i++)
{
if (i <= 100 + (ulong)user.Prestige*5)
{
presXp += Convert.ToUInt64(Math.Round((presXp * 0.05d + 50d), 0, MidpointRounding.ToEven));
}
};
if (user.TXp >= presXp)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**Tier {user.Prestige+1}** is available! Type **confirm** to buy it for **{presXp}xp**.");
var message = await NextMessageAsync();
if (message.Content.ToLowerInvariant() == "confirm")
{
user.Prestige++;
user.TXp -= presXp;
user.Xp = 0;
user.Lvl = 0;
while (user.TXp >= user.Xp)
{
user.Lvl += 1;
user.Xp = user.Lvl.GetLevelXp()[0];
}
await Database.SaveChangesAsync();
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou've successfully upgraded to **P{user.Prestige}**.\nReadjusting level.");
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nCome back when you change your mind.");
}
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYour next prestige is available at **Lvl {100+user.Prestige*5}** in **{presXp - user.TXp}xp**.");
}
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYour first prestige is available at **Lvl 100** in **{130503-user.TXp}xp**.");
}
}
}
}
[Command("xptolevel"),Alias("tolv", "xpto"),Summary("Displays how much xp you need to reach the given level / amount of xp.")]
public async Task XpToNextLevl(ulong lvl, IUser otheruser = null)
{
ulong lvlXp = 50;
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
if (lvl > 1 && lvl <= 200)
{
for (ulong i = 1; i < lvl; i++)
{
if (i <= lvl)
{
lvlXp += Convert.ToUInt64(Math.Round((lvlXp * 0.05d + 50d), 0, MidpointRounding.ToEven));
}
};
}
else if (lvl == 1)
{
lvlXp = 50;
}
else if (lvl < 1)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThat's not really possible?");
return;
}
else if (lvl > 200)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**Lvl 200** is the maximum lvl");
return;
}
var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
if (user == null)
{
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nXP required for **Lvl {lvl} : {lvlXp}**");
}
}
else
{
if (user.Lvl >= lvl)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nXP required for **Lvl {lvl} : {lvlXp}**" +
$"\nXP since you reached **Lvl {lvl} : {user.TXp - lvlXp}**" +
$"\nCurrent XP : **{user.TXp}**");
}
else
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nXP required for **Lvl {lvl} : {lvlXp}**" +
$"\nXP left until **Lvl {lvl} : {lvlXp - user.TXp}**" +
$"\nCurrent XP : **{user.TXp}**" +
$"\nProgress to goal : **~{Math.Round(((user.TXp * 100d) / lvlXp), 0, MidpointRounding.ToEven)}%**");
}
}
}
}
5 years ago
}
}