Skip to content

Commit

Permalink
Merge pull request #23 from Hedius/test
Browse files Browse the repository at this point in the history
Version 8.1.9.0
  • Loading branch information
Hedius authored Feb 18, 2023
2 parents ecad3e9 + d063138 commit c242aa2
Show file tree
Hide file tree
Showing 4 changed files with 219 additions and 7 deletions.
158 changes: 152 additions & 6 deletions AdKats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <version_code>8.1.8.0</version_code>
* <version_code>8.1.9.0</version_code>
*/

using System;
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -1117,7 +1117,7 @@ public AdKats()

public String GetPluginName()
{
return "AdKats - Advanced In-Game Admin";
return "E4GLAdKats - Advanced In-Game Admin";
}

public String GetPluginVersion()
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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":
Expand Down Expand Up @@ -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 on " + 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 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);
}
}
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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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()
Expand Down
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,23 @@ Added small improvements to fuzzy player match response text.</li>
</ul>
<b>Changes</b><br/>
<ul>
<liNone</li>
<li>None</li>
</ul>
<b>Bugs Fixed</b><br/>
<ul>
<li>None</li>
</ul>

<h4>8.1.9.0 (18-FEB-2023)</h4>
<b>Enhancements</b><br/>
<ul>
<li>New commands: !lpunish and !lreset</li>
<li>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.</li>
<li>This has been implemented to allow auditing of language punishments.</li>
</ul>
<b>Changes</b><br/>
<ul>
<li>Report war responses tell people to join the discord now. (Instead of teamspeak).</li>
</ul>
<b>Bugs Fixed</b><br/>
<ul>
Expand Down
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
</p>
<h3>LanguageEnforcer Integration</h3>
<p>
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.
</p>
<h3>Player Reputation System</h3>
<p>
Reputation is a numeric for how helpful a player is to the server.
Expand Down Expand Up @@ -2746,6 +2752,48 @@ plugin.CallOtherPlugin("AdKats", "IssueCommand", command);
</td>
</tr>
</table>
<h3>LanguageEnforcer Integration Commands</h3>
<table>
<tr>
<td><b>Command</b></td>
<td><b>Default Text</b></td>
<td><b>Params</b></td>
<td><b>Description</b></td>
</tr>
<tr>
<td><b>Issue Language Punish</b></td>
<td>lpunish</td>
<td>
None<br/>
OR<br/>
[player][reason]<br/>
OR<br/>
[reportID]<br/>
OR<br/>
[reportID][reason]
</td>
<td>
The in-game command for issuing a language punishment over LanguageEnforcer. Requires LanguageEnforcer to be installed and enabled.
</td>
</tr>
<tr>
<td><b>Issue Language Reset</b></td>
<td>lreset</td>
<td>
None<br/>
OR<br/>
[player][reason]<br/>
OR<br/>
[reportID]<br/>
OR<br/>
[reportID][reason]
</td>
<td>
The in-game command for issuing a counter reset over LanguageEnforcer. Resets all points and sets the the player to a clean state.
</td>
</tr>
</table>

<h3>Maintenance Commands</h3>
<table>
<tr>
Expand Down
2 changes: 2 additions & 0 deletions adkats.sql
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +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 Language Punish', 'lpunish', TRUE, 'Any');
REPLACE INTO `adkats_commands` VALUES(157, 'Active', 'player_language_reset', 'Log', 'Issue Language Counter Reset', 'lreset', TRUE, 'Any');



Expand Down

0 comments on commit c242aa2

Please sign in to comment.