1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-07 21:58:06 -05:00

use correct EFClient return time for ScriptPluginExtensions and provide IPAddress on game interface data

This commit is contained in:
RaidMax 2024-07-12 22:08:23 -05:00
parent ee0b40d657
commit 135fc98e1c
2 changed files with 4 additions and 3 deletions

View File

@ -1,8 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Data.Models.Client;
using Data.Models.Client.Stats; using Data.Models.Client.Stats;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Interfaces; using SharedLibraryCore.Interfaces;
namespace IW4MAdmin.Application.Extensions; namespace IW4MAdmin.Application.Extensions;
@ -29,7 +29,7 @@ public static class ScriptPluginExtensions
} }
public static EFClient GetClientByNumber(this IGameServer server, int clientNumber) => public static EFClient GetClientByNumber(this IGameServer server, int clientNumber) =>
server.ConnectedClients.FirstOrDefault(client => client.ClientNumber == clientNumber); server.ConnectedClients.FirstOrDefault(client => client.ClientNumber >= 0 && client.ClientNumber == clientNumber);
public static EFClient GetClientByGuid(this IGameServer server, string clientGuid) => public static EFClient GetClientByGuid(this IGameServer server, string clientGuid) =>
server.ConnectedClients.FirstOrDefault(client => client?.GuidString == clientGuid?.Trim().ToLower()); server.ConnectedClients.FirstOrDefault(client => client?.GuidString == clientGuid?.Trim().ToLower());

View File

@ -262,7 +262,8 @@ const plugin = {
clientId: client.clientId, clientId: client.clientId,
lastConnection: client.timeSinceLastConnectionString, lastConnection: client.timeSinceLastConnectionString,
tag: tagMeta?.value ?? '', tag: tagMeta?.value ?? '',
performance: clientStats?.performance ?? 200.0 performance: clientStats?.performance ?? 200.0,
ipAddress: client.ipAddressString
}; };
} }