Use string for AC snapshot weapon and hit location

Add webfront logging
This commit is contained in:
RaidMax 2021-06-29 15:02:01 -05:00
parent 95cbc85144
commit 42979dc5ae
42 changed files with 12207 additions and 1471 deletions

4
.gitignore vendored
View File

@ -245,4 +245,6 @@ launchSettings.json
/Tests/ApplicationTests/Files/replay.json
/GameLogServer/game_log_server_env
.idea/*
*.db
*.db
/Data/IW4MAdmin_Migration.db-shm
/Data/IW4MAdmin_Migration.db-wal

View File

@ -3,7 +3,13 @@
"Using": [
"Serilog.Sinks.File"
],
"MinimumLevel": "Information",
"MinimumLevel": {
"Default": "Information",
"Override": {
"System": "Warning",
"Microsoft": "Warning"
}
},
"WriteTo": [
{
"Name": "File",

View File

@ -8,62 +8,9 @@
<PackageId>RaidMax.IW4MAdmin.Data</PackageId>
<Title>RaidMax.IW4MAdmin.Data</Title>
<Authors />
<PackageVersion>1.0.1</PackageVersion>
<PackageVersion>1.0.3</PackageVersion>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Migrations\MySql\20210210221342_AddAdditionalClientStats.cs" />
<Compile Remove="Migrations\MySql\20210210221342_AddAdditionalClientStats.Designer.cs" />
<Compile Remove="Migrations\Postgresql\20210224014503_AddAdditionalClientStats.cs" />
<Compile Remove="Migrations\Postgresql\20210224014503_AddAdditionalClientStats.Designer.cs" />
<Compile Remove="Migrations\Postgresql\20210224030227_AddAdditionalClientStats.cs" />
<Compile Remove="Migrations\Postgresql\20210224030227_AddAdditionalClientStats.Designer.cs" />
<Compile Remove="Migrations\Postgresql\20210224031245_AddAdditionalClientStats.cs" />
<Compile Remove="Migrations\Postgresql\20210224031245_AddAdditionalClientStats.Designer.cs" />
<Compile Remove="Migrations\Postgresql\20210227041237_AddPerformancePercentileToClientStats.cs" />
<Compile Remove="Migrations\Postgresql\20210227041237_AddPerformancePercentileToClientStats.Designer.cs" />
<Compile Remove="Migrations\Postgresql\20210227161333_AddPerformancePercentileToClientStats.cs" />
<Compile Remove="Migrations\Postgresql\20210227161333_AddPerformancePercentileToClientStats.Designer.cs" />
<Compile Remove="Migrations\Postgresql\20210307163752_AddRankingHistory.cs" />
<Compile Remove="Migrations\Postgresql\20210307163752_AddRankingHistory.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210209205243_AddAdditionaClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210209205243_AddAdditionaClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210209205948_AddAdditionaClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210209205948_AddAdditionaClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210209211745_AddAdditionaClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210209211745_AddAdditionaClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210209212725_AddAdditionaClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210209212725_AddAdditionaClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210210020314_AddAdditionaClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210210020314_AddAdditionaClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210210140835_AddAdditionaClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210210140835_AddAdditionaClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210210154738_AddAdditionaClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210210154738_AddAdditionaClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210210163803_AddAdditionaClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210210163803_AddAdditionaClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210210193852_AddAdditionaClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210210193852_AddAdditionaClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210211033835_AddAdditionalClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210211033835_AddAdditionalClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210219013429_AddAdditionalClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210219013429_AddAdditionalClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210220171950_AddAdditionalClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210220171950_AddAdditionalClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210223163022_AddAdditionalClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210223163022_AddAdditionalClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210226215929_AddPerformancePercentileToClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210226215929_AddPerformancePercentileToClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210227160800_AddPerformancePercentileToClientStats.cs" />
<Compile Remove="Migrations\Sqlite\20210227160800_AddPerformancePercentileToClientStats.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210305033616_AddRankingHistory.cs" />
<Compile Remove="Migrations\Sqlite\20210305033616_AddRankingHistory.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210305033846_AddRankingHistory.cs" />
<Compile Remove="Migrations\Sqlite\20210305033846_AddRankingHistory.Designer.cs" />
<Compile Remove="Migrations\Sqlite\20210306223712_AddRankingHistory.cs" />
<Compile Remove="Migrations\Sqlite\20210306223712_AddRankingHistory.Designer.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.10">

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Data.Migrations.MySql
{
public partial class AddWeaponReferenceToEFClientKill : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "WeaponReference",
table: "EFClientKills",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "WeaponReference",
table: "EFClientKills");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Data.Migrations.MySql
{
public partial class AddWeaponReferenceAndServerIdToEFACSnapshot : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "ServerId",
table: "EFACSnapshot",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "WeaponReference",
table: "EFACSnapshot",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_EFACSnapshot_ServerId",
table: "EFACSnapshot",
column: "ServerId");
migrationBuilder.AddForeignKey(
name: "FK_EFACSnapshot_EFServers_ServerId",
table: "EFACSnapshot",
column: "ServerId",
principalTable: "EFServers",
principalColumn: "ServerId",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EFACSnapshot_EFServers_ServerId",
table: "EFACSnapshot");
migrationBuilder.DropIndex(
name: "IX_EFACSnapshot_ServerId",
table: "EFACSnapshot");
migrationBuilder.DropColumn(
name: "ServerId",
table: "EFACSnapshot");
migrationBuilder.DropColumn(
name: "WeaponReference",
table: "EFACSnapshot");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Data.Migrations.MySql
{
public partial class AddHitLocationReferenceToEFACSnapshot : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "HitLocationReference",
table: "EFACSnapshot",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "HitLocationReference",
table: "EFACSnapshot");
}
}
}

View File

@ -146,6 +146,9 @@ namespace Data.Migrations.MySql
b.Property<int>("Weapon")
.HasColumnType("int");
b.Property<string>("WeaponReference")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<DateTime>("When")
.HasColumnType("datetime(6)");
@ -237,6 +240,9 @@ namespace Data.Migrations.MySql
b.Property<int>("HitLocation")
.HasColumnType("int");
b.Property<string>("HitLocationReference")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<int>("HitOriginId")
.HasColumnType("int");
@ -255,6 +261,9 @@ namespace Data.Migrations.MySql
b.Property<double>("RecoilOffset")
.HasColumnType("double");
b.Property<long?>("ServerId")
.HasColumnType("bigint");
b.Property<double>("SessionAngleOffset")
.HasColumnType("double");
@ -279,6 +288,9 @@ namespace Data.Migrations.MySql
b.Property<int>("WeaponId")
.HasColumnType("int");
b.Property<string>("WeaponReference")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<DateTime>("When")
.HasColumnType("datetime(6)");
@ -294,6 +306,8 @@ namespace Data.Migrations.MySql
b.HasIndex("LastStrainAngleId");
b.HasIndex("ServerId");
b.ToTable("EFACSnapshot");
});
@ -1103,6 +1117,10 @@ namespace Data.Migrations.MySql
.HasForeignKey("LastStrainAngleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Data.Models.Server.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientHitStatistic", b =>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Data.Migrations.Postgresql
{
public partial class AddWeaponReferenceToEFClientKill : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "WeaponReference",
table: "EFClientKills",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "WeaponReference",
table: "EFClientKills");
}
}
}

View File

@ -0,0 +1,52 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Data.Migrations.Postgresql
{
public partial class AddWeaponReferenceAndServerIdToEFACSnapshot : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "ServerId",
table: "EFACSnapshot",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "WeaponReference",
table: "EFACSnapshot",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_EFACSnapshot_ServerId",
table: "EFACSnapshot",
column: "ServerId");
migrationBuilder.AddForeignKey(
name: "FK_EFACSnapshot_EFServers_ServerId",
table: "EFACSnapshot",
column: "ServerId",
principalTable: "EFServers",
principalColumn: "ServerId",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_EFACSnapshot_EFServers_ServerId",
table: "EFACSnapshot");
migrationBuilder.DropIndex(
name: "IX_EFACSnapshot_ServerId",
table: "EFACSnapshot");
migrationBuilder.DropColumn(
name: "ServerId",
table: "EFACSnapshot");
migrationBuilder.DropColumn(
name: "WeaponReference",
table: "EFACSnapshot");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Data.Migrations.Postgresql
{
public partial class AddHitLocationReferenceToEFACSnapshot : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "HitLocationReference",
table: "EFACSnapshot",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "HitLocationReference",
table: "EFACSnapshot");
}
}
}

View File

@ -151,6 +151,9 @@ namespace Data.Migrations.Postgresql
b.Property<int>("Weapon")
.HasColumnType("integer");
b.Property<string>("WeaponReference")
.HasColumnType("text");
b.Property<DateTime>("When")
.HasColumnType("timestamp without time zone");
@ -244,6 +247,9 @@ namespace Data.Migrations.Postgresql
b.Property<int>("HitLocation")
.HasColumnType("integer");
b.Property<string>("HitLocationReference")
.HasColumnType("text");
b.Property<int>("HitOriginId")
.HasColumnType("integer");
@ -262,6 +268,9 @@ namespace Data.Migrations.Postgresql
b.Property<double>("RecoilOffset")
.HasColumnType("double precision");
b.Property<long?>("ServerId")
.HasColumnType("bigint");
b.Property<double>("SessionAngleOffset")
.HasColumnType("double precision");
@ -286,6 +295,9 @@ namespace Data.Migrations.Postgresql
b.Property<int>("WeaponId")
.HasColumnType("integer");
b.Property<string>("WeaponReference")
.HasColumnType("text");
b.Property<DateTime>("When")
.HasColumnType("timestamp without time zone");
@ -301,6 +313,8 @@ namespace Data.Migrations.Postgresql
b.HasIndex("LastStrainAngleId");
b.HasIndex("ServerId");
b.ToTable("EFACSnapshot");
});
@ -1128,6 +1142,10 @@ namespace Data.Migrations.Postgresql
.HasForeignKey("LastStrainAngleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Data.Models.Server.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientHitStatistic", b =>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Data.Migrations.Sqlite
{
public partial class AddWeaponReferenceToEFClientKill : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "WeaponReference",
table: "EFClientKills",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "WeaponReference",
table: "EFClientKills");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,162 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Data.Migrations.Sqlite
{
public partial class AddWeaponReferenceAndServerIdToEFACSnapshot : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(@"PRAGMA foreign_keys = 0;
CREATE TABLE sqlitestudio_temp_table AS SELECT *
FROM EFACSnapshot;
DROP TABLE EFACSnapshot;
CREATE TABLE EFACSnapshot (
Active INTEGER NOT NULL,
TimeSinceLastEvent INTEGER NOT NULL,
SnapshotId INTEGER NOT NULL
CONSTRAINT PK_EFACSnapshot PRIMARY KEY AUTOINCREMENT,
ClientId INTEGER NOT NULL,
ServerId INTEGER CONSTRAINT FK_EFACSnapshot_EFServers_ServerId REFERENCES EFServers (ServerId) ON DELETE RESTRICT,
[When] TEXT NOT NULL,
CurrentSessionLength INTEGER NOT NULL,
EloRating REAL NOT NULL,
SessionScore INTEGER NOT NULL,
SessionSPM REAL NOT NULL,
Hits INTEGER NOT NULL,
Kills INTEGER NOT NULL,
Deaths INTEGER NOT NULL,
CurrentStrain REAL NOT NULL,
StrainAngleBetween REAL NOT NULL,
SessionAngleOffset REAL NOT NULL,
LastStrainAngleId INTEGER NOT NULL,
HitOriginId INTEGER NOT NULL,
HitDestinationId INTEGER NOT NULL,
Distance REAL NOT NULL,
CurrentViewAngleId INTEGER,
WeaponId INTEGER NOT NULL,
WeaponReference TEXT,
HitLocation INTEGER NOT NULL,
HitType INTEGER NOT NULL,
RecoilOffset REAL NOT NULL
DEFAULT 0.0,
SessionAverageSnapValue REAL NOT NULL
DEFAULT 0.0,
SessionSnapHits INTEGER NOT NULL
DEFAULT 0,
CONSTRAINT FK_EFACSnapshot_EFClients_ClientId FOREIGN KEY (
ClientId
)
REFERENCES EFClients (ClientId) ON DELETE CASCADE,
CONSTRAINT FK_EFACSnapshot_Vector3_CurrentViewAngleId FOREIGN KEY (
CurrentViewAngleId
)
REFERENCES Vector3 (Vector3Id) ON DELETE RESTRICT,
CONSTRAINT FK_EFACSnapshot_Vector3_HitDestinationId FOREIGN KEY (
HitDestinationId
)
REFERENCES Vector3 (Vector3Id) ON DELETE CASCADE,
CONSTRAINT FK_EFACSnapshot_Vector3_HitOriginId FOREIGN KEY (
HitOriginId
)
REFERENCES Vector3 (Vector3Id) ON DELETE CASCADE,
CONSTRAINT FK_EFACSnapshot_Vector3_LastStrainAngleId FOREIGN KEY (
LastStrainAngleId
)
REFERENCES Vector3 (Vector3Id) ON DELETE CASCADE
);
INSERT INTO EFACSnapshot (
Active,
TimeSinceLastEvent,
SnapshotId,
ClientId,
[When],
CurrentSessionLength,
EloRating,
SessionScore,
SessionSPM,
Hits,
Kills,
Deaths,
CurrentStrain,
StrainAngleBetween,
SessionAngleOffset,
LastStrainAngleId,
HitOriginId,
HitDestinationId,
Distance,
CurrentViewAngleId,
WeaponId,
HitLocation,
HitType,
RecoilOffset,
SessionAverageSnapValue,
SessionSnapHits
)
SELECT Active,
TimeSinceLastEvent,
SnapshotId,
ClientId,
""When"",
CurrentSessionLength,
EloRating,
SessionScore,
SessionSPM,
Hits,
Kills,
Deaths,
CurrentStrain,
StrainAngleBetween,
SessionAngleOffset,
LastStrainAngleId,
HitOriginId,
HitDestinationId,
Distance,
CurrentViewAngleId,
WeaponId,
HitLocation,
HitType,
RecoilOffset,
SessionAverageSnapValue,
SessionSnapHits
FROM sqlitestudio_temp_table;
DROP TABLE sqlitestudio_temp_table;
CREATE INDEX IX_EFACSnapshot_ClientId ON EFACSnapshot (
""ClientId""
);
CREATE INDEX IX_EFACSnapshot_CurrentViewAngleId ON EFACSnapshot (
""CurrentViewAngleId""
);
CREATE INDEX IX_EFACSnapshot_HitDestinationId ON EFACSnapshot (
""HitDestinationId""
);
CREATE INDEX IX_EFACSnapshot_HitOriginId ON EFACSnapshot (
""HitOriginId""
);
CREATE INDEX IX_EFACSnapshot_LastStrainAngleId ON EFACSnapshot (
""LastStrainAngleId""
);
CREATE INDEX IX_EFACSnapshot_ServerId ON EFACSnapshot (
""_ServerId""
);
PRAGMA foreign_keys = 1;
");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Data.Migrations.Sqlite
{
public partial class AddHitLocationReferenceToEFACSnapshot : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "HitLocationReference",
table: "EFACSnapshot",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "HitLocationReference",
table: "EFACSnapshot");
}
}
}

View File

@ -145,6 +145,9 @@ namespace Data.Migrations.Sqlite
b.Property<int>("Weapon")
.HasColumnType("INTEGER");
b.Property<string>("WeaponReference")
.HasColumnType("TEXT");
b.Property<DateTime>("When")
.HasColumnType("TEXT");
@ -236,6 +239,9 @@ namespace Data.Migrations.Sqlite
b.Property<int>("HitLocation")
.HasColumnType("INTEGER");
b.Property<string>("HitLocationReference")
.HasColumnType("TEXT");
b.Property<int>("HitOriginId")
.HasColumnType("INTEGER");
@ -254,6 +260,9 @@ namespace Data.Migrations.Sqlite
b.Property<double>("RecoilOffset")
.HasColumnType("REAL");
b.Property<long?>("ServerId")
.HasColumnType("INTEGER");
b.Property<double>("SessionAngleOffset")
.HasColumnType("REAL");
@ -278,6 +287,9 @@ namespace Data.Migrations.Sqlite
b.Property<int>("WeaponId")
.HasColumnType("INTEGER");
b.Property<string>("WeaponReference")
.HasColumnType("TEXT");
b.Property<DateTime>("When")
.HasColumnType("TEXT");
@ -293,6 +305,8 @@ namespace Data.Migrations.Sqlite
b.HasIndex("LastStrainAngleId");
b.HasIndex("ServerId");
b.ToTable("EFACSnapshot");
});
@ -1102,6 +1116,10 @@ namespace Data.Migrations.Sqlite
.HasForeignKey("LastStrainAngleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Data.Models.Server.EFServer", "Server")
.WithMany()
.HasForeignKey("ServerId");
});
modelBuilder.Entity("Data.Models.Client.Stats.EFClientHitStatistic", b =>

View File

@ -18,7 +18,9 @@ namespace Data.Models.Client
public int HitLoc { get; set; }
public int DeathType { get; set; }
public int Damage { get; set; }
[Obsolete]
public int Weapon { get; set; }
public string WeaponReference { get; set; }
public Vector3 KillOrigin { get; set; }
public Vector3 DeathOrigin { get; set; }
public Vector3 ViewAngles { get; set; }

View File

@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Numerics;
using Data.Models.Server;
namespace Data.Models.Client.Stats
{
@ -17,7 +18,9 @@ namespace Data.Models.Client.Stats
public int ClientId { get; set; }
[ForeignKey("ClientId")]
public EFClient Client { get; set; }
public long? ServerId { get; set; }
[ForeignKey(nameof(ServerId))]
public EFServer Server { get; set; }
public DateTime When { get; set; }
public int CurrentSessionLength { get; set; }
public int TimeSinceLastEvent { get; set; }
@ -46,8 +49,11 @@ namespace Data.Models.Client.Stats
public int CurrentViewAngleId { get; set; }
[ForeignKey("CurrentViewAngleId")]
public Vector3 CurrentViewAngle { get; set; }
[Obsolete]
public int WeaponId { get; set; }
public string WeaponReference { get; set; }
public int HitLocation { get; set; }
public string HitLocationReference { get; set; }
public int HitType { get; set; }
public virtual ICollection<EFACSnapshotVector3> PredictedViewAngles { get; set; }
@ -55,5 +61,7 @@ namespace Data.Models.Client.Stats
public string CapturedViewAngles => PredictedViewAngles?.Count > 0 ?
string.Join(", ", PredictedViewAngles.OrderBy(_angle => _angle.ACSnapshotVector3Id).Select(_angle => _angle.Vector.ToString())) :
"";
[NotMapped] public string ServerName => Server?.HostName ?? "--";
}
}

View File

@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.SyndicationFeed.ReaderWriter" Version="1.0.2" />
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.3.19.1" PrivateAssets="All" />
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.6.29.1" PrivateAssets="All" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -10,7 +10,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.3.19.1" PrivateAssets="All" />
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.6.29.1" PrivateAssets="All" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -23,7 +23,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.3.19.1" PrivateAssets="All" />
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.6.29.1" PrivateAssets="All" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -19,7 +19,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.3.19.1" PrivateAssets="All" />
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.6.29.1" PrivateAssets="All" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -16,7 +16,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.3.19.1" PrivateAssets="All" />
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.6.29.1" PrivateAssets="All" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -38,7 +38,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
double AngleDifferenceAverage;
EFClientStatistics ClientStats;
long LastOffset;
IW4Info.WeaponName LastWeapon;
string LastWeapon;
ILogger Log;
Strain Strain;
readonly DateTime ConnectionTime = DateTime.UtcNow;
@ -111,7 +111,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
hit.DeathType != (int)IW4Info.MeansOfDeath.MOD_HEAD_SHOT) ||
hit.HitLoc == (int)IW4Info.HitLocation.none || hit.TimeOffset - LastOffset < 0 ||
// hack: prevents false positives
((int)LastWeapon != hit.Weapon && (hit.TimeOffset - LastOffset) == 50))
(LastWeapon != hit.WeaponReference && (hit.TimeOffset - LastOffset) == 50))
{
return new[] {new DetectionPenaltyResult()
{
@ -119,7 +119,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
}};
}
LastWeapon = (IW4Info.WeaponName)(hit.Weapon);
LastWeapon = hit.WeaponReference;
HitLocationCount[(IW4Info.HitLocation)hit.HitLoc].Count++;
HitCount++;
@ -309,7 +309,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
try
{
shouldIgnoreDetection = Plugin.Config.Configuration().AnticheatConfiguration.IgnoredDetectionSpecification[(Server.Game)hit.GameName][DetectionType.Recoil]
.Any(_weaponRegex => Regex.IsMatch(((IW4Info.WeaponName)(hit.Weapon)).ToString(), _weaponRegex));
.Any(_weaponRegex => Regex.IsMatch(hit.WeaponReference, _weaponRegex));
}
catch (KeyNotFoundException)
@ -341,7 +341,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
{
shouldIgnoreDetection = false;
shouldIgnoreDetection = Plugin.Config.Configuration().AnticheatConfiguration.IgnoredDetectionSpecification[(Server.Game)hit.GameName][DetectionType.Button]
.Any(_weaponRegex => Regex.IsMatch(((IW4Info.WeaponName)(hit.Weapon)).ToString(), _weaponRegex));
.Any(_weaponRegex => Regex.IsMatch(hit.WeaponReference, _weaponRegex));
}
catch (KeyNotFoundException)
@ -454,7 +454,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
{
shouldIgnoreDetection = false; // reset previous value
shouldIgnoreDetection = Plugin.Config.Configuration().AnticheatConfiguration.IgnoredDetectionSpecification[(Server.Game)hit.GameName][DetectionType.Chest]
.Any(_weaponRegex => Regex.IsMatch(((IW4Info.WeaponName)(hit.Weapon)).ToString(), _weaponRegex));
.Any(_weaponRegex => Regex.IsMatch(hit.WeaponReference, _weaponRegex));
}
catch (KeyNotFoundException)
@ -506,6 +506,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
{
When = hit.When,
ClientId = ClientStats.ClientId,
ServerId = ClientStats.ServerId,
SessionAngleOffset = AngleDifferenceAverage,
RecoilOffset = hitRecoilAverage,
CurrentSessionLength = (int)(DateTime.UtcNow - ConnectionTime).TotalMinutes,
@ -527,7 +528,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
SessionSPM = Math.Round(ClientStats.SessionSPM, 0),
StrainAngleBetween = Strain.LastDistance,
TimeSinceLastEvent = (int)Strain.LastDeltaTime,
WeaponId = hit.Weapon,
WeaponReference = hit.WeaponReference,
SessionSnapHits = sessionSnapHits,
SessionAverageSnapValue = sessionAverageSnapAmount
};

View File

@ -610,7 +610,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
DeathType = (int) ParseEnum<IW4Info.MeansOfDeath>.Get(type, typeof(IW4Info.MeansOfDeath)),
Damage = int.Parse(damage),
HitLoc = (int) ParseEnum<IW4Info.HitLocation>.Get(hitLoc, typeof(IW4Info.HitLocation)),
Weapon = (int) ParseEnum<IW4Info.WeaponName>.Get(weapon, typeof(IW4Info.WeaponName)),
WeaponReference = weapon,
ViewAngles = vViewAngles,
TimeOffset = long.Parse(offset),
When = time,
@ -872,12 +872,12 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
victimStats.LastScore = 0;
}
var estimatedAttackerScore = (int)attacker.CurrentServer.GameName != 10
var estimatedAttackerScore = attacker.CurrentServer.GameName != Server.Game.SHG1
? attacker.Score
: (attackerStats.SessionKills * 50) / (attacker.ConnectionLength / 60);
var estimatedVictimScore = (int)attacker.CurrentServer.GameName != 10
: attackerStats.SessionKills * 50;
var estimatedVictimScore = attacker.CurrentServer.GameName != Server.Game.SHG1
? victim.Score
: victimStats.SessionKills * 50 / (attacker.ConnectionLength / 60);
: victimStats.SessionKills * 50;
attackerStats.SessionScore = estimatedAttackerScore;
victimStats.SessionScore = estimatedVictimScore;
@ -1318,7 +1318,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
killSpm *= Math.Max(1, spmMultiplier);
// update this for ac tracking
clientStats.SessionSPM = killSpm;
clientStats.SessionSPM = clientStats.SessionScore / Math.Max(1, clientStats.Client.ToPartialClient().ConnectionLength / 60.0);
// calculate how much the KDR should weigh
// 1.637 is a Eddie-Generated number that weights the KDR nicely

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.3.19.1" PrivateAssets="All" />
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.6.29.1" PrivateAssets="All" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -20,7 +20,7 @@
</Target>
<ItemGroup>
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.3.19.1" PrivateAssets="All" />
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.6.29.1" PrivateAssets="All" />
</ItemGroup>
</Project>

View File

@ -1,66 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PackageId>RaidMax.IW4MAdmin.SharedLibraryCore</PackageId>
<Version>2020.11.18.1</Version>
<Authors>RaidMax</Authors>
<Company>Forever None</Company>
<Configurations>Debug;Release;Prerelease</Configurations>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
<LangVersion>8.0</LangVersion>
<PackageTags>IW4MAdmin</PackageTags>
<RepositoryUrl>https://github.com/RaidMax/IW4M-Admin/</RepositoryUrl>
<PackageProjectUrl>https://www.raidmax.org/IW4MAdmin/</PackageProjectUrl>
<Copyright>2020</Copyright>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsPackable>true</IsPackable>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Description>Shared Library for IW4MAdmin</Description>
<PackageVersion>2020.11.18.1</PackageVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentValidation" Version="9.1.3" />
<PackageReference Include="Humanizer.Core" Version="2.8.26" />
<PackageReference Include="Humanizer.Core.ru" Version="2.8.26" />
<PackageReference Include="Humanizer.Core.de" Version="2.8.26" />
<PackageReference Include="Humanizer.Core.es" Version="2.8.26" />
<PackageReference Include="Humanizer.Core.pt" Version="2.8.26" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.7" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="3.1.7" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.7" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.7" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.7" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Npgsql" Version="4.1.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.4" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.2" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Debug'">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.7" />
</ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="if not exist &quot;$(ProjectDir)..\BUILD&quot; (&#xD;&#xA;if $(ConfigurationName) == Debug (&#xD;&#xA;md &quot;$(ProjectDir)..\BUILD&quot;&#xD;&#xA;)&#xD;&#xA;)&#xD;&#xA;if not exist &quot;$(ProjectDir)..\BUILD\Plugins&quot; (&#xD;&#xA;if $(ConfigurationName) == Debug (&#xD;&#xA;md &quot;$(ProjectDir)..\BUILD\Plugins&quot;&#xD;&#xA;)&#xD;&#xA;)" />
</Target>
</Project>

View File

@ -4,7 +4,7 @@
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PackageId>RaidMax.IW4MAdmin.SharedLibraryCore</PackageId>
<Version>2021.3.5.1</Version>
<Version>2021.6.29.1</Version>
<Authors>RaidMax</Authors>
<Company>Forever None</Company>
<Configurations>Debug;Release;Prerelease</Configurations>
@ -19,7 +19,7 @@
<IsPackable>true</IsPackable>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Description>Shared Library for IW4MAdmin</Description>
<PackageVersion>2021.3.19.1</PackageVersion>
<PackageVersion>2021.6.29.1</PackageVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|AnyCPU'">
@ -44,7 +44,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.10" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.10" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="RaidMax.IW4MAdmin.Data" Version="1.0.1" />
<PackageReference Include="RaidMax.IW4MAdmin.Data" Version="1.0.3" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0" />
</ItemGroup>

View File

@ -183,6 +183,7 @@ namespace IW4MAdmin.Plugins.Web.StatsWeb.Controllers
.Include(s => s.HitOrigin)
.Include(s => s.HitDestination)
.Include(s => s.CurrentViewAngle)
.Include(s => s.Server)
.Include(s => s.PredictedViewAngles)
.ThenInclude(_angles => _angles.Vector)
.OrderBy(s => s.When)

View File

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Serilog;
using SharedLibraryCore.Interfaces;
using WebfrontCore.Middleware;

View File

@ -113,6 +113,7 @@ namespace WebfrontCore
services.AddSingleton<IResourceQueryHelper<StatsInfoRequest, AdvancedStatsInfo>, AdvancedClientStatsResourceQueryHelper>();
services.AddSingleton(typeof(IDataValueCache<,>), typeof(DataValueCache<,>));
// todo: this needs to be handled more gracefully
services.AddSingleton(Program.ApplicationServiceProvider.GetRequiredService<ILoggerFactory>());
services.AddSingleton(Program.ApplicationServiceProvider.GetService<IConfigurationHandlerFactory>());
services.AddSingleton(Program.ApplicationServiceProvider.GetService<IDatabaseContextFactory>());
services.AddSingleton(Program.ApplicationServiceProvider.GetService<IAuditInformationRepository>());

View File

@ -7,15 +7,16 @@
@foreach (var snapshot in Model)
{
<!-- this is not ideal, but I didn't want to manually write out all the properties-->
var snapProperties = Model.First().GetType().GetProperties();
var snapProperties = Model.First().GetType().GetProperties().OrderBy(prop => prop.Name);
foreach (var prop in snapProperties)
{
@if ((prop.Name.EndsWith("Id") && prop.Name != "WeaponId") || new[] { "Active", "Client", "PredictedViewAngles" }.Contains(prop.Name))
@if ((prop.Name.EndsWith("Id") && prop.Name != "WeaponId" || prop.Name == "Server") || new[] {"Active", "Client", "PredictedViewAngles"}.Contains(prop.Name))
{
continue;
}
<span class="text-white">@prop.Name </span> <span>&mdash; @prop.GetValue(snapshot).ToString()</span><br />
<span class="text-white">@prop.Name </span>
<span>&mdash; @prop.GetValue(snapshot)?.ToString()?.StripColors()</span><br/>
}
<div class="w-100 mt-1 mb-1 border-bottom"></div>
}