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

@@ -99,6 +99,14 @@ namespace Kehyeedra3.Commands
var message = await NextMessageAsync();
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;
await Database.SaveChangesAsync();
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)]
[Command("makeimag")]
public async Task MakeImage()

View File

@@ -15,17 +15,17 @@ using Kehyeedra3.Preconditions;
using System.IO;
namespace Kehyeedra3.Commands
{
{
public class Economy : InteractiveBase<SocketCommandContext>
{
readonly string[] ores = new string[]
{
"**Gold**,",
"**Platinum**,",
"**Plastids**,",
"a **Windows Update**,",
"a ticking **Time Bomb**,",
"an **Amethyst**,",
"**Germanium**,",
"the **Bone Stone**,",
"a **Hotdog**,",
"**Corundum**,",
"**Quartz**,",
@@ -35,11 +35,11 @@ namespace Kehyeedra3.Commands
"**Beryllium**,",
"**Gallium**,",
"an **Amber**,",
"**Bismuth**",
"**Bismuth**,",
"an **Emerald**,",
"a lost **Sock**,",
"**Tellurium**,",
"**Ferrite**,",
"**Bad Apple**,",
"a **Glass of Water**,",
"**Redstone**,",
"**Racism**,",
@@ -64,7 +64,7 @@ namespace Kehyeedra3.Commands
"a **Viet Cong Tunnel**,",
"a single unit of several **Trees**,",
"**1,000,000₩**,",
"**Jas's Love**,",
"a **Cunny Rabbit**,",
"a **Rock Golem**,",
"a piece of **Toast**,",
"**Luminite**,",
@@ -178,15 +178,7 @@ namespace Kehyeedra3.Commands
if (muser.TXp >= muser.Xp)
{
muser.Lvl += 1;
ulong leXp = 50;
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;
muser.Xp = muser.Lvl.GetLevelXp()[0];
levelup += $"You leveled up. You are now **Lvl {muser.Lvl}**";
}
else
@@ -635,32 +627,17 @@ namespace Kehyeedra3.Commands
int times = 0;
if (user.TXp > 50 && user.FXp == 0)
{
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));
}
if (i == user.Lvl - 2)
{
user.FXp = lvlXp;
}
}
ulong[] result = user.Lvl.GetLevelXp();
lvlXp = result[0];
user.FXp = result[1];
}
if (user.TXp >= user.Xp)
{
ulong leXp = 50;
ulong[] result = user.Lvl.GetLevelXp();
ulong leXp = result[0];
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)
{
user.Lvl = 0;
@@ -672,27 +649,19 @@ namespace Kehyeedra3.Commands
user.Lvl += 1;
times += 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));
}
if (i == user.Lvl - 2)
{
user.FXp = lvlXp;
}
}
result = user.Lvl.GetLevelXp();
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\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)
{
@@ -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)
{
if (user == null)
@@ -1152,7 +1121,7 @@ namespace Kehyeedra3.Commands
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()
{
User user;
@@ -1163,7 +1132,21 @@ namespace Kehyeedra3.Commands
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
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)
{
if (entry.Value[0] > 0)
@@ -1175,6 +1158,42 @@ namespace Kehyeedra3.Commands
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)]
[Command("tradebuy", RunMode = RunMode.Async), Summary("Unfinished command")]
public async Task TradingBuy(int amount, string itemtype, int price, [Remainder] string item)
@@ -1662,19 +1681,10 @@ namespace Kehyeedra3.Commands
user.TXp -= presXp;
user.Xp = 0;
user.Lvl = 0;
ulong lvlXp = 0;
while (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;
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.");

View File

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

View File

@@ -246,7 +246,7 @@ namespace Kehyeedra3.Commands
}
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}");
}
}
@@ -381,7 +381,7 @@ namespace Kehyeedra3.Commands
[Command("changenick")]
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");
return;