mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
abstract engine color codes to use (Color::<Color>) format to make codes more.
see pt6 parser and configs for example usages
This commit is contained in:
@ -1,35 +1,32 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using SharedLibraryCore;
|
||||
using System.Collections.Generic;
|
||||
using Data.Abstractions;
|
||||
using Data.Models.Client.Stats;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using IW4MAdmin.Plugins.Stats.Helpers;
|
||||
using SharedLibraryCore.Configuration;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using EFClient = Data.Models.Client.EFClient;
|
||||
|
||||
namespace IW4MAdmin.Plugins.Stats.Commands
|
||||
{
|
||||
class TopStats : Command
|
||||
public class TopStats : Command
|
||||
{
|
||||
public static async Task<List<string>> GetTopStats(Server s, ITranslationLookup translationLookup)
|
||||
{
|
||||
long serverId = StatManager.GetIdForServer(s);
|
||||
var serverId = StatManager.GetIdForServer(s);
|
||||
var topStatsText = new List<string>()
|
||||
{
|
||||
$"^5--{translationLookup["PLUGINS_STATS_COMMANDS_TOP_TEXT"]}--"
|
||||
$"(Color::Accent)--{translationLookup["PLUGINS_STATS_COMMANDS_TOP_TEXT"]}--"
|
||||
};
|
||||
|
||||
var stats = await Plugin.Manager.GetTopStats(0, 5, serverId);
|
||||
var statsList = stats.Select((stats, index) => $"#{index + 1} ^3{stats.Name}^7 - ^5{stats.KDR} ^7{translationLookup["PLUGINS_STATS_TEXT_KDR"]} | ^5{stats.Performance} ^7{translationLookup["PLUGINS_STATS_COMMANDS_PERFORMANCE"]}");
|
||||
var statsList = stats.Select((stats, index) =>
|
||||
translationLookup["COMMANDS_TOPSTATS_RESULT"]
|
||||
.FormatExt(index + 1, stats.Name, stats.KDR, stats.Performance));
|
||||
|
||||
topStatsText.AddRange(statsList);
|
||||
|
||||
// no one qualified
|
||||
// no one qualified
|
||||
if (topStatsText.Count == 1)
|
||||
{
|
||||
topStatsText = new List<string>()
|
||||
@ -41,11 +38,10 @@ namespace IW4MAdmin.Plugins.Stats.Commands
|
||||
return topStatsText;
|
||||
}
|
||||
|
||||
private readonly CommandConfiguration _config;
|
||||
private readonly IDatabaseContextFactory _contextFactory;
|
||||
private new readonly CommandConfiguration _config;
|
||||
|
||||
public TopStats(CommandConfiguration config, ITranslationLookup translationLookup,
|
||||
IDatabaseContextFactory contextFactory) : base(config, translationLookup)
|
||||
public TopStats(CommandConfiguration config, ITranslationLookup translationLookup) : base(config,
|
||||
translationLookup)
|
||||
{
|
||||
Name = "topstats";
|
||||
Description = translationLookup["PLUGINS_STATS_COMMANDS_TOP_DESC"];
|
||||
@ -54,7 +50,6 @@ namespace IW4MAdmin.Plugins.Stats.Commands
|
||||
RequiresTarget = false;
|
||||
|
||||
_config = config;
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(GameEvent E)
|
||||
@ -76,4 +71,4 @@ namespace IW4MAdmin.Plugins.Stats.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user