From c4026b29a05a67c4af23bb741f31a8d2d3bee1c2 Mon Sep 17 00:00:00 2001 From: Hedius Date: Sat, 18 Feb 2023 02:48:36 +0100 Subject: [PATCH 1/7] update reputation stats for language punish command --- adkatsreputationstats.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/adkatsreputationstats.json b/adkatsreputationstats.json index 6d445c7d..159fa692 100644 --- a/adkatsreputationstats.json +++ b/adkatsreputationstats.json @@ -846,7 +846,7 @@ }, { "command_typeaction": "146|146", - "target_weight": 10, + "target_weight": 8, "source_weight": 0.5 }, { @@ -866,7 +866,7 @@ }, { "command_typeaction": "150|150", - "target_weight": 10, + "target_weight": 8, "source_weight": 1 }, { @@ -893,5 +893,10 @@ "command_typeaction": "155|155", "target_weight": 0, "source_weight": 0 + }, + { + "command_typeaction": "156|156", + "target_weight": -10, + "source_weight": 0.5 } ] From 3cf92e448a24089a42a5596aefd2e1f82e173061 Mon Sep 17 00:00:00 2001 From: Hedius Date: Sat, 18 Feb 2023 17:47:36 +0100 Subject: [PATCH 2/7] add commands player_language_punish/reset --- AdKats.cs | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++- adkats.sql | 1 + 2 files changed, 148 insertions(+), 1 deletion(-) diff --git a/AdKats.cs b/AdKats.cs index 9fc6978c..5c717ed0 100644 --- a/AdKats.cs +++ b/AdKats.cs @@ -21023,7 +21023,7 @@ private void QueueRecordForProcessing(ARecord record) NowDuration(aRecord.record_time).TotalMinutes < 5 && aRecord.command_action.command_key != "player_report_confirm") >= 1) { - SendMessageToSource(record, "Do not have report wars. If this is urgent please contact an admin in teamspeak; " + GetChatCommandByKey("self_voip") + " for the address."); + SendMessageToSource(record, "Do not have report wars. If this is urgent please contact an admin in Discord; " + GetChatCommandByKey("self_voip") + " for the address."); QueueRecordForProcessing(new ARecord { record_source = ARecord.Sources.Automated, @@ -29511,6 +29511,77 @@ public void CompleteRecordInformation(ARecord record, AChatMessage message) } } break; + // Hedius: REDUDANCY part 10k. :) This plugin is a mess. + case "player_language_punish": + case "player_language_reset": + { + //Remove previous commands awaiting confirmation + CancelSourcePendingAction(record); + + if (_serverInfo.ServerType == "OFFICIAL") + { + SendMessageToSource(record, record.command_type.command_name + " cannot be performed on official servers."); + FinalizeRecord(record); + return; + } + + //Parse parameters using max param count + String[] parameters = Util.ParseParameters(remainingMessage, 2); + switch (parameters.Length) + { + case 0: + if (record.record_source != ARecord.Sources.InGame) + { + SendMessageToSource(record, "You can't use a self-targeted command from outside the game."); + FinalizeRecord(record); + return; + } + record.record_message = "Issuing command on yourself"; + record.target_name = record.source_name; + CompleteTargetInformation(record, false, false, false); + break; + case 1: + record.target_name = parameters[0]; + //Handle based on report ID as only option + if (!HandlePlayerReport(record)) + { + SendMessageToSource(record, "No reason given, unable to submit."); + } + FinalizeRecord(record); + return; + case 2: + record.target_name = parameters[0]; + + //attempt to handle via pre-message ID + record.record_message = GetPreMessage(parameters[1], _RequirePreMessageUse); + if (record.record_message == null) + { + SendMessageToSource(record, "Invalid PreMessage ID, valid PreMessage IDs are 1-" + _PreMessageList.Count); + FinalizeRecord(record); + return; + } + + //Handle based on report ID if possible + if (!HandlePlayerReport(record)) + { + if (record.record_message.Length >= _RequiredReasonLength) + { + CompleteTargetInformation(record, false, false, true); + } + else + { + SendMessageToSource(record, "Reason too short, unable to submit."); + FinalizeRecord(record); + } + } + break; + default: + SendMessageToSource(record, "Invalid parameters, unable to submit."); + FinalizeRecord(record); + return; + } + } + break; default: Log.Error("Unable to complete record for " + record.command_type.command_key + ", handler not found."); FinalizeRecord(record); @@ -31169,6 +31240,12 @@ private void RunAction(ARecord record) case "self_challenge": SendChallengeInfo(record); break; + case "player_language_punish": + LanguagePunishTarget(record); + break; + case "player_language_reset": + LanguageResetTarget(record); + break; case "player_changename": case "player_changetag": case "player_changeip": @@ -36000,6 +36077,63 @@ public void ChallengeAutoKillRemoveTarget(ARecord record) Log.Debug(() => "Exiting ChallengeAutoKillRemoveTarget", 6); } + public void LanguagePunishTarget(ARecord record) { + Log.Debug(() => "Entering LanguagePunishTarget", 6); + try { + record.record_action_executed = true; + //Perform actions + if (String.IsNullOrEmpty(record.target_player.player_name)) { + Log.Error("Tried to issue an language punish on a null target."); + } + else { + if (record.record_source != ARecord.Sources.InGame && record.record_source != ARecord.Sources.Automated && record.record_source != ARecord.Sources.ServerCommand) { + SendMessageToSource(record, "You issued a LANGUAGE PUNISH " + record.GetTargetNames() + " for " + record.record_message); + } + + AdminSayMessage(Log.FBold(Log.CRed(record.GetTargetNames() + " LANGUAGE PUNISHED" + (_ShowAdminNameInAnnouncement ? (" by " + record.GetSourceName()) : ("")) + " for " + record.record_message))); + ExecuteCommand("procon.protected.plugins.call", "LanguageEnforcer", "RemoteManuallyPunishPlayer", GetType().Name, record.target_player.player_name, record.target_player.player_guid); + } + } + catch (Exception e) { + record.record_exception = new AException("Error while taking action for language punish record.", e); + Log.HandleException(record.record_exception); + FinalizeRecord(record); + } + + Log.Debug(() => "Exiting LanguagePunishTarget", 6); + } + + public void LanguageResetTarget(ARecord record) + { + Log.Debug(() => "Entering LanguageResetTarget", 6); + try + { + record.record_action_executed = true; + //Perform actions + if (String.IsNullOrEmpty(record.target_player.player_name)) + { + Log.Error("Tried to issue an language reset on a null target."); + } + else + { + if (record.record_source != ARecord.Sources.InGame && + record.record_source != ARecord.Sources.Automated && + record.record_source != ARecord.Sources.ServerCommand) + { + SendMessageToSource(record, "You issued a LANGUAGE RESET " + record.GetTargetNames() + " for " + record.record_message); + } + ExecuteCommand("procon.protected.plugins.call", "LanguageEnforcer", "RemoteManuallyResetPlayer", GetType().Name, record.target_player.player_name, record.target_player.player_guid); + } + } + catch (Exception e) + { + record.record_exception = new AException("Error while taking action for language reset record.", e); + Log.HandleException(record.record_exception); + FinalizeRecord(record); + } + Log.Debug(() => "Exiting LanguageResetTarget", 6); + } + public void PurgeExtendedRoundStats() { Log.Debug(() => "Entering PurgeExtendedRoundStats", 6); @@ -47712,6 +47846,16 @@ private void FetchCommands() SendNonQuery("Adding command player_whitelistmoveprotection_remove", "INSERT INTO `adkats_commands` VALUES(155, 'Active', 'player_whitelistmoveprotection_remove', 'Log', 'Remove Move Protection Whitelist', 'unmovewhitelist', TRUE, 'Any')", true); newCommands = true; } + if (!_CommandIDDictionary.ContainsKey(156)) + { + SendNonQuery("Adding command player_language_punish", "INSERT INTO `adkats_commands` VALUES(156, 'Active', 'player_language_punish', 'Log', 'Issue Language Punish', 'lpunish', TRUE, 'Any')", true); + newCommands = true; + } + if (!_CommandIDDictionary.ContainsKey(157)) + { + SendNonQuery("Adding command player_language_reset", "INSERT INTO `adkats_commands` VALUES(157, 'Active', 'player_language_reset', 'Log', 'Issue Language Counter Reset', 'lreset', TRUE, 'Any')", true); + newCommands = true; + } if (newCommands) { FetchCommands(); @@ -47886,6 +48030,8 @@ private void FillCommandDescDictionary() _CommandDescriptionDictionary["player_watchlist_remove"] = "Removes the target player from the watchlist."; _CommandDescriptionDictionary["player_whitelistmoveprotection"] = "Adds the target player to the move protection whitelist. Preventing admins from moving them."; _CommandDescriptionDictionary["player_whitelistmoveprotection_remove"] = "Removes the target player from the move protection whitelist."; + _CommandDescriptionDictionary["player_language_punish"] = "Issue a LanguageEnforcer punishment. Requires LanguageEnforcer to be installed and active."; + _CommandDescriptionDictionary["player_language_reset"] = "Issue a LanguageEnforcer counter reset. Resetting the punishment counter to 0 on the server."; } private void FillReadableMapModeDictionaries() diff --git a/adkats.sql b/adkats.sql index 6fdc6a9f..1219083c 100644 --- a/adkats.sql +++ b/adkats.sql @@ -327,6 +327,7 @@ REPLACE INTO `adkats_commands` VALUES(152, 'Active', 'player_watchlist_remove', REPLACE INTO `adkats_commands` VALUES(153, 'Active', 'player_persistentmute_force', 'Log', 'Persistent Force Mute Player', 'fmute', TRUE, 'AnyHidden'); REPLACE INTO `adkats_commands` VALUES(154, 'Active', 'player_whitelistmoveprotection', 'Log', 'Move Protection Whitelist Player', 'movewhitelist', TRUE, 'Any'); REPLACE INTO `adkats_commands` VALUES(155, 'Active', 'player_whitelistmoveprotection_remove', 'Log', 'Remove Move Protection Whitelist', 'unmovewhitelist', TRUE, 'Any'); +REPLACE INTO `adkats_commands` VALUES(156, 'Active', 'player_language_punish', 'Log', 'Issue LanguageEnforcer Punish', 'lpunish', TRUE, 'Any'); From 72f3da5860dd375f71cf02e5efbd8b674242bde9 Mon Sep 17 00:00:00 2001 From: Hedius Date: Sat, 18 Feb 2023 17:49:03 +0100 Subject: [PATCH 3/7] add reputation stats for command 157 --- adkatsreputationstats.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/adkatsreputationstats.json b/adkatsreputationstats.json index 159fa692..1303a794 100644 --- a/adkatsreputationstats.json +++ b/adkatsreputationstats.json @@ -898,5 +898,10 @@ "command_typeaction": "156|156", "target_weight": -10, "source_weight": 0.5 + }, + { + "command_typeaction": "157|157", + "target_weight": 8, + "source_weight": 0.5 } ] From 394db837e138f5c52943a4cce1299463a1bf07ea Mon Sep 17 00:00:00 2001 From: Hedius Date: Sat, 18 Feb 2023 18:00:35 +0100 Subject: [PATCH 4/7] update docs --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ adkats.sql | 3 ++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3de00273..b2ec79e1 100644 --- a/README.md +++ b/README.md @@ -549,6 +549,12 @@ Direct temp-ban and ban are of course still available for hacking/glitching situations, but that is the ONLY time they should be used.

+

LanguageEnforcer Integration

+

+ This plugin integrates with E4GLs LanguageEnforcer for issuing commands + from AdKats. Admins can use the commands !lpunish and !lreset to manually issue LanguageEnforcer punishments on players. + Furthermore, this custom version of the plugin comes with temp and perma mute support. +

Player Reputation System

Reputation is a numeric for how helpful a player is to the server. @@ -2746,6 +2752,48 @@ plugin.CallOtherPlugin("AdKats", "IssueCommand", command); +

LanguageEnforcer Integration Commands

+ + + + + + + + + + + + + + + + + + + +
CommandDefault TextParamsDescription
Issue Language Punishlpunish + None
+ OR
+ [player][reason]
+ OR
+ [reportID]
+ OR
+ [reportID][reason] +
+ The in-game command for issuing a language punishment over LanguageEnforcer. Requires LanguageEnforcer to be installed and enabled. +
Issue Language Resetlreset + None
+ OR
+ [player][reason]
+ OR
+ [reportID]
+ OR
+ [reportID][reason] +
+ The in-game command for issuing a counter reset over LanguageEnforcer. Resets all points and sets the the player to a clean state. +
+

Maintenance Commands

diff --git a/adkats.sql b/adkats.sql index 1219083c..2d28a8ae 100644 --- a/adkats.sql +++ b/adkats.sql @@ -327,7 +327,8 @@ REPLACE INTO `adkats_commands` VALUES(152, 'Active', 'player_watchlist_remove', REPLACE INTO `adkats_commands` VALUES(153, 'Active', 'player_persistentmute_force', 'Log', 'Persistent Force Mute Player', 'fmute', TRUE, 'AnyHidden'); REPLACE INTO `adkats_commands` VALUES(154, 'Active', 'player_whitelistmoveprotection', 'Log', 'Move Protection Whitelist Player', 'movewhitelist', TRUE, 'Any'); REPLACE INTO `adkats_commands` VALUES(155, 'Active', 'player_whitelistmoveprotection_remove', 'Log', 'Remove Move Protection Whitelist', 'unmovewhitelist', TRUE, 'Any'); -REPLACE INTO `adkats_commands` VALUES(156, 'Active', 'player_language_punish', 'Log', 'Issue LanguageEnforcer Punish', 'lpunish', TRUE, 'Any'); +REPLACE INTO `adkats_commands` VALUES(156, 'Active', 'player_language_punish', 'Log', 'Issue Language Punish', 'lpunish', TRUE, 'Any'); +REPLACE INTO `adkats_commands` VALUES(157, 'Active', 'player_language_reset', 'Log', 'Issue Language Counter Reset', 'lreset', TRUE, 'Any'); From eeb467005002e531ce7a13b9142085fb2cac40d2 Mon Sep 17 00:00:00 2001 From: Hedius Date: Sat, 18 Feb 2023 18:07:03 +0100 Subject: [PATCH 5/7] update changelog for 8.1.9.0 --- CHANGELOG.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5d37a9d..74b51344 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1613,7 +1613,23 @@ Added small improvements to fuzzy player match response text. Changes
    - +
  • None
  • +
+Bugs Fixed
+
    +
  • None
  • +
+ +

8.1.9.0 (18-FEB-2023)

+Enhancements
+
    +
  • New commands: !lpunish and !lreset
  • +
  • These commands integrate together with E4GL's LanguageEnforcer fork to allow admins to issue language punishments and resets of the counter over the Language plugin.
  • +
  • This has been implemented to allow auditing of language punishments.
  • +
+Changes
+
    +
  • Report war responses tell people to join the discord now. (Instead of teamspeak).
Bugs Fixed
    From c2714885ab91db817b0b22ed838bbd53669d03a7 Mon Sep 17 00:00:00 2001 From: Hedius Date: Sat, 18 Feb 2023 18:56:38 +0100 Subject: [PATCH 6/7] fix typo --- AdKats.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AdKats.cs b/AdKats.cs index 5c717ed0..c87645fb 100644 --- a/AdKats.cs +++ b/AdKats.cs @@ -36087,7 +36087,7 @@ public void LanguagePunishTarget(ARecord record) { } else { if (record.record_source != ARecord.Sources.InGame && record.record_source != ARecord.Sources.Automated && record.record_source != ARecord.Sources.ServerCommand) { - SendMessageToSource(record, "You issued a LANGUAGE PUNISH " + record.GetTargetNames() + " for " + record.record_message); + SendMessageToSource(record, "You issued a LANGUAGE PUNISH on " + record.GetTargetNames() + " for " + record.record_message); } AdminSayMessage(Log.FBold(Log.CRed(record.GetTargetNames() + " LANGUAGE PUNISHED" + (_ShowAdminNameInAnnouncement ? (" by " + record.GetSourceName()) : ("")) + " for " + record.record_message))); @@ -36120,7 +36120,7 @@ public void LanguageResetTarget(ARecord record) record.record_source != ARecord.Sources.Automated && record.record_source != ARecord.Sources.ServerCommand) { - SendMessageToSource(record, "You issued a LANGUAGE RESET " + record.GetTargetNames() + " for " + record.record_message); + SendMessageToSource(record, "You issued a LANGUAGE RESET on " + record.GetTargetNames() + " for " + record.record_message); } ExecuteCommand("procon.protected.plugins.call", "LanguageEnforcer", "RemoteManuallyResetPlayer", GetType().Name, record.target_player.player_name, record.target_player.player_guid); } From d06313805edc5eeecdbfdcfc85c804a6d5c2dc5a Mon Sep 17 00:00:00 2001 From: Hedius Date: Sat, 18 Feb 2023 18:58:21 +0100 Subject: [PATCH 7/7] release v8.1.9.0 --- AdKats.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/AdKats.cs b/AdKats.cs index c87645fb..1c05bda6 100644 --- a/AdKats.cs +++ b/AdKats.cs @@ -21,11 +21,11 @@ * Work on fork by Hedius (Version >= 8.0.0.0) * * AdKats.cs - * Version 8.1.8.0 - * 13-JAN-2023 + * Version 8.1.9.0 + * 18-FEB-2023 * * Automatic Update Information - * 8.1.8.0 + * 8.1.9.0 */ using System; @@ -68,7 +68,7 @@ public class AdKats : PRoConPluginAPI, IPRoConPluginInterface { //Current Plugin Version - private const String PluginVersion = "8.1.8.0"; + private const String PluginVersion = "8.1.9.0"; public enum GameVersionEnum { @@ -1117,7 +1117,7 @@ public AdKats() public String GetPluginName() { - return "AdKats - Advanced In-Game Admin"; + return "E4GLAdKats - Advanced In-Game Admin"; } public String GetPluginVersion()