re-implemented auto-upload on publish
fixed the max length migration for MySQL configure the python projects to be able to be published from command line optimize find active pentalties query add feature for issue #38 testing fix for concurrent dict access (in stats plugin)
This commit is contained in:
parent
b9086fd145
commit
a786541484
@ -5,7 +5,7 @@
|
|||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
||||||
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
||||||
<Version>2.1.8</Version>
|
<Version>2.1.9</Version>
|
||||||
<Authors>RaidMax</Authors>
|
<Authors>RaidMax</Authors>
|
||||||
<Company>Forever None</Company>
|
<Company>Forever None</Company>
|
||||||
<Product>IW4MAdmin</Product>
|
<Product>IW4MAdmin</Product>
|
||||||
@ -80,15 +80,17 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||||
<Exec Command="call $(ProjectDir)BuildScripts\PreBuild.bat $(SolutionDir) $(ProjectDir) $(TargetDir) $(OutDir)" />
|
<Exec Command="call $(ProjectDir)BuildScripts\PreBuild.bat $(ProjectDir)..\ $(ProjectDir) $(TargetDir) $(OutDir)" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
<Exec Command="call $(ProjectDir)BuildScripts\PostBuild.bat $(SolutionDir) $(ProjectDir) $(TargetDir) $(OutDir)" />
|
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
|
||||||
|
<Output TaskParameter="Assemblies" ItemName="CurrentAssembly" />
|
||||||
|
</GetAssemblyIdentity>
|
||||||
|
<Exec Command="call $(ProjectDir)BuildScripts\PostBuild.bat $(ProjectDir)..\ $(ProjectDir) $(TargetDir) $(OutDir) %(CurrentAssembly.Version)" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="PostPublish" AfterTargets="Publish">
|
<Target Name="PostPublish" AfterTargets="Publish">
|
||||||
<Exec Command="call $(ProjectDir)BuildScripts\PostPublish.bat $(SolutionDir) $(ProjectDir) $(TargetDir) $(OutDir)" />
|
<Exec Command="call $(ProjectDir)BuildScripts\PostPublish.bat $(ProjectDir)..\ $(ProjectDir) $(TargetDir) $(OutDir)" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -2,6 +2,9 @@ set SolutionDir=%1
|
|||||||
set ProjectDir=%2
|
set ProjectDir=%2
|
||||||
set TargetDir=%3
|
set TargetDir=%3
|
||||||
set OutDir=%4
|
set OutDir=%4
|
||||||
|
set Version=%5
|
||||||
|
|
||||||
|
echo %Version% > "%SolutionDir%DEPLOY\version.txt"
|
||||||
|
|
||||||
echo Copying dependency configs
|
echo Copying dependency configs
|
||||||
copy "%SolutionDir%WebfrontCore\%OutDir%*.deps.json" "%TargetDir%"
|
copy "%SolutionDir%WebfrontCore\%OutDir%*.deps.json" "%TargetDir%"
|
||||||
|
@ -18,20 +18,23 @@ namespace IW4MAdmin.Application
|
|||||||
{
|
{
|
||||||
Manager = mgr;
|
Manager = mgr;
|
||||||
OutOfOrderEvents = new SortedList<long, GameEvent>();
|
OutOfOrderEvents = new SortedList<long, GameEvent>();
|
||||||
IsProcessingEvent = new SemaphoreSlim(0);
|
IsProcessingEvent = new SemaphoreSlim(2, 2);
|
||||||
IsProcessingEvent.Release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddEvent(GameEvent gameEvent)
|
public void AddEvent(GameEvent gameEvent)
|
||||||
{
|
{
|
||||||
|
IsProcessingEvent.Wait();
|
||||||
((Manager as ApplicationManager).OnServerEvent)(this, new GameEventArgs(null, false, gameEvent));
|
((Manager as ApplicationManager).OnServerEvent)(this, new GameEventArgs(null, false, gameEvent));
|
||||||
if (gameEvent.Type == GameEvent.EventType.Connect)
|
if (gameEvent.Type == GameEvent.EventType.Connect)
|
||||||
{
|
{
|
||||||
|
IsProcessingEvent.Wait();
|
||||||
if (!gameEvent.OnProcessed.Wait(30 * 1000))
|
if (!gameEvent.OnProcessed.Wait(30 * 1000))
|
||||||
{
|
{
|
||||||
Manager.GetLogger().WriteError($"{Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_COMMAND_TIMEOUT"]} [{gameEvent.Id}, {gameEvent.Type}]");
|
Manager.GetLogger().WriteError($"{Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_COMMAND_TIMEOUT"]} [{gameEvent.Id}, {gameEvent.Type}]");
|
||||||
}
|
}
|
||||||
|
IsProcessingEvent.Release(1);
|
||||||
}
|
}
|
||||||
|
IsProcessingEvent.Release(1);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
|
||||||
-->
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<PublishProtocol>FileSystem</PublishProtocol>
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
|
||||||
<PublishDir>C:\Projects\IW4M-Admin\Publish\Windows</PublishDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
|
@ -231,7 +231,14 @@ namespace IW4MAdmin
|
|||||||
|
|
||||||
// reban the "evading" guid
|
// reban the "evading" guid
|
||||||
if (player.Level != Player.Permission.Banned && currentBan.Type == Penalty.PenaltyType.Ban)
|
if (player.Level != Player.Permission.Banned && currentBan.Type == Penalty.PenaltyType.Ban)
|
||||||
|
{
|
||||||
|
// hack: re apply the automated offense to the reban
|
||||||
|
if (currentBan.AutomatedOffense != null)
|
||||||
|
{
|
||||||
|
autoKickClient.AdministeredPenalties.Add(new EFPenalty() { AutomatedOffense = currentBan.AutomatedOffense });
|
||||||
|
}
|
||||||
await player.Ban($"{currentBan.Offense}", autoKickClient);
|
await player.Ban($"{currentBan.Offense}", autoKickClient);
|
||||||
|
}
|
||||||
|
|
||||||
// they didn't fully connect so empty their slot
|
// they didn't fully connect so empty their slot
|
||||||
Players[player.ClientNumber] = null;
|
Players[player.ClientNumber] = null;
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
<WorkingDirectory>.</WorkingDirectory>
|
<WorkingDirectory>.</WorkingDirectory>
|
||||||
<OutputPath>.</OutputPath>
|
<OutputPath>.</OutputPath>
|
||||||
<Name>DiscordWebhook</Name>
|
<Name>DiscordWebhook</Name>
|
||||||
|
<SuppressCollectPythonCloudServiceFiles>true</SuppressCollectPythonCloudServiceFiles>
|
||||||
<RootNamespace>DiscordWebhook</RootNamespace>
|
<RootNamespace>DiscordWebhook</RootNamespace>
|
||||||
<InterpreterId>MSBuild|env|$(MSBuildProjectFullPath)</InterpreterId>
|
<InterpreterId>MSBuild|env|$(MSBuildProjectFullPath)</InterpreterId>
|
||||||
<IsWindowsApplication>False</IsWindowsApplication>
|
<IsWindowsApplication>False</IsWindowsApplication>
|
||||||
@ -49,7 +50,7 @@
|
|||||||
<Publish>True</Publish>
|
<Publish>True</Publish>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.Web.targets" />
|
||||||
<!-- Uncomment the CoreCompile target to enable the Build command in
|
<!-- Uncomment the CoreCompile target to enable the Build command in
|
||||||
Visual Studio and specify your pre- and post-build commands in
|
Visual Studio and specify your pre- and post-build commands in
|
||||||
the BeforeBuild and AfterBuild targets below. -->
|
the BeforeBuild and AfterBuild targets below. -->
|
||||||
@ -58,4 +59,37 @@
|
|||||||
</Target>
|
</Target>
|
||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
|
<ProjectExtensions>
|
||||||
|
<VisualStudio>
|
||||||
|
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||||
|
<WebProjectProperties>
|
||||||
|
<AutoAssignPort>True</AutoAssignPort>
|
||||||
|
<UseCustomServer>True</UseCustomServer>
|
||||||
|
<CustomServerUrl>http://localhost</CustomServerUrl>
|
||||||
|
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||||
|
</WebProjectProperties>
|
||||||
|
</FlavorProperties>
|
||||||
|
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}" User="">
|
||||||
|
<WebProjectProperties>
|
||||||
|
<StartPageUrl>
|
||||||
|
</StartPageUrl>
|
||||||
|
<StartAction>CurrentPage</StartAction>
|
||||||
|
<AspNetDebugging>True</AspNetDebugging>
|
||||||
|
<SilverlightDebugging>False</SilverlightDebugging>
|
||||||
|
<NativeDebugging>False</NativeDebugging>
|
||||||
|
<SQLDebugging>False</SQLDebugging>
|
||||||
|
<ExternalProgram>
|
||||||
|
</ExternalProgram>
|
||||||
|
<StartExternalURL>
|
||||||
|
</StartExternalURL>
|
||||||
|
<StartCmdLineArguments>
|
||||||
|
</StartCmdLineArguments>
|
||||||
|
<StartWorkingDirectory>
|
||||||
|
</StartWorkingDirectory>
|
||||||
|
<EnableENC>False</EnableENC>
|
||||||
|
<AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
|
||||||
|
</WebProjectProperties>
|
||||||
|
</FlavorProperties>
|
||||||
|
</VisualStudio>
|
||||||
|
</ProjectExtensions>
|
||||||
</Project>
|
</Project>
|
@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||||||
_commands.gsc = _commands.gsc
|
_commands.gsc = _commands.gsc
|
||||||
_customcallbacks.gsc = _customcallbacks.gsc
|
_customcallbacks.gsc = _customcallbacks.gsc
|
||||||
README.md = README.md
|
README.md = README.md
|
||||||
|
RunPublishPre.cmd = RunPublishPre.cmd
|
||||||
version.txt = version.txt
|
version.txt = version.txt
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
8
RunPublishPre.cmd
Normal file
8
RunPublishPre.cmd
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
dotnet publish WebfrontCore/WebfrontCore.csproj -c Prerelease -o C:\Projects\IW4M-Admin\Publish\WindowsPrerelease
|
||||||
|
dotnet publish Application/Application.csproj -c Prerelease -o C:\Projects\IW4M-Admin\Publish\WindowsPrerelease
|
||||||
|
dotnet publish GameLogServer/GameLogServer.pyproj -c Release -o C:\Projects\IW4M-Admin\Publish\WindowsPrerelease\GameLogServer
|
||||||
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
|
||||||
|
msbuild GameLogServer/GameLogServer.pyproj /p:PublishProfile=FolderProfile /p:DeployOnBuild=true /p:PublishProfileRootFolder=C:\Projects\IW4M-Admin\GameLogServer\
|
||||||
|
msbuild DiscordWebhook/DiscordWebhook.pyproj /p:PublishProfile=FolderProfile /p:DeployOnBuild=true /p:PublishProfileRootFolder=C:\Projects\IW4M-Admin\DiscordWebhook\
|
||||||
|
cd "C:\Projects\IW4M-Admin\DEPLOY\"
|
||||||
|
PowerShell ".\upload_prerelease.ps1"
|
@ -1,6 +1,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using SharedLibraryCore.Database;
|
using SharedLibraryCore.Database;
|
||||||
using SharedLibraryCore.Database.Models;
|
using SharedLibraryCore.Database.Models;
|
||||||
|
using SharedLibraryCore.Events;
|
||||||
using SharedLibraryCore.Objects;
|
using SharedLibraryCore.Objects;
|
||||||
using SharedLibraryCore.Services;
|
using SharedLibraryCore.Services;
|
||||||
using System;
|
using System;
|
||||||
@ -464,6 +465,7 @@ namespace SharedLibraryCore.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player.Permission oldPerm = E.Target.Level;
|
||||||
Player.Permission newPerm = Utilities.MatchPermission(E.Data);
|
Player.Permission newPerm = Utilities.MatchPermission(E.Data);
|
||||||
|
|
||||||
if (newPerm == Player.Permission.Owner &&
|
if (newPerm == Player.Permission.Owner &&
|
||||||
@ -518,6 +520,21 @@ namespace SharedLibraryCore.Commands
|
|||||||
E.Owner.Manager.GetPrivilegedClients()[E.Target.ClientId] = E.Target;
|
E.Owner.Manager.GetPrivilegedClients()[E.Target.ClientId] = E.Target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var e = new GameEvent()
|
||||||
|
{
|
||||||
|
Origin = E.Origin,
|
||||||
|
Target = E.Target,
|
||||||
|
Owner = E.Owner,
|
||||||
|
Type = GameEvent.EventType.ChangePermission,
|
||||||
|
Extra = new Change()
|
||||||
|
{
|
||||||
|
PreviousValue = oldPerm.ToString(),
|
||||||
|
NewValue = newPerm.ToString()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
E.Owner.Manager.GetEventHandler().AddEvent(e);
|
||||||
|
|
||||||
await E.Origin.Tell($"{E.Target.Name} {Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SETLEVEL_SUCCESS"]}");
|
await E.Origin.Tell($"{E.Target.Name} {Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SETLEVEL_SUCCESS"]}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,8 @@ namespace SharedLibraryCore.Database.Models
|
|||||||
{
|
{
|
||||||
public enum ChangeType
|
public enum ChangeType
|
||||||
{
|
{
|
||||||
Permission
|
Permission,
|
||||||
|
Ban
|
||||||
}
|
}
|
||||||
|
|
||||||
[Key]
|
[Key]
|
||||||
@ -23,5 +24,7 @@ namespace SharedLibraryCore.Database.Models
|
|||||||
public DateTime TimeChanged { get; set; } = DateTime.UtcNow;
|
public DateTime TimeChanged { get; set; } = DateTime.UtcNow;
|
||||||
[MaxLength(128)]
|
[MaxLength(128)]
|
||||||
public string Comment { get; set; }
|
public string Comment { get; set; }
|
||||||
|
public string PreviousValue { get; set; }
|
||||||
|
public string CurrentValue { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,6 @@ namespace SharedLibraryCore.Database.Models
|
|||||||
{
|
{
|
||||||
public class SharedEntity
|
public class SharedEntity
|
||||||
{
|
{
|
||||||
public bool Active { get; set; }
|
public bool Active { get; set; } = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
SharedLibraryCore/Events/Change.cs
Normal file
21
SharedLibraryCore/Events/Change.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SharedLibraryCore.Events
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// represents change from one value to another
|
||||||
|
/// </summary>
|
||||||
|
class Change
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// represents the previous value of the item
|
||||||
|
/// </summary>
|
||||||
|
public string PreviousValue { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// represents the new/current value of the item
|
||||||
|
/// </summary>
|
||||||
|
public string NewValue { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using SharedLibraryCore.Database;
|
||||||
|
using SharedLibraryCore.Database.Models;
|
||||||
using SharedLibraryCore.Dtos;
|
using SharedLibraryCore.Dtos;
|
||||||
|
|
||||||
namespace SharedLibraryCore.Events
|
namespace SharedLibraryCore.Events
|
||||||
@ -22,7 +25,92 @@ namespace SharedLibraryCore.Events
|
|||||||
return eventList;
|
return eventList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OnGameEvent(object sender, GameEventArgs eventState)
|
private static async Task SaveChangeHistory(GameEvent e)
|
||||||
|
{
|
||||||
|
EFChangeHistory change = null;
|
||||||
|
|
||||||
|
switch (e.Type)
|
||||||
|
{
|
||||||
|
case GameEvent.EventType.Unknown:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Start:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Stop:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Connect:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Join:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Quit:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Disconnect:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.MapEnd:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.MapChange:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Say:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Warn:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Report:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Flag:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Unflag:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Kick:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.TempBan:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Ban:
|
||||||
|
change = new EFChangeHistory()
|
||||||
|
{
|
||||||
|
OriginEntityId = e.Origin.ClientId,
|
||||||
|
TargetEntityId = e.Target.ClientId,
|
||||||
|
TypeOfChange = EFChangeHistory.ChangeType.Ban,
|
||||||
|
Comment = e.Data
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Command:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.ChangePermission:
|
||||||
|
change = new EFChangeHistory()
|
||||||
|
{
|
||||||
|
OriginEntityId = e.Origin.ClientId,
|
||||||
|
TargetEntityId = e.Target.ClientId,
|
||||||
|
TypeOfChange = EFChangeHistory.ChangeType.Permission,
|
||||||
|
PreviousValue = ((Change)e.Extra).PreviousValue,
|
||||||
|
CurrentValue = ((Change)e.Extra).NewValue
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Broadcast:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Tell:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.ScriptDamage:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.ScriptKill:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Damage:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.Kill:
|
||||||
|
break;
|
||||||
|
case GameEvent.EventType.JoinTeam:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (change != null)
|
||||||
|
{
|
||||||
|
using (var ctx = new DatabaseContext(true))
|
||||||
|
{
|
||||||
|
ctx.EFChangeHistory.Add(change);
|
||||||
|
await ctx.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async void OnGameEvent(object sender, GameEventArgs eventState)
|
||||||
{
|
{
|
||||||
var E = eventState.Event;
|
var E = eventState.Event;
|
||||||
// don't want to clog up the api with unknown events
|
// don't want to clog up the api with unknown events
|
||||||
@ -62,6 +150,8 @@ namespace SharedLibraryCore.Events
|
|||||||
|
|
||||||
// add the new event to the list
|
// add the new event to the list
|
||||||
AddNewEvent(apiEvent);
|
AddNewEvent(apiEvent);
|
||||||
|
|
||||||
|
await SaveChangeHistory(E);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -9,41 +9,118 @@ namespace SharedLibraryCore
|
|||||||
{
|
{
|
||||||
public enum EventType
|
public enum EventType
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// the event wasn't parsed properly
|
||||||
|
/// </summary>
|
||||||
Unknown,
|
Unknown,
|
||||||
|
|
||||||
// events "generated" by the server
|
// events "generated" by the server
|
||||||
|
/// <summary>
|
||||||
|
/// a server started being monitored
|
||||||
|
/// </summary>
|
||||||
Start,
|
Start,
|
||||||
|
/// <summary>
|
||||||
|
/// a server stopped being monitored
|
||||||
|
/// </summary>
|
||||||
Stop,
|
Stop,
|
||||||
|
/// <summary>
|
||||||
|
/// a client was detecting as connecting via RCon
|
||||||
|
/// </summary>
|
||||||
Connect,
|
Connect,
|
||||||
|
/// <summary>
|
||||||
|
/// a client was detecting joining via log
|
||||||
|
/// </summary>
|
||||||
Join,
|
Join,
|
||||||
|
/// <summary>
|
||||||
|
/// a client was detected leaving via log
|
||||||
|
/// </summary>
|
||||||
Quit,
|
Quit,
|
||||||
|
/// <summary>
|
||||||
|
/// a client was detected leaving by RCon
|
||||||
|
/// </summary>
|
||||||
Disconnect,
|
Disconnect,
|
||||||
|
/// <summary>
|
||||||
|
/// the current map ended
|
||||||
|
/// </summary>
|
||||||
MapEnd,
|
MapEnd,
|
||||||
|
/// <summary>
|
||||||
|
/// the current map changed
|
||||||
|
/// </summary>
|
||||||
MapChange,
|
MapChange,
|
||||||
|
|
||||||
// events "generated" by clients
|
// events "generated" by clients
|
||||||
|
/// <summary>
|
||||||
|
/// a client sent a message
|
||||||
|
/// </summary>
|
||||||
Say,
|
Say,
|
||||||
|
/// <summary>
|
||||||
|
/// a client was warned
|
||||||
|
/// </summary>
|
||||||
Warn,
|
Warn,
|
||||||
|
/// <summary>
|
||||||
|
/// a client was reported
|
||||||
|
/// </summary>
|
||||||
Report,
|
Report,
|
||||||
|
/// <summary>
|
||||||
|
/// a client was flagged
|
||||||
|
/// </summary>
|
||||||
Flag,
|
Flag,
|
||||||
|
/// <summary>
|
||||||
|
/// a client was unflagged
|
||||||
|
/// </summary>
|
||||||
Unflag,
|
Unflag,
|
||||||
|
/// <summary>
|
||||||
|
/// a client was kicked
|
||||||
|
/// </summary>
|
||||||
Kick,
|
Kick,
|
||||||
|
/// <summary>
|
||||||
|
/// a client was tempbanned
|
||||||
|
/// </summary>
|
||||||
TempBan,
|
TempBan,
|
||||||
|
/// <summary>
|
||||||
|
/// a client was banned
|
||||||
|
/// </summary>
|
||||||
Ban,
|
Ban,
|
||||||
|
/// <summary>
|
||||||
|
/// a client entered a command
|
||||||
|
/// </summary>
|
||||||
Command,
|
Command,
|
||||||
|
/// <summary>
|
||||||
|
/// a client's permission was changed
|
||||||
|
/// </summary>
|
||||||
|
ChangePermission,
|
||||||
|
|
||||||
// events "generated" by IW4MAdmin
|
// events "generated" by IW4MAdmin
|
||||||
|
/// <summary>
|
||||||
|
/// a message is sent to all clients
|
||||||
|
/// </summary>
|
||||||
Broadcast,
|
Broadcast,
|
||||||
|
/// <summary>
|
||||||
|
/// a message is sent to a specific client
|
||||||
|
/// </summary>
|
||||||
Tell,
|
Tell,
|
||||||
|
|
||||||
// events "generated" by script/log
|
// events "generated" by script/log
|
||||||
|
/// <summary>
|
||||||
|
/// AC Damage Log
|
||||||
|
/// </summary>
|
||||||
ScriptDamage,
|
ScriptDamage,
|
||||||
|
/// <summary>
|
||||||
|
/// AC Kill Log
|
||||||
|
/// </summary>
|
||||||
ScriptKill,
|
ScriptKill,
|
||||||
|
/// <summary>
|
||||||
|
/// damage info printed out by game script
|
||||||
|
/// </summary>
|
||||||
Damage,
|
Damage,
|
||||||
|
/// <summary>
|
||||||
|
/// kill info printed out by game script
|
||||||
|
/// </summary>
|
||||||
Kill,
|
Kill,
|
||||||
|
/// <summary>
|
||||||
|
/// team info printed out by game script
|
||||||
|
/// </summary>
|
||||||
JoinTeam,
|
JoinTeam,
|
||||||
|
|
||||||
StatusUpdate
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static long NextEventId;
|
static long NextEventId;
|
||||||
|
@ -6,7 +6,15 @@ namespace SharedLibraryCore.Migrations
|
|||||||
{
|
{
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
|
// hack: we can't alter the column on SQLite, but we need max length limit for the Index in MySQL etc
|
||||||
|
if (migrationBuilder.ActiveProvider != "Microsoft.EntityFrameworkCore.Sqlite")
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "EFAlias",
|
||||||
|
maxLength: 24,
|
||||||
|
nullable: false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
684
SharedLibraryCore/Migrations/20180912015012_AddPreviousCurrentValueToEFChangeHistory.Designer.cs
generated
Normal file
684
SharedLibraryCore/Migrations/20180912015012_AddPreviousCurrentValueToEFChangeHistory.Designer.cs
generated
Normal file
@ -0,0 +1,684 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using SharedLibraryCore.Database;
|
||||||
|
|
||||||
|
namespace SharedLibraryCore.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(DatabaseContext))]
|
||||||
|
[Migration("20180912015012_AddPreviousCurrentValueToEFChangeHistory")]
|
||||||
|
partial class AddPreviousCurrentValueToEFChangeHistory
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "2.1.2-rtm-30932");
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFACSnapshot", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("SnapshotId")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<int>("ClientId");
|
||||||
|
|
||||||
|
b.Property<int>("CurrentSessionLength");
|
||||||
|
|
||||||
|
b.Property<double>("CurrentStrain");
|
||||||
|
|
||||||
|
b.Property<int?>("CurrentViewAngleVector3Id");
|
||||||
|
|
||||||
|
b.Property<int>("Deaths");
|
||||||
|
|
||||||
|
b.Property<double>("Distance");
|
||||||
|
|
||||||
|
b.Property<double>("EloRating");
|
||||||
|
|
||||||
|
b.Property<int?>("HitDestinationVector3Id");
|
||||||
|
|
||||||
|
b.Property<int>("HitLocation");
|
||||||
|
|
||||||
|
b.Property<int?>("HitOriginVector3Id");
|
||||||
|
|
||||||
|
b.Property<int>("HitType");
|
||||||
|
|
||||||
|
b.Property<int>("Hits");
|
||||||
|
|
||||||
|
b.Property<int>("Kills");
|
||||||
|
|
||||||
|
b.Property<int?>("LastStrainAngleVector3Id");
|
||||||
|
|
||||||
|
b.Property<double>("SessionAngleOffset");
|
||||||
|
|
||||||
|
b.Property<double>("SessionSPM");
|
||||||
|
|
||||||
|
b.Property<int>("SessionScore");
|
||||||
|
|
||||||
|
b.Property<double>("StrainAngleBetween");
|
||||||
|
|
||||||
|
b.Property<int>("TimeSinceLastEvent");
|
||||||
|
|
||||||
|
b.Property<int>("WeaponId");
|
||||||
|
|
||||||
|
b.Property<DateTime>("When");
|
||||||
|
|
||||||
|
b.HasKey("SnapshotId");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("CurrentViewAngleVector3Id");
|
||||||
|
|
||||||
|
b.HasIndex("HitDestinationVector3Id");
|
||||||
|
|
||||||
|
b.HasIndex("HitOriginVector3Id");
|
||||||
|
|
||||||
|
b.HasIndex("LastStrainAngleVector3Id");
|
||||||
|
|
||||||
|
b.ToTable("EFACSnapshot");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientKill", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("KillId")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<int>("AttackerId");
|
||||||
|
|
||||||
|
b.Property<int>("Damage");
|
||||||
|
|
||||||
|
b.Property<int?>("DeathOriginVector3Id");
|
||||||
|
|
||||||
|
b.Property<int>("DeathType");
|
||||||
|
|
||||||
|
b.Property<double>("Fraction");
|
||||||
|
|
||||||
|
b.Property<int>("HitLoc");
|
||||||
|
|
||||||
|
b.Property<bool>("IsKill");
|
||||||
|
|
||||||
|
b.Property<int?>("KillOriginVector3Id");
|
||||||
|
|
||||||
|
b.Property<int>("Map");
|
||||||
|
|
||||||
|
b.Property<int>("ServerId");
|
||||||
|
|
||||||
|
b.Property<int>("VictimId");
|
||||||
|
|
||||||
|
b.Property<int?>("ViewAnglesVector3Id");
|
||||||
|
|
||||||
|
b.Property<double>("VisibilityPercentage");
|
||||||
|
|
||||||
|
b.Property<int>("Weapon");
|
||||||
|
|
||||||
|
b.Property<DateTime>("When");
|
||||||
|
|
||||||
|
b.HasKey("KillId");
|
||||||
|
|
||||||
|
b.HasIndex("AttackerId");
|
||||||
|
|
||||||
|
b.HasIndex("DeathOriginVector3Id");
|
||||||
|
|
||||||
|
b.HasIndex("KillOriginVector3Id");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.HasIndex("VictimId");
|
||||||
|
|
||||||
|
b.HasIndex("ViewAnglesVector3Id");
|
||||||
|
|
||||||
|
b.ToTable("EFClientKills");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientMessage", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("MessageId")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<int>("ClientId");
|
||||||
|
|
||||||
|
b.Property<string>("Message");
|
||||||
|
|
||||||
|
b.Property<int>("ServerId");
|
||||||
|
|
||||||
|
b.Property<DateTime>("TimeSent");
|
||||||
|
|
||||||
|
b.HasKey("MessageId");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("EFClientMessages");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientRatingHistory", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("RatingHistoryId")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<int>("ClientId");
|
||||||
|
|
||||||
|
b.HasKey("RatingHistoryId");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("EFClientRatingHistory");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("ClientId");
|
||||||
|
|
||||||
|
b.Property<int>("ServerId");
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<int>("Deaths");
|
||||||
|
|
||||||
|
b.Property<double>("EloRating");
|
||||||
|
|
||||||
|
b.Property<int>("Kills");
|
||||||
|
|
||||||
|
b.Property<double>("MaxStrain");
|
||||||
|
|
||||||
|
b.Property<double>("RollingWeightedKDR");
|
||||||
|
|
||||||
|
b.Property<double>("SPM");
|
||||||
|
|
||||||
|
b.Property<double>("Skill");
|
||||||
|
|
||||||
|
b.Property<int>("TimePlayed");
|
||||||
|
|
||||||
|
b.Property<double>("VisionAverage");
|
||||||
|
|
||||||
|
b.HasKey("ClientId", "ServerId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("EFClientStatistics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFHitLocationCount", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("HitLocationCountId")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnName("EFClientStatistics_ClientId");
|
||||||
|
|
||||||
|
b.Property<int>("HitCount");
|
||||||
|
|
||||||
|
b.Property<float>("HitOffsetAverage");
|
||||||
|
|
||||||
|
b.Property<int>("Location");
|
||||||
|
|
||||||
|
b.Property<float>("MaxAngleDistance");
|
||||||
|
|
||||||
|
b.Property<int>("ServerId")
|
||||||
|
.HasColumnName("EFClientStatistics_ServerId");
|
||||||
|
|
||||||
|
b.HasKey("HitLocationCountId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId", "ServerId");
|
||||||
|
|
||||||
|
b.ToTable("EFHitLocationCounts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFRating", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("RatingId")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<int>("ActivityAmount");
|
||||||
|
|
||||||
|
b.Property<bool>("Newest");
|
||||||
|
|
||||||
|
b.Property<double>("Performance");
|
||||||
|
|
||||||
|
b.Property<int>("Ranking");
|
||||||
|
|
||||||
|
b.Property<int>("RatingHistoryId");
|
||||||
|
|
||||||
|
b.Property<int?>("ServerId");
|
||||||
|
|
||||||
|
b.Property<DateTime>("When");
|
||||||
|
|
||||||
|
b.HasKey("RatingId");
|
||||||
|
|
||||||
|
b.HasIndex("Performance");
|
||||||
|
|
||||||
|
b.HasIndex("Ranking");
|
||||||
|
|
||||||
|
b.HasIndex("RatingHistoryId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.HasIndex("When");
|
||||||
|
|
||||||
|
b.ToTable("EFRating");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServer", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("ServerId");
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<int>("Port");
|
||||||
|
|
||||||
|
b.HasKey("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("EFServers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServerStatistics", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("StatisticId")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<int>("ServerId");
|
||||||
|
|
||||||
|
b.Property<long>("TotalKills");
|
||||||
|
|
||||||
|
b.Property<long>("TotalPlayTime");
|
||||||
|
|
||||||
|
b.HasKey("StatisticId");
|
||||||
|
|
||||||
|
b.HasIndex("ServerId");
|
||||||
|
|
||||||
|
b.ToTable("EFServerStatistics");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFAlias", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("AliasId")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateAdded");
|
||||||
|
|
||||||
|
b.Property<int>("IPAddress");
|
||||||
|
|
||||||
|
b.Property<int>("LinkId");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(24);
|
||||||
|
|
||||||
|
b.HasKey("AliasId");
|
||||||
|
|
||||||
|
b.HasIndex("IPAddress");
|
||||||
|
|
||||||
|
b.HasIndex("LinkId");
|
||||||
|
|
||||||
|
b.HasIndex("Name");
|
||||||
|
|
||||||
|
b.ToTable("EFAlias");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFAliasLink", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("AliasLinkId")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.HasKey("AliasLinkId");
|
||||||
|
|
||||||
|
b.ToTable("EFAliasLinks");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFChangeHistory", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("ChangeHistoryId")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<string>("Comment")
|
||||||
|
.HasMaxLength(128);
|
||||||
|
|
||||||
|
b.Property<string>("CurrentValue");
|
||||||
|
|
||||||
|
b.Property<int>("OriginEntityId");
|
||||||
|
|
||||||
|
b.Property<string>("PreviousValue");
|
||||||
|
|
||||||
|
b.Property<int>("TargetEntityId");
|
||||||
|
|
||||||
|
b.Property<DateTime>("TimeChanged");
|
||||||
|
|
||||||
|
b.Property<int>("TypeOfChange");
|
||||||
|
|
||||||
|
b.HasKey("ChangeHistoryId");
|
||||||
|
|
||||||
|
b.ToTable("EFChangeHistory");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFClient", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<int>("AliasLinkId");
|
||||||
|
|
||||||
|
b.Property<int>("Connections");
|
||||||
|
|
||||||
|
b.Property<int>("CurrentAliasId");
|
||||||
|
|
||||||
|
b.Property<DateTime>("FirstConnection");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastConnection");
|
||||||
|
|
||||||
|
b.Property<int>("Level");
|
||||||
|
|
||||||
|
b.Property<bool>("Masked");
|
||||||
|
|
||||||
|
b.Property<long>("NetworkId");
|
||||||
|
|
||||||
|
b.Property<string>("Password");
|
||||||
|
|
||||||
|
b.Property<string>("PasswordSalt");
|
||||||
|
|
||||||
|
b.Property<int>("TotalConnectionTime");
|
||||||
|
|
||||||
|
b.HasKey("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("AliasLinkId");
|
||||||
|
|
||||||
|
b.HasIndex("CurrentAliasId");
|
||||||
|
|
||||||
|
b.HasIndex("NetworkId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("EFClients");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFMeta", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("MetaId")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<int>("ClientId");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Created");
|
||||||
|
|
||||||
|
b.Property<string>("Extra");
|
||||||
|
|
||||||
|
b.Property<string>("Key")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Property<DateTime>("Updated");
|
||||||
|
|
||||||
|
b.Property<string>("Value")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasKey("MetaId");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("EFMeta");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFPenalty", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("PenaltyId")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<string>("AutomatedOffense");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Expires");
|
||||||
|
|
||||||
|
b.Property<int>("LinkId");
|
||||||
|
|
||||||
|
b.Property<int>("OffenderId");
|
||||||
|
|
||||||
|
b.Property<string>("Offense")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Property<int>("PunisherId");
|
||||||
|
|
||||||
|
b.Property<int>("Type");
|
||||||
|
|
||||||
|
b.Property<DateTime>("When");
|
||||||
|
|
||||||
|
b.HasKey("PenaltyId");
|
||||||
|
|
||||||
|
b.HasIndex("LinkId");
|
||||||
|
|
||||||
|
b.HasIndex("OffenderId");
|
||||||
|
|
||||||
|
b.HasIndex("PunisherId");
|
||||||
|
|
||||||
|
b.ToTable("EFPenalties");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SharedLibraryCore.Helpers.Vector3", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Vector3Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<int?>("EFACSnapshotSnapshotId");
|
||||||
|
|
||||||
|
b.Property<float>("X");
|
||||||
|
|
||||||
|
b.Property<float>("Y");
|
||||||
|
|
||||||
|
b.Property<float>("Z");
|
||||||
|
|
||||||
|
b.HasKey("Vector3Id");
|
||||||
|
|
||||||
|
b.HasIndex("EFACSnapshotSnapshotId");
|
||||||
|
|
||||||
|
b.ToTable("Vector3");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFACSnapshot", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("SharedLibraryCore.Helpers.Vector3", "CurrentViewAngle")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CurrentViewAngleVector3Id");
|
||||||
|
|
||||||
|
b.HasOne("SharedLibraryCore.Helpers.Vector3", "HitDestination")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("HitDestinationVector3Id");
|
||||||
|
|
||||||
|
b.HasOne("SharedLibraryCore.Helpers.Vector3", "HitOrigin")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("HitOriginVector3Id");
|
||||||
|
|
||||||
|
b.HasOne("SharedLibraryCore.Helpers.Vector3", "LastStrainAngle")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("LastStrainAngleVector3Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientKill", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Attacker")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("AttackerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("SharedLibraryCore.Helpers.Vector3", "DeathOrigin")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("DeathOriginVector3Id");
|
||||||
|
|
||||||
|
b.HasOne("SharedLibraryCore.Helpers.Vector3", "KillOrigin")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("KillOriginVector3Id");
|
||||||
|
|
||||||
|
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Victim")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("VictimId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("SharedLibraryCore.Helpers.Vector3", "ViewAngles")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ViewAnglesVector3Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientMessage", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientRatingHistory", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFHitLocationCount", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics")
|
||||||
|
.WithMany("HitLocations")
|
||||||
|
.HasForeignKey("ClientId", "ServerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFRating", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFClientRatingHistory", "RatingHistory")
|
||||||
|
.WithMany("Ratings")
|
||||||
|
.HasForeignKey("RatingHistoryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServerStatistics", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ServerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFAlias", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SharedLibraryCore.Database.Models.EFAliasLink", "Link")
|
||||||
|
.WithMany("Children")
|
||||||
|
.HasForeignKey("LinkId")
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFClient", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SharedLibraryCore.Database.Models.EFAliasLink", "AliasLink")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("AliasLinkId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("SharedLibraryCore.Database.Models.EFAlias", "CurrentAlias")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CurrentAliasId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFMeta", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client")
|
||||||
|
.WithMany("Meta")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SharedLibraryCore.Database.Models.EFPenalty", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SharedLibraryCore.Database.Models.EFAliasLink", "Link")
|
||||||
|
.WithMany("ReceivedPenalties")
|
||||||
|
.HasForeignKey("LinkId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Offender")
|
||||||
|
.WithMany("ReceivedPenalties")
|
||||||
|
.HasForeignKey("OffenderId")
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
|
b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Punisher")
|
||||||
|
.WithMany("AdministeredPenalties")
|
||||||
|
.HasForeignKey("PunisherId")
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SharedLibraryCore.Helpers.Vector3", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFACSnapshot")
|
||||||
|
.WithMany("PredictedViewAngles")
|
||||||
|
.HasForeignKey("EFACSnapshotSnapshotId");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace SharedLibraryCore.Migrations
|
||||||
|
{
|
||||||
|
public partial class AddPreviousCurrentValueToEFChangeHistory : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "CurrentValue",
|
||||||
|
table: "EFChangeHistory",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "PreviousValue",
|
||||||
|
table: "EFChangeHistory",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CurrentValue",
|
||||||
|
table: "EFChangeHistory");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "PreviousValue",
|
||||||
|
table: "EFChangeHistory");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -356,8 +356,12 @@ namespace SharedLibraryCore.Migrations
|
|||||||
b.Property<string>("Comment")
|
b.Property<string>("Comment")
|
||||||
.HasMaxLength(128);
|
.HasMaxLength(128);
|
||||||
|
|
||||||
|
b.Property<string>("CurrentValue");
|
||||||
|
|
||||||
b.Property<int>("OriginEntityId");
|
b.Property<int>("OriginEntityId");
|
||||||
|
|
||||||
|
b.Property<string>("PreviousValue");
|
||||||
|
|
||||||
b.Property<int>("TargetEntityId");
|
b.Property<int>("TargetEntityId");
|
||||||
|
|
||||||
b.Property<DateTime>("TimeChanged");
|
b.Property<DateTime>("TimeChanged");
|
||||||
|
@ -101,9 +101,8 @@ namespace SharedLibraryCore.Services
|
|||||||
|
|
||||||
public async Task<IList<EFPenalty>> GetRecentPenalties(int count, int offset, Penalty.PenaltyType showOnly = Penalty.PenaltyType.Any)
|
public async Task<IList<EFPenalty>> GetRecentPenalties(int count, int offset, Penalty.PenaltyType showOnly = Penalty.PenaltyType.Any)
|
||||||
{
|
{
|
||||||
using (var context = new DatabaseContext())
|
using (var context = new DatabaseContext(true))
|
||||||
return await context.Penalties
|
return await context.Penalties
|
||||||
.AsNoTracking()
|
|
||||||
.Include(p => p.Offender.CurrentAlias)
|
.Include(p => p.Offender.CurrentAlias)
|
||||||
.Include(p => p.Punisher.CurrentAlias)
|
.Include(p => p.Punisher.CurrentAlias)
|
||||||
.Where(p => showOnly == Penalty.PenaltyType.Any ? p.Type != Penalty.PenaltyType.Any : p.Type == showOnly)
|
.Where(p => showOnly == Penalty.PenaltyType.Any ? p.Type != Penalty.PenaltyType.Any : p.Type == showOnly)
|
||||||
@ -116,9 +115,8 @@ namespace SharedLibraryCore.Services
|
|||||||
|
|
||||||
public async Task<IList<EFPenalty>> GetClientPenaltiesAsync(int clientId)
|
public async Task<IList<EFPenalty>> GetClientPenaltiesAsync(int clientId)
|
||||||
{
|
{
|
||||||
using (var context = new DatabaseContext())
|
using (var context = new DatabaseContext(true))
|
||||||
return await context.Penalties
|
return await context.Penalties
|
||||||
.AsNoTracking()
|
|
||||||
.Where(p => p.OffenderId == clientId)
|
.Where(p => p.OffenderId == clientId)
|
||||||
.Where(p => p.Active)
|
.Where(p => p.Active)
|
||||||
.Include(p => p.Offender.CurrentAlias)
|
.Include(p => p.Offender.CurrentAlias)
|
||||||
@ -134,10 +132,9 @@ namespace SharedLibraryCore.Services
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<ProfileMeta>> ReadGetClientPenaltiesAsync(int clientId, bool victim = true)
|
public async Task<List<ProfileMeta>> ReadGetClientPenaltiesAsync(int clientId, bool victim = true)
|
||||||
{
|
{
|
||||||
using (var context = new DatabaseContext())
|
using (var context = new DatabaseContext(true))
|
||||||
{
|
{
|
||||||
context.ChangeTracker.AutoDetectChangesEnabled = false;
|
// todo: clean this up
|
||||||
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
|
||||||
if (victim)
|
if (victim)
|
||||||
{
|
{
|
||||||
var now = DateTime.UtcNow;
|
var now = DateTime.UtcNow;
|
||||||
@ -233,32 +230,26 @@ namespace SharedLibraryCore.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<EFPenalty>> GetActivePenaltiesAsync(int aliasId, int ip = 0)
|
public async Task<List<EFPenalty>> GetActivePenaltiesAsync(int linkId, int ip = 0)
|
||||||
{
|
{
|
||||||
var now = DateTime.UtcNow;
|
var now = DateTime.UtcNow;
|
||||||
|
|
||||||
using (var context = new DatabaseContext())
|
using (var context = new DatabaseContext(true))
|
||||||
{
|
{
|
||||||
var iqPenalties = await (from link in context.AliasLinks
|
var iqPenalties = context.Penalties
|
||||||
where link.AliasLinkId == aliasId
|
.Where(p => p.LinkId == linkId ||
|
||||||
join penalty in context.Penalties
|
p.Link.Children.Any(a => a.IPAddress == ip))
|
||||||
on link.AliasLinkId equals penalty.LinkId
|
.Where(p => p.Active)
|
||||||
where penalty.Active
|
.Where(p => p.Expires > now);
|
||||||
where penalty.Expires > now
|
|
||||||
orderby penalty.When descending
|
|
||||||
select penalty).ToListAsync();
|
#if DEBUG == true
|
||||||
if (ip != 0)
|
var penaltiesSql = iqPenalties.ToSql();
|
||||||
{
|
#endif
|
||||||
iqPenalties.AddRange(await (from alias in context.Aliases
|
|
||||||
where alias.IPAddress == ip
|
var activePenalties = await iqPenalties.ToListAsync();
|
||||||
join penalty in context.Penalties
|
// this is a bit more performant in memory (ordering)
|
||||||
on alias.LinkId equals penalty.LinkId
|
return activePenalties.OrderByDescending(p =>p.When).ToList();
|
||||||
where penalty.Active
|
|
||||||
where penalty.Expires > now
|
|
||||||
orderby penalty.When descending
|
|
||||||
select penalty).ToListAsync());
|
|
||||||
}
|
|
||||||
return iqPenalties;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,8 +277,6 @@ namespace SharedLibraryCore.Services
|
|||||||
.ForEachAsync(c => c.Level = Player.Permission.User);
|
.ForEachAsync(c => c.Level = Player.Permission.User);
|
||||||
await internalContext.SaveChangesAsync();
|
await internalContext.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||||
<Exec Command="if not exist "$(SolutionDir)BUILD" (
md "$(SolutionDir)BUILD"
)
if not exist "$(SolutionDir)BUILD\Plugins" (
md "$(SolutionDir)BUILD\Plugins"
)" />
|
<Exec Command="if not exist "$(ProjectDir)..\BUILD" (
md "$(ProjectDir)..\BUILD"
)
if not exist "$(ProjectDir)..\BUILD\Plugins" (
md "$(ProjectDir)..\BUILD\Plugins"
)" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user