public override void OnListPlayers(List<CPlayerInfo> players, CPlayerSubset subset)
        {
            foreach (var player in players)
            {
                var soldierName = player.SoldierName;
                if (ignoreReservedPlayers && reservedPlayers != null && reservedPlayers.Contains(soldierName))
                {
                    continue;
                }

                int rank = player.Rank;
                if (rank == 0)
                {
                    rank = _GetGameTrackerBC2Stats(soldierName);
                    if (rank == 0)
                    {
                        rank = _GetBFBCStatRank(soldierName);
                        if (rank == 0) continue;
                    }
                }

                if (rank > rankLimit)
                {
                    ExecuteCommand("procon.protected.send", "admin.kickPlayer", soldierName, "You got kicked due to your Player Rank (" + rank + ") being too high!");
                    ExecuteCommand("procon.protected.send", "admin.say", "Kicked '" + soldierName + "' because their Player Rank (" + rank + ") is too high!");
                }
            }
        }
        public override void OnListPlayers(List<CPlayerInfo> players, CPlayerSubset subset)
        {
            if (reservedPlayers == null)
            {
                return;
            }

            foreach (var player in players)
            {
                var soldierName = player.SoldierName;

                if (!reservedPlayers.Contains(soldierName))
                {
                    _KickPlayer(soldierName);
                }
            }
        }
Пример #3
0
 public void OnCommandPlayerGUID(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) {
     if (this.m_enAllowPlayersToGuidOthers == enumBoolYesNo.Yes) {
         if (base.PunkbusterPlayerInfoList.ContainsKey(capCommand.MatchedArguments[0].Argument) == true && base.PunkbusterPlayerInfoList[capCommand.MatchedArguments[0].Argument].GUID.Length == 32) {
             this.ExecuteCommand("procon.protected.send", "admin.say", base.PunkbusterPlayerInfoList[capCommand.MatchedArguments[0].Argument].SoldierName + "'s P/GUID: " + base.PunkbusterPlayerInfoList[capCommand.MatchedArguments[0].Argument].GUID.Substring(24, 8), "player", strSpeaker);
         }
         else {
             this.ExecuteCommand("procon.protected.send", "admin.say", "Player not found", "player", strSpeaker);
         }
     }
 }
Пример #4
0
        public override void OnListPlayers(List<CPlayerInfo> lstPlayers, CPlayerSubset cpsSubset)
        {
            // EVENT EXCEPTION BLOCK:
            try
            {
            WriteDebugInfo("ProconRulz: ********************OnListPlayers******************************");
            // if (trace_rules == enumBoolYesNo.Yes) prdebug("counts");
            // if 'admin.listPlayers all' then do full update of players list and return
            if (cpsSubset.Subset == CPlayerSubset.PlayerSubsetType.All)
            {
                players.pre_scrub(); // reset all 'updated' flags to false

                admins_reset(); // empty list of currently logged on admins

                foreach (CPlayerInfo cp_info in lstPlayers)
                {
                    players.update(cp_info);
                    // add this player to list of logged-on admins if required
                    admins_add(cp_info.SoldierName);
                    // create/update a score variable for each player
                    string var_name = "%server_score[" + cp_info.SoldierName + "]%";
                    rulz_vars.set_value(null, var_name, cp_info.Score.ToString(), null);
                }
                players.scrub(); // remove all players that were not updated

            }
            if (trace_rules == enumBoolYesNo.Yes) prdebug("counts");
            }
            catch (Exception ex)
            {
                WriteConsole("ProconRulz: recoverable exception in OnListPlayers");
                PrintException(ex);
            }
        }
Пример #5
0
        public void onPlayersStatsCmd(List<CPlayerInfo> lstPlayers, CPlayerSubset cpsSubset) {

            if (cpsSubset.Subset == CPlayerSubset.PlayerSubsetType.All)
                foreach (CPlayerInfo cpiPlayer in lstPlayers)
                    if (this.players.ContainsKey(cpiPlayer.SoldierName))
                        this.players[cpiPlayer.SoldierName].updateInfo(cpiPlayer);

            /* fail safe to get the maximum number of players in server */
            if (lstPlayers.Count > max_player_count)
                max_player_count = lstPlayers.Count;
        }
Пример #6
0
        public override void OnListPlayers(List<CPlayerInfo> players, CPlayerSubset subset)
        {
            if (!fIsEnabled) return;

            DebugWrite("^9^bGot OnListPlayers^n", 8);

            try {
            if (subset.Subset != CPlayerSubset.PlayerSubsetType.All) return;

            lock (fListPlayersQ) {
            fListPlayersTimestamp = DateTime.Now;
            Monitor.Pulse(fListPlayersQ);
            }

            /*
            Check if server crashed or Blaze dumped players or model invalid for too long.
            Detected by: last recorded server uptime is greater than zero and less than new uptime,
            or a player model timed out while still being on the all players list,
            or got an OnLogin callback, which is used in connection initialization for Procon,
            or the current list of players is more than CRASH_COUNT_HEURISTIC players less than the last
            recorded count, or the last known player count is greater than the maximum server size,
            or more than 3 minutes have elapsed since a move/reassign was started.
            Since these detections are not completely reliable, do a minimal  amount of recovery,
            don't do a full reset
            */
            if (fServerCrashed
            || fGotLogin
            || fRefreshCommand
            || (fServerCrashed = (this.TotalPlayerCount >= 16
            && this.TotalPlayerCount > players.Count
            && (this.TotalPlayerCount - players.Count) >= Math.Min(CRASH_COUNT_HEURISTIC, this.TotalPlayerCount)))
            || this.TotalPlayerCount > MaximumServerSize
            || (fTimeOutOfJoint > 0 && GetTimeInRoundMinutes() - fTimeOutOfJoint > 3.0))  {
            ValidateModel(players);
            fServerCrashed = false;
            fGotLogin = false;
            fRefreshCommand = false;
            fTimeOutOfJoint = 0;
            } else {
            fUnassigned.Clear();

            foreach (CPlayerInfo p in players) {
                try {
                    UpdatePlayerModel(p.SoldierName, p.TeamID, p.SquadID, p.GUID, p.Score, p.Kills, p.Deaths, p.Rank);
                } catch (Exception e) {
                    ConsoleException(e);
                    continue;
                }
            }
            }

            GarbageCollectKnownPlayers(); // also resets LastMoveTo

            UpdateTeams();

            LogStatus(false, DebugLevel);

            /* Special handling for JustEnabled state */
            if (fPluginState == PluginState.JustEnabled) {
            fPluginState = PluginState.Active;
            fRoundStartTimestamp = DateTime.Now;
            DebugWrite("^b^3State = " + fPluginState, 6);
            }

            // Use updated player list, one-time updates
            if (fNeedPlayerListUpdate) {
            try { AssignGroups(); } catch (Exception e) { ConsoleException(e); }
            try { RememberTeams(); } catch (Exception e) { ConsoleException(e); }
            fNeedPlayerListUpdate = false;
            }

            //CommandToLog("whitelist");
            foreach (CPlayerInfo p in players) {
            try {
                PlayerModel player = GetPlayer(p.SoldierName);
                if (player == null) continue;
                String guid = (String.IsNullOrEmpty(player.EAGUID)) ? INVALID_NAME_TAG_GUID : player.EAGUID;
                String xt = ExtractTag(player);
                if (String.IsNullOrEmpty(xt)) xt = INVALID_NAME_TAG_GUID;
                foreach (String item in fSettingWhitelist) {
                    List<String> tokens = new List<String>(Regex.Split(item, @"\s+"));
                    if (tokens.Count < 1) {
                        continue;
                    }
                    if (tokens[0] == player.Name || tokens[0] == xt || tokens[0] == guid) {
                        if (player.Whitelist == 0) {
                            DebugWrite("^8^bWARNING^n^0: (^b" + player.Name + ", " + xt + ", ^n" + guid + ") matches (" + String.Join(", ", tokens.ToArray()) + ") ^8^bBUT NO WHITELIST FLAGS SET!", 7);
                        }
                    }
                }
            } catch (Exception e) {
                ConsoleException(e);
            }
            }

            } catch (Exception e) {
            ConsoleException(e);
            }
        }
 public void OnCommandToggle(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
 {
     if (capCommand.ExtraArguments == "0" || capCommand.ExtraArguments == "off")
     {
         this.ExecuteCommand("procon.protected.send", "admin.say", "RankKicker disabled!", "all");
         this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^4AccessRestriction: ^0RankKicker disabled ingame!");
         this.m_RankKickerOnOff = enumBoolOnOff.Off;
     }
     else if (capCommand.ExtraArguments == "1" || capCommand.ExtraArguments == "on")
     {
         this.ExecuteCommand("procon.protected.send", "admin.say", "RankKicker enabled!", "all");
         this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^4AccessRestriction: ^0RankKicker enabled ingame!");
         this.m_RankKickerOnOff = enumBoolOnOff.On;
     }
     else if (capCommand.ExtraArguments == "clear")
     {
         Clear(0);
     }
     else if (capCommand.ExtraArguments == "check")
     {
         this.ExecuteCommand("procon.protected.send", "admin.say", "RankKicker checking all players!", "all");
         this.ExecuteCommand("procon.protected.pluginconsole.write", "^b^4AccessRestriction: ^0RankKicker checking all players!");
         this.ExecuteCommand("procon.protected.send", "admin.listPlayers", "all");
     }
     else
     {
         this.ExecuteCommand("procon.protected.send", "admin.say", "Wrong arguments. Use '0'/'off', '1'/'on', 'clear' or 'check'!", "all");
     }
 }
Пример #8
0
        public void OnListPlayers(List<CPlayerInfo> lstPlayers, CPlayerSubset cpsSubset) {

        }
Пример #9
0
 public override void OnListPlayers(List<CPlayerInfo> players, CPlayerSubset subset)
 {
 }
Пример #10
0
        public override void OnListPlayers(List<CPlayerInfo> Players, CPlayerSubset Subset)
        {
            PlayerList = Players;

            if (ZombieModeEnabled == false)
                return;

            if (Players.Count + JoinQueue.Count > 0 && GetState() != GState.Idle) DebugWrite("OnListPlayers: " + Players.Count + " players, " + JoinQueue.Count + " joining", 5);

            if (OldGameState != GetState()) DebugWrite("OnListPlayers: GameState = " + GetState(), 3);
            OldGameState = GetState();

            if (CheckIdle(Players))
            {
                // We kicked some idle players, so update the player list again
                RequestPlayersList();
                return;
            }

            List<String> HumanCensus = new List<String>();
            List<String> ZombieCensus = new List<String>();

            foreach (CPlayerInfo Player in Players)
            {
                KillTracker.AddPlayer(Player.SoldierName.ToString());

                // Team tracking
                if (Player.TeamID == 1)
                {
                    HumanCensus.Add(Player.SoldierName);
                    DebugWrite("OnListPlayers: counted " + Player.SoldierName + " as human (" + HumanCensus.Count + ")", 6);
                }
                else if (Player.TeamID == 2)
                {
                    // Othewise, add
                    ZombieCensus.Add(Player.SoldierName);
                    DebugWrite("OnListPlayers: counted " + Player.SoldierName + " as zombie (" + ZombieCensus.Count + ")", 6);
                }
                else
                {
                    DebugWrite("OnListPlayers: unknown team " + Player.TeamID + " for player " + Player.SoldierName, 5);
                }

                RemoveJoinQueue(Player.SoldierName);
            }

            // Check for differences

            KnownPlayerCount = HumanCensus.Count + ZombieCensus.Count;

            bool SomeoneMoved = false;

            lock (TeamHuman)
            {
                if (Players.Count > 0) DebugWrite("OnListPlayers: human count " + TeamHuman.Count + " vs " + HumanCensus.Count + ", zombie count " + TeamZombie.Count + " vs " + ZombieCensus.Count, 6);

                SomeoneMoved = (TeamHuman.Count != HumanCensus.Count);
                SomeoneMoved |= (TeamZombie.Count != ZombieCensus.Count);
            }

            if (GetState() != GState.Idle && (HumanCensus.Count+ZombieCensus.Count) == 0)
            {
                Reset();
                return;
            }

            if (GetState() == GState.Playing)
            {
                if (SomeoneMoved)
                {
                    DebugWrite("OnListPlayers: playing, checking victory conditions", 5);
                }
                CheckVictoryConditions(false);
            }
            else if (GetState() == GState.BetweenRounds)
            {
                DebugWrite("OnListPlayers: between rounds", 5);
            }
            else if (GetState() == GState.Idle || GetState() == GState.Waiting || GetState() == GState.RoundStarting)
            {
                // force update when not playing a match
                if (SomeoneMoved)
                {
                    DebugWrite("OnListPlayers: teams updated, not playing yet", 5);

                    lock (TeamHuman)
                    {
                        TeamHuman.Clear();
                        TeamHuman.AddRange(HumanCensus);
                        TeamZombie.Clear();
                        TeamZombie.AddRange(ZombieCensus);
                    }
                }
            }
        }
Пример #11
0
 public void OnCommandPlayerTimes(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) {
     if (this.m_enAllowPlayersToTimeOthers == enumBoolYesNo.Yes) {
         if (base.FrostbitePlayerInfoList.ContainsKey(capCommand.MatchedArguments[0].Argument) == true && base.FrostbitePlayerInfoList[capCommand.MatchedArguments[0].Argument].SessionTime != 0) {
             string strOutTime = this.SecondsToText((UInt32)base.FrostbitePlayerInfoList[capCommand.MatchedArguments[0].Argument].SessionTime, this.m_astrTimeDescription, true);
             this.ExecuteCommand("procon.protected.send", "admin.say", base.FrostbitePlayerInfoList[capCommand.MatchedArguments[0].Argument].SoldierName + "'s playTime: " + strOutTime, "player", strSpeaker);
         } else {
             this.ExecuteCommand("procon.protected.send", "admin.say", "Player not found / or just joined", "player", strSpeaker);
         }
     }
 }
Пример #12
0
 public void OnCommandMyTimes(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) {
     if (base.FrostbitePlayerInfoList.ContainsKey(strSpeaker) == true && base.FrostbitePlayerInfoList[strSpeaker].SessionTime != 0) {
         string strOutTime = this.SecondsToText((UInt32)base.FrostbitePlayerInfoList[strSpeaker].SessionTime, this.m_astrTimeDescription, true);
         this.ExecuteCommand("procon.protected.send", "admin.say", "Your current playTime: " + strOutTime, "player", strSpeaker);
     } else {
         this.ExecuteCommand("procon.protected.send", "admin.say", "Sorry, you've just joined =(", "player", strSpeaker);
     }
 }
Пример #13
0
 public void OnCommandVersion(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) {
     this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("IP: {0}, Location: {1}, Rcon: PRoCon {2}", this.m_strHostName, this.GetVariable<string>("SERVER_COUNTRY", ""), this.m_strPRoConVersion), "player", strSpeaker);
 }
