コード例 #1
0
ファイル: ConfirmationEntry.cs プロジェクト: EBassie/Procon-1
 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;
 }
コード例 #2
0
 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);
         }
     }
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
        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);

        }
コード例 #5
0
        // Funktion zum Testcommand
        public void OnCommand_Cancel(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
        {
            WritePluginConsole("^1^b[OnCommand_Cancel]^0^n Speaker was: "+strSpeaker+" text was: "+strText , "Info", 10);
            if (IsSwitchDefined())
            {
            this.ExecuteCommand("procon.protected.tasks.remove", "Switch");

            next_serverMode = serverMode;
            SendPlayerMessage(strSpeaker, "Canceled current activity....");
            }
            else
            {
            SendPlayerMessage(strSpeaker, "There is nothing to cancel");
            }
        }
コード例 #6
0
 public void OnCommandSetAdminMode(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
 {
     this.ExecuteCommand("procon.protected.send", "vars.textChatModerationMode", "muted");
     this.ExecuteCommand("procon.protected.send", "admin.say", "Admin only chat mode has been activated", "all");
 }
コード例 #7
0
 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");
     }
 }
コード例 #8
0
 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);
         }
     }
 }
コード例 #9
0
 //
 // IPRoConPluginInterface3
 //
 public void OnAnyMatchRegisteredCommand(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
 {
 }
コード例 #10
0
        public void OnCommandRules(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
        {
            string taskName;
            int    iLineAdjust = 0; if (this.m_enIgnoreFirstLine == enumBoolYesNo.Yes)
            {
                iLineAdjust = 1;
            }
            int         iRuleNr   = 0;
            int         iTmp      = 0;
            int         iDelay    = this.m_iDelayBeforeSendingRules;
            bool        blIsAdmin = false;
            CPrivileges cpAccount = this.GetAccountPrivileges(strSpeaker);

            this.WritePluginConsole(strSpeaker + " requested the rules. Checking privileges...", 1);

            // 8328 => has account with no privileges in procon
            if (cpAccount != null && cpAccount.PrivilegesFlags >= this.m_iMinPrivilegesValue)
            {
                blIsAdmin = true;
            }
            this.WritePluginConsole(strSpeaker + " (isAdmin: " + blIsAdmin.ToString() + " - " + (cpAccount != null ? cpAccount.PrivilegesFlags.ToString() : "notExistentAccount") + ") checked...", 1);

            this.WritePluginConsole("... checking for dedicated rule request ...", 1);
            if (capCommand.ExtraArguments.Length != 0)
            {
                this.WritePluginConsole(String.Format("... checking additinal parameter ( {0} ) ...", capCommand.ExtraArguments), 1);
                if (int.TryParse(capCommand.ExtraArguments, out iTmp) == true && iTmp <= this.m_aServerRules.Length - iLineAdjust && iTmp > 0)
                {
                    iRuleNr = int.Parse(capCommand.ExtraArguments);
                    this.WritePluginConsole("... rule number " + iRuleNr.ToString() + " was requested.", 1);
                }
                else
                {
                    this.WritePluginConsole("... could not be parsed / not available...", 1);
                }
            }

            if (blIsAdmin == true && string.Compare(capCommand.ResposeScope, this.m_strPublicPrefix, true) == 0)
            {
                // Admin wants rules to be send to all
                this.SendSayResponse(this.m_strPrivatePrefix, strSpeaker, "At your service. Sending rules to everyone.");
                this.WriteEventTab("reguested the rules to be shown public.", strSpeaker, 2);

                if (iRuleNr == 0)
                {
                    // all rules
                    foreach (string rule in this.m_aServerRules)
                    {
                        taskName = string.Format("ServerRulesOnRequest-{0}", strSpeaker);
                        if (this.m_enYellResponsesRules == enumBoolYesNo.Yes)
                        {
                            this.ExecuteCommand("procon.protected.tasks.add", "CServerRulesOnRequest", iDelay.ToString(), "1", "1", "procon.protected.send", "admin.yell", rule, (this.m_iRuleDisplayTime / this.m_iTimeDivider).ToString(), "all");
                            iDelay += (this.m_iRuleDisplayTime / 1000) + this.m_iDelayBetweenRules;
                        }
                        else
                        {
                            this.ExecuteCommand("procon.protected.tasks.add", "CServerRulesOnRequest", iDelay.ToString(), "1", "1", "procon.protected.send", "admin.say", rule, "all");
                            iDelay += this.m_iDelayBetweenRules;
                        }
                    }
                }
                else
                {
                    // dedicated rule requested
                    string rule = this.m_aServerRules[iRuleNr - 1 + iLineAdjust];
                    taskName = string.Format("ServerRulesOnRequest-{0}", strSpeaker);
                    if (this.m_enYellResponsesRules == enumBoolYesNo.Yes)
                    {
                        this.ExecuteCommand("procon.protected.tasks.add", "CServerRulesOnRequest", iDelay.ToString(), "1", "1", "procon.protected.send", "admin.yell", rule, (this.m_iRuleDisplayTime / this.m_iTimeDivider).ToString(), "all");
                        iDelay += (this.m_iRuleDisplayTime / 1000) + this.m_iDelayBetweenRules;
                    }
                    else
                    {
                        this.ExecuteCommand("procon.protected.tasks.add", "CServerRulesOnRequest", iDelay.ToString(), "1", "1", "procon.protected.send", "admin.say", rule, "all");
                        iDelay += this.m_iDelayBetweenRules;
                    }
                }
            }
            else
            {
                // player is no admin or admin will see rules privately
                this.WriteEventTab(String.Format("{0} reguested the rules shown to himself", strSpeaker), blIsAdmin == true ? strSpeaker : String.Empty, 2);

                if (iRuleNr == 0)
                {
                    // all rules
                    foreach (string rule in this.m_aServerRules)
                    {
                        taskName = string.Format("ServerRulesOnRequest-{0}", strSpeaker);
                        if (this.m_enYellResponsesRules == enumBoolYesNo.Yes)
                        {
                            this.ExecuteCommand("procon.protected.tasks.add", "CServerRulesOnRequest", iDelay.ToString(), "1", "1", "procon.protected.send", "admin.yell", rule, (this.m_iRuleDisplayTime / this.m_iTimeDivider).ToString(), "player", strSpeaker);
                            iDelay += (this.m_iRuleDisplayTime / 1000) + this.m_iDelayBetweenRules;
                        }
                        else
                        {
                            this.ExecuteCommand("procon.protected.tasks.add", "CServerRulesOnRequest", iDelay.ToString(), "1", "1", "procon.protected.send", "admin.say", rule, "player", strSpeaker);
                            iDelay += this.m_iDelayBetweenRules;;
                        }
                    } // end foreach
                }
                else
                {
                    // dedicated rule requested
                    string rule = this.m_aServerRules[iRuleNr - 1 + iLineAdjust];
                    taskName = string.Format("ServerRulesOnRequest-{0}", strSpeaker);
                    if (this.m_enYellResponsesRules == enumBoolYesNo.Yes)
                    {
                        this.ExecuteCommand("procon.protected.tasks.add", "CServerRulesOnRequest", iDelay.ToString(), "1", "1", "procon.protected.send", "admin.yell", rule, (this.m_iRuleDisplayTime / this.m_iTimeDivider).ToString(), "all");
                        iDelay += (this.m_iRuleDisplayTime / 1000) + this.m_iDelayBetweenRules;
                    }
                    else
                    {
                        this.ExecuteCommand("procon.protected.tasks.add", "CServerRulesOnRequest", iDelay.ToString(), "1", "1", "procon.protected.send", "admin.say", rule, "all");
                        iDelay += this.m_iDelayBetweenRules;;
                    }
                }
            }
        }
コード例 #11
0
        public void OnCommand_Switchnow(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
        {
            WritePluginConsole("OnCommand_Switchnow()", "DEBUG", 6);
            WritePluginConsole("OnCommand_Switchnow() strSpeaker='" + strSpeaker + "' strText='" + strText + "'", "DEBUG", 8);
            lastcmdspeaker = strSpeaker;
            if (IsSwitchDefined())
            {
            if (SwitchInitiator == strSpeaker) StartSwitchCountdown();
            if (SwitchInitiator != strSpeaker) SendPlayerMessage(strSpeaker, R(msg_notInitiator));
            return;
            }

            if (!IsSwitchDefined()) SendPlayerMessage(strSpeaker, R(msg_switchnotdefined));
            return;
        }
コード例 #12
0
 public void OnCommand_Shotgun(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
 {
     WritePluginConsole("OnCommand_Shotgun()", "DEBUG", 6);
     WritePluginConsole("OnCommand_shotgun() strSpeaker='" + strSpeaker + "' strText='" + strText + "'", "DEBUG", 8);
     SwitchInitiator = strSpeaker;
     lastcmdspeaker = strSpeaker;
     CancelSwitch();
     PreSwitchServerMode("shotgun");
     return;
 }
コード例 #13
0
 public void OnCommand_Rules(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
 {
     WritePluginConsole("OnCommand_Rules()", "DEBUG", 6);
     WritePluginConsole("OnCommand_Rules() strSpeaker='" + strSpeaker + "' strText='" + strText + "'" , "DEBUG", 8);
     WritePluginConsole(strSpeaker + " requested the Rules", "INFO", 2);
     ShowRules(strSpeaker);
     return;
 }
コード例 #14
0
 public void OnCommand_Kickall(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
 {
     WritePluginConsole("OnCommand_KickAll()", "DEBUG", 6);
     WritePluginConsole("OnCommand_KickAll() strSpeaker='" + strSpeaker + "' strText='" + strText + "'", "DEBUG", 8);
     lastcmdspeaker = strSpeaker;
     KickAll();
 }
コード例 #15
0
        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);
            }
        }
コード例 #16
0
 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);
 }
コード例 #17
0
 public override void OnAnyMatchRegisteredCommand(string speaker, string text, MatchCommand matchedCommand, CapturedCommand capturedCommand, CPlayerSubset matchedScope)
 {
     Output.TraceInformation("OnAnyMatchRegisteredCommand {0} {1} {2} {3} {4}", speaker, text, matchedCommand.Command, capturedCommand.Command, matchedScope.SoldierName);
 }
コード例 #18
0
ファイル: PRoConPluginAPI.cs プロジェクト: Tratos/Procon-1
 /// <summary>
 /// Fires when any registered command has been matched against a players text in game.
 /// This method is called regardless of it being registered to your classname.
 /// Called *after* a confirmation.  If this method is called you can assume the
 /// speaker has met the required privliege and has confirmed the command as correct.
 /// </summary>
 /// <param name="speaker">The player that issued the command</param>
 /// <param name="strText">The text that was matched to the MatchCommand object</param>
 /// <param name="mtcCommand">The registered command object</param>
 /// <param name="capCommand">The captured command details</param>
 /// <param name="subMatchedScope">The scope the message was sent by the player (squad chat, team chat etc)</param>
 /// Note: This method was not included, instead you delegate a method when creating a MatchCommand object.
 public virtual void OnAnyMatchRegisteredCommand(string speaker, string text, MatchCommand matchedCommand, CapturedCommand capturedCommand, CPlayerSubset matchedScope)
 {
 }
コード例 #19
0
ファイル: CInGameAdminEx.cs プロジェクト: wsdd2/ProconPlugins
        public void OnCommandSwapTeam(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
        {
            ExecuteCommand("procon.protected.events.write", "Plugins", "PluginAction", String.Format("Initiated a swap team"), strSpeaker);

            List <int> teamIds = FrostbitePlayerInfoList.Values.Select(_ => _.TeamID).Distinct().ToList();

            Output.Information("TeamIds:" + string.Join(",", teamIds));
            for (int i = 0; i < FrostbitePlayerInfoList.Count; i++)
            {
                var player     = FrostbitePlayerInfoList.ElementAt(i).Value;
                var name       = player.SoldierName;
                var dstTeamId  = teamIds[((teamIds.IndexOf(player.TeamID) + 1) < teamIds.Count) ? (teamIds.IndexOf(player.TeamID) + 1) : 0];
                var dstSquadId = player.SquadID;
                ExecuteCommand("procon.protected.tasks.add", ClassName + strSpeaker, 10.ToString(), "1", "1", "procon.protected.send", "admin.movePlayer", name, dstTeamId.ToString(), dstSquadId.ToString(), true.ToString());
                Output.Information("{0} {1} {2} {3} {4}", "admin.movePlayer", name, dstTeamId.ToString(), dstSquadId.ToString(), true.ToString());
            }
        }
コード例 #20
0
        public void OnCommandPlayerMute(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
        {
            if (this.m_dicPbInfo.ContainsKey(capCommand.MatchedArguments[0].Argument) == true)
            {
                int myInt;
                this.ExecuteCommand("procon.protected.send", "textChatModerationList.addPlayer", "muted", this.m_dicPbInfo[capCommand.MatchedArguments[0].Argument].SoldierName);

                if (capCommand.ExtraArguments.Length > 0)
                {
                    try
                    {
                        myInt = Int32.Parse(capCommand.ExtraArguments);

                        this.ExecuteCommand("procon.protected.send", "admin.say", this.m_dicPbInfo[capCommand.MatchedArguments[0].Argument].SoldierName + " now is muted for " + myInt.ToString() + " minutes", "player", strSpeaker);
                        this.ExecuteCommand("procon.protected.send", "admin.say", "You have been muted for " + myInt.ToString() + " minutes", "player", this.m_dicPbInfo[capCommand.MatchedArguments[0].Argument].SoldierName);

                        myInt = myInt * 60;
                        this.ExecuteCommand("procon.protected.tasks.add", "CPlayerMuterUnMute", myInt.ToString(), "1", "1", "procon.protected.plugins.call", "CPlayerMuter", "RemoveMute", this.m_dicPbInfo[capCommand.MatchedArguments[0].Argument].SoldierName);
                    }
                    catch
                    {
                        this.ExecuteCommand("procon.protected.send", "admin.say", "Invalid mute time, player not muted", "player", strSpeaker);
                    }
                }
                else
                {
                    this.ExecuteCommand("procon.protected.send", "admin.say", this.m_dicPbInfo[capCommand.MatchedArguments[0].Argument].SoldierName + " has been muted.", "player", strSpeaker);
                    this.ExecuteCommand("procon.protected.send", "admin.say", "You have been muted", "player", this.m_dicPbInfo[capCommand.MatchedArguments[0].Argument].SoldierName);
                    if (this.m_removeMuteAfter.CompareTo("Time limit") == 0)
                    {
                        this.ExecuteCommand("procon.protected.tasks.add", "CPlayerMuterUnMute", this.m_strMuteTime.ToString(), "1", "1", "procon.protected.plugins.call", "CPlayerMuter", "RemoveMute", this.m_dicPbInfo[capCommand.MatchedArguments[0].Argument].SoldierName);
                    }
                    else
                    {
                        this.m_dicPlayerMutes.Add(this.m_dicPbInfo[capCommand.MatchedArguments[0].Argument].SoldierName, this.m_removeMuteAfter);
                    }
                }

                this.ExecuteCommand("procon.protected.send", "textChatModerationList.save");
            }
            else
            {
                this.ExecuteCommand("procon.protected.send", "admin.say", "Player not found", "player", strSpeaker);
            }
        }
コード例 #21
0
ファイル: CTrueBalancerBF3.cs プロジェクト: ratdart/Procon-1
        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);

        }
コード例 #22
0
ファイル: PluginManager.cs プロジェクト: phelom/Procon-1
        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));
            }
        }
