minor fixes

fixed some minors
master
Lan 2 years ago
parent a3e32c077f
commit a4f9dc1b7a
  1. 33
      Kehyeedra3/Commands/Economy.cs
  2. 97
      Kehyeedra3/Commands/Interactive.cs

@ -1416,12 +1416,12 @@ namespace Kehyeedra3.Commands
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*/);
}
[Command("leaderboard"), Alias("top", "lb"), Summary("Shows the top 10 people in a leaderboard, currently available leaderboards: 'f, fish', 'm, money'.")]
[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)
{
if (type == null)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nPlease specify the leaderboard you want to view (fish or f for fish, m or money for money)");
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)");
}
else if (type == "m" || type == "money")
{
@ -1471,6 +1471,35 @@ namespace Kehyeedra3.Commands
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.");

@ -567,7 +567,7 @@ namespace Kehyeedra3.Commands
}
[Command("gstore", RunMode = RunMode.Async),Alias("gs"),Summary("General store: gstore or gs. Secondary variables s/sell to sell, b/buy to buy.")]
public async Task GeneralStore(string input = null)
public async Task GeneralStore(string input = null, string sec = null, string ter = null, [Remainder]string quar = null)
{
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
@ -622,19 +622,38 @@ namespace Kehyeedra3.Commands
{
input = input.ToLowerInvariant();
}
if (input == null)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nPlease specify 'b / buy' to buy items, or 's / sell' to sell items.");
}
else if (input == "b" || input == "buy")
{
int itemid = 0;
int itemnum = 0;
if (!itemlist.Any(i => (int)i.Id == (int.Parse(sec))))
{
sec = null;
}
if (sec == null || ter == null)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the item and amount (ID num)\n{itemtxt}");
var inp = await NextMessageAsync(timeout: TimeSpan.FromMinutes(2));
var inpsep = inp.Content.Split(" ");
itemid = int.Parse(inpsep[0]);
itemnum = int.Parse(inpsep[1]);
}
else
{
itemid = int.Parse(sec);
itemnum = int.Parse(ter);
}
item = itemlist.FirstOrDefault(i => (int)i.Id == itemid);
item = itemlist.FirstOrDefault(i => (int)i.Id == int.Parse(inpsep[0]));
items = user.GetGenInve();
@ -646,14 +665,14 @@ namespace Kehyeedra3.Commands
items.Add(item.Id, amount);
}
if (int.Parse(inpsep[1]) * item.Price <= user.Money)
if (itemnum * item.Price <= user.Money)
{
amount[0] += int.Parse(inpsep[1]);
int count = int.Parse(inpsep[1]);
amount[0] += itemnum;
int count = itemnum;
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThis will cost you {((long)(count * item.Price)).ToYeedraDisplay()}.\nType 'ok' to confirm.");
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou are about to buy {item.Name} for {((long)(count * item.Price)).ToYeedraDisplay()}%.\nType 'ok' to confirm.");
inp = await NextMessageAsync();
var inp = await NextMessageAsync();
if (inp.Content.ToLowerInvariant() == "ok")
{
if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), -(count * item.Price)))
@ -685,10 +704,17 @@ namespace Kehyeedra3.Commands
await Context.Channel.SendMessageAsync($"Your inventory is empty. Try fishing more.");
return;
}
int tier = 0;
if (sec == null)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the tier.\n");
var inp = await NextMessageAsync();
int tier = int.Parse(inp.Content);
var inpu = await NextMessageAsync();
tier = int.Parse(inpu.Content);
}
else
{
tier = int.Parse(sec);
}
if (tier > 0 && tier < 5)
@ -733,6 +759,8 @@ namespace Kehyeedra3.Commands
string common = "";
string fishtext = "";
if (sec != null && ter != null && quar != null)
{
foreach (var entry in fishinv)
{
fishtext = $"{(int)entry.Key} : {entry.Key} [";
@ -767,6 +795,8 @@ namespace Kehyeedra3.Commands
common += $"{fishtext}";
}
}
}
string locker = "";
if (legendary != "")
@ -788,12 +818,27 @@ namespace Kehyeedra3.Commands
return;
}
int itemid = 0;
string itemsize = "";
int itemnum = 0;
if (sec == null || ter == null || quar == null)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the item, size, and amount. (ID size amount)\n\n{locker}");
inp = await NextMessageAsync(timeout: TimeSpan.FromMinutes(2));
var inpu = await NextMessageAsync(timeout: TimeSpan.FromMinutes(2));
var inpsep = inpu.Content.Split(" ");
itemid = int.Parse(inpsep[0]);
itemsize = inpsep[1].ToString().ToLowerInvariant();
itemnum = int.Parse(inpsep[2]);
}
else
{
itemid = int.Parse(sec);
itemsize = ter.ToLowerInvariant();
itemnum = int.Parse(quar);
}
var inpsep = inp.Content.Split(" ");
int siz = 0;
switch (inpsep[1].ToString().ToLowerInvariant())
switch (itemsize)
{
case "s":
{
@ -812,9 +857,9 @@ namespace Kehyeedra3.Commands
break;
}
fish = fishes.FirstOrDefault(i => (int)i.Id == int.Parse(inpsep[0]));
fish = fishes.FirstOrDefault(i => (int)i.Id == itemid);
size = (FishSize)siz;
int amount = int.Parse(inpsep[2]);
int amount = itemnum;
int amountcheck = fishinv.FirstOrDefault(f => f.Key == fish.Id).Value[(int)size];
if (amountcheck < amount)
@ -849,8 +894,8 @@ namespace Kehyeedra3.Commands
value *= amount;
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou're about to sell **{amount} {fish.Name}** for **{((long)value).ToYeedraDisplay()}**.\nType 'ok' to confirm.");
inp = await NextMessageAsync(timeout: TimeSpan.FromMinutes(2));
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou're about to sell **{amount} {fish.Name}** for **{((long)value).ToYeedraDisplay()}%**.\nType 'ok' to confirm.");
var inp = await NextMessageAsync(timeout: TimeSpan.FromMinutes(2));
if (inp.Content.ToLowerInvariant() == "ok")
{
@ -894,9 +939,17 @@ namespace Kehyeedra3.Commands
return;
}
int tier = 0;
if (sec == null)
{
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the tier.\n");
var inp = await NextMessageAsync(timeout: TimeSpan.FromMinutes(2));
int tier = int.Parse(inp.Content);
var inptier = await NextMessageAsync();
tier = int.Parse(inptier.Content);
}
else
{
tier = int.Parse(sec);
}
if (tier > 0 && tier < 5)
{
@ -955,7 +1008,7 @@ namespace Kehyeedra3.Commands
fish = fishes.FirstOrDefault(i => i.Id == f.Key);
if (fish.Tier == ftier && fish.Rarity != FishRarity.Unreasonable && fish.Rarity != FishRarity.Legendary)
if (fish != null && fish.Tier == ftier && fish.Rarity != FishRarity.Unreasonable && fish.Rarity != FishRarity.Legendary)
{
if (f.Value[0] > 0)
@ -1036,7 +1089,7 @@ namespace Kehyeedra3.Commands
}
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou're about to sell **{count} Fish** for **{((long)value).ToYeedraDisplay()}%**.\nType 'ok' to confirm.");
inp = await NextMessageAsync(timeout: TimeSpan.FromMinutes(2));
var inp = await NextMessageAsync(timeout: TimeSpan.FromMinutes(2));
if (inp.Content.ToLowerInvariant() == "ok")
{

Loading…
Cancel
Save