Пример #14
0
        public void OnCommandHelpSpecific(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) {
            List<MatchCommand> lstCommands = this.GetRegisteredCommands();

            CPrivileges privileges = this.GetAccountPrivileges(strSpeaker);

            foreach (MatchCommand mtcLoopedCommand in lstCommands) {
                if (String.Compare(mtcLoopedCommand.Command, capCommand.MatchedArguments[0].Argument, true) == 0 && mtcLoopedCommand.Requirements.HasValidPermissions(privileges) == true) {
                    foreach (string strLine in this.WordWrap(String.Format("> {0}; {1}", mtcLoopedCommand.ToString(), mtcLoopedCommand.Description), 100)) {
                        this.ExecuteCommand("procon.protected.send", "admin.say", strLine, "player", strSpeaker);
                    }
                }
            }
        }
Пример #15
0
        public void OnCommandHelp(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) {
            this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("Type \"{0}help [command]\" for more information about a command:", capCommand.ResposeScope), "player", strSpeaker);

            foreach (string strCommandOutput in this.WordWrap(String.Join(", ", this.GetExcludedCommandStrings(strSpeaker).ToArray()), 100)) {
                this.ExecuteCommand("procon.protected.send", "admin.say", strCommandOutput, "player", strSpeaker);
            }
        }
Пример #16
0
        // Communication Events
        public void OnYelling(string strMessage, int iMessageDuration, CPlayerSubset cpsSubset) {

        }
Пример #17
0
        public void OnSaying(string strMessage, CPlayerSubset cpsSubset) {

        }
Пример #18
0
        public override void OnListPlayers(List<CPlayerInfo> players, CPlayerSubset subset)
        {
            List<string> tmpTeam1Players = new List<string>();
            List<string> tmpTeam2Players = new List<string>();

            foreach(CPlayerInfo player in players){
                    if(player.TeamID == 1){
                        tmpTeam1Players.Add(player.SoldierName);
                    } else if(player.TeamID == 2){
                        tmpTeam2Players.Add(player.SoldierName);
                    }
            }
            this.team1Players = tmpTeam1Players;
            this.team2Players = tmpTeam2Players;
        }