コード例 #23
0
ファイル: CTrueBalancerBF3.cs プロジェクト: ratdart/Procon-1
        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;
            }
        }
コード例 #24
0
 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);
             }
         }
     }           
 }
コード例 #25
0
 //
 // IPRoConPluginInterface3
 //
 public void OnAnyMatchRegisteredCommand(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) {
     
 }
コード例 #26
0
        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;
            }
        }
コード例 #27
0
        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);
            }
        }
コード例 #28
0
 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);
 }
コード例 #29
0
 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);
 }
コード例 #30
0
 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);
         }
     }
 }
コード例 #31
0
 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);
         }
     }
 }
コード例 #32
0
        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);
                    }
                }
            }
        }
コード例 #33
0
 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);
         }
     }
 }
コード例 #34
0
 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);
     }
 }
コード例 #35
0
        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);
            }
        }
コード例 #36
0
ファイル: MatchCommand.cs プロジェクト: eaceaser/PRoCon
        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;
        }
コード例 #37
0
        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);
                    }
                }
            }
        }
コード例 #38
0
        public void OnCommandPingPlayer(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
        {
            if (this.dicPingPlayer.ContainsKey(capCommand.MatchedArguments[0].Argument))
            {
                if (!this.dicPingPlayer[capCommand.MatchedArguments[0].Argument].PingFails)
                {
                    PingReply reply = this.PingPlayer(this.dicPingPlayer[capCommand.MatchedArguments[0].Argument].Name);
                    if (this.dicPingPlayer[capCommand.MatchedArguments[0].Argument].Results.Count > this.iPingStorageLength)
                    {
                        this.dicPingPlayer[capCommand.MatchedArguments[0].Argument].Results.Clear();
                    }
                    this.dicPingPlayer[capCommand.MatchedArguments[0].Argument].Results.Add(reply);
                    if (reply.Status != IPStatus.Success)
                    {
                        this.dicPingPlayer[capCommand.MatchedArguments[0].Argument].PingFails = true;
                    }

                    if (!this.dicPingPlayer[capCommand.MatchedArguments[0].Argument].PingFails)
                    {
                        lock (this.dicPlayerInfo)
                        {
                            this.IngameSaySquad(strSpeaker + ": '" + capCommand.MatchedArguments[0].Argument + "'s Ping is " + reply.RoundtripTime + "ms.", this.dicPlayerInfo[strSpeaker].TeamID, this.dicPlayerInfo[strSpeaker].SquadID);
                        }
                    }
                    else
                    {
                        lock (this.dicPlayerInfo)
                        {
                            this.IngameSaySquad(strSpeaker + ": Pinging '" + capCommand.MatchedArguments[0].Argument + "' fails!", this.dicPlayerInfo[strSpeaker].TeamID, this.dicPlayerInfo[strSpeaker].SquadID);
                        }
                    }
                }
                else
                {
                    lock (this.dicPlayerInfo)
                    {
                        this.IngameSaySquad(strSpeaker + ": Pinging '" + capCommand.MatchedArguments[0].Argument + "' fails!", this.dicPlayerInfo[strSpeaker].TeamID, this.dicPlayerInfo[strSpeaker].SquadID);
                    }
                }
            }
            else
            {
                if (this.lstWhiteList.Contains(capCommand.MatchedArguments[0].Argument))
                {
                    lock (this.dicPlayerInfo)
                    {
                        this.IngameSaySquad(strSpeaker + ": '" + capCommand.MatchedArguments[0].Argument + "' is on the whitelist and thus not monitored!", this.dicPlayerInfo[strSpeaker].TeamID, this.dicPlayerInfo[strSpeaker].SquadID);
                    }
                }
                else
                {
                    lock (this.dicPlayerInfo)
                    {
                        this.IngameSaySquad(strSpeaker + ": '" + capCommand.MatchedArguments[0].Argument + "'s information is not contained in the dictionary...", this.dicPlayerInfo[strSpeaker].TeamID, this.dicPlayerInfo[strSpeaker].SquadID);
                    }
                }
            }
        }
コード例 #39
0
 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);
 }
