fixed up IW5 parser with new event system
changed login alias to li (duplicate) fixed crashing bug in generic repo fixed anonymous name in access to web console
This commit is contained in:
parent
8071fb37bc
commit
35e7f57156
@ -32,7 +32,7 @@ namespace IW4MAdmin.Application.EventParsers
|
|||||||
|
|
||||||
return new GameEvent()
|
return new GameEvent()
|
||||||
{
|
{
|
||||||
Type = GameEvent.EventType.Connect,
|
Type = GameEvent.EventType.Join,
|
||||||
Origin = new Player()
|
Origin = new Player()
|
||||||
{
|
{
|
||||||
ClientId = 1
|
ClientId = 1
|
||||||
|
@ -20,7 +20,7 @@ namespace IW4MAdmin.Application
|
|||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
AppDomain.CurrentDomain.SetData("DataDirectory", OperatingDirectory);
|
AppDomain.CurrentDomain.SetData("DataDirectory", OperatingDirectory);
|
||||||
System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal;
|
//System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal;
|
||||||
Localization.Configure.Initialize();
|
Localization.Configure.Initialize();
|
||||||
var loc = Utilities.CurrentLocalization.LocalizationSet;
|
var loc = Utilities.CurrentLocalization.LocalizationSet;
|
||||||
Console.OutputEncoding = Encoding.UTF8;
|
Console.OutputEncoding = Encoding.UTF8;
|
||||||
|
@ -140,7 +140,7 @@ namespace Application.RconParsers
|
|||||||
|
|
||||||
Int32.TryParse(playerInfo[2], out Ping);
|
Int32.TryParse(playerInfo[2], out Ping);
|
||||||
string name = Encoding.UTF8.GetString(Encoding.Convert(Utilities.EncodingType, Encoding.UTF8, Utilities.EncodingType.GetBytes(responseLine.Substring(23, 15).StripColors().Trim())));
|
string name = Encoding.UTF8.GetString(Encoding.Convert(Utilities.EncodingType, Encoding.UTF8, Utilities.EncodingType.GetBytes(responseLine.Substring(23, 15).StripColors().Trim())));
|
||||||
long networkId = playerInfo[4].ConvertLong();
|
long networkId = 0;//playerInfo[4].ConvertLong();
|
||||||
int.TryParse(playerInfo[0], out clientId);
|
int.TryParse(playerInfo[0], out clientId);
|
||||||
var regex = Regex.Match(responseLine, @"\d+\.\d+\.\d+.\d+\:\d{1,5}");
|
var regex = Regex.Match(responseLine, @"\d+\.\d+\.\d+.\d+\:\d{1,5}");
|
||||||
int ipAddress = regex.Value.Split(':')[0].ConvertToIP();
|
int ipAddress = regex.Value.Split(':')[0].ConvertToIP();
|
||||||
@ -155,7 +155,7 @@ namespace Application.RconParsers
|
|||||||
IPAddress = ipAddress,
|
IPAddress = ipAddress,
|
||||||
Ping = Ping,
|
Ping = Ping,
|
||||||
Score = score,
|
Score = score,
|
||||||
IsBot = networkId == 0
|
IsBot = false
|
||||||
};
|
};
|
||||||
|
|
||||||
StatusPlayers.Add(p);
|
StatusPlayers.Add(p);
|
||||||
|
@ -186,7 +186,7 @@ namespace IW4MAdmin
|
|||||||
var e = new GameEvent(GameEvent.EventType.Connect, "", player, null, this);
|
var e = new GameEvent(GameEvent.EventType.Connect, "", player, null, this);
|
||||||
Manager.GetEventHandler().AddEvent(e);
|
Manager.GetEventHandler().AddEvent(e);
|
||||||
|
|
||||||
e.OnProcessed.Wait();
|
// e.OnProcessed.Wait();
|
||||||
|
|
||||||
if (!Manager.GetApplicationSettings().Configuration().EnableClientVPNs &&
|
if (!Manager.GetApplicationSettings().Configuration().EnableClientVPNs &&
|
||||||
await VPNCheck.UsingVPN(player.IPAddressString, Manager.GetApplicationSettings().Configuration().IPHubAPIKey))
|
await VPNCheck.UsingVPN(player.IPAddressString, Manager.GetApplicationSettings().Configuration().IPHubAPIKey))
|
||||||
@ -413,6 +413,19 @@ namespace IW4MAdmin
|
|||||||
override protected async Task ProcessEvent(GameEvent E)
|
override protected async Task ProcessEvent(GameEvent E)
|
||||||
{
|
{
|
||||||
if (E.Type == GameEvent.EventType.Connect)
|
if (E.Type == GameEvent.EventType.Connect)
|
||||||
|
{
|
||||||
|
ChatHistory.Add(new ChatInfo()
|
||||||
|
{
|
||||||
|
Name = E.Origin.Name,
|
||||||
|
Message = "CONNECTED",
|
||||||
|
Time = DateTime.UtcNow
|
||||||
|
});
|
||||||
|
|
||||||
|
if (E.Origin.Level > Player.Permission.Moderator)
|
||||||
|
await E.Origin.Tell(string.Format(loc["SERVER_REPORT_COUNT"], E.Owner.Reports.Count));
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (E.Type == GameEvent.EventType.Join)
|
||||||
{
|
{
|
||||||
// special case for IW5 when connect is from the log
|
// special case for IW5 when connect is from the log
|
||||||
if (E.Extra != null && GameName == Game.IW5)
|
if (E.Extra != null && GameName == Game.IW5)
|
||||||
@ -424,22 +437,6 @@ namespace IW4MAdmin
|
|||||||
client.NetworkId = logClient.NetworkId;
|
client.NetworkId = logClient.NetworkId;
|
||||||
|
|
||||||
await AddPlayer(client);
|
await AddPlayer(client);
|
||||||
|
|
||||||
// hack: to prevent plugins from registering it as a real connect
|
|
||||||
E.Type = GameEvent.EventType.Unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ChatHistory.Add(new ChatInfo()
|
|
||||||
{
|
|
||||||
Name = E.Origin.Name,
|
|
||||||
Message = "CONNECTED",
|
|
||||||
Time = DateTime.UtcNow
|
|
||||||
});
|
|
||||||
|
|
||||||
if (E.Origin.Level > Player.Permission.Moderator)
|
|
||||||
await E.Origin.Tell(string.Format(loc["SERVER_REPORT_COUNT"], E.Owner.Reports.Count));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -571,10 +568,19 @@ namespace IW4MAdmin
|
|||||||
|
|
||||||
var clients = GetPlayersAsList();
|
var clients = GetPlayersAsList();
|
||||||
foreach (var client in clients)
|
foreach (var client in clients)
|
||||||
|
{
|
||||||
|
if (GameName == Game.IW5)
|
||||||
|
{
|
||||||
|
if (!CurrentPlayers.Select(c => c.ClientNumber).Contains(client.ClientNumber))
|
||||||
|
await RemovePlayer(client.ClientNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (!CurrentPlayers.Select(c => c.NetworkId).Contains(client.NetworkId))
|
if (!CurrentPlayers.Select(c => c.NetworkId).Contains(client.NetworkId))
|
||||||
await RemovePlayer(client.ClientNumber);
|
await RemovePlayer(client.ClientNumber);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < CurrentPlayers.Count; i++)
|
for (int i = 0; i < CurrentPlayers.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ namespace IW4MAdmin.Plugins.Login.Commands
|
|||||||
{
|
{
|
||||||
public class CLogin : Command
|
public class CLogin : Command
|
||||||
{
|
{
|
||||||
public CLogin() : base("login", Utilities.CurrentLocalization.LocalizationSet["PLUGINS_LOGIN_COMMANDS_LOGIN_DESC"], "l", Player.Permission.Trusted, false, new CommandArgument[]
|
public CLogin() : base("login", Utilities.CurrentLocalization.LocalizationSet["PLUGINS_LOGIN_COMMANDS_LOGIN_DESC"], "li", Player.Permission.Trusted, false, new CommandArgument[]
|
||||||
{
|
{
|
||||||
new CommandArgument()
|
new CommandArgument()
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
|
|||||||
{
|
{
|
||||||
double marginOfError = Thresholds.GetMarginOfError(Kills);
|
double marginOfError = Thresholds.GetMarginOfError(Kills);
|
||||||
// determine what the max headshot percentage can be for current number of kills
|
// determine what the max headshot percentage can be for current number of kills
|
||||||
double lerpAmount = Math.Min(1.0, (Kills - Thresholds.LowSampleMinKills) / (double)(Thresholds.HighSampleMinKills - Thresholds.LowSampleMinKills));
|
double lerpAmount = Math.Min(1.0, (Kills - Thresholds.LowSampleMinKills) / (double)(/*Thresholds.HighSampleMinKills*/ 60 - Thresholds.LowSampleMinKills));
|
||||||
double maxHeadshotLerpValueForFlag = Thresholds.Lerp(Thresholds.HeadshotRatioThresholdLowSample(2.0), Thresholds.HeadshotRatioThresholdHighSample(2.0), lerpAmount) + marginOfError;
|
double maxHeadshotLerpValueForFlag = Thresholds.Lerp(Thresholds.HeadshotRatioThresholdLowSample(2.0), Thresholds.HeadshotRatioThresholdHighSample(2.0), lerpAmount) + marginOfError;
|
||||||
double maxHeadshotLerpValueForBan = Thresholds.Lerp(Thresholds.HeadshotRatioThresholdLowSample(3.0), Thresholds.HeadshotRatioThresholdHighSample(3.0), lerpAmount) + marginOfError;
|
double maxHeadshotLerpValueForBan = Thresholds.Lerp(Thresholds.HeadshotRatioThresholdLowSample(3.0), Thresholds.HeadshotRatioThresholdHighSample(3.0), lerpAmount) + marginOfError;
|
||||||
// determine what the max bone percentage can be for current number of kills
|
// determine what the max bone percentage can be for current number of kills
|
||||||
@ -91,7 +91,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
|
|||||||
double maxBoneRatioLerpValueForBan = Thresholds.Lerp(Thresholds.BoneRatioThresholdLowSample(3.25), Thresholds.BoneRatioThresholdHighSample(3.25), lerpAmount) + marginOfError;
|
double maxBoneRatioLerpValueForBan = Thresholds.Lerp(Thresholds.BoneRatioThresholdLowSample(3.25), Thresholds.BoneRatioThresholdHighSample(3.25), lerpAmount) + marginOfError;
|
||||||
|
|
||||||
// calculate headshot ratio
|
// calculate headshot ratio
|
||||||
double currentHeadshotRatio = ((HitLocationCount[IW4Info.HitLocation.head] + HitLocationCount[IW4Info.HitLocation.helmet]) / (double)Kills);
|
double currentHeadshotRatio = ((HitLocationCount[IW4Info.HitLocation.head] + HitLocationCount[IW4Info.HitLocation.helmet] + HitLocationCount[IW4Info.HitLocation.neck]) / (double)Kills);
|
||||||
|
|
||||||
// calculate maximum bone
|
// calculate maximum bone
|
||||||
double currentMaxBoneRatio = (HitLocationCount.Values.Select(v => v / (double)Kills).Max());
|
double currentMaxBoneRatio = (HitLocationCount.Values.Select(v => v / (double)Kills).Max());
|
||||||
@ -276,8 +276,8 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
|
|||||||
double marginOfError = Thresholds.GetMarginOfError(totalChestKills);
|
double marginOfError = Thresholds.GetMarginOfError(totalChestKills);
|
||||||
double lerpAmount = Math.Min(1.0, (totalChestKills - 60) / 250.0);
|
double lerpAmount = Math.Min(1.0, (totalChestKills - 60) / 250.0);
|
||||||
// determine max acceptable ratio of chest to abdomen kills
|
// determine max acceptable ratio of chest to abdomen kills
|
||||||
double chestAbdomenRatioLerpValueForFlag = Thresholds.Lerp(Thresholds.ChestAbdomenRatioThresholdHighSample(3.0), Thresholds.ChestAbdomenRatioThresholdHighSample(2), lerpAmount) + marginOfError;
|
double chestAbdomenRatioLerpValueForFlag = Thresholds.Lerp(Thresholds.ChestAbdomenRatioThresholdHighSample(3.0), Thresholds.ChestAbdomenRatioThresholdHighSample(2.0), lerpAmount) + marginOfError;
|
||||||
double chestAbdomenLerpValueForBan = Thresholds.Lerp(Thresholds.ChestAbdomenRatioThresholdHighSample(4.0), Thresholds.ChestAbdomenRatioThresholdHighSample(4.0), lerpAmount) + marginOfError;
|
double chestAbdomenLerpValueForBan = Thresholds.Lerp(Thresholds.ChestAbdomenRatioThresholdHighSample(4.0), Thresholds.ChestAbdomenRatioThresholdHighSample(3.0), lerpAmount) + marginOfError;
|
||||||
|
|
||||||
double currentChestAbdomenRatio = totalChestKills /
|
double currentChestAbdomenRatio = totalChestKills /
|
||||||
stats.HitLocations.Single(hl => hl.Location == IW4Info.HitLocation.torso_lower).HitCount;
|
stats.HitLocations.Single(hl => hl.Location == IW4Info.HitLocation.torso_lower).HitCount;
|
||||||
|
@ -230,7 +230,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
|||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
{
|
{
|
||||||
Log.WriteWarning("Could not parse kill or death origin or viewangle vectors");
|
Log.WriteWarning("Could not parse kill or death origin or viewangle vectors");
|
||||||
Log.WriteDebug($"Kill - {killOrigin} Death - {deathOrigin} ViewAgnel - {viewAngles}");
|
Log.WriteDebug($"Kill - {killOrigin} Death - {deathOrigin} ViewAngle - {viewAngles}");
|
||||||
await AddStandardKill(attacker, victim);
|
await AddStandardKill(attacker, victim);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ namespace SharedLibraryCore
|
|||||||
Start,
|
Start,
|
||||||
Stop,
|
Stop,
|
||||||
Connect,
|
Connect,
|
||||||
|
// this is for IW5 compatibility
|
||||||
|
Join,
|
||||||
Disconnect,
|
Disconnect,
|
||||||
Say,
|
Say,
|
||||||
MapChange,
|
MapChange,
|
||||||
|
@ -15,11 +15,6 @@ namespace SharedLibraryCore.Services
|
|||||||
private dynamic _context;
|
private dynamic _context;
|
||||||
private DbSet<TEntity> _dbSet;
|
private DbSet<TEntity> _dbSet;
|
||||||
|
|
||||||
~GenericRepository()
|
|
||||||
{
|
|
||||||
_context.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected DbContext Context
|
protected DbContext Context
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -38,7 +38,9 @@ namespace WebfrontCore.Controllers
|
|||||||
{
|
{
|
||||||
Client = Client ?? new EFClient()
|
Client = Client ?? new EFClient()
|
||||||
{
|
{
|
||||||
ClientId = -1
|
ClientId = -1,
|
||||||
|
Level = Player.Permission.User,
|
||||||
|
CurrentAlias = new EFAlias() { Name = "Web Console Guest" }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!HttpContext.Connection.RemoteIpAddress.GetAddressBytes().SequenceEqual(LocalHost))
|
if (!HttpContext.Connection.RemoteIpAddress.GetAddressBytes().SequenceEqual(LocalHost))
|
||||||
@ -78,9 +80,9 @@ namespace WebfrontCore.Controllers
|
|||||||
|
|
||||||
Authorized = Client.ClientId >= 0;
|
Authorized = Client.ClientId >= 0;
|
||||||
ViewBag.Authorized = Authorized;
|
ViewBag.Authorized = Authorized;
|
||||||
ViewBag.Url = Startup.Configuration["Web:Address"];
|
ViewBag.Url = Manager.GetApplicationSettings().Configuration().WebfrontBindUrl;
|
||||||
ViewBag.User = Client;
|
ViewBag.User = Client;
|
||||||
ViewBag.DiscordLink = DiscordLink;
|
ViewBag.DiscordLink = DiscordLink ?? "";
|
||||||
|
|
||||||
base.OnActionExecuting(context);
|
base.OnActionExecuting(context);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ namespace WebfrontCore.Controllers
|
|||||||
ClientId = Client.ClientId,
|
ClientId = Client.ClientId,
|
||||||
Level = Client.Level,
|
Level = Client.Level,
|
||||||
CurrentServer = server,
|
CurrentServer = server,
|
||||||
CurrentAlias = new Alias() { Name = Client.Name }
|
Name = Client.Name
|
||||||
};
|
};
|
||||||
var remoteEvent = new GameEvent()
|
var remoteEvent = new GameEvent()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user