public ConfirmationEntry(string speaker, string message, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subset) { this.Speaker = speaker; this.Message = message; this.MatchedCommand = mtcCommand; this.ConfirmationDetails = capCommand; this.MessageScope = subset; }
public CapturedCommand Matches(string strText) { CapturedCommand ccReturn = null; Match mtcCommandMatch = Regex.Match(strText, String.Format("^/?(?<scope>{0})(?<command>{1})[ ]?(?<arguments>.*)", String.Join("|", this.Scope.ToArray()), this.Command), RegexOptions.IgnoreCase); if (mtcCommandMatch.Success == true) { string strRemainderArguments = mtcCommandMatch.Groups["arguments"].Value; List <MatchArgument> lstMatchedArguments = new List <MatchArgument>(); int skippedBlankArguments = 0; foreach (MatchArgumentFormat argument in this.ArgumentsFormat) { if (argument.ArgumentValues != null && argument.ArgumentValues.Count > 0) { string strArgument = String.Empty; if (argument.ArgumentType == MatchArgumentFormatTypes.Dictionary) { int iMatchScore = MatchCommand.GetClosestMatch(strRemainderArguments, argument.ArgumentValues, out strArgument, out strRemainderArguments); if (iMatchScore != int.MaxValue) { lstMatchedArguments.Add(new MatchArgument(strArgument, iMatchScore)); } } else if (argument.ArgumentType == MatchArgumentFormatTypes.Regex) { foreach (string regexInput in argument.ArgumentValues) { Match argumentMatch = Regex.Match(strRemainderArguments, String.Format("^({0})", regexInput)); if (argumentMatch.Success == true && argumentMatch.Groups.Count >= 2) { strRemainderArguments = strRemainderArguments.Substring(argumentMatch.Value.Length, strRemainderArguments.Length - argumentMatch.Value.Length); lstMatchedArguments.Add(new MatchArgument(argumentMatch.Groups[1].Value, 0)); break; } } } } if (argument.ArgumentValues.Count == 0) { skippedBlankArguments++; } } if (lstMatchedArguments.Count == this.ArgumentsFormat.Count - skippedBlankArguments) { ccReturn = new CapturedCommand(mtcCommandMatch.Groups["scope"].Value, this.Command, lstMatchedArguments, strRemainderArguments); } } return(ccReturn); }
public CBattlelogCache() { matchCommandLookupRequest = new MatchCommand("CBattlelogCache", "PlayerLookup", new List<string>(), "CBattlelogCache_LookupRequest", new List<MatchArgumentFormat>(), new ExecutionRequirements(ExecutionScope.None), "LookupRequest method for the Battlelog statscaching plugin. Cannot be called ingame"); lookupRequests = new List<LookupRequest>(); lookupResponses = new List<LookupResponse>(); isEnabled = false; debugLevel = 2; }
private void Initialize(ExecutionScope scope, Privileges privileges, int iMinimumSimilarity, MatchCommand mcConfirmationCommand, string strFailedRequirementsMessage) { this.ExecutionScope = scope; this.RequiredPrivileges = privileges; this.MinimumMatchSimilarity = iMinimumSimilarity; this.ConfirmationCommand = mcConfirmationCommand; if (strFailedRequirementsMessage.Length < 100) { this.FailedRequirementsMessage = strFailedRequirementsMessage; } else { this.FailedRequirementsMessage = strFailedRequirementsMessage.Substring(0, 100); } }
public ExecutionRequirements(ExecutionScope scope, int iMinimumSimilarity, MatchCommand mcConfirmationCommand) { this.Initialize(scope, Privileges.CanLogin, iMinimumSimilarity, mcConfirmationCommand, string.Empty); }
/// <summary> /// This will check from the dictionary of registered commands to see if some text is matched /// against a registered command. The return is prioritized for whatever command matches more /// arguments. /// </summary> /// <param name="playerName">Who executed the command</param> /// <param name="message">The message they sent</param> /// <param name="matchedCommand"></param> /// <param name="returnCommand"></param> private bool CheckInGameCommands(string playerName, string message, out MatchCommand matchedCommand, out CapturedCommand returnCommand) { bool isMatch = false; returnCommand = null; matchedCommand = null; lock (MatchedInGameCommandsLocker) { CapturedCommand capMatched = null; // If this player has a command stored that requires confirmation. if (CommandsNeedingConfirmation.Contains(playerName) == true) { if ((capMatched = CommandsNeedingConfirmation[playerName].MatchedCommand.Requirements.ConfirmationCommand.Matches(message)) != null) { //capReturnCommand = capMatched; returnCommand = CommandsNeedingConfirmation[playerName].ConfirmationDetails; matchedCommand = CommandsNeedingConfirmation[playerName].MatchedCommand; returnCommand.IsConfirmed = true; isMatch = true; } } // If it was not a confirmation to a previously matched command. if (isMatch == false) { foreach (var kvpCommand in MatchedInGameCommands) { // Only care if the plugin is enabled. if (Plugins.IsEnabled(kvpCommand.Value.RegisteredClassname) == true) { capMatched = kvpCommand.Value.Matches(message); if (capMatched != null) { if (kvpCommand.Value.Requirements.HasValidPermissions(ProconClient.GetAccountPrivileges(playerName)) == true) { // if (this.ValidateRequirements(playerName, kvpCommand.Value.Requirements) == true) { // If it's the first match we've found if (returnCommand == null) { returnCommand = capMatched; matchedCommand = kvpCommand.Value; isMatch = true; } else if (capMatched.CompareTo(returnCommand) > 0) { // We've found a command with that is a closer match to its arguments returnCommand = capMatched; matchedCommand = kvpCommand.Value; isMatch = true; } /* // If we've found a better match than before (more arguments matched) else if (capReturnCommand != null && capMatched.MatchedArguments.Count > capReturnCommand.MatchedArguments.Count) { capReturnCommand = capMatched; mtcMatchedCommand = kvpCommand.Value; isMatch = true; } // If we've found another match, check if this one is "matchier" (has a lower score) else if (capReturnCommand != null && capMatched.MatchedArguments.Count == capReturnCommand.MatchedArguments.Count && capMatched.AggregateMatchScore < capReturnCommand.AggregateMatchScore) { // We've found a command with the same amount of matched data but the new command is closer to it's own dictionary. capReturnCommand = capMatched; mtcMatchedCommand = kvpCommand.Value; isMatch = true; }*/ } else { ProconClient.Game.SendAdminSayPacket(kvpCommand.Value.Requirements.FailedRequirementsMessage, new CPlayerSubset(CPlayerSubset.PlayerSubsetType.Player, playerName)); // this.m_prcClient.SendRequest(new List<string>() { "admin.say", kvpCommand.Value.Requirements.FailedRequirementsMessage, "player", playerName }); } } } } } } return isMatch; }
// TO DO: Move to seperate command control class with events captured by PluginManager. public void RegisterCommand(MatchCommand mtcCommand) { lock (MatchedInGameCommandsLocker) { if (mtcCommand.RegisteredClassname.Length > 0 && mtcCommand.RegisteredMethodName.Length > 0 && mtcCommand.Command.Length > 0) { if (MatchedInGameCommands.ContainsKey(mtcCommand.ToString()) == true) { if (String.CompareOrdinal(MatchedInGameCommands[mtcCommand.ToString()].RegisteredClassname, mtcCommand.RegisteredClassname) != 0) { WritePluginConsole("^1^bIdentical command registration on class {0} overwriting class {1} command {2}", mtcCommand.RegisteredClassname, MatchedInGameCommands[mtcCommand.ToString()].RegisteredClassname, MatchedInGameCommands[mtcCommand.ToString()].ToString()); } MatchedInGameCommands[mtcCommand.ToString()] = mtcCommand; } else { MatchedInGameCommands.Add(mtcCommand.ToString(), mtcCommand); InvokeOnAllEnabled("OnRegisteredCommand", mtcCommand); } } } }
public AdKats() { //Set defaults for webclient System.Net.ServicePointManager.Expect100Continue = false; //By default plugin is not enabled or ready this._IsEnabled = false; this._ThreadsReady = false; //Assign the match commands this._IssueCommandMatchCommand = new MatchCommand("AdKats", "IssueCommand", new List<String>(), "AdKats_IssueCommand", new List<MatchArgumentFormat>(), new ExecutionRequirements(ExecutionScope.None), "Useable by other plugins to call AdKats commands."); this._FetchAuthorizedSoldiersMatchCommand = new MatchCommand("AdKats", "FetchAuthorizedSoldiers", new List<String>(), "AdKats_FetchAuthorizedSoldiers", new List<MatchArgumentFormat>(), new ExecutionRequirements(ExecutionScope.None), "Useable by other plugins to fetch authorized soldiers."); //Debug level is 0 by default this._DebugLevel = 0; //Randomize the external access key this._ExternalCommandAccessKey = AdKats.GetRandom32BitHashCode(); //Init the punishment severity index this._PunishmentSeverityIndex = new List<String> { "kill", "kick", "tban60", "tban120", "tbanday", "tbanweek", "tban2weeks", "tbanmonth", "ban" }; //Init the pre-message list this._PreMessageList = new List<String> { "US TEAM: DO NOT BASERAPE, YOU WILL BE PUNISHED.", "RU TEAM: DO NOT BASERAPE, YOU WILL BE PUNISHED.", "US TEAM: DO NOT ENTER THE STREETS BEYOND 'A', YOU WILL BE PUNISHED.", "RU TEAM: DO NOT GO BEYOND THE BLACK LINE ON CEILING BY 'C' FLAG, YOU WILL BE PUNISHED.", "THIS SERVER IS NO EXPLOSIVES, YOU WILL BE PUNISHED FOR INFRACTIONS.", "JOIN OUR TEAMSPEAK AT TS.ADKGAMERS.COM:3796" }; //Fetch the plugin description and changelog this.FetchPluginDescAndChangelog(); //Prepare the keep-alive this.SetupKeepAlive(); }
private static int GetClosestMatch(string strArguments, List <string> lstDictionary, out string strMatchedDictionaryKey, out string strRemainderArguments) { int iSimilarity = int.MaxValue; int iScore = 0; strRemainderArguments = String.Empty; strMatchedDictionaryKey = String.Empty; if (lstDictionary.Count >= 1) { int iLargestDictionaryKey = 0; // Build array of default matches from the dictionary to store a rank for each match. // (it's designed to work on smaller dictionaries with say.. 32 player names in it =) List <MatchDictionaryKey> lstMatches = new List <MatchDictionaryKey>(); foreach (string strDictionaryKey in lstDictionary) { lstMatches.Add(new MatchDictionaryKey(strDictionaryKey)); if (strDictionaryKey.Length > iLargestDictionaryKey) { iLargestDictionaryKey = strDictionaryKey.Length; } } // Rank each match, find the remaining characters for a match (arguements) for (int x = 1; x <= Math.Min(strArguments.Length, iLargestDictionaryKey); x++) { // Skip it if it's a space (a space breaks a name and moves onto arguement. // but the space could also be included in the dictionarykey, which will be checked // on the next loop. if (x + 1 < strArguments.Length && strArguments[x] != ' ') { continue; } for (int i = 0; i < lstMatches.Count; i++) { iScore = MatchCommand.Compute(strArguments.Substring(0, x).ToLower(), lstMatches[i].LowerCaseMatchedText); if (iScore < lstMatches[i].MatchedScore) { lstMatches[i].MatchedScore = iScore; lstMatches[i].MatchedScoreCharacters = x; } } } // Sort the matches lstMatches.Sort(); int iBestCharactersMatched = lstMatches[0].MatchedScoreCharacters; iSimilarity = lstMatches[0].MatchedScore; strMatchedDictionaryKey = lstMatches[0].MatchedText; // Now though we want to loop through from start to end and see if a subset of what we entered is found. // if so then this will find the highest ranked item with a subset of what was entered and favour that instead. string strBestCharsSubstringLower = strArguments.Substring(0, iBestCharactersMatched).ToLower(); for (int i = 0; i < lstMatches.Count; i++) { if (lstMatches[i].LowerCaseMatchedText.Contains(strBestCharsSubstringLower) == true) { iSimilarity = lstMatches[i].MatchedScore; strMatchedDictionaryKey = lstMatches[i].MatchedText; iBestCharactersMatched = lstMatches[i].MatchedScoreCharacters; break; } } if (iBestCharactersMatched < strArguments.Length) { strRemainderArguments = strArguments.Substring(iBestCharactersMatched + 1); } else { strRemainderArguments = strArguments.Substring(iBestCharactersMatched); } } return(iSimilarity); }
public void OnCommandPlayerGUID(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { if (this.m_enAllowPlayersToGuidOthers == enumBoolYesNo.Yes) { if (base.PunkbusterPlayerInfoList.ContainsKey(capCommand.MatchedArguments[0].Argument) == true && base.PunkbusterPlayerInfoList[capCommand.MatchedArguments[0].Argument].GUID.Length == 32) { this.ExecuteCommand("procon.protected.send", "admin.say", base.PunkbusterPlayerInfoList[capCommand.MatchedArguments[0].Argument].SoldierName + "'s P/GUID: " + base.PunkbusterPlayerInfoList[capCommand.MatchedArguments[0].Argument].GUID.Substring(24, 8), "player", strSpeaker); } else { this.ExecuteCommand("procon.protected.send", "admin.say", "Player not found", "player", strSpeaker); } } }
public void OnCommandTBForceMove(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { if (capCommand.MatchedArguments.Count == 0) { this.DebugInfoGuard("^4Malformed tb-fmove command: " + strText); if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.say player " + strSpeaker + " - " + "Malformed command: " + strText); } else { this.ExecuteCommand("procon.protected.send", "admin.say", "Malformed command: " + strText, "player", strSpeaker); } return; } string player = capCommand.MatchedArguments[0].Argument; this.DebugInfoGuard("^4Force Moving Player: ^b" + player); this.DTForceMove = DateTime.Now; if (this.OnCommandMove.ContainsKey(player) == false) { this.OnCommandMove.Add(player, true); } else { this.OnCommandMove[player] = true; } int team = 0; if (this.dicPlayerCache[player].teamID == 1) team = 2; else team = 1; if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.movePlayer " + player + " " + team.ToString() + " 0 false"); } else { this.ExecuteCommand("procon.protected.send", "admin.movePlayer", player, team.ToString(), "0", "true"); } this.DebugInfoGuard("^4Trying to force player to the other side, due to TB-ForceMoveCommand: ^b" + player); }
public void OnCommandServerLocation(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { this.ExecuteCommand("procon.protected.send", "admin.say", "Server location: " + this.GetVariable<string>("SERVER_COUNTRY", ""), "player", strSpeaker); }
public void OnCommandPlayerLocation(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { if (this.m_enAllowPlayersToGetOthersCountry == enumBoolYesNo.Yes) { if (base.PunkbusterPlayerInfoList.ContainsKey(capCommand.MatchedArguments[0].Argument) == true) { this.ExecuteCommand("procon.protected.send", "admin.say", base.PunkbusterPlayerInfoList[capCommand.MatchedArguments[0].Argument].SoldierName + "'s location: " + base.PunkbusterPlayerInfoList[capCommand.MatchedArguments[0].Argument].PlayerCountry, "player", strSpeaker); } else { this.ExecuteCommand("procon.protected.send", "admin.say", "Player not found", "player", strSpeaker); } } }
public void OnCommandMyGUIDFull(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { if (base.PunkbusterPlayerInfoList.ContainsKey(strSpeaker) == true && base.PunkbusterPlayerInfoList[strSpeaker].GUID.Length == 32) { this.ExecuteCommand("procon.protected.send", "admin.say", "Your GUID " + base.PunkbusterPlayerInfoList[strSpeaker].GUID, "player", strSpeaker); } else { this.ExecuteCommand("procon.protected.send", "admin.say", "No pb info yet, try again =(", "player", strSpeaker); } }
public override void OnUnregisteredCommand(MatchCommand mtcCommand) { if (String.Compare(mtcCommand.Command, "help", true) != 0) { this.SetupHelpCommands(); } }
public void OnUnregisteredCommand(MatchCommand mtcCommand) { }
// // IPRoConPluginInterface3 // public void OnAnyMatchRegisteredCommand(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { }
public void OnCommandHelp(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("Type \"{0}help [command]\" for more information about a command:", capCommand.ResposeScope), "player", strSpeaker); foreach (string strCommandOutput in this.WordWrap(String.Join(", ", this.GetExcludedCommandStrings(strSpeaker).ToArray()), 100)) { this.ExecuteCommand("procon.protected.send", "admin.say", strCommandOutput, "player", strSpeaker); } }
public void OnCommandScrambleRound(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope){ bool blIsAdmin = false; CPrivileges cpAccount = this.GetAccountPrivileges(strSpeaker); if (cpAccount != null && cpAccount.PrivilegesFlags > 0) { blIsAdmin = true; } if(blIsAdmin){ this.DebugInfoSkill("^1Admin requested a scramble next round!"); if (this.ynbEnableScrambleRound == enumBoolYesNo.Yes){ this.boolscramblebyadminroundend = true; if (this.boolLevelStart){ if (this.ynbScrambleMessage == enumBoolYesNo.Yes){ if (this.strScrambleRoundMsg != ""){ if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL:^n say all - " + this.strScrambleRoundMsg); } else { this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleRoundMsg , "all"); } if (this.ynbYellScrambleManuall == enumBoolYesNo.Yes && !this.boolVirtual){ this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleRoundMsg , "30"); } } } } }else{ this.DebugInfoSkill("^3This command is deactivated at the moment. Activate it in PRoCon."); if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.say player " + strSpeaker + " - " + "This command is not activated for your server in PRoCon."); } else { this.ExecuteCommand("procon.protected.send", "admin.say", "This command is not activated for your server in PRoCon." , "player", strSpeaker); } } } }
public void OnCommandHelpSpecific(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { List<MatchCommand> lstCommands = this.GetRegisteredCommands(); CPrivileges privileges = this.GetAccountPrivileges(strSpeaker); foreach (MatchCommand mtcLoopedCommand in lstCommands) { if (String.Compare(mtcLoopedCommand.Command, capCommand.MatchedArguments[0].Argument, true) == 0 && mtcLoopedCommand.Requirements.HasValidPermissions(privileges) == true) { foreach (string strLine in this.WordWrap(String.Format("> {0}; {1}", mtcLoopedCommand.ToString(), mtcLoopedCommand.Description), 100)) { this.ExecuteCommand("procon.protected.send", "admin.say", strLine, "player", strSpeaker); } } } }
public void OnCommandTBMove(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { if (capCommand.MatchedArguments.Count == 0) { this.DebugInfoGuard("^4Malformed tb-move command: " + strText); if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.say player " + strSpeaker + " - " + "Malformed command: " + strText); } else { this.ExecuteCommand("procon.protected.send", "admin.say", "Malformed command: " + strText, "player", strSpeaker); } return; } string player = capCommand.MatchedArguments[0].Argument; this.DebugInfoGuard("^4Move Player when dead: ^b" + player); if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.say player " + player + " - " + "You will be moved to the other team upon death."); } else { this.ExecuteCommand("procon.protected.send", "admin.say", "You will be moved to the other team upon death.", "player", player); } if (this.OnCommandMoveDone.Contains(player)) { this.OnCommandMoveDone.Remove(player); } if (this.OnCommandMove.ContainsKey(player) == false) { this.OnCommandMove.Add(player, false); } else { this.OnCommandMove[player] = false; } }
public void OnCommandVersion(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("IP: {0}, Location: {1}, Rcon: PRoCon {2}", this.m_strHostName, this.GetVariable<string>("SERVER_COUNTRY", ""), this.m_strPRoConVersion), "player", strSpeaker); }
public void OnCommandTBForceMove(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { string player = capCommand.MatchedArguments[0].Argument; this.DebugInfoGuard("^4Force Moving Player: ^b" + player); this.DTForceMove = DateTime.Now; if (this.OnCommandMove.ContainsKey(player) == false) { this.OnCommandMove.Add(player, true); } else { this.OnCommandMove[player] = true; } int team = 0; if (this.dicPlayerCache[player].teamID == 1) team = 2; else team = 1; this.ExecuteCommand("procon.protected.send", "admin.movePlayer", player, team.ToString(), "0", "true"); this.DebugInfoGuard("^4Trying to force player to the other side, due to TB-ForceMoveCommand: ^b" + player); }
public void OnCommandMyTimes(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { if (base.FrostbitePlayerInfoList.ContainsKey(strSpeaker) == true && base.FrostbitePlayerInfoList[strSpeaker].SessionTime != 0) { string strOutTime = this.SecondsToText((UInt32)base.FrostbitePlayerInfoList[strSpeaker].SessionTime, this.m_astrTimeDescription, true); this.ExecuteCommand("procon.protected.send", "admin.say", "Your current playTime: " + strOutTime, "player", strSpeaker); } else { this.ExecuteCommand("procon.protected.send", "admin.say", "Sorry, you've just joined =(", "player", strSpeaker); } }
public void OnCommandToggle(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { if (capCommand.ExtraArguments == "0" || capCommand.ExtraArguments == "off") { this.ExecuteCommand("procon.protected.send", "admin.say", "RankKicker disabled!", "all"); this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^4AccessRestriction: ^0RankKicker disabled ingame!"); this.m_RankKickerOnOff = enumBoolOnOff.Off; } else if (capCommand.ExtraArguments == "1" || capCommand.ExtraArguments == "on") { this.ExecuteCommand("procon.protected.send", "admin.say", "RankKicker enabled!", "all"); this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^4AccessRestriction: ^0RankKicker enabled ingame!"); this.m_RankKickerOnOff = enumBoolOnOff.On; } else if (capCommand.ExtraArguments == "clear") { Clear(0); } else if (capCommand.ExtraArguments == "check") { this.ExecuteCommand("procon.protected.send", "admin.say", "RankKicker checking all players!", "all"); this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^4AccessRestriction: ^0RankKicker checking all players!"); this.ExecuteCommand("procon.protected.send", "admin.listPlayers", "all"); } else { this.ExecuteCommand("procon.protected.send", "admin.say", "Wrong arguments. Use '0'/'off', '1'/'on', 'clear' or 'check'!", "all"); } }
public void OnCommandPlayerTimes(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { if (this.m_enAllowPlayersToTimeOthers == enumBoolYesNo.Yes) { if (base.FrostbitePlayerInfoList.ContainsKey(capCommand.MatchedArguments[0].Argument) == true && base.FrostbitePlayerInfoList[capCommand.MatchedArguments[0].Argument].SessionTime != 0) { string strOutTime = this.SecondsToText((UInt32)base.FrostbitePlayerInfoList[capCommand.MatchedArguments[0].Argument].SessionTime, this.m_astrTimeDescription, true); this.ExecuteCommand("procon.protected.send", "admin.say", base.FrostbitePlayerInfoList[capCommand.MatchedArguments[0].Argument].SoldierName + "'s playTime: " + strOutTime, "player", strSpeaker); } else { this.ExecuteCommand("procon.protected.send", "admin.say", "Player not found / or just joined", "player", strSpeaker); } } }
private void DispatchMatchedCommand(string playerName, string message, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subset) { bool isConfirmationRequired = false; if (capCommand.IsConfirmed == false) { foreach (MatchArgument mtcArgument in capCommand.MatchedArguments) { if (mtcArgument.MatchScore > mtcCommand.Requirements.MinimumMatchSimilarity) { isConfirmationRequired = true; capCommand.IsConfirmed = false; break; } } } if (isConfirmationRequired == true && capCommand.IsConfirmed == false) { if (CommandsNeedingConfirmation.Contains(playerName) == true) { CommandsNeedingConfirmation.Remove(playerName); } CommandsNeedingConfirmation.Add(new ConfirmationEntry(playerName, message, mtcCommand, capCommand, subset)); ProconClient.Game.SendAdminSayPacket(String.Format("Did you mean {0}?", capCommand), new CPlayerSubset(CPlayerSubset.PlayerSubsetType.Player, playerName)); } else { InvokeOnEnabled(mtcCommand.RegisteredClassname, mtcCommand.RegisteredMethodName, playerName, message, mtcCommand, capCommand, new CPlayerSubset(CPlayerSubset.PlayerSubsetType.All)); InvokeOnAllEnabled("OnAnyMatchRegisteredCommand", playerName, message, mtcCommand, capCommand, new CPlayerSubset(CPlayerSubset.PlayerSubsetType.All)); } }
public ExecutionRequirements(ExecutionScope scope, Privileges privileges, int iMinimumSimilarity, MatchCommand mcConfirmationCommand, string strFailedRequirementsMessage) { this.Initialize(scope, privileges, iMinimumSimilarity, mcConfirmationCommand, strFailedRequirementsMessage); }
public void UnregisterCommand(MatchCommand mtcCommand) { lock (MatchedInGameCommandsLocker) { if (MatchedInGameCommands.ContainsKey(mtcCommand.ToString()) == true) { MatchedInGameCommands.Remove(mtcCommand.ToString()); InvokeOnAllEnabled("OnUnregisteredCommand", mtcCommand); } } }
private void RegisterAllCommands(){ if (this.m_isPluginEnabled == true) { MatchCommand confirmationCommand = new MatchCommand(this.Listify<string>("@", "!", "#"), "yes" , this.Listify<MatchArgumentFormat>()); this.RegisterCommand( new MatchCommand( "TrueBalancer", "OnCommandScrambleNow", this.Listify<string>("@", "!", "#"), "scramblenow", this.Listify<MatchArgumentFormat>(), new ExecutionRequirements( ExecutionScope.Privileges, Privileges.CanMovePlayers, 0, confirmationCommand, "You do not have enough privileges to scramble players"), "Scrambling teams now! Use with caution." ) ); this.RegisterCommand( new MatchCommand ( "TrueBalancer", "OnCommandScrambleRound", this.Listify<string>("@", "!", "#"), "scrambleround", this.Listify<MatchArgumentFormat>(), new ExecutionRequirements( ExecutionScope.Privileges, Privileges.CanMovePlayers, 0, confirmationCommand, "You do not have enough privileges to scramble players"), "Scrambling teams next round!" ) ); this.RegisterCommand( new MatchCommand( "TrueBalancer", "OnCommandTBMove", this.Listify<string>("@", "!", "#"), "tb-move", this.Listify<MatchArgumentFormat>( new MatchArgumentFormat( "playername", GetSoldierNames() ) ), new ExecutionRequirements( ExecutionScope.Privileges, Privileges.CanMovePlayers, 2, confirmationCommand, "You do not have enough privileges to move players"), "Moves the player to the other team on death!" ) ); this.RegisterCommand( new MatchCommand( "TrueBalancer", "OnCommandTBForceMove", this.Listify<string>("@", "!", "#"), "tb-fmove", this.Listify<MatchArgumentFormat>( new MatchArgumentFormat( "playername", GetSoldierNames() ) ), new ExecutionRequirements( ExecutionScope.Privileges, Privileges.CanMovePlayers, 2, confirmationCommand, "You do not have enough privileges to move players"), "Kills a player and moves the player to the other team." ) ); } }
public void OnCommandScrambleNow(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope){ bool blIsAdmin = false; CPrivileges cpAccount = this.GetAccountPrivileges(strSpeaker); if (cpAccount != null && cpAccount.PrivilegesFlags > 0) { blIsAdmin = true; } if(blIsAdmin){ this.DebugInfoSkill("^1Admin requested a scramble now!"); this.TSLevelStartWait = DateTime.Now - this.DTLevelStart; if (this.boolLevelStart && this.boolFirstOP){ if (this.ynbEnableScrambleNow == enumBoolYesNo.Yes){ if (!this.boolscrambleActive){ if (this.ynbScrambleMessage == enumBoolYesNo.Yes){ if (this.strScrambleNowMsg != ""){ if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL:^n say all - " + this.strScrambleNowMsg); } else { this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleNowMsg , "all"); } if (this.ynbYellScrambleManuall == enumBoolYesNo.Yes && !this.boolVirtual){ this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleNowMsg , "30"); } } } int i = 1; this.dicPlayerScore.Clear(); this.dicSquadScore.Clear(); this.bestSquadTeamID = 0; foreach (KeyValuePair<string, CPlayerJoinInf> kvp in this.dicPlayerCache) { double value = this.dicPlayerCache[kvp.Key].playerValue; string tag = this.dicPlayerCache[kvp.Key].tag; CPlayerScoreInf newEntry = new CPlayerScoreInf(kvp.Key, this.dicPlayerCache[kvp.Key].teamID, this.dicPlayerCache[kvp.Key].playerSquad, value, false, false, tag); this.dicPlayerScore.Add(i, newEntry); i++; } bool Sortiert; do{ Sortiert = true; for (int j = 1; j < this.dicPlayerScore.Count; j++) { if (this.dicPlayerScore[j].playerValue < this.dicPlayerScore[j+1].playerValue){ CPlayerScoreInf temp = new CPlayerScoreInf(this.dicPlayerScore[j].playerName, this.dicPlayerScore[j].teamID, this.dicPlayerScore[j].playerSquad, this.dicPlayerScore[j].playerValue, false, false, this.dicPlayerScore[j].tag); this.dicPlayerScore[j] = this.dicPlayerScore[j+1]; this.dicPlayerScore[j+1] = temp; Sortiert = false; } } } while (!Sortiert); this.boolFirstOP = false; this.boolwaitfordeath = false; this.boolscrambleActive = true; this.boolTeamsScrambled = false; this.intScrambledPlayers = 0; this.teamswitcher.Clear(); this.ExecuteCommand("procon.protected.tasks.add", "WaitScrambleTimer", "3", "1", "1", "procon.protected.plugins.call", "TrueBalancer", "StartScrambler"); //StartScrambler(); }else{ this.DebugInfoSkill("^3A scrambing has allready been requested."); if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.say player " + strSpeaker + " - " + "A scrambing has allready been requested."); } { this.ExecuteCommand("procon.protected.send", "admin.say", "A scrambing has allready been requested." , "player", strSpeaker); } } }else{ this.DebugInfoSkill("^3This command is deactivated at the moment. Activate in in PRoCon."); if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.say player " + strSpeaker + " - " + "This command is not activated for your server in PRoCon."); } else { this.ExecuteCommand("procon.protected.send", "admin.say", "This command is not activated for your server in PRoCon." , "player", strSpeaker); } } } } }
public AdKats() { this.isEnabled = false; this.threadsReady = false; this.AdKatsAvailableIndicator = new MatchCommand("AdKats", "NoCallableMethod", new List<string>(), "AdKats_NoCallableMethod", new List<MatchArgumentFormat>(), new ExecutionRequirements(ExecutionScope.None), "Useable by other plugins to determine whether this one is installed and enabled."); debugLevel = 0; this.externalCommandAccessKey = AdKats.GetRandom32BitHashCode(); preMessageList.Add("US TEAM: DO NOT BASERAPE, YOU WILL BE PUNISHED."); preMessageList.Add("RU TEAM: DO NOT BASERAPE, YOU WILL BE PUNISHED."); preMessageList.Add("US TEAM: DO NOT ENTER THE STREETS BEYOND 'A', YOU WILL BE PUNISHED."); preMessageList.Add("RU TEAM: DO NOT GO BEYOND THE BLACK LINE ON CEILING BY 'C' FLAG, YOU WILL BE PUNISHED."); preMessageList.Add("THIS SERVER IS NO EXPLOSIVES, YOU WILL BE PUNISHED FOR INFRACTIONS."); preMessageList.Add("JOIN OUR TEAMSPEAK AT TS.ADKGAMERS.COM:3796"); //Create command and logging dictionaries this.AdKat_CommandStrings = new Dictionary<string, AdKat_CommandType>(); this.AdKat_LoggingSettings = new Dictionary<AdKat_CommandType, Boolean>(); //Fill command and logging dictionaries by calling rebind this.rebindAllCommands(); //Create database dictionaries this.AdKat_RecordTypes = new Dictionary<AdKat_CommandType, string>(); this.AdKat_RecordTypesInv = new Dictionary<string, AdKat_CommandType>(); this.AdKat_CommandAccessRank = new Dictionary<AdKat_CommandType, int>(); //Fill DB record types for outgoing database commands this.AdKat_RecordTypes.Add(AdKat_CommandType.MovePlayer, "Move"); this.AdKat_RecordTypes.Add(AdKat_CommandType.ForceMovePlayer, "ForceMove"); this.AdKat_RecordTypes.Add(AdKat_CommandType.Teamswap, "Teamswap"); this.AdKat_RecordTypes.Add(AdKat_CommandType.KillPlayer, "Kill"); this.AdKat_RecordTypes.Add(AdKat_CommandType.KickPlayer, "Kick"); this.AdKat_RecordTypes.Add(AdKat_CommandType.TempBanPlayer, "TempBan"); this.AdKat_RecordTypes.Add(AdKat_CommandType.PermabanPlayer, "PermaBan"); this.AdKat_RecordTypes.Add(AdKat_CommandType.PunishPlayer, "Punish"); this.AdKat_RecordTypes.Add(AdKat_CommandType.ForgivePlayer, "Forgive"); this.AdKat_RecordTypes.Add(AdKat_CommandType.MutePlayer, "Mute"); this.AdKat_RecordTypes.Add(AdKat_CommandType.RoundWhitelistPlayer, "RoundWhitelist"); this.AdKat_RecordTypes.Add(AdKat_CommandType.ReportPlayer, "Report"); this.AdKat_RecordTypes.Add(AdKat_CommandType.CallAdmin, "CallAdmin"); this.AdKat_RecordTypes.Add(AdKat_CommandType.ConfirmReport, "ConfirmReport"); this.AdKat_RecordTypes.Add(AdKat_CommandType.AdminSay, "AdminSay"); this.AdKat_RecordTypes.Add(AdKat_CommandType.PlayerSay, "PlayerSay"); this.AdKat_RecordTypes.Add(AdKat_CommandType.AdminYell, "AdminYell"); this.AdKat_RecordTypes.Add(AdKat_CommandType.PlayerYell, "PlayerYell"); this.AdKat_RecordTypes.Add(AdKat_CommandType.RestartLevel, "RestartLevel"); this.AdKat_RecordTypes.Add(AdKat_CommandType.NextLevel, "NextLevel"); this.AdKat_RecordTypes.Add(AdKat_CommandType.EndLevel, "EndLevel"); this.AdKat_RecordTypes.Add(AdKat_CommandType.NukeServer, "Nuke"); this.AdKat_RecordTypes.Add(AdKat_CommandType.KickAll, "KickAll"); this.AdKat_RecordTypes.Add(AdKat_CommandType.EnforceBan, "EnforceBan"); //Fill DB Inverse record types for incoming database commands this.AdKat_RecordTypesInv.Add("Move", AdKat_CommandType.MovePlayer); this.AdKat_RecordTypesInv.Add("ForceMove", AdKat_CommandType.ForceMovePlayer); this.AdKat_RecordTypesInv.Add("Teamswap", AdKat_CommandType.Teamswap); this.AdKat_RecordTypesInv.Add("Kill", AdKat_CommandType.KillPlayer); this.AdKat_RecordTypesInv.Add("Kick", AdKat_CommandType.KickPlayer); this.AdKat_RecordTypesInv.Add("TempBan", AdKat_CommandType.TempBanPlayer); this.AdKat_RecordTypesInv.Add("PermaBan", AdKat_CommandType.PermabanPlayer); this.AdKat_RecordTypesInv.Add("Punish", AdKat_CommandType.PunishPlayer); this.AdKat_RecordTypesInv.Add("Forgive", AdKat_CommandType.ForgivePlayer); this.AdKat_RecordTypesInv.Add("Mute", AdKat_CommandType.MutePlayer); this.AdKat_RecordTypesInv.Add("RoundWhitelist", AdKat_CommandType.RoundWhitelistPlayer); this.AdKat_RecordTypesInv.Add("Report", AdKat_CommandType.ReportPlayer); this.AdKat_RecordTypesInv.Add("CallAdmin", AdKat_CommandType.CallAdmin); this.AdKat_RecordTypesInv.Add("ConfirmReport", AdKat_CommandType.ConfirmReport); this.AdKat_RecordTypesInv.Add("AdminSay", AdKat_CommandType.AdminSay); this.AdKat_RecordTypesInv.Add("PlayerSay", AdKat_CommandType.PlayerSay); this.AdKat_RecordTypesInv.Add("AdminYell", AdKat_CommandType.AdminYell); this.AdKat_RecordTypesInv.Add("PlayerYell", AdKat_CommandType.PlayerYell); this.AdKat_RecordTypesInv.Add("RestartLevel", AdKat_CommandType.RestartLevel); this.AdKat_RecordTypesInv.Add("NextLevel", AdKat_CommandType.NextLevel); this.AdKat_RecordTypesInv.Add("EndLevel", AdKat_CommandType.EndLevel); this.AdKat_RecordTypesInv.Add("Nuke", AdKat_CommandType.NukeServer); this.AdKat_RecordTypesInv.Add("KickAll", AdKat_CommandType.KickAll); this.AdKat_RecordTypesInv.Add("EnforceBan", AdKat_CommandType.EnforceBan); //Fill all command access ranks this.AdKat_CommandAccessRank.Add(AdKat_CommandType.RestartLevel, 0); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.NextLevel, 0); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.EndLevel, 0); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.NukeServer, 0); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.KickAll, 0); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.PermabanPlayer, 1); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.TempBanPlayer, 2); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.RoundWhitelistPlayer, 2); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.KillPlayer, 3); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.KickPlayer, 3); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.PunishPlayer, 3); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.ForgivePlayer, 3); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.MutePlayer, 3); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.MovePlayer, 4); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.ForceMovePlayer, 4); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.AdminSay, 4); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.AdminYell, 4); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.PlayerSay, 4); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.PlayerYell, 4); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.WhatIs, 4); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.Teamswap, 5); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.ReportPlayer, 6); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.CallAdmin, 6); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.ConfirmReport, 6); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.ConfirmCommand, 6); this.AdKat_CommandAccessRank.Add(AdKat_CommandType.CancelCommand, 6); this.AdKat_LoggingSettings.Add(AdKat_CommandType.AdminSay, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.AdminYell, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.CallAdmin, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.CancelCommand, false); this.AdKat_LoggingSettings.Add(AdKat_CommandType.ConfirmCommand, false); this.AdKat_LoggingSettings.Add(AdKat_CommandType.ConfirmReport, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.Default, false); this.AdKat_LoggingSettings.Add(AdKat_CommandType.EndLevel, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.EnforceBan, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.ForceMovePlayer, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.ForgivePlayer, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.KickAll, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.KickPlayer, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.KillPlayer, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.MovePlayer, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.MutePlayer, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.NextLevel, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.NukeServer, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.PermabanPlayer, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.PlayerSay, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.PlayerYell, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.PunishPlayer, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.ReportPlayer, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.RestartLevel, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.RoundWhitelistPlayer, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.Teamswap, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.TempBanPlayer, true); this.AdKat_LoggingSettings.Add(AdKat_CommandType.WhatIs, false); //Initialize the threads //TODO find if necessary //this.InitThreads(); }
public void OnCommandTBMove(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { string player = capCommand.MatchedArguments[0].Argument; this.DebugInfoGuard("^4Move Player when dead: ^b" + player); this.ExecuteCommand("procon.protected.send", "admin.say", "You will be moved to the other team upon death.", "player", player); if (this.OnCommandMoveDone.Contains(player)) { this.OnCommandMoveDone.Remove(player); } if (this.OnCommandMove.ContainsKey(player) == false) { this.OnCommandMove.Add(player, false); } else { this.OnCommandMove[player] = false; } }