2022-10-17 10:17:43 -04:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2022-10-23 14:29:01 -04:00
|
|
|
|
using Data.Models.Client.Stats;
|
2022-10-17 10:17:43 -04:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2022-10-23 14:29:01 -04:00
|
|
|
|
using SharedLibraryCore;
|
2022-10-17 10:17:43 -04:00
|
|
|
|
|
|
|
|
|
namespace IW4MAdmin.Application.Extensions;
|
|
|
|
|
|
|
|
|
|
public static class ScriptPluginExtensions
|
|
|
|
|
{
|
|
|
|
|
public static IEnumerable<object> GetClientsBasicData(
|
|
|
|
|
this DbSet<Data.Models.Client.EFClient> set, int[] clientIds)
|
|
|
|
|
{
|
|
|
|
|
return set.Where(client => clientIds.Contains(client.ClientId))
|
|
|
|
|
.Select(client => new
|
|
|
|
|
{
|
|
|
|
|
client.ClientId,
|
|
|
|
|
client.CurrentAlias,
|
|
|
|
|
client.Level,
|
|
|
|
|
client.NetworkId
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
2022-10-23 14:29:01 -04:00
|
|
|
|
|
|
|
|
|
public static IEnumerable<object> GetClientsStatData(this DbSet<EFClientStatistics> set, int[] clientIds,
|
|
|
|
|
double serverId)
|
|
|
|
|
{
|
|
|
|
|
return set.Where(stat => clientIds.Contains(stat.ClientId) && stat.ServerId == (long)serverId).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static object GetId(this Server server)
|
|
|
|
|
{
|
|
|
|
|
return server.GetIdForServer().GetAwaiter().GetResult();
|
|
|
|
|
}
|
2022-10-17 10:17:43 -04:00
|
|
|
|
}
|