public override void OnServerInfo(CServerInfo data) { serverInfo = data; if (string.IsNullOrEmpty(serverInfo.ExternalGameIpandPort)) serverInfo.ExternalGameIpandPort = host + ":" + port; SetSignal(); }
private void Game_ServerInfo(FrostbiteClient sender, CServerInfo csiServerInfo) { this.UpdateConnections(); }
public override void OnServerInfo(CServerInfo serverInfo) { if (this.isEnabled) { //Get the team scores this.setServerInfo(serverInfo); List<TeamScore> listCurrTeamScore = serverInfo.TeamScores; int iTeam0Score = listCurrTeamScore[0].Score; int iTeam1Score = listCurrTeamScore[1].Score; this.lowestTicketCount = (iTeam0Score < iTeam1Score) ? (iTeam0Score) : (iTeam1Score); this.highestTicketCount = (iTeam0Score > iTeam1Score) ? (iTeam0Score) : (iTeam1Score); this.serverInfoHandle.Set(); /*if (!this.tweetedPluginEnable) { string tweet = "Server '" + serverInfo.ServerName + "' [" + serverInfo.ServerRegion + "] has ENABLED Adkats " + this.GetPluginVersion() + "!"; this.twitterHandler.sendTweet(tweet); this.tweetedPluginEnable = true; }*/ } }
public override void OnServerInfo(CServerInfo serverInfo) { enabled = serverInfo.GameMode.ToLower().Contains("conquest"); if (!enabled) { parent.ExecuteCommand("procon.protected.plugins.setVariable", "PureMessage", "IGNORE", "IGNORE"); parent.ConsoleWrite("Ticket Count Message '" + name + "' only works in Conquest."); return; } if (serverInfo.TeamScores.Count < 2) return; if (startTicketCount == -1) startTicketCount = serverInfo.TeamScores[0].Score; if (!triggered && (serverInfo.TeamScores[0].Score <= (ticketCountPercent / 100.0) * startTicketCount || serverInfo.TeamScores[1].Score <= (ticketCountPercent / 100.0) * startTicketCount)) { sendMessage(String.Format(message, ticketCountPercent), null); triggered = true; } }
public virtual void OnServerInfo(CServerInfo serverInfo) { }
public void OnServerInfo(CServerInfo csiServerInfo) { this.serverName = csiServerInfo.ServerName; this.ServerInfo = csiServerInfo; }
/* Constructor */ public MULTIbalancer() { /* Private members */ fIsEnabled = false; fFinalizerActive = false; fPluginState = PluginState.Disabled; fGameState = GameState.Unknown; fServerInfo = null; fRefreshCommand = false; fServerUptime = 0; fServerCrashed = false; fDebugScramblerBefore = new List<PlayerModel>[2]{new List<PlayerModel>(), new List<PlayerModel>()}; fDebugScramblerAfter = new List<PlayerModel>[2]{new List<PlayerModel>(), new List<PlayerModel>()}; fDebugScramblerStartRound = new List<PlayerModel>[2]{new List<PlayerModel>(), new List<PlayerModel>()}; fBalancedRound = 0; fUnstackedRound = 0; fUnswitchedRound = 0; fExcludedRound = 0; fExemptRound = 0; fFailedRound = 0; fTotalRound = 0; fBalanceIsActive = false; fRoundsEnabled = 0; fGrandTotalQuits = 0; fGrandRageQuits = 0; fTotalQuits = 0; fRageQuits = 0; fMoveThread = null; fFetchThread = null; fListPlayersThread = null; fScramblerThread = null; fTimerThread = null; fModeToSimple = new Dictionary<String,String>(); fEasyTypeDict = new Dictionary<int, Type>(); fEasyTypeDict.Add(0, typeof(int)); fEasyTypeDict.Add(1, typeof(Int16)); fEasyTypeDict.Add(2, typeof(Int32)); fEasyTypeDict.Add(3, typeof(Int64)); fEasyTypeDict.Add(4, typeof(float)); fEasyTypeDict.Add(5, typeof(long)); fEasyTypeDict.Add(6, typeof(String)); fEasyTypeDict.Add(7, typeof(string)); fEasyTypeDict.Add(8, typeof(double)); fBoolDict = new Dictionary<int, Type>(); fBoolDict.Add(0, typeof(Boolean)); fBoolDict.Add(1, typeof(bool)); fListStrDict = new Dictionary<int, Type>(); fListStrDict.Add(0, typeof(String[])); fPerMode = new Dictionary<String,PerModeSettings>(); fAllPlayers = new List<String>(); fKnownPlayers = new Dictionary<String, PlayerModel>(); fTeam1 = new List<PlayerModel>(); fTeam2 = new List<PlayerModel>(); fTeam3 = new List<PlayerModel>(); fTeam4 = new List<PlayerModel>(); fUnassigned = new List<String>(); fRoundStartTimestamp = DateTime.MinValue; fRoundOverTimestamp = DateTime.MinValue; fListPlayersTimestamp = DateTime.MinValue; fFullUnstackSwapTimestamp = DateTime.MinValue; fLastValidationTimestamp = DateTime.MinValue; fListPlayersQ = new Queue<DelayedRequest>(); fPendingTeamChange = new Dictionary<String,int>(); fMoving = new Dictionary<String, MoveInfo>(); fMoveQ = new Queue<MoveInfo>(); fReassigned = new List<String>(); fReservedSlots = new List<String>(); fTickets = new int[5]{0,0,0,0,0}; fFriendlyMaps = new Dictionary<String,String>(); fFriendlyModes = new Dictionary<String,String>(); fMaxTickets = -1; fRushMaxTickets = -1; fLastBalancedTimestamp = DateTime.MinValue; fEnabledTimestamp = DateTime.MinValue; fFinalStatus = null; fIsFullRound = false; fUnstackState = UnstackState.Off; fLastMsg = null; fRushStage = 0; fRushPrevAttackerTickets = 0; fRushAttackerStageLoss = 0; fRushAttackerStageSamples = 0; fMoveStash = new List<MoveInfo>(); fLastVersionCheckTimestamp = DateTime.MinValue; fTimeOutOfJoint = 0; fUnstackGroupCount = 0; fPriorityFetchQ = new PriorityQueue(this); fIsCacheEnabled = false; fScramblerLock = new DelayedRequest(); fWinner = 0; fUpdateThreadLock = new DelayedRequest(); fLastServerInfoTimestamp = DateTime.Now; fStageInProgress = false; fHost = String.Empty; fPort = String.Empty; fRushMap3Stages = new List<String>(new String[6]{"MP_007", "XP4_Quake", "XP5_002", "MP_012", "XP4_Rubble", "MP_Damage"}); fRushMap5Stages = new List<String>(new String[6]{"MP_013", "XP3_Valley", "MP_017", "XP5_001", "MP_Prison", "MP_Siege"}); fGroupAssignments = new int[5]{0,0,0,0,0}; fDispersalGroups = new List<String>[5]{null, new List<String>(), new List<String>(), new List<String>(), new List<String>()}; fNeedPlayerListUpdate = false; fFriends = new Dictionary<int, List<String>>(); fAllFriends = new List<String>(); fWhileScrambling = false; fExtrasLock = new DelayedRequest(); fExtraNames = new List<String>(); fGotLogin = false; fDebugScramblerSuspects = new Dictionary<String,String>(); fTimerRequestList = new List<DelayedRequest>(); fAverageTicketLoss = new Queue<double>[3]{null, new Queue<double>(), new Queue<double>()}; fTicketLossHistogram = new Histogram(); /* Settings */ /* ===== SECTION 0 - Presets ===== */ SettingsVersion = 1; Preset = PresetItems.Standard; EnableUnstacking = false; EnableSettingsWizard = false; WhichMode = "Conquest Large"; MetroIsInMapRotation = false; MaximumPlayersForMode = 64; LowestMaximumTicketsForMode = 300; HighestMaximumTicketsForMode = 400; PreferredStyleOfBalancing = PresetItems.Standard; ApplySettingsChanges = false; /* ===== SECTION 1 - Settings ===== */ DebugLevel = 2; MaximumServerSize = 64; EnableBattlelogRequests = true; MaximumRequestRate = 10; // in 20 seconds WaitTimeout = 30; // seconds WhichBattlelogStats = BattlelogStats.ClanTagOnly; MaxTeamSwitchesByStrongPlayers = 1; MaxTeamSwitchesByWeakPlayers = 2; UnlimitedTeamSwitchingDuringFirstMinutesOfRound = 5.0; Enable2SlotReserve = false; EnablerecruitCommand = false; EnableWhitelistingOfReservedSlotsList = true; Whitelist = new String[] {DEFAULT_LIST_ITEM}; fSettingWhitelist = new List<String>(Whitelist); DisperseEvenlyList = new String[] {DEFAULT_LIST_ITEM}; fSettingDisperseEvenlyList = new List<String>(DisperseEvenlyList); FriendsList = new String[] {DEFAULT_LIST_ITEM}; fSettingFriendsList = new List<String>(); SecondsUntilAdaptiveSpeedBecomesFast = 3*60; // 3 minutes default EnableInGameCommands = true; /* ===== SECTION 2 - Exclusions ===== */ OnWhitelist = true; OnFriendsList = false; ApplyFriendsListToTeam = false; TopScorers = true; SameClanTagsInSquad = true; SameClanTagsInTeam = false; SameClanTagsForRankDispersal = false; LenientRankDispersal = false; MinutesAfterJoining = 5; MinutesAfterBeingMoved = 90; // 1.5 hours JoinedEarlyPhase = true; JoinedMidPhase = true; JoinedLatePhase = false; /* ===== SECTION 3 - Round Phase & Population Settings ===== */ EarlyPhaseTicketPercentageToUnstack = new double[3] { 0,120,120}; MidPhaseTicketPercentageToUnstack = new double[3] { 0,120,120}; LatePhaseTicketPercentageToUnstack = new double[3] { 0, 0, 0}; EnableTicketLossRateLogging = false; SpellingOfSpeedNamesReminder = Speed.Click_Here_For_Speed_Names; EarlyPhaseBalanceSpeed = new Speed[3] { Speed.Fast, Speed.Adaptive, Speed.Adaptive}; MidPhaseBalanceSpeed = new Speed[3] { Speed.Fast, Speed.Adaptive, Speed.Adaptive}; LatePhaseBalanceSpeed = new Speed[3] { Speed.Stop, Speed.Stop, Speed.Stop}; /* ===== SECTION 4 - Scrambler ===== */ OnlyOnNewMaps = true; // false means scramble every round OnlyOnFinalTicketPercentage = 120; // 0 means scramble regardless of final score ScrambleBy = DefineStrong.RoundScore; KeepSquadsTogether = true; KeepClanTagsInSameTeam = true; KeepFriendsInSameTeam = false; DivideBy = DivideByChoices.None; ClanTagToDivideBy = String.Empty; DelaySeconds = 50; /* ===== SECTION 5 - Messages ===== */ QuietMode = false; // false: chat is global, true: chat is private. Yells are always private YellDurationSeconds = 10; BadBecauseMovedByBalancer = "autobalance moved you to the %toTeam% team"; BadBecauseWinningTeam = "switching to the winning team is not allowed"; BadBecauseBiggestTeam = "switching to the biggest team is not allowed"; BadBecauseRank = "this server splits Colonel 100's between teams"; BadBecauseDispersalList = "you're on the list of players to split between teams"; ChatMovedForBalance = "*** MOVED %name% for balance ..."; YellMovedForBalance = "Moved %name% for balance ..."; ChatMovedToUnstack = "*** MOVED %name% to unstack teams ..."; YellMovedToUnstack = "Moved %name% to unstack teams ..."; ChatDetectedBadTeamSwitch = "%name%, you can't switch to team %fromTeam%: %reason%, sending you back ..."; YellDetectedBadTeamSwitch = "You can't switch to the %fromTeam% team: %reason%, sending you back!"; ChatDetectedGoodTeamSwitch = "%name%, thanks for helping out the %toTeam% team!"; YellDetectedGoodTeamSwitch = "Thanks for helping out the %toTeam% team!"; ChatAfterUnswitching = "%name%, please stay on the %toTeam% team for the rest of this round"; YellAfterUnswitching = "Please stay on the %toTeam% team for the rest of this round"; /* ===== SECTION 6 - Unswitcher ===== */ EnableImmediateUnswitch = true; ForbidSwitchingAfterAutobalance = UnswitchChoice.Always; ForbidSwitchingToWinningTeam = UnswitchChoice.Always; ForbidSwitchingToBiggestTeam = UnswitchChoice.Always; ForbidSwitchingAfterDispersal = UnswitchChoice.Always; /* ===== SECTION 7 - TBD ===== */ /* ===== SECTION 8 - Per-Mode Settings ===== */ /* ===== SECTION 9 - Debug Settings ===== */ ShowInLog = INVALID_NAME_TAG_GUID; ShowCommandInLog = String.Empty; LogChat = true; EnableLoggingOnlyMode = false; EnableExternalLogging = false; ExternalLogSuffix = "_mb.log"; }
public override void OnServerInfo(CServerInfo serverInfo) { // This is just to test debug logging DebugWrite("OnServerInfo: Debug level = " + DebugLevel + " ....", 9); DebugWrite("GameState = " + GetState(), 8); if (GetState() == GState.BetweenRounds) { lock (TeamHuman) { KnownPlayerCount = TeamHuman.Count + TeamZombie.Count; } } }
public override void OnServerInfo(CServerInfo serverInfo) { ConsoleWrite("Debug level = " + fDebugLevel); }
// Query Events public void OnServerInfo(CServerInfo csiServerInfo) { }
public override void OnServerInfo(CServerInfo serverInfo) { DebugWrite("Debug level = " + DebugLevel, 9); DateTime now = DateTime.Now; //if (!Regex.Match(serverInfo.GameMode, "Rush").Success) return; fSI = serverInfo; List<TeamScore> ts = fSI.TeamScores; double atts = 0; double defs = 0; foreach (TeamScore t in ts) { if (t.TeamID == 1) atts = t.Score; if (t.TeamID == 2) defs = t.Score; } //DebugWrite("Tickets " + atts.ToString("F0") + "/" + defs.ToString("F0") + ", Time " + TimeSpan.FromSeconds(fSI.RoundTime).ToString().Substring(0,8), 4); f1Samples.Enqueue(new Sample(now, atts)); f2Samples.Enqueue(new Sample(now, defs)); fQ1Samples.Enqueue(new Sample(now, atts)); fQ2Samples.Enqueue(new Sample(now, defs)); TrimQueueToTime(f1Samples, 60.0); TrimQueueToTime(f2Samples, 60.0); TrimQueueToTime(fQ1Samples, 20.0); TrimQueueToTime(fQ2Samples, 20.0); // One minute means List<Sample> s1 = new List<Sample>(f1Samples.ToArray()); double mean1 = ComputeMean(s1) * 60.0; double med1 = ComputeMedian(s1) * 60.0; List<Sample> s2 = new List<Sample>(f2Samples.ToArray()); double mean2 = ComputeMean(s2) * 60.0; double med2 = ComputeMedian(s2) * 60.0; // 20 second means List<Sample> q1 = new List<Sample>(fQ1Samples.ToArray()); double qMean1 = ComputeMean(q1) * 20.0; double qMed1 = ComputeMedian(q1) * 20.0; List<Sample> q2 = new List<Sample>(fQ2Samples.ToArray()); double qMean2 = ComputeMean(q2) * 20.0; double qMed2 = ComputeMedian(q2) * 20.0; double timeWin = SumTimes(s1); if (DebugLevel >= 4) { String line = DumpSamples(s1); DebugWrite("Team 1: " + line, 4); line = DumpSamples(s2); DebugWrite("Team 2: " + line, 4); } DebugWrite("Tickets ^b" + atts.ToString("F0") + "/" + defs.ToString("F0") + "^n, Time " + TimeSpan.FromSeconds(fSI.RoundTime).ToString().Substring(0,8) + ", Window: ^1" + timeWin.ToString("F1") + "^0, Ticket loss per minute: ^b" + med1.ToString("F1") + "^n(" + mean1.ToString("F1") + ")/^b" + med2.ToString("F1") + "^n(" + mean2.ToString("F2") + "), 20-second rate: ^b" + qMed1.ToString("F1") + "^n(" + qMean1.ToString("F1") + ")/^b" + qMed2.ToString("F1") + "^n(" + qMean2.ToString("F1") + ")", 3); }
// Query Events public void OnServerInfo(CServerInfo csiServerInfo) { this.m_strCurrentMapFileName = csiServerInfo.Map; }
public override void OnServerInfo(CServerInfo serverInfo) { }
public override void OnServerInfo(CServerInfo serverInfo) { // TODO: Check if database holds old stats? }
public override void OnServerInfo(CServerInfo serverInfo) { this.DebugWrite("Entering OnServerInfo", 7); try { if (this._IsEnabled) { this._UsTicketCount = -1; this._RuTicketCount = -1; if (serverInfo != null) { //Get the team scores this.SetServerInfo(serverInfo); if (serverInfo.TeamScores != null) { List<TeamScore> listCurrTeamScore = serverInfo.TeamScores; //During round change, teams don't exist if (listCurrTeamScore.Count > 0) { foreach (TeamScore score in listCurrTeamScore) { if (score.TeamID == AdKats.UsTeamID) { this._UsTicketCount = score.Score; } else if (score.TeamID == AdKats.RuTeamID) { this._RuTicketCount = score.Score; } else { this.DebugWrite("Score for team " + score.TeamID + " not parsable.", 2); } } } else { this.DebugWrite("Server info fired while changing rounds, no teams to parse.", 5); } if (this._UsTicketCount >= 0 && this._RuTicketCount >= 0) { this._LowestTicketCount = (this._UsTicketCount < this._RuTicketCount) ? (this._UsTicketCount) : (this._RuTicketCount); this._HighestTicketCount = (this._UsTicketCount > this._RuTicketCount) ? (this._UsTicketCount) : (this._RuTicketCount); } } this._ServerName = serverInfo.ServerName; //Only activate the following on ADK servers. Boolean wasADK = this._IsTestingAuthorized; this._IsTestingAuthorized = serverInfo.ServerName.Contains("=ADK="); if (!wasADK && this._IsTestingAuthorized) { this.ConsoleWrite("Server is priviledged for testing."); this.UpdateSettingPage(); } } else { this.HandleException(new AdKatsException("Server info was null")); } this._ServerInfoWaitHandle.Set(); } } catch (Exception e) { this.HandleException(new AdKatsException("Error while processing server info.", e)); } this.DebugWrite("Exiting OnServerInfo", 7); }
public override void OnServerInfo(CServerInfo serverInfo) { this.serverInfo = serverInfo; }
private void Client_Serverinfo_EndRound_Update(FrostbiteClient sender, CServerInfo csiServerInfo) { this.InvokeIfRequired(() => { // int iTeams = this.Client.GetLocalizedTeamNameCount(this.Client.CurrentServerInfo.Map, this.Client.CurrentServerInfo.GameMode); this.cboEndRound.Items.Clear(); this.cboEndRound.Items.AddRange(new object[] { this.Language.GetDefaultLocalized("Select winning team to end round:", "uscPlayerListPanel.ctxPlayerOptions.EndRound.Label") }); this.cboEndRound.SelectedIndex = 0; for (int i = 1; i < iTeams; i++) { this.cboEndRound.Items.AddRange(new object[] { String.Format("{0} - {1}", this.Language.GetDefaultLocalized("Team " + i.ToString(), "uscPlayerListPanel.ctxPlayerOptions.EndRound.Team" + i.ToString(CultureInfo.InvariantCulture)), this.Client.GetLocalizedTeamName(i, this.Client.CurrentServerInfo.Map, this.Client.CurrentServerInfo.GameMode)) }); } Graphics cboEndRoundGrafphics = cboEndRound.CreateGraphics(); this.cboEndRound.Width = 18 + (int)cboEndRoundGrafphics.MeasureString(this.cboEndRound.Text, this.cboEndRound.Font).Width; }); }
public override void OnServerInfo(CServerInfo csiServerInfo) { //DebugInfo(csiServerInfo.GameMod.ToString()); //DebugInfo(csiServerInfo.GameMode.ToString()); //this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^9TrueBalancer:^n " + csiServerInfo.BlazeGameState); //this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^9TrueBalancer:^n " + csiServerInfo.BlazePlayerCount); if (Servertype == "AUTOMATIC") { if (string.IsNullOrEmpty(csiServerInfo.BlazeGameState)) { DebugInfoSkill("BF3 detected"); Servertype = "BF3"; } else { DebugInfoSkill("BF4 detected"); Servertype = "BF4"; } } this.strcurrentGametype = csiServerInfo.GameMode; this.intMaxSlots = csiServerInfo.MaxPlayerCount; this.intCurrentRoundCount = csiServerInfo.TotalRounds - csiServerInfo.CurrentRound; if (intCurrentRoundCount < 1) { intCurrentRoundCount = 1; } this.intScoreTeamA = 0; this.intScoreTeamB = 0; //DebugInfoSkill("Before Check: " + this.intTicketcount + ", GameMode: " + this.strcurrentGametype); if (this.strcurrentGametype.Contains("Elimination")) { this.intScoreTeamA = 10000; this.intScoreTeamB = 10000; } else if (this.strcurrentGametype.Contains("GunMaster") || this.strcurrentGametype.Contains("CaptureTheFlag0")) { this.intScoreTeamA = 10000; this.intScoreTeamB = 10000; } else { foreach (TeamScore score in csiServerInfo.TeamScores) { if (score.TeamID == 1) { this.intScoreTeamA = score.Score; if (this.intTicketcount == 123987123 && this.strcurrentGametype.Contains("TeamDeathMatch")) { this.intTicketcount = score.WinningScore; } } else if (score.TeamID == 2) { this.intScoreTeamB = score.Score; } } } if ((this.strcurrentGametype.Contains("Conquest") || this.strcurrentGametype.Contains("TankSuperiority0") || this.strcurrentGametype.Contains("Scavenger0") || this.strcurrentGametype.Contains("AirSuperiority0") || this.strcurrentGametype.Contains("CarrierAssault") || this.strcurrentGametype.Contains("Chainlink")) && this.boolLevelStart) { if (this.intTicketcount == 123987123) { if (this.intScoreTeamA > this.intScoreTeamB) this.intTicketcount = this.intScoreTeamB; else this.intTicketcount = this.intScoreTeamA; } this.intminScore = intminScoreCONQUEST; if ((this.TeamA + this.TeamB) < this.intTreshCONQUEST) { this.intAllowDif = this.intAllowDif1CONQUEST; } else { this.intAllowDif = this.intAllowDif2CONQUEST; } } if (this.strcurrentGametype.Contains("Domination0") && this.boolLevelStart) { if (this.intTicketcount == 123987123) { if (this.intScoreTeamA > this.intScoreTeamB) this.intTicketcount = this.intScoreTeamB; else this.intTicketcount = this.intScoreTeamA; } this.intminScore = intminScoreDOM; if ((this.TeamA + this.TeamB) < this.intTreshDOM) { this.intAllowDif = this.intAllowDif1DOM; } else { this.intAllowDif = this.intAllowDif2DOM; } } else if (this.strcurrentGametype.Contains("Obliteration") && this.boolLevelStart) { if (this.intTicketcount == 123987123) { if (this.intScoreTeamA > this.intScoreTeamB) this.intTicketcount = this.intScoreTeamB; else this.intTicketcount = this.intScoreTeamA; } this.intminScore = intminScoreOB; if ((this.TeamA + this.TeamB) < this.intTreshOB) { this.intAllowDif = this.intAllowDif1OB; } else { this.intAllowDif = this.intAllowDif2OB; } } else if ((this.strcurrentGametype.Contains("Rush")) && this.boolLevelStart) { if (this.intTicketcount == 123987123) { if (this.intScoreTeamA > this.intScoreTeamB) this.intTicketcount = this.intScoreTeamB; else this.intTicketcount = this.intScoreTeamA; } this.intminScore = intminScoreRUSH; if ((this.TeamA + this.TeamB) < this.intTreshRUSH) { this.intAllowDif = this.intAllowDif1RUSH; } else { this.intAllowDif = this.intAllowDif2RUSH; } } //else if (this.strcurrentGametype.Contains("GunMaster") && this.boolLevelStart) else if ((this.strcurrentGametype.Contains("GunMaster") || this.strcurrentGametype.Contains("CaptureTheFlag0")) && this.boolLevelStart) { this.intminScore = 0; if ((this.TeamA + this.TeamB) < this.intTreshGM) { this.intAllowDif = this.intAllowDif1GM; } else { this.intAllowDif = this.intAllowDif2GM; } } else if ((this.strcurrentGametype.Contains("Elimination")) && this.boolLevelStart) { this.intminScore = 0; if ((this.TeamA + this.TeamB) < this.intTreshDF) { this.intAllowDif = this.intAllowDif1DF; } else { this.intAllowDif = this.intAllowDif2DF; } } else if (this.strcurrentGametype.Contains("TeamDeathMatch") && this.boolLevelStart) { this.intminScore = this.intTicketcount - intminScoreTDM; if ((this.TeamA + this.TeamB) < this.intTreshTDM) { this.intAllowDif = this.intAllowDif1TDM; } else { this.intAllowDif = this.intAllowDif2TDM; } } int intticketdiffrence = 0; //DebugInfoSkill("TicketCount: " + this.intTicketcount); if (this.intScoreTeamA > this.intScoreTeamB) intticketdiffrence = this.intScoreTeamA - this.intScoreTeamB; else if (this.intScoreTeamA < this.intScoreTeamB) intticketdiffrence = this.intScoreTeamB - this.intScoreTeamA; if (!this.boolmessagesent && (this.strcurrentGametype.Contains("Conquest") || this.strcurrentGametype.Contains("TankSuperiority0") || this.strcurrentGametype.Contains("Scavenger0") || this.strcurrentGametype.Contains("AirSuperiority0") || this.strcurrentGametype.Contains("CarrierAssault") || this.strcurrentGametype.Contains("Chainlink")) && this.ynbenableSkillCONQUEST == enumBoolYesNo.Yes && (this.intScoreTeamA < 40 || this.intScoreTeamB < 40)) { this.boolmessagesent = true; DebugInfoSkill("SI - CQ - Gamemode: ^b" + this.strcurrentGametype); if (this.ynbScrambleMapCONQUEST == enumBoolYesNo.Yes && this.intCurrentRoundCount == 1) { DebugInfoSkill("SI - Scrambling on every new map: ^b" + this.strcurrentGametype); if (this.strScrambleMessageCONQUEST != "") { if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL:^n say all - " + this.strScrambleMessageCONQUEST); } else { this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleMessageCONQUEST, "all"); } if (this.ynbYellScrambleMessage == enumBoolYesNo.Yes && !this.boolVirtual) { this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleMessageCONQUEST, "30"); } } } else if ((this.intwonTicketsCONQUEST * this.intTicketcount / 100) <= intticketdiffrence && (this.intCurrentRoundCount == 1 || this.ynbScrambleEveryRoundCONQUEST == enumBoolYesNo.Yes)) { DebugInfoSkill("SI - Won with too much tickets: ^b" + this.strcurrentGametype); if (this.strScrambleMessageCONQUEST != "") { if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL:^n say all - " + this.strScrambleMessageCONQUEST); } else { this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleMessageCONQUEST, "all"); } if (this.ynbYellScrambleMessage == enumBoolYesNo.Yes && !this.boolVirtual) { this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleMessageCONQUEST, "30"); } } } else { DebugInfoSkill("SI - " + this.strcurrentGametype + ":^b^1 No reason to scramble!"); } } if (!this.boolmessagesent && this.strcurrentGametype.Contains("Domination0") && this.ynbenableSkillDOM == enumBoolYesNo.Yes && (this.intScoreTeamA < 40 || this.intScoreTeamB < 40)) { this.boolmessagesent = true; DebugInfoSkill("SI - DOM - Gamemode: ^b" + this.strcurrentGametype); if (this.ynbScrambleMapDOM == enumBoolYesNo.Yes && this.intCurrentRoundCount == 1) { DebugInfoSkill("SI - Scrambling on every new map: ^b" + this.strcurrentGametype); if (this.strScrambleMessageDOM != "") { if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL:^n say all - " + this.strScrambleMessageDOM); } else { this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleMessageDOM, "all"); } if (this.ynbYellScrambleMessage == enumBoolYesNo.Yes && !this.boolVirtual) { this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleMessageDOM, "30"); } } } else if ((this.intwonTicketsDOM * this.intTicketcount / 100) <= intticketdiffrence && (this.intCurrentRoundCount == 1 || this.ynbScrambleEveryRoundDOM == enumBoolYesNo.Yes)) { DebugInfoSkill("SI - Won with too much tickets: ^b" + this.strcurrentGametype); if (this.strScrambleMessageDOM != "") { if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL:^n say all - " + this.strScrambleMessageDOM); } else { this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleMessageDOM, "all"); } if (this.ynbYellScrambleMessage == enumBoolYesNo.Yes && !this.boolVirtual) { this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleMessageDOM, "30"); } } } else { DebugInfoSkill("SI - " + this.strcurrentGametype + ":^b^1 No reason to scramble!"); } } else if (!this.boolmessagesent && this.strcurrentGametype.Contains("Obliteration") && this.ynbenableSkillOB == enumBoolYesNo.Yes && (this.intScoreTeamA < 2 || this.intScoreTeamB < 2)) { this.boolmessagesent = true; DebugInfoSkill("SI - OB - Gamemode: ^b" + this.strcurrentGametype); if (this.ynbScrambleMapOB == enumBoolYesNo.Yes && this.intCurrentRoundCount == 1) { DebugInfoSkill("SI - Scrambling on every new map: ^b" + this.strcurrentGametype); if (this.strScrambleMessageOB != "") { if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL:^n say all - " + this.strScrambleMessageOB); } else { this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleMessageOB, "all"); } if (this.ynbYellScrambleMessage == enumBoolYesNo.Yes && !this.boolVirtual) { this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleMessageOB, "30"); } } } else if ((this.intwonTicketsOB * this.intTicketcount / 100) <= intticketdiffrence && (this.intCurrentRoundCount == 1 || this.ynbScrambleEveryRoundOB == enumBoolYesNo.Yes)) { DebugInfoSkill("SI - Won with too much tickets: ^b" + this.strcurrentGametype); if (this.strScrambleMessageOB != "") { if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL:^n say all - " + this.strScrambleMessageOB); } else { this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleMessageOB, "all"); } if (this.ynbYellScrambleMessage == enumBoolYesNo.Yes && !this.boolVirtual) { this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleMessageOB, "30"); } } } else { DebugInfoSkill("SI - " + this.strcurrentGametype + ":^b^1 No reason to scramble!"); } } else if (!this.boolmessagesent && this.strcurrentGametype.Contains("TeamDeathMatch") && this.ynbenableSkillTDM == enumBoolYesNo.Yes && (this.intScoreTeamA > (this.intTicketcount - 25) || this.intScoreTeamB > (this.intTicketcount - 25))) { this.boolmessagesent = true; DebugInfoSkill("SI - TDM - Gamemode: ^b" + this.strcurrentGametype); if (this.ynbScrambleMapTDM == enumBoolYesNo.Yes && this.intCurrentRoundCount == 1) { DebugInfoSkill("SI - Scrambling on every new map: ^b" + this.strcurrentGametype); if (this.strScrambleMessageTDM != "") { if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL:^n say all - " + this.strScrambleMessageTDM); } else { this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleMessageTDM, "all"); } if (this.ynbYellScrambleMessage == enumBoolYesNo.Yes && !this.boolVirtual) { this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleMessageTDM, "30"); } } } else if ((this.intwonTicketsTDM * this.intTicketcount / 100) <= intticketdiffrence && (this.intCurrentRoundCount == 1 || this.ynbScrambleEveryRoundTDM == enumBoolYesNo.Yes)) { DebugInfoSkill("SI - Won with too much tickets: ^b" + this.strcurrentGametype); if (this.strScrambleMessageTDM != "") { if (this.boolVirtual) { this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL:^n say all - " + this.strScrambleMessageTDM); } else { this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleMessageTDM, "all"); } if (this.ynbYellScrambleMessage == enumBoolYesNo.Yes) { this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleMessageTDM, "30"); } } } else { DebugInfoSkill("SI - " + this.strcurrentGametype + ": ^b^1No reason to scramble!"); } } /* if ((this.intScoreTeamA < 40 || this.intScoreTeamB < 40) && this.ynbenableSkill==enumBoolYesNo.Yes && this.strcurrentGametype != "squadrush0" && this.strcurrentGametype != "rushlarge0"){ // if ((this.intwonTickets <= intticketdiffrence || this.ynbScrambleMap == enumBoolYesNo.Yes)&& this.intCurrentRoundCount == 1){ if (this.intwonTickets <= intticketdiffrence || this.ynbScrambleMap == enumBoolYesNo.Yes){ if (this.strScrambleMessage !="" && this.boolticketdif == false){ this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleMessage , "all"); this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleMessage, "30"); } this.boolticketdif = true; } } */ this.DebugInfo("Serverinfo: ^1ScoreA: ^i" + this.intScoreTeamA.ToString() + "^n, ^2ScoreB: ^i" + this.intScoreTeamB.ToString() + "^n, ^9RoundCount: ^i " + this.intCurrentRoundCount.ToString()); UpdateCheck(); }
public override void OnServerInfo(CServerInfo serverInfo) { if (!fIsEnabled || serverInfo == null) return; DebugWrite("^9^bGot OnServerInfo^n: Debug level = " + DebugLevel, 8); DateTime debugTime = DateTime.Now; try { double elapsedTimeInSeconds = DateTime.Now.Subtract(fLastServerInfoTimestamp).TotalSeconds; fLastServerInfoTimestamp = DateTime.Now; if (fUpdateTicketsRequest != null) fUpdateTicketsRequest.LastUpdate = fLastServerInfoTimestamp; // Update game state if just enabled (as of R38, CTF TeamScores may be null, does not mean round end) if (fGameState == GameState.Unknown && serverInfo.GameMode != "CaptureTheFlag0") { if (serverInfo.TeamScores == null || serverInfo.TeamScores.Count < 2) { fGameState = GameState.RoundEnding; DebugWrite("OnServerInfo: ^b^3Game state = " + fGameState, 6); } } // Show final status if (fFinalStatus != null) { try { DebugWrite("^bFINAL STATUS FOR PREVIOUS ROUND:^n", 2); foreach (TeamScore ts in fFinalStatus) { if (ts.TeamID >= fTickets.Length) break; fTickets[ts.TeamID] = (ts.Score == 1) ? 0 : ts.Score; // fix rounding } LogStatus(true, DebugLevel); DebugWrite("+------------------------------------------------+", 2); if (DebugLevel >= 3) CommandToLog("bad tags"); } catch (Exception) {} fFinalStatus = null; } if (fServerInfo == null || fServerInfo.GameMode != serverInfo.GameMode || fServerInfo.Map != serverInfo.Map) { ConsoleDebug("ServerInfo update: " + serverInfo.Map + "/" + serverInfo.GameMode); } // Check for server crash if (fServerUptime > 0 && fServerUptime > serverInfo.ServerUptime + 2) { // +2 secs for rounding error in server! fServerCrashed = true; DebugWrite("^1^bDETECTED GAME SERVER CRASH^n (recorded uptime longer than latest serverInfo uptime)", 3); } fServerInfo = serverInfo; fServerUptime = serverInfo.ServerUptime; // Update max tickets PerModeSettings perMode = GetPerModeSettings(); bool isRush = IsRush(); double minTickets = Double.MaxValue; double maxTickets = 0; double attacker = 0; double defender = 0; double[] oldTickets = new double[]{0, fTickets[1], fTickets[2]}; if (fServerInfo.TeamScores == null || fServerInfo.TeamScores.Count == 0) return; foreach (TeamScore ts in fServerInfo.TeamScores) { if (ts.TeamID >= fTickets.Length) break; fTickets[ts.TeamID] = ts.Score; if (ts.Score > maxTickets) maxTickets = ts.Score; if (ts.Score < minTickets) minTickets = ts.Score; } if (isRush && fServerInfo.TeamScores.Count >= 2) { attacker = fServerInfo.TeamScores[0].Score; defender = fServerInfo.TeamScores[1].Score; if (fStageInProgress) { if (attacker < fRushPrevAttackerTickets && attacker > 0) { fRushAttackerStageLoss = fRushAttackerStageLoss + (fRushPrevAttackerTickets - attacker); ++fRushAttackerStageSamples; } } String avl = String.Empty; if (fStageInProgress) avl = ", avg loss = " + RushAttackerAvgLoss().ToString("F1") + "/" + Math.Min(perMode.SecondsToCheckForNewStage, elapsedTimeInSeconds).ToString("F0") + " secs"; if (this.TotalPlayerCount > 3) DebugWrite("^7serverInfo: Rush attacker = " + attacker + ", was = " + fMaxTickets + avl + ", defender = " + defender, 7); } if (fMaxTickets == -1) { if (!isRush) { fMaxTickets = maxTickets; ConsoleDebug("ServerInfo update: fMaxTickets = " + fMaxTickets.ToString("F0")); } else if (fServerInfo.TeamScores.Count == 2) { fRushMaxTickets = defender; fMaxTickets = attacker; fRushStage = 1; fRushPrevAttackerTickets = attacker; fRushAttackerStageSamples = 0; fRushAttackerStageLoss = 0; fStageInProgress = false; ConsoleDebug("ServerInfo update: fMaxTickets = " + fMaxTickets.ToString("F0") + ", fRushMaxTickets = " + fRushMaxTickets + ", fRushStage = " + fRushStage); } } // Rush heuristic: if attacker tickets are higher than last check, new stage started if (isRush && fServerInfo != null && !String.IsNullOrEmpty(fServerInfo.Map)) { int maxStages = 4; if (fRushMap3Stages.Contains(fServerInfo.Map)) { maxStages = 3; } else if (fRushMap5Stages.Contains(fServerInfo.Map)) { maxStages = 5; } if (fRushStage == 0) { fRushMaxTickets = defender; fMaxTickets = attacker; fRushStage = 1; fRushPrevAttackerTickets = attacker; fRushAttackerStageSamples = 0; fRushAttackerStageLoss = 0; } if (!fStageInProgress) { // hysteresis, wait for attacker tickets to go below threshold before stage is in progress for sure fStageInProgress = ((attacker + (2 * perMode.SecondsToCheckForNewStage / 5)) < fMaxTickets); if (fStageInProgress) { DebugWrite("^7serverInfo: stage " + fRushStage + " in progress!", 7); } } else if (attacker > fRushPrevAttackerTickets && (attacker - fRushPrevAttackerTickets) >= Math.Min(12, 2 * perMode.SecondsToCheckForNewStage / 5) && AttackerTicketsWithinRangeOfMax(attacker) && fRushStage < 5) { fStageInProgress = false; fRushMaxTickets = defender; fMaxTickets = attacker; fRushPrevAttackerTickets = attacker; fRushStage = fRushStage + 1; fRushAttackerStageSamples = 0; fRushAttackerStageLoss = 0; DebugWrite(".................................... ^b^1New rush stage detected^0^n ....................................", 3); DebugBalance("Rush Stage " + fRushStage + " of " + maxStages); } // update last known attacker ticket value fRushPrevAttackerTickets = attacker; } // Ticket loss rate updates if ((EnableTicketLossRateLogging || perMode.EnableTicketLossRatio) && fGameState == GameState.Playing && TotalPlayerCount >= 4) { if (fUpdateTicketsRequest == null) SetupUpdateTicketsRequest(); AddTicketLossSample(1, oldTickets[1], fTickets[1], elapsedTimeInSeconds); AddTicketLossSample(2, oldTickets[2], fTickets[2], elapsedTimeInSeconds); } else { ResetAverageTicketLoss(); } if (EnableTicketLossRateLogging && IsConquest()) { UpdateTicketLossRateLog(DateTime.Now, 0, 0); } if ((EnableTicketLossRateLogging || perMode.EnableTicketLossRatio) && fGameState == GameState.Playing && TotalPlayerCount >= 4) { try { double a1 = GetAverageTicketLossRate(1, false); double a2 = GetAverageTicketLossRate(2, false); double ratio = (a1 > a2) ? (a1/Math.Max(1, a2)) : (a2/Math.Max(1, a1)); ratio = Math.Min(ratio, 50.0); // cap at 50x ratio = ratio * 100.0; fTicketLossHistogram.Add(Convert.ToInt32(Math.Round(ratio))); } catch (Exception e) { ConsoleException(e); } } // Check for plugin updates periodically if (fLastVersionCheckTimestamp != DateTime.MinValue && DateTime.Now.Subtract(fLastVersionCheckTimestamp).TotalMinutes > CHECK_FOR_UPDATES_MINS) { LaunchCheckForPluginUpdate(); } } catch (Exception e) { ConsoleException(e); } finally { double elapsedTime = DateTime.Now.Subtract(debugTime).TotalMilliseconds; if (DebugLevel >= 8 || (DebugLevel >= 7 && elapsedTime > 100.0)) { DebugWrite("^8OnServerInfo took ^b" + elapsedTime.ToString("F0") + "^n ms", 1); } } }
public void OnServerInfo(CServerInfo csiServerInfo) { this.m_strCurrentGameMode = csiServerInfo.GameMode.ToLower(); }
private void Reset() { ResetRound(); lock (fPriorityFetchQ) { fPriorityFetchQ.Clear(); Monitor.Pulse(fPriorityFetchQ); } lock (fMoveQ) { fMoveQ.Clear(); Monitor.Pulse(fMoveQ); } lock (fListPlayersQ) { fListPlayersQ.Clear(); Monitor.Pulse(fListPlayersQ); } lock (fAllPlayers) { fAllPlayers.Clear(); } lock (fMoving) { fMoving.Clear(); } lock (fMoveStash) { fMoveStash.Clear(); } lock (fExtrasLock) { fExtraNames.Clear(); fDebugScramblerSuspects.Clear(); } fReassigned.Clear(); fPendingTeamChange.Clear(); fUnassigned.Clear(); /* fKnownPlayers is not cleared right away, since we want to retain stats from previous plugin sessions. It will be garbage collected after MODEL_MINUTES. */ fServerInfo = null; // release Procon reference fListPlayersTimestamp = DateTime.MinValue; fRefreshCommand = false; fServerUptime = 0; fServerCrashed = false; fFinalStatus = null; fMaxTickets = -1; fBalanceIsActive = false; fIsFullRound = false; fLastMsg = null; fRoundsEnabled = 0; fGrandTotalQuits = 0; fGrandRageQuits = 0; fWhileScrambling = false; fUpdateTicketsRequest = null; fTotalRoundEndingRounds = 0; fTotalRoundEndingSeconds = 0; fDebugScramblerBefore[0].Clear(); fDebugScramblerBefore[1].Clear(); fDebugScramblerAfter[0].Clear(); fDebugScramblerAfter[1].Clear(); fDebugScramblerStartRound[0].Clear(); fDebugScramblerStartRound[1].Clear(); }
private void m_prcConnection_ServerInfo(FrostbiteClient sender, CServerInfo csiServerInfo) { this.InvokeIfRequired(() => { this.SetServerInfoLabels(csiServerInfo); this.SetVersionInfoLabels(sender); }); }
public override void OnServerInfo(CServerInfo serverInfo) { foreach (Message m in messages.FindAll((m) => m.enabled)) try { m.OnServerInfo(serverInfo); } catch (Exception exc) { ConsoleError("Exception with OnServerInfo of '" + m.name + "': " + exc.Message + " " + exc.StackTrace); } }
private void SetServerInfoLabels(CServerInfo csiServerInfo) { //this.lblServerName.Text = String.Format("{0} [{1}]", csiServerInfo.ServerName, this.m_prcConnection.HostNamePort); this.uscAccounts.ServerName = csiServerInfo.ServerName; //this.lblCurrentMapName.Text = String.Format("{0} - {1}", this.m_prcConnection.GetFriendlyGamemode(csiServerInfo.GameMode), this.m_prcConnection.GetFriendlyMapname(csiServerInfo.Map)); // add enhanced detection CMap tmpMap = this.m_prcConnection.GetFriendlyMapByFilenamePlayList(csiServerInfo.Map, csiServerInfo.GameMode); this.lblCurrentMapName.Text = tmpMap != null ? String.Format("{0} - {1}", tmpMap.GameMode, tmpMap.PublicLevelName) : String.Empty; this.toolTipMapControls.SetToolTip(this.lblCurrentMapName, csiServerInfo.Map); if ((this.Client.Game is BFHLClient || this.Client.Game is BF4Client || this.Client.Game is BF3Client || this.Client.Game is MOHWClient) && (csiServerInfo.CurrentRound != csiServerInfo.TotalRounds)) { this.lblCurrentRound.Text = this.m_clocLanguage.GetLocalized("uscServerConnection.lblCurrentRound", (csiServerInfo.CurrentRound + 1).ToString(), csiServerInfo.TotalRounds.ToString()); } else { this.lblCurrentRound.Text = this.m_clocLanguage.GetLocalized("uscServerConnection.lblCurrentRound", csiServerInfo.CurrentRound.ToString(), csiServerInfo.TotalRounds.ToString()); } this.lblMappack.Text = this.m_clocLanguage.GetLocalized("uscServerConnection.lblMappack", csiServerInfo.Mappack.ToString()); if (csiServerInfo.ConnectionState.Length > 0) { this.lblPlasmaStatus.Text = this.m_clocLanguage.GetLocalized(String.Format("uscServerConnection.lblPlasmaStatus.{0}", csiServerInfo.ConnectionState)); // this.toolTipPlasma.SetToolTip(this.lblPlasmaStatus, this.m_clocLanguage.GetLocalized(String.Format("uscServerConnection.lblPlasmaStatus.{0}.ToolTip", csiServerInfo.ConnectionState))); // 
 or Environment.NewLine if (csiServerInfo.GameMod == GameMods.BC2 || csiServerInfo.GameMod == GameMods.VIETNAM) { this.toolTipPlasma.SetToolTip(this.lblPlasmaStatus, this.m_clocLanguage.GetLocalized(String.Format("uscServerConnection.lblPlasmaStatus.{0}.ToolTip", csiServerInfo.ConnectionState)) + Environment.NewLine + Environment.NewLine + this.m_clocLanguage.GetLocalized("uscServerConnection.extServerInfo.ExternalGameIpandPort.ToolTip") + "\t" + csiServerInfo.ExternalGameIpandPort + Environment.NewLine + this.m_clocLanguage.GetLocalized("uscServerConnection.extServerInfo.JoinQueueEnabled.ToolTip") + "\t" + this.m_clocLanguage.GetLocalized(String.Format("uscServerConnection.extServerInfo.JoinQueueEnabled.{0}.ToolTip", csiServerInfo.JoinQueueEnabled)) + Environment.NewLine + this.m_clocLanguage.GetLocalized("uscServerConnection.extServerInfo.ServerRegion.ToolTip") + "\t\t" + this.m_clocLanguage.GetLocalized(String.Format("uscServerConnection.extServerInfo.ServerRegion.{0}.ToolTip", csiServerInfo.ServerRegion)) + Environment.NewLine + this.m_clocLanguage.GetLocalized("uscServerConnection.extServerInfo.PunkBusterVersion.ToolTip") + "\t" + csiServerInfo.PunkBusterVersion + Environment.NewLine + Environment.NewLine ); } else { this.toolTipPlasma.SetToolTip(this.lblPlasmaStatus, this.m_clocLanguage.GetLocalized(String.Format("uscServerConnection.lblPlasmaStatus.{0}.ToolTip", csiServerInfo.ConnectionState))); } switch (csiServerInfo.ConnectionState) { case "NotConnected": this.lblPlasmaStatus.ForeColor = Color.Maroon; break; case "ConnectedToBackend": this.lblPlasmaStatus.ForeColor = Color.Gold; break; case "AcceptingPlayers": this.lblPlasmaStatus.ForeColor = Color.MediumSeaGreen; break; default: break; } } // BF3 & MOHW goes here cause it has ConnectionState parameter is empty if (this.Client.Game is BF3Client) { this.toolTipPlasma.SetToolTip(this.lblPlasmaStatus, this.m_clocLanguage.GetLocalized("uscServerConnection.lblPlasmaStatus.AcceptingPlayers.ToolTip") + Environment.NewLine + Environment.NewLine + this.m_clocLanguage.GetLocalized("uscServerConnection.extServerInfo.ExternalGameIpandPort.ToolTip") + "\t" + csiServerInfo.ExternalGameIpandPort + Environment.NewLine + this.m_clocLanguage.GetLocalized("uscServerConnection.extServerInfo.JoinQueueEnabled.ToolTip") + "\t" + this.m_clocLanguage.GetLocalized(String.Format("uscServerConnection.extServerInfo.JoinQueueEnabled.{0}.ToolTip", csiServerInfo.JoinQueueEnabled)) + Environment.NewLine + this.m_clocLanguage.GetDefaultLocalized("QuickMatch Detected:", "uscServerConnection.extServerInfo.QuickMatch.ToolTip") + "\t" + this.m_clocLanguage.GetDefaultLocalized(csiServerInfo.QuickMatch.ToString(), String.Format("uscServerConnection.extServerInfo.QuickMatch.{0}.ToolTip", csiServerInfo.QuickMatch.ToString())) + Environment.NewLine + Environment.NewLine + this.m_clocLanguage.GetLocalized("uscServerConnection.extServerInfo.ServerRegion.ToolTip") + "\t\t" + this.m_clocLanguage.GetLocalized(String.Format("uscServerConnection.extServerInfo.ServerRegion.{0}.ToolTip", csiServerInfo.ServerRegion)) + Environment.NewLine + this.m_clocLanguage.GetDefaultLocalized("Server Country:", "uscServerConnection.extServerInfo.ServerCountry.ToolTip") + "\t\t" + csiServerInfo.ServerCountry + Environment.NewLine + this.m_clocLanguage.GetDefaultLocalized("Closest Ping Site:", "uscServerConnection.extServerInfo.PingSite.ToolTip") + "\t\t" + this.m_clocLanguage.GetDefaultLocalized(csiServerInfo.PingSite, String.Format("uscServerConnection.extServerInfo.PingSite.{0}.ToolTip", csiServerInfo.PingSite)) + Environment.NewLine + Environment.NewLine + this.m_clocLanguage.GetLocalized("uscServerConnection.extServerInfo.PunkBusterVersion.ToolTip") + "\t" + csiServerInfo.PunkBusterVersion + Environment.NewLine + Environment.NewLine ); } if (this.Client.Game is BFHLClient || this.Client.Game is BF4Client) { this.toolTipPlasma.SetToolTip(this.lblPlasmaStatus, this.m_clocLanguage.GetLocalized("uscServerConnection.lblPlasmaStatus.AcceptingPlayers.ToolTip") + Environment.NewLine + Environment.NewLine + this.m_clocLanguage.GetLocalized("uscServerConnection.extServerInfo.ExternalGameIpandPort.ToolTip") + "\t" + csiServerInfo.ExternalGameIpandPort + Environment.NewLine + this.m_clocLanguage.GetLocalized("uscServerConnection.extServerInfo.JoinQueueEnabled.ToolTip") + "\t" + this.m_clocLanguage.GetLocalized(String.Format("uscServerConnection.extServerInfo.JoinQueueEnabled.{0}.ToolTip", csiServerInfo.JoinQueueEnabled)) + Environment.NewLine + this.m_clocLanguage.GetDefaultLocalized("MatchMaking Enabled:", "uscServerConnection.extServerInfo.MatchMaking.ToolTip") + "\t" + this.m_clocLanguage.GetDefaultLocalized(csiServerInfo.QuickMatch.ToString(), String.Format("uscServerConnection.extServerInfo.QuickMatch.{0}.ToolTip", csiServerInfo.QuickMatch.ToString())) + Environment.NewLine + Environment.NewLine + this.m_clocLanguage.GetLocalized("uscServerConnection.extServerInfo.ServerRegion.ToolTip") + "\t\t" + this.m_clocLanguage.GetLocalized(String.Format("uscServerConnection.extServerInfo.ServerRegion.{0}.ToolTip", csiServerInfo.ServerRegion)) + Environment.NewLine + this.m_clocLanguage.GetDefaultLocalized("Server Country:", "uscServerConnection.extServerInfo.ServerCountry.ToolTip") + "\t\t" + csiServerInfo.ServerCountry + Environment.NewLine + this.m_clocLanguage.GetDefaultLocalized("Closest Ping Site:", "uscServerConnection.extServerInfo.PingSite.ToolTip") + "\t\t" + this.m_clocLanguage.GetDefaultLocalized(csiServerInfo.PingSite, String.Format("uscServerConnection.extServerInfo.PingSite.{0}.ToolTip", csiServerInfo.PingSite)) + Environment.NewLine + Environment.NewLine + this.m_clocLanguage.GetLocalized("uscServerConnection.extServerInfo.PunkBusterVersion.ToolTip") + "\t" + csiServerInfo.PunkBusterVersion + Environment.NewLine + Environment.NewLine + this.m_clocLanguage.GetDefaultLocalized("Blaze Player Count:", "uscServerConnection.extServerInfo.BlazePlayerCount.ToolTip") + "\t\t" + csiServerInfo.BlazePlayerCount + Environment.NewLine + this.m_clocLanguage.GetDefaultLocalized("Blaze Game State:", "uscServerConnection.extServerInfo.BlazeGameState.ToolTip") + "\t\t" + csiServerInfo.BlazeGameState + Environment.NewLine + Environment.NewLine ); } // MoHW is way different to BF3 R-33 if (this.Client.Game is MOHWClient) { this.toolTipPlasma.SetToolTip(this.lblPlasmaStatus, this.m_clocLanguage.GetLocalized("uscServerConnection.lblPlasmaStatus.AcceptingPlayers.ToolTip") + Environment.NewLine + Environment.NewLine + this.m_clocLanguage.GetLocalized("uscServerConnection.extServerInfo.ServerRegion.ToolTip") + "\t\t" + this.m_clocLanguage.GetLocalized(String.Format("uscServerConnection.extServerInfo.ServerRegion.{0}.ToolTip", csiServerInfo.ServerRegion)) + Environment.NewLine + this.m_clocLanguage.GetDefaultLocalized("Server Country:", "uscServerConnection.extServerInfo.ServerCountry.ToolTip") + "\t\t" + csiServerInfo.ServerCountry + Environment.NewLine + this.m_clocLanguage.GetDefaultLocalized("Closest Ping Site:", "uscServerConnection.extServerInfo.PingSite.ToolTip") + "\t\t" + this.m_clocLanguage.GetDefaultLocalized(csiServerInfo.PingSite, String.Format("uscServerConnection.extServerInfo.PingSite.{0}.ToolTip", csiServerInfo.PingSite)) + Environment.NewLine + Environment.NewLine + this.m_clocLanguage.GetLocalized("uscServerConnection.extServerInfo.PunkBusterVersion.ToolTip") + "\t" + csiServerInfo.PunkBusterVersion + Environment.NewLine + Environment.NewLine ); } }
public override void OnServerInfo(CServerInfo csiServerInfo) { int max_tickets; lock (info_mutex) { this.serverInfo = csiServerInfo; string gamemode = serverInfo.GameMode.ToLower(); // first goes logic for conquests if (!modes[gamemode].Equals("tdm") && !modes[gamemode].Equals("tdmcq")) max_tickets = this.serverInfo.TeamScores[0].Score; else max_tickets = this.serverInfo.TeamScores[0].WinningScore; } if (max_tickets > max_round_tickets) max_round_tickets = max_tickets; DebugWrite("max round tickets : " + max_round_tickets, 1); }
public override void OnServerInfo(CServerInfo serverInfo) { playerCount = serverInfo.PlayerCount; maxPlayerCount = serverInfo.MaxPlayerCount; if (isPluginEnabled) { if (playerCount >= disable_spectators_PlayerCount) DisableSpectators(); if (playerCount <= enable_spectators_PlayerCount) EnableSpectators(); } }
public virtual void OnServerInfo(CServerInfo serverInfo) { List<TeamScore> scores = new List<TeamScore>(); // number of tickets remaining per team // EVENT EXCEPTION BLOCK: try { WriteDebugInfo("ProconRulz: *******************OnServerInfo*****************************"); current_map = this.GetMapByFilename(serverInfo.Map); current_map_mode = serverInfo.GameMode; if (serverInfo.TeamScores != null) { // set up team score variables %server_team_score[1]%, %server_team_score[2]% ... foreach (TeamScore t in serverInfo.TeamScores) { if (t.TeamID == null || t.Score == null) { WriteConsole(String.Format("ProconRulz: OnServerInfo TeamID,Score error [{0}][{1}]", t.TeamID, t.Score)); break; } string var_name = "%server_team_score[" + t.TeamID.ToString() + "]%"; rulz_vars.set_value(null, var_name, t.Score.ToString(), null); } } } catch (Exception ex) { WriteConsole("ProconRulz: recoverable exception in OnServerInfo"); PrintException(ex); } }
public void OnServerInfo(CServerInfo csiServerInfo) { this.m_csiLatestServerInfo = csiServerInfo; if (this.m_csiLatestServerInfo.CurrentRound == this.m_csiLatestServerInfo.TotalRounds) { if (this.m_blFinalRoundSet == false) { this.SetNextMap(); this.m_blFinalRoundSet = true; } } else { this.m_blFinalRoundSet = false; } }
public void setServerInfo(CServerInfo info) { lock (this.serverInfoMutex) { this.serverInfo = info; } }
public override void OnServerInfo(CServerInfo csiServerInfo) { this.strcurrentGametype = csiServerInfo.GameMode; this.intMaxSlots = csiServerInfo.MaxPlayerCount; this.intCurrentRoundCount = csiServerInfo.TotalRounds - csiServerInfo.CurrentRound; this.intScoreTeamA = 0; this.intScoreTeamB = 0; //DebugInfoSkill("Before Check: " + this.intTicketcount + ", GameMode: " + this.strcurrentGametype); if (this.strcurrentGametype.Contains("GunMaster")) { this.intScoreTeamA = 10000; this.intScoreTeamB = 10000; } else { foreach (TeamScore score in csiServerInfo.TeamScores) { if (score.TeamID == 1) { this.intScoreTeamA = score.Score; if (this.intTicketcount == 123987123 && this.strcurrentGametype.Contains("TeamDeathMatch")) { this.intTicketcount = score.WinningScore; } } else if (score.TeamID == 2) { this.intScoreTeamB = score.Score; } } } if ((this.strcurrentGametype.Contains("Conquest") || this.strcurrentGametype.Contains("TankSuperiority0") || this.strcurrentGametype.Contains("Domination0")) && this.boolLevelStart) { if (this.intTicketcount == 123987123) { if (this.intScoreTeamA > this.intScoreTeamB) this.intTicketcount = this.intScoreTeamB; else this.intTicketcount = this.intScoreTeamA; } this.intminScore = intminScoreCONQUEST; if ( (this.TeamA + this.TeamB) < this.intTreshCONQUEST){ this.intAllowDif = this.intAllowDif1CONQUEST; }else{ this.intAllowDif = this.intAllowDif2CONQUEST; } } else if (this.strcurrentGametype.Contains("Rush") && this.boolLevelStart) { if (this.intTicketcount == 123987123) { if (this.intScoreTeamA > this.intScoreTeamB) this.intTicketcount = this.intScoreTeamB; else this.intTicketcount = this.intScoreTeamA; } this.intminScore = intminScoreRUSH; if ( (this.TeamA + this.TeamB) < this.intTreshRUSH){ this.intAllowDif = this.intAllowDif1RUSH; }else{ this.intAllowDif = this.intAllowDif2RUSH; } } else if (this.strcurrentGametype.Contains("GunMaster") && this.boolLevelStart) { this.intminScore = 0; if ((this.TeamA + this.TeamB) < this.intTreshGM) { this.intAllowDif = this.intAllowDif1GM; } else { this.intAllowDif = this.intAllowDif2GM; } } else if (this.strcurrentGametype.Contains("TeamDeathMatch") && this.boolLevelStart) { this.intminScore = this.intTicketcount - intminScoreTDM; if ( (this.TeamA + this.TeamB) < this.intTreshTDM){ this.intAllowDif = this.intAllowDif1TDM; }else{ this.intAllowDif = this.intAllowDif2TDM; } } int intticketdiffrence = 0; //DebugInfoSkill("TicketCount: " + this.intTicketcount); if (this.intScoreTeamA > this.intScoreTeamB) intticketdiffrence = this.intScoreTeamA - this.intScoreTeamB; else if (this.intScoreTeamA < this.intScoreTeamB) intticketdiffrence = this.intScoreTeamB - this.intScoreTeamA; if (!this.boolmessagesent && (this.strcurrentGametype.Contains("Conquest") || this.strcurrentGametype.Contains("TankSuperiority0") || this.strcurrentGametype.Contains("Domination0")) && this.ynbenableSkillCONQUEST == enumBoolYesNo.Yes && (this.intScoreTeamA < 40 || this.intScoreTeamB < 40)) { this.boolmessagesent = true; DebugInfoSkill("SI - CQ - Gamemode: ^b" + this.strcurrentGametype); if (this.ynbScrambleMapCONQUEST == enumBoolYesNo.Yes && this.intCurrentRoundCount == 1){ DebugInfoSkill("SI - Scrambling on every new map: ^b" + this.strcurrentGametype); if (this.strScrambleMessageCONQUEST !=""){ this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleMessageCONQUEST, "all"); if (this.ynbYellScrambleMessage == enumBoolYesNo.Yes){ this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleMessageCONQUEST, "30"); } } } else if ((this.intwonTicketsCONQUEST * this.intTicketcount/100) <= intticketdiffrence && (this.intCurrentRoundCount == 1 || this.ynbScrambleEveryRoundCONQUEST == enumBoolYesNo.Yes)) { DebugInfoSkill("SI - Won with too much tickets: ^b" + this.strcurrentGametype); if (this.strScrambleMessageCONQUEST !=""){ this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleMessageCONQUEST, "all"); if (this.ynbYellScrambleMessage == enumBoolYesNo.Yes){ this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleMessageCONQUEST, "30"); } } } else { DebugInfoSkill("SI - " + this.strcurrentGametype + ":^b^1 No reason to scramble!"); } } else if (!this.boolmessagesent && this.strcurrentGametype.Contains("TeamDeathMatch") && this.ynbenableSkillTDM == enumBoolYesNo.Yes && (this.intScoreTeamA > (this.intTicketcount - 25) || this.intScoreTeamB > (this.intTicketcount - 25))) { this.boolmessagesent = true; DebugInfoSkill("SI - TDM - Gamemode: ^b" + this.strcurrentGametype); if (this.ynbScrambleMapTDM == enumBoolYesNo.Yes && this.intCurrentRoundCount == 1){ DebugInfoSkill("SI - Scrambling on every new map: ^b" + this.strcurrentGametype); if (this.strScrambleMessageTDM !=""){ this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleMessageTDM, "all"); if (this.ynbYellScrambleMessage == enumBoolYesNo.Yes){ this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleMessageTDM, "30"); } } }else if ((this.intwonTicketsTDM * this.intTicketcount/100) <= intticketdiffrence && ( this.intCurrentRoundCount == 1 || this.ynbScrambleEveryRoundTDM == enumBoolYesNo.Yes)){ DebugInfoSkill("SI - Won with too much tickets: ^b" + this.strcurrentGametype); if (this.strScrambleMessageTDM !=""){ this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleMessageTDM, "all"); if (this.ynbYellScrambleMessage == enumBoolYesNo.Yes){ this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleMessageTDM, "30"); } } } else { DebugInfoSkill("SI - " + this.strcurrentGametype + ": ^b^1No reason to scramble!"); } } /* if ((this.intScoreTeamA < 40 || this.intScoreTeamB < 40) && this.ynbenableSkill==enumBoolYesNo.Yes && this.strcurrentGametype != "squadrush0" && this.strcurrentGametype != "rushlarge0"){ // if ((this.intwonTickets <= intticketdiffrence || this.ynbScrambleMap == enumBoolYesNo.Yes)&& this.intCurrentRoundCount == 1){ if (this.intwonTickets <= intticketdiffrence || this.ynbScrambleMap == enumBoolYesNo.Yes){ if (this.strScrambleMessage !="" && this.boolticketdif == false){ this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleMessage , "all"); this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleMessage, "30"); } this.boolticketdif = true; } } */ this.DebugInfo("Serverinfo: ^1ScoreA: ^i" + this.intScoreTeamA.ToString() + "^n, ^2ScoreB: ^i" + this.intScoreTeamB.ToString() + "^n, ^9RoundCount: ^i " + this.intCurrentRoundCount.ToString()); }