public async Task AutoFollow()
        {
            var activeClients = new ActiveClients(Path.GetFileNameWithoutExtension(_config.Process));
            var leader        = activeClients.GetClient(_config.Leader);
            var distance      = _config.Distance;
            var followers     = activeClients.Clients.Where(client =>
                                                            !string.Equals(leader.Self.Name, client.Self.Name, StringComparison.OrdinalIgnoreCase))
                                .ToArray();

            Log.Information($"Following {leader.Self.Name} at a distance of no more than {distance} space(s).");

            while (_isRunning.Value)
            {
                try
                {
                    if (_isPaused.Value)
                    {
                        continue;
                    }

                    foreach (var follower in followers)
                    {
                        switch (follower.Self.BasePath)
                        {
                        case TkClient.BasePath.Mage:
                            await((MageClient)follower).Commands.Movement.Follow(leader, distance);
                            break;

                        case TkClient.BasePath.Poet:
                            await((PoetClient)follower).Commands.Movement.Follow(leader, distance);
                            break;

                        case TkClient.BasePath.Rogue:
                            await((RogueClient)follower).Commands.Movement.Follow(leader, distance);
                            break;

                        case TkClient.BasePath.Warrior:
                            await((WarriorClient)follower).Commands.Movement.Follow(leader, distance);
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    TkTrainerFactory.Terminate(ex);
                }
            }
        }
Exemple #2
0
 private static async Task Main(string[] args)
 {
     await Parser.Default.ParseArguments <WarriorConfiguration>(args)
     .WithParsedAsync(async config =>
     {
         try
         {
             var trainer = new WarriorTrainer(config);
             await trainer.AutoHunt();
         }
         catch (Exception ex)
         {
             TkTrainerFactory.Terminate(ex);
         }
     });
 }
Exemple #3
0
        public async Task AutoHunt()
        {
            Log.Information($"Starting AutoHunt for {_mage.Self.Name}...");

            while (_isRunning.Value)
            {
                try
                {
                    if (_isPaused.Value)
                    {
                        continue;
                    }
                    _mage.UpdateGroup(_clients);
                    MarkExternalGroupMembersForEsuna();
                    if (await _mage.Commands.Mana.Invoke())
                    {
                        continue;
                    }
                    if (await HealGroupIfBelowVitaPercent(20))
                    {
                        continue;
                    }
                    if (await _mage.Commands.Asv.SanctuaryGroup())
                    {
                        continue;
                    }
                    if (await _mage.Commands.Debuffs.RemoveCurseGroup())
                    {
                        continue;
                    }
                    if (await _mage.Commands.Debuffs.CureParalysisGroup())
                    {
                        continue;
                    }
                    if (await _mage.Commands.Debuffs.PurgeGroup())
                    {
                        continue;
                    }
                    if (await _mage.Commands.Asv.HardenArmorGroup())
                    {
                        continue;
                    }
                    if (await HealGroupIfEligible())
                    {
                        continue;                              // Most mana-efficient healing
                    }
                    if (await BlindNpcs())
                    {
                        continue;
                    }
                    if (await VexNpcs())
                    {
                        continue;
                    }
                    if (await ParalyzeNpcs())
                    {
                        continue;
                    }
                    if (await UpdateNpcs())
                    {
                        continue;
                    }
                    if (await VenomNpcs())
                    {
                        continue;
                    }
                    if (await _mage.Commands.Asv.ValorGroup())
                    {
                        continue;
                    }
                    if (await _mage.Commands.Heal.HealGroupIfBelowVitaPercent(50))
                    {
                        continue;                                                            // For when the heal amount is relatively large compared to target's max vita
                    }
                    await ZapNpcs();
                }
                catch (Exception ex)
                {
                    TkTrainerFactory.Terminate(ex);
                }
            }

            Log.Information($"Shutting down Mage trainer for {_mage.Self.Name}...");
            _ahk.ExecRaw("Suspend");
            TkTrainerFactory.Terminate(_mage);
        }
        public async Task AutoHunt()
        {
            Log.Information($"Starting AutoHunt for {_rogue.Self.Name}...");

            try
            {
                await _rogue.Commands.Buffs.Enchant();
            }
            catch (Exception ex)
            {
                TkTrainerFactory.Terminate(ex);
            }

            while (_isRunning.Value)
            {
                try
                {
                    if (_isPaused.Value)
                    {
                        continue;
                    }
                    _rogue.UpdateGroup(_clients);
                    if (await _rogue.Commands.Buffs.Rage())
                    {
                        continue;
                    }
                    if (await _rogue.Commands.Buffs.Fury())
                    {
                        continue;
                    }
                    if (await _rogue.Commands.Buffs.ShadowFigure())
                    {
                        continue;
                    }
                    if (await _rogue.Commands.Buffs.Might())
                    {
                        continue;
                    }
                    if (await LethalStrike(85))
                    {
                        continue;
                    }
                    if (await DesperateAttack(85))
                    {
                        continue;
                    }
                    if (await TauntNpcs())
                    {
                        continue;
                    }
                    if (await Invisible())
                    {
                        continue;
                    }
                    await Melee();
                }
                catch (Exception ex)
                {
                    TkTrainerFactory.Terminate(ex);
                }
            }

            Log.Information($"Shutting down trainer for {_rogue.Self.Name}...");
            _ahk.ExecRaw("Suspend");
            TkTrainerFactory.Terminate(_rogue);
        }
Exemple #5
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);
        }
        public async Task AutoHunt()
        {
            Log.Information($"Starting AutoHunt for {_warrior.Self.Name}...");

            try
            {
                await _warrior.Commands.Buffs.Enchant();
            }
            catch (Exception ex)
            {
                TkTrainerFactory.Terminate(ex);
            }

            while (_isRunning.Value)
            {
                try
                {
                    if (_isPaused.Value)
                    {
                        continue;
                    }
                    _warrior.UpdateGroup(_clients);
                    if (await _warrior.Commands.Buffs.Rage())
                    {
                        continue;
                    }
                    if (await _warrior.Commands.Buffs.Fury())
                    {
                        continue;
                    }
                    if (await _warrior.Commands.Buffs.Backstab())
                    {
                        continue;
                    }
                    if (await _warrior.Commands.Buffs.Flank())
                    {
                        continue;
                    }
                    if (await _warrior.Commands.Buffs.Potence())
                    {
                        continue;
                    }
                    if (await _warrior.Commands.Buffs.Blessing())
                    {
                        continue;
                    }
                    if (await Whirlwind(85))
                    {
                        continue;
                    }
                    if (await Berserk(85))
                    {
                        continue;
                    }
                    if (await TauntNpcs())
                    {
                        continue;
                    }
                    if (await SpotTraps())
                    {
                        continue;
                    }
                    await Melee();
                }
                catch (Exception ex)
                {
                    TkTrainerFactory.Terminate(ex);
                }
            }

            Log.Information($"Shutting down Warrior trainer for {_warrior.Self.Name}...");
            _ahk.ExecRaw("Suspend");
            TkTrainerFactory.Terminate(_warrior);
        }