예제 #1
0
        public async Task AutoHunt()
        {
            Log.Information($"Starting AutoHunt for {_poet.Self.Name}...");

            while (_isRunning.Value)
            {
                try
                {
                    if (_isPaused.Value)
                    {
                        continue;
                    }
                    _poet.UpdateGroup(_clients);
                    ResetCurses();
                    MarkExternalGroupMembersForEsuna();
                    if (await _poet.Commands.Mana.Invoke())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Heal.RestoreGroupIfEligible())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Heal.HealGroupIfBelowVitaPercent(20))
                    {
                        continue;
                    }
                    if (await _poet.Commands.Asv.SanctuaryGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Debuffs.AtoneGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Debuffs.RemoveCurseGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Debuffs.CureParalysisGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Debuffs.PurgeGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Asv.HardenArmorGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Debuffs.RemoveVeilGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Heal.HealGroupIfEligible())
                    {
                        continue;                                                  // Most mana-efficient healing
                    }
                    if (await _poet.Commands.Debuffs.CurseNpcs())
                    {
                        continue;
                    }
                    if (await _poet.UpdateNpcs(_poet.Spells.KeySpells.Heal))
                    {
                        continue;
                    }
                    if (await _poet.Commands.Mana.InspireGroup())
                    {
                        continue;
                    }
                    if (await HardenBody())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Asv.ValorGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Heal.HealGroupIfBelowVitaPercent(50))
                    {
                        continue;                                                            // For when the heal amount is relatively large compared to target's max vita
                    }
                    await _poet.Commands.Debuffs.DisheartenNpcs();
                }
                catch (Exception ex)
                {
                    TkTrainerFactory.Terminate(ex);
                }
            }

            Log.Information($"Shutting down Poet trainer for {_poet.Self.Name}...");
            _ahk.ExecRaw("Suspend");
            TkTrainerFactory.Terminate(_poet);
        }
예제 #2
0
        /// <summary>
        /// Defines and executes the logic of the bot. Lines in the try statement can be
        /// rearranged to tweak the logic, or commands can be added/removed for significantly
        /// different bot behavior.
        /// </summary>
        public async Task AutoHunt()
        {
            Log.Information($"Starting Poet bot for {_poet.Self.Name}...");

            while (_isBotRunning.Value)
            {
                try
                {
                    if (_isBotPaused.Value)
                    {
                        continue;
                    }
                    _poet.UpdateGroup(_clients);
                    if (await Return())
                    {
                        continue;
                    }
                    if (await Gate())
                    {
                        continue;
                    }
                    if (await Ring())
                    {
                        continue;
                    }
                    MarkExternalGroupMembersForEsuna();
                    if (await _poet.Commands.Mana.Invoke(20))
                    {
                        continue;
                    }
                    if (await _poet.Commands.Heal.RestoreGroupIfEligible())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Heal.HealGroupIfBelowVitaPercent(20))
                    {
                        continue;
                    }
                    if (await _poet.Commands.Asv.SanctuaryGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Debuffs.AtoneGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Heal.HealGroupIfBelowVitaPercent(30))
                    {
                        continue;
                    }
                    if (await _poet.Commands.Debuffs.RemoveCurseGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Debuffs.CureParalysisGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Debuffs.PurgeGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Asv.HardenArmorGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Debuffs.CurseNpcs())
                    {
                        continue;
                    }
                    if (await _poet.UpdateNpcs(_poet.Spells.KeySpells.Heal))
                    {
                        continue;
                    }
                    if (await _poet.Commands.Debuffs.RemoveVeilGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Heal.HealGroupIfEligible())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Asv.ValorGroup())
                    {
                        continue;
                    }
                    if (await _poet.Commands.Heal.HealGroupIfBelowVitaPercent(90))
                    {
                        continue;
                    }
                    if (await _poet.Commands.Mana.InspireGroup(75))
                    {
                        continue;
                    }
                    await _poet.Commands.HardenBody();
                }

                catch (Exception ex)
                {
                    TkBotFactory.LogException(ex);
                }
            }

            Log.Information($"Shutting down Poet bot for {_poet.Self.Name}...");
            TkBotFactory.Terminate(_poet);
        }