Esempio n. 1
0
        public static bool PlayerIsRanked(ClassCollections.AppObject player)
        {
            {
                if (player.level <= 20)
                {
                    MessageBox.Show("Player level too low for ranked...");
                    return(false);
                }

                MessageBox.Show("Player is ranked...");
                return(true);
            }
        }
Esempio n. 2
0
        public static void CreatePlayerObject(ClassCollections.AppObject player)

        {
            string output = HTTPConnector.HttpClientConnector.TestMethod(ClassCollections.AppConfig.selectedName, ClassCollections.AppConfig.selectedPlatform);

            var listPlayer = JsonConvert.DeserializeObject <List <ClassCollections.RootObject> >(output);

            //Copy required items from rootobject into player object

            foreach (var item in listPlayer)
            {
                player.apacRank = Convert.ToInt32(item.ranks.apac.mmr);
                player.emeaRank = Convert.ToInt32(item.ranks.emea.mmr);
                player.ncsaRank = Convert.ToInt32(item.ranks.ncsa.mmr);
                player.level    = item.level;
                player.name     = item.name;
            }
        }
Esempio n. 3
0
        public static double GetRegionMmr(ClassCollections.AppObject player, string selectedRegion)

        {
            if (ClassCollections.AppConfig.selectedRegion == "emea")
            {
                return(player.emeaRank);
            }
            else if (ClassCollections.AppConfig.selectedRegion == "apac")
            {
                Console.WriteLine("Rank: " + player.apacRank);
                return(player.apacRank);
            }
            else if (ClassCollections.AppConfig.selectedRegion == "ncsa")
            {
                Console.WriteLine("Rank: " + player.ncsaRank);
                return(player.ncsaRank);
            }
            else
            {
                //catch all to ignore error
                return(0);
            }
        }
Esempio n. 4
0
        public void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            ClassCollections.AppConfig.selectedName = this.SearchText.Text;

            ClassCollections.AppObject player = new ClassCollections.AppObject();



            if (Engine.IsPlayerUnique())
            {
                MessageBox.Show("Name unique!");

                Engine.CreatePlayerObject(player);

                if (Engine.PlayerIsRanked(player))
                {
                    double regionMmr = Engine.GetRegionMmr(player, ClassCollections.AppConfig.selectedRegion);

                    string calculatedRank = Engine.CalculateRank(regionMmr);

                    MessageBox.Show(calculatedRank);

                    DisplayRank displayRankWindow = new DisplayRank();
                    displayRankWindow.Show();
                    this.Close();
                }
            }

            else

            {
                MessageBox.Show("Name Not Unique!");
                PickPlayer pickPlayerWindow = new PickPlayer();
                pickPlayerWindow.Show();
                this.Close();
            }
        }