コード例 #40
0
 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;
 }
コード例 #41
0
 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);
     }
 }
コード例 #42
0
 public void OnCommandPlayerAdmin(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
 {
     if (this.m_dicPbInfo.ContainsKey(capCommand.MatchedArguments[0].Argument) == true)
     {
         this.ExecuteCommand("procon.protected.send", "textChatModerationList.addPlayer", "admin", this.m_dicPbInfo[capCommand.MatchedArguments[0].Argument].SoldierName);
         this.ExecuteCommand("procon.protected.send", "admin.say", this.m_dicPbInfo[capCommand.MatchedArguments[0].Argument].SoldierName + " now has admin chat privileges.", "player", strSpeaker);
         this.ExecuteCommand("procon.protected.send", "admin.say", "You have been granted admin chat privleges", "player", this.m_dicPbInfo[capCommand.MatchedArguments[0].Argument].SoldierName);
         this.ExecuteCommand("procon.protected.send", "textChatModerationList.save");
     }
     else
     {
         this.ExecuteCommand("procon.protected.send", "admin.say", "Player not found", "player", strSpeaker);
     }
 }
コード例 #43
0
 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);
         }
     }
 }
コード例 #44
0
ファイル: PluginManager.cs プロジェクト: phelom/Procon-1
        /// <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;
        }
コード例 #45
0
        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);
                        }
                    }
                    
                }
            }           
        }
コード例 #46
0
ファイル: PRoConPluginAPI.cs プロジェクト: NSGod/Procon-1
 /// <summary>
 /// Fires when any registered command has been matched against a players text in game.
 /// This method is called regardless of it being registered to your classname.
 /// Called *after* a confirmation.  If this method is called you can assume the 
 /// speaker has met the required privliege and has confirmed the command as correct.
 /// </summary>
 /// <param name="speaker">The player that issued the command</param>
 /// <param name="text">The text that was matched to the MatchCommand object</param>
 /// <param name="matchedCommand">The registered command object</param>
 /// <param name="capturedCommand">The captured command details</param>
 /// <param name="matchedScope">The scope the message was sent by the player (squad chat, team chat etc)</param>
 /// Note: This method was not included, instead you delegate a method when creating a MatchCommand object.
 public virtual void OnAnyMatchRegisteredCommand(string speaker, string text, MatchCommand matchedCommand, CapturedCommand capturedCommand, CPlayerSubset matchedScope) { }
コード例 #47
0
        public void OnAnyChat(string speaker, string message)
        {
            WritePluginConsole("OnAnyChat", "DEBUG", 6);

            if (IsCommand(message) && IsAdmin(speaker))    // Helper Method, becouse i got problems with registered command not be executed
            {
            string tmpCommand = ExtractCommand(message);
            MatchCommand emptyCommand = new MatchCommand(new List<string>(), "", new List<MatchArgumentFormat>());
            CapturedCommand emptyCapturedCommand = new CapturedCommand("", "", new List<MatchArgument>(), "");
            CPlayerSubset emptyCPlayerSubset = new CPlayerSubset(new List<string>());

            if (tmpCommand == cmd_KickAll) OnCommand_Kickall(speaker, message, emptyCommand, emptyCapturedCommand, emptyCPlayerSubset);
            if (tmpCommand == cmd_cancel) OnCommand_Cancel(speaker, message, emptyCommand, emptyCapturedCommand, emptyCPlayerSubset);

            }
        }