public MapWindow(AmeisenBot ameisenBot) { AmeisenBot = ameisenBot; MapTimer = new Timer(10); MapTimer.Elapsed += MapTimer_Elapsed; MeBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FFFFFFFF")); EnemyBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FFFF5D6C")); FriendBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FF8CBA51")); NeutralBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FFFFE277")); DefaultEntityBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FFB4F2E1")); DungeonNodeBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FF808080")); DungeonNodePen = new Pen((Color) new ColorConverter().ConvertFromString("#FFFFFFFF"), 1); PathNodeBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FF00FFFF")); PathNodePen = new Pen((Color) new ColorConverter().ConvertFromString("#FFE0FFFF"), 1); BlacklistNodeBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FFFF0000")); BlacklistNodePen = new Pen((Color) new ColorConverter().ConvertFromString("#FFFF0000"), 1); TextBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FFFFFFFF")); TextFont = new Font("Bahnschrift Light", 6, System.Drawing.FontStyle.Regular); AmeisenBot.WowInterface.ObjectManager.OnObjectUpdateComplete += (List <WowObject> wowObjects) => { NeedToUpdateMap = true; }; InitializeComponent(); }
public ManagedAmeisenBot(WowProcess wowProcess, WowAccount wowAccount, AmeisenBot ameisenBot) { WowProcess = wowProcess; WowAccount = wowAccount; AmeisenBot = ameisenBot; StartState = BotStartState.None; }
public MapWindow(AmeisenBot ameisenBot) { AmeisenBot = ameisenBot; MapTimer = new(250, MapTimerTick); MeBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FFFFFFFF")); EnemyBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FFFF5D6C")); DeadBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FFACACAC")); FriendBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FF8CBA51")); NeutralBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FFFFE277")); DefaultEntityBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FFB4F2E1")); DungeonNodeBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FF808080")); DungeonNodePen = new((Color) new ColorConverter().ConvertFromString("#FFFFFFFF"), 1); PathNodeBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FF00FFFF")); PathNodePen = new((Color) new ColorConverter().ConvertFromString("#FFE0FFFF"), 1); BlacklistNodeBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FFFF0000")); BlacklistNodePen = new((Color) new ColorConverter().ConvertFromString("#FFFF0000"), 1); TextBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FFFFFFFF")); TextFont = new("Bahnschrift Light", 6, System.Drawing.FontStyle.Regular); SubTextBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#DCDCDC")); SubTextFont = new("Bahnschrift Light", 5, System.Drawing.FontStyle.Regular); OreBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FF6F4E37")); HerbBrush = new SolidBrush((Color) new ColorConverter().ConvertFromString("#FF7BB661")); AmeisenBot.Bot.Objects.OnObjectUpdateComplete += (IEnumerable <IWowObject> wowObjects) => { NeedToUpdateMap = true; }; InitializeComponent(); }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { SaveBotWindowPosition(); KeyboardHook.Disable(); Overlay?.Exit(); AmeisenBot?.Dispose(); InfoWindow?.Close(); MapWindow?.Close(); DevToolsWindow?.Close(); RelationshipWindow?.Close(); if (StateConfigWindows != null) { foreach (Window window in StateConfigWindows.Values) { window.Close(); } } SaveConfig(); AmeisenLogger.I.Stop(); }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { AmeisenBot?.Stop(); Overlay?.Exit(); InfoWindow?.Close(); MapWindow?.Close(); SaveConfig(); }
public void IsMeSupposedToFollowTest() { AmeisenBot ameisenBot = new AmeisenBot(null, new TestWowDataAdapter(), null, null); AmeisenBotStateMachine stateMachine = new AmeisenBotStateMachine(ameisenBot.WowDataAdapter, null, null, null, null); WowUnit unitToFollow = stateMachine.FindUnitToFollow(); Assert.IsTrue(stateMachine.IsMeSupposedToFollow(unitToFollow)); }
public BotView(AmeisenBot ameisenBot, Settings settings, AttachBotFunction attachBotFunction) { AmeisenBot = ameisenBot; Settings = settings; AttachBotFunc = attachBotFunction; InitializeComponent(); UpdateView(); }
private void ButtonConfig_Click(object sender, RoutedEventArgs e) { ConfigEditorWindow configWindow = new ConfigEditorWindow(DataPath, AmeisenBot, Config, Path.GetFileName(Path.GetDirectoryName(ConfigPath))); configWindow.ShowDialog(); if (configWindow.SaveConfig) { AmeisenBot.Config = configWindow.Config; AmeisenBot.ReloadConfig(); File.WriteAllText(ConfigPath, JsonConvert.SerializeObject(configWindow.Config, Formatting.Indented)); } }
private void ButtonStateConfig_Click(object sender, RoutedEventArgs e) { if (StateConfigWindows.ContainsKey((BotMode)comboboxStateOverride.SelectedItem)) { Window selectedWindow = StateConfigWindows[(BotMode)comboboxStateOverride.SelectedItem]; selectedWindow.ShowDialog(); if (((IStateConfigWindow)selectedWindow).ShouldSave) { AmeisenBot.ReloadConfig(((IStateConfigWindow)selectedWindow).Config); SaveConfig(); } } }
private void ButtonConfig_Click(object sender, RoutedEventArgs e) { ConfigEditorWindow configWindow = new(DataPath, AmeisenBot, AmeisenBot.Config, AmeisenBot.AccountName); configWindow.ShowDialog(); if (configWindow.SaveConfig) { AmeisenBot.ReloadConfig(configWindow.Config); File.WriteAllText(AmeisenBot.Config.Path, JsonSerializer.Serialize(configWindow.Config, new() { WriteIndented = true })); KeyboardHook.Clear(); LoadHotkeys(); } }
private void ButtonStartPause_Click(object sender, RoutedEventArgs e) { if (AmeisenBot.IsRunning) { AmeisenBot.Pause(); buttonStartPause.Content = "â–¶"; buttonStartPause.Foreground = TextAccentBrush; } else { AmeisenBot.Resume(); buttonStartPause.Content = "||"; buttonStartPause.Foreground = DarkForegroundBrush; } }
private void StartPause() { if (AmeisenBot.IsRunning) { AmeisenBot.Pause(); buttonStartPause.Content = "â–¶"; buttonStartPause.Foreground = TextAccentBrush; } else { AmeisenBot.Resume(); buttonStartPause.Content = "||"; buttonStartPause.Foreground = DarkForegroundBrush; } }
public ConfigEditorWindow(string dataDir, AmeisenBot ameisenBot, AmeisenBotConfig initialConfig = null, string initialConfigName = "") { InitializeComponent(); DataDir = dataDir; NewConfig = initialConfig == null; Config = initialConfig ?? new AmeisenBotConfig(); AmeisenBot = ameisenBot; ConfigName = initialConfigName; SaveConfig = NewConfig; normalBorderBrush = new SolidColorBrush((Color)FindResource("DarkBorder")); errorBorderBrush = new SolidColorBrush((Color)FindResource("DarkError")); }
private void Window_Loaded(object sender, RoutedEventArgs e) { // Init GUI stuff // -------------- > InteropHelper = new WindowInteropHelper(this); PresentationSource presentationSource = PresentationSource.FromVisual(this); M11 = presentationSource.CompositionTarget.TransformToDevice.M11; M22 = presentationSource.CompositionTarget.TransformToDevice.M22; comboboxStateOverride.Items.Add(BotState.Idle); comboboxStateOverride.Items.Add(BotState.Attacking); comboboxStateOverride.Items.Add(BotState.Grinding); comboboxStateOverride.Items.Add(BotState.Job); comboboxStateOverride.Items.Add(BotState.Questing); comboboxStateOverride.SelectedIndex = 0; labelPID.Content = $"PID: {Environment.ProcessId}"; if (Config.Autopilot) { buttonToggleAutopilot.Foreground = CurrentTickTimeGoodBrush; } if (!Directory.Exists(DataPath)) { Directory.CreateDirectory(DataPath); } // Init the bot // ------------ > AmeisenBot = new AmeisenBot(DataPath, Path.GetFileName(Path.GetDirectoryName(ConfigPath)), Config, InteropHelper.EnsureHandle()); AmeisenBot.WowInterface.ObjectManager.OnObjectUpdateComplete += OnObjectUpdateComplete; AmeisenBot.StateMachine.OnStateMachineStateChanged += OnStateMachineStateChange; AmeisenBot.StateMachine.GetState <StateStartWow>().OnWoWStarted += MainWindow_OnWoWStarted; StateConfigWindows = new Dictionary <BotState, Window>() { { BotState.Grinding, new StateGrindingConfigWindow(AmeisenBot, AmeisenBot.Config) }, { BotState.Job, new StateJobConfigWindow(AmeisenBot, AmeisenBot.Config) }, { BotState.Questing, new StateQuestingConfigWindow(AmeisenBot, AmeisenBot.Config) }, }; AmeisenBot.Start(); }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { AmeisenBot?.Stop(); Overlay?.Exit(); InfoWindow?.Close(); MapWindow?.Close(); DevToolsWindow?.Close(); if (StateConfigWindows != null) { foreach (Window window in StateConfigWindows.Values) { window.Close(); } } SaveConfig(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { labelPID.Content = $"PID: {Process.GetCurrentProcess().Id}"; if (Config != null) { string playername = Path.GetFileName(Path.GetDirectoryName(ConfigPath)); AmeisenBot = new AmeisenBot(BotDataPath, playername, Config, Process.GetCurrentProcess().MainWindowHandle); AmeisenBot.WowInterface.ObjectManager.OnObjectUpdateComplete += OnObjectUpdateComplete; AmeisenBot.StateMachine.OnStateMachineStateChanged += OnStateMachineStateChange; LastStateMachineTickUpdate = DateTime.Now; } if (AmeisenBot != null) { AmeisenBot.Start(); } }
public MainWindow() { InitializeComponent(); Config = LoadConfig(); darkForegroundBrush = new SolidColorBrush((Color)FindResource("DarkForeground")); textAccentBrush = new SolidColorBrush((Color)FindResource("TextAccent")); if (Config != null) { string playername = Path.GetFileName(Path.GetDirectoryName(ConfigPath)); AmeisenBot = new AmeisenBot(BotDataPath, playername, Config); AmeisenBot.WowInterface.ObjectManager.OnObjectUpdateComplete += OnObjectUpdateComplete; AmeisenBot.StateMachine.OnStateMachineStateChanged += OnStateMachineStateChange; LastStateMachineTickUpdate = DateTime.Now; } }
public void AmeisenBotStateMachineTest() { IWowDataAdapter wowDataAdapter = new TestWowDataAdapter(); IWowActionExecutor wowActionExecutor = new TestWowActionExecutor(); AmeisenBot ameisenBot = new AmeisenBot(null, wowDataAdapter, null, null); ameisenBot.Attach(wowActionExecutor, null, null, new BasicMeleeMovementProvider(), null); AmeisenBotStateMachine stateMachine = new AmeisenBotStateMachine(ameisenBot.WowDataAdapter, ameisenBot.WowActionExecutor, null, null, null); Assert.IsTrue(stateMachine.CurrentState is BotStateIdle); stateMachine.SwitchState(typeof(BotStateFollow)); Assert.IsTrue(stateMachine.CurrentState is BotStateFollow); Assert.AreEqual("You suck", wowDataAdapter.LastErrorMessage); wowDataAdapter.StartObjectUpdates(); wowDataAdapter.StopObjectUpdates(); }
private void SetupNewAmeisenBot(WowAccount account, WowProcess wowProcess) { WowAccounts[account] = BotStartState.BotIsAttaching; TrashMem trashMem = new TrashMem(wowProcess.Process); MemoryWowDataAdapter memoryWowDataAdapter = new MemoryWowDataAdapter(trashMem, OffsetList); MemoryWowActionExecutor memoryWowActionExecutioner = new MemoryWowActionExecutor(trashMem, OffsetList); AmeisenNavPathfindingClient ameisenNavPathfindingClient = new AmeisenNavPathfindingClient(Settings.AmeisenNavmeshServerIp, Settings.AmeisenNavmeshServerPort, wowProcess.Process.Id); LuaHookWowEventAdapter luaHookWowEventAdapter = new LuaHookWowEventAdapter(memoryWowActionExecutioner); BasicMeleeMovementProvider basicMeleeMovementProvider = new BasicMeleeMovementProvider(); SimpleAutologinProvider simpleAutologinProvider = new SimpleAutologinProvider(); AmeisenBot ameisenBot = new AmeisenBot(trashMem, memoryWowDataAdapter, simpleAutologinProvider, wowProcess.Process); ManagedAmeisenBot managedAmeisenBot = new ManagedAmeisenBot(wowProcess, account, ameisenBot); if (ameisenBot.AutologinProvider.DoLogin(wowProcess.Process, account, OffsetList)) { ameisenBot.Attach(memoryWowActionExecutioner, ameisenNavPathfindingClient, luaHookWowEventAdapter, basicMeleeMovementProvider, null); if (Settings.WowPositions.ContainsKey(account.CharacterName)) { ameisenBot.SetWindowPosition(Settings.WowPositions[account.CharacterName]); } ManagedAmeisenBots.Add(managedAmeisenBot); IAmeisenBotViews.OfType <WowView>().ToList().RemoveAll(v => v.WowProcess.Process.Id == managedAmeisenBot.WowProcess.Process.Id); WowAccounts[account] = BotStartState.BotIsAttached; } else { // we failed to login, restart wow... if (!wowProcess.Process.HasExited) { wowProcess.Process.Kill(); } WowAccounts[account] = BotStartState.None; } }
public StateGrindingConfigWindow(AmeisenBot ameisenBot, AmeisenBotConfig config) { AmeisenBot = ameisenBot; Config = config; InitializeComponent(); }
public RelationshipWindow(AmeisenBot ameisenBot) { AmeisenBot = ameisenBot; InitializeComponent(); }
public DevToolsWindow(AmeisenBot ameisenBot) { AmeisenBot = ameisenBot; InitializeComponent(); }
public void Setup() { TestWowDataAdapter dataAdapter = new TestWowDataAdapter(); ameisenBot = new AmeisenBot(null, dataAdapter, null, null); }
private void Window_Loaded(object sender, RoutedEventArgs e) { // obtain a window handle (HWND) to out current WPF window MainWindowHandle = new WindowInteropHelper(this).EnsureHandle(); comboboxStateOverride.Items.Add(BotMode.None); comboboxStateOverride.Items.Add(BotMode.Grinding); comboboxStateOverride.Items.Add(BotMode.Jobs); comboboxStateOverride.Items.Add(BotMode.PvP); comboboxStateOverride.Items.Add(BotMode.Questing); comboboxStateOverride.Items.Add(BotMode.Testing); comboboxStateOverride.SelectedIndex = 0; // display the PID, maybe remove this when not debugging labelPID.Content = $"PID: {Environment.ProcessId}"; if (TryLoadConfig(ConfigPath, out AmeisenBotConfig config)) { AmeisenBot = new(config); // capture whisper messages and display them in the bots ui as a flashing button AmeisenBot.Bot.Wow.Events?.Subscribe("CHAT_MSG_WHISPER", OnWhisper); // events used to update our GUI AmeisenBot.Bot.Objects.OnObjectUpdateComplete += OnObjectUpdateComplete; // handle the autoposition function where the wow window gets "absorbed" by the bots window if (AmeisenBot.Config.AutoPositionWow) { // this is used to measure the size of wow's window PresentationSource presentationSource = PresentationSource.FromVisual(this); M11 = presentationSource.CompositionTarget.TransformToDevice.M11; M22 = presentationSource.CompositionTarget.TransformToDevice.M22; AmeisenBot.Logic.OnWoWStarted += () => { Dispatcher.Invoke(() => { AmeisenBot.Bot.Memory.SetupAutoPosition ( MainWindowHandle, (int)((wowRect.Margin.Left + 1) * M11), (int)((wowRect.Margin.Top + 1) * M22), (int)((wowRect.ActualWidth - 1) * M11), (int)((wowRect.ActualHeight - 1) * M22) ); }); IsAutoPositionSetup = true; }; } AmeisenLogger.I.Log("AmeisenBot", "Loading Hotkeys", LogLevel.Verbose); LoadHotkeys(); AmeisenBot.Start(); StateConfigWindows = new() { { BotMode.Jobs, new StateJobConfigWindow(AmeisenBot, AmeisenBot.Config) }, { BotMode.Grinding, new StateGrindingConfigWindow(AmeisenBot, AmeisenBot.Config) },
public void AmeisenBotSetup() { TestWowDataAdapter adapter = new TestWowDataAdapter(); AmeisenBot bot = new AmeisenBot(null, adapter, null, null); }
private void AttachAmeisenBot(AmeisenBot ameisenBot) { }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { AmeisenBot?.Stop(); SaveConfig(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { AmeisenBot.Start(); }
public InfoWindow(AmeisenBot ameisenBot) { AmeisenBot = ameisenBot; CurrentDisplayMode = DisplayMode.Equipment; InitializeComponent(); }