private void ButtonGoAuto_Click(object sender, RoutedEventArgs e) { Credentials credentials; WowExe activeExe = ((WowExe)comboBoxWoWs.SelectedItem); if (activeExe != null && autologinIsPossible && activeExe.characterName == "") { if (!Directory.Exists(configPath)) { Directory.CreateDirectory(configPath); } string path = configPath + textboxCharactername.Text.ToLower() + extension; credentials.charname = textboxCharactername.Text; credentials.username = textboxUsername.Text; credentials.password = textboxPassword.Password; credentials.charSlot = Convert.ToInt32(textboxCharSlot.Text); if (checkboxSave.IsChecked == true) { File.WriteAllText(path, Newtonsoft.Json.JsonConvert.SerializeObject(credentials)); } string charname = textboxCharactername.Text; LoginAutomator.DoLogin(((WowExe)comboBoxWoWs.SelectedItem).process.Id, credentials.charSlot, credentials.username, credentials.password); ((WowExe)comboBoxWoWs.SelectedItem).characterName = charname; ButtonGo_Click(this, null); } }
private void ButtonGoAuto_Click(object sender, RoutedEventArgs e) { Credentials credentials; WowExe activeExe = ((WowExe)comboBoxWoWs.SelectedItem); if (textboxUsername.Text.Length == 0 || textboxPassword.Password.Length == 0) { MessageBox.Show("Please select an account or enter credentials to use auto-login", "Error"); return; } if (activeExe == null) { // launch new wow ButtonLaunchWow_Click(null, null); } if (activeExe != null && autologinIsPossible && activeExe.characterName == "not logged in") { if (!Directory.Exists(configPath)) { Directory.CreateDirectory(configPath); } string path = configPath + textboxCharactername.Text.ToLower() + extension; credentials.charname = textboxCharactername.Text; credentials.username = textboxUsername.Text; credentials.password = textboxPassword.Password; credentials.charSlot = Convert.ToInt32(textboxCharSlot.Text); if (checkboxSave.IsChecked == true) { File.WriteAllText(path, Newtonsoft.Json.JsonConvert.SerializeObject(credentials)); } string charname = textboxCharactername.Text; LoginAutomator.DoLogin(((WowExe)comboBoxWoWs.SelectedItem).process.Id, credentials.charSlot, credentials.username, credentials.password); ((WowExe)comboBoxWoWs.SelectedItem).characterName = charname; ButtonGo_Click(this, null); } else { MessageBox.Show("Please select a wow process or set the executeable path to auto-start it", "Error"); } }
/// <summary> /// Returns the running WoW's in a WoWExe List containing the logged in playername and /// Process object. /// </summary> /// <returns>A list containing all the runnign WoW processes</returns> public static List <WowExe> GetRunningWows() { List <WowExe> wows = new List <WowExe>(); List <Process> processList = new List <Process>(Process.GetProcessesByName("Wow")); foreach (Process p in processList) { AmeisenLogger.Instance.Log(LogLevel.DEBUG, $"Found WoW Process! PID: {p.Id}", "AmeisenCore"); WowExe wow = new WowExe(); BlackMagic blackmagic = new BlackMagic(p.Id); wow.characterName = blackmagic.ReadASCIIString(Offsets.playerName, 12); wow.process = p; wows.Add(wow); blackmagic.Close(); } return(wows); }
public BotWindow(WowExe wowExe, BotManager botManager) { InitializeComponent(); BotManager = botManager; // Load Settings BotManager.LoadSettingsFromFile(wowExe.characterName); ApplyConfigColors(); BotManager.StartBot(wowExe); if (BotManager.Settings.saveBotWindowPosition) { if (BotManager.Settings.oldXindowPosX != 0) { Left = BotManager.Settings.oldXindowPosX; } if (BotManager.Settings.oldXindowPosY != 0) { Top = BotManager.Settings.oldXindowPosY; } } }
/// <summary> /// Starts the bots mechanisms, hooks, ... /// </summary> /// <param name="wowExe">WowExe to start the bot on</param> public void StartBot(WowExe wowExe) { WowExe = wowExe; // Load Settings AmeisenSettings.LoadFromFile(wowExe.characterName); // Load old WoW Position if (AmeisenSettings.Settings.saveBotWindowPosition) { if (AmeisenSettings.Settings.wowRectL != 0 && AmeisenSettings.Settings.wowRectR != 0 && AmeisenSettings.Settings.wowRectT != 0 && AmeisenSettings.Settings.wowRectB != 0) { AmeisenCore.SetWindowPosition( wowExe.process.MainWindowHandle, (int)AmeisenSettings.Settings.wowRectL, (int)AmeisenSettings.Settings.wowRectT, (int)AmeisenSettings.Settings.wowRectB - (int)AmeisenSettings.Settings.wowRectT, (int)AmeisenSettings.Settings.wowRectR - (int)AmeisenSettings.Settings.wowRectL); } } // Connect to DB if (AmeisenSettings.Settings.databaseAutoConnect) { AmeisenDBManager.ConnectToMySQL( string.Format(sqlConnectionString, AmeisenSettings.Settings.databaseIP, AmeisenSettings.Settings.databasePort, AmeisenSettings.Settings.databaseName, AmeisenSettings.Settings.databaseUsername, AmeisenSettings.Settings.databasePasswort) ); } // Attach to Proccess Blackmagic = new BlackMagic(wowExe.process.Id); IsBlackmagicAttached = Blackmagic.IsProcessOpen; // TODO: make this non static AmeisenCore.BlackMagic = Blackmagic; // Hook EndScene AmeisenHook = new AmeisenHook(Blackmagic); IsEndsceneHooked = AmeisenHook.isHooked; // TODO: make this non static AmeisenCore.AmeisenHook = AmeisenHook; // Hook Events /*AmeisenEventHook = new AmeisenEventHook(); * AmeisenEventHook.Init(); * AmeisenEventHook.Subscribe("UI_ERROR_MESSAGE");*/ // Start our object updates AmeisenObjectManager = new AmeisenObjectManager(AmeisenDataHolder, AmeisenDBManager); AmeisenObjectManager.Start(); // Load the combatclass IAmeisenCombatClass combatClass = CompileAndLoadCombatClass(AmeisenSettings.Settings.combatClassPath); // Init our MovementEngine to hposition ourself according to our formation AmeisenMovementEngine = new AmeisenMovementEngine(new DefaultFormation()) { MemberCount = 40 }; // Start the StateMachine AmeisenStateMachineManager = new AmeisenStateMachineManager( AmeisenDataHolder, AmeisenDBManager, AmeisenMovementEngine, combatClass); // Deafult Idle state AmeisenStateMachineManager.StateMachine.PushAction(BotState.Idle); AmeisenStateMachineManager.Start(); // Connect to Server if (Settings.serverAutoConnect) { AmeisenClient.Register( Me, IPAddress.Parse(AmeisenSettings.Settings.ameisenServerIP), AmeisenSettings.Settings.ameisenServerPort); } }
/// <summary> /// Starts the bots mechanisms, hooks, ... /// </summary> /// <param name="wowExe">WowExe to start the bot on</param> public void StartBot(WowExe wowExe) { AmeisenLogger.Instance.currentUsername = wowExe.characterName; AmeisenLogger.Instance.RefreshLogName(); WowExe = wowExe; LootableUnits = new Queue <Unit>(); // Load Settings AmeisenSettings.LoadFromFile(wowExe.characterName); // Load old WoW Position if (AmeisenSettings.Settings.saveBotWindowPosition) { if (AmeisenSettings.Settings.wowRectL > 0 && AmeisenSettings.Settings.wowRectR > 0 && AmeisenSettings.Settings.wowRectT > 0 && AmeisenSettings.Settings.wowRectB > 0) { AmeisenCore.SetWindowPosition( wowExe.process.MainWindowHandle, (int)AmeisenSettings.Settings.wowRectL, (int)AmeisenSettings.Settings.wowRectT, (int)AmeisenSettings.Settings.wowRectB - (int)AmeisenSettings.Settings.wowRectT, (int)AmeisenSettings.Settings.wowRectR - (int)AmeisenSettings.Settings.wowRectL); } } // Connect to DB if (AmeisenSettings.Settings.databaseAutoConnect) { ConnectToDB(); } // Connect to NavmeshServer if (AmeisenSettings.Settings.navigationServerAutoConnect) { AmeisenNavmeshClient = new AmeisenNavmeshClient( AmeisenSettings.Settings.navigationServerIp, AmeisenSettings.Settings.navigationServerPort ); } // Attach to Proccess Blackmagic = new BlackMagic(wowExe.process.Id); IsBlackmagicAttached = Blackmagic.IsProcessOpen; // TODO: make this non static AmeisenCore.BlackMagic = Blackmagic; // Hook EndScene AmeisenHook = new AmeisenHook(Blackmagic); IsEndsceneHooked = AmeisenHook.isHooked; // TODO: make this non static AmeisenCore.AmeisenHook = AmeisenHook; // Unlimit fps to speed up loading, we will limit them later again AmeisenCore.RunSlashCommand($"/console maxfps 30"); AmeisenCore.RunSlashCommand($"/console maxfpsbk 30"); // Init our CharacterMangager to keep track of our stats/items/money AmeisenCharacterManager = new AmeisenCharacterManager(); AmeisenCharacterManager.UpdateCharacterAsync(); // Hook Events AmeisenEventHook = new AmeisenEventHook(); AmeisenEventHook.Init(); AmeisenEventHook.Subscribe(WowEvents.PLAYER_ENTERING_WORLD, OnPlayerEnteringWorld); AmeisenEventHook.Subscribe(WowEvents.LOOT_OPENED, OnLootWindowOpened); AmeisenEventHook.Subscribe(WowEvents.LOOT_BIND_CONFIRM, OnLootBindOnPickup); AmeisenEventHook.Subscribe(WowEvents.READY_CHECK, OnReadyCheck); AmeisenEventHook.Subscribe(WowEvents.PARTY_INVITE_REQUEST, OnPartyInvitation); AmeisenEventHook.Subscribe(WowEvents.CONFIRM_SUMMON, OnSummonRequest); AmeisenEventHook.Subscribe(WowEvents.RESURRECT_REQUEST, OnResurrectRequest); AmeisenEventHook.Subscribe(WowEvents.PLAYER_REGEN_DISABLED, OnRegenDisabled); AmeisenEventHook.Subscribe(WowEvents.PLAYER_REGEN_ENABLED, OnRegenEnabled); AmeisenEventHook.Subscribe(WowEvents.START_LOOT_ROLL, OnStartLootRoll); AmeisenEventHook.Subscribe(WowEvents.ITEM_PUSH, OnNewItem); AmeisenEventHook.Subscribe(WowEvents.PARTY_MEMBERS_CHANGED, OnGroupChanged); //AmeisenEventHook.Subscribe(WowEvents.COMBAT_LOG_EVENT_UNFILTERED, OnCombatLogEvent); // LoadingscreenChecker, stops our hook if we are in loadingscreens IsLoadingScreenCheckerActive = true; LoadingScreenCheckerThread = new Thread(new ThreadStart(LoadingScreenChecker)); LoadingScreenCheckerThread.Start(); // Start our object updates AmeisenObjectManager = new AmeisenObjectManager(AmeisenDataHolder, AmeisenDBManager); AmeisenObjectManager.Start(); // Load the combatclass // CombatClass = CompileAndLoadCombatClass(AmeisenSettings.Settings.combatClassPath); if (CombatPackage == null) { CombatPackage = LoadDefaultClassForSpec(); } // Init our MovementEngine to position ourself according to our formation AmeisenMovementEngine = new AmeisenMovementEngine(new DefaultFormation()) { MemberCount = 40 }; // Start the StateMachine AmeisenStateMachineManager = new AmeisenStateMachineManager( AmeisenDataHolder, AmeisenDBManager, AmeisenMovementEngine, CombatPackage, AmeisenCharacterManager, AmeisenNavmeshClient); // Deafult Idle state AmeisenStateMachineManager.StateMachine.PushAction(BotState.Idle); AmeisenStateMachineManager.Start(); // Connect to Server if (Settings.serverAutoConnect) { ConnectToServer(); } // Ultralow Gfx if (Settings.autoUltralowGfx) { AmeisenCore.RunSlashCommand("/console farclip 350"); AmeisenCore.RunSlashCommand("/console groundEffectDensity 0"); AmeisenCore.RunSlashCommand("/console groundEffectDistance 0"); AmeisenCore.RunSlashCommand("/console environmentDetail 0"); AmeisenCore.RunSlashCommand("/console particleDensity 10"); AmeisenCore.RunSlashCommand("/console shadowMode 0"); AmeisenCore.RunSlashCommand("/console waterDetail 0"); AmeisenCore.RunSlashCommand("/console reflectionMode 0"); AmeisenCore.RunSlashCommand("/console sunShafts 0"); AmeisenCore.RunSlashCommand("/console basemip 1"); AmeisenCore.RunSlashCommand("/console terrainMipLevel 1"); AmeisenCore.RunSlashCommand("/console projectedTextures 0"); AmeisenCore.RunSlashCommand("/console weatherDensity 0"); AmeisenCore.RunSlashCommand("/console componentTextureLevel 0"); AmeisenCore.RunSlashCommand("/console textureFilteringMode 0"); } // Limit fps AmeisenCore.RunSlashCommand($"/console maxfps {Settings.maxFpsForeground}"); AmeisenCore.RunSlashCommand($"/console maxfpsbk {Settings.maxFpsBackground}"); }