Пример #19
0
 public override void OnListPlayers(List<CPlayerInfo> players, CPlayerSubset cpsSubset)
 {
     try {
         //Only handle the list if it is an "All players" list
         if (cpsSubset.Subset == CPlayerSubset.PlayerSubsetType.All) {
             //Return if small duration (5 seconds) since last player list
             if ((DateTime.UtcNow - this._LastSuccessfulPlayerList) < TimeSpan.FromSeconds(5)) {
                 //Avoid "over-handling" player listing
             }
             else {
                 //Only perform the following if all threads are ready
                 if (this._ThreadsReady) {
                     this.QueuePlayerListForProcessing(players);
                 }
             }
         }
     }
     catch (Exception e) {
         this.HandleException(new AdKatsException("Error occured while listing players.", e));
     }
 }
        public override void OnListPlayers(List<CPlayerInfo> lstPlayers, CPlayerSubset cpsSubset) {
            int numStatsFetch = this.intMaxPlayersToFetch;
            int numRemaining = lstPlayers.Count;

            if (lstPlayers.Count == 0 && this.boolnoplayer == false){           
                this.boolnoplayer = true;
                this.dicPlayerCache.Clear();
                this.DebugInfo("^3^b" + lstPlayers.Count.ToString() + " Players on the server.");
                return;
            } else if (lstPlayers.Count != 0 && this.boolnoplayer) {
                this.boolnoplayer = false;
            } else if (lstPlayers.Count == 0) {
                return; // suppress debugging messages for empty server
            }

            TimeSpan ScrambleTime  = new TimeSpan(0);
            ScrambleTime = DateTime.Now - this.DTScramblestarted;
            if (ScrambleTime.TotalSeconds > 20 && this.boolscrambleActive){
                this.DebugInfoSkill("^b^8Was not able to scramble teams in 15 seconds! Teams partly scrambled.");
                this.boolTeamsScrambled = true;
                this.intScrambledPlayers = 0;
                this.boolscrambleNow = false;
                this.boolscrambleActive = false;
                this.intScrambleCount = 0;
            }
            
            if (!this.boolscrambleActive){
                List<String> removeFromCache = new List<String>();
                
                int numWithStats = 0;
                foreach (String k in this.dicPlayerCache.Keys) {
                    if (this.dicPlayerCache[k].statsFetched) ++numWithStats;
                }
                DebugInfoSkill("OnListPlayers: Players = " + lstPlayers.Count + " vs Known with stats = " + numWithStats);
            
                foreach (KeyValuePair<string, CPlayerJoinInf> kvp in this.dicPlayerCache)
                {
                    if (this.m_isPluginEnabled == false) break;

                    this.boolplayerexists = false;
                    foreach (CPlayerInfo cpiPlayer in lstPlayers)
                    {
                        if (this.m_isPluginEnabled == false) break;

                        if (cpiPlayer.SoldierName == kvp.Key)
                        {
                            boolplayerexists = true;
                            if (this.dicPlayerCache[kvp.Key].teamID != cpiPlayer.TeamID){
                                if(this.boolmanuellchange && this.dicPlayerCache[kvp.Key].teamID != 0 && kvp.Key != this.strMovedPlayer){
                                    
                                    this.dicPlayerCache[kvp.Key].Playerjoined = DateTime.Now;
                                    this.dicPlayerCache[kvp.Key].playerWL = 0;
                                    this.DebugInfo("Switched Manually!");
                                    
                                }
                                this.dicPlayerCache[kvp.Key].teamID = cpiPlayer.TeamID;
                                
                            }
                            this.dicPlayerCache[kvp.Key].playerSquad = cpiPlayer.SquadID;
                            this.dicPlayerCache[kvp.Key].score = cpiPlayer.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"))
                            {
                                if (this.ScrambleByCONQUEST == "Rank")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].rank;
                                }
                                else if (this.ScrambleByCONQUEST == "Skill")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].skill;
                                }
                                else if (this.ScrambleByCONQUEST == "SPM")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].spm;
                                }
                                else if (this.ScrambleByCONQUEST == "SPMcombat")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].spmcombat;
                                }
                                else if (this.ScrambleByCONQUEST == "K/D")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].kdr;
                                }
                                else if (this.ScrambleByCONQUEST == "TB-Value")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].TBvalue;
                                }
                            }
                            if (this.strcurrentGametype.Contains("Domination"))
                            {
                                if (this.ScrambleByDOM == "Rank")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].rank;
                                }
                                else if (this.ScrambleByDOM == "Skill")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].skill;
                                }
                                else if (this.ScrambleByDOM == "SPM")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].spm;
                                }
                                else if (this.ScrambleByDOM == "SPMcombat")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].spmcombat;
                                }
                                else if (this.ScrambleByDOM == "K/D")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].kdr;
                                }
                                else if (this.ScrambleByDOM == "TB-Value")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].TBvalue;
                                }
                            }
                            else if (this.strcurrentGametype.Contains("Obliteration"))
                            {
                                if (this.ScrambleByOB == "Rank")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].rank;
                                }
                                else if (this.ScrambleByOB == "Skill")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].skill;
                                }
                                else if (this.ScrambleByOB == "SPM")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].spm;
                                }
                                else if (this.ScrambleByOB == "SPMcombat")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].spmcombat;
                                }
                                else if (this.ScrambleByOB == "K/D")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].kdr;
                                }
                                else if (this.ScrambleByOB == "TB-Value")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].TBvalue;
                                }
                            }
                            else if (this.strcurrentGametype.Contains("Rush"))
                            {
                                if (this.ScrambleByRUSH == "Rank"){
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].rank;
                                }else if (this.ScrambleByRUSH == "Skill"){
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].skill;
                                }else if (this.ScrambleByRUSH == "SPM"){
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].spm;
                                }else if (this.ScrambleByRUSH == "SPMcombat"){
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].spmcombat;
                                }else if (this.ScrambleByRUSH == "K/D"){
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].kdr;
                                }
                                else if (this.ScrambleByRUSH == "TB-Value")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].TBvalue;
                                }
                            }
                            else if (this.strcurrentGametype.Contains("GunMaster") || this.strcurrentGametype.Contains("CaptureTheFlag0"))
                            {
                                if (this.ScrambleByGM == "Rank")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].rank;
                                }
                                else if (this.ScrambleByGM == "Skill")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].skill;
                                }
                                else if (this.ScrambleByGM == "SPM")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].spm;
                                }
                                else if (this.ScrambleByGM == "SPMcombat")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].spmcombat;
                                }
                                else if (this.ScrambleByGM == "K/D")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].kdr;
                                }
                                else if (this.ScrambleByGM == "TB-Value")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].TBvalue;
                                }
                            }
                            else if (this.strcurrentGametype.Contains("Elimination"))
                            {
                                if (this.ScrambleByDF == "Rank")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].rank;
                                }
                                else if (this.ScrambleByDF == "Skill")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].skill;
                                }
                                else if (this.ScrambleByDF == "SPM")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].spm;
                                }
                                else if (this.ScrambleByDF == "SPMcombat")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].spmcombat;
                                }
                                else if (this.ScrambleByDF == "K/D")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].kdr;
                                }
                                else if (this.ScrambleByDF == "TB-Value")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].TBvalue;
                                }
                            }
                            else if (this.strcurrentGametype.Contains("TeamDeathMatch"))
                            {
                                if (this.ScrambleByTDM == "Rank"){
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].rank;
                                }else if (this.ScrambleByTDM == "Skill"){
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].skill;
                                }else if (this.ScrambleByTDM == "SPM"){
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].spm;
                                }else if (this.ScrambleByTDM == "SPMcombat"){
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].spmcombat;
                                }else if (this.ScrambleByTDM == "K/D"){
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].kdr;
                                }
                                else if (this.ScrambleByTDM == "TB-Value")
                                {
                                    this.dicPlayerCache[kvp.Key].playerValue = this.dicPlayerCache[kvp.Key].TBvalue;
                                }
                            }
                            
                            
                            
                            if ( (  ((IList<string>)this.strAWhitelistComplete).Contains(cpiPlayer.SoldierName) || ( ((IList<string>)this.strAClantagWhitelist).Contains(dicPlayerCache[cpiPlayer.SoldierName].tag) && dicPlayerCache[cpiPlayer.SoldierName].tag != String.Empty )  )   && this.ynbWhitelist == enumBoolYesNo.Yes)
                            {
                                this.dicPlayerCache[kvp.Key].playerWL = 1;
                            }
                            
                            break;
                        }
                    }
                    if (boolplayerexists == false)
                    {
                        if (!removeFromCache.Contains(kvp.Key))
                        {
                            removeFromCache.Add(kvp.Key);
                        }
                        // FIXME this.dicPlayerCache.Remove(kvp.Key);
                        //PlayersOnServer.Remove(kvp.Key);
                    }
                }
                
                foreach (String s in removeFromCache)
                {
                    if (this.dicPlayerCache.ContainsKey(s))
                    {
                        this.dicPlayerCache.Remove(s);
                    }
                }


                foreach (CPlayerInfo cpiPlayer in lstPlayers)
                {
                    if (this.m_isPluginEnabled == false) break;
                    
                    --numRemaining;

                    if (this.dicPlayerCache.ContainsKey(cpiPlayer.SoldierName) == true && this.dicPlayerCache[cpiPlayer.SoldierName].statsFetched)
                    {
                        if (this.dicPlayerCache[cpiPlayer.SoldierName].teamID != cpiPlayer.TeamID){
                                if(this.boolmanuellchange && this.dicPlayerCache[cpiPlayer.SoldierName].teamID != 0 && cpiPlayer.SoldierName != this.strMovedPlayer){
                                    
                                    this.dicPlayerCache[cpiPlayer.SoldierName].Playerjoined = DateTime.Now;
                                    this.dicPlayerCache[cpiPlayer.SoldierName].playerWL = 0;
                                    this.DebugInfo("Switched Manually!(2)");
                                    
                                }
                                this.dicPlayerCache[cpiPlayer.SoldierName].teamID = cpiPlayer.TeamID;
                                
                        }
                        this.dicPlayerCache[cpiPlayer.SoldierName].playerSquad = cpiPlayer.SquadID;
                        this.dicPlayerCache[cpiPlayer.SoldierName].score = cpiPlayer.Score;

                        if (this.strcurrentGametype.Contains("Conquest") || this.strcurrentGametype.Contains("TankSuperiority0") || this.strcurrentGametype.Contains("Scavenger") || this.strcurrentGametype.Contains("AirSuperiority0") || this.strcurrentGametype.Contains("CarrierAssault") || this.strcurrentGametype.Contains("Chainlink"))
                        {
                            if (this.ScrambleByCONQUEST == "Rank")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].rank;
                            }
                            else if (this.ScrambleByCONQUEST == "Skill")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].skill;
                            }
                            else if (this.ScrambleByCONQUEST == "SPM")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].spm;
                            }
                            else if (this.ScrambleByCONQUEST == "SPMcombat")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].spmcombat;
                            }
                            else if (this.ScrambleByCONQUEST == "K/D")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].kdr;
                            }
                            else if (this.ScrambleByCONQUEST == "TB-Value")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].TBvalue;
                            }
                        }
                        if (this.strcurrentGametype.Contains("Domination"))
                        {
                            if (this.ScrambleByDOM == "Rank")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].rank;
                            }
                            else if (this.ScrambleByDOM == "Skill")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].skill;
                            }
                            else if (this.ScrambleByDOM == "SPM")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].spm;
                            }
                            else if (this.ScrambleByDOM == "SPMcombat")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].spmcombat;
                            }
                            else if (this.ScrambleByDOM == "K/D")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].kdr;
                            }
                            else if (this.ScrambleByDOM == "TB-Value")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].TBvalue;
                            }
                        }
                        else if (this.strcurrentGametype.Contains("Obliteration"))
                        {
                            if (this.ScrambleByOB == "Rank")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].rank;
                            }
                            else if (this.ScrambleByOB == "Skill")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].skill;
                            }
                            else if (this.ScrambleByOB == "SPM")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].spm;
                            }
                            else if (this.ScrambleByOB == "SPMcombat")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].spmcombat;
                            }
                            else if (this.ScrambleByOB == "K/D")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].kdr;
                            }
                            else if (this.ScrambleByOB == "TB-Value")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].TBvalue;
                            }
                        }
                        else if (this.strcurrentGametype.Contains("Rush"))
                        {
                            if (this.ScrambleByRUSH == "Rank"){
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].rank;
                            }else if (this.ScrambleByRUSH == "Skill"){
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].skill;
                            }else if (this.ScrambleByRUSH == "SPM"){
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].spm;
                            }else if (this.ScrambleByRUSH == "SPMcombat"){
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].spmcombat;
                            }else if (this.ScrambleByRUSH == "K/D"){
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].kdr;
                            }
                            else if (this.ScrambleByRUSH == "TB-Value")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].TBvalue;
                            }
                        }
                        else if (this.strcurrentGametype.Contains("GunMaster") || this.strcurrentGametype.Contains("CaptureTheFlag0"))
                        {
                            if (this.ScrambleByGM == "Rank")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].rank;
                            }
                            else if (this.ScrambleByGM == "Skill")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].skill;
                            }
                            else if (this.ScrambleByGM == "SPM")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].spm;
                            }
                            else if (this.ScrambleByGM == "SPMcombat")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].spmcombat;
                            }
                            else if (this.ScrambleByGM == "K/D")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].kdr;
                            }
                            else if (this.ScrambleByGM == "TB-Value")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].TBvalue;
                            }
                        }
                        else if (this.strcurrentGametype.Contains("Elimination"))
                        {
                            if (this.ScrambleByDF == "Rank")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].rank;
                            }
                            else if (this.ScrambleByDF == "Skill")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].skill;
                            }
                            else if (this.ScrambleByDF == "SPM")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].spm;
                            }
                            else if (this.ScrambleByDF == "SPMcombat")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].spmcombat;
                            }
                            else if (this.ScrambleByDF == "K/D")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].kdr;
                            }
                            else if (this.ScrambleByDF == "TB-Value")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].TBvalue;
                            }
                        }
                        else if (this.strcurrentGametype.Contains("TeamDeathMatch"))
                        {
                            if (this.ScrambleByTDM == "Rank"){
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].rank;
                            }else if (this.ScrambleByTDM == "Skill"){
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].skill;
                            }else if (this.ScrambleByTDM == "SPM"){
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].spm;
                            }else if (this.ScrambleByTDM == "SPMcombat"){
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].spmcombat;
                            }else if (this.ScrambleByTDM == "K/D"){
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].kdr;
                            }
                            else if (this.ScrambleByTDM == "TB-Value")
                            {
                                this.dicPlayerCache[cpiPlayer.SoldierName].playerValue = this.dicPlayerCache[cpiPlayer.SoldierName].TBvalue;
                            }
                        }
                        
                        
                        
                        if ( (  ((IList<string>)this.strAWhitelistComplete).Contains(cpiPlayer.SoldierName) || ( ((IList<string>)this.strAClantagWhitelist).Contains(dicPlayerCache[cpiPlayer.SoldierName].tag) && dicPlayerCache[cpiPlayer.SoldierName].tag != String.Empty )  )   && this.ynbWhitelist == enumBoolYesNo.Yes)
                        {
                            this.dicPlayerCache[cpiPlayer.SoldierName].playerWL = 1;
                        }
                    }
                    else
                    {
                        PlayerStats stats = new PlayerStats();
                        stats.reset();

                        /* If stats fetching is taking too long, skip for the rest of the current players list */

                        if (numStatsFetch > 0)
                        {
                            DebugInfoSkill("Starting Battlelog stats fetch for: ^b^5" + cpiPlayer.SoldierName);
                            DateTime startTime = DateTime.Now;

                            if (Servertype == "BF3")
                            {
                                stats = this.bclient.getPlayerStats(cpiPlayer.SoldierName, BattlelogClient.ServerType.BF3);
                            }
                            if (Servertype == "BF4")
                            {
                                stats = this.bclient.getPlayerStats(cpiPlayer.SoldierName, BattlelogClient.ServerType.BF4);
                            }

                            stats.statsFetched = true;

                            String name = (stats.tag != String.Empty) ? "[" + stats.tag + "]" + cpiPlayer.SoldierName : cpiPlayer.SoldierName;
                            DebugInfoSkill("^5^b" + name + "^n^9 stats fetched, rank is " + stats.rank + ", spm is " + stats.spm.ToString("F0") + ", ^b" + numRemaining + "^n players still need stats. ^2ELAPSED TIME: " + DateTime.Now.Subtract(startTime).TotalSeconds.ToString("F1") + " seconds");

                            --numStatsFetch;
                        }

                        double ValueTemp = 0;
                        
                        double tempskill = stats.skill;
                        
                        if (tempskill == 0)
                            tempskill = (this.skillA + this.skillB) / 2;
                        else if (tempskill < 0)
                            tempskill = 0;

                        double tempspm = stats.spm;
                        if (tempspm == 0)
                            tempspm = (this.spmA + this.spmB) / 2;

                        double tempspmcombat = stats.spmcombat;
                        if (tempspmcombat == 0)
                        {
                            tempspmcombat = (this.spmcombatA + this.spmcombatB) / 2;
                        }

                        double tempkdr = stats.kdr;
                        if (tempkdr == 0)
                            tempkdr = (this.kdrA + this.kdrB) / 2;


                        double TBvalueTemp = TBValue(stats.rank, tempskill, tempspm, tempspmcombat, tempkdr);

                        if (this.strcurrentGametype.Contains("Conquest") || this.strcurrentGametype.Contains("TankSuperiority0") || this.strcurrentGametype.Contains("Scavenger") || this.strcurrentGametype.Contains("AirSuperiority0") || this.strcurrentGametype.Contains("CarrierAssault") || this.strcurrentGametype.Contains("Chainlink"))
                        {
                            if (this.ScrambleByCONQUEST == "Rank")
                            {
                                ValueTemp = stats.rank;
                            }
                            else if (this.ScrambleByCONQUEST == "Skill")
                            {
                                ValueTemp = tempskill;
                            }
                            else if (this.ScrambleByCONQUEST == "SPM")
                            {
                                ValueTemp = tempspm;
                            }
                            else if (this.ScrambleByCONQUEST == "SPMcombat")
                            {
                                ValueTemp = tempspmcombat;
                            }
                            else if (this.ScrambleByCONQUEST == "K/D")
                            {
                                ValueTemp = tempkdr;
                            }
                            else if (this.ScrambleByCONQUEST == "TB-Value")
                            {
                                ValueTemp = TBvalueTemp;
                            }
                        }
                        if (this.strcurrentGametype.Contains("Domination"))
                        {
                            if (this.ScrambleByDOM == "Rank")
                            {
                                ValueTemp = stats.rank;
                            }
                            else if (this.ScrambleByDOM == "Skill")
                            {
                                ValueTemp = tempskill;
                            }
                            else if (this.ScrambleByDOM == "SPM")
                            {
                                ValueTemp = tempspm;
                            }
                            else if (this.ScrambleByDOM == "SPMcombat")
                            {
                                ValueTemp = tempspmcombat;
                            }
                            else if (this.ScrambleByDOM == "K/D")
                            {
                                ValueTemp = tempkdr;
                            }
                            else if (this.ScrambleByDOM == "TB-Value")
                            {
                                ValueTemp = TBvalueTemp;
                            }
                        }
                        else if (this.strcurrentGametype.Contains("Obliteration"))
                        {
                            if (this.ScrambleByCONQUEST == "Rank")
                            {
                                ValueTemp = stats.rank;
                            }
                            else if (this.ScrambleByOB == "Skill")
                            {
                                ValueTemp = tempskill;
                            }
                            else if (this.ScrambleByOB == "SPM")
                            {
                                ValueTemp = tempspm;
                            }
                            else if (this.ScrambleByOB == "SPMcombat")
                            {
                                ValueTemp = tempspmcombat;
                            }
                            else if (this.ScrambleByOB == "K/D")
                            {
                                ValueTemp = tempkdr;
                            }
                            else if (this.ScrambleByOB == "TB-Value")
                            {
                                ValueTemp = TBvalueTemp;
                            }
                        }
                        else if (this.strcurrentGametype.Contains("Rush"))
                        {
                            if (this.ScrambleByRUSH == "Rank"){
                                ValueTemp = stats.rank;
                            }else if (this.ScrambleByRUSH == "Skill"){
                                ValueTemp = tempskill;
                            }else if (this.ScrambleByRUSH == "SPM"){
                                ValueTemp = tempspm;
                            }else if (this.ScrambleByRUSH == "SPMcombat"){
                                ValueTemp = tempspmcombat;
                            }else if (this.ScrambleByRUSH == "K/D"){
                                ValueTemp = tempkdr;
                            }
                            else if (this.ScrambleByRUSH == "TB-Value")
                            {
                                ValueTemp = TBvalueTemp;
                            }
                        }
                        else if (this.strcurrentGametype.Contains("GunMaster") || this.strcurrentGametype.Contains("CaptureTheFlag0"))
                        {
                            if (this.ScrambleByGM == "Rank")
                            {
                                ValueTemp = stats.rank;
                            }
                            else if (this.ScrambleByGM == "Skill")
                            {
                                ValueTemp = tempskill;
                            }
                            else if (this.ScrambleByGM == "SPM")
                            {
                                ValueTemp = tempspm;
                            }
                            else if (this.ScrambleByGM == "SPMcombat")
                            {
                                ValueTemp = tempspmcombat;
                            }
                            else if (this.ScrambleByGM == "K/D")
                            {
                                ValueTemp = tempkdr;
                            }
                            else if (this.ScrambleByGM == "TB-Value")
                            {
                                ValueTemp = TBvalueTemp;
                            }
                        }
                        else if (this.strcurrentGametype.Contains("Elimination"))
                        {
                            if (this.ScrambleByDF == "Rank")
                            {
                                ValueTemp = stats.rank;
                            }
                            else if (this.ScrambleByDF == "Skill")
                            {
                                ValueTemp = tempskill;
                            }
                            else if (this.ScrambleByDF == "SPM")
                            {
                                ValueTemp = tempspm;
                            }
                            else if (this.ScrambleByDF == "SPMcombat")
                            {
                                ValueTemp = tempspmcombat;
                            }
                            else if (this.ScrambleByDF == "K/D")
                            {
                                ValueTemp = tempkdr;
                            }
                            else if (this.ScrambleByDF == "TB-Value")
                            {
                                ValueTemp = TBvalueTemp;
                            }
                        }
                        else if (this.strcurrentGametype.Contains("TeamDeathMatch"))
                        {
                            if (this.ScrambleByTDM == "Rank"){
                                ValueTemp = stats.rank;
                            }else if (this.ScrambleByTDM == "Skill"){
                                ValueTemp = tempskill;
                            }else if (this.ScrambleByTDM == "SPM"){
                                ValueTemp = tempspm;
                            }else if (this.ScrambleByTDM == "SPMcombat"){
                                ValueTemp = tempspmcombat;
                            }else if (this.ScrambleByTDM == "K/D"){
                                ValueTemp = tempkdr;
                            }
                            else if (this.ScrambleByTDM == "TB-Value")
                            {
                                ValueTemp = TBvalueTemp;
                            }
                        }

                        bool commander = cpiPlayer.Type == 1 || cpiPlayer.Type == 2 ? true : false;
                        bool spectator = cpiPlayer.Type == 3 ? true : false;
                        if ((((IList<string>)this.strAWhitelistComplete).Contains(cpiPlayer.SoldierName) || (((IList<string>)this.strAClantagWhitelist).Contains(stats.tag) && stats.tag != String.Empty)) && this.ynbWhitelist == enumBoolYesNo.Yes)
                        {

                            CPlayerJoinInf newEntry = new CPlayerJoinInf(cpiPlayer.TeamID, 1, cpiPlayer.SquadID, DateTime.Now, cpiPlayer.Score, stats.rank, tempskill, tempspm, tempspmcombat, tempkdr, TBvalueTemp, ValueTemp, stats.tag, false, commander, spectator);
                            newEntry.statsFetched = stats.statsFetched;
                            this.dicPlayerCache[cpiPlayer.SoldierName] = newEntry;
                            //this.dicPlayerCache.Add(cpiPlayer.SoldierName, newEntry);
                            //PlayersOnServer.Add(cpiPlayer.SoldierName);
                            //this.ExecuteCommand("procon.protected.pluginconsole.write", spm.ToString());
                        }
                        else
                        {
                            if (cpiPlayer.TeamID == 0)
                            {
                                CPlayerJoinInf newEntry = new CPlayerJoinInf(cpiPlayer.TeamID, 0, cpiPlayer.SquadID, DateTime.Now, cpiPlayer.Score, stats.rank, tempskill, tempspm, tempspmcombat, tempkdr, TBvalueTemp, ValueTemp, stats.tag, true, commander, spectator);
                                newEntry.statsFetched = stats.statsFetched;
                                this.dicPlayerCache[cpiPlayer.SoldierName] = newEntry;
                                //this.dicPlayerCache.Add(cpiPlayer.SoldierName, newEntry);
                                //PlayersOnServer.Add(cpiPlayer.SoldierName);
                            }
                            else
                            {
                                CPlayerJoinInf newEntry = new CPlayerJoinInf(cpiPlayer.TeamID, 0, cpiPlayer.SquadID, DateTime.Now, cpiPlayer.Score, stats.rank, tempskill, tempspm, tempspmcombat, tempkdr, TBvalueTemp, ValueTemp, stats.tag, false, commander, spectator);
                                newEntry.statsFetched = stats.statsFetched;
                                this.dicPlayerCache[cpiPlayer.SoldierName] = newEntry;
                                //this.dicPlayerCache.Add(cpiPlayer.SoldierName, newEntry);
                                //PlayersOnServer.Add(cpiPlayer.SoldierName);
                            }
                            //this.ExecuteCommand("procon.protected.pluginconsole.write", spm.ToString());
                        }
                        
                    }
                }
                 
                if (this.ynbWhitelist == enumBoolYesNo.Yes && this.ynbincludeVIPlist == enumBoolYesNo.Yes) {
                this.ExecuteCommand("procon.protected.send", "reservedSlotsList.list");
                }
                 
                 
                this.strMovedPlayer = "";
                this.boolmanuellchange = false;
                this.DebugInfo("-------OP-------");
                
                
                string printSoldier = "";
                string strPlayerlist = "";
                string strPLTeam1 = "";
                string strPLTeam2 = "";
                string strPLNeutral = "";
                
                
                /*  Dictionary<string, CPlayerJoinInf> dicSorted = new Dictionary<string, CPlayerJoinInf>();
                
                dicSorted = from k in dicPlayerCache.Keys
                            orderby dicPlayerCache[k].Playerjoined ascending
                            select k; */

                Dictionary<string, CPlayerJoinInf> dicPlayerSorted = new Dictionary<string, CPlayerJoinInf>();

                string whitelisttemp = "^2";

                foreach (KeyValuePair<string, CPlayerJoinInf> kvp1 in this.dicPlayerCache)
                {
                    if (this.dicPlayerCache[kvp1.Key].playerWL == 1 || dicPlayerCache[kvp1.Key].IsCommander || dicPlayerCache[kvp1.Key].IsSpectator)
                    {
                        whitelisttemp = whitelisttemp + "^b" + kvp1.Key + "^n" + ", ";
                    }
                    // DateTime maxValueJoined = new DateTime();
                    double minpoints = 100000000;
                    KeyValuePair<string, CPlayerJoinInf> kvplastjoiner = new KeyValuePair<string, CPlayerJoinInf>();
                    
                    foreach (KeyValuePair<string, CPlayerJoinInf> kvp2 in this.dicPlayerCache)
                    {
                        if (this.dicPlayerCache[kvp2.Key].score <= minpoints && dicPlayerSorted.ContainsKey(kvp2.Key) == false)
                        {
                            minpoints = this.dicPlayerCache[kvp2.Key].score;
                            kvplastjoiner = kvp2;
                        }
                    }
                    dicPlayerSorted.Add(kvplastjoiner.Key, kvplastjoiner.Value);    
                }
                
                
                foreach (KeyValuePair<string, CPlayerJoinInf> kvp in dicPlayerSorted)
                {
                    printSoldier = kvp.Key.Replace("{", "(");
                    printSoldier = printSoldier.Replace("}", ")");
                    if (dicPlayerSorted[kvp.Key].teamID == 1){
                        strPLTeam1 = strPLTeam1 + "^0^n[" + dicPlayerSorted[kvp.Key].tag + "]^b" + printSoldier + "^n:^2" + Convert.ToString(dicPlayerSorted[kvp.Key].playerWL) +
                        "^0.^1" + Convert.ToString(dicPlayerSorted[kvp.Key].playerSquad) + " - ^i^3" + dicPlayerSorted[kvp.Key].TBvalue.ToString("F1") + "^0/^3" + dicPlayerSorted[kvp.Key].rank.ToString("F2") + "^0/^3" + dicPlayerSorted[kvp.Key].skill.ToString("F2") + "^0/^3" + dicPlayerSorted[kvp.Key].spm.ToString("F2") + "^0/^3" +
                        dicPlayerSorted[kvp.Key].spmcombat.ToString("F2") + "^0/^3" + dicPlayerSorted[kvp.Key].kdr.ToString("F2") + "^b^4 -=- ";
                    }else if (dicPlayerSorted[kvp.Key].teamID == 2){
                        strPLTeam2 = strPLTeam2 + "^0^n[" + dicPlayerSorted[kvp.Key].tag + "]^b" + printSoldier + "^n:^2" + Convert.ToString(dicPlayerSorted[kvp.Key].playerWL) +
                        "^0.^1" + Convert.ToString(dicPlayerSorted[kvp.Key].playerSquad) + " - ^i^3" + dicPlayerSorted[kvp.Key].TBvalue.ToString("F1") + "^0/^3" + dicPlayerSorted[kvp.Key].rank.ToString("F2") + "^0/^3" + dicPlayerSorted[kvp.Key].skill.ToString("F2") + "^0/^3" + dicPlayerSorted[kvp.Key].spm.ToString("F2") + "^0/^3" +
                        dicPlayerSorted[kvp.Key].spmcombat.ToString("F2") + "^0/^3" + dicPlayerSorted[kvp.Key].kdr.ToString("F2") + "^b^4 -=- ";
                    }else{
                        strPLNeutral = strPLNeutral + "^0^n[" + dicPlayerSorted[kvp.Key].tag + "]^b" + printSoldier + "^n:^2" + Convert.ToString(dicPlayerSorted[kvp.Key].playerWL) +
                        "^0.^1" + Convert.ToString(dicPlayerSorted[kvp.Key].playerSquad) + " - ^i^3" + dicPlayerSorted[kvp.Key].TBvalue.ToString("F1") + "^0/^3" + dicPlayerSorted[kvp.Key].rank.ToString("F2") + "^0/^3" + dicPlayerSorted[kvp.Key].skill.ToString("F2") + "^0/^3" + dicPlayerSorted[kvp.Key].spm.ToString("F2") + "^0/^3" +
                        dicPlayerSorted[kvp.Key].spmcombat.ToString("F2") + "^0/^3" + dicPlayerSorted[kvp.Key].kdr.ToString("F2") + "^b^4 -=- ";
                    }
                }
            
    /*          foreach (KeyValuePair<string, CPlayerJoinInf> kvp in this.dicPlayerCache)
                {
                    printSoldier = kvp.Key.Replace("{", "(");
                    printSoldier = printSoldier.Replace("}", ")");
                    if (this.dicPlayerCache[kvp.Key].teamID == 1){
                        strPLTeam1 = strPLTeam1 + Convert.ToString(this.dicPlayerCache[kvp.Key].playerWL) + 
                        "." + Convert.ToString(this.dicPlayerCache[kvp.Key].playerSquad) + "." + 
                        this.dicPlayerCache[kvp.Key].Playerjoined.ToString("HH:mm:ss") + "-" + printSoldier + " -=- ";
                    }else if (this.dicPlayerCache[kvp.Key].teamID == 2){
                        strPLTeam2 = strPLTeam2 + Convert.ToString(this.dicPlayerCache[kvp.Key].playerWL) + 
                        "." + Convert.ToString(this.dicPlayerCache[kvp.Key].playerSquad) + "." + 
                        this.dicPlayerCache[kvp.Key].Playerjoined.ToString("HH:mm:ss") + "-" + printSoldier + " -=- ";
                    }else{
                        strPLNeutral = strPLNeutral + Convert.ToString(this.dicPlayerCache[kvp.Key].playerWL) + 
                        "." + Convert.ToString(this.dicPlayerCache[kvp.Key].playerSquad) + "." + 
                        this.dicPlayerCache[kvp.Key].Playerjoined.ToString("HH:mm:ss") + "-" + printSoldier + " -=- ";
                    }
                } */
                            
                strPlayerlist = "\n^b^4TEAM 1:^n " + strPLTeam1 + "\n\n^bTEAM 2:^n " + strPLTeam2 + "\n\n^bNeutral:^n " + strPLNeutral;
                
                this.DebugInfo(strPlayerlist);
                this.DebugInfo("Online whitelisted players: " + whitelisttemp);
                
                //this.DebugInfo("WaitSeconds: " + this.intWaitSeconds.ToString());

            
                this.TSLevelStartWait = DateTime.Now - this.DTLevelStart;
                if (this.boolLevelStart && this.TSLevelStartWait.TotalSeconds > 30)
                {
                        if (this.boolFirstOP == false)
                        {
                            this.boolFirstOP = true;                    
                        }   

                        if (strcurrentGametype != "squaddeathmatch0")
                        {
                            // if ( this.intScoreTeamA > this.intminScore && this.intScoreTeamB > this.intminScore){
                                CompareTeams();
                            // } else {
                                // this.DebugInfo("Not comparing teams. Tickets till Endround: TeamA: " + this.intScoreTeamA + ", TeamB: " + this.intScoreTeamB  );
                            // }
                        }
                        else if (strcurrentGametype != "")
                        {
                            if (this.boolgametype == false)
                            {
                                this.boolgametype = true;
                                this.ExecuteCommand("procon.protected.pluginconsole.write", "TrueBalancer:  Still no data or GameMode not supported: " + "I" + strcurrentGametype + "I" );
                                
                            }
                        }   
                    } 
            }else {

                DebugInfoSkill("^3OnListPlayers, skill scramble in progress");

                double afterscrambleValueA = 0;
                double afterscrambleTeamSizeA = 0;
                double afterscrambleValueB = 0;
                double afterscrambleTeamSizeB = 0;
                if (this.boolscrambleNow && this.boolRunOnList){
                    this.boolTeamsScrambled = true;
                    foreach (KeyValuePair<int, CPlayerScoreInf> kvp in this.dicPlayerScore){
                        if (this.m_isPluginEnabled == false) break;
                        foreach (CPlayerInfo cpiPlayer in lstPlayers){
                            if (this.m_isPluginEnabled == false) break;
                            if (this.dicPlayerScore[kvp.Key].playerName == cpiPlayer.SoldierName){
                                if (cpiPlayer.TeamID == this.dicPlayerScore[kvp.Key].teamID && cpiPlayer.SquadID == this.dicPlayerScore[kvp.Key].playerSquad){
                                    this.dicPlayerScore[kvp.Key].scrambled = true;
                                    if (cpiPlayer.TeamID == 1)
                                    {
                                        afterscrambleValueA = afterscrambleValueA + this.dicPlayerScore[kvp.Key].playerValue;
                                        afterscrambleTeamSizeA++;
                                    }
                                    else
                                    {
                                        afterscrambleValueB = afterscrambleValueB + this.dicPlayerScore[kvp.Key].playerValue;
                                        afterscrambleTeamSizeB++;
                                    }
                                }else{
                                    this.dicPlayerScore[kvp.Key].scrambled = false;
                                    this.boolTeamsScrambled = false;
                                    this.DebugInfoSkill("^3Not scrambled: ^b" + cpiPlayer.SoldierName + "^n. Is in: ^b" + cpiPlayer.TeamID.ToString() +"."+cpiPlayer.SquadID +"^n - Goal: ^b" + this.dicPlayerScore[kvp.Key].teamID .ToString() +  "." + this.dicPlayerScore[kvp.Key].playerSquad.ToString());
                                }
                                break;
                            }
                        }
                    }
                    if (this.boolTeamsScrambled) {
                        this.boolRunOnList = false;
                        this.DebugInfoSkill("^b^2Teams are scrambled now!");
                        this.DebugInfoSkill("Team 1 Value: ^b^2" + afterscrambleValueA / afterscrambleTeamSizeA + "^9*^7" + afterscrambleTeamSizeA + "^n^9 --- Team 2 Value: ^b^2" + afterscrambleValueB / afterscrambleTeamSizeB + "^9*^7" + afterscrambleTeamSizeB);
                        double valuediffendround = afterscrambleValueA / afterscrambleTeamSizeA - afterscrambleValueB / afterscrambleTeamSizeB;
                        this.DebugInfoSkill("ValueDifference: ^b^2" + valuediffendround);
                        TimeSpan ScrambleDuration = DateTime.Now - this.DTScramblestarted;
                        this.DebugInfoSkill("ScrambleDuration: " + ScrambleDuration.TotalSeconds.ToString("F2") + " seconds");
                        this.boolscrambleNow = false;
                        this.boolscrambleActive = false;
                        this.intScrambleCount = 0;
                        if (this.boolLevelStart){
                            if (this.ynbScrambleMessage == enumBoolYesNo.Yes){
                                if (this.strScrambleDoneMsg !=""){
                                    if (this.boolVirtual)
                                    {
                                        this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL:^n say all - " + strScrambleDoneMsg);
                                    }
                                    else
                                    {
                                        this.ExecuteCommand("procon.protected.send", "admin.say", strScrambleDoneMsg , "all");
                                    }
                                    if (this.ynbYellScrambleManuall == enumBoolYesNo.Yes && !this.boolVirtual){
                                        this.ExecuteCommand("procon.protected.send", "admin.yell", strScrambleDoneMsg , "30");
                                    }
                                }
                            }
                        }                   
                    } else{
                        this.boolRunOnList = false;
                        ScrambleNow();
                    }
                    
                } else  {
                    DebugInfoSkill("^3Scrambler Active OnList!");
                }
            }

            /* Since the playername matching feature requires the lastest list of player names, we have
             * to re-register commands after every player list update, bleah!
             */
            this.RegisterAllCommands();
            DebugInfoSkill("OnListPlayers handler returning");
        }
Пример #21
0
        /*
        public void OnPlayerPunkbusterInfo(CPunkbusterInfo pbInfo) {


        }
        */

        private void m_prcClient_ListPlayers(FrostbiteClient sender, List<CPlayerInfo> lstPlayers, CPlayerSubset cpsSubset) {
            this.InvokeIfRequired(() => {
                if (cpsSubset.Subset == CPlayerSubset.PlayerSubsetType.All) {
                    foreach (CPlayerInfo cpiPlayer in lstPlayers) {
                        if (this.Players.ContainsKey(cpiPlayer.SoldierName) == true) {

                            ListViewItem playerListItem = this.Players[cpiPlayer.SoldierName];

                            if (this.Client != null && this.Client.Game != null && this.Client.Game.HasSquads == true) {
                                if (cpiPlayer.SquadID != uscPlayerListPanel.NeutralSquad) {
                                    if (String.Compare(playerListItem.SubItems["squad"].Text, cpiPlayer.ClanTag) == 0) {
                                        playerListItem.SubItems["squad"].Text = this.Language.GetLocalized("global.Squad" + cpiPlayer.SquadID.ToString(), null);
                                    }
                                }
                                else {
                                    if (String.IsNullOrEmpty(playerListItem.SubItems["squad"].Text) != false) {
                                        playerListItem.SubItems["squad"].Text = String.Empty;
                                    }
                                }
                            }

                            if (String.Compare(playerListItem.SubItems["tags"].Text, cpiPlayer.ClanTag) != 0) {
                                playerListItem.SubItems["tags"].Text = cpiPlayer.ClanTag;
                            }

                            if (String.Compare(playerListItem.SubItems["score"].Text, cpiPlayer.Score.ToString()) != 0) {
                                playerListItem.SubItems["score"].Text = cpiPlayer.Score.ToString();
                            }
                            playerListItem.SubItems["kills"].Tag = (Double)cpiPlayer.Kills;
                            if (String.Compare(playerListItem.SubItems["kills"].Text, cpiPlayer.Kills.ToString()) != 0) {
                                playerListItem.SubItems["kills"].Text = cpiPlayer.Kills.ToString();
                            }

                            playerListItem.SubItems["deaths"].Tag = (Double)cpiPlayer.Deaths;
                            if (String.Compare(playerListItem.SubItems["deaths"].Text, cpiPlayer.Kills.ToString()) != 0) {
                                playerListItem.SubItems["deaths"].Text = cpiPlayer.Deaths.ToString();
                            }

                            string kdr = cpiPlayer.Deaths > 0 ? String.Format("{0:0.00}", (Double)cpiPlayer.Kills / (Double)cpiPlayer.Deaths) : String.Format("{0:0.00}", (Double)cpiPlayer.Kills);

                            if (String.Compare(playerListItem.SubItems["kdr"].Text, kdr) == 0) {
                                playerListItem.SubItems["kdr"].Text = kdr;
                            }

                            //if (String.Compare(playerListItem.SubItems["ping"].Text, cpiPlayer.Ping.ToString()) != 0) { playerListItem.SubItems["ping"].Text = cpiPlayer.Ping.ToString(); }
                            if ((this.Client.Game.GameType.Equals("BF3") == true) && (this.Pings.ContainsKey(cpiPlayer.SoldierName) == true)) {
                                if (String.Compare(playerListItem.SubItems["ping"].Text, this.Pings[cpiPlayer.SoldierName].ToString()) != 0) {
                                    playerListItem.SubItems["ping"].Text = this.Pings[cpiPlayer.SoldierName].ToString();
                                    cpiPlayer.Ping = this.Pings[cpiPlayer.SoldierName];
                                }
                            }
                            else {
                                if (String.Compare(playerListItem.SubItems["ping"].Text, cpiPlayer.Ping.ToString()) != 0) {
                                    playerListItem.SubItems["ping"].Text = cpiPlayer.Ping.ToString();
                                }
                            }

                            if (String.Compare(playerListItem.SubItems["rank"].Text, cpiPlayer.Rank.ToString()) != 0) {
                                playerListItem.SubItems["rank"].Text = cpiPlayer.Rank.ToString();
                            }
                            
                            string strTime = cpiPlayer.SessionTime > 60 ? String.Format("{0:0}", cpiPlayer.SessionTime / 60) : "0";
                            playerListItem.SubItems["time"].Text = strTime;
                            
                            if (String.Compare(playerListItem.SubItems["type"].Text, cpiPlayer.Type.ToString()) != 0) {
                                if (cpiPlayer.Type == 0) {
                                    //playerListItem.SubItems["type"].Text = this.m_clocLanguage.GetDefaultLocalized("Player", "uscPlayerListPanel.lsvPlayers.Type.Player", null);
                                    playerListItem.SubItems["type"].Text = String.Empty;
                                }
                                else if (cpiPlayer.Type == 1) {
                                    playerListItem.SubItems["type"].Text = this.Language.GetDefaultLocalized("Spectator", "uscPlayerListPanel.lsvPlayers.Type.Spectator", null);
                                }
                                else if (cpiPlayer.Type == 2) {
                                    playerListItem.SubItems["type"].Text = this.Language.GetDefaultLocalized("Commander (PC)", "uscPlayerListPanel.lsvPlayers.Type.CommanderPC", null);
                                }
                                else if (cpiPlayer.Type == 3) {
                                    playerListItem.SubItems["type"].Text = this.Language.GetDefaultLocalized("Commander (Tablet)", "uscPlayerListPanel.lsvPlayers.Type.CommanderTablet", null);
                                }
                            }

                            AdditionalPlayerInfo sapiAdditional;

                            if (playerListItem.Tag == null) {
                                sapiAdditional = new AdditionalPlayerInfo();
                                sapiAdditional.ResolvedHostName = String.Empty;
                            }
                            else {
                                sapiAdditional = (AdditionalPlayerInfo)playerListItem.Tag;
                            }

                            sapiAdditional.Player = cpiPlayer;
                            playerListItem.Tag = sapiAdditional;
                        }
                        else {
                            this.Players.Add(cpiPlayer.SoldierName, this.CreatePlayer(cpiPlayer));
                        }
                    }

                    List<string> lstKeys = new List<string>(this.Players.Keys);

                    for (int i = 0; i < lstKeys.Count; i++) {
                        bool blFoundPlayer = false;

                        foreach (CPlayerInfo cpiPlayer in lstPlayers) {
                            if (String.Compare(cpiPlayer.SoldierName, this.Players[lstKeys[i]].Name) == 0) {
                                blFoundPlayer = true;
                                break;
                            }
                        }

                        if (blFoundPlayer == false) {
                            this.Players[lstKeys[i]].Remove();
                            this.Players.Remove(lstKeys[i]);
                        }
                    }

                    this.Players.Add("procon.playerlist.totals1", this.CreateTotalsPlayer(new CPlayerInfo("Totals", "procon.playerlist.totals1", 1, 0), 1));
                    this.Players.Add("procon.playerlist.totals2", this.CreateTotalsPlayer(new CPlayerInfo("Totals", "procon.playerlist.totals2", 2, 0), 2));
                    this.Players.Add("procon.playerlist.totals3", this.CreateTotalsPlayer(new CPlayerInfo("Totals", "procon.playerlist.totals3", 3, 0), 3));
                    this.Players.Add("procon.playerlist.totals4", this.CreateTotalsPlayer(new CPlayerInfo("Totals", "procon.playerlist.totals4", 4, 0), 4));

                    this.Players.Add("procon.playerlist.averages1", this.CreateTotalsPlayer(new CPlayerInfo("Averages", "procon.playerlist.averages1", 1, 0), 1));
                    this.Players.Add("procon.playerlist.averages2", this.CreateTotalsPlayer(new CPlayerInfo("Averages", "procon.playerlist.averages2", 2, 0), 2));
                    this.Players.Add("procon.playerlist.averages3", this.CreateTotalsPlayer(new CPlayerInfo("Averages", "procon.playerlist.averages3", 3, 0), 3));
                    this.Players.Add("procon.playerlist.averages4", this.CreateTotalsPlayer(new CPlayerInfo("Averages", "procon.playerlist.averages4", 4, 0), 4));

                    this.ArrangePlayers();
                }
            });
        }
        public void OnCommandScrambleNow(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope){
            bool blIsAdmin = false;
            CPrivileges cpAccount = this.GetAccountPrivileges(strSpeaker);
            if (cpAccount != null && cpAccount.PrivilegesFlags > 0) { blIsAdmin = true; }
            
            if(blIsAdmin){
                this.DebugInfoSkill("^1Admin requested a scramble now!");
                
                this.TSLevelStartWait = DateTime.Now - this.DTLevelStart;
                if (this.boolLevelStart && this.boolFirstOP){

                    if (this.ynbEnableScrambleNow == enumBoolYesNo.Yes){
                        if (!this.boolscrambleActive){
                    
                            if (this.ynbScrambleMessage == enumBoolYesNo.Yes){
                                    if (this.strScrambleNowMsg != ""){
                                        if (this.boolVirtual)
                                        {
                                            this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL:^n say all - " + this.strScrambleNowMsg);
                                        }
                                        else
                                        {
                                            this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleNowMsg , "all");
                                        }
                                        if (this.ynbYellScrambleManuall == enumBoolYesNo.Yes && !this.boolVirtual){
                                            this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleNowMsg , "30");
                                        }
                                    }
                                }
                                
                            int i = 1;
                            this.dicPlayerScore.Clear();
                            this.dicSquadScore.Clear();
                            this.bestSquadTeamID = 0;
                            
                            
                            foreach (KeyValuePair<string, CPlayerJoinInf> kvp in this.dicPlayerCache) {
                                double value = this.dicPlayerCache[kvp.Key].playerValue;
                                string tag = this.dicPlayerCache[kvp.Key].tag;
                                CPlayerScoreInf newEntry = new CPlayerScoreInf(kvp.Key, this.dicPlayerCache[kvp.Key].teamID, this.dicPlayerCache[kvp.Key].playerSquad, value, false, false, tag);
                                this.dicPlayerScore.Add(i, newEntry);
                                i++;
                            
                            }
                            
                            
                            bool Sortiert;
                            do{
                                Sortiert = true; 
                                for (int j = 1; j < this.dicPlayerScore.Count; j++) {
                                    if (this.dicPlayerScore[j].playerValue < this.dicPlayerScore[j+1].playerValue){
                                        CPlayerScoreInf temp = new CPlayerScoreInf(this.dicPlayerScore[j].playerName, this.dicPlayerScore[j].teamID, this.dicPlayerScore[j].playerSquad, this.dicPlayerScore[j].playerValue, false, false, this.dicPlayerScore[j].tag);
                                        this.dicPlayerScore[j] = this.dicPlayerScore[j+1];
                                        this.dicPlayerScore[j+1] = temp;
                                        Sortiert = false;
                                    }
                                }  
                            } while (!Sortiert);
                            
                            this.boolFirstOP = false;
                            this.boolwaitfordeath = false;
                            this.boolscrambleActive = true;
                            this.boolTeamsScrambled = false;
                            this.intScrambledPlayers = 0;
                            this.teamswitcher.Clear();
                            
                            
                            this.ExecuteCommand("procon.protected.tasks.add", "WaitScrambleTimer", "3", "1", "1",  "procon.protected.plugins.call", "TrueBalancer", "StartScrambler");
                            //StartScrambler();
                            
                        }else{
                            this.DebugInfoSkill("^3A scrambing has allready been requested.");
                            if (this.boolVirtual)
                            {
                                this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.say player " + strSpeaker + " - " + "A scrambing has allready been requested.");
                            }
                            {
                                this.ExecuteCommand("procon.protected.send", "admin.say", "A scrambing has allready been requested." , "player", strSpeaker);
                            }
                        }
                        
                    }else{
                        this.DebugInfoSkill("^3This command is deactivated at the moment. Activate in in PRoCon.");
                        if (this.boolVirtual)
                        {
                            this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.say player " + strSpeaker + " - " + "This command is not activated for your server in PRoCon.");
                        }
                        else
                        {
                            this.ExecuteCommand("procon.protected.send", "admin.say", "This command is not activated for your server in PRoCon." , "player", strSpeaker);
                        }
                    }
                    
                }
            }           
        }
        public void OnListPlayers(List<CPlayerInfo> lstPlayers, CPlayerSubset cpsSubset)
        {
            this.lstPlayerList = lstPlayers;
            if (this.m_RoCAccepted == enumBoolYesNo.Yes)
            {
                foreach (CPlayerInfo info in lstPlayers)
                {
                    if (this.m_RankKicker == enumBoolOnOff.On)
                    {
                        if (this.m_RankKickerOnOff == enumBoolOnOff.On)
                        {
                            if (this.m_RankKickerOnOff == enumBoolOnOff.On && this.m_PlayerKicks.ContainsKey(info.SoldierName) == false && this.m_WhiteList.Contains(info.SoldierName) == false && this.m_WhiteListClanTags.Contains(info.ClanTag) == false)
                            {
                                this.m_PlayerKicks.Add(info.SoldierName, 0);
                            }
                            else if (this.m_RankKickerOnOff == enumBoolOnOff.On && this.m_PlayerKicks.ContainsKey(info.SoldierName) == true && this.m_WhiteList.Contains(info.SoldierName) == false)
                            {
                                if (this.m_RankKickerOnOff == enumBoolOnOff.On && this.m_PlayerKicks[info.SoldierName] > 0 && this.m_PlayerKicks[info.SoldierName] < this.m_KicksBeforeBan && this.m_BanAfterKicks == enumBoolYesNo.Yes)
                                {
                                    this.ExecuteCommand("procon.protected.send", "admin.kickPlayer", info.SoldierName, this.m_KickReason);
                                    this.m_PlayerKicks[info.SoldierName]++;
                                    this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("Player '{0}' kicked due to a too high rank!", info.SoldierName));
                                    if (this.m_ConsoleLog == enumBoolYesNo.Yes)
                                    {
                                        this.ExecuteCommand("procon.protected.pluginconsole.write", String.Format("^b^4AccessRestriction: ^0RankKicker-Player '{0}' kicked. Number of kicks: {1}", info.SoldierName, this.m_PlayerKicks[info.SoldierName]));
                                    }
                                }
                                else if (this.m_RankKickerOnOff == enumBoolOnOff.On && this.m_PlayerKicks[info.SoldierName] > 0 && this.m_PlayerKicks[info.SoldierName] >= this.m_KicksBeforeBan && this.m_BanAfterKicks == enumBoolYesNo.Yes)
                                {
                                    if (this.m_BanGUID == enumBoolYesNo.No || this.m_PlayerGUIDs.ContainsKey(info.SoldierName) == false)
                                    {
                                        this.ExecuteCommand("procon.protected.send", "banList.add", "name", info.SoldierName, "perm", this.m_PermBanReason);
                                    }
                                    else
                                    {
                                        this.ExecuteCommand("procon.protected.send", "banList.add", "guid", this.m_PlayerGUIDs[info.SoldierName], "perm", this.m_PermBanReason);
                                    }
                                    this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("Player '{0}' banned permanently due to a too high rank!", info.SoldierName));
                                    if (this.m_ConsoleLog == enumBoolYesNo.Yes)
                                    {
                                        this.ExecuteCommand("procon.protected.pluginconsole.write", String.Format("^b^4AccessRestriction: ^0RankKicker-Player '{0}' banned permanently.", info.SoldierName));
                                    }
                                }
                            }

                            PlayerStats? stats = getBFBCStats(info.SoldierName);
                            if (stats == null)
                                continue;

                            if (this.m_RankKickerOnOff == enumBoolOnOff.On && stats.Value.rank >= this.m_RankLimit && this.m_TempBanPlayers == enumBoolYesNo.No && this.m_PermBanPlayers == enumBoolYesNo.No && this.m_WhiteList.Contains(info.SoldierName) == false)
                            {
                                this.ExecuteCommand("procon.protected.send", "admin.kickPlayer", info.SoldierName, this.m_KickReason);
                                this.m_PlayerKicks[info.SoldierName]++;
                                this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("Player '{0}' kicked due to a too high rank!", info.SoldierName));
                                if (this.m_ConsoleLog == enumBoolYesNo.Yes)
                                {
                                    this.ExecuteCommand("procon.protected.pluginconsole.write", String.Format("^b^4AccessRestriction: ^0RankKicker-Player '{0}' kicked. Number of kicks: {1}", info.SoldierName, this.m_PlayerKicks[info.SoldierName]));
                                }
                            }
                            else if (this.m_RankKickerOnOff == enumBoolOnOff.On && stats.Value.rank >= this.m_RankLimit && this.m_TempBanPlayers == enumBoolYesNo.Yes && this.m_PermBanPlayers == enumBoolYesNo.No && this.m_WhiteList.Contains(info.SoldierName) == false)
                            {
                                if (this.m_BanGUID == enumBoolYesNo.No || this.m_PlayerGUIDs.ContainsKey(info.SoldierName) == false)
                                {
                                    this.ExecuteCommand("procon.protected.send", "banList.add", "name", info.SoldierName, "seconds", (this.m_TempBanTime * 60).ToString(), this.m_BanReason);
                                }
                                else
                                {
                                    this.ExecuteCommand("procon.protected.send", "banList.add", "guid", this.m_PlayerGUIDs[info.SoldierName], "seconds", (this.m_TempBanTime * 60).ToString(), this.m_BanReason);
                                }
                                this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("Player '{0}' banned for {1} minutes due to a too high rank!", info.SoldierName, this.m_TempBanTime));
                                if (this.m_ConsoleLog == enumBoolYesNo.Yes)
                                {
                                    this.ExecuteCommand("procon.protected.pluginconsole.write", String.Format("^b^4AccessRestriction: ^0RankKicker-Player '{0}' banned for {1} minutes.", info.SoldierName, this.m_TempBanTime));
                                }
                            }
                            else if (this.m_RankKickerOnOff == enumBoolOnOff.On && stats.Value.rank >= this.m_RankLimit && this.m_TempBanPlayers == enumBoolYesNo.Yes && this.m_PermBanPlayers == enumBoolYesNo.Yes && this.m_WhiteList.Contains(info.SoldierName) == false)
                            {
                                if (this.m_BanGUID == enumBoolYesNo.No || this.m_PlayerGUIDs.ContainsKey(info.SoldierName) == false)
                                {
                                    this.ExecuteCommand("procon.protected.send", "banList.add", "name", info.SoldierName, "perm", this.m_PermBanReason);
                                }
                                else
                                {
                                    this.ExecuteCommand("procon.protected.send", "banList.add", "guid", this.m_PlayerGUIDs[info.SoldierName], "perm", this.m_PermBanReason);
                                }
                                this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("Player '{0}' banned permanently due to a too high rank!", info.SoldierName));
                                if (this.m_ConsoleLog == enumBoolYesNo.Yes)
                                {
                                    this.ExecuteCommand("procon.protected.pluginconsole.write", String.Format("^b^4AccessRestriction: ^0RankKicker-Player '{0}' banned permanently.", info.SoldierName));
                                }
                            }
                        }
                    }

                    if (this.m_AccessLimitation == enumBoolOnOff.On)
                    {
                        if (this.m_AccessLimitationPlayers == enumBoolYesNo.Yes || this.m_AccessLimitationTags == enumBoolYesNo.Yes)
                        {
                            bool validPlayer;
                            if (this.m_AllowedPlayers.Contains(info.SoldierName) == true || this.m_AllowedClanTags.Contains(info.ClanTag) == true)
                            {
                                validPlayer = true;
                            }
                            else
                            {
                                validPlayer = false;
                            }
                            if (validPlayer != true)
                            {
                                if (this.m_AccessBanPlayers == enumBoolYesNo.No)
                                {
                                    this.ExecuteCommand("procon.protected.send", "admin.kickPlayer", info.SoldierName, this.m_AccessKickReason);
                                    this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("Player '{0}' kicked for not being on the list of allowed players!", info.SoldierName));
                                    if (this.m_ConsoleLog == enumBoolYesNo.Yes)
                                    {
                                        this.ExecuteCommand("procon.protected.pluginconsole.write", String.Format("^b^4AccessRestriction: ^0AccessLimitation-Player '{0}' kicked.", info.SoldierName));
                                    }
                                }
                                else if (this.m_AccessBanPlayers == enumBoolYesNo.Yes)
                                {
                                    if (this.m_BanGUID == enumBoolYesNo.No || this.m_PlayerGUIDs.ContainsKey(info.SoldierName) == false)
                                    {
                                        this.ExecuteCommand("procon.protected.send", "banList.add", "name", info.SoldierName, "perm", this.m_AccessPermBanReason);
                                    }
                                    else
                                    {
                                        this.ExecuteCommand("procon.protected.send", "banList.add", "guid", this.m_PlayerGUIDs[info.SoldierName], "perm", this.m_AccessPermBanReason);
                                    }
                                    this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("Player '{0}' banned permanently for not being on the list of allowed players!", info.SoldierName));
                                    if (this.m_ConsoleLog == enumBoolYesNo.Yes)
                                    {
                                        this.ExecuteCommand("procon.protected.pluginconsole.write", String.Format("^b^4AccessRestriction: ^0AccessLimitation-Player '{0}' banned permanently.", info.SoldierName));
                                    }
                                }
                            }
                        }
                    }

                    if (this.m_ClanTagModeration == enumBoolOnOff.On)
                    {
                        if (this.m_ModeratedClanTags.Contains(info.ClanTag) == true)
                        {
                            if (this.m_AllowedClanPlayers.Contains(info.SoldierName) != true)
                            {
                                if (this.m_ClanTagBanPlayers == enumBoolYesNo.No)
                                {
                                    this.ExecuteCommand("procon.protected.send", "admin.kickPlayer", info.SoldierName, this.m_ClanTagKickReason);
                                    this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("Player '{0}' kicked for using a clantag by unfair means!", info.SoldierName));
                                    if (this.m_ConsoleLog == enumBoolYesNo.Yes)
                                    {
                                        this.ExecuteCommand("procon.protected.pluginconsole.write", String.Format("^b^4AccessRestriction: ^0ClanTagModeration-Player '{0}' kicked.", info.SoldierName));
                                    }
                                }
                                else if (this.m_ClanTagBanPlayers == enumBoolYesNo.Yes)
                                {
                                    if (this.m_BanGUID == enumBoolYesNo.No || this.m_PlayerGUIDs.ContainsKey(info.SoldierName) == false)
                                    {
                                        this.ExecuteCommand("procon.protected.send", "banList.add", "name", info.SoldierName, "perm", this.m_ClanTagPermBanReason);
                                    }
                                    else
                                    {
                                        this.ExecuteCommand("procon.protected.send", "banList.add", "guid", this.m_PlayerGUIDs[info.SoldierName], "perm", this.m_ClanTagPermBanReason);
                                    }
                                    this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("Player '{0}' banned permanently for using a clantag by unfair means!", info.SoldierName));
                                    if (this.m_ConsoleLog == enumBoolYesNo.Yes)
                                    {
                                        this.ExecuteCommand("procon.protected.pluginconsole.write", String.Format("^b^4AccessRestriction: ^0ClanTagModeration-Player '{0}' banned permanently.", info.SoldierName));
                                    }
                                }
                            }
                        }
                    }

                    if (this.m_DisallowedTags == enumBoolOnOff.On)
                    {
                        if (this.m_DisallowedClanTags.Contains(info.ClanTag) == true)
                        {
                            if (this.m_DisallowedTagsBan == enumBoolYesNo.No)
                            {
                                this.ExecuteCommand("procon.protected.send", "admin.kickPlayer", info.SoldierName, this.m_DisallowedTagsKickReason);
                                this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("Player '{0}' kicked due to his clan not being welcome here!", info.SoldierName));
                                if (this.m_ConsoleLog == enumBoolYesNo.Yes)
                                {
                                    this.ExecuteCommand("procon.protected.pluginconsole.write", String.Format("^b^4AccessRestriction: ^0DisallowedClanTags-Player '{0}' kicked.", info.SoldierName));
                                }
                            }
                            else if (this.m_DisallowedTagsBan == enumBoolYesNo.Yes)
                            {
                                if (this.m_BanGUID == enumBoolYesNo.No || this.m_PlayerGUIDs.ContainsKey(info.SoldierName) == false)
                                {
                                    this.ExecuteCommand("procon.protected.send", "banList.add", "name", info.SoldierName, "perm", this.m_DisallowedTagsBanReason);
                                }
                                else
                                {
                                    this.ExecuteCommand("procon.protected.send", "banList.add", "guid", this.m_PlayerGUIDs[info.SoldierName], "perm", this.m_DisallowedTagsBanReason);
                                }
                                this.ExecuteCommand("procon.protected.send", "admin.say", String.Format("Player '{0}' banned permanently due to his clan not being welcome here!", info.SoldierName));
                                if (this.m_ConsoleLog == enumBoolYesNo.Yes)
                                {
                                    this.ExecuteCommand("procon.protected.pluginconsole.write", String.Format("^b^4AccessRestriction: ^0DisallowedClanTags-Player '{0}' banned permanently.", info.SoldierName));
                                }
                            }
                        }
                    }
                }
            }
        }
 public void OnCommandScrambleRound(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope){
     bool blIsAdmin = false;
     CPrivileges cpAccount = this.GetAccountPrivileges(strSpeaker);
     if (cpAccount != null && cpAccount.PrivilegesFlags > 0) { blIsAdmin = true; }
     if(blIsAdmin){
         this.DebugInfoSkill("^1Admin requested a scramble next round!");
         
         if (this.ynbEnableScrambleRound == enumBoolYesNo.Yes){
             this.boolscramblebyadminroundend = true;
             if (this.boolLevelStart){
                 if (this.ynbScrambleMessage == enumBoolYesNo.Yes){
                     if (this.strScrambleRoundMsg != ""){
                         if (this.boolVirtual)
                         {
                             this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL:^n say all - " + this.strScrambleRoundMsg);
                         }
                         else
                         {
                             this.ExecuteCommand("procon.protected.send", "admin.say", this.strScrambleRoundMsg , "all");
                         }
                         if (this.ynbYellScrambleManuall == enumBoolYesNo.Yes && !this.boolVirtual){
                             this.ExecuteCommand("procon.protected.send", "admin.yell", this.strScrambleRoundMsg , "30");
                         }
                     }
                 }
             }
         }else{
             this.DebugInfoSkill("^3This command is deactivated at the moment. Activate it in PRoCon.");
             if (this.boolVirtual)
             {
                 this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.say player " + strSpeaker + " - " + "This command is not activated for your server in PRoCon.");
             }
             else
             {
                 this.ExecuteCommand("procon.protected.send", "admin.say", "This command is not activated for your server in PRoCon." , "player", strSpeaker);
             }
         }
     }           
 }
        public void OnCommandTBForceMove(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
        {
            if (capCommand.MatchedArguments.Count == 0) {
                this.DebugInfoGuard("^4Malformed tb-fmove command: " + strText);
                if (this.boolVirtual)
                {
                    this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.say player " + strSpeaker + " - " + "Malformed command: " + strText);
                }
                else
                {
                    this.ExecuteCommand("procon.protected.send", "admin.say", "Malformed command: " + strText, "player", strSpeaker);
                }
                return;
            }

            string player = capCommand.MatchedArguments[0].Argument;
            this.DebugInfoGuard("^4Force Moving Player: ^b" + player);

            this.DTForceMove = DateTime.Now;

            if (this.OnCommandMove.ContainsKey(player) == false)
            {
                this.OnCommandMove.Add(player, true);
            }
            else 
            {
                this.OnCommandMove[player] = true;
            }

            int team = 0;

            if (this.dicPlayerCache[player].teamID == 1)
                team = 2;
            else
                team = 1;

            if (this.boolVirtual)
            {
                this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.movePlayer " + player + " " + team.ToString() + " 0 false");
            }
            else
            {
                this.ExecuteCommand("procon.protected.send", "admin.movePlayer", player, team.ToString(), "0", "true");
            }
            this.DebugInfoGuard("^4Trying to force player to the other side, due to TB-ForceMoveCommand: ^b" + player);

        }
        public void OnCommandTBMove(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope)
        {
            if (capCommand.MatchedArguments.Count == 0) {
                this.DebugInfoGuard("^4Malformed tb-move command: " + strText);
                if (this.boolVirtual)
                {
                    this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.say player " + strSpeaker + " - " + "Malformed command: " + strText);
                }
                else
                {
                    this.ExecuteCommand("procon.protected.send", "admin.say", "Malformed command: " + strText, "player", strSpeaker);
                }
                return;
            }
            string player = capCommand.MatchedArguments[0].Argument;
            this.DebugInfoGuard("^4Move Player when dead: ^b" + player);
            if (this.boolVirtual)
            {
                this.ExecuteCommand("procon.protected.pluginconsole.write", "^b[TB] VIRTUAL^n admin.say player " + player + " - " + "You will be moved to the other team upon death.");
            }
            else
            {
                this.ExecuteCommand("procon.protected.send", "admin.say", "You will be moved to the other team upon death.", "player", player);
            }
            if (this.OnCommandMoveDone.Contains(player))
            {
                this.OnCommandMoveDone.Remove(player);
            }

            if (this.OnCommandMove.ContainsKey(player) == false)
            {
                this.OnCommandMove.Add(player, false);
            }
            else
            {
                this.OnCommandMove[player] = false;
            }
        }
Пример #27
0
        public override void OnListPlayers(List<CPlayerInfo> lstPlayers, CPlayerSubset cpsSubset) {
            if (cpsSubset.Subset != CPlayerSubset.PlayerSubsetType.All)
                return;

            updateQueues(lstPlayers);
            syncPlayersList(lstPlayers);

            /* fail safe to get the maximum number of players in server */
            if (lstPlayers.Count > max_player_count)
                max_player_count = lstPlayers.Count;


            if (check_state_phase == 1)
                startCheckState(utc);
        }
Пример #28
0
        public void OnListPlayers(List<CPlayerInfo> lstPlayers, CPlayerSubset cpsSubset)
        {
            if (cpsSubset.Subset == CPlayerSubset.PlayerSubsetType.All)
            {
                foreach (CPlayerInfo cpiPlayer in lstPlayers)
                {
                    if (this.m_dicPlayersAndBalances.ContainsKey(cpiPlayer.SoldierName) == false)
                    {
                        if (this.CheckAccountByName(cpiPlayer.SoldierName) == false)
                        {
                            this.CreateSQLAccount(cpiPlayer.GUID.ToString(), cpiPlayer.SoldierName);
                            this.m_dicPlayersAndBalances.Add(cpiPlayer.SoldierName, 0);
                        }

                        else
                        {
                            int balanceFromSQL = int.Parse(GetBalance(cpiPlayer.SoldierName));
                            this.m_dicPlayersAndBalances.Add(cpiPlayer.SoldierName, balanceFromSQL);
                        }
                    }

                    if (this.m_dicPlayersAndInfo.ContainsKey(cpiPlayer.SoldierName) == true)
                    {
                        this.m_dicPlayersAndInfo[cpiPlayer.SoldierName] = cpiPlayer;
                    }

                    else
                    {
                        this.m_dicPlayersAndInfo.Add(cpiPlayer.SoldierName, cpiPlayer);
                    }

                    if (this.m_ebynEnablePayroll == enumBoolYesNo.Yes)
                    {
                        this.PayrollManager(cpiPlayer.SoldierName);
                    }

                    if (this.m_dicOldPlayersAndBalances.ContainsKey(cpiPlayer.SoldierName))
                    {
                        if (this.m_dicOldPlayersAndBalances[cpiPlayer.SoldierName] != this.m_dicPlayersAndBalances[cpiPlayer.SoldierName])
                        {
                            this.SetCurrency(this.m_dicPlayersAndBalances[cpiPlayer.SoldierName], cpiPlayer.SoldierName);
                            this.m_dicOldPlayersAndBalances[cpiPlayer.SoldierName] = this.m_dicPlayersAndBalances[cpiPlayer.SoldierName];
                        }
                    }

                    else
                    {
                        this.m_dicOldPlayersAndBalances.Add(cpiPlayer.SoldierName, this.m_dicPlayersAndBalances[cpiPlayer.SoldierName]);
                    }
                }
                SquadCensus("update", 0, 0);
            }
        }
Пример #29
0
        public override void OnListPlayers(List<CPlayerInfo> players, CPlayerSubset subset)
        {
            if (this.threadsReady)
            {
                this.DebugWrite("Listing Players", 5);
                //Player list and ban list need to be locked for this operation
                lock (playersMutex)
                {
                    //Reset the player counts of both sides and recount everything
                    this.USPlayerCount = 0;
                    this.RUPlayerCount = 0;
                    foreach (CPlayerInfo player in players)
                    {
                        AdKat_Player aPlayer = null;
                        if (this.playerDictionary.TryGetValue(player.SoldierName, out aPlayer))
                        {
                            //If the player does not have an IP address, check the database until they have one.
                            if (String.IsNullOrEmpty(aPlayer.player_ip))
                            {
                                aPlayer = this.fetchPlayer(-1, player.SoldierName, player.GUID, null);
                                aPlayer.frostbitePlayerInfo = player;
                                //In case of quick name-change, update their IGN
                                aPlayer.player_name = player.SoldierName;

                                //if player now has an IP, call a ban check
                                if (!String.IsNullOrEmpty(aPlayer.player_ip))
                                {
                                    //Check with ban enforcer
                                    this.queuePlayerForBanCheck(aPlayer);
                                }
                            }
                            else
                            {
                                //Otherwise, just update the frostbite player info
                                this.playerDictionary[player.SoldierName].frostbitePlayerInfo = player;
                            }
                        }
                        else
                        {
                            aPlayer = this.fetchPlayer(-1, player.SoldierName, player.GUID, null);
                            aPlayer.frostbitePlayerInfo = player;
                            //In case of quick name-change, update their IGN
                            aPlayer.player_name = player.SoldierName;

                            this.playerDictionary.Add(player.SoldierName, aPlayer);

                            //Check with ban enforcer
                            this.queuePlayerForBanCheck(aPlayer);

                            if (this.isAdminAssistant(aPlayer))
                            {
                                this.DebugWrite(player.SoldierName + " IS an Admin Assistant.", 3);
                                if (!this.adminAssistantCache.ContainsKey(player.SoldierName))
                                {
                                    this.adminAssistantCache.Add(player.SoldierName, false);
                                    this.DebugWrite(player.SoldierName + " added to the Admin Assistant Cache.", 4);
                                }
                                else
                                {
                                    this.DebugWrite("Player is already in the admin assitant cache, this is abnormal.", 3);
                                }
                            }
                            else
                            {
                                this.DebugWrite(player.SoldierName + " is NOT an Admin Assistant.", 4);
                            }
                        }

                        if (player.TeamID == USTeamID)
                        {
                            this.USPlayerCount++;
                        }
                        else
                        {
                            this.RUPlayerCount++;
                        }
                    }
                }

                //Set the handle for teamswap
                this.listPlayersHandle.Set();
            }
        }
Пример #30
0
 public void OnCommandPlayerLocation(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) {
     if (this.m_enAllowPlayersToGetOthersCountry == enumBoolYesNo.Yes) {
         if (base.PunkbusterPlayerInfoList.ContainsKey(capCommand.MatchedArguments[0].Argument) == true) {
             this.ExecuteCommand("procon.protected.send", "admin.say", base.PunkbusterPlayerInfoList[capCommand.MatchedArguments[0].Argument].SoldierName + "'s location: " + base.PunkbusterPlayerInfoList[capCommand.MatchedArguments[0].Argument].PlayerCountry, "player", strSpeaker);
         }
         else {
             this.ExecuteCommand("procon.protected.send", "admin.say", "Player not found", "player", strSpeaker);
         }
     }
 }