|
21 | 21 | * Work on fork by Hedius (Version >= 8.0.0.0) |
22 | 22 | * |
23 | 23 | * AdKats.cs |
24 | | - * Version 8.1.8.0 |
25 | | - * 13-JAN-2023 |
| 24 | + * Version 8.1.9.0 |
| 25 | + * 18-FEB-2023 |
26 | 26 | * |
27 | 27 | * Automatic Update Information |
28 | | - * <version_code>8.1.8.0</version_code> |
| 28 | + * <version_code>8.1.9.0</version_code> |
29 | 29 | */ |
30 | 30 |
|
31 | 31 | using System; |
@@ -68,7 +68,7 @@ public class AdKats : PRoConPluginAPI, IPRoConPluginInterface |
68 | 68 | { |
69 | 69 |
|
70 | 70 | //Current Plugin Version |
71 | | - private const String PluginVersion = "8.1.8.0"; |
| 71 | + private const String PluginVersion = "8.1.9.0"; |
72 | 72 |
|
73 | 73 | public enum GameVersionEnum |
74 | 74 | { |
@@ -1117,7 +1117,7 @@ public AdKats() |
1117 | 1117 |
|
1118 | 1118 | public String GetPluginName() |
1119 | 1119 | { |
1120 | | - return "AdKats - Advanced In-Game Admin"; |
| 1120 | + return "E4GLAdKats - Advanced In-Game Admin"; |
1121 | 1121 | } |
1122 | 1122 |
|
1123 | 1123 | public String GetPluginVersion() |
@@ -21023,7 +21023,7 @@ private void QueueRecordForProcessing(ARecord record) |
21023 | 21023 | NowDuration(aRecord.record_time).TotalMinutes < 5 && |
21024 | 21024 | aRecord.command_action.command_key != "player_report_confirm") >= 1) |
21025 | 21025 | { |
21026 | | - SendMessageToSource(record, "Do not have report wars. If this is urgent please contact an admin in teamspeak; " + GetChatCommandByKey("self_voip") + " for the address."); |
| 21026 | + SendMessageToSource(record, "Do not have report wars. If this is urgent please contact an admin in Discord; " + GetChatCommandByKey("self_voip") + " for the address."); |
21027 | 21027 | QueueRecordForProcessing(new ARecord |
21028 | 21028 | { |
21029 | 21029 | record_source = ARecord.Sources.Automated, |
@@ -29511,6 +29511,77 @@ public void CompleteRecordInformation(ARecord record, AChatMessage message) |
29511 | 29511 | } |
29512 | 29512 | } |
29513 | 29513 | break; |
| 29514 | + // Hedius: REDUDANCY part 10k. :) This plugin is a mess. |
| 29515 | + case "player_language_punish": |
| 29516 | + case "player_language_reset": |
| 29517 | + { |
| 29518 | + //Remove previous commands awaiting confirmation |
| 29519 | + CancelSourcePendingAction(record); |
| 29520 | + |
| 29521 | + if (_serverInfo.ServerType == "OFFICIAL") |
| 29522 | + { |
| 29523 | + SendMessageToSource(record, record.command_type.command_name + " cannot be performed on official servers."); |
| 29524 | + FinalizeRecord(record); |
| 29525 | + return; |
| 29526 | + } |
| 29527 | + |
| 29528 | + //Parse parameters using max param count |
| 29529 | + String[] parameters = Util.ParseParameters(remainingMessage, 2); |
| 29530 | + switch (parameters.Length) |
| 29531 | + { |
| 29532 | + case 0: |
| 29533 | + if (record.record_source != ARecord.Sources.InGame) |
| 29534 | + { |
| 29535 | + SendMessageToSource(record, "You can't use a self-targeted command from outside the game."); |
| 29536 | + FinalizeRecord(record); |
| 29537 | + return; |
| 29538 | + } |
| 29539 | + record.record_message = "Issuing command on yourself"; |
| 29540 | + record.target_name = record.source_name; |
| 29541 | + CompleteTargetInformation(record, false, false, false); |
| 29542 | + break; |
| 29543 | + case 1: |
| 29544 | + record.target_name = parameters[0]; |
| 29545 | + //Handle based on report ID as only option |
| 29546 | + if (!HandlePlayerReport(record)) |
| 29547 | + { |
| 29548 | + SendMessageToSource(record, "No reason given, unable to submit."); |
| 29549 | + } |
| 29550 | + FinalizeRecord(record); |
| 29551 | + return; |
| 29552 | + case 2: |
| 29553 | + record.target_name = parameters[0]; |
| 29554 | + |
| 29555 | + //attempt to handle via pre-message ID |
| 29556 | + record.record_message = GetPreMessage(parameters[1], _RequirePreMessageUse); |
| 29557 | + if (record.record_message == null) |
| 29558 | + { |
| 29559 | + SendMessageToSource(record, "Invalid PreMessage ID, valid PreMessage IDs are 1-" + _PreMessageList.Count); |
| 29560 | + FinalizeRecord(record); |
| 29561 | + return; |
| 29562 | + } |
| 29563 | + |
| 29564 | + //Handle based on report ID if possible |
| 29565 | + if (!HandlePlayerReport(record)) |
| 29566 | + { |
| 29567 | + if (record.record_message.Length >= _RequiredReasonLength) |
| 29568 | + { |
| 29569 | + CompleteTargetInformation(record, false, false, true); |
| 29570 | + } |
| 29571 | + else |
| 29572 | + { |
| 29573 | + SendMessageToSource(record, "Reason too short, unable to submit."); |
| 29574 | + FinalizeRecord(record); |
| 29575 | + } |
| 29576 | + } |
| 29577 | + break; |
| 29578 | + default: |
| 29579 | + SendMessageToSource(record, "Invalid parameters, unable to submit."); |
| 29580 | + FinalizeRecord(record); |
| 29581 | + return; |
| 29582 | + } |
| 29583 | + } |
| 29584 | + break; |
29514 | 29585 | default: |
29515 | 29586 | Log.Error("Unable to complete record for " + record.command_type.command_key + ", handler not found."); |
29516 | 29587 | FinalizeRecord(record); |
@@ -31169,6 +31240,12 @@ private void RunAction(ARecord record) |
31169 | 31240 | case "self_challenge": |
31170 | 31241 | SendChallengeInfo(record); |
31171 | 31242 | break; |
| 31243 | + case "player_language_punish": |
| 31244 | + LanguagePunishTarget(record); |
| 31245 | + break; |
| 31246 | + case "player_language_reset": |
| 31247 | + LanguageResetTarget(record); |
| 31248 | + break; |
31172 | 31249 | case "player_changename": |
31173 | 31250 | case "player_changetag": |
31174 | 31251 | case "player_changeip": |
@@ -36000,6 +36077,63 @@ public void ChallengeAutoKillRemoveTarget(ARecord record) |
36000 | 36077 | Log.Debug(() => "Exiting ChallengeAutoKillRemoveTarget", 6); |
36001 | 36078 | } |
36002 | 36079 |
|
| 36080 | + public void LanguagePunishTarget(ARecord record) { |
| 36081 | + Log.Debug(() => "Entering LanguagePunishTarget", 6); |
| 36082 | + try { |
| 36083 | + record.record_action_executed = true; |
| 36084 | + //Perform actions |
| 36085 | + if (String.IsNullOrEmpty(record.target_player.player_name)) { |
| 36086 | + Log.Error("Tried to issue an language punish on a null target."); |
| 36087 | + } |
| 36088 | + else { |
| 36089 | + if (record.record_source != ARecord.Sources.InGame && record.record_source != ARecord.Sources.Automated && record.record_source != ARecord.Sources.ServerCommand) { |
| 36090 | + SendMessageToSource(record, "You issued a LANGUAGE PUNISH on " + record.GetTargetNames() + " for " + record.record_message); |
| 36091 | + } |
| 36092 | + |
| 36093 | + AdminSayMessage(Log.FBold(Log.CRed(record.GetTargetNames() + " LANGUAGE PUNISHED" + (_ShowAdminNameInAnnouncement ? (" by " + record.GetSourceName()) : ("")) + " for " + record.record_message))); |
| 36094 | + ExecuteCommand("procon.protected.plugins.call", "LanguageEnforcer", "RemoteManuallyPunishPlayer", GetType().Name, record.target_player.player_name, record.target_player.player_guid); |
| 36095 | + } |
| 36096 | + } |
| 36097 | + catch (Exception e) { |
| 36098 | + record.record_exception = new AException("Error while taking action for language punish record.", e); |
| 36099 | + Log.HandleException(record.record_exception); |
| 36100 | + FinalizeRecord(record); |
| 36101 | + } |
| 36102 | + |
| 36103 | + Log.Debug(() => "Exiting LanguagePunishTarget", 6); |
| 36104 | + } |
| 36105 | + |
| 36106 | + public void LanguageResetTarget(ARecord record) |
| 36107 | + { |
| 36108 | + Log.Debug(() => "Entering LanguageResetTarget", 6); |
| 36109 | + try |
| 36110 | + { |
| 36111 | + record.record_action_executed = true; |
| 36112 | + //Perform actions |
| 36113 | + if (String.IsNullOrEmpty(record.target_player.player_name)) |
| 36114 | + { |
| 36115 | + Log.Error("Tried to issue an language reset on a null target."); |
| 36116 | + } |
| 36117 | + else |
| 36118 | + { |
| 36119 | + if (record.record_source != ARecord.Sources.InGame && |
| 36120 | + record.record_source != ARecord.Sources.Automated && |
| 36121 | + record.record_source != ARecord.Sources.ServerCommand) |
| 36122 | + { |
| 36123 | + SendMessageToSource(record, "You issued a LANGUAGE RESET on " + record.GetTargetNames() + " for " + record.record_message); |
| 36124 | + } |
| 36125 | + ExecuteCommand("procon.protected.plugins.call", "LanguageEnforcer", "RemoteManuallyResetPlayer", GetType().Name, record.target_player.player_name, record.target_player.player_guid); |
| 36126 | + } |
| 36127 | + } |
| 36128 | + catch (Exception e) |
| 36129 | + { |
| 36130 | + record.record_exception = new AException("Error while taking action for language reset record.", e); |
| 36131 | + Log.HandleException(record.record_exception); |
| 36132 | + FinalizeRecord(record); |
| 36133 | + } |
| 36134 | + Log.Debug(() => "Exiting LanguageResetTarget", 6); |
| 36135 | + } |
| 36136 | + |
36003 | 36137 | public void PurgeExtendedRoundStats() |
36004 | 36138 | { |
36005 | 36139 | Log.Debug(() => "Entering PurgeExtendedRoundStats", 6); |
@@ -47712,6 +47846,16 @@ private void FetchCommands() |
47712 | 47846 | 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); |
47713 | 47847 | newCommands = true; |
47714 | 47848 | } |
| 47849 | + if (!_CommandIDDictionary.ContainsKey(156)) |
| 47850 | + { |
| 47851 | + SendNonQuery("Adding command player_language_punish", "INSERT INTO `adkats_commands` VALUES(156, 'Active', 'player_language_punish', 'Log', 'Issue Language Punish', 'lpunish', TRUE, 'Any')", true); |
| 47852 | + newCommands = true; |
| 47853 | + } |
| 47854 | + if (!_CommandIDDictionary.ContainsKey(157)) |
| 47855 | + { |
| 47856 | + 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); |
| 47857 | + newCommands = true; |
| 47858 | + } |
47715 | 47859 | if (newCommands) |
47716 | 47860 | { |
47717 | 47861 | FetchCommands(); |
@@ -47886,6 +48030,8 @@ private void FillCommandDescDictionary() |
47886 | 48030 | _CommandDescriptionDictionary["player_watchlist_remove"] = "Removes the target player from the watchlist."; |
47887 | 48031 | _CommandDescriptionDictionary["player_whitelistmoveprotection"] = "Adds the target player to the move protection whitelist. Preventing admins from moving them."; |
47888 | 48032 | _CommandDescriptionDictionary["player_whitelistmoveprotection_remove"] = "Removes the target player from the move protection whitelist."; |
| 48033 | + _CommandDescriptionDictionary["player_language_punish"] = "Issue a LanguageEnforcer punishment. Requires LanguageEnforcer to be installed and active."; |
| 48034 | + _CommandDescriptionDictionary["player_language_reset"] = "Issue a LanguageEnforcer counter reset. Resetting the punishment counter to 0 on the server."; |
47889 | 48035 | } |
47890 | 48036 |
|
47891 | 48037 | private void FillReadableMapModeDictionaries() |
|
0 commit comments