|
@@ -1,4 +1,3 @@
|
|
|
-using System;
|
|
|
using System.Linq;
|
|
|
using System.Threading.Tasks;
|
|
|
using MafiaTelegramBot.DataBase.EntityDao;
|
|
@@ -15,28 +14,10 @@ namespace MafiaTelegramBot.Models.Inlines
|
|
|
{
|
|
|
await DeletePreviousMessage(ChatId, update.CallbackQuery.Message.MessageId);
|
|
|
var user = await UserDao.GetPlayerById(UserId);
|
|
|
- var rolesList = Enum.GetValues(typeof(Roles)).Cast<Roles>().ToList();
|
|
|
- rolesList.Remove(Roles.None);
|
|
|
- rolesList.Remove(Roles.All);
|
|
|
- if (!user.Statistics.Contains(Roles.All))
|
|
|
- await UserDao.ActiveUsers[UserId].LoadStatistics();
|
|
|
- var allStatsRow = user.Statistics[Roles.All];
|
|
|
- var message = "";
|
|
|
- user = await UserDao.GetPlayerById(UserId);
|
|
|
- if (allStatsRow.Games > 0)
|
|
|
- foreach (var role in rolesList)
|
|
|
- {
|
|
|
- if (user.Statistics.Contains(role) && user.Statistics[role].Games > 0)
|
|
|
- {
|
|
|
- var statsRow = user.Statistics[role];
|
|
|
- message += String.Format(strings.role_string, roles.ResourceManager.GetString(role.ToString()), statsRow.Wins, statsRow.Games, (int) (statsRow.GetWinrate()*100)) + '\n';
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- message += strings.no_stats_by_roles;
|
|
|
- }
|
|
|
- return await Bot.SendWithMarkdown2(ChatId, message);
|
|
|
+ var opened = user.OpenedRoles.ToList();
|
|
|
+ if (opened.Count > 3) return await Bot.SendWithMarkdown2(ChatId, opened.Where(role => role is not (Roles.Cop or Roles.Don or Roles.Doctor))
|
|
|
+ .Aggregate(strings.your_opened_roles_list, (current, role) => current + $"\n{roles.ResourceManager.GetString(role.ToString())}"));
|
|
|
+ return await Bot.SendWithMarkdown2(ChatId, strings.you_dont_have_any_extended_role);
|
|
|
}
|
|
|
}
|
|
|
}
|