コード例 #1
0
        private async void btnUpgrade_Click(object sender, EventArgs e)
        {
            EnabledButton(false);
            var selectedItems = PokemonListView.SelectedItems;
            int powerdup = 0;
            int total = selectedItems.Count;
            string failed = string.Empty;
            taskResponse resp = new taskResponse(false, string.Empty);

            foreach (ListViewItem selectedItem in selectedItems)
            {
                resp = await PowerUp((PokemonData)selectedItem.Tag);
                if (resp.Status)
                    powerdup++;
                else
                    failed += resp.Message + " ";
            }
            if (failed != string.Empty)
                MessageBox.Show("Succesfully powered up " + powerdup + "/" + total + " Pokemons. Failed: " + failed, "Transfer status", MessageBoxButtons.OK, MessageBoxIcon.Information);
            else
                MessageBox.Show("Succesfully powered up " + powerdup + "/" + total + " Pokemons.", "Transfer status", MessageBoxButtons.OK, MessageBoxIcon.Information);
            if (powerdup > 0)
            {
                PokemonListView.Clear();
                Execute();
            }
            else
                EnabledButton(true);
        }
コード例 #2
0
ファイル: Pokemons.cs プロジェクト: vaginessa/Pokecrot
        private async void btnFullPowerUp_Click(object sender, EventArgs e)
        {
            EnabledButton(false, "Powering up...");
            DialogResult result = MessageBox.Show("This process may take some time.", "FullPowerUp status", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (result == DialogResult.OK)
            {
                var    selectedItems = PokemonListView.SelectedItems;
                int    powerdup      = 0;
                int    total         = selectedItems.Count;
                string failed        = string.Empty;

                taskResponse resp     = new taskResponse(false, string.Empty);
                int          i        = 0;
                int          powerUps = 0;
                while (i == 0)
                {
                    foreach (ListViewItem selectedItem in selectedItems)
                    {
                        resp = await PowerUp((PokemonData)selectedItem.Tag);

                        if (resp.Status)
                        {
                            powerdup++;
                        }
                        else
                        {
                            failed += resp.Message + " ";
                        }
                    }
                    if (failed != string.Empty)
                    {
                        if (powerUps > 0)
                        {
                            MessageBox.Show("Pokemon succesfully powered " + powerUps + " times up.", "FullPowerUp status", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("Pokemon not powered up. Not enough Stardust or Candy.", "FullPowerUp status", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        i = 1;
                        EnabledButton(true);
                    }
                    else
                    {
                        powerUps++;
                        statusTexbox.Text = "Powering up..." + powerUps;
                    }
                }
                if (powerdup > 0 && i == 1)
                {
                    PokemonListView.Clear();
                    Execute();
                }
            }
            else
            {
                EnabledButton(true);
            }
        }
コード例 #3
0
        private async void btnEvolve_Click(object sender, EventArgs e)
        {
            EnabledButton(false, "Evolving...");
            var selectedItems = PokemonListView.SelectedItems;
            int evolved = 0;
            int total = selectedItems.Count;
            string failed = string.Empty;
            taskResponse resp = new taskResponse(false, string.Empty);

            foreach (ListViewItem selectedItem in selectedItems)
            {
                resp = await evolvePokemon((PokemonData)selectedItem.Tag);
                if (resp.Status)
                {
                    evolved++;
                    statusTexbox.Text = "Evolving..." + evolved;
                }
                else
                    failed += resp.Message + " ";
            }

            if (failed != string.Empty)
                MessageBox.Show("Succesfully evolved " + evolved + "/" + total + " Pokemons. Failed: " + failed, "Evolve status", MessageBoxButtons.OK, MessageBoxIcon.Information);
            else
                MessageBox.Show("Succesfully evolved " + evolved + "/" + total + " Pokemons.", "Evolve status", MessageBoxButtons.OK, MessageBoxIcon.Information);
            if (evolved > 0)
            {
                PokemonListView.Clear();
                Execute();
            }
            else
                EnabledButton(true);
        }
コード例 #4
0
        private async void powerUpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var pokemon = (PokemonData)PokemonListView.SelectedItems[0].Tag;
            taskResponse resp = new taskResponse(false, string.Empty);

            if (MessageBox.Show(this, pokemon.PokemonId + " with " + pokemon.Cp + " CP thats " + Math.Round(PokemonInfo.CalculatePokemonPerfection(pokemon)) + "% perfect", "Are you sure you want to power it up?", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                resp = await PowerUp(pokemon);
            }
            else
            {
                return;
            }
            if (resp.Status)
            {
                PokemonListView.Clear();
                Execute();
            }
            else
                MessageBox.Show(resp.Message + " powering up failed!", "PowerUp Status", MessageBoxButtons.OK);
        }
コード例 #5
0
ファイル: Pokemons.cs プロジェクト: vaginessa/Pokecrot
 private void reloadtimer_Tick(object sender, EventArgs e)
 {
     PokemonListView.Clear();
     Execute();
 }
コード例 #6
0
ファイル: Pokemons.cs プロジェクト: vaginessa/Pokecrot
 private void btnReload_Click(object sender, EventArgs e)
 {
     PokemonListView.Clear();
     Execute();
 }
コード例 #7
0
        private async void btnEvolve_Click(object sender, EventArgs e)
        {
            EnabledButton(false, "Evolving...");
            var    selectedItems = PokemonListView.SelectedItems;
            int    evolved       = 0;
            int    total         = selectedItems.Count;
            string failed        = string.Empty;
            var    date          = DateTime.Now.ToString();
            string logPath       = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs");
            string evolvelog     = System.IO.Path.Combine(logPath, "EvolveLog.txt");

            taskResponse resp = new taskResponse(false, string.Empty);

            foreach (ListViewItem selectedItem in selectedItems)
            {
                resp = await evolvePokemon((PokemonData)selectedItem.Tag);

                var pokemoninfo = (PokemonData)selectedItem.Tag;
                var name        = pokemoninfo.PokemonId;

                File.AppendAllText(evolvelog, $"[{date}] - MANUAL - Trying to evole Pokemon: {name}" + Environment.NewLine);

                if (resp.Status)
                {
                    evolved++;
                    statusTexbox.Text = "Evolving..." + evolved;
                }
                else
                {
                    failed += resp.Message + " ";
                }
                if (Globals.UseAnimationTimes)
                {
                    await RandomHelper.RandomDelay(30000, 35000);
                }
                else
                {
                    await RandomHelper.RandomDelay(500, 800);
                }
            }


            if (failed != string.Empty)
            {
                if (_clientSettings.bLogEvolve)
                {
                    File.AppendAllText(evolvelog, $"[{date}] - MANUAL - Sucessfully evolved {evolved}/{total} Pokemons. Failed: {failed}" + Environment.NewLine);
                }
                MessageBox.Show("Succesfully evolved " + evolved + "/" + total + " Pokemons. Failed: " + failed, "Evolve status", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            else
            {
                if (_clientSettings.bLogEvolve)
                {
                    File.AppendAllText(evolvelog, $"[{date}] - MANUAL - Sucessfully evolved {evolved}/{total} Pokemons." + Environment.NewLine);
                }
                MessageBox.Show("Succesfully evolved " + evolved + "/" + total + " Pokemons.", "Evolve status", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            if (evolved > 0)
            {
                PokemonListView.Clear();
                Execute();
            }
            else
            {
                EnabledButton(true);
            }
        }