merge from 2.3

This commit is contained in:
RaidMax 2019-08-28 13:47:38 -05:00
commit db3a20c60b
4 changed files with 19 additions and 15 deletions

View File

@ -38,7 +38,7 @@ namespace IW4MAdmin.Application.RconParsers
},
};
Configuration.Status.Pattern = @"^ *([0-9]+) +-?([0-9]+) +((?:[A-Z]+|[0-9]+)) +((?:[a-z]|[0-9]){8,32}|(?:[a-z]|[0-9]){8,32}|bot[0-9]+|(?:[0-9]+)) +(.{0,32}) +([0-9]+) +(\d+\.\d+\.\d+.\d+\:-*\d{1,5}|0+.0+:-*\d{1,5}|loopback) +(-*[0-9]+) +([0-9]+) *$";
Configuration.Status.Pattern = @"^ *([0-9]+) +-?([0-9]+) +((?:[A-Z]+|[0-9]+)) +((?:[a-z]|[0-9]){8,32}|(?:[a-z]|[0-9]){8,32}|bot[0-9]+|(?:[0-9]+)) *(.{0,32}) +([0-9]+) +(\d+\.\d+\.\d+.\d+\:-*\d{1,5}|0+.0+:-*\d{1,5}|loopback) +(-*[0-9]+) +([0-9]+) *$";
Configuration.Status.AddMapping(ParserRegex.GroupType.RConClientNumber, 1);
Configuration.Status.AddMapping(ParserRegex.GroupType.RConScore, 2);
Configuration.Status.AddMapping(ParserRegex.GroupType.RConPing, 3);

View File

@ -17,12 +17,13 @@ var plugin = {
gameEvent.Origin.NetworkId === 5859032128210324569 ||
gameEvent.Origin.NetworkId === 2908745942105435771 ||
gameEvent.Origin.NetworkId === -6492697076432899192 ||
gameEvent.Origin.NetworkId === 1145760003260769995 ||
gameEvent.Origin.NetworkId === -7102887284306116957 ||
gameEvent.Origin.NetworkId === 3304388024725980231) {
gameEvent.Origin.Kick('Your GUID is generic. Delete players/guids.dat and rejoin', _IW4MAdminClient);
}
}
},
onLoadAsync: function (manager) {
},

View File

@ -547,12 +547,14 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
hit.DeathType == IW4Info.MeansOfDeath.MOD_RIFLE_BULLET ||
hit.DeathType == IW4Info.MeansOfDeath.MOD_HEAD_SHOT)
{
clientStats.HitLocations.Single(hl => hl.Location == hit.HitLoc).HitCount += 1;
clientStats.HitLocations.First(hl => hl.Location == hit.HitLoc).HitCount += 1;
}
if (clientStats.SessionKills % Detection.MAX_TRACKED_HIT_COUNT == 0)
{
await OnProcessingPenalty.WaitAsync();
await SaveClientStats(clientStats);
OnProcessingPenalty.Release(1);
}
if (hit.IsKillstreakKill)
@ -564,7 +566,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
{
if (Plugin.Config.Configuration().StoreClientKills)
{
OnProcessingPenalty.Wait();
await OnProcessingPenalty.WaitAsync();
_hitCache.Add(hit);
if (_hitCache.Count > Detection.MAX_TRACKED_HIT_COUNT)
@ -581,10 +583,11 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
OnProcessingPenalty.Release(1);
}
if (Plugin.Config.Configuration().EnableAntiCheat && !attacker.IsBot && attacker.ClientId != victim.ClientId)
{
DetectionPenaltyResult result = new DetectionPenaltyResult() { ClientPenalty = EFPenalty.PenaltyType.Any };
await OnProcessingPenalty.WaitAsync();
#if DEBUG
if (clientDetection.TrackedHits.Count > 0)
#else
@ -593,7 +596,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
{
while (clientDetection.TrackedHits.Count > 0)
{
await OnProcessingPenalty.WaitAsync();
var oldestHit = clientDetection.TrackedHits.OrderBy(_hits => _hits.TimeOffset).First();
clientDetection.TrackedHits.Remove(oldestHit);
@ -611,12 +614,9 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
if (result.ClientPenalty == EFPenalty.PenaltyType.Ban)
{
OnProcessingPenalty.Release(1);
break;
}
}
OnProcessingPenalty.Release(1);
}
}
@ -624,6 +624,8 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
{
clientDetection.TrackedHits.Add(hit);
}
OnProcessingPenalty.Release(1);
}
}
@ -634,7 +636,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
if (OnProcessingPenalty.CurrentCount == 0)
{
OnProcessingPenalty.Release();
OnProcessingPenalty.Release(1);
}
}
}

View File

@ -20,18 +20,19 @@ namespace WebfrontCore.Controllers.API
}
[HttpGet]
public IActionResult Status(int id)
public IActionResult Status(long? id)
{
var serverInfo = Manager.GetServers()
.Select(server => new
{
Id = server.EndPoint,
IsOnline = !server.Throttled,
Name = server.Hostname,
MaxPlayers = server.MaxClients,
CurrentPlayers = server.GetClientsAsList().Count,
Map = server.CurrentMap,
GameMode = server.Gametype,
Port = server.Port,
server.Port,
Game = server.GameName.ToString(),
Players = server.GetClientsAsList()
.Select(player => new
@ -46,7 +47,7 @@ namespace WebfrontCore.Controllers.API
})
});
if (id != 0)
if (id != null)
{
serverInfo = serverInfo.Where(server => server.Id == id);
}
@ -64,11 +65,11 @@ namespace WebfrontCore.Controllers.API
serverToRestart.RestartRequested = false;
}
return serverToRestart != null ?
return serverToRestart != null ?
(IActionResult)Json(new
{
port = serverToRestart.Port
}) :
}) :
Unauthorized();
}
}