Beispiel #1
0
        public PoetTrainer(PoetConfiguration config)
        {
            TkTrainerFactory.Initialize(TkClient.BasePath.Poet.ToString());

            _clients = new ActiveClients(config.Process);

            _poet = string.IsNullOrWhiteSpace(config.Name)
                ? _clients.GetPoet()
                : _clients.GetPoet(config.Name);

            _poet.Activity.DefaultCommandCooldown = config.CommandDelay;

            Log.Debug($"Key item assignments:\n{_poet.Inventory.KeyItems}\n");
            Log.Debug($"Key spell assignments:\n{_poet.Spells.KeySpells}\n");

            _isRunning        = new AutoHotkeyToggle("^F2", "isRunning", true);
            _isPaused         = new AutoHotkeySuspendToggle("F2", "isPaused", false);
            _shouldHardenBody = new AutoHotkeyToggle("F5", "shouldHardenBody", config.HardenBody.Value);
            _resetCurses      = new AutoHotkeyToggle("F12", "resetCurses", false);
            _shouldEsunaExternalGroupMembers = new AutoHotkeyToggle("^F12", "shouldEsunaExternalGroupMembers", false);

            var toggles = new[]
            {
                _isRunning,
                _isPaused,
                _shouldHardenBody,
                _resetCurses,
                _shouldEsunaExternalGroupMembers
            };

            _ahk = AutoHotkeyEngine.Instance;
            _ahk.LoadToggles(toggles);
        }
        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);
                }
            }
        }
Beispiel #3
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);
         }
     });
 }
        public AutoFollowTrainer(AutoFollowConfiguration config)
        {
            _config = config;

            TkTrainerFactory.Initialize("AutoFollow");

            _isRunning = new AutoHotkeyToggle("ScrollLock", "isRunning", true);
            _isPaused  = new AutoHotkeyToggle("Pause", "isPaused", false);

            var toggles = new[]
            {
                _isRunning,
                _isPaused
            };

            AutoHotkeyEngine.Instance.LoadToggles(toggles);
        }
Beispiel #5
0
        public MageTrainer(MageConfiguration config)
        {
            TkTrainerFactory.Initialize(TkClient.BasePath.Mage.ToString());

            _clients = new ActiveClients(config.Process);

            _mage = string.IsNullOrWhiteSpace(config.Name)
                ? _clients.GetMage()
                : _clients.GetMage(config.Name);

            _mage.Activity.DefaultCommandCooldown = config.CommandDelay;

            Log.Debug($"Key item assignments:\n{_mage.Inventory.KeyItems}\n");
            Log.Debug($"Key spell assignments:\n{_mage.Spells.KeySpells}\n");

            _isRunning = new AutoHotkeyToggle("^F1", "isRunning", true);
            _isPaused  = new AutoHotkeySuspendToggle("F1", "isPaused", false);
            _shouldEsunaExternalGroupMembers = new AutoHotkeyToggle("F11", "shouldEsunaExternalGroupMembers", false);
            _shouldHeal       = new AutoHotkeyToggle("`", "shouldHeal", config.Heal.Value);
            _shouldBlind      = new AutoHotkeyToggle("1", "shouldBlind", config.Blind.Value);
            _shouldParalyze   = new AutoHotkeyToggle("2", "shouldParalyze", config.Paralyze.Value);
            _shouldVenom      = new AutoHotkeyToggle("3", "shouldVenom", config.Venom.Value);
            _shouldVex        = new AutoHotkeyToggle("4", "shouldVex", config.Vex.Value);
            _shouldZap        = new AutoHotkeyToggle("5", "shouldZap", config.Zap.Value);
            _shouldUpdateNpcs = new AutoHotkeyToggle("6", "shouldUpdateNpcs", false);

            var toggles = new[]
            {
                _isRunning,
                _isPaused,
                _shouldEsunaExternalGroupMembers,
                _shouldHeal,
                _shouldBlind,
                _shouldParalyze,
                _shouldVenom,
                _shouldVex,
                _shouldZap,
                _shouldUpdateNpcs
            };

            _ahk = AutoHotkeyEngine.Instance;
            _ahk.LoadToggles(toggles);
        }
Beispiel #6
0
        public RogueTrainer(RogueConfiguration config)
        {
            TkTrainerFactory.Initialize(TkClient.BasePath.Rogue.ToString());

            _clients = new ActiveClients(config.Process);

            _rogue = string.IsNullOrWhiteSpace(config.Name)
                ? _clients.GetRogue()
                : _clients.GetRogue(config.Name);

            _rogue.Activity.DefaultCommandCooldown = config.CommandDelay;

            Log.Debug($"Key item assignments:\n{_rogue.Inventory.KeyItems}\n");
            Log.Debug($"Key spell assignments:\n{_rogue.Spells.KeySpells}\n");

            _shouldUpdateNpcs               = new AutoHotkeyBool("shouldUpdateNpcs", false);
            _isRunning                      = new AutoHotkeyToggle("^F3", "isRunning", true);
            _isPaused                       = new AutoHotkeySuspendToggle("F3", "isPaused", false);
            _shouldTaunt                    = new AutoHotkeyToggleWithPrerequisite("7", "shouldTaunt", false, _shouldUpdateNpcs);
            _shouldLethalStrikeOnAethers    = new AutoHotkeyToggle("8", "shouldLethalStrikeOnAethers", config.LethalStrike.Value);
            _shouldDesperateAttackOnAethers = new AutoHotkeyToggle("9", "shouldDesperateAttackOnAethers", config.DesperateAttack.Value);
            _shouldAutoMelee                = new AutoHotkeyToggle("0", "shouldAutoMelee", config.Attack.Value);
            _shouldAmbushOnMelee            = new AutoHotkeyToggle("-", "shouldAmbushOnMelee", config.Ambush.Value);

            var toggles = new[]
            {
                _isRunning,
                _isPaused,
                _shouldTaunt,
                _shouldLethalStrikeOnAethers,
                _shouldDesperateAttackOnAethers,
                _shouldAutoMelee,
                _shouldAmbushOnMelee
            };

            _ahk = AutoHotkeyEngine.Instance;
            _ahk.LoadToggles(toggles);
        }
        public WarriorTrainer(WarriorConfiguration config)
        {
            TkTrainerFactory.Initialize(TkClient.BasePath.Warrior.ToString());

            _clients = new ActiveClients(config.Process);

            _warrior = string.IsNullOrWhiteSpace(config.Name)
                ? _clients.GetWarrior()
                : _clients.GetWarrior(config.Name);

            _warrior.Activity.DefaultCommandCooldown = config.CommandDelay;

            Log.Debug($"Key item assignments:\n{_warrior.Inventory.KeyItems}\n");
            Log.Debug($"Key spell assignments:\n{_warrior.Spells.KeySpells}\n");

            _shouldUpdateNpcs         = new AutoHotkeyBool("shouldUpdateNpcs", false);
            _isRunning                = new AutoHotkeyToggle("^F4", "isRunning", true);
            _isPaused                 = new AutoHotkeySuspendToggle("F4", "isPaused", false);
            _shouldSpotTrapsOnAethers = new AutoHotkeyToggle("F6", "shouldSpotTrapsOnAethers", false);
            _shouldTaunt              = new AutoHotkeyToggleWithPrerequisite("F7", "shouldTaunt", false, _shouldUpdateNpcs);
            _shouldWhirlwindOnAethers = new AutoHotkeyToggle("F8", "shouldWhirlwindOnAethers", config.Whirlwind.Value);
            _shouldBerserkOnAethers   = new AutoHotkeyToggle("F9", "shouldBerserkOnAethers", config.Berserk.Value);
            _shouldAutoMelee          = new AutoHotkeyToggle("F10", "shouldAutoMelee", config.Attack.Value);

            var toggles = new[]
            {
                _isRunning,
                _isPaused,
                _shouldTaunt,
                _shouldWhirlwindOnAethers,
                _shouldBerserkOnAethers,
                _shouldAutoMelee,
                _shouldSpotTrapsOnAethers
            };

            _ahk = AutoHotkeyEngine.Instance;
            _ahk.LoadToggles(toggles);
        }
Beispiel #8
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);
        }
Beispiel #9
0
        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);
        }
Beispiel #10
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);
        }
Beispiel #11
0
        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);
        }