Пример #1
0
        public static void Revive(bool manual = false)
        {
            try
            {
                if (GUI.isPxgActive() == false)
                {
                    AutoItX.WinActivate(Addresses.PxgClientName);
                }

                if (GUI.PokeballPosition.X == 0 || GUI.PokeballPosition.Y == 0 || GUI.PokeballPosition.IsEmpty)
                {
                    if (Settings.Debug)
                    {
                        Settings.DebugText += "\n Pokeball position not set for reviving";
                    }
                    Console.WriteLine("Pokeball position not set for reviving");
                    Reviving = false;
                    return;
                }

                Reviving              = true;
                ReviveCooldown        = true;
                Cavebot.Enabled       = false;
                CavebotAttack.Enabled = false;
                if (Settings.Debug)
                {
                    Settings.DebugText += "\n Will Revive";
                }

                /////////////////////////
                if (manual || HP > 0)
                {
                    PutIn();
                }

                InputHandler.BlockUserInput(true);

                InputHandler.SendKeys(new string[] { AutoReviveHotkey }, 15);
                AutoItX.Sleep(15);
                InputHandler.MouseClick("left", GUI.PokeballPosition.X, GUI.PokeballPosition.Y);
                Settings.DebugText += "Run Revive";
                AutoItX.Sleep(100);
                PutOut();

                InputHandler.BlockUserInput(false);

                foreach (PokemonSpell spell in Pokemon.PokemonSpells)
                {
                    spell.Available = true;
                }
                if (HP > AutoReviveHP)
                {
                    Task.Run(async() => { await Task.Delay(2000); ReviveCooldown = false; });
                }
                else
                {
                    ReviveCooldown = false;
                }

                Reviving              = false;
                Cavebot.Enabled       = true;
                CavebotAttack.Enabled = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: Revive: " + ex.Message);
            }
        }