added fish leaderboard
also minor fix in reminders
This commit is contained in:
@@ -976,13 +976,18 @@ namespace Kehyeedra3.Commands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[Command("leaderboard"), Alias("top", "lb"), Summary("Shows the top 10 people in regards to % money as well as how much of the money in circulation they own")]
|
[Command("leaderboard"), Alias("top", "lb"), Summary("Shows the top 10 people in a leaderboard, currently available leaderboards: 'f, fish', 'm, money'.")]
|
||||||
public async Task Leaderboard()
|
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)");
|
||||||
|
}
|
||||||
|
else if (type == "m" || type == "money")
|
||||||
{
|
{
|
||||||
List<User> users;
|
List<User> users;
|
||||||
User bank;
|
User bank;
|
||||||
User skuld;
|
User skuld;
|
||||||
|
|
||||||
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
|
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
|
||||||
{
|
{
|
||||||
users = Database.Users.OrderByDescending(user => user.Money).ToList();
|
users = Database.Users.OrderByDescending(user => user.Money).ToList();
|
||||||
@@ -992,15 +997,40 @@ namespace Kehyeedra3.Commands
|
|||||||
users.Remove(bank);
|
users.Remove(bank);
|
||||||
users.Remove(skuld);
|
users.Remove(skuld);
|
||||||
|
|
||||||
string leaderboardMessage = "**Top Ten Most Jewish Miners**:";
|
int placing = 0;
|
||||||
|
string leaderboardMessage = "**Top Ten Most Jewish Users**:";
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
|
placing += 1;
|
||||||
string percent = $"{ users[i].Money / 10000d }";
|
string percent = $"{ users[i].Money / 10000d }";
|
||||||
string percentCirculating = $"{Math.Round(((users[i].Money * 100d) / (1000000d - bank.Money - skuld.Money)), 2, MidpointRounding.ToEven)}";
|
string percentCirculating = $"{Math.Round(((users[i].Money * 100d) / (1000000d - bank.Money - skuld.Money)), 2, MidpointRounding.ToEven)}";
|
||||||
leaderboardMessage += $"\n**{users[i].Username}** : {percent}% ~ *{percentCirculating}% circulating*";
|
leaderboardMessage += $"\n**#{placing} : {users[i].Username}**\n{percent}% ~ *{percentCirculating}% circulating*";
|
||||||
}
|
}
|
||||||
|
|
||||||
await Context.Channel.SendMessageAsync(leaderboardMessage);
|
await Context.Channel.SendMessageAsync(leaderboardMessage);
|
||||||
|
}
|
||||||
|
else if (type == "f" || type == "fish")
|
||||||
|
{
|
||||||
|
List<Fishing> users;
|
||||||
|
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
|
||||||
|
{
|
||||||
|
users = Database.Fishing.OrderByDescending(user => user.TXp).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}";
|
||||||
|
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.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
[Command("give"), Summary("Give a user money. Eg. 'give @user [amount]'")]
|
[Command("give"), Summary("Give a user money. Eg. 'give @user [amount]'")]
|
||||||
@@ -1062,5 +1092,6 @@ namespace Kehyeedra3.Commands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,12 +112,12 @@ namespace Kehyeedra3.Commands
|
|||||||
ulong sen = (d * 86400) + (h * 3600) + (m * 60);
|
ulong sen = (d * 86400) + (h * 3600) + (m * 60);
|
||||||
ulong yeedraStamp = DateTime.UtcNow.ToYeedraStamp();
|
ulong yeedraStamp = DateTime.UtcNow.ToYeedraStamp();
|
||||||
|
|
||||||
while (m > 60)
|
while (m > 59)
|
||||||
{
|
{
|
||||||
h += 1;
|
h += 1;
|
||||||
m -= 60;
|
m -= 60;
|
||||||
}
|
}
|
||||||
while (h > 24)
|
while (h > 23)
|
||||||
{
|
{
|
||||||
d += 1;
|
d += 1;
|
||||||
h -= 24;
|
h -= 24;
|
||||||
|
|||||||
Reference in New Issue
Block a user