Пример #1
0
 public static void OnLoad(Config config)
 {
     Log.Info($"onLoad - reading config, ceating ranks and gamerecord object");
     _config  = config;
     _ranks   = new Ranks();
     _record  = new GameRecord();
     lastRank = 0;
 }
Пример #2
0
 public static void OnLoad(Config config)
 {
     Log.Info($"onLoad - reading config, creating ranks and gamerecord object");
     _config = config;
     _ranks  = new Ranks();
     LoadGameRecordFromFile();
     lastRank = 0;
     IsAdmin();
     boonApiConnector.InitializeClient();
 }
        public static void CalcAvgRank(Ranks rank)
        {
            double totalAmount    = rank.rank1Amount + rank.rank2Amount + rank.rank3Amount + rank.rank4Amount + rank.rank5Amount + rank.rank6Amount + rank.rank7Amount + rank.rank8Amount;
            double weightedAmount = (1 * rank.rank1Amount) + (2 * rank.rank2Amount) + (3 * rank.rank3Amount) + (4 * rank.rank4Amount) + (5 * rank.rank5Amount) + (6 * rank.rank6Amount) + (7 * rank.rank7Amount) + (8 * rank.rank8Amount);

            if (totalAmount != 0)
            {
                _avgRank = Math.Round((weightedAmount / totalAmount), MidpointRounding.AwayFromZero).ToString();
            }
        }
Пример #4
0
        public static void CalcAvgRank(Ranks rank)
        {
            double totalAmount    = rank.rank1Amount + rank.rank2Amount + rank.rank3Amount + rank.rank4Amount + rank.rank5Amount + rank.rank6Amount + rank.rank7Amount + rank.rank8Amount;
            double weightedAmount = (1 * rank.rank1Amount) + (2 * rank.rank2Amount) + (3 * rank.rank3Amount) + (4 * rank.rank4Amount) + (5 * rank.rank5Amount) + (6 * rank.rank6Amount) + (7 * rank.rank7Amount) + (8 * rank.rank8Amount);

            if (_overlay.tbTotalGames.Visibility == Visibility.Visible)
            {
                _overlay.tbTotalGames.Content = "Games: " + totalAmount.ToString();
            }
            if (totalAmount != 0)
            {
                _avgRank = Math.Round((weightedAmount / totalAmount), MidpointRounding.AwayFromZero).ToString();
            }
        }
Пример #5
0
 private static void SetOverlayRanksAndStuff()
 {
     if (lastRank > 0)
     {
         Ranks.SetRank(lastRank, _ranks);
         CalcAvgRank(_ranks);
         _overlay.SetRanksForOverlay(_ranks, _avgRank);
         _simpleOverlay.SetLastRank(lastRank);
         UpdateLeaderboardData();
         meanbob.meanBobLines(lastRank, _config);
         if (lastRank == 8)
         {
             RankEight();
         }
     }
 }
        public void SetTextBoxValue(Ranks rank, string avgRank)
        {
            lbRank1.Content = rank.rank1Amount.ToString() + "x";
            lbRank2.Content = rank.rank2Amount.ToString() + "x";
            lbRank3.Content = rank.rank3Amount.ToString() + "x";
            lbRank4.Content = rank.rank4Amount.ToString() + "x";
            lbRank5.Content = rank.rank5Amount.ToString() + "x";
            lbRank6.Content = rank.rank6Amount.ToString() + "x";
            lbRank7.Content = rank.rank7Amount.ToString() + "x";
            lbRank8.Content = rank.rank8Amount.ToString() + "x";

            int[] numbers       = new int[] { rank.rank1Amount, rank.rank2Amount, rank.rank3Amount, rank.rank4Amount, rank.rank5Amount, rank.rank6Amount, rank.rank7Amount, rank.rank8Amount };
            int   maximumNumber = numbers.Max();

            if (maximumNumber != 0)
            {
                pbRank1.Maximum = maximumNumber;
                pbRank2.Maximum = maximumNumber;
                pbRank3.Maximum = maximumNumber;
                pbRank4.Maximum = maximumNumber;
                pbRank5.Maximum = maximumNumber;
                pbRank6.Maximum = maximumNumber;
                pbRank7.Maximum = maximumNumber;
                pbRank8.Maximum = maximumNumber;
            }

            pbRank1.Value = rank.rank1Amount;
            pbRank2.Value = rank.rank2Amount;
            pbRank3.Value = rank.rank3Amount;
            pbRank4.Value = rank.rank4Amount;
            pbRank5.Value = rank.rank5Amount;
            pbRank6.Value = rank.rank6Amount;
            pbRank7.Value = rank.rank7Amount;
            pbRank8.Value = rank.rank8Amount;

            if (tbAvgRankText.Visibility == Visibility.Visible)
            {
                tbAvgRankText.Content = "Ø-Rank: " + avgRank;
            }
            if (tbAvgRankSmallText.Visibility == Visibility.Visible)
            {
                tbAvgRankSmallText.Content = avgRank;
            }
        }
Пример #7
0
        internal static void SetRank(int rank, Ranks _ranks)
        {
            switch (rank)
            {
            case 1:
                _ranks.rank1Amount = _ranks.rank1Amount + 1;
                break;

            case 2:
                _ranks.rank2Amount = _ranks.rank2Amount + 1;
                break;

            case 3:
                _ranks.rank3Amount = _ranks.rank3Amount + 1;
                break;

            case 4:
                _ranks.rank4Amount = _ranks.rank4Amount + 1;
                break;

            case 5:
                _ranks.rank5Amount = _ranks.rank5Amount + 1;
                break;

            case 6:
                _ranks.rank6Amount = _ranks.rank6Amount + 1;
                break;

            case 7:
                _ranks.rank7Amount = _ranks.rank7Amount + 1;
                break;

            case 8:
                _ranks.rank8Amount = _ranks.rank8Amount + 1;

                break;

            default: break;
            }
        }
        public string SetAvgRankValue(Ranks rank)
        {
            double totalAmount    = rank.rank1Amount + rank.rank2Amount + rank.rank3Amount + rank.rank4Amount + rank.rank5Amount + rank.rank6Amount + rank.rank7Amount + rank.rank8Amount;
            double weightedAmount = (1 * rank.rank1Amount) + (2 * rank.rank2Amount) + (3 * rank.rank3Amount) + (4 * rank.rank4Amount) + (5 * rank.rank5Amount) + (6 * rank.rank6Amount) + (7 * rank.rank7Amount) + (8 * rank.rank8Amount);

            if (tbTotalGames.Visibility == Visibility.Visible)
            {
                tbTotalGames.Content = "Games: " + totalAmount.ToString();
            }
            if (tbTotalGamesSmallText.Visibility == Visibility.Visible)
            {
                tbTotalGamesSmallText.Content = totalAmount.ToString();
            }
            if (totalAmount != 0)
            {
                return(Math.Round((weightedAmount / totalAmount), MidpointRounding.AwayFromZero).ToString());
            }
            else
            {
                return("");
            }
        }
Пример #9
0
        internal void SetAvgRank(string avgRank)
        {
            Ranks rank = new Ranks();

            lbAvgRank.Content = "Avg Rank: " + avgRank;
        }
Пример #10
0
 public static void AddManual(int rank, Ranks ranks)
 {
     SetRank(rank, ranks);
 }