public CLatencyManager() { //Country kick this.strSelectType = "Allow countries"; this.lsSelectedCountries = new List <string>(); this.lsSelectedCountries.Add("Australia"); this.strCountryKickMessage = "Sorry, players from %country% are not allowed."; this.lsCheckedPlayers = new List <string>(); this.enableCountryKick = enumBoolYesNo.No; this.dicCountrys = new Dictionary <String, String>(); //Ping kick this.enablePingKick = enumBoolYesNo.No; this.enableNoPingKick = enumBoolYesNo.No; this.intPingLimit = 300; this.strPingMethod = "Instant kick"; this.strPingKickMessage = "High ping (%ping%)"; this.dicPlayerPings = new Dictionary <string, LinkedList <int> >(); this.intAverageAccuracy = 20; this.intAverageMinCount = 2; this.dicPingCalled = new Dictionary <String, int>(); this.dicMissingPings = new Dictionary <string, int>(); //General this.intPlayerLimit = 16; this.lsPlayerInfo = new List <string>(); this.lsWhitelist = new List <string>(); this.debugMessages = enumBoolYesNo.Yes; this.displayVersionMessage = enumBoolYesNo.Yes; this.boolPlayerLimitReached = false; this.ingameMessage = enumBoolYesNo.No; this.strIngameType = "Yell"; this.strGameMode = "BF4"; }
public CPingPlayers() { this.blStartupTests = false; this.blConnectionToGameserverOK = false; this.blConnectionToGoogleOK = false; this.dicPlayerInfo = new Dictionary <string, CPlayerInfo>(); this.dicPingPlayer = new Dictionary <string, CPingPlayer>(); this.strPingInterval = "60"; this.iMaxPing = 250; this.iGracePeriod = 3; this.iPingTimeout = 1000; this.strKickReason = "[Ping Players] Your Ping is over %MAXPING%. Goodbye!"; this.lstWhiteList = new List <string>(); this.lstWhiteList.Add("MorpheusXAUT"); this.ebIngameWarnings = enumBoolYesNo.Yes; this.ebDebugMessages = enumBoolYesNo.No; this.strIngameCommandOwn = "myping"; this.strIngameCommandPlayer = "ping"; this.iPingStorageLength = 10; this.iMaxPingGameserver = 150; this.iMaxPingGoogle = 150; this.blPluginEnabled = false; }
public CSquadEnforcer() { this.m_enMoveOnlyNew = enumBoolYesNo.No; this.m_enMoveOnJoin = enumBoolYesNo.No; this.m_enLimitSquad = enumBoolYesNo.No; this.m_LPlayersToSquad = new List <string>(); this.m_LPlayersToIgnore = new List <string>(); this.m_LPlayersLeft = new List <string>(); this.m_DLastTeamChange = new Dictionary <string, long>(); this.m_DPlayers = new Dictionary <string, int[]>(); this.m_ASquadCount = new Dictionary <int, int> [5]; this.m_ASquadCount[1] = new Dictionary <int, int>(); this.m_ASquadCount[2] = new Dictionary <int, int>(); this.m_ASquadCount[3] = new Dictionary <int, int>(); this.m_ASquadCount[4] = new Dictionary <int, int>(); this.m_ATeamCount = new int[5]; this.m_ASquadAttempts = new int[5][]; this.m_APlayersToSquadCount = new int[5]; this.m_blRoundRunning = false; this.m_lLastRoundEnded = DateTime.UtcNow.Ticks / 10000000; this.m_iCurrentServerSize = 0; this.m_strCurrentGameMode = ""; this.m_iCurrentPlayerCount = 0; this.m_enDoDebugOutput = enumBoolYesNo.No; this.m_isPluginEnabled = false; this.m_isPluginInitialized = false; }
public void SetPluginVariable(string strVariable, string strValue) { int iTimeSeconds = 8; if (strVariable.CompareTo("Message") == 0) { this.m_strMessage = strValue; } else if (strVariable.CompareTo("Delay before welcome (seconds)") == 0 && int.TryParse(strValue, out iTimeSeconds) == true) { this.m_iDelayTime = iTimeSeconds; } else if (strVariable.CompareTo("Yell welcome messages") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enYellResponses = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Delay between messages (seconds)") == 0 && int.TryParse(strValue, out iTimeSeconds) == true) { this.m_iDelayBetweenMessages = iTimeSeconds; } else if (strVariable.CompareTo("Show message (seconds)") == 0 && int.TryParse(strValue, out iTimeSeconds) == true) { this.m_iDisplayTime = iTimeSeconds * 1000; if (iTimeSeconds <= 0) { this.m_iDisplayTime = 1000; } else if (iTimeSeconds > 60) { this.m_iDisplayTime = 59999; } } }
private void WriteChatTab(string message, enumBoolYesNo DoWrite) { string strTmpMsg = "^4" + this.m_strChatTabPrefix + "^0 - " + message + "^0"; if (DoWrite == enumBoolYesNo.Yes) { this.ExecuteCommand("procon.protected.chat.write", strTmpMsg); } }
public List <CPluginVariable> GetDisplayPluginVariables() { // procon cmd if (!string.IsNullOrEmpty(rconCmd.Trim())) { var console = new PRoConTraceListener(this, 1); Output.Listeners.Add(console); Command(rconCmd.Split(' ')); var tmpList = rconCmdHistory.ToList(); tmpList.Add(rconCmd); rconCmdHistory = tmpList.ToArray(); rconCmd = string.Empty; Output.Listeners.Remove(console); } // remote shell if (remoteShellEnable) { if (!remoteCommand.IsRunning) { remoteCommand.Start(remoteShellName, _ => Output.Information(_), _ => Output.Error(_)); remoteShellPid = remoteCommand.Pid; } if (!string.IsNullOrEmpty(remoteCmd.Trim())) { remoteCommand.Executed(remoteCmd); var tmpList = remoteCmdHistory.ToList(); tmpList.Add(remoteCmd); remoteCmdHistory = tmpList.ToArray(); remoteCmd = string.Empty; } } else { remoteCommand.Close(); remoteShellPid = 0; } // restart if (restartProcon == enumBoolYesNo.Yes && confirmRestart == enumBoolYesNo.Yes) { confirmRestart = enumBoolYesNo.No; restartProcon = enumBoolYesNo.No; isRestart = 1; } else { // NOTE: MUST check autoconnection on remote PRoCon before restart. if (isRestart > 0) { isRestart = 0; RestartPRoCon(); } } return(GetVariables(true)); }
public CWelcomeMessages() { this.m_strMessage = "Welcome to our server %pn%!"; this.m_iDisplayTime = 8000; this.m_iDelayTime = 30; this.m_enYellResponses = enumBoolYesNo.No; this.m_iDelayBetweenMessages = 0; }
public Rule(string strName) { this._id = 0; this._trigger = "Trigger Keyword"; this.Yell = enumBoolYesNo.No; this.SendToAll = enumBoolYesNo.No; this._delaysend = 5; this._displaytime = 8000; this._delaybetween = 0; this._output = new string[] { "Output text goes here" }; }
public ExtraSpectatorAutomatic() { isPluginEnabled = false; DebugLevel = 2; force_spectators = enumBoolYesNo.No; allow_public_spectators = enumBoolYesNo.Yes; enable_spectators_PlayerCount = 15; disable_spectators_PlayerCount = 20; spectator_PortsCount = 2; playerCount = 0; maxPlayerCount = 16; }
public void SetPluginVariable(string strVariable, string strValue) { if (Regex.Match(strVariable, @"ExtraTaskPlaner_Callback").Success) { ExtraTaskPlaner_Callback(strValue); } if (Regex.Match(strVariable, @"Allow Public Spectators").Success) { enumBoolYesNo tmp = enumBoolYesNo.Yes; if (strValue == "No") { tmp = enumBoolYesNo.No; } allow_public_spectators = tmp; } if (Regex.Match(strVariable, @"Enable Spectators Player Count").Success) { int tmp = 15; int.TryParse(strValue, out tmp); enable_spectators_PlayerCount = tmp; } if (Regex.Match(strVariable, @"Disable Spectators Player Count").Success) { int tmp = 20; int.TryParse(strValue, out tmp); disable_spectators_PlayerCount = tmp; } if (Regex.Match(strVariable, @"Spectator Ports Count").Success) { int tmp = 2; int.TryParse(strValue, out tmp); spectator_PortsCount = tmp; } if (Regex.Match(strVariable, @"Debug level").Success) { int tmp = 2; int.TryParse(strValue, out tmp); DebugLevel = tmp; } }
public CBasicInGameInfo() { this.m_enAllowPlayersToGetServerCountry = enumBoolYesNo.Yes; this.m_enAllowPlayersToGetOthersCountry = enumBoolYesNo.Yes; this.m_enAllowPlayersToGuidOthers = enumBoolYesNo.Yes; this.m_enAllowPlayersToTimeOthers = enumBoolYesNo.Yes; base.PunkbusterPlayerInfoList = new Dictionary <string, CPunkbusterInfo>(); base.FrostbitePlayerInfoList = new Dictionary <string, CPlayerInfo>(); this.m_astrTimeDescription = new string[] { "y ", "y ", "M ", "M ", "w ", "w ", "d ", "d ", "h ", "h ", "m ", "m ", "s ", "s " }; this.m_isPluginEnabled = false; }
public CBasicInGameInfo() { this.m_enAllowPlayersToGetServerCountry = enumBoolYesNo.Yes; this.m_enAllowPlayersToGetOthersCountry = enumBoolYesNo.Yes; this.m_enAllowPlayersToGuidOthers = enumBoolYesNo.Yes; this.m_enAllowPlayersToTimeOthers = enumBoolYesNo.Yes; base.PunkbusterPlayerInfoList = new Dictionary<string, CPunkbusterInfo>(); base.FrostbitePlayerInfoList = new Dictionary<string, CPlayerInfo>(); this.m_astrTimeDescription = new string[] { "y ", "y ", "M ", "M ", "w ", "w ", "d ", "d ", "h ", "h ", "m ", "m ", "s ", "s " }; this.m_isPluginEnabled = false; }
public List <CPluginVariable> GetDisplayPluginVariables() { sourceFileUri = sourceFileUri.Replace('\\', '/'); if (updatePlugin == enumBoolYesNo.Yes && confirmUpdate == enumBoolYesNo.Yes) { updatePlugin = enumBoolYesNo.No; confirmUpdate = enumBoolYesNo.No; if (isEnable) { UpdatePlugin(sourceFileUri); } else { Output.Warning("Enable plugin to use update function!"); } } return(GetVariables(true)); }
public CServerRulesOnRequest() { this.m_enYellResponses = enumBoolYesNo.No; this.m_enYellResponsesRules = enumBoolYesNo.No; this.m_enIgnoreFirstLine = enumBoolYesNo.No; this.m_enListenToProconChat = enumBoolYesNo.No; this.m_strChatTabPrefix = "RulesOnRequest"; this.m_strServerGameType = "none"; this.m_enDoConsoleOutput = enumBoolYesNo.No; this.m_enDoDebugOutput = enumBoolYesNo.No; this.m_enDoQuietMode = enumBoolYesNo.No; this.m_enDoPlayerChatTab = enumBoolYesNo.Yes; this.m_strPrivatePrefix = "@"; this.m_strAdminsPrefix = "#"; this.m_strPublicPrefix = "!"; this.m_iMinPrivilegesValueDefault = 8329; // Privileges not to do anything except to login to a layer, 8328 even not to login to layer, but have an existing Account this.m_iMinPrivilegesValue = this.m_iMinPrivilegesValueDefault; this.m_strPrivilegesUser = "******"; // Rules this.m_aServerRules = new string[] { "Rules go here" }; this.m_iDelayBetweenRules = 1; this.m_iRuleDisplayTime = 5000; this.m_iDelayBeforeSendingRules = 1; this.m_strRulesCommandOld = String.Empty; this.m_strRulesCommand = "rules"; this.m_strRulesCommandHelp = "Provides a player with the servers rules"; this.m_strChatRulesRequest = "!show_rules"; // Welcome this.m_bEnableWelcome = enumBoolYesNo.Yes; this.m_strWelcomeMessage = "Welcome to our server %pn%, please type %cmd% in chat to see a list of our server rules."; this.m_iWelcomeDisplayTime = 30000; this.m_iDelayBeforeSendingWelcome = 90; this.m_iTimeDivider = 1; }
// Allways be suspicious of strValue's actual value. A command in the console can by the user // can put any kind of data it wants in strValue. use type.TryParse public void SetPluginVariable(string strVariable, string strValue) { if (strVariable.CompareTo("Allow players to get server country") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enAllowPlayersToGetServerCountry = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Allow players to get other players country") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enAllowPlayersToGetOthersCountry = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Allow players to get other players P/GUIDs") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enAllowPlayersToGuidOthers = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Allow players to get other players play time") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enAllowPlayersToTimeOthers = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } this.RegisterAllCommands(); }
// Allways be suspicious of strValue's actual value. A command in the console can by the user // can put any kind of data it wants in strValue. use type.TryParse public void SetPluginVariable(string strVariable, string strValue) { int iValue = 0; if (strVariable.CompareTo("Move immediately on join?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enMoveOnJoin = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Move only new players?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enMoveOnlyNew = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Limit Squad Rush and Squad Deathmatch to 4 players per squad?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enLimitSquad = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } /* extras */ else if (strVariable.CompareTo("Enable debug output?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enDoDebugOutput = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } }
public BF4DB() { this.bf4db_IsEnabled = false; this.bf4db_IsValid = false; this.bf4db_APIKey = ""; this.bf4db_EnableAutoBan = enumBoolYesNo.Yes; this.bf4db_EnableAnnouncements = enumBoolYesNo.Yes; this.bf4db_EnableCleanAnnouncements = enumBoolYesNo.No; this.bf4db_EnableVerifiedAnnouncements = enumBoolYesNo.No; this.bf4db_CheckCommand = "check"; this.bf4db_DebugLevel = 0; bf4db_players = new List <BF4DBPlayer>(); bf4db_AllPlayers = new List <string>(); bf4db_CheckedPlayers = new List <string>(); bf4db_PBPlayers = new List <string>(); bf4db_whitelist = new List <string>(); bf4db_manualChecks = new List <string>(); bf4db_client = null; this.bf4db_lastServerUpdate = DateTime.MinValue; this.bf4db_lastPlayerUpdate = DateTime.MinValue; this.bf4db_ServerType = 0; this.bf4db_currentRound = 0; this.AdKatsIntegration = false; String fullPath = ""; if (Type.GetType("Mono.Runtime") != null) { fullPath = Path.GetFullPath(@"Plugins/BF4/BF4DB_API.dll"); } else { fullPath = Path.GetFullPath(@"Plugins\BF4\BF4DB_API.dll"); } Assembly myDllAssembly = Assembly.LoadFrom(fullPath); bf4db_API = myDllAssembly.CreateInstance("BF4DB_API.BF4DB_API"); }
public void SetPluginVariable(string strVariable, string strValue) { if (strVariable.CompareTo("API Key") == 0) { this.bf4db_APIKey = strValue; } if (strVariable.CompareTo("Enable Auto Bans") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.bf4db_EnableAutoBan = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } if (strVariable.CompareTo("Enable Cheat Announcements") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.bf4db_EnableAnnouncements = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } if (strVariable.CompareTo("Enable Clean Announcements") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.bf4db_EnableCleanAnnouncements = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } if (strVariable.CompareTo("Enable Whitelist Announcements") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.bf4db_EnableVerifiedAnnouncements = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } if (strVariable.CompareTo("Whitelist") == 0) { this.bf4db_whitelist = new List <string>(CPluginVariable.DecodeStringArray(strValue)); } if (strVariable.CompareTo("Check Command(/!#@)") == 0) { this.bf4db_CheckCommand = strValue; } if (strVariable.CompareTo("Debug Level") == 0) { int tmp = 1; int.TryParse(strValue, out tmp); this.bf4db_DebugLevel = tmp; } }
public void VersionCheck() { if (this.displayVersionMessage == enumBoolYesNo.Yes) { try { XmlDocument xml = new XmlDocument(); xml.Load("http://www.viridianphotos.com/VersionControl.xml"); XmlNodeList xList = xml.SelectNodes("//plugin"); foreach (XmlNode node in xList) { if ((node.SelectSingleNode(".//title").InnerText.Equals(GetPluginName())) && (this.displayVersionMessage == enumBoolYesNo.Yes) && (!node.SelectSingleNode(".//version").InnerText.Equals(GetPluginVersion()))) { this.ExecuteCommand("procon.protected.tasks.add", "VersionTrackerTask", "1", "300", "-1", "procon.protected.chat.write", String.Format("^b^6 You are running version {0} of the Latency Manager plugin. Version {1} is now available. Visit https://forum.myrcon.com/ for more information", GetPluginVersion(), node.SelectSingleNode(".//version").InnerText)); } } } catch (Exception) { this.displayVersionMessage = enumBoolYesNo.No; this.ExecuteCommand("procon.protected.tasks.remove", "VersionTrackerTask"); } } }
public void SetPluginVariable(string strVariable, string strValue) { if (strVariable.CompareTo("Rename Currency to:") == 0) { this.m_strCurrencyInstanceName = strValue; } else if (strVariable.CompareTo("Currency symbol:") == 0) { this.m_strCurrencySymbol = strValue; } else if (strVariable.CompareTo("Disable console messages?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynSpamPluginConsole = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Main menu chat trigger:") == 0) { this.m_strMainMenuTrigger = strValue; } else if (strVariable.CompareTo("Main menu header:") == 0) { this.m_straMainMenu = CPluginVariable.DecodeStringArray(strValue); ; } else if (strVariable.CompareTo("Shop menu chat trigger:") == 0) { this.m_strShopTrigger = strValue; } else if (strVariable.CompareTo("Shop menu header:") == 0) { this.m_straShop = CPluginVariable.DecodeStringArray(strValue); ; } else if (strVariable.CompareTo("Check balance chat trigger:") == 0) { this.m_strCheckBalanceTrigger = strValue; } else if (strVariable.CompareTo("Toggle notifications chat trigger:") == 0) { this.m_strPlayerPersonalSpamTrigger = strValue; } else if (strVariable.CompareTo("Grant admins special privileges?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynAllowAdminPrivileges = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } //Added for selection of yes/no else if (strVariable.CompareTo("Eliminate collection for TK?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynEnableTKStop = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" Admin check player's balance command:") == 0) { this.m_strAdminCheckBalanceCommand = strValue; } else if (strVariable.CompareTo(" Admin add " + m_strCurrencySymbol + " to player's account command:") == 0) { this.m_strAdminAddCurrencyCommand = strValue; } else if (strVariable.CompareTo(" Admin remove " + m_strCurrencySymbol + " from player's account command:") == 0) { this.m_strAdminRemoveCurrencyCommand = strValue; } else if (strVariable.CompareTo("Hostname/IP:") == 0) { this.m_strSQLHostname = strValue; } else if (strVariable.CompareTo("Database Name:") == 0) { this.m_strSQLDatabaseName = strValue; } else if (strVariable.CompareTo("UserName:"******"Password:"******"Enable payroll?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynEnablePayroll = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" Payroll frequency (in minutes):") == 0) { this.m_iPayrollFrequency = int.Parse(strValue); } else if (strVariable.CompareTo(" Payroll amount:") == 0) { this.m_iPayrollAmount = int.Parse(strValue); } else if (strVariable.CompareTo(" Message sent to player when paid:") == 0) { this.m_strPayrollMessage = strValue; } else if (strVariable.CompareTo("Pay for kills?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynPayForKills = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" Amount paid per kill:") == 0) { this.m_iAmountPaidPerKill = int.Parse(strValue); } else if (strVariable.CompareTo("Deduct for deaths?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynDeductForDeaths = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" Amount deducted per death:") == 0) { this.m_iAmountLostPerDeath = int.Parse(strValue); } else if (strVariable.CompareTo("Pay bonus for headshots?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynPayForHeadshots = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" Bonus paid per headshot:") == 0) { this.m_iAmountPaidPerHeadshot = int.Parse(strValue); } else if (strVariable.CompareTo("Pay for kills with specific weapons?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynPayForSpecificWeaponKills = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" Select a weapon and enter its kill value below:") == 0) { this.m_strSpecificWeaponChosen = strValue; } else if (strVariable.CompareTo(" Enter selected weapon's kill value, then select Add below:") == 0) { this.m_iSpecificWeaponPay = int.Parse(strValue); } else if (strVariable.CompareTo(" Add or remove selected weapon and kill value to or from list?") == 0) { if (this.m_strSpecificWeaponChosen.Equals(string.Empty) == false) { string t_strWeaponAndItsPayValue = this.m_strSpecificWeaponChosen + "=" + this.m_iSpecificWeaponPay; if (strValue.Equals("Add")) { if (this.m_iSpecificWeaponPay > 0) { if (this.m_lstWeaponAndPayValue.Contains(this.m_strSpecificWeaponChosen) == false) { this.m_lstWeaponAndPayValue.Add(t_strWeaponAndItsPayValue); } } } else if (strValue.Equals("Remove")) { foreach (string line in m_lstWeaponAndPayValue) { if (line.StartsWith(m_strSpecificWeaponChosen) == true) { this.m_lstWeaponAndPayValue.Remove(t_strWeaponAndItsPayValue); break; } } } this.m_lstWeaponAndPayValue.RemoveAll(string.IsNullOrEmpty); } } else if (strVariable.CompareTo(" List of weapons and corresponding " + m_strCurrencySymbol + " values:") == 0) { this.m_lstWeaponAndPayValue = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } else if (strVariable.CompareTo("Command used to display the Bounty Board:") == 0) { this.m_strBountyBoardCommand = strValue; } else if (strVariable.CompareTo("Enable automatic bounties?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynEnableAutoBounties = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" AutoBounty: Number of kills needed to start bounty:") == 0) { this.m_iAutoBountyStreak = int.Parse(strValue); } else if (strVariable.CompareTo(" AutoBounty: Starting bounty amount:") == 0) { this.m_iAutoBountyStartingBounty = int.Parse(strValue); } else if (strVariable.CompareTo(" AutoBounty: Amount added to bounty for additional kills:") == 0) { this.m_iAutoBountyIncreasePerKill = int.Parse(strValue); } else if (strVariable.CompareTo(" AutoBounty: Message sent when a bounty is posted:") == 0) { this.m_strAutoBountyPosted = strValue; } else if (strVariable.CompareTo(" AutoBounty: Message sent when a bounty is collected:") == 0) { this.m_strAutoBountyCollected = strValue; } else if (strVariable.CompareTo(" AutoBounty: Send messages to everyone?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynPublicAutoBountyNotifications = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" AutoBounty: Say the messages above?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynSayAutoBountyNotifications = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" AutoBounty: Yell the messages above?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynYellAutoBountyNotifications = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" AutoBounty: Yell them for how long (seconds)?") == 0) { this.m_iAutoBountyNotificationsYellLength = int.Parse(strValue); } else if (strVariable.CompareTo("Enable player-made bounties?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynEnablePlayerBounties = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" PlayerBounty: Command players use to add bounties:") == 0) { this.m_strPlayerBountyPostCommand = strValue; } else if (strVariable.CompareTo(" PlayerBounty: Message sent when a bounty is posted:") == 0) { this.m_strPlayerBountyPosted = strValue; } else if (strVariable.CompareTo(" PlayerBounty: Message sent when a bounty is collected:") == 0) { this.m_strPlayerBountyCollected = strValue; } else if (strVariable.CompareTo(" PlayerBounty: Send messages to everyone?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynPublicPlayerBountyNotifications = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" PlayerBounty: Say the messages?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynSayPlayerBountyNotifications = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" PlayerBounty: Yell the messages?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynYellPlayerBountyNotifications = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" PlayerBounty: Yell messages for how long (seconds)?") == 0) { this.m_iPlayerBountyNotificationsYellLength = (int.Parse(strValue) * 1); } else if (strVariable.CompareTo("Enable mugging?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynEnableMugging = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" Percentage of victim's " + m_strCurrencySymbol + " stolen when mugged:") == 0) { this.m_iMuggingPercentStolen = int.Parse(strValue); } else if (strVariable.CompareTo(" Limit the amount of " + m_strCurrencySymbol + " that can be stolen per mugging?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynEnableMuggingLimit = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" Maximum amount of " + m_strCurrencySymbol + " that can be stolen:") == 0) { this.m_iMuggingLimit = int.Parse(strValue); } else if (strVariable.CompareTo(" Message sent to everyone when someone is mugged:") == 0) { this.m_strMugged = strValue; } else if (strVariable.CompareTo(" Say the message above?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynSayStrMugged = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" Yell the message above?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ebynYellStrMugged = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(" Yell message for how long (seconds)?") == 0) { this.m_iStrMuggedYellLength = int.Parse(strValue); } else if (strVariable.CompareTo(" Select a mugging weapon:") == 0) { this.m_strMuggingWeaponChosen = strValue; } else if (strVariable.CompareTo(" Add or remove selected weapon to or from the list?") == 0) { if (this.m_strMuggingWeaponChosen.Equals(string.Empty) == false) { if (strValue.Equals("Add")) { if (this.m_lstMuggingWeapons.Contains(this.m_strMuggingWeaponChosen) == false) { this.m_lstMuggingWeapons.Add(m_strMuggingWeaponChosen); } } else if (strValue.Equals("Remove")) { if (this.m_lstMuggingWeapons.Contains(this.m_strMuggingWeaponChosen) == true) { this.m_lstMuggingWeapons.Remove(m_strMuggingWeaponChosen); } } this.m_lstMuggingWeapons.RemoveAll(string.IsNullOrEmpty); } } else if (strVariable.CompareTo(" List of mugging weapons:") == 0) { this.m_lstMuggingWeapons = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (strVariable.CompareTo("Number of items:") == 0) { this.m_iItemCount = int.Parse(strValue); } int returnInt = 0; int itemIDFromStrVariable = (strVariable.IndexOf("-") - strVariable.IndexOf("|")); if (itemIDFromStrVariable > 0) { int.TryParse(strVariable.Substring(strVariable.IndexOf("|") + 6, (strVariable.IndexOf("-") - strVariable.IndexOf("|") - 6)), out returnInt); Item item = m_dicItemsForSale[returnInt]; if (strVariable.CompareTo(string.Format("Item {0} - Name:", item.ID)) == 0) { item.Name = strValue; } else if (strVariable.CompareTo(string.Format("Item {0} - Enabled:", item.ID)) == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { item.Enabled = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo(string.Format("Item {0} - Cost:", item.ID)) == 0) { item.Cost = int.Parse(strValue); } else if (strVariable.CompareTo(string.Format("Item {0} - Buy command:", item.ID)) == 0) { item.BuyCommand = strValue; } else if (strVariable.CompareTo(string.Format("Item {0} - Description:", item.ID)) == 0) { item.Description = strValue; } else if (strVariable.CompareTo(string.Format("Item {0} - Add a console command to run when bought:", item.ID)) == 0) { if (strValue.Equals("Say")) { item.Payload.Add("Say, %buyer just bought an item!"); } if (strValue.Equals("Whisper")) { item.Payload.Add("Whisper, Buyer, You just bought an item!"); } if (strValue.Equals("Yell")) { item.Payload.Add("Yell, 5, %buyer just bought an item!"); } if (strValue.Equals("Growl")) { item.Payload.Add("Growl, 5, Buyer, You just bought an item!"); } if (strValue.Equals("Move")) { item.Payload.Add("Move, Player, US"); } if (strValue.Equals("Mute")) { item.Payload.Add("Mute, Player, 5, Minutes"); } if (strValue.Equals("Voice")) { item.Payload.Add("Voice"); } if (strValue.Equals("Kill")) { item.Payload.Add("Kill, Player"); } if (strValue.Equals("Nuke")) { item.Payload.Add("Nuke, Squad, %buyer just nuked your squad!"); } if (strValue.Equals("Kick")) { item.Payload.Add("Kick, Player, Replace this text with the kick reason."); } if (strValue.Equals("TempBan")) { item.Payload.Add("TempBan, Player, 5, Hours, Replace this text with the ban reason."); } if (strValue.Equals("PermBan")) { item.Payload.Add("PermBan, Player, Replace this text with the ban reason."); } if (strValue.Equals("UnBan")) { item.Payload.Add("UnBan"); } if (strValue.Equals("RestartRound")) { item.Payload.Add("RestartRound"); } if (strValue.Equals("NextLevel")) { item.Payload.Add("NextLevel"); } if (strValue.Equals("ReserveAdd")) { item.Payload.Add("ReserveAdd, Player, 60, Minutes"); } if (strValue.Equals("ReserveRemove")) { item.Payload.Add("ReserveRemove, Player"); } item.Payload.RemoveAll(string.IsNullOrEmpty); } if (strVariable.CompareTo(string.Format("Item {0} - List of console commands for Item {0}:", item.ID)) == 0) { item.Payload = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } } }
// Write the Config to the Server public void WriteServerConfig(string newName, string Description, string Message, List<string> NewMaplist ,enumBoolYesNo VehicleSpawnAllowed,int VehicleSpawnTime, int PlayerSpawnTime, List<string> PRoConConfig) { Thread thread_writeserverconfig = new Thread(new ThreadStart(delegate() { this.WritePluginConsole("Called WriteServerConfig(): serverMode= " + serverMode + " next_serverMode = " + next_serverMode, "Warn", 10); if (autoconfig == enumBoolYesNo.Yes) tmp_autoconfig = "Yes"; if (autoconfig == enumBoolYesNo.No) tmp_autoconfig = "No"; this.SetPluginSetting("Autoconfig", "No" ); Thread.Sleep(1000); this.ServerCommand("vars.serverDescription", Description); // SET SERVER DESCRIPTION this.ServerCommand("vars.serverMessage", Message); // SET SERVER MESSAGE if (advanced_mode == enumBoolYesNo.Yes) { this.ServerCommand("vars.vehicleSpawnAllowed", enumboolToStringTrueFalse(VehicleSpawnAllowed)); this.ServerCommand("vars.vehicleSpawnDelay", VehicleSpawnTime.ToString()); this.ServerCommand("vars.playerRespawnTime", PlayerSpawnTime.ToString()); if (expert_mode == enumBoolYesNo.Yes) WritePRoConConfig(PRoConConfig); } if (!(isInstalledUMM && useUmm == enumBoolYesNo.Yes && serverMode == "normal")) { Enable_UMM(false); this.ServerCommand("vars.serverName", newName); // SET SERVER NAME Thread.Sleep(1000); this.WriteMapList(NewMaplist); } else { Enable_UMM(true); if (expert_mode == enumBoolYesNo.Yes) WritePRoConConfig(PRoConConfig); } Thread.Sleep(1000); this.SetPluginSetting("Autoconfig", tmp_autoconfig ); })); thread_writeserverconfig.Start(); }
public void SetPluginVariable(string strVariable, string strValue) { int MaxRank = 0; int iTimeMinutes = 0; int KickBanValue = 0; int Rounds = 0; enumBoolYesNo clear = enumBoolYesNo.No; if (strVariable.CompareTo("RoC read and accepted") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_RoCAccepted = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Ban Player's GUID?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_BanGUID = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("RankKicker") == 0 && Enum.IsDefined(typeof(enumBoolOnOff), strValue) == true) { this.m_RankKicker = (enumBoolOnOff)Enum.Parse(typeof(enumBoolOnOff), strValue); } else if (strVariable.CompareTo("Access Limitation") == 0 && Enum.IsDefined(typeof(enumBoolOnOff), strValue) == true) { this.m_AccessLimitation = (enumBoolOnOff)Enum.Parse(typeof(enumBoolOnOff), strValue); } else if (strVariable.CompareTo("Clan Tag Moderation") == 0 && Enum.IsDefined(typeof(enumBoolOnOff), strValue) == true) { this.m_ClanTagModeration = (enumBoolOnOff)Enum.Parse(typeof(enumBoolOnOff), strValue); } else if (strVariable.CompareTo("Disallowed Clan Tags") == 0 && Enum.IsDefined(typeof(enumBoolOnOff), strValue) == true) { this.m_DisallowedTags = (enumBoolOnOff)Enum.Parse(typeof(enumBoolOnOff), strValue); } else if (strVariable.CompareTo("RankKicker active? (Ingame-Command)") == 0 && Enum.IsDefined(typeof(enumBoolOnOff), strValue) == true) { this.m_RankKickerOnOff = (enumBoolOnOff)Enum.Parse(typeof(enumBoolOnOff), strValue); } else if (strVariable.CompareTo("Show actions in plugin console?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ConsoleLog = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Rank Limit") == 0 && int.TryParse(strValue, out MaxRank) == true) { this.m_RankLimit = int.Parse(strValue); } else if (strVariable.CompareTo("White List") == 0) { this.m_WhiteList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } else if (strVariable.CompareTo("Allowed certain Clan Tags?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ClanTagWhiteList = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("White List Clan Tags") == 0) { this.m_WhiteListClanTags = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } else if (strVariable.CompareTo("Clear data now?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { clear = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); if (clear == enumBoolYesNo.Yes) { Clear(1); this.m_ClearAll = enumBoolYesNo.No; } } else if (strVariable.CompareTo("Ban Players?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_TempBanPlayers = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Permanently Ban Players?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_PermBanPlayers = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Player Ban Time (minutes)") == 0 && int.TryParse(strValue, out iTimeMinutes) == true) { if (iTimeMinutes > 0) { this.m_TempBanTime = iTimeMinutes; } } else if (strVariable.CompareTo("Ban Player after X Kicks?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_BanAfterKicks = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Number of Kicks before Ban") == 0 && int.TryParse(strValue, out KickBanValue) == true) { this.m_KicksBeforeBan = KickBanValue; } else if (strVariable.CompareTo("Kick Reason") == 0) { this.m_KickReason = strValue; } else if (strVariable.CompareTo("Ban Reason") == 0) { this.m_BanReason = strValue; } else if (strVariable.CompareTo("Permanent Ban Reason") == 0) { this.m_PermBanReason = strValue; } else if (strVariable.CompareTo("Allow Access via Playername?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_AccessLimitationPlayers = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Allow Access via Clantag?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_AccessLimitationTags = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Allowed Players") == 0) { this.m_AllowedPlayers = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } else if (strVariable.CompareTo("Allowed Clantags") == 0) { this.m_AllowedClanTags = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } else if (strVariable.CompareTo("Ban disallowed Players?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_AccessBanPlayers = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Access Kick Reason") == 0) { this.m_AccessKickReason = strValue; } else if (strVariable.CompareTo("Access Ban Reason") == 0) { this.m_AccessPermBanReason = strValue; } else if (strVariable.CompareTo("Moderated Clan Tags") == 0) { this.m_ModeratedClanTags = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } else if (strVariable.CompareTo("Allowed Clan Players") == 0) { this.m_AllowedClanPlayers = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } else if (strVariable.CompareTo("Ban dÃsallowed Clan Players?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_ClanTagBanPlayers = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Clan Tag Kick Reason") == 0) { this.m_ClanTagKickReason = strValue; } else if (strVariable.CompareTo("Clan Tag Ban Reason") == 0) { this.m_ClanTagPermBanReason = strValue; } else if (strVariable.CompareTo("Ban disallowed Clan Players?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_DisallowedTagsBan = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Black List") == 0) { this.m_DisallowedClanTags = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } else if (strVariable.CompareTo("Disallowed Clan Kick Reason") == 0) { this.m_DisallowedTagsKickReason = strValue; } else if (strVariable.CompareTo("Disallowed Clan Ban Reason") == 0) { this.m_DisallowedTagsBanReason = strValue; } else if (strVariable.CompareTo("Clear Cache automatically? (Recommended!)") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_AutomaticallyClearCache = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Rounds before Cache-Clearing") == 0 && int.TryParse(strValue, out Rounds) == true) { this.m_CacheClearRounds = int.Parse(strValue); } if (this.m_ConsoleLog == enumBoolYesNo.Yes && clear == enumBoolYesNo.No) { this.ExecuteCommand("procon.protected.pluginconsole.write", String.Format("^b^4AccessRestriction: ^0Plugin variable '{0}' set to '{1}'", strVariable, strValue)); } }
public void SetPluginVariable(string strVariable, string strValue) { int iTimeSeconds = 0; int iTmpValue = 0; // Basics if (strVariable.CompareTo("Private Prefix") == 0) { this.m_strPrivatePrefix = strValue; } else if (strVariable.CompareTo("Admins Prefix") == 0) { this.m_strAdminsPrefix = strValue; } else if (strVariable.CompareTo("Public Prefix") == 0) { this.m_strPublicPrefix = strValue; } // Welcome else if (strVariable.CompareTo("Enable welcome") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_bEnableWelcome = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Message") == 0) { this.m_strWelcomeMessage = strValue; } else if (strVariable.CompareTo("Yell welcome") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enYellResponses = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Delay before sending welcome") == 0 && int.TryParse(strValue, out iTimeSeconds) == true) { this.m_iDelayBeforeSendingWelcome = iTimeSeconds; } else if (strVariable.CompareTo("Show welcome for how long") == 0 && int.TryParse(strValue, out iTimeSeconds) == true) { this.m_iWelcomeDisplayTime = iTimeSeconds * 1000; } // Rules else if (strVariable.CompareTo("Yell rules") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enYellResponsesRules = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Delay before sending rules") == 0 && int.TryParse(strValue, out iTimeSeconds) == true) { this.m_iDelayBeforeSendingRules = iTimeSeconds; } else if (strVariable.CompareTo("Show rule for how long") == 0 && int.TryParse(strValue, out iTimeSeconds) == true) { this.m_iRuleDisplayTime = iTimeSeconds * 1000; } else if (strVariable.CompareTo("Delay between rules") == 0 && int.TryParse(strValue, out iTimeSeconds) == true) { this.m_iDelayBetweenRules = iTimeSeconds; } else if (strVariable.CompareTo("Chat Command") == 0) { this.m_strRulesCommandOld = this.m_strRulesCommand; this.m_strRulesCommand = strValue; } else if (strVariable.CompareTo("Server Rules") == 0) { this.m_aServerRules = CPluginVariable.DecodeStringArray(strValue); int iloop = 0; foreach (string rule in this.m_aServerRules) { if (rule.ToLower().IndexOf(this.m_strChatRulesRequest.ToLower()) >= 0) { this.m_aServerRules[iloop] = Regex.Replace(rule, this.m_strChatRulesRequest, "", RegexOptions.IgnoreCase); } iloop++; } } else if (strVariable.CompareTo("Ignore first line") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enIgnoreFirstLine = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } // Misc else if (strVariable.CompareTo("Default Sound") == 0) { this.m_audioFile = strValue; } else if (strVariable.CompareTo("Listen to Procon chat") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enListenToProconChat = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("GUI chat command") == 0) { this.m_strChatRulesRequest = strValue; int iloop = 0; foreach (string rule in this.m_aServerRules) { if (rule.ToLower().IndexOf(this.m_strChatRulesRequest.ToLower()) >= 0) { this.m_aServerRules[iloop] = Regex.Replace(rule, this.m_strChatRulesRequest, "", RegexOptions.IgnoreCase); } iloop++; } } else if (strVariable.CompareTo("Privileges value") == 0 && int.TryParse(strValue, out iTmpValue) == true) { this.m_iMinPrivilegesValue = iTmpValue; } else if (strVariable.CompareTo("Take privileges of") == 0) { if (strValue.CompareTo("ExampleAccount") != 0) { this.WritePluginConsole(String.Format("Checking privileges on {0}", strValue), 2); CPrivileges cpAccount = this.GetAccountPrivileges(strValue); if (cpAccount != null) { this.WritePluginConsole(String.Format("{0} has privilege value {1}", strValue, cpAccount.PrivilegesFlags.ToString()), 2); this.m_iMinPrivilegesValue = (int)cpAccount.PrivilegesFlags; } else { this.WritePluginConsole(String.Format("There is no account {0}. Using default value.", strValue), 2); this.m_iMinPrivilegesValue = this.m_iMinPrivilegesValueDefault; } } } else if (strVariable.CompareTo("Debug output") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enDoDebugOutput = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); if (this.m_enDoDebugOutput == enumBoolYesNo.No && this.m_enDoQuietMode == enumBoolYesNo.Yes) { this.m_enDoConsoleOutput = enumBoolYesNo.Yes; } } this.UnregisterAllCommands(); this.RegisterAllCommands(); }
public CLatencyManager() { //Country kick this.strSelectType = "Allow countries"; this.lsSelectedCountries = new List<string>(); this.lsSelectedCountries.Add("Australia"); this.strCountryKickMessage = "Sorry, players from %country% are not allowed."; this.lsCheckedPlayers = new List<string>(); this.enableCountryKick = enumBoolYesNo.No; this.dicCountrys = new Dictionary<String, String>(); //Ping kick this.enablePingKick = enumBoolYesNo.No; this.enableNoPingKick = enumBoolYesNo.No; this.intPingLimit = 300; this.strPingMethod = "Instant kick"; this.strPingKickMessage = "High ping (%ping%)"; this.dicPlayerPings = new Dictionary<string, LinkedList<int>>(); this.intAverageAccuracy = 20; this.intAverageMinCount = 2; this.dicPingCalled = new Dictionary<String, int>(); this.dicMissingPings = new Dictionary<string, int>(); //General this.intPlayerLimit = 16; this.lsPlayerInfo = new List<string>(); this.lsWhitelist = new List<string>(); this.debugMessages = enumBoolYesNo.Yes; this.displayVersionMessage = enumBoolYesNo.Yes; this.boolPlayerLimitReached = false; this.ingameMessage = enumBoolYesNo.No; this.strIngameType = "Yell"; this.strGameMode = "BF4"; }
public void VersionCheck() { if (this.displayVersionMessage == enumBoolYesNo.Yes) { try { XmlDocument xml = new XmlDocument(); xml.Load("http://www.viridianphotos.com/VersionControl.xml"); XmlNodeList xList = xml.SelectNodes("//plugin"); foreach (XmlNode node in xList) { if((node.SelectSingleNode(".//title").InnerText.Equals(GetPluginName())) && (this.displayVersionMessage == enumBoolYesNo.Yes) && (!node.SelectSingleNode(".//version").InnerText.Equals(GetPluginVersion()))) { this.ExecuteCommand("procon.protected.tasks.add", "VersionTrackerTask", "1", "300", "-1", "procon.protected.chat.write", String.Format("^b^6 You are running version {0} of the Latency Manager plugin. Version {1} is now available. Visit https://forum.myrcon.com/ for more information", GetPluginVersion(), node.SelectSingleNode(".//version").InnerText)); } } } catch (Exception) { this.displayVersionMessage = enumBoolYesNo.No; this.ExecuteCommand("procon.protected.tasks.remove", "VersionTrackerTask"); } } }
public void SetPluginVariable(string strVariable, string strValue) { int iValue = 16; //COUNTRY VARIABLES if (strVariable.CompareTo("Action") == 0) { this.strSelectType = strValue; } else if (strVariable.CompareTo("Country list") == 0) { if (strValue.CompareTo("N/A") != 0) { this.lsSelectedCountries.Add(strValue); } } else if (strVariable.CompareTo("Selected countries") == 0) { this.lsSelectedCountries = new List <string>(CPluginVariable.DecodeStringArray(strValue)); } else if (strVariable.CompareTo("Enable Country based kick?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.enableCountryKick = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Country kick message") == 0) { this.strCountryKickMessage = strValue; } // PING VARIABLES else if (strVariable.CompareTo("Enable high ping kick?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.enablePingKick = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Ping limit") == 0 && int.TryParse(strValue, out iValue) == true) { this.intPingLimit = iValue; } else if (strVariable.CompareTo("High ping kick message") == 0) { this.strPingKickMessage = strValue; } else if (strVariable.CompareTo("Ping Kick Method") == 0) { this.strPingMethod = strValue; } else if (strVariable.CompareTo("Instant kick no ping?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.enableNoPingKick = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Pings to sample for average") == 0 && int.TryParse(strValue, out iValue) == true) { if (iValue < this.intAverageMinCount) { this.intAverageMinCount = iValue; } this.intAverageAccuracy = iValue; } else if (strVariable.CompareTo("Minimum pings before kicking") == 0 && int.TryParse(strValue, out iValue) == true) { if (iValue > this.intAverageAccuracy) { this.intAverageMinCount = this.intAverageAccuracy; } else { this.intAverageMinCount = iValue; } } // GENERAL VARIABLES else if (strVariable.CompareTo("Minimum players before rule enforced (0: none)") == 0 && int.TryParse(strValue, out iValue) == true) { this.intPlayerLimit = iValue; } else if (strVariable.CompareTo("Whitelist") == 0) { this.lsWhitelist = new List <string>(CPluginVariable.DecodeStringArray(strValue)); } else if (strVariable.CompareTo("Debug messages?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.debugMessages = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Display plugin update message?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.displayVersionMessage = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); if (this.displayVersionMessage == enumBoolYesNo.No) { this.ExecuteCommand("procon.protected.tasks.remove", "VersionTrackerTask"); } } else if (strVariable.CompareTo("Yell or Say ingame message") == 0) { this.strIngameType = strValue; } else if (strVariable.CompareTo("Ingame messages?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ingameMessage = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } }
public void OnGlobalChat(string strSpeaker, string strMessage) { if ((strSpeaker).Equals("Server") == false) { foreach (Rule rule in t_dicRules.Values) { string t_isItATrigger = rule.Trigger; string[] t_output = rule.Output; enumBoolYesNo t_yellOrNot = rule.Yell; enumBoolYesNo t_sendToAllOrNot = rule.SendToAll; int t_delay = rule.DelaySend; int t_displayTime = rule.DisplayTime; Match mMatch; mMatch = Regex.Match(strMessage, t_isItATrigger, RegexOptions.IgnoreCase); if (mMatch.Success == true) { foreach (string line in t_output) { if (t_yellOrNot == enumBoolYesNo.Yes) { if (t_sendToAllOrNot == enumBoolYesNo.Yes) { //this.ExecuteCommand("procon.protected.tasks.add", "ChatTriggerAutoResponder", t_delay.ToString(), "1", "1", "procon.protected.send", "admin.yell", line, t_displayTime.ToString(), "all"); //t_delay += (t_displayTime / 1000) + t_delay; this.ExecuteCommand("procon.protected.tasks.add", "ChatTriggerAutoResponder", t_delay.ToString(), "1", "1", "procon.protected.send", "admin.yell", line, (t_displayTime / this.m_iYellDivider).ToString(), "all"); t_delay += (t_displayTime / 1000) + t_delay; this.ExecuteCommand("procon.protected.chat.write", "^4ChatTriggerAutoResponder: " + line.ToUpper()); } else { //this.ExecuteCommand("procon.protected.tasks.add", "ChatTriggerAutoResponder", t_delay.ToString(), "1", "1", "procon.protected.send", "admin.yell", line, t_displayTime.ToString(), "player", strSpeaker); //t_delay += (t_displayTime / 1000) + t_delay; this.ExecuteCommand("procon.protected.tasks.add", "ChatTriggerAutoResponder", t_delay.ToString(), "1", "1", "procon.protected.send", "admin.yell", line, (t_displayTime / this.m_iYellDivider).ToString(), "player", strSpeaker); t_delay += (t_displayTime / 1000) + t_delay; this.ExecuteCommand("procon.protected.chat.write", "^4ChatTriggerAutoResponder: " + line.ToUpper()); } } else { if (t_sendToAllOrNot == enumBoolYesNo.Yes) { this.ExecuteCommand("procon.protected.tasks.add", "ChatTriggerAutoResponder", t_delay.ToString(), "1", "1", "procon.protected.send", "admin.say", line, "all"); this.ExecuteCommand("procon.protected.chat.write", "^4ChatTriggerAutoResponder: " + line); } else { this.ExecuteCommand("procon.protected.tasks.add", "ChatTriggerAutoResponder", t_delay.ToString(), "1", "1", "procon.protected.send", "admin.say", line, "player", strSpeaker); this.ExecuteCommand("procon.protected.chat.write", "^4ChatTriggerAutoResponder: " + line); } } } } else { } } } else { } this.m_strPreviousMessage = strMessage; }
// Allways be suspicious of strValue's actual value. A command in the console can // by the user can put any kind of data it wants in strValue. // use type.TryParse public void SetPluginVariable(string strVariable, string strValue) { if (strVariable.CompareTo("PRoCon - Scramble Teams on Roundend?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleRoundViaPRoCon = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("PRoCon - Scramble Teams on Roundend? Are you sure?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleRoundViaPRoConConf = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); if (this.ynbScrambleRoundViaPRoConConf == enumBoolYesNo.Yes) { OnScrambleViaPRoCon(); } } else if (strVariable.CompareTo("How many warnings?") == 0 && Int32.TryParse(strValue, out this.intWarnings) == true) { if (this.intWarnings > 0) { this.intWarnings = Convert.ToInt32(strValue); } else { this.intWarnings = 1; } } else if (strVariable.CompareTo("Enable Debug Mode for balancing guard") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbDebugModeGuard = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Enable Balancing Guard?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbBalancingGuard = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("CQ/TDM - Enable Shame Message?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbShameMessage = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("CQ/TDM - Shame Message") == 0) { this.strShameMessage = strValue; } else if (strVariable.CompareTo("CQ/TDM - Stop winning team switching, when x % TicketDiff (% of maxTickets)") == 0 && Int32.TryParse(strValue, out this.intScoreWTS) == true) { if (this.intScoreWTS > 0) { this.intScoreWTS = Convert.ToInt32(strValue); } else { this.intScoreWTS = 1; } } else if (strVariable.CompareTo("Rush - Start sorting at Difference of") == 0 && Double.TryParse(strValue, out this.dblValueDiffRUSH) == true) { if (this.dblValueDiffRUSH >= 0.01) { this.dblValueDiffRUSH = Convert.ToDouble(strValue); } else { this.dblValueDiffRUSH = 0.01; } } else if (strVariable.CompareTo("GM - Start sorting at Difference of") == 0 && Double.TryParse(strValue, out this.dblValueDiffGM) == true) { if (this.dblValueDiffGM >= 0.01) { this.dblValueDiffGM = Convert.ToDouble(strValue); } else { this.dblValueDiffGM = 0.01; } } else if (strVariable.CompareTo("Conquest - Start sorting at Difference of") == 0 && Double.TryParse(strValue, out this.dblValueDiffCONQUEST) == true) { if (this.dblValueDiffCONQUEST >= 0.01) { this.dblValueDiffCONQUEST = Convert.ToDouble(strValue); } else { this.dblValueDiffCONQUEST = 0.01; } } else if (strVariable.CompareTo("TDM - Start sorting at Difference of") == 0 && Double.TryParse(strValue, out this.dblValueDiffTDM) == true) { if (this.dblValueDiffTDM >= 0.01) { this.dblValueDiffTDM = Convert.ToDouble(strValue); } else { this.dblValueDiffTDM = 0.01; } } else if (strVariable.CompareTo("Rush - Sort by (same as Scramble by)") == 0) { this.ScrambleByRUSH = strValue; } else if (strVariable.CompareTo("GM - Sort by (same as Scramble by)") == 0) { this.ScrambleByGM = strValue; } else if (strVariable.CompareTo("Conquest - Sort by (same as Scramble by)") == 0) { this.ScrambleByCONQUEST = strValue; } else if (strVariable.CompareTo("TDM - Sort by (same as Scramble by)") == 0) { this.ScrambleByTDM = strValue; } else if (strVariable.CompareTo("Time between Warnings in sec") == 0 && Int32.TryParse(strValue, out this.intInterval) == true) { if (this.intInterval > 0) { this.intInterval = Convert.ToInt32(strValue); } else { this.intInterval = 1; } } else if (strVariable.CompareTo("RUSH-Player Threshold") == 0 && Int32.TryParse(strValue, out this.intTreshRUSH) == true) { if (this.intTreshRUSH > 0) { this.intTreshRUSH = Convert.ToInt32(strValue); } else { this.intTreshRUSH = 0; } } else if (strVariable.CompareTo("RUSH-Allowing Player Difference below Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif1RUSH) == true) { if (this.intAllowDif1RUSH > 0) { this.intAllowDif1RUSH = Convert.ToInt32(strValue); } else { this.intAllowDif1RUSH = 1; } } else if (strVariable.CompareTo("RUSH-Allowing Player Difference equal to/above Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif2RUSH) == true) { if (this.intAllowDif2RUSH > 0) { this.intAllowDif2RUSH = Convert.ToInt32(strValue); } else { this.intAllowDif2RUSH = 1; } } else if (strVariable.CompareTo("RUSH-Stop balancing, when tickets till end") == 0 && Int32.TryParse(strValue, out this.intminScoreRUSH) == true) { this.intminScoreRUSH = Convert.ToInt32(strValue); } else if (strVariable.CompareTo("GM-Player Threshold") == 0 && Int32.TryParse(strValue, out this.intTreshGM) == true) { if (this.intTreshGM > 0) { this.intTreshGM = Convert.ToInt32(strValue); } else { this.intTreshGM = 0; } } else if (strVariable.CompareTo("GM-Allowing Player Difference below Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif1GM) == true) { if (this.intAllowDif1GM > 0) { this.intAllowDif1GM = Convert.ToInt32(strValue); } else { this.intAllowDif1GM = 1; } } else if (strVariable.CompareTo("GM-Allowing Player Difference equal to/above Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif2GM) == true) { if (this.intAllowDif2GM > 0) { this.intAllowDif2GM = Convert.ToInt32(strValue); } else { this.intAllowDif2GM = 1; } } else if (strVariable.CompareTo("CQ-Player Threshold") == 0 && Int32.TryParse(strValue, out this.intTreshCONQUEST) == true) { if (this.intTreshCONQUEST > 0) { this.intTreshCONQUEST = Convert.ToInt32(strValue); } else { this.intTreshCONQUEST = 0; } } else if (strVariable.CompareTo("CQ-Allowing Player Difference below Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif1CONQUEST) == true) { if (this.intAllowDif1CONQUEST > 0) { this.intAllowDif1CONQUEST = Convert.ToInt32(strValue); } else { this.intAllowDif1CONQUEST = 1; } } else if (strVariable.CompareTo("CQ-Allowing Player Difference equal to/above Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif2CONQUEST) == true) { if (this.intAllowDif2CONQUEST > 0) { this.intAllowDif2CONQUEST = Convert.ToInt32(strValue); } else { this.intAllowDif2CONQUEST = 1; } } else if (strVariable.CompareTo("CQ-Stop balancing, when tickets till end") == 0 && Int32.TryParse(strValue, out this.intminScoreCONQUEST) == true) { this.intminScoreCONQUEST = Convert.ToInt32(strValue); } else if (strVariable.CompareTo("TDM-Player Threshold") == 0 && Int32.TryParse(strValue, out this.intTreshTDM) == true) { if (this.intTreshTDM> 0) { this.intTreshTDM= Convert.ToInt32(strValue); } else { this.intTreshTDM= 0; } } else if (strVariable.CompareTo("TDM-Allowing Player Difference below Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif1TDM) == true) { if (this.intAllowDif1TDM> 0) { this.intAllowDif1TDM= Convert.ToInt32(strValue); } else { this.intAllowDif1TDM= 1; } } else if (strVariable.CompareTo("TDM-Allowing Player Difference equal to/above Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif2TDM) == true) { if (this.intAllowDif2TDM> 0) { this.intAllowDif2TDM= Convert.ToInt32(strValue); } else { this.intAllowDif2TDM= 1; } } else if (strVariable.CompareTo("TDM-Stop balancing, when tickets till end") == 0 && Int32.TryParse(strValue, out this.intminScoreTDM) == true) { this.intminScoreTDM = Convert.ToInt32(strValue); } else if (strVariable.CompareTo("Show ingame warnings?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbShowWarnings = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Warning Message") == 0) { this.strWarning = strValue; } else if (strVariable.CompareTo("Show ingame balancing message?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbShowBallancing = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Balancing Message") == 0) { this.strLastWarning = strValue; } else if (strVariable.CompareTo("Show private message to moved player?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbShowPlayermessage = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Message for moved Player") == 0) { this.strBeenMoved = strValue; } else if (strVariable.CompareTo("Enable Command: !scrambleround") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbEnableScrambleRound = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Enable Command: !scramblenow") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbEnableScrambleNow = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Show Scrambling messages to the server?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleMessage = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Yell messages to the server?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbYellScrambleManuall = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Message when admin requests a scramble at roundend") == 0) { this.strScrambleRoundMsg = strValue; } else if (strVariable.CompareTo("Message when admin requests a scramble now") == 0) { this.strScrambleNowMsg = strValue; } else if (strVariable.CompareTo("Message when scrambling is done") == 0) { this.strScrambleDoneMsg = strValue; } else if (strVariable.CompareTo("Yell scramble message at roundend?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbYellScrambleMessage = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("What to do with squads?") == 0) { this.strScrambleMode = strValue; } else if (strVariable.CompareTo("ClanTag-List: Keep squad, if at least one player uses one of these ClanTags") == 0) { this.strAClantagWhitelistScrambler = CPluginVariable.DecodeStringArray(strValue); } else if (strVariable.CompareTo("RUSH-Scramble teams on every new map?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbenableSkillRUSH = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("RUSH-Scramble by") == 0) { this.ScrambleByRUSH = strValue; } else if (strVariable.CompareTo("GM-Scramble teams on every new map?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbenableSkillGM = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("GM-Scramble by") == 0) { this.ScrambleByGM = strValue; } else if (strVariable.CompareTo("CQ-Enable Skillscrambler?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbenableSkillCONQUEST = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("CQ-Scramble on every new map no matter what score?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleMapCONQUEST = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("CQ-Check balance on every new Round (else on new Map only)") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleEveryRoundCONQUEST = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } if (strVariable.CompareTo("CQ-Scramble, if x % Tickets difference (% of maxTickets)") == 0 && Int32.TryParse(strValue, out this.intwonTicketsCONQUEST) == true) { if (this.intwonTicketsCONQUEST >= 0) { this.intwonTicketsCONQUEST = Convert.ToInt32(strValue); } else { this.intwonTicketsCONQUEST = 0; } } else if (strVariable.CompareTo("CQ-Scrambling Message at roundend") == 0) { this.strScrambleMessageCONQUEST = strValue; } else if (strVariable.CompareTo("CQ-Scramble by") == 0) { this.ScrambleByCONQUEST = strValue; } else if (strVariable.CompareTo("TDM-Enable Skillscrambler?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbenableSkillTDM = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("TDM-Scramble on every new map no matter what score?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleMapTDM = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("TDM-Check balance on every new Round (else on new Map only)") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleEveryRoundTDM = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } if (strVariable.CompareTo("TDM-Scramble, if x % Tickets difference (% of maxTickets)") == 0 && Int32.TryParse(strValue, out this.intwonTicketsTDM) == true) { if (this.intwonTicketsTDM >= 0) { this.intwonTicketsTDM = Convert.ToInt32(strValue); } else { this.intwonTicketsTDM = 0; } } if (strVariable.CompareTo("TDM-Show Scramble message at roundend when x Tickets are reached") == 0 && Int32.TryParse(strValue, out this.intshowTicketsTDM) == true) { if (this.intshowTicketsTDM >= 0) { this.intshowTicketsTDM = Convert.ToInt32(strValue); } else { this.intshowTicketsTDM = 5; } } else if (strVariable.CompareTo("TDM-Scrambling Message at roundend") == 0) { this.strScrambleMessageTDM = strValue; } else if (strVariable.CompareTo("TDM-Scramble by") == 0) { this.ScrambleByTDM = strValue; } else if (strVariable.CompareTo("Enable Debug Mode for normal balancing") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbDebugMode = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Enable Debug Mode for skill balancing") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbDebugModeSkill = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Enable Whitelist") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbWhitelist = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Whitelist ClanTags") == 0) { this.strAClantagWhitelist = CPluginVariable.DecodeStringArray(strValue); } else if (strVariable.CompareTo("Whitelist Names") == 0) { this.strAWhitelist = CPluginVariable.DecodeStringArray(strValue); } else if (strVariable.CompareTo("Include VIP/Reserved Slots List into the whitelist?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbincludeVIPlist = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } }
public void OnScrambleViaPRoCon() { this.ynbScrambleRoundViaPRoConConf = enumBoolYesNo.No; this.ynbScrambleRoundViaPRoCon = enumBoolYesNo.No; if (this.ynbEnableScrambleRound == enumBoolYesNo.Yes) { if (this.boolLevelStart) { this.DebugInfoSkill("^1Admin requested a scramble for next round!"); this.boolscramblebyadminroundend = true; if (this.ynbScrambleMessage == enumBoolYesNo.Yes) { if (this.strScrambleRoundMsg != "") { this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleRoundMsg, "all"); if (this.ynbYellScrambleManuall == enumBoolYesNo.Yes) { this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleRoundMsg, "30"); } } } } else { this.DebugInfoSkill("^3You can only request for a scramble, if a round is running."); } } else { this.DebugInfoSkill("You need to activate and setup !scrambleround at '2.5 Skill-Scrambler: Manual Commands'"); } }
public void SetPluginVariable(string strVariable, string strValue) { if (Regex.Match(strVariable, @"ExtraTaskPlaner_Callback").Success) // Extra Task Manager Callback { ExtraTaskPlaner_Callback(strValue); } if (Regex.Match(strVariable, @"Select Servermode").Success) // Extra Task Manager Callback { if (strValue != "...") ExtraTaskPlaner_Callback(strValue); } if (strVariable.Contains("|")) { string[] tmpVariable = strVariable.Split('|'); strVariable = tmpVariable[1]; } if (plugin_loaded) WritePluginConsole("^b" + strVariable + "^n ( " + strValue + " )","VARIABLE", 10); if (!tmpPluginVariables.ContainsKey(strVariable)) tmpPluginVariables.Add(strVariable, strValue); // COMMANDS if (Regex.Match(strVariable, @"Switchnow_Command").Success) { switchnow_cmd = strValue; } if (Regex.Match(strVariable, @"Command_Kick All").Success) { cmd_KickAll = strValue; } // UMM Variables if (Regex.Match(strVariable, @"Use UMM for Normal Mode").Success) { if (strValue == "Yes") { useUmm = enumBoolYesNo.Yes; if ( serverMode == "normal" ) Enable_UMM(true); } if (strValue == "No") { useUmm = enumBoolYesNo.No; if (serverMode == "normal") Enable_UMM(false); } } // VARS if (Regex.Match(strVariable, @"I have read the Terms of Use YES / NO").Success) { thermsofuse = strValue; } if (Regex.Match(strVariable, @"Debug level").Success) { int tmp = 2; int.TryParse(strValue, out tmp); fDebugLevel = tmp; } if (Regex.Match(strVariable, @"Enable Advanced Mode").Success) { if (strValue == "Yes") advanced_mode = enumBoolYesNo.Yes; if (strValue == "No") { advanced_mode = enumBoolYesNo.No; expert_mode = enumBoolYesNo.No; // Disable Expert Mode if advanced mode is off } } if (Regex.Match(strVariable, @"Enable Expert Mode").Success) { if (strValue == "Yes") expert_mode = enumBoolYesNo.Yes; if (strValue == "No") expert_mode = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"Plugin Command").Success) { PluginCommand(strValue); } if (Regex.Match(strVariable, @"Startup Mode").Success) { if (strValue == "") strValue = "normal"; // Standardwert setzen startup_mode = strValue; } if (Regex.Match(strVariable, @"Aggressive Startup").Success) { if (strValue == "Yes") agresive_startup = enumBoolYesNo.Yes; if (strValue == "No") agresive_startup = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"Countdown Timer").Success) { int tmp = 2; int.TryParse(strValue, out tmp); countdown_time = tmp; } if (Regex.Match(strVariable, @"Show Weaponcodes").Success) { if (strValue == "Yes") showweaponcode = enumBoolYesNo.Yes; if (strValue == "No") showweaponcode = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"Plugin Autoconfig").Success) { if (strValue == "Yes") autoconfig = enumBoolYesNo.Yes; if (strValue == "No") autoconfig = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"Use General Whitelist").Success) { if (strValue == "Yes") mWhitelist_isEnabled = enumBoolYesNo.Yes; if (strValue == "No") mWhitelist_isEnabled = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"Auto Whitelist ProconAccounts").Success) { if (strValue == "Yes") Auto_Whitelist_Admins = enumBoolYesNo.Yes; if (strValue == "No") Auto_Whitelist_Admins = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"Prevent ProconAccounts from warn").Success) { if (strValue == "Yes") Prevent_Admins_Warn = enumBoolYesNo.Yes; if (strValue == "No") Prevent_Admins_Warn = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"Prevent Whitelist Players from warn").Success) { if (strValue == "Yes") Prevent_WlistPlayers_Warn = enumBoolYesNo.Yes; if (strValue == "No") Prevent_WlistPlayers_Warn = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"Use General Prohibited Weapons").Success) { if (strValue == "Yes") g_prohibitedWeapons_enable = enumBoolYesNo.Yes; if (strValue == "No") g_prohibitedWeapons_enable = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"Use Map Prohibited Weapons").Success) { if (strValue == "Yes") map_prohibitedWeapons_enable = enumBoolYesNo.Yes; if (strValue == "No") map_prohibitedWeapons_enable = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"General Prohibited Weapons List").Success) { g_prohibitedWeapons = new List<string>(CheckWeaponList(CPluginVariable.DecodeStringArray(strValue))); } if (Regex.Match(strVariable, @"Clan_Whitelist").Success) { m_ClanWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (strVariable == "Player_Whitelist") { m_PlayerWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"Prohibited Weapon Max Player Warns").Success) { g_max_Warns = Convert.ToInt32(strValue); } if (Regex.Match(strVariable, @"Prohibited Weapon Player Action").Success) { g_PlayerAction = strValue; } if (Regex.Match(strVariable, @"Prohibited Weapon TBan Minutes").Success) { g_ActionTbanTime = Convert.ToInt32(strValue); } if (Regex.Match(strVariable, @"Enable Server Rules").Success) { if (strValue == "Yes") rules_enable = enumBoolYesNo.Yes; if (strValue == "No") rules_enable = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"Show Rules in...").Success) { rules_method = strValue; } if (Regex.Match(strVariable, @"Show Rules on first spawn").Success) { if (strValue == "Yes") rules_firstjoin = enumBoolYesNo.Yes; if (strValue == "No") rules_firstjoin = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"Show Rules Time").Success) { rules_time = Convert.ToInt32(strValue); } // NORMAL MODE VARS if (Regex.Match(strVariable, @"NM_Command Enable").Success) { if (strValue == "") strValue = "normal"; // Standardwert setzen nm_commandEnable = strValue; } if (Regex.Match(strVariable, @"NM_Rules").Success) { nm_Rules = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"NM_PRoCon Config").Success) { List<string> tmpConfigList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); nmPRoConConfig = new List<string>(); foreach (string line in tmpConfigList) { string tmpline = line.Replace("|","#LISTITEM#"); nmPRoConConfig.Add(tmpline); } } if (Regex.Match(strVariable, @"NM_Server Name").Success && !(isInstalledUMM && useUmm == enumBoolYesNo.Yes)) { nm_Servername = strValue; } if (Regex.Match(strVariable, @"NM_Server Description").Success) { nm_Serverdescription = strValue; } if (Regex.Match(strVariable, @"NM_Server Message").Success) { nm_ServerMessage = strValue; } if (Regex.Match(strVariable, @"NM_Vehicle Spawn Allowed").Success) { if (strValue == "Yes") nm_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "No") nm_VehicleSpawnAllowed = enumBoolYesNo.No; if (strValue == "True") nm_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "False") nm_VehicleSpawnAllowed = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"NM_Vehicle Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of NM_Vehicle Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of NM_Vehicle Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } nm_VehicleSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"NM_Player Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of NM_Player Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of NM_Player Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } nm_PlayerSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"NM_MapList").Success) { if (!(isInstalledUMM && useUmm == enumBoolYesNo.Yes)) { nm_MapList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } } // PRIVATE MODE VARIABLEN if (Regex.Match(strVariable, @"Private Mode").Success) { UnRegisterAllCommands(); if (strValue == "Yes") pm_isEnabled = enumBoolYesNo.Yes; if (strValue == "No") pm_isEnabled = enumBoolYesNo.No; RegisterAllCommands(); taskPlanerUpdateNeeded = true; } if (Regex.Match(strVariable, @"PM_Command Enable").Success) { if (strValue == "") strValue = "private"; // Standardwert setzen pm_commandEnable = strValue; } if (Regex.Match(strVariable, @"PM_Rules").Success) { pm_Rules = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"PM_ClanWhitelist").Success) { pm_ClanWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"PM_PlayerWhitelist").Success) { pm_PlayerWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"PM_PRoCon Config").Success) { List<string> tmpConfigList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); pmPRoConConfig = new List<string>(); foreach (string line in tmpConfigList) { string tmpline = line.Replace("|", "#LISTITEM#"); pmPRoConConfig.Add(tmpline); } } if (Regex.Match(strVariable, @"PM_Server Name").Success) { pm_Servername = strValue; } if (Regex.Match(strVariable, @"PM_Server Description").Success) { pm_Serverdescription = strValue; } if (Regex.Match(strVariable, @"PM_Server Message").Success) { pm_ServerMessage = strValue; } if (Regex.Match(strVariable, @"PM_Vehicle Spawn Allowed").Success) { if (strValue == "Yes") pm_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "No") pm_VehicleSpawnAllowed = enumBoolYesNo.No; if (strValue == "True") pm_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "False") pm_VehicleSpawnAllowed = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"PM_Vehicle Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of PM_Vehicle Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of PM_Vehicle Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } pm_VehicleSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"PM_Player Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of PM_Player Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of PM_Player Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } pm_PlayerSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"PM_MapList").Success) { pm_MapList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"PM_Autokick All on enable").Success) { if (strValue == "Yes") autoKickAll = enumBoolYesNo.Yes; if (strValue == "No") autoKickAll = enumBoolYesNo.No; } // FLAGRUN MODE VARIABLEN if (Regex.Match(strVariable, @"Flagrun Mode").Success) { UnRegisterAllCommands(); if (strValue == "Yes") fm_isEnabled = enumBoolYesNo.Yes; if (strValue == "No") fm_isEnabled = enumBoolYesNo.No; RegisterAllCommands(); taskPlanerUpdateNeeded = true; } if (Regex.Match(strVariable, @"FM_PRoCon Config").Success) { List<string> tmpConfigList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); fmPRoConConfig = new List<string>(); foreach (string line in tmpConfigList) { string tmpline = line.Replace("|", "#LISTITEM#"); fmPRoConConfig.Add(tmpline); } } if (Regex.Match(strVariable, @"FM_Command Enable").Success) { if (strValue == "") strValue = "flagrun"; // Standardwert setzen fm_commandEnable = strValue; } if (Regex.Match(strVariable, @"FM_Rules").Success) { fm_Rules = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"FM_ClanWhitelist").Success) { fm_ClanWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"FM_PlayerWhitelist").Success) { fm_PlayerWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"FM_Server Name").Success) { fm_Servername = strValue; } if (Regex.Match(strVariable, @"FM_Server Description").Success) { fm_Serverdescription = strValue; } if (Regex.Match(strVariable, @"FM_Server Message").Success) { fm_ServerMessage = strValue; } if (Regex.Match(strVariable, @"FM_Vehicle Spawn Allowed").Success) { if (strValue == "Yes") fm_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "No") fm_VehicleSpawnAllowed = enumBoolYesNo.No; if (strValue == "True") fm_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "False") fm_VehicleSpawnAllowed = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"FM_Vehicle Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of FM_Vehicle Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of FM_Vehicle Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } fm_VehicleSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"FM_Player Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of PM_Player Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of FM_Player Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } fm_PlayerSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"FM_MapList").Success) { fm_MapList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"FM_Max Player Warns").Success) { fm_max_Warns = Convert.ToInt32(strValue); } if (Regex.Match(strVariable, @"FM_Player Action").Success) { fm_PlayerAction = strValue; } if (Regex.Match(strVariable, @"FM_TBan Minutes").Success) { fm_ActionTbanTime = Convert.ToInt32(strValue); } // KNIFE ONLY MODE VARIABLEN if (Regex.Match(strVariable, @"Knife Only Mode").Success) { UnRegisterAllCommands(); if (strValue == "Yes") kom_isEnabled = enumBoolYesNo.Yes; if (strValue == "No") kom_isEnabled = enumBoolYesNo.No; RegisterAllCommands(); taskPlanerUpdateNeeded = true; } if (Regex.Match(strVariable, @"KOM_PRoCon Config").Success) { List<string> tmpConfigList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); komPRoConConfig = new List<string>(); foreach (string line in tmpConfigList) { string tmpline = line.Replace("|", "#LISTITEM#"); komPRoConConfig.Add(tmpline); } } if (Regex.Match(strVariable, @"KOM_Command Enable").Success) { if (strValue == "") strValue = "flagrun"; // Standardwert setzen kom_commandEnable = strValue; } if (Regex.Match(strVariable, @"KOM_Rules").Success) { kom_Rules = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"KOM_ClanWhitelist").Success) { kom_ClanWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"KOM_PlayerWhitelist").Success) { kom_PlayerWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"KOM_Server Name").Success) { kom_Servername = strValue; } if (Regex.Match(strVariable, @"KOM_Server Description").Success) { kom_Serverdescription = strValue; } if (Regex.Match(strVariable, @"KOM_Server Message").Success) { kom_ServerMessage = strValue; } if (Regex.Match(strVariable, @"KOM_Vehicle Spawn Allowed").Success) { if (strValue == "Yes") kom_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "No") kom_VehicleSpawnAllowed = enumBoolYesNo.No; if (strValue == "True") kom_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "False") kom_VehicleSpawnAllowed = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"KOM_Vehicle Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of KOM_Vehicle Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of KOM_Vehicle Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } kom_VehicleSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"KOM_Player Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of PM_Player Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of KOM_Player Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } kom_PlayerSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"KOM_MapList").Success) { kom_MapList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"KOM_Max Player Warns").Success) { kom_max_Warns = Convert.ToInt32(strValue); } if (Regex.Match(strVariable, @"KOM_Player Action").Success) { kom_PlayerAction = strValue; } if (Regex.Match(strVariable, @"KOM_TBan Minutes").Success) { kom_ActionTbanTime = Convert.ToInt32(strValue); } // PISTOL ONLY MODE VARIABLEN if (Regex.Match(strVariable, @"Pistol Only Mode").Success) { UnRegisterAllCommands(); if (strValue == "Yes") pom_isEnabled = enumBoolYesNo.Yes; if (strValue == "No") pom_isEnabled = enumBoolYesNo.No; RegisterAllCommands(); taskPlanerUpdateNeeded = true; } if (Regex.Match(strVariable, @"POM_PRoCon Config").Success) { List<string> tmpConfigList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); pomPRoConConfig = new List<string>(); foreach (string line in tmpConfigList) { string tmpline = line.Replace("|", "#LISTITEM#"); pomPRoConConfig.Add(tmpline); } } if (Regex.Match(strVariable, @"POM_Command Enable").Success) { if (strValue == "") strValue = "flagrun"; // Standardwert setzen pom_commandEnable = strValue; } if (Regex.Match(strVariable, @"POM_Rules").Success) { pom_Rules = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"POM_ClanWhitelist").Success) { pom_ClanWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"POM_PlayerWhitelist").Success) { pom_PlayerWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"POM_Server Name").Success) { pom_Servername = strValue; } if (Regex.Match(strVariable, @"POM_Server Description").Success) { pom_Serverdescription = strValue; } if (Regex.Match(strVariable, @"POM_Server Message").Success) { pom_ServerMessage = strValue; } if (Regex.Match(strVariable, @"POM_Vehicle Spawn Allowed").Success) { if (strValue == "Yes") pom_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "No") pom_VehicleSpawnAllowed = enumBoolYesNo.No; if (strValue == "True") pom_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "False") pom_VehicleSpawnAllowed = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"POM_Vehicle Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of POM_Vehicle Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of POM_Vehicle Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } pom_VehicleSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"POM_Player Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of PM_Player Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of POM_Player Spawn Time","ERROR",0); WritePluginConsole("this Setting have to be between 5 and 100","ERROR",0); } pom_PlayerSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"POM_MapList").Success) { pom_MapList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"POM_Max Player Warns").Success) { pom_max_Warns = Convert.ToInt32(strValue); } if (Regex.Match(strVariable, @"POM_Player Action").Success) { pom_PlayerAction = strValue; } if (Regex.Match(strVariable, @"POM_TBan Minutes").Success) { pom_ActionTbanTime = Convert.ToInt32(strValue); } // NEW PISTOLS ( 0.0.3.0 ) if (Regex.Match(strVariable, @"POM_Allow").Success) { if (!isInitWeaponDictionarys) InitWeaponDictionarys(); // Init Dictionarys if not done yet ! string tmpVar = strVariable.Replace("POM_Allow " , ""); // Remove POM Indexer //if (!Allow_Handguns.ContainsKey(tmpVar)) Allow_Handguns.Add(tmpVar, enumBoolYesNo.No); // Create entry if not exist if (Allow_Handguns.ContainsKey(tmpVar)) { if (strValue == "Yes") Allow_Handguns[tmpVar] = enumBoolYesNo.Yes; if (strValue == "No") Allow_Handguns[tmpVar] = enumBoolYesNo.No; } } // SHOTGUN ONLY MODE VARIABLEN if (Regex.Match(strVariable, @"Shotgun Only Mode").Success) { UnRegisterAllCommands(); if (strValue == "Yes") sm_isEnabled = enumBoolYesNo.Yes; if (strValue == "No") sm_isEnabled = enumBoolYesNo.No; RegisterAllCommands(); taskPlanerUpdateNeeded = true; } if (Regex.Match(strVariable, @"SOM_PRoCon Config").Success) { List<string> tmpConfigList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); smPRoConConfig = new List<string>(); foreach (string line in tmpConfigList) { string tmpline = line.Replace("|", "#LISTITEM#"); smPRoConConfig.Add(tmpline); } } if (Regex.Match(strVariable, @"SOM_Command Enable").Success) { if (strValue == "") strValue = "flagrun"; // Standardwert setzen sm_commandEnable = strValue; } if (Regex.Match(strVariable, @"SOM_Rules").Success) { sm_Rules = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"SOM_ClanWhitelist").Success) { sm_ClanWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"SOM_PlayerWhitelist").Success) { sm_PlayerWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"SOM_Server Name").Success) { sm_Servername = strValue; } if (Regex.Match(strVariable, @"SOM_Server Description").Success) { sm_Serverdescription = strValue; } if (Regex.Match(strVariable, @"SOM_Server Message").Success) { sm_ServerMessage = strValue; } if (Regex.Match(strVariable, @"SOM_Vehicle Spawn Allowed").Success) { if (strValue == "Yes") sm_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "No") sm_VehicleSpawnAllowed = enumBoolYesNo.No; if (strValue == "True") sm_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "False") sm_VehicleSpawnAllowed = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"SOM_Vehicle Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of SOM_Vehicle Spawn Time", "ERROR", 0); WritePluginConsole("this Setting have to be between 5 and 100", "ERROR", 0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of SOM_Vehicle Spawn Time", "ERROR", 0); WritePluginConsole("this Setting have to be between 5 and 100", "ERROR", 0); } sm_VehicleSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"SOM_Player Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of PM_Player Spawn Time", "ERROR", 0); WritePluginConsole("this Setting have to be between 5 and 100", "ERROR", 0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of SOM_Player Spawn Time", "ERROR", 0); WritePluginConsole("this Setting have to be between 5 and 100", "ERROR", 0); } sm_PlayerSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"SOM_MapList").Success) { sm_MapList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"SOM_Max Player Warns").Success) { sm_max_Warns = Convert.ToInt32(strValue); } if (Regex.Match(strVariable, @"SOM_Player Action").Success) { sm_PlayerAction = strValue; } if (Regex.Match(strVariable, @"SOM_TBan Minutes").Success) { sm_ActionTbanTime = Convert.ToInt32(strValue); } if (Regex.Match(strVariable, @"SOM_Allow").Success) { if (!isInitWeaponDictionarys) InitWeaponDictionarys(); // Init Dictionarys if not done yet ! string tmpVar = strVariable.Replace("SOM_Allow ", ""); // Remove SOM Indexer if (Allow_Shotguns.ContainsKey(tmpVar)) { if (strValue == "Yes") Allow_Shotguns[tmpVar] = enumBoolYesNo.Yes; if (strValue == "No") Allow_Shotguns[tmpVar] = enumBoolYesNo.No; } } // BOLT ACTION ONLY MODE VARIABLEN if (Regex.Match(strVariable, @"BoltAction Only Mode").Success) { UnRegisterAllCommands(); if (strValue == "Yes") bam_isEnabled = enumBoolYesNo.Yes; if (strValue == "No") bam_isEnabled = enumBoolYesNo.No; RegisterAllCommands(); taskPlanerUpdateNeeded = true; } if (Regex.Match(strVariable, @"BAM_PRoCon Config").Success) { List<string> tmpConfigList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); bamPRoConConfig = new List<string>(); foreach (string line in tmpConfigList) { string tmpline = line.Replace("|", "#LISTITEM#"); bamPRoConConfig.Add(tmpline); } } if (Regex.Match(strVariable, @"BAM_Command Enable").Success) { if (strValue == "") strValue = "flagrun"; // Standardwert setzen bam_commandEnable = strValue; } if (Regex.Match(strVariable, @"BAM_Rules").Success) { bam_Rules = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"BAM_ClanWhitelist").Success) { bam_ClanWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"BAM_PlayerWhitelist").Success) { bam_PlayerWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"BAM_Server Name").Success) { bam_Servername = strValue; } if (Regex.Match(strVariable, @"BAM_Server Description").Success) { bam_Serverdescription = strValue; } if (Regex.Match(strVariable, @"BAM_Server Message").Success) { bam_ServerMessage = strValue; } if (Regex.Match(strVariable, @"BAM_Vehicle Spawn Allowed").Success) { if (strValue == "Yes") bam_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "No") bam_VehicleSpawnAllowed = enumBoolYesNo.No; if (strValue == "True") bam_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "False") bam_VehicleSpawnAllowed = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"BAM_Vehicle Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of BAM_Vehicle Spawn Time", "ERROR", 0); WritePluginConsole("this Setting have to be between 5 and 100", "ERROR", 0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of BAM_Vehicle Spawn Time", "ERROR", 0); WritePluginConsole("this Setting have to be between 5 and 100", "ERROR", 0); } bam_VehicleSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"BAM_Player Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of PM_Player Spawn Time", "ERROR", 0); WritePluginConsole("this Setting have to be between 5 and 100", "ERROR", 0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of BAM_Player Spawn Time", "ERROR", 0); WritePluginConsole("this Setting have to be between 5 and 100", "ERROR", 0); } bam_PlayerSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"BAM_MapList").Success) { bam_MapList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"BAM_Max Player Warns").Success) { bam_max_Warns = Convert.ToInt32(strValue); } if (Regex.Match(strVariable, @"BAM_Player Action").Success) { bam_PlayerAction = strValue; } if (Regex.Match(strVariable, @"BAM_TBan Minutes").Success) { bam_ActionTbanTime = Convert.ToInt32(strValue); } if (Regex.Match(strVariable, @"BAM_Allow").Success) { if (!isInitWeaponDictionarys) InitWeaponDictionarys(); // Init Dictionarys if not done yet ! string tmpVar = strVariable.Replace("BAM_Allow ", ""); // Remove SOM Indexer if (Allow_Boltaction.ContainsKey(tmpVar)) { if (strValue == "Yes") Allow_Boltaction[tmpVar] = enumBoolYesNo.Yes; if (strValue == "No") Allow_Boltaction[tmpVar] = enumBoolYesNo.No; } } // AUTOSNIPER (DMR) ONLY MODE VARIABLEN if (Regex.Match(strVariable, @"Autosniper Only Mode").Success) { UnRegisterAllCommands(); if (strValue == "Yes") dmr_isEnabled = enumBoolYesNo.Yes; if (strValue == "No") dmr_isEnabled = enumBoolYesNo.No; RegisterAllCommands(); taskPlanerUpdateNeeded = true; } if (Regex.Match(strVariable, @"DMR_PRoCon Config").Success) { List<string> tmpConfigList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); dmrPRoConConfig = new List<string>(); foreach (string line in tmpConfigList) { string tmpline = line.Replace("|", "#LISTITEM#"); dmrPRoConConfig.Add(tmpline); } } if (Regex.Match(strVariable, @"DMR_Command Enable").Success) { if (strValue == "") strValue = "flagrun"; // Standardwert setzen dmr_commandEnable = strValue; } if (Regex.Match(strVariable, @"DMR_Rules").Success) { dmr_Rules = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"DMR_ClanWhitelist").Success) { dmr_ClanWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"DMR_PlayerWhitelist").Success) { dmr_PlayerWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"DMR_Server Name").Success) { dmr_Servername = strValue; } if (Regex.Match(strVariable, @"DMR_Server Description").Success) { dmr_Serverdescription = strValue; } if (Regex.Match(strVariable, @"DMR_Server Message").Success) { dmr_ServerMessage = strValue; } if (Regex.Match(strVariable, @"DMR_Vehicle Spawn Allowed").Success) { if (strValue == "Yes") dmr_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "No") dmr_VehicleSpawnAllowed = enumBoolYesNo.No; if (strValue == "True") dmr_VehicleSpawnAllowed = enumBoolYesNo.Yes; if (strValue == "False") dmr_VehicleSpawnAllowed = enumBoolYesNo.No; } if (Regex.Match(strVariable, @"DMR_Vehicle Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of DMR_Vehicle Spawn Time", "ERROR", 0); WritePluginConsole("this Setting have to be between 5 and 100", "ERROR", 0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of DMR_Vehicle Spawn Time", "ERROR", 0); WritePluginConsole("this Setting have to be between 5 and 100", "ERROR", 0); } dmr_VehicleSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"DMR_Player Spawn Time").Success) { int tmpValue = Convert.ToInt32(strValue); if (tmpValue > 100) { tmpValue = 100; WritePluginConsole("Incorrect Value of PM_Player Spawn Time", "ERROR", 0); WritePluginConsole("this Setting have to be between 5 and 100", "ERROR", 0); } if (tmpValue < 5) { tmpValue = 5; WritePluginConsole("Incorrect Value of DMR_Player Spawn Time", "ERROR", 0); WritePluginConsole("this Setting have to be between 5 and 100", "ERROR", 0); } dmr_PlayerSpawnCount = tmpValue; } if (Regex.Match(strVariable, @"DMR_MapList").Success) { dmr_MapList = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } if (Regex.Match(strVariable, @"DMR_Max Player Warns").Success) { dmr_max_Warns = Convert.ToInt32(strValue); } if (Regex.Match(strVariable, @"DMR_Player Action").Success) { dmr_PlayerAction = strValue; } if (Regex.Match(strVariable, @"DMR_TBan Minutes").Success) { dmr_ActionTbanTime = Convert.ToInt32(strValue); } if (Regex.Match(strVariable, @"DMR_Allow").Success) { if (!isInitWeaponDictionarys) InitWeaponDictionarys(); // Init Dictionarys if not done yet ! string tmpVar = strVariable.Replace("DMR_Allow ", ""); // Remove DMR Indexer if (Allow_Autosniper.ContainsKey(tmpVar)) { if (strValue == "Yes") Allow_Autosniper[tmpVar] = enumBoolYesNo.Yes; if (strValue == "No") Allow_Autosniper[tmpVar] = enumBoolYesNo.No; } } // MAP PROHIBITED WEAPONS if (Regex.Match(strVariable, @"Add Map...").Success) { if (!isInitMapList) InitMapList(); if (isInitMapList) { if (MapNameList.Contains(strValue)) { if (!MapProhibitedWeapons.ContainsKey(strValue)) { List<string> tmpList = new List<string>(); MapProhibitedWeapons.Add(strValue, tmpList); } } } } if (isInitMapList) { if (MapNameList.Contains(strVariable)) { if (!MapProhibitedWeapons.ContainsKey(strVariable)) { List<string> tmpList = new List<string>(); MapProhibitedWeapons.Add(strVariable, tmpList); } } } if (MapProhibitedWeapons.ContainsKey(strVariable)) { MapProhibitedWeapons[strVariable] = (CheckWeaponList(CPluginVariable.DecodeStringArray(strValue))); } if (Regex.Match(strVariable, @"Remove Map...").Success) { if (MapProhibitedWeapons.ContainsKey(strValue)) { MapProhibitedWeapons.Remove(strValue); } } // GAME MODE PROHIBITED WEAPONS if (Regex.Match(strVariable, @"Add Game Mode...").Success) { if (!isInitMapList) InitMapList(); if (isInitMapList) { if (GameModeList.Contains(strValue)) { if (!ModeProhibitedWeapons.ContainsKey(strValue)) { List<string> tmpList = new List<string>(); ModeProhibitedWeapons.Add(strValue, tmpList); } } } } if (isInitMapList) { if (GameModeList.Contains(strVariable)) { if (!ModeProhibitedWeapons.ContainsKey(strVariable)) { List<string> tmpList = new List<string>(); ModeProhibitedWeapons.Add(strVariable, tmpList); } } } if (ModeProhibitedWeapons.ContainsKey(strVariable)) { ModeProhibitedWeapons[strVariable] = (CheckWeaponList(CPluginVariable.DecodeStringArray(strValue))); } if (Regex.Match(strVariable, @"Remove Game Mode...").Success) { if (ModeProhibitedWeapons.ContainsKey(strValue)) { ModeProhibitedWeapons.Remove(strValue); } } }
// ASSIGN values to program globals FROM server_ip.cfg public void SetPluginVariable(string strVariable, string strValue) { try { strValue = CPluginVariable.Decode(strValue); switch (strVariable) { case "Server Name Template": this.serverNameTemplate = strValue; break; case "Delay before kill": this.kill_delay = Int32.Parse(strValue); break; case "Tickets per Player": this.TicketsPerPlayer = Int32.Parse(strValue); break; case "Infractions Before Kick": this.infractionsBeforeKick = Int32.Parse(strValue); break; case "Infractions Before 2 Hour TBan": this.infractionsBeforeTBan = Int32.Parse(strValue); break; case "Protect 'reserved slots' players from Kick or Kill": this.protect_reservedslot_players = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); break; default: break; } //update proconrulz with whatever changes were made this.setProconRulz(); } catch (Exception ex) { ConsoleWrite(ex.Message); } }
public void SetPluginVariable(string variable, string value) { int i; switch (variable) { case VariableName.PunishCommand: _punishCommand = value.ToArray(); break; case VariableName.ForgiveCommand: _forgiveCommand = value.ToArray(); break; case VariableName.AllowKillersToApologizeToAvoidPunishment: _allowKillersToApologizeToAvoidPunishment = value.ToEnum <enumBoolYesNo>(); break; case VariableName.SorryCommand: _sorryCommand = value.ToArray(); break; case VariableName.ShameCommand: _shameCommand = value.ToArray(); break; case VariableName.KillerMessages: _killerMessages = value.ToArray(); break; case VariableName.VictimMessages: _victimMessages = value.ToArray(); break; case VariableName.PunishedMessage: _punishedMessage = value; break; case VariableName.ForgivenMessage: _forgivenMessage = value; break; case VariableName.ApologizedMessage: _apologizedMessage = value; break; case VariableName.KickMessage: _kickMessage = value; break; case VariableName.NoOneToPunishMessage: _noOneToPunishMessage = value; break; case VariableName.NoOneToForgiveMessage: _noOneToForgiveMessage = value; break; case VariableName.NoOneToApologizeToMessage: _noOneToApologizeToMessage = value; break; case VariableName.ShameAllOnRoundEnd: _shameAllOnRoundEnd = value.ToEnum <enumBoolYesNo>(); break; case VariableName.NoOneToShameOnRoundEndMessage: _noOneToShameOnRoundEndMessage = value; break; case VariableName.NoOneToShameMessage: _noOneToShameMessage = value; break; case VariableName.VictimWindow: if (!int.TryParse(value, out i)) { return; } if (i < VictimWindowMin) { i = VictimWindowMin; } if (i > VictimWindowMax) { i = VictimWindowMax; } _victimWindow = TimeSpan.FromSeconds(i); break; case VariableName.AutoAction: _autoAction = value.ToEnum <Action>(); break; case VariableName.HasPunishLimit: _hasPunishLimit = value.ToEnum <enumBoolYesNo>(); break; case VariableName.PunishLimit: if (!int.TryParse(value, out i)) { return; } if (i < PunishLimitMin) { i = PunishLimitMin; } if (i > PunishLimitMax) { i = PunishLimitMax; } _punishLimit = i; break; case VariableName.PlayerCountThresholdForKick: if (!int.TryParse(value, out i)) { return; } if (i < PlayerCountThresholdForKickMin) { i = PlayerCountThresholdForKickMin; } if (i > PlayerCountThresholdForKickMax) { i = PlayerCountThresholdForKickMax; } _playerCountThresholdForKick = i; break; case VariableName.Protected: _protect = value.ToEnum <Protect>(); break; case VariableName.Whitelist: _whitelist = value.ToArray(); break; case VariableName.ShouldSuicideCountAsATeamKill: _shouldSuicideCountAsATeamKill = value.ToEnum <enumBoolYesNo>(); break; case VariableName.OutputToChat: _outputToChat = value.ToEnum <Chat>(); break; case VariableName.UseAdKats: _useAdKats = value.ToEnum <enumBoolYesNo>(); if (_useAdKats == enumBoolYesNo.Yes && !IsAdKatsAvailable()) { WriteConsole("^8\"Use AdKats\" is \"Yes\", but AdKats is either not enabled or not yet fully initialized.^0"); } break; } }
public void SetPluginVariable(string strVariable, string strValue) { if (Regex.Match(strVariable, @"ExtraTaskPlaner_Callback").Success) { ExtraTaskPlaner_Callback(strValue); } if (Regex.Match(strVariable, @"Allow Public Spectators").Success) { enumBoolYesNo tmp = enumBoolYesNo.Yes; if (strValue == "No") tmp = enumBoolYesNo.No; allow_public_spectators = tmp; } if (Regex.Match(strVariable, @"Enable Spectators Player Count").Success) { int tmp = 15; int.TryParse(strValue, out tmp); enable_spectators_PlayerCount = tmp; } if (Regex.Match(strVariable, @"Disable Spectators Player Count").Success) { int tmp = 20; int.TryParse(strValue, out tmp); disable_spectators_PlayerCount = tmp; } if (Regex.Match(strVariable, @"Spectator Ports Count").Success) { int tmp = 2; int.TryParse(strValue, out tmp); spectator_PortsCount = tmp; } if (Regex.Match(strVariable, @"Debug level").Success) { int tmp = 2; int.TryParse(strValue, out tmp); DebugLevel = tmp; } }
// Allways be suspicious of strValue's actual value. A command in the console can // by the user can put any kind of data it wants in strValue. // use type.TryParse public void SetPluginVariable(string strVariable, string strValue) { if (strVariable.CompareTo("Servertype") == 0) { this.Servertype = strValue; } if (strVariable == "Maximum number of players to fetch at each interval") { int numPlayers = 1; Int32.TryParse(strValue, out numPlayers); if (numPlayers < 0 || numPlayers > 3) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^9TrueBalancer:^n ^8^bMaximum number of players to fetch must be between 0 and 3, inclusive!"); numPlayers = 1; } else if (numPlayers == 0) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^9TrueBalancer:^n ^1^bMaximum number of players to fetch set to 0, stats fetching is disabled!"); } else if (numPlayers != this.intMaxPlayersToFetch) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^9TrueBalancer:^n ^0^bMaximum number of players to fetch set to " + numPlayers); } this.intMaxPlayersToFetch = numPlayers; } if (strVariable.CompareTo("PRoCon - Scramble Teams on Roundend?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleRoundViaPRoCon = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("PRoCon - Scramble Teams on Roundend? Are you sure?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleRoundViaPRoConConf = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); if (this.ynbScrambleRoundViaPRoConConf == enumBoolYesNo.Yes) { OnScrambleViaPRoCon(); } } else if (strVariable.CompareTo("How many warnings?") == 0 && Int32.TryParse(strValue, out this.intWarnings) == true) { if (this.intWarnings > 0) { this.intWarnings = Convert.ToInt32(strValue); } else { this.intWarnings = 1; } } else if (strVariable.CompareTo("Enable Debug Mode for balancing guard") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbDebugModeGuard = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Enable Balancing Guard?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbBalancingGuard = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("CQ/TDM - Enable Shame Message?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbShameMessage = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("CQ/TDM - Shame Message") == 0) { this.strShameMessage = strValue; } else if (strVariable.CompareTo("CQ/TDM - Stop winning team switching, when x % TicketDiff (% of maxTickets)") == 0 && Int32.TryParse(strValue, out this.intScoreWTS) == true) { if (this.intScoreWTS > 0) { this.intScoreWTS = Convert.ToInt32(strValue); } else { this.intScoreWTS = 1; } } else if (strVariable.CompareTo("Rush - Start sorting at Difference of") == 0 && Double.TryParse(strValue, out this.dblValueDiffRUSH) == true) { if (this.dblValueDiffRUSH >= 0.01) { this.dblValueDiffRUSH = Convert.ToDouble(strValue); } else { this.dblValueDiffRUSH = 0.01; } } else if (strVariable.CompareTo("GM/CTF - Start sorting at Difference of") == 0 && Double.TryParse(strValue, out this.dblValueDiffGM) == true) { if (this.dblValueDiffGM >= 0.01) { this.dblValueDiffGM = Convert.ToDouble(strValue); } else { this.dblValueDiffGM = 0.01; } } else if (strVariable.CompareTo("Conquest - Start sorting at Difference of") == 0 && Double.TryParse(strValue, out this.dblValueDiffCONQUEST) == true) { if (this.dblValueDiffCONQUEST >= 0.01) { this.dblValueDiffCONQUEST = Convert.ToDouble(strValue); } else { this.dblValueDiffCONQUEST = 0.01; } } else if (strVariable.CompareTo("TDM - Start sorting at Difference of") == 0 && Double.TryParse(strValue, out this.dblValueDiffTDM) == true) { if (this.dblValueDiffTDM >= 0.01) { this.dblValueDiffTDM = Convert.ToDouble(strValue); } else { this.dblValueDiffTDM = 0.01; } } else if (strVariable.CompareTo("Rush - Sort by (same as Scramble by)") == 0) { this.ScrambleByRUSH = strValue; } else if (strVariable.CompareTo("GM/CTF - Sort by (same as Scramble by)") == 0) { this.ScrambleByGM = strValue; } else if (strVariable.CompareTo("DF - Sort by (same as Scramble by)") == 0) { this.ScrambleByDF = strValue; } else if (strVariable.CompareTo("Conquest - Sort by (same as Scramble by)") == 0) { this.ScrambleByCONQUEST = strValue; } else if (strVariable.CompareTo("TDM - Sort by (same as Scramble by)") == 0) { this.ScrambleByTDM = strValue; } else if (strVariable.CompareTo("Obliteration - Sort by (same as Scramble by)") == 0) { this.ScrambleByOB = strValue; } else if (strVariable.CompareTo("Time between Warnings in sec") == 0 && Int32.TryParse(strValue, out this.intInterval) == true) { if (this.intInterval > 0) { this.intInterval = Convert.ToInt32(strValue); } else { this.intInterval = 1; } } else if (strVariable.CompareTo("RUSH-Player Threshold") == 0 && Int32.TryParse(strValue, out this.intTreshRUSH) == true) { if (this.intTreshRUSH > 0) { this.intTreshRUSH = Convert.ToInt32(strValue); } else { this.intTreshRUSH = 0; } } else if (strVariable.CompareTo("RUSH-Allowing Player Difference below Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif1RUSH) == true) { if (this.intAllowDif1RUSH > 0) { this.intAllowDif1RUSH = Convert.ToInt32(strValue); } else { this.intAllowDif1RUSH = 1; } } else if (strVariable.CompareTo("RUSH-Allowing Player Difference equal to/above Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif2RUSH) == true) { if (this.intAllowDif2RUSH > 0) { this.intAllowDif2RUSH = Convert.ToInt32(strValue); } else { this.intAllowDif2RUSH = 1; } } else if (strVariable.CompareTo("RUSH-Stop balancing, when tickets till end") == 0 && Int32.TryParse(strValue, out this.intminScoreRUSH) == true) { this.intminScoreRUSH = Convert.ToInt32(strValue); } else if (strVariable.CompareTo("GM/CTF-Player Threshold") == 0 && Int32.TryParse(strValue, out this.intTreshGM) == true) { if (this.intTreshGM > 0) { this.intTreshGM = Convert.ToInt32(strValue); } else { this.intTreshGM = 0; } } else if (strVariable.CompareTo("GM/CTF-Allowing Player Difference below Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif1GM) == true) { if (this.intAllowDif1GM > 0) { this.intAllowDif1GM = Convert.ToInt32(strValue); } else { this.intAllowDif1GM = 1; } } else if (strVariable.CompareTo("GM/CTF-Allowing Player Difference equal to/above Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif2GM) == true) { if (this.intAllowDif2GM > 0) { this.intAllowDif2GM = Convert.ToInt32(strValue); } else { this.intAllowDif2GM = 1; } } else if (strVariable.CompareTo("DF-Player Threshold") == 0 && Int32.TryParse(strValue, out this.intTreshDF) == true) { if (this.intTreshDF > 0) { this.intTreshDF = Convert.ToInt32(strValue); } else { this.intTreshDF = 0; } } else if (strVariable.CompareTo("DF-Allowing Player Difference below Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif1DF) == true) { if (this.intAllowDif1DF > 0) { this.intAllowDif1DF = Convert.ToInt32(strValue); } else { this.intAllowDif1DF = 1; } } else if (strVariable.CompareTo("DF-Allowing Player Difference equal to/above Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif2DF) == true) { if (this.intAllowDif2DF > 0) { this.intAllowDif2DF = Convert.ToInt32(strValue); } else { this.intAllowDif2DF = 1; } } else if (strVariable.CompareTo("CQ-Player Threshold") == 0 && Int32.TryParse(strValue, out this.intTreshCONQUEST) == true) { if (this.intTreshCONQUEST > 0) { this.intTreshCONQUEST = Convert.ToInt32(strValue); } else { this.intTreshCONQUEST = 0; } } else if (strVariable.CompareTo("CQ-Allowing Player Difference below Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif1CONQUEST) == true) { if (this.intAllowDif1CONQUEST > 0) { this.intAllowDif1CONQUEST = Convert.ToInt32(strValue); } else { this.intAllowDif1CONQUEST = 1; } } else if (strVariable.CompareTo("CQ-Allowing Player Difference equal to/above Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif2CONQUEST) == true) { if (this.intAllowDif2CONQUEST > 0) { this.intAllowDif2CONQUEST = Convert.ToInt32(strValue); } else { this.intAllowDif2CONQUEST = 1; } } else if (strVariable.CompareTo("CQ-Stop balancing, when tickets till end") == 0 && Int32.TryParse(strValue, out this.intminScoreCONQUEST) == true) { this.intminScoreCONQUEST = Convert.ToInt32(strValue); } else if (strVariable.CompareTo("DOM-Player Threshold") == 0 && Int32.TryParse(strValue, out this.intTreshDOM) == true) { if (this.intTreshDOM > 0) { this.intTreshDOM = Convert.ToInt32(strValue); } else { this.intTreshDOM = 0; } } else if (strVariable.CompareTo("DOM-Allowing Player Difference below Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif1DOM) == true) { if (this.intAllowDif1DOM > 0) { this.intAllowDif1DOM = Convert.ToInt32(strValue); } else { this.intAllowDif1DOM = 1; } } else if (strVariable.CompareTo("DOM-Allowing Player Difference equal to/above Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif2DOM) == true) { if (this.intAllowDif2DOM > 0) { this.intAllowDif2DOM = Convert.ToInt32(strValue); } else { this.intAllowDif2DOM = 1; } } else if (strVariable.CompareTo("DOM-Stop balancing, when tickets till end") == 0 && Int32.TryParse(strValue, out this.intminScoreDOM) == true) { this.intminScoreDOM = Convert.ToInt32(strValue); } else if (strVariable.CompareTo("TDM-Player Threshold") == 0 && Int32.TryParse(strValue, out this.intTreshTDM) == true) { if (this.intTreshTDM> 0) { this.intTreshTDM= Convert.ToInt32(strValue); } else { this.intTreshTDM= 0; } } else if (strVariable.CompareTo("TDM-Allowing Player Difference below Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif1TDM) == true) { if (this.intAllowDif1TDM> 0) { this.intAllowDif1TDM= Convert.ToInt32(strValue); } else { this.intAllowDif1TDM= 1; } } else if (strVariable.CompareTo("TDM-Allowing Player Difference equal to/above Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif2TDM) == true) { if (this.intAllowDif2TDM> 0) { this.intAllowDif2TDM= Convert.ToInt32(strValue); } else { this.intAllowDif2TDM= 1; } } else if (strVariable.CompareTo("TDM-Stop balancing, when tickets till end") == 0 && Int32.TryParse(strValue, out this.intminScoreTDM) == true) { this.intminScoreTDM = Convert.ToInt32(strValue); } else if (strVariable.CompareTo("OB-Player Threshold") == 0 && Int32.TryParse(strValue, out this.intTreshOB) == true) { if (this.intTreshOB > 0) { this.intTreshOB = Convert.ToInt32(strValue); } else { this.intTreshOB = 0; } } else if (strVariable.CompareTo("OB-Allowing Player Difference below Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif1OB) == true) { if (this.intAllowDif1OB > 0) { this.intAllowDif1OB = Convert.ToInt32(strValue); } else { this.intAllowDif1OB = 1; } } else if (strVariable.CompareTo("OB-Allowing Player Difference equal to/above Threshold") == 0 && Int32.TryParse(strValue, out this.intAllowDif2OB) == true) { if (this.intAllowDif2OB > 0) { this.intAllowDif2OB = Convert.ToInt32(strValue); } else { this.intAllowDif2OB = 1; } } else if (strVariable.CompareTo("OB-Stop balancing, when tickets till end") == 0 && Int32.TryParse(strValue, out this.intminScoreOB) == true) { this.intminScoreOB = Convert.ToInt32(strValue); } else if (strVariable.CompareTo("Show ingame warnings?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbShowWarnings = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Warning Message") == 0) { this.strWarning = strValue; } else if (strVariable.CompareTo("Show ingame balancing message?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbShowBallancing = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Balancing Message") == 0) { this.strLastWarning = strValue; } else if (strVariable.CompareTo("Show private message to moved player?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbShowPlayermessage = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Message for moved Player") == 0) { this.strBeenMoved = strValue; } else if (strVariable.CompareTo("Enable Command: !scrambleround") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbEnableScrambleRound = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Enable Command: !scramblenow") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbEnableScrambleNow = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Show Scrambling messages to the server?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleMessage = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Yell messages to the server?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbYellScrambleManuall = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Message when admin requests a scramble at roundend") == 0) { this.strScrambleRoundMsg = strValue; } else if (strVariable.CompareTo("Message when admin requests a scramble now") == 0) { this.strScrambleNowMsg = strValue; } else if (strVariable.CompareTo("Message when scrambling is done") == 0) { this.strScrambleDoneMsg = strValue; } else if (strVariable.CompareTo("Yell scramble message at roundend?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbYellScrambleMessage = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("What to do with squads?") == 0) { this.strScrambleMode = strValue; } else if (strVariable.CompareTo("ClanTag-List: Keep squad, if at least one player uses one of these ClanTags") == 0) { this.strAClantagWhitelistScrambler = CPluginVariable.DecodeStringArray(strValue); } else if (strVariable.CompareTo("RUSH-Scramble teams on every new map?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbenableSkillRUSH = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("RUSH-Scramble by") == 0) { this.ScrambleByRUSH = strValue; } else if (strVariable.CompareTo("GM/CTF-Scramble teams on every new map?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbenableSkillGM = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("GM/CTF-Scramble by") == 0) { this.ScrambleByGM = strValue; } else if (strVariable.CompareTo("DF-Scramble teams on every new map?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbenableSkillDF = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("DF-Scramble by") == 0) { this.ScrambleByDF = strValue; } //else if (strVariable.CompareTo("OB-Scramble teams on every new map?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) //{ // this.ynbenableSkillOB = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); //} //else if (strVariable.CompareTo("OB-Scramble by") == 0) //{ // this.ScrambleByOB = strValue; //} else if (strVariable.CompareTo("CQ-Enable Skillscrambler?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbenableSkillCONQUEST = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("CQ-Scramble on every new map no matter what score?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleMapCONQUEST = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("CQ-Check balance on every new Round (else on new Map only)") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleEveryRoundCONQUEST = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } if (strVariable.CompareTo("CQ-Scramble, if x % Tickets difference (% of maxTickets)") == 0 && Int32.TryParse(strValue, out this.intwonTicketsCONQUEST) == true) { if (this.intwonTicketsCONQUEST >= 0) { this.intwonTicketsCONQUEST = Convert.ToInt32(strValue); } else { this.intwonTicketsCONQUEST = 0; } } else if (strVariable.CompareTo("CQ-Scrambling Message at roundend") == 0) { this.strScrambleMessageCONQUEST = strValue; } else if (strVariable.CompareTo("CQ-Scramble by") == 0) { this.ScrambleByCONQUEST = strValue; } else if (strVariable.CompareTo("DOM-Enable Skillscrambler?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbenableSkillDOM = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("DOM-Scramble on every new map no matter what score?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleMapDOM = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("DOM-Check balance on every new Round (else on new Map only)") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleEveryRoundDOM = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } if (strVariable.CompareTo("DOM-Scramble, if x % Tickets difference (% of maxTickets)") == 0 && Int32.TryParse(strValue, out this.intwonTicketsDOM) == true) { if (this.intwonTicketsDOM >= 0) { this.intwonTicketsDOM = Convert.ToInt32(strValue); } else { this.intwonTicketsDOM = 0; } } else if (strVariable.CompareTo("DOM-Scrambling Message at roundend") == 0) { this.strScrambleMessageDOM = strValue; } else if (strVariable.CompareTo("DOM-Scramble by") == 0) { this.ScrambleByDOM = strValue; } else if (strVariable.CompareTo("OB-Enable Skillscrambler?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbenableSkillOB = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("OB-Scramble on every new map no matter what score?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleMapOB = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("OB-Check balance on every new Round (else on new Map only)") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleEveryRoundOB = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } if (strVariable.CompareTo("OB-Scramble, if x % Tickets difference (% of maxTickets)") == 0 && Int32.TryParse(strValue, out this.intwonTicketsOB) == true) { if (this.intwonTicketsOB >= 0) { this.intwonTicketsOB = Convert.ToInt32(strValue); } else { this.intwonTicketsOB = 0; } } else if (strVariable.CompareTo("OB-Scrambling Message at roundend") == 0) { this.strScrambleMessageOB = strValue; } else if (strVariable.CompareTo("OB-Scramble by") == 0) { this.ScrambleByOB = strValue; } else if (strVariable.CompareTo("TDM-Enable Skillscrambler?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbenableSkillTDM = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("TDM-Scramble on every new map no matter what score?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleMapTDM = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("TDM-Check balance on every new Round (else on new Map only)") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbScrambleEveryRoundTDM = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } if (strVariable.CompareTo("TDM-Scramble, if x % Tickets difference (% of maxTickets)") == 0 && Int32.TryParse(strValue, out this.intwonTicketsTDM) == true) { if (this.intwonTicketsTDM >= 0) { this.intwonTicketsTDM = Convert.ToInt32(strValue); } else { this.intwonTicketsTDM = 0; } } if (strVariable.CompareTo("TDM-Show Scramble message at roundend when x Tickets are reached") == 0 && Int32.TryParse(strValue, out this.intshowTicketsTDM) == true) { if (this.intshowTicketsTDM >= 0) { this.intshowTicketsTDM = Convert.ToInt32(strValue); } else { this.intshowTicketsTDM = 5; } } else if (strVariable.CompareTo("TDM-Scrambling Message at roundend") == 0) { this.strScrambleMessageTDM = strValue; } else if (strVariable.CompareTo("TDM-Scramble by") == 0) { this.ScrambleByTDM = strValue; } else if (strVariable.CompareTo("Enable Debug Mode for normal balancing") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbDebugMode = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Enable Debug Mode for skill balancing") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbDebugModeSkill = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Enable Whitelist") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbWhitelist = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Whitelist ClanTags") == 0) { this.strAClantagWhitelist = CPluginVariable.DecodeStringArray(strValue); } else if (strVariable.CompareTo("Whitelist Names") == 0) { this.strAWhitelist = CPluginVariable.DecodeStringArray(strValue); } else if (strVariable.CompareTo("Include VIP/Reserved Slots List into the whitelist?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbincludeVIPlist = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Show Balancing Moves (PlayerNumber Skill and Guard)") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.showMoves = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Check for Update?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.Check4Update = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } //PURE else if (strVariable.CompareTo("Minimum population to start maintaining squads") == 0 && Int32.TryParse(strValue, out this.intPopMaintainSquads) == true) { if (this.intPopMaintainSquads >= 0) { this.intPopMaintainSquads = Convert.ToInt32(strValue); } else { this.intPopMaintainSquads = 1; } } else if (strVariable.CompareTo("Enable TB score chat output when scrambling") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynEnableTBValueToChat = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } if (strVariable == "Enable Virtual Mode?" && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ynbVirtualMode = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); this.boolVirtual = (this.ynbVirtualMode == enumBoolYesNo.Yes); if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^9TrueBalancer:^n ^1^bVirtual mode is ENABLED!^n^0 No player moves or say/yells will be sent to the game server."); } } }
public void SetPluginVariable(string strVariable, string strValue) { int iValue = 16; //COUNTRY VARIABLES if (strVariable.CompareTo("Action") == 0) { this.strSelectType = strValue; } else if (strVariable.CompareTo("Country list") == 0) { if (strValue.CompareTo("N/A") != 0) { this.lsSelectedCountries.Add(strValue); } } else if (strVariable.CompareTo("Selected countries") == 0) { this.lsSelectedCountries = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } else if (strVariable.CompareTo("Enable Country based kick?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.enableCountryKick = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Country kick message") == 0) { this.strCountryKickMessage = strValue; } // PING VARIABLES else if (strVariable.CompareTo("Enable high ping kick?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.enablePingKick = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Ping limit") == 0 && int.TryParse(strValue, out iValue) == true) { this.intPingLimit = iValue; } else if (strVariable.CompareTo("High ping kick message") == 0) { this.strPingKickMessage = strValue; } else if (strVariable.CompareTo("Ping Kick Method") == 0) { this.strPingMethod = strValue; } else if (strVariable.CompareTo("Instant kick no ping?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.enableNoPingKick = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Pings to sample for average") == 0 && int.TryParse(strValue, out iValue) == true) { if (iValue < this.intAverageMinCount) { this.intAverageMinCount = iValue; } this.intAverageAccuracy = iValue; } else if (strVariable.CompareTo("Minimum pings before kicking") == 0 && int.TryParse(strValue, out iValue) == true) { if (iValue > this.intAverageAccuracy) { this.intAverageMinCount = this.intAverageAccuracy; } else { this.intAverageMinCount = iValue; } } // GENERAL VARIABLES else if (strVariable.CompareTo("Minimum players before rule enforced (0: none)") == 0 && int.TryParse(strValue, out iValue) == true) { this.intPlayerLimit = iValue; } else if (strVariable.CompareTo("Whitelist") == 0) { this.lsWhitelist = new List<string>(CPluginVariable.DecodeStringArray(strValue)); } else if (strVariable.CompareTo("Debug messages?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.debugMessages = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Display plugin update message?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.displayVersionMessage = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); if(this.displayVersionMessage == enumBoolYesNo.No) { this.ExecuteCommand("procon.protected.tasks.remove", "VersionTrackerTask"); } } else if (strVariable.CompareTo("Yell or Say ingame message") == 0) { this.strIngameType = strValue; } else if (strVariable.CompareTo("Ingame messages?") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ingameMessage = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } }
public TrueBalancer() { //lastupdatecheck = DateTime.Now.AddHours(-4); this.bclient = new BattlelogClient(this); this.dicPlayerCache = new Dictionary<string, CPlayerJoinInf>(); this.dicPlayerScore = new Dictionary<int, CPlayerScoreInf>(); this.dicSquadScore = new Dictionary<int, CSquadScoreInf>(); this.dicSquadList = new Dictionary<string, int>(); this.OnCommandMove = new Dictionary<string,bool>(); this.OnCommandMoveDone = new List<string>(); this.Servertype = "AUTOMATIC"; //this.strAWhitelist = new string[] { "HRPanter", "Name two", "Name three" }; //this.strAClantagWhitelist = new string[] { "FoC", "ClanTag2", "ClanTag3" }; //this.strAClantagWhitelistScrambler = new string[] { "FoC", "FoCr", "ClanTag3" }; ; this.strAWhitelist = new string[] { "HRPanter" }; this.strAClantagWhitelist = new string[] { "FoC" }; this.strAClantagWhitelistScrambler = new string[] { "FoC", "FoCr" }; ; this.strAWhitelistComplete = new string[] { }; this.teamswitcher = new List<string>(); this.BalancedPlayers = new List<string>(); //this.PlayersOnServer = new List<string>(new string[] {"Z1", "Z2", "HRPanter"}); //panter this.strWarning = "EVEN TEAMS! Autobalancing teams shortly."; this.strLastWarning = "AUTOBALANCING [Player: %MovedPlayer%]"; this.strBeenMoved = "You got balanced, because you have a low score and died."; this.strMovedPlayer = ""; this.strJoinedPlayerName = ""; this.strShameMessage = "%TeamSwitcher% tried to switch into the winning team. SHAME ON YOU!"; this.strScrambleDoneMsg = "Teams are scrambled now. Good luck all!"; this.strScrambleNowMsg = "Teams are going to be scrambled now. This may take up to 20 seconds!"; this.strScrambleRoundMsg = "Teams are going to be scrambled on next round!"; this.strFinalSquad = ""; this.strErrorMsg = ""; this.strdeadplayer = ""; this.intInterval = 15; this.intWarnings = 1; this.intTimerWait = 15; this.intI = 0; this.TeamA = 0; this.TeamB = 0; this.intPlayerDif = 0; this.intToTeam = 0; this.intFromTeam = 0; this.intNewTeam = 0; this.intcountWarnings = 0; this.intWaitSeconds = 0; this.intScoreTeamA = 0; this.intScoreTeamB = 0; this.bestSquadTeamID = 0; this.intCurrentRoundCount = 100; this.intTicketsdif = -1; this.intMaxSlots = 0; this.intScrambledPlayers = 0; this.intSquadA = 0; this.intSquadB = 0; this.intScrambleCount = 0; this.intPlayerCache = 15; this.dblValueDiffRUSH = 10; this.dblValueDiffCONQUEST = 10; this.dblValueDiffDOM = 10; this.dblValueDiffTDM = 10; this.dblValueDiffGM = 10; this.intScoreWTS = 50; this.intTicketcount = 123987123; this.rankA = 0; this.rankB = 0; this.skillA = 0; this.skillB = 0; this.spmA = 0; this.spmB = 0; this.spmcombatA = 0; this.spmcombatB = 0; this.kdrA = 0; this.kdrB = 0; this.TBvalueA = 0; this.TBvalueB = 0; this.ynbDebugMode = enumBoolYesNo.No; this.ynbDebugModeSkill = enumBoolYesNo.No; this.ynbDebugModeGuard = enumBoolYesNo.No; //this.ynbWhitelist = enumBoolYesNo.No; this.ynbWhitelist = enumBoolYesNo.Yes; this.ynbShowWarnings = enumBoolYesNo.Yes; this.ynbShowBallancing = enumBoolYesNo.Yes; this.ynbShowPlayermessage = enumBoolYesNo.Yes; this.ynbLoneWolf = enumBoolYesNo.Yes; //this.ynbincludeVIPlist = enumBoolYesNo.No; this.ynbincludeVIPlist = enumBoolYesNo.Yes; //this.ynbShameMessage = enumBoolYesNo.Yes; //this.ynbBalancingGuard = enumBoolYesNo.No; this.ynbShameMessage = enumBoolYesNo.No; this.ynbBalancingGuard = enumBoolYesNo.Yes; this.ynbScrambleMessage = enumBoolYesNo.Yes; this.ynbEnableScrambleNow = enumBoolYesNo.No; this.ynbEnableScrambleRound = enumBoolYesNo.Yes; this.ynbYellScrambleManuall = enumBoolYesNo.Yes; this.ynbYellScrambleMessage = enumBoolYesNo.Yes; this.ynbScrambleRoundViaPRoCon = enumBoolYesNo.No; this.ynbScrambleRoundViaPRoConConf = enumBoolYesNo.No; this.backswitcher = false; this.boolplayerleft = false; this.m_isPluginEnabled = false; this.boolplayerexists = false; this.boolneedbalance = false; this.booltimer = false; this.boolstartBalance = false; this.boolLevelStart = false; this.boolLevelLoaded = true; this.boolRoundOver = false; this.boolgametype = false; this.boolafterBalance = false; this.boolFirstOP = false; this.boolfirstwarningWL = false; this.boolmanuellchange = false; this.boolnoplayer = false; this.boolscrambleActive = false; this.boolscrambleNow = false; this.boolTeamsScrambled = false; this.DTScramblestarted = new DateTime(); this.boolRunOnList = false; this.boolticketdif = false; this.boolwaitfordeath = false; this.boolwaitdead = false; this.boolfirstscrambler = false; this.boolscramblefailed = false; this.boolmessagesent = false; this.boolbalanced = true; this.boolscramblebyadminroundend = false; this.showfirstmove = true; this.TSLevelStartWait = new TimeSpan(0); this.DTLevelStart = new DateTime(); this.DTLevelLoaded = new DateTime(); this.intAllowDif = 500; this.intminScore = 500; this.intminScoreRUSH = 15; this.intTreshRUSH = 24; this.intAllowDif1RUSH = 1; this.intAllowDif2RUSH = 2; this.intTreshGM = 16; this.intAllowDif1GM = 1; this.intAllowDif2GM = 2; this.intTreshDF = 16; this.intAllowDif1DF = 1; this.intAllowDif2DF = 2; this.intminScoreCONQUEST = 100; this.intTreshCONQUEST = 24; this.intAllowDif1CONQUEST = 1; this.intAllowDif2CONQUEST = 2; this.intminScoreDOM = 100; this.intTreshDOM = 24; this.intAllowDif1DOM = 1; this.intAllowDif2DOM = 2; this.intminScoreOB = 1; this.intTreshOB = 24; this.intAllowDif1OB = 1; this.intAllowDif2OB = 2; this.intminScoreTDM = 25; this.intTreshTDM = 24; this.intAllowDif1TDM = 1; this.intAllowDif2TDM = 2; //this.strScrambleMode = "Keep squads with two or more clanmates"; this.strScrambleMode = "Keep all Squads"; this.ynbenableSkillRUSH = enumBoolYesNo.No; this.ynbScrambleMapRUSH = enumBoolYesNo.No; this.ScrambleByRUSH = "TB-Value"; this.ynbenableSkillGM = enumBoolYesNo.No; this.ynbScrambleMapGM = enumBoolYesNo.No; this.ScrambleByGM = "TB-Value"; this.ynbenableSkillDF = enumBoolYesNo.No; this.ynbScrambleMapDF = enumBoolYesNo.No; this.ScrambleByDF = "TB-Value"; //this.ynbenableSkillOB = enumBoolYesNo.No; //this.ynbScrambleMapOB = enumBoolYesNo.No; //this.ScrambleByOB = "TB-Value"; //this.ynbenableSkillCONQUEST = enumBoolYesNo.No; this.ynbenableSkillCONQUEST = enumBoolYesNo.Yes; this.ynbScrambleMapCONQUEST = enumBoolYesNo.No; this.ynbScrambleEveryRoundCONQUEST = enumBoolYesNo.No; this.intwonTicketsCONQUEST = 50; this.strScrambleMessageCONQUEST = "SCRAMBLING teams next round. Ticketdifference too big. Squads will be kept together."; this.ScrambleByCONQUEST = "TB-Value"; this.ynbenableSkillDOM = enumBoolYesNo.Yes; this.ynbScrambleMapDOM = enumBoolYesNo.No; this.ynbScrambleEveryRoundDOM = enumBoolYesNo.No; this.intwonTicketsDOM = 50; this.strScrambleMessageDOM = "SCRAMBLING teams next round. Ticketdifference too big. Squads will be kept together."; this.ScrambleByDOM = "TB-Value"; //this.ynbenableSkillOB = enumBoolYesNo.No; this.ynbenableSkillOB = enumBoolYesNo.Yes; this.ynbScrambleMapOB = enumBoolYesNo.No; this.ynbScrambleEveryRoundOB = enumBoolYesNo.No; this.intwonTicketsOB = 50; this.strScrambleMessageOB = "SCRAMBLING teams next round. Ticketdifference too big. Squads will be kept together."; this.ScrambleByOB = "TB-Value"; //this.ynbenableSkillTDM = enumBoolYesNo.No; this.ynbenableSkillTDM = enumBoolYesNo.Yes; this.ynbScrambleMapTDM = enumBoolYesNo.No; this.ynbScrambleEveryRoundTDM = enumBoolYesNo.No; this.intwonTicketsTDM = 50; this.intshowTicketsTDM = 50; this.strScrambleMessageTDM = "SCRAMBLING teams next round. Ticketdifference too big. Squads will be kept together."; this.ScrambleByTDM = "TB-Value"; this.TSForceMove = new TimeSpan(0); this.DTForceMove = new DateTime(); this.EndRoundSeconds = new TimeSpan(0); this.EndRoundTime = new DateTime(); this.boolVirtual = false; this.ynbVirtualMode = enumBoolYesNo.No; this.intMaxPlayersToFetch = 2; showMoves = enumBoolYesNo.No; Check4Update = enumBoolYesNo.Yes; //PURE this.intPopMaintainSquads = 0; this.ynEnableTBValueToChat = enumBoolYesNo.Yes; }
// Allways be suspicious of strValue's actual value. A command in the console can // by the user can put any kind of data it wants in strValue. // use type.TryParse public void SetPluginVariable(string strVariable, string strValue) { int iTmp; this.UnregisterAllCommands(); if (strVariable.CompareTo("Ping Interval") == 0) { if (int.TryParse(strValue, out iTmp) && iTmp > 0) { this.strPingInterval = strValue; this.ExecuteCommand("procon.protected.tasks.remove", "CPingPlayersWorker"); this.ExecuteCommand("procon.protected.tasks.add", "CPingPlayersWorker", "5", this.strPingInterval, "-1", "procon.protected.plugins.call", "CPingPlayers", "PingAllPlayers"); } } else if (strVariable.CompareTo("Max. Ping") == 0) { if (int.TryParse(strValue, out iTmp) && iTmp > 0) { this.iMaxPing = iTmp; } } else if (strVariable.CompareTo("Grace Period") == 0) { if (int.TryParse(strValue, out iTmp) && iTmp > 0) { this.iGracePeriod = iTmp; } } else if (strVariable.CompareTo("Ping Timeout") == 0) { if (int.TryParse(strValue, out iTmp) && iTmp > 0) { this.iPingTimeout = iTmp; } } else if (strVariable.CompareTo("Kick Reason") == 0) { this.strKickReason = strValue; } else if (strVariable.CompareTo("White List") == 0) { this.lstWhiteList = new List <string>(CPluginVariable.DecodeStringArray(strValue)); } else if (strVariable.CompareTo("Ingame Warnings") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ebIngameWarnings = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Debug Messages") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.ebDebugMessages = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Ingame Command Own Ping") == 0) { this.strIngameCommandOwn = strValue; } else if (strVariable.CompareTo("Ingame Command Other Player's Ping") == 0) { this.strIngameCommandPlayer = strValue; } else if (strVariable.CompareTo("Ping-Reply Storage Length") == 0) { if (int.TryParse(strValue, out iTmp) && iTmp > 0) { this.iPingStorageLength = iTmp; } } this.RegisterAllCommands(); }
public void OnScrambleViaPRoCon() { this.ynbScrambleRoundViaPRoConConf = enumBoolYesNo.No; this.ynbScrambleRoundViaPRoCon = enumBoolYesNo.No; if (this.ynbEnableScrambleRound == enumBoolYesNo.Yes) { if (this.boolLevelStart) { this.DebugInfoSkill("^1Admin requested a scramble for next round!"); this.boolscramblebyadminroundend = true; 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"); this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^9TrueBalancer:^n Teams will be scrambled at RoundEnd"); } if (this.ynbYellScrambleManuall == enumBoolYesNo.Yes && !this.boolVirtual) { this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleRoundMsg, "30"); } } } } else { this.DebugInfoSkill("^3You can only request for a scramble, if a round is running."); } } else { this.DebugInfoSkill("You need to activate and setup !scrambleround at '2.5 Skill-Scrambler: Manual Commands'"); } }
public AccessRestriction() { this.lstPlayerList = new List<CPlayerInfo>(); //this.m_LastUpdated = null; this.m_RoCAccepted = enumBoolYesNo.No; this.m_BanGUID = enumBoolYesNo.No; this.m_RankKicker = enumBoolOnOff.Off; this.m_AccessLimitation = enumBoolOnOff.Off; this.m_RankLimit = 50; this.m_TempBanPlayers = enumBoolYesNo.No; this.m_PermBanPlayers = enumBoolYesNo.No; this.m_TempBanTime = 60; this.m_BanAfterKicks = enumBoolYesNo.No; this.m_KicksBeforeBan = 3; this.m_KickReason = "You got kicked due to your Player Rank being too high!"; this.m_BanReason = "You got banned for %bt% minutes due to your Player Rank being too high!"; this.m_PermBanReason = "You permanently got banned due to your Player Rank being too high!"; this.m_IsPluginEnabled = false; this.m_RankKickerOnOff = enumBoolOnOff.On; this.m_ConsoleLog = enumBoolYesNo.Yes; this.m_ClearAll = enumBoolYesNo.No; this.m_WhiteList = new List<string>(); this.m_ClanTagWhiteList = enumBoolYesNo.No; this.m_WhiteListClanTags = new List<string>(); this.m_AllowedClanTags = new List<string>(); this.m_AccessLimitationPlayers = enumBoolYesNo.No; this.m_AccessLimitationTags = enumBoolYesNo.No; this.m_AllowedPlayers = new List<string>(); this.m_AccessBanPlayers = enumBoolYesNo.No; this.m_AccessKickReason = "Sorry for the kick, dude! This is a private match!"; this.m_AccessPermBanReason = "Sorry for the ban, dude! This is a private match!"; this.m_ModeratedClanTags = new List<string>(); this.m_AllowedClanPlayers = new List<string>(); this.m_ClanTagModeration = enumBoolOnOff.Off; this.m_ClanTagBanPlayers = enumBoolYesNo.No; this.m_ClanTagKickReason = "You got kicked for using a clantag by unfair means!"; this.m_ClanTagPermBanReason = "You got banned for using a clantag by unfair means!"; this.m_DisallowedClanTags = new List<string>(); this.m_DisallowedTags = enumBoolOnOff.Off; this.m_DisallowedTagsBan = enumBoolYesNo.No; this.m_DisallowedTagsKickReason = "Your clan isn't welcome on this server! You got kicked!"; this.m_DisallowedTagsBanReason = "Your clan isn't welcome on this server! You got banned permanently!"; this.m_AutomaticallyClearCache = enumBoolYesNo.Yes; this.m_CacheClearRounds = 6; }
public Currency() { this.m_ebynEnableAutoBounties = enumBoolYesNo.No; this.m_ebynPublicAutoBountyNotifications = enumBoolYesNo.Yes; this.m_ebynSayAutoBountyNotifications = enumBoolYesNo.Yes; this.m_ebynYellAutoBountyNotifications = enumBoolYesNo.No; this.m_ebynEnablePlayerBounties = enumBoolYesNo.No; this.m_ebynPublicPlayerBountyNotifications = enumBoolYesNo.Yes; this.m_ebynSayPlayerBountyNotifications = enumBoolYesNo.Yes; this.m_ebynYellPlayerBountyNotifications = enumBoolYesNo.No; this.m_ebynEnableMugging = enumBoolYesNo.No; this.m_ebynEnableMuggingLimit = enumBoolYesNo.No; this.m_ebynSayStrMugged = enumBoolYesNo.Yes; this.m_ebynYellStrMugged = enumBoolYesNo.No; this.m_ebynSpamPluginConsole = enumBoolYesNo.Yes; this.m_ebynAllowAdminPrivileges = enumBoolYesNo.No; this.m_ebynEnablePayroll = enumBoolYesNo.No; this.m_ebynPayForKills = enumBoolYesNo.No; this.m_ebynDeductForDeaths = enumBoolYesNo.No; this.m_ebynPayForSpecificWeaponKills = enumBoolYesNo.No; this.m_ebynPayForHeadshots = enumBoolYesNo.No; //Added for TK Yes/No Selection this.m_ebynEnableTKStop = enumBoolYesNo.Yes; this.m_iAutoBountyStreak = 5; this.m_iAutoBountyStartingBounty = 2; this.m_iAutoBountyIncreasePerKill = 1; this.m_iAutoBountyNotificationsYellLength = 5; this.m_iPlayerBountyNotificationsYellLength = 5; this.m_iMuggingPercentStolen = 1; this.m_iMuggingLimit = 50; this.m_iStrMuggedYellLength = 5; this.m_iItemCount = 0; this.m_iPayrollAmount = 500; this.m_iPayrollFrequency = 30; this.m_iAmountPaidPerKill = 0; this.m_iAmountLostPerDeath = 0; this.m_iAmountPaidPerHeadshot = 0; this.m_iSpecificWeaponPay = 0; this.m_strAutoBountyPosted = "A %amount CC$ bounty has been put on %killer's head for her %streak kill streak!"; this.m_strAutoBountyCollected = "%killer has ended %victim's %streak kill streak, claiming the %amount CC$ bounty!"; this.m_strCurrentGameMode = ""; this.m_strPlayerBountyPostCommand = "@addbounty"; this.m_strPlayerBountyPosted = "%poster just put a %amount CC$ bounty on %target's head!"; this.m_strPlayerBountyCollected = "%killer just murked %victim, claiming her %amount CC$ bounty!"; this.m_strBountyBoardCommand = "@bountyboard"; this.m_strMugged = "%killer just mugged %victim, stealing %amount CC$!"; this.m_strMuggingWeaponChosen = ""; this.m_strSelectedConfirmWeaponChosen = ""; this.m_strCurrencyInstanceName = "Currency"; this.m_strCurrencySymbol = "CC$"; this.m_strPayrollMessage = "Payroll - You just got paid %amount CC$!"; this.m_strMainMenuTrigger = "@currency"; this.m_strAdminAddCurrencyCommand = "@addcc"; this.m_strAdminRemoveCurrencyCommand = "@removecc"; this.m_strAdminCheckBalanceCommand = "@checkbalance"; this.m_strSQLHostname = ""; this.m_strSQLDatabaseName = ""; this.m_strSQLUsername = ""; this.m_strSQLPassword = ""; this.m_strShopTrigger = "@shop"; this.m_strCheckBalanceTrigger = "@balance"; this.m_strPlayerPersonalSpamTrigger = "@quiet"; this.m_strSpecificWeaponChosen = ""; this.m_strSelectedConfirmMuggingWeaponChosen = ""; this.m_straMainMenu = new string[] { "This is the main menu!" }; this.m_straShop = new string[] { "This is the shop!" }; this.m_strHostName = ""; this.m_strPort = ""; this.m_strPRoConVersion = ""; this.m_dtPreviousEntryStamp = DateTime.Now; this.m_lstMuggingWeapons = new List<string>(); this.m_lstWeaponAndPayValue = new List<string>(); this.m_lstNoSpam = new List<string>(); }
// Convertes bool "True/False" into String "true/false" public string enumboolToStringTrueFalse(enumBoolYesNo isTrue) { if (isTrue == enumBoolYesNo.Yes) return "true"; return "false"; }
public Item(string strName) { this._id = 0; this._name = "Item"; this.Enabled = enumBoolYesNo.No; this._ccvalue = 100; this._buycommand = "Enter the chat trigger used to buy this item"; this._description = "Enter a short description and show proper syntax"; this._templatechosen = ""; this._payload = new List<string>(); }
// plugin variables are declared in 'Global Vars' region above // ASSIGN values to program globals FROM server_ip.cfg and from Plugin Settings pane public void SetPluginVariable(string strVariable, string raw_strValue) { try { string strValue = CPluginVariable.Decode(raw_strValue); switch (strVariable) { case "Game": game_id = (GameIdEnum)Enum.Parse(typeof(GameIdEnum), strValue); break; case "Delay before kill": kill_delay = Int32.Parse(strValue); break; case "Yell seconds": yell_delay = Int32.Parse(strValue); break; //case "Player keeps items on respawn": // reservationMode = (ReserveItemEnum)Enum.Parse(typeof(ReserveItemEnum), strValue); // break; case "EA Rules of Conduct read and accepted": roc_read = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); break; case "Trace rules": trace_rules = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); break; case "Protect these players from Kick or Kill": protect_players = (ProtectEnum)Enum.Parse(typeof(ProtectEnum), strValue); break; case "Rules": string strValueHtmlDecode = raw_strValue.Contains(" ") ? raw_strValue : raw_strValue.Replace("+", " "); string strValueUnencoded; try { strValueUnencoded = Uri.UnescapeDataString(strValueHtmlDecode); } catch { strValueUnencoded = strValueHtmlDecode; } unparsed_rules = new List<string>(strValueUnencoded.Split(new char[] { '|' })); rulz_vars.reset(); reset_counts(); parse_rules(); break; case "Rulz .txt filenames": rulz_filenames = new List<string>(CPluginVariable.DecodeStringArray(strValue)); // look for rulz files and add those to unparsed_rules load_rulz_from_files(); rulz_vars.reset(); reset_counts(); parse_rules(); break; case "Player name whitelist": whitelist_players = new List<string>(CPluginVariable.DecodeStringArray(strValue)); break; case "Clan name whitelist": whitelist_clans = new List<string>(CPluginVariable.DecodeStringArray(strValue)); break; case "Send ProconRulz Log messages to:": log_file = (LogFileEnum)Enum.Parse(typeof(LogFileEnum), strValue); break; default: break; } } catch (Exception ex) { PrintException(ex); } }
// Allways be suspicious of strValue's actual value. A command in the console can // by the user can put any kind of data it wants in strValue. // use type.TryParse public void SetPluginVariable(string strVariable, string strValue) { if (strVariable.CompareTo("Allow players to get server country") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enAllowPlayersToGetServerCountry = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Allow players to get other players country") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enAllowPlayersToGetOthersCountry = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Allow players to get other players P/GUIDs") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enAllowPlayersToGuidOthers = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } else if (strVariable.CompareTo("Allow players to get other players play time") == 0 && Enum.IsDefined(typeof(enumBoolYesNo), strValue) == true) { this.m_enAllowPlayersToTimeOthers = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue); } this.RegisterAllCommands(); }