fix duplicate meta data when restarting

fix issue with parsing anticheat info in non en-US culture
fix rare issue with client spots "swapping"
don't copy referenced shared library assemeblies from plugins
This commit is contained in:
RaidMax 2019-06-09 09:50:58 -05:00
parent 163523d586
commit 82390340c9
15 changed files with 64 additions and 26 deletions

View File

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion>
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
<Version>2.2.7.4</Version>
<Version>2.2.7.5</Version>
<Authors>RaidMax</Authors>
<Company>Forever None</Company>
<Product>IW4MAdmin</Product>
@ -32,8 +32,8 @@
<PropertyGroup>
<ServerGarbageCollection>true</ServerGarbageCollection>
<TieredCompilation>true</TieredCompilation>
<AssemblyVersion>2.2.7.4</AssemblyVersion>
<FileVersion>2.2.7.4</FileVersion>
<AssemblyVersion>2.2.7.5</AssemblyVersion>
<FileVersion>2.2.7.5</FileVersion>
<LangVersion>7.1</LangVersion>
</PropertyGroup>

View File

@ -30,7 +30,7 @@ namespace IW4MAdmin.Application.IO
public long Length => -1;
public int UpdateInterval => 350;
public int UpdateInterval => 550;
public async Task<ICollection<GameEvent>> ReadEventsFromLog(Server server, long fileSizeDiff, long startPosition)
{

View File

@ -164,6 +164,10 @@ namespace IW4MAdmin
/// <returns></returns>
override protected async Task<bool> ProcessEvent(GameEvent E)
{
#if DEBUG
Logger.WriteDebug($"processing event of type {E.Type}");
#endif
if (E.Type == GameEvent.EventType.ConnectionLost)
{
var exception = E.Extra as Exception;
@ -204,13 +208,21 @@ namespace IW4MAdmin
var existingClient = GetClientsAsList().FirstOrDefault(_client => _client.Equals(E.Origin));
// they're already connected
if (existingClient != null && !E.Origin.IsBot)
if (existingClient != null && existingClient.ClientNumber == E.Origin.ClientNumber && !E.Origin.IsBot)
{
Logger.WriteWarning($"detected preconnect for {E.Origin}, but they are already connected");
return false;
}
//CONNECT:
// this happens for some reason rarely where the client spots get out of order
// possible a connect/reconnect game event before we get to process it here
else if (existingClient != null && existingClient.ClientNumber != E.Origin.ClientNumber)
{
Logger.WriteWarning($"client {E.Origin} is trying to connect in client slot {E.Origin.ClientNumber}, but they are already registed in client slot {existingClient.ClientNumber}, swapping...");
// we need to remove them so the client spots can swap
await OnClientDisconnected(Clients[existingClient.ClientNumber]);
}
if (Clients[E.Origin.ClientNumber] == null)
{
#if DEBUG == true
@ -249,8 +261,6 @@ namespace IW4MAdmin
else
{
Logger.WriteWarning($"{E.Origin} is connecting but {Clients[E.Origin.ClientNumber]} is currently in that client slot");
//await OnClientDisconnected(Clients[E.Origin.ClientNumber]);
//goto CONNECT;
}
}
@ -561,7 +571,7 @@ namespace IW4MAdmin
{
try
{
#region SHUTDOWN
#region SHUTDOWN
if (Manager.CancellationToken.IsCancellationRequested)
{
foreach (var client in GetClientsAsList())
@ -584,7 +594,7 @@ namespace IW4MAdmin
return true;
}
#endregion
#endregion
try
{

View File

@ -11,7 +11,9 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" />
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -15,8 +15,12 @@
</Target>
<ItemGroup>
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" />
<ProjectReference Include="..\Stats\Stats.csproj" />
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj">
<Private>false</Private>
</ProjectReference>
<ProjectReference Include="..\Stats\Stats.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>

View File

@ -19,7 +19,9 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" />
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>

View File

@ -17,7 +17,9 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" />
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>

View File

@ -509,9 +509,9 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
TimeOffset = Int64.Parse(offset),
When = time,
IsKillstreakKill = isKillstreakKill[0] != '0',
AdsPercent = float.Parse(Ads),
Fraction = double.Parse(fraction),
VisibilityPercentage = double.Parse(visibilityPercentage),
AdsPercent = float.Parse(Ads, System.Globalization.CultureInfo.InvariantCulture),
Fraction = double.Parse(fraction, System.Globalization.CultureInfo.InvariantCulture),
VisibilityPercentage = double.Parse(visibilityPercentage, System.Globalization.CultureInfo.InvariantCulture),
IsKill = !isDamage,
AnglesList = snapshotAngles
};

View File

@ -17,8 +17,12 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" />
<ProjectReference Include="..\..\WebfrontCore\WebfrontCore.csproj" />
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj">
<Private>false</Private>
</ProjectReference>
<ProjectReference Include="..\..\WebfrontCore\WebfrontCore.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>

View File

@ -12,7 +12,9 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Stats\Stats.csproj" />
<ProjectReference Include="..\..\Stats\Stats.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>

View File

@ -17,7 +17,9 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj" />
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>

View File

@ -36,6 +36,7 @@ namespace SharedLibraryCore.Commands
public override Task ExecuteAsync(GameEvent E)
{
MetaService.Clear();
E.Owner.Manager.Restart();
E.Origin.Tell(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_RESTART_SUCCESS"]);
return Task.CompletedTask;

View File

@ -38,11 +38,16 @@ namespace SharedLibraryCore.Helpers
{
bool valid = Regex.Match(s, @"\((-?[0-9]+\.?[0-9]*|-?[0-9]+\.?[0-9]*e-[0-9]+),\ (-?[0-9]+\.?[0-9]*|-?[0-9]+\.?[0-9]*e-[0-9]+),\ (-?[0-9]+\.?[0-9]*|-?[0-9]+\.?[0-9]*e-[0-9]+)\)").Success;
if (!valid)
{
throw new FormatException("Vector3 is not in correct format");
}
string removeParenthesis = s.Substring(1, s.Length - 2);
string[] eachPoint = removeParenthesis.Split(',');
return new Vector3(float.Parse(eachPoint[0], System.Globalization.NumberStyles.Any), float.Parse(eachPoint[1], System.Globalization.NumberStyles.Any), float.Parse(eachPoint[2], System.Globalization.NumberStyles.Any));
return new Vector3(float.Parse(eachPoint[0], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture),
float.Parse(eachPoint[1], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture),
float.Parse(eachPoint[2], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture));
}
public static double Distance(Vector3 a, Vector3 b)
@ -54,14 +59,12 @@ namespace SharedLibraryCore.Helpers
{
double deltaX = Math.Abs(b.X -a.X);
double deltaY = Math.Abs(b.Y - a.Y);
double deltaZ = Math.Abs(b.Z - a.Z);
// this 'fixes' the roll-over angles
double dx = deltaX < 360.0 / 2 ? deltaX : 360.0 - deltaX;
double dy = deltaY < 360.0 / 2 ? deltaY : 360.0 - deltaY;
double dz = deltaZ < 360.0 / 2 ? deltaZ : 360.0 - deltaZ;
return Math.Sqrt((dx * dx) + (dy * dy) /*+ (dz * dz)*/);
return Math.Sqrt((dx * dx) + (dy * dy));
}
public static double ViewAngleDistance(Vector3 a, Vector3 b, Vector3 c)

View File

@ -56,6 +56,11 @@ namespace SharedLibraryCore.Services
}
}
internal static void Clear()
{
_metaActions.Clear();
}
/// <summary>
/// retrieves meta data for given client and key
/// </summary>

View File

@ -31,6 +31,7 @@ namespace SharedLibraryCore
public static Encoding EncodingType;
public static Localization.Layout CurrentLocalization = new Localization.Layout(new Dictionary<string, string>());
public static TimeSpan DefaultCommandTimeout = new TimeSpan(0, 0, 10);
public static CultureInfo BestCulture = CultureInfo.CreateSpecificCulture("en-US");
public static EFClient IW4MAdminClient(Server server = null)
{