/// <summary> /// Initializes settings and defines hotkeys. /// </summary>. public DemoBot() { TkBotFactory.Initialize(); _clients = new ActiveClients(TkBotFactory.ProcessName); //Log.Information("Got list of clients"); _client = _clients.GetRogue(); _client.Activity.DefaultCommandCooldown = TkBotFactory.CommandCooldown; _isBotRunning = new AutoHotkeyToggle("^F2", "isBotRunning", true); _isBotPaused = new AutoHotkeyToggle("F2", "isBotPaused", false); _shouldEsunaExternalGroupMembers = new AutoHotkeyToggle("F12", "shouldEsunaExternalGroupMembers", false); _shouldRing = new AutoHotkeyToggle("NumpadDiv", "shouldRing", false); _shouldGate = new AutoHotkeyToggle("^NumpadDiv", "shouldGate", false); _shouldReturn = new AutoHotkeyToggle("!NumpadDiv", "shouldReturn", false); var toggles = new[] { _isBotRunning, _isBotPaused, _shouldEsunaExternalGroupMembers, _shouldRing, _shouldGate, _shouldReturn }; var ahk = AutoHotkeyEngine.Instance; ahk.LoadToggles(toggles); ahk.LoadScript("NumpadAdd::Send {Ctrl down},{Ctrl up}"); }
/// <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 bot for {_client.Self.Name}..."); while (_isBotRunning.Value) { try { if (_isBotPaused.Value) { continue; } _client.UpdateGroup(_clients); if (await Return()) { continue; } if (await Gate()) { continue; } if (await Ring()) { continue; } MarkExternalGroupMembersForEsuna(); //if (await _client.Commands.Mana.Invoke(20)) continue; //if (await _client.Commands.Heal.RestoreGroupIfEligible()) continue; //if (await _client.Commands.Heal.HealGroupIfBelowVitaPercent(20)) continue; //if (await _client.Commands.Asv.SanctuaryGroup()) continue; //if (await _client.Commands.Debuffs.AtoneGroup()) continue; //if (await _client.Commands.Heal.HealGroupIfBelowVitaPercent(30)) continue; //if (await _client.Commands.Debuffs.RemoveCurseGroup()) continue; //if (await _client.Commands.Debuffs.CureParalysisGroup()) continue; //if (await _client.Commands.Debuffs.PurgeGroup()) continue; //if (await _client.Commands.Asv.HardenArmorGroup()) continue; //if (await _client.Commands.Debuffs.CurseNpcs()) continue; if (await _client.UpdateNpcs(_client.Spells.KeySpells.Heal)) { continue; } //if (await _client.Commands.Debuffs.RemoveVeilGroup()) continue; //if (await _client.Commands.Heal.HealGroupIfEligible()) continue; //if (await _client.Commands.Asv.ValorGroup()) continue; //if (await _client.Commands.Heal.HealGroupIfBelowVitaPercent(90)) continue; //if (await _client.Commands.Mana.InspireGroup(75)) continue; //await _client.Commands.HardenBody(); } catch (Exception ex) { TkBotFactory.LogException(ex); } } Log.Information($"Shutting down Poet bot for {_client.Self.Name}..."); TkBotFactory.Terminate(_client); }
public static async Task Main(string[] args) { try { var bot = new DemoBot(); await bot.AutoHunt(); } catch (Exception ex) { TkBotFactory.Terminate(ex); } }