From 539050d95f7fc7c76a848c3b69575c45dc49a43e Mon Sep 17 00:00:00 2001 From: RaidMax Date: Thu, 14 Sep 2023 21:40:35 -0500 Subject: [PATCH 01/20] add clear all reports command --- .../Commands/ClearAllReportsCommand.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Application/Commands/ClearAllReportsCommand.cs diff --git a/Application/Commands/ClearAllReportsCommand.cs b/Application/Commands/ClearAllReportsCommand.cs new file mode 100644 index 00000000..b78b55e1 --- /dev/null +++ b/Application/Commands/ClearAllReportsCommand.cs @@ -0,0 +1,31 @@ +using System.Threading.Tasks; +using Data.Models.Client; +using SharedLibraryCore; +using SharedLibraryCore.Configuration; +using SharedLibraryCore.Interfaces; + +namespace IW4MAdmin.Application.Commands; + +public class ClearAllReportsCommand : Command +{ + public ClearAllReportsCommand(CommandConfiguration config, ITranslationLookup layout) : base(config, layout) + { + Name = "clearallreports"; + Description = _translationLookup["COMMANDS_REPORTS_CLEAR_DESC"]; + Alias = "car"; + Permission = EFClient.Permission.Administrator; + RequiresTarget = false; + } + + public override Task ExecuteAsync(GameEvent gameEvent) + { + foreach (var server in gameEvent.Owner.Manager.GetServers()) + { + server.Reports.Clear(); + } + + gameEvent.Origin.Tell(_translationLookup["COMMANDS_REPORTS_CLEAR_SUCCESS"]); + + return Task.CompletedTask; + } +} From b1831e1ec91e509ef5242376416477dad3516059 Mon Sep 17 00:00:00 2001 From: INeedGames Date: Wed, 11 Oct 2023 19:33:43 -0600 Subject: [PATCH 02/20] Fix possible infinite loop Possibility of an exploiter killing an enemy and disconnecting within the `wait` window to trigger an infinite loop. --- .../AntiCheat/PT6/storage/t6/scripts/mp/_customcallbacks.gsc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GameFiles/AntiCheat/PT6/storage/t6/scripts/mp/_customcallbacks.gsc b/GameFiles/AntiCheat/PT6/storage/t6/scripts/mp/_customcallbacks.gsc index 133a6a59..5e62645d 100644 --- a/GameFiles/AntiCheat/PT6/storage/t6/scripts/mp/_customcallbacks.gsc +++ b/GameFiles/AntiCheat/PT6/storage/t6/scripts/mp/_customcallbacks.gsc @@ -143,6 +143,8 @@ waitForFrameThread() waitForAdditionalAngles( logString, beforeFrameCount, afterFrameCount ) { + self endon( "disconnect" ); + currentIndex = self.currentAnglePosition; wait( 0.05 * afterFrameCount ); @@ -260,4 +262,4 @@ Callback_PlayerDisconnect() { level notify( "disconnected", self ); self [[maps\mp\gametypes\_globallogic_player::callback_playerdisconnect]](); -} \ No newline at end of file +} From 321ac5558f68b1fb63d93c38629d9deda58683cd Mon Sep 17 00:00:00 2001 From: INeedGames Date: Wed, 11 Oct 2023 19:37:49 -0600 Subject: [PATCH 03/20] Update _customcallbacks.gsc --- .../AntiCheat/IW5/storage/iw5/scripts/_customcallbacks.gsc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GameFiles/AntiCheat/IW5/storage/iw5/scripts/_customcallbacks.gsc b/GameFiles/AntiCheat/IW5/storage/iw5/scripts/_customcallbacks.gsc index e327d1a0..e8a7f0bd 100644 --- a/GameFiles/AntiCheat/IW5/storage/iw5/scripts/_customcallbacks.gsc +++ b/GameFiles/AntiCheat/IW5/storage/iw5/scripts/_customcallbacks.gsc @@ -137,6 +137,8 @@ waitForFrameThread() waitForAdditionalAngles( logString, beforeFrameCount, afterFrameCount ) { + self endon( "disconnect" ); + currentIndex = self.currentAnglePosition; wait( 0.05 * afterFrameCount ); @@ -246,4 +248,4 @@ Callback_PlayerDisconnect() { level notify( "disconnected", self ); self maps\mp\gametypes\_playerlogic::Callback_PlayerDisconnect(); -} \ No newline at end of file +} From 220e46fb65d881b8972d40e1ec9493dbca152a7a Mon Sep 17 00:00:00 2001 From: Edo Date: Thu, 21 Dec 2023 17:19:24 +0100 Subject: [PATCH 04/20] feat(pt5): fully support game log on T5 out of the box --- Plugins/ScriptPlugins/ParserPlutoniumT5.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/ScriptPlugins/ParserPlutoniumT5.js b/Plugins/ScriptPlugins/ParserPlutoniumT5.js index 6c12985a..b681ce70 100644 --- a/Plugins/ScriptPlugins/ParserPlutoniumT5.js +++ b/Plugins/ScriptPlugins/ParserPlutoniumT5.js @@ -13,6 +13,7 @@ var plugin = { onLoadAsync: function (manager) { rconParser = manager.GenerateDynamicRConParser(this.name); eventParser = manager.GenerateDynamicEventParser(this.name); + eventParser.Configuration.GameDirectory = ''; rconParser.Configuration.DefaultInstallationDirectoryHint = '{LocalAppData}/Plutonium/storage/t5'; rconParser.Configuration.CommandPrefixes.RConResponse = '\xff\xff\xff\xffprint\n'; @@ -21,6 +22,7 @@ var plugin = { rconParser.Configuration.CommandPrefixes.RConGetInfo = undefined; rconParser.Configuration.GuidNumberStyle = 7; // Integer rconParser.Configuration.DefaultRConPort = 3074; + rconParser.Configuration.OverrideDvarNameMapping.Add('fs_homepath', 'fs_basegame'); rconParser.Configuration.CanGenerateLogPath = false; rconParser.Configuration.OverrideCommandTimeouts.Clear(); From c5e38991cc7456f56c54d868687ba29b26a0cbd1 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 21 Jan 2024 11:13:33 -0600 Subject: [PATCH 05/20] Add nuget package artifact to cd pipeline --- DeploymentFiles/deployment-pipeline.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/DeploymentFiles/deployment-pipeline.yml b/DeploymentFiles/deployment-pipeline.yml index e8463b15..76116d1a 100644 --- a/DeploymentFiles/deployment-pipeline.yml +++ b/DeploymentFiles/deployment-pipeline.yml @@ -181,6 +181,13 @@ jobs: artifact: 'IW4MAdmin.$(buildConfiguration)' publishLocation: 'pipeline' + - task: PublishPipelineArtifact@1 + displayName: 'Publish nuget package artifact' + inputs: + targetPath: '$(Build.Repository.LocalPath)/SharedLibaryCore/bin/$(buildConfiguration)/RaidMax.IW4MAdmin.SharedLibraryCore.$(Build.BuildNumber).nupkg' + artifact: 'SharedLibraryCore.$(Build.BuildNumber).nupkg' + publishLocation: 'pipeline' + - task: FtpUpload@2 condition: ne(variables['Build.SourceBranch'], 'refs/heads/develop') displayName: 'Upload zip file to website' From a69f2ea2d9747370f15f837c535e03e44e52b30e Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 21 Jan 2024 18:00:17 -0600 Subject: [PATCH 06/20] Add dynamic SharedLibraryCore version to pipeline --- DeploymentFiles/deployment-pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DeploymentFiles/deployment-pipeline.yml b/DeploymentFiles/deployment-pipeline.yml index 76116d1a..6ee81c7a 100644 --- a/DeploymentFiles/deployment-pipeline.yml +++ b/DeploymentFiles/deployment-pipeline.yml @@ -66,7 +66,7 @@ jobs: displayName: 'Build projects' inputs: solution: '$(solution)' - msbuildArgs: '/p:DeployOnBuild=false /p:PackageAsSingleFile=false /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)" /p:Version=$(Build.BuildNumber)' + msbuildArgs: '/p:DeployOnBuild=false /p:PackageAsSingleFile=false /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)" /p:Version=$(Build.BuildNumber) /t:Pack /p:PackageVersion=$(Build.BuildNumber)' platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' @@ -184,7 +184,7 @@ jobs: - task: PublishPipelineArtifact@1 displayName: 'Publish nuget package artifact' inputs: - targetPath: '$(Build.Repository.LocalPath)/SharedLibaryCore/bin/$(buildConfiguration)/RaidMax.IW4MAdmin.SharedLibraryCore.$(Build.BuildNumber).nupkg' + targetPath: '$(Build.Repository.LocalPath)/SharedLibraryCore/bin/$(buildConfiguration)/RaidMax.IW4MAdmin.SharedLibraryCore.$(Build.BuildNumber).nupkg' artifact: 'SharedLibraryCore.$(Build.BuildNumber).nupkg' publishLocation: 'pipeline' From 5b842f7c40ccc808fa1cef6249037f28532d3d47 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 21 Jan 2024 18:07:55 -0600 Subject: [PATCH 07/20] Remove pack arg in cd pipeline --- DeploymentFiles/deployment-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DeploymentFiles/deployment-pipeline.yml b/DeploymentFiles/deployment-pipeline.yml index 6ee81c7a..5ac64659 100644 --- a/DeploymentFiles/deployment-pipeline.yml +++ b/DeploymentFiles/deployment-pipeline.yml @@ -66,7 +66,7 @@ jobs: displayName: 'Build projects' inputs: solution: '$(solution)' - msbuildArgs: '/p:DeployOnBuild=false /p:PackageAsSingleFile=false /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)" /p:Version=$(Build.BuildNumber) /t:Pack /p:PackageVersion=$(Build.BuildNumber)' + msbuildArgs: '/p:DeployOnBuild=false /p:PackageAsSingleFile=false /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)" /p:Version=$(Build.BuildNumber) /p:PackageVersion=$(Build.BuildNumber)' platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' From b1efa3d14009ccaa8ede41be59aac209f667bedc Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 21 Jan 2024 18:30:42 -0600 Subject: [PATCH 08/20] Update SLC nuget artifact path --- DeploymentFiles/deployment-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DeploymentFiles/deployment-pipeline.yml b/DeploymentFiles/deployment-pipeline.yml index 5ac64659..03dfcf62 100644 --- a/DeploymentFiles/deployment-pipeline.yml +++ b/DeploymentFiles/deployment-pipeline.yml @@ -184,7 +184,7 @@ jobs: - task: PublishPipelineArtifact@1 displayName: 'Publish nuget package artifact' inputs: - targetPath: '$(Build.Repository.LocalPath)/SharedLibraryCore/bin/$(buildConfiguration)/RaidMax.IW4MAdmin.SharedLibraryCore.$(Build.BuildNumber).nupkg' + targetPath: '$(Build.Repository.LocalPath)/SharedLibraryCore/bin/$(buildConfiguration)/RaidMax.IW4MAdmin.SharedLibraryCore.$(Date:yyyyMd).$(Rev:r).nupkg' artifact: 'SharedLibraryCore.$(Build.BuildNumber).nupkg' publishLocation: 'pipeline' From 94d436a2035b0bfb3d76ab4bab652d34f40bbeb6 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 21 Jan 2024 18:50:03 -0600 Subject: [PATCH 09/20] Actually do the last thing --- DeploymentFiles/deployment-pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DeploymentFiles/deployment-pipeline.yml b/DeploymentFiles/deployment-pipeline.yml index 03dfcf62..6b9e3f5e 100644 --- a/DeploymentFiles/deployment-pipeline.yml +++ b/DeploymentFiles/deployment-pipeline.yml @@ -1,4 +1,4 @@ -name: '$(Date:yyyy.MM.dd)$(Rev:.r)' +name: '$(Date:yyyy.M.d)$(Rev:.r)' trigger: batch: true @@ -184,7 +184,7 @@ jobs: - task: PublishPipelineArtifact@1 displayName: 'Publish nuget package artifact' inputs: - targetPath: '$(Build.Repository.LocalPath)/SharedLibraryCore/bin/$(buildConfiguration)/RaidMax.IW4MAdmin.SharedLibraryCore.$(Date:yyyyMd).$(Rev:r).nupkg' + targetPath: '$(Build.Repository.LocalPath)/SharedLibraryCore/bin/$(buildConfiguration)/RaidMax.IW4MAdmin.SharedLibraryCore.$(Build.BuildNumber).nupkg' artifact: 'SharedLibraryCore.$(Build.BuildNumber).nupkg' publishLocation: 'pipeline' From a81f9ecfa04d72913b54a9e4a9cc08ee2feb4cda Mon Sep 17 00:00:00 2001 From: Amos Date: Mon, 22 Jan 2024 01:08:25 +0000 Subject: [PATCH 10/20] slc update (#319) --- SharedLibraryCore/RCon/CommandPrefix.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SharedLibraryCore/RCon/CommandPrefix.cs b/SharedLibraryCore/RCon/CommandPrefix.cs index 59947192..d286f54d 100644 --- a/SharedLibraryCore/RCon/CommandPrefix.cs +++ b/SharedLibraryCore/RCon/CommandPrefix.cs @@ -16,5 +16,7 @@ public string RConGetInfo { get; set; } public string RConResponse { get; set; } public string RconGetInfoResponseHeader { get; set; } + public string Mute { get; set; } + public string Unmute { get; set; } } -} \ No newline at end of file +} From 570328dc1e1f5d5276b83d0e5e54955008e7a49d Mon Sep 17 00:00:00 2001 From: RaidMax Date: Thu, 1 Feb 2024 16:23:02 -0600 Subject: [PATCH 11/20] Update Data assembly dependency in SharedLibraryCore --- SharedLibraryCore/SharedLibraryCore.csproj | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/SharedLibraryCore/SharedLibraryCore.csproj b/SharedLibraryCore/SharedLibraryCore.csproj index 7c6d139e..081458e6 100644 --- a/SharedLibraryCore/SharedLibraryCore.csproj +++ b/SharedLibraryCore/SharedLibraryCore.csproj @@ -54,8 +54,11 @@ - - + + + true + Data.dll + @@ -65,7 +68,7 @@ $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage - + From f2c957fe71b2c5561884c62cc0389ff4d0a45469 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 4 Feb 2024 11:29:47 -0600 Subject: [PATCH 12/20] Update csprojs to support SLC nuget building --- Application/Application.csproj | 1 + Data/Data.csproj | 4 ---- WebfrontCore/WebfrontCore.csproj | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Application/Application.csproj b/Application/Application.csproj index 4c478d2b..858f10a5 100644 --- a/Application/Application.csproj +++ b/Application/Application.csproj @@ -53,6 +53,7 @@ + true diff --git a/Data/Data.csproj b/Data/Data.csproj index 49f5e201..d93474a2 100644 --- a/Data/Data.csproj +++ b/Data/Data.csproj @@ -4,11 +4,7 @@ net6.0 Debug;Release;Prerelease AnyCPU - true - RaidMax.IW4MAdmin.Data RaidMax.IW4MAdmin.Data - - 1.2.0 diff --git a/WebfrontCore/WebfrontCore.csproj b/WebfrontCore/WebfrontCore.csproj index 51070322..8ce9eb47 100644 --- a/WebfrontCore/WebfrontCore.csproj +++ b/WebfrontCore/WebfrontCore.csproj @@ -63,6 +63,7 @@ + From 186ed839dad979f2bfde382809849b99e1cce442 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 4 Feb 2024 12:09:17 -0600 Subject: [PATCH 13/20] Update plugins for latest shared library --- Plugins/AutomessageFeed/AutomessageFeed.csproj | 2 +- Plugins/LiveRadar/LiveRadar.csproj | 2 +- Plugins/Login/Login.csproj | 2 +- Plugins/Mute/Mute.csproj | 2 +- Plugins/ProfanityDeterment/ProfanityDeterment.csproj | 2 +- Plugins/Stats/Stats.csproj | 2 +- Plugins/Welcome/Welcome.csproj | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Plugins/AutomessageFeed/AutomessageFeed.csproj b/Plugins/AutomessageFeed/AutomessageFeed.csproj index 5886eaeb..6ed02fbf 100644 --- a/Plugins/AutomessageFeed/AutomessageFeed.csproj +++ b/Plugins/AutomessageFeed/AutomessageFeed.csproj @@ -10,7 +10,7 @@ - + diff --git a/Plugins/LiveRadar/LiveRadar.csproj b/Plugins/LiveRadar/LiveRadar.csproj index 9964cdcc..132bdb8f 100644 --- a/Plugins/LiveRadar/LiveRadar.csproj +++ b/Plugins/LiveRadar/LiveRadar.csproj @@ -16,7 +16,7 @@ - + diff --git a/Plugins/Login/Login.csproj b/Plugins/Login/Login.csproj index b462bc8f..cdaa5746 100644 --- a/Plugins/Login/Login.csproj +++ b/Plugins/Login/Login.csproj @@ -19,7 +19,7 @@ - + diff --git a/Plugins/Mute/Mute.csproj b/Plugins/Mute/Mute.csproj index aee6479e..a89ad5ba 100644 --- a/Plugins/Mute/Mute.csproj +++ b/Plugins/Mute/Mute.csproj @@ -11,7 +11,7 @@ - + diff --git a/Plugins/ProfanityDeterment/ProfanityDeterment.csproj b/Plugins/ProfanityDeterment/ProfanityDeterment.csproj index 9d987a06..79409dd4 100644 --- a/Plugins/ProfanityDeterment/ProfanityDeterment.csproj +++ b/Plugins/ProfanityDeterment/ProfanityDeterment.csproj @@ -16,7 +16,7 @@ - + diff --git a/Plugins/Stats/Stats.csproj b/Plugins/Stats/Stats.csproj index 1a8321ac..88aad451 100644 --- a/Plugins/Stats/Stats.csproj +++ b/Plugins/Stats/Stats.csproj @@ -17,7 +17,7 @@ - + diff --git a/Plugins/Welcome/Welcome.csproj b/Plugins/Welcome/Welcome.csproj index f2f4c15b..7b5caa1e 100644 --- a/Plugins/Welcome/Welcome.csproj +++ b/Plugins/Welcome/Welcome.csproj @@ -20,7 +20,7 @@ - + From 6f5d638a1e65bf403320708c166be85a05fee718 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 4 Feb 2024 12:10:13 -0600 Subject: [PATCH 14/20] Remove explicit reference to underlying database provider error in stats plugin --- Plugins/Stats/Helpers/StatManager.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Plugins/Stats/Helpers/StatManager.cs b/Plugins/Stats/Helpers/StatManager.cs index eec64dd7..0ed89842 100644 --- a/Plugins/Stats/Helpers/StatManager.cs +++ b/Plugins/Stats/Helpers/StatManager.cs @@ -1,5 +1,4 @@ using IW4MAdmin.Plugins.Stats.Cheat; -using IW4MAdmin.Plugins.Stats.Config; using IW4MAdmin.Plugins.Stats.Web.Dtos; using Microsoft.EntityFrameworkCore; using SharedLibraryCore; @@ -8,6 +7,7 @@ using SharedLibraryCore.Interfaces; using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Data.Common; using System.Linq; using System.Linq.Expressions; using System.Threading; @@ -21,8 +21,6 @@ using Data.Models.Server; using Humanizer.Localisation; using Microsoft.Data.Sqlite; using Microsoft.Extensions.Logging; -using MySqlConnector; -using Npgsql; using Stats.Client.Abstractions; using Stats.Config; using Stats.Helpers; @@ -488,9 +486,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers } catch (DbUpdateException updateException) when ( - updateException.InnerException is PostgresException { SqlState: "23503" } - || updateException.InnerException is SqliteException { SqliteErrorCode: 787 } - || updateException.InnerException is MySqlException { SqlState: "23503" }) + updateException.InnerException is DbException { SqlState: "23503" } or SqliteException { SqliteErrorCode: 787 }) { _log.LogWarning("Trying to add {Client} to stats before they have been added to the database", pl.ToString()); From 82d89b9dd0deee92d9701990121fd2ae0cbb562a Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 4 Feb 2024 12:47:08 -0600 Subject: [PATCH 15/20] Add nuget package pipeline --- Data/Data.csproj | 1 + DeploymentFiles/deployment-pipeline.yml | 4 ++ DeploymentFiles/nuget-pipeline.yml | 65 +++++++++++++++++++++++++ IW4MAdmin.sln | 1 + 4 files changed, 71 insertions(+) create mode 100644 DeploymentFiles/nuget-pipeline.yml diff --git a/Data/Data.csproj b/Data/Data.csproj index d93474a2..75cbf585 100644 --- a/Data/Data.csproj +++ b/Data/Data.csproj @@ -5,6 +5,7 @@ Debug;Release;Prerelease AnyCPU RaidMax.IW4MAdmin.Data + 1.0.0.0 diff --git a/DeploymentFiles/deployment-pipeline.yml b/DeploymentFiles/deployment-pipeline.yml index 6b9e3f5e..d684acae 100644 --- a/DeploymentFiles/deployment-pipeline.yml +++ b/DeploymentFiles/deployment-pipeline.yml @@ -7,6 +7,10 @@ trigger: - release/pre - master - develop + paths: + exclude: + - '**/*.yml' + - '*.yml' pr: none diff --git a/DeploymentFiles/nuget-pipeline.yml b/DeploymentFiles/nuget-pipeline.yml new file mode 100644 index 00000000..c29fb4ce --- /dev/null +++ b/DeploymentFiles/nuget-pipeline.yml @@ -0,0 +1,65 @@ +name: '$(Date:yyyy.M.d)$(Rev:.r)' + +pr: none + +pool: + vmImage: 'windows-2022' + +variables: + buildPlatform: 'Any CPU' + outputFolder: '$(Build.ArtifactStagingDirectory)\Publish\$(buildConfiguration)' + releaseType: verified + buildConfiguration: Stable + isPreRelease: false + +jobs: + - job: Build_Pack + steps: + - task: UseDotNet@2 + displayName: 'Install .NET Core 6 SDK' + inputs: + packageType: 'sdk' + version: '6.0.x' + includePreviewVersions: true + + - task: NuGetToolInstaller@1 + + - task: PowerShell@2 + displayName: 'Setup Build configuration' + condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/release/pre'), eq(variables['Build.SourceBranch'], 'refs/heads/develop')) + inputs: + targetType: 'inline' + script: | + echo '##vso[task.setvariable variable=releaseType]prerelease' + echo '##vso[task.setvariable variable=buildConfiguration]Prerelease' + echo '##vso[task.setvariable variable=isPreRelease]true' + failOnStderr: true + + - task: DotNetCoreCLI@2 + displayName: 'Build Data' + inputs: + command: 'build' + projects: '**/Data.csproj' + arguments: '-c $(buildConfiguration)' + + - task: DotNetCoreCLI@2 + displayName: 'Build SLC' + inputs: + command: 'build' + projects: '**/SharedLibraryCore.csproj' + arguments: '-c $(buildConfiguration) /p:Version=$(Build.BuildNumber)' + + - task: DotNetCoreCLI@2 + displayName: 'Pack SLC' + inputs: + command: 'pack' + packagesToPack: '**/SharedLibraryCore.csproj' + nobuild: true + versioningScheme: 'byBuildNumber' + + - task: PublishPipelineArtifact@1 + displayName: 'Publish nuget package artifact' + inputs: + targetPath: '$(Build.Repository.LocalPath)/SharedLibraryCore/bin/$(buildConfiguration)/RaidMax.IW4MAdmin.SharedLibraryCore.$(Build.BuildNumber).nupkg' + artifact: 'SharedLibraryCore.$(Build.BuildNumber).nupkg' + publishLocation: 'pipeline' diff --git a/IW4MAdmin.sln b/IW4MAdmin.sln index 90b29b90..87038b44 100644 --- a/IW4MAdmin.sln +++ b/IW4MAdmin.sln @@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution version.txt = version.txt DeploymentFiles\UpdateIW4MAdmin.ps1 = DeploymentFiles\UpdateIW4MAdmin.ps1 DeploymentFiles\UpdateIW4MAdmin.sh = DeploymentFiles\UpdateIW4MAdmin.sh + DeploymentFiles\nuget-pipeline.yml = DeploymentFiles\nuget-pipeline.yml EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharedLibraryCore", "SharedLibraryCore\SharedLibraryCore.csproj", "{AA0541A2-8D51-4AD9-B0AC-3D1F5B162481}" From a9dd4e66b6711eae7f046dbe8eff262137989f6a Mon Sep 17 00:00:00 2001 From: Amos Date: Sun, 21 Jan 2024 16:05:17 +0000 Subject: [PATCH 16/20] Add mute/unmute functionality and update related components Added mute and unmute commands in ParserIW6x.js, including necessary updates in MuteManager.cs and Plugin.cs files. Refactored the query for mute penalties. Also added RootNamespace in Mute.csproj. --- Plugins/Mute/Mute.csproj | 1 + Plugins/Mute/MuteManager.cs | 23 ++++++++------- Plugins/Mute/Plugin.cs | 45 +++++++++++++++++++++++------ Plugins/ScriptPlugins/ParserIW4x.js | 2 ++ Plugins/ScriptPlugins/ParserIW6x.js | 2 ++ 5 files changed, 54 insertions(+), 19 deletions(-) diff --git a/Plugins/Mute/Mute.csproj b/Plugins/Mute/Mute.csproj index a89ad5ba..460888bd 100644 --- a/Plugins/Mute/Mute.csproj +++ b/Plugins/Mute/Mute.csproj @@ -8,6 +8,7 @@ Library Debug;Release;Prerelease AnyCPU + IW4MAdmin.Plugins.Mute diff --git a/Plugins/Mute/MuteManager.cs b/Plugins/Mute/MuteManager.cs index 5f91d816..537465b1 100644 --- a/Plugins/Mute/MuteManager.cs +++ b/Plugins/Mute/MuteManager.cs @@ -131,8 +131,11 @@ public class MuteManager { var newPenalty = new EFPenalty { - Type = muteState is MuteState.Unmuted ? EFPenalty.PenaltyType.Unmute : - dateTime is null ? EFPenalty.PenaltyType.Mute : EFPenalty.PenaltyType.TempMute, + Type = muteState is MuteState.Unmuted + ? EFPenalty.PenaltyType.Unmute + : dateTime is null + ? EFPenalty.PenaltyType.Mute + : EFPenalty.PenaltyType.TempMute, Expires = muteState is MuteState.Unmuted ? DateTime.UtcNow : dateTime, Offender = target, Offense = reason, @@ -148,10 +151,9 @@ public class MuteManager { await using var context = _databaseContextFactory.CreateContext(); var mutePenalties = await context.Penalties - .Where(penalty => penalty.OffenderId == client.ClientId && - (penalty.Type == EFPenalty.PenaltyType.Mute || - penalty.Type == EFPenalty.PenaltyType.TempMute) && - (penalty.Expires == null || penalty.Expires > DateTime.UtcNow)) + .Where(penalty => penalty.OffenderId == client.ClientId) + .Where(penalty => penalty.Type == EFPenalty.PenaltyType.Mute || penalty.Type == EFPenalty.PenaltyType.TempMute) + .Where(penalty => penalty.Expires == null || penalty.Expires > DateTime.UtcNow) .ToListAsync(); foreach (var mutePenalty in mutePenalties) @@ -169,19 +171,20 @@ public class MuteManager switch (muteStateMeta.MuteState) { case MuteState.Muted: - await server.ExecuteCommandAsync($"muteClient {client.ClientNumber}"); + var muteCommand = string.Format(server.RconParser.Configuration.CommandPrefixes.Mute, client.ClientNumber); + await server.ExecuteCommandAsync(muteCommand); muteStateMeta.CommandExecuted = true; break; case MuteState.Unmuted: - await server.ExecuteCommandAsync($"unmute {client.ClientNumber}"); + var unMuteCommand = string.Format(server.RconParser.Configuration.CommandPrefixes.Unmute, client.ClientNumber); + await server.ExecuteCommandAsync(unMuteCommand); muteStateMeta.CommandExecuted = true; break; } } private async Task ReadPersistentDataV1(EFClient client) => TryParse( - (await _metaService.GetPersistentMeta(Plugin.MuteKey, client.ClientId))?.Value, - out var muteState) + (await _metaService.GetPersistentMeta(Plugin.MuteKey, client.ClientId))?.Value, out var muteState) ? muteState : null; diff --git a/Plugins/Mute/Plugin.cs b/Plugins/Mute/Plugin.cs index 242857da..fc75ea27 100644 --- a/Plugins/Mute/Plugin.cs +++ b/Plugins/Mute/Plugin.cs @@ -21,7 +21,7 @@ public class Plugin : IPluginV2 public const string MuteKey = "IW4MMute"; public static IManager Manager { get; private set; } = null!; - public static readonly Server.Game[] SupportedGames = {Server.Game.IW4}; + public static Server.Game[] SupportedGames { get; private set; } = Array.Empty(); private static readonly string[] DisabledCommands = {nameof(PrivateMessageAdminsCommand), "PrivateMessageCommand"}; private readonly IInteractionRegistration _interactionRegistration; private readonly IRemoteCommandService _remoteCommandService; @@ -34,12 +34,14 @@ public class Plugin : IPluginV2 _interactionRegistration = interactionRegistration; _remoteCommandService = remoteCommandService; _muteManager = muteManager; - + IManagementEventSubscriptions.Load += OnLoad; IManagementEventSubscriptions.Unload += OnUnload; - IManagementEventSubscriptions.ClientStateInitialized += OnClientStateInitialized; + IGameServerEventSubscriptions.ClientDataUpdated += OnClientDataUpdated; + IGameServerEventSubscriptions.MonitoringStarted += OnServerMonitoredStarted; + IGameEventSubscriptions.ClientMessaged += OnClientMessaged; } @@ -61,7 +63,7 @@ public class Plugin : IPluginV2 var muteMeta = Task.Run(() => _muteManager.GetCurrentMuteState(gameEvent.Origin), cancellationToken) .GetAwaiter().GetResult(); - + if (muteMeta.MuteState is not MuteState.Muted) { return true; @@ -91,7 +93,7 @@ public class Plugin : IPluginV2 }); return Task.CompletedTask; } - + private Task OnUnload(IManager manager, CancellationToken token) { _interactionRegistration.UnregisterInteraction(MuteInteraction); @@ -152,21 +154,21 @@ public class Plugin : IPluginV2 { return; } - + var muteMetaJoin = await _muteManager.GetCurrentMuteState(state.Client); switch (muteMetaJoin) { - case { MuteState: MuteState.Muted }: + case {MuteState: MuteState.Muted}: // Let the client know when their mute expires. state.Client.Tell(Utilities.CurrentLocalization .LocalizationIndex["PLUGINS_MUTE_REMAINING_TIME"].FormatExt( - muteMetaJoin is { Expiration: not null } + muteMetaJoin is {Expiration: not null} ? muteMetaJoin.Expiration.Value.HumanizeForCurrentCulture() : Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_MUTE_NEVER"], muteMetaJoin.Reason)); break; - case { MuteState: MuteState.Unmuting }: + case {MuteState: MuteState.Unmuting}: // Handle unmute of unmuted players. await _muteManager.Unmute(state.Client.CurrentServer, Utilities.IW4MAdminClient(), state.Client, muteMetaJoin.Reason ?? string.Empty); @@ -319,4 +321,29 @@ public class Plugin : IPluginV2 } }; } + + private Task OnServerMonitoredStarted(MonitorStartEvent serverEvent, CancellationToken token) + { + var game = (Server.Game)serverEvent.Server.GameCode; + + lock (SupportedGames) + { + if (SupportedGames.Contains(game)) + { + return Task.CompletedTask; + } + + var server = Manager.GetServers().FirstOrDefault(x => x == serverEvent.Server); + var commandIsEmpty = string.IsNullOrWhiteSpace(server?.RconParser.Configuration.CommandPrefixes.Mute); + + if (commandIsEmpty) + { + return Task.CompletedTask; + } + + SupportedGames = SupportedGames.Append(game).ToArray(); + } + + return Task.CompletedTask; + } } diff --git a/Plugins/ScriptPlugins/ParserIW4x.js b/Plugins/ScriptPlugins/ParserIW4x.js index b35ef0d0..0d9cf3a2 100644 --- a/Plugins/ScriptPlugins/ParserIW4x.js +++ b/Plugins/ScriptPlugins/ParserIW4x.js @@ -19,6 +19,8 @@ var plugin = { rconParser.Configuration.CommandPrefixes.Kick = 'clientkick {0} "{1}"'; rconParser.Configuration.CommandPrefixes.Ban = 'clientkick {0} "{1}"'; rconParser.Configuration.CommandPrefixes.TempBan = 'tempbanclient {0} "{1}"'; + rconParser.Configuration.CommandPrefixes.Mute = 'muteClient {0}'; + rconParser.Configuration.CommandPrefixes.Unmute = 'unmute {0}'; rconParser.Configuration.DefaultRConPort = 28960; rconParser.Configuration.DefaultInstallationDirectoryHint = 'HKEY_CURRENT_USER\\Software\\Classes\\iw4x\\shell\\open\\command'; diff --git a/Plugins/ScriptPlugins/ParserIW6x.js b/Plugins/ScriptPlugins/ParserIW6x.js index 7c399aa8..4185bb35 100644 --- a/Plugins/ScriptPlugins/ParserIW6x.js +++ b/Plugins/ScriptPlugins/ParserIW6x.js @@ -20,6 +20,8 @@ var plugin = { rconParser.Configuration.CommandPrefixes.Ban = 'clientkick {0} "{1}"'; rconParser.Configuration.CommandPrefixes.TempBan = 'clientkick {0} "{1}"'; rconParser.Configuration.CommandPrefixes.RConResponse = '\xff\xff\xff\xffprint\n'; + rconParser.Configuration.CommandPrefixes.Mute = 'muteClient {0}'; + rconParser.Configuration.CommandPrefixes.Unmute = 'unmuteClient {0}'; rconParser.Configuration.Dvar.Pattern = '^ *\\"(.+)\\" is: \\"(.+)?\\" default: \\"(.+)?\\"\\n?(?:latched: \\"(.+)?\\"\\n?)?(.*)$'; rconParser.Configuration.Status.Pattern = '^ *([0-9]+) +-?([0-9]+) +(Yes|No) +((?:[A-Z]+|[0-9]+)) +((?:[a-z]|[0-9]){8,32}|(?:[a-z]|[0-9]){8,32}|bot[0-9]+|(?:[0-9]+)) *(.{0,32}) +(\\d+\\.\\d+\\.\\d+.\\d+\\:-*\\d{1,5}|0+.0+:-*\\d{1,5}|loopback|unknown|bot) +(-*[0-9]+) *$'; rconParser.Configuration.StatusHeader.Pattern = 'num +score +bot +ping +guid +name +address +qport *'; From 104b16dccdff33a45f01f1ec0dd193fda59f8bf2 Mon Sep 17 00:00:00 2001 From: Violent <128183707+realviolent@users.noreply.github.com> Date: Mon, 5 Feb 2024 03:18:02 +0100 Subject: [PATCH 17/20] Show() instead of Hide() If no clip disabled (#321) Show() instead of Hide() If no clip disabled (IW5 game interface) --- GameFiles/GameInterface/_integration_iw5.gsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameFiles/GameInterface/_integration_iw5.gsc b/GameFiles/GameInterface/_integration_iw5.gsc index fd4d652a..6dfc6a7c 100644 --- a/GameFiles/GameInterface/_integration_iw5.gsc +++ b/GameFiles/GameInterface/_integration_iw5.gsc @@ -193,7 +193,7 @@ NoClipImpl() self God(); self Noclip(); - self Hide(); + self Show(); SetDvar( "sv_cheats", 0 ); From bfa8a25a43c67f8c254c249be408e66aa9306a85 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 4 Feb 2024 20:27:59 -0600 Subject: [PATCH 18/20] Remove unneeded nuget pipeline step --- DeploymentFiles/nuget-pipeline.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/DeploymentFiles/nuget-pipeline.yml b/DeploymentFiles/nuget-pipeline.yml index c29fb4ce..ff7ae71e 100644 --- a/DeploymentFiles/nuget-pipeline.yml +++ b/DeploymentFiles/nuget-pipeline.yml @@ -15,18 +15,9 @@ variables: jobs: - job: Build_Pack steps: - - task: UseDotNet@2 - displayName: 'Install .NET Core 6 SDK' - inputs: - packageType: 'sdk' - version: '6.0.x' - includePreviewVersions: true - - - task: NuGetToolInstaller@1 - - task: PowerShell@2 displayName: 'Setup Build configuration' - condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/release/pre'), eq(variables['Build.SourceBranch'], 'refs/heads/develop')) + condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/release/pre'), eq(variables['Build.SourceBranch'], 'refs/heads/develop'), eq(variables['Build.SourceBranch'], 'refs/heads/chore/nuget-pipeline')) inputs: targetType: 'inline' script: | @@ -54,12 +45,11 @@ jobs: inputs: command: 'pack' packagesToPack: '**/SharedLibraryCore.csproj' - nobuild: true versioningScheme: 'byBuildNumber' - task: PublishPipelineArtifact@1 displayName: 'Publish nuget package artifact' inputs: - targetPath: '$(Build.Repository.LocalPath)/SharedLibraryCore/bin/$(buildConfiguration)/RaidMax.IW4MAdmin.SharedLibraryCore.$(Build.BuildNumber).nupkg' + targetPath: 'D:\a\1\a\RaidMax.IW4MAdmin.SharedLibraryCore.$(Build.BuildNumber).nupkg' artifact: 'SharedLibraryCore.$(Build.BuildNumber).nupkg' publishLocation: 'pipeline' From 63ccd02eace6607e834d8d32a340e6dc5b99cba7 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 4 Feb 2024 20:36:06 -0600 Subject: [PATCH 19/20] Add startup notice for .NET 8 upgrade --- Application/Main.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Application/Main.cs b/Application/Main.cs index 2edb79a2..bcded032 100644 --- a/Application/Main.cs +++ b/Application/Main.cs @@ -94,6 +94,15 @@ namespace IW4MAdmin.Application Console.WriteLine($" Version {Utilities.GetVersionAsString()}"); Console.WriteLine("====================================================="); + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine("!!!! IMPORTANT !!!!"); + Console.WriteLine("The next update of IW4MAdmin will require .NET 8."); + Console.WriteLine("This is a breaking change!"); + Console.WriteLine( + "Please update the ASP.NET Core Runtime: https://dotnet.microsoft.com/en-us/download/dotnet/8.0"); + Console.WriteLine("!!!!!!!!!!!!!!!!!!!"); + Console.ForegroundColor = ConsoleColor.Gray; + await LaunchAsync(); } From 5726527980b3d7d2648dfa3032024c4ba74774ef Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 4 Feb 2024 20:55:17 -0600 Subject: [PATCH 20/20] Update plugins for shared library versioning change --- Plugins/AutomessageFeed/AutomessageFeed.csproj | 2 +- Plugins/LiveRadar/LiveRadar.csproj | 2 +- Plugins/Login/Login.csproj | 2 +- Plugins/Mute/Mute.csproj | 2 +- Plugins/ProfanityDeterment/ProfanityDeterment.csproj | 4 ++-- Plugins/Stats/Stats.csproj | 2 +- Plugins/Welcome/Welcome.csproj | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Plugins/AutomessageFeed/AutomessageFeed.csproj b/Plugins/AutomessageFeed/AutomessageFeed.csproj index 6ed02fbf..1a79d2e5 100644 --- a/Plugins/AutomessageFeed/AutomessageFeed.csproj +++ b/Plugins/AutomessageFeed/AutomessageFeed.csproj @@ -10,7 +10,7 @@ - + diff --git a/Plugins/LiveRadar/LiveRadar.csproj b/Plugins/LiveRadar/LiveRadar.csproj index 132bdb8f..a5a50206 100644 --- a/Plugins/LiveRadar/LiveRadar.csproj +++ b/Plugins/LiveRadar/LiveRadar.csproj @@ -16,7 +16,7 @@ - + diff --git a/Plugins/Login/Login.csproj b/Plugins/Login/Login.csproj index cdaa5746..b3a92171 100644 --- a/Plugins/Login/Login.csproj +++ b/Plugins/Login/Login.csproj @@ -19,7 +19,7 @@ - + diff --git a/Plugins/Mute/Mute.csproj b/Plugins/Mute/Mute.csproj index 460888bd..19e6bb03 100644 --- a/Plugins/Mute/Mute.csproj +++ b/Plugins/Mute/Mute.csproj @@ -12,7 +12,7 @@ - + diff --git a/Plugins/ProfanityDeterment/ProfanityDeterment.csproj b/Plugins/ProfanityDeterment/ProfanityDeterment.csproj index 79409dd4..009d1d49 100644 --- a/Plugins/ProfanityDeterment/ProfanityDeterment.csproj +++ b/Plugins/ProfanityDeterment/ProfanityDeterment.csproj @@ -1,7 +1,7 @@  - Library + Library net6.0 @@ -16,7 +16,7 @@ - + diff --git a/Plugins/Stats/Stats.csproj b/Plugins/Stats/Stats.csproj index 88aad451..7aff2f0c 100644 --- a/Plugins/Stats/Stats.csproj +++ b/Plugins/Stats/Stats.csproj @@ -17,7 +17,7 @@ - + diff --git a/Plugins/Welcome/Welcome.csproj b/Plugins/Welcome/Welcome.csproj index 7b5caa1e..de9255ef 100644 --- a/Plugins/Welcome/Welcome.csproj +++ b/Plugins/Welcome/Welcome.csproj @@ -20,7 +20,7 @@ - +