void Logout() { isLogginOut = true; isLoggedOut = true; API.Bot.Overrides.FiniteStateMachine.Engine.StopEngine(); logoutTick = Environment.TickCount; UIFrame.Update(); UIFrame.Frame GameMenuFrame = UIFrame.GetFrameByName("GameMenuFrame"); while (!GameMenuFrame.IsVisible) { MyWoW.Helpers.Keybindings.UseBinding("TOGGLEGAMEMENU"); Thread.Sleep(1000); UIFrame.Update(); } UIFrame.Frame GameMenuButtonLogout = UIFrame.GetFrameByName("GameMenuButtonLogout"); GameMenuButtonLogout.LeftClick(); lblStartingBot.Text = "Logging out..."; lblStartingBot.Visible = true; btnStartBotNow.Visible = true; }
public void ThreadDisassemble() { while (isRunning && itemsLeft > 0) { // Make sure we're on the right action bar if (ActionBar.CurrentActionBar != disassembleSpell.GetActionBarAction.Bar) { ActionBar.ChangeActionBar(disassembleSpell.GetActionBarAction.Bar); Thread.Sleep(1000); } disassembleSpell.GetActionBarAction.Push(); Thread.Sleep(500); bool success = InventoryExt.UseItemByIdExt(disassembleItem.ItemId); if (success) { itemsLeft--; } else { isRunning = false; Log("Unable to disassemble, maybe someone closed the bag"); } txtItems.Text = itemsLeft.ToString(); Log(disassembleItem.ToString() + ": " + itemsLeft.ToString() + " left"); while (ObjectManager.Me.IsCasting && isRunning) { Thread.Sleep(100); } UIFrame.Update(); UIFrame.Frame frame = UIFrame.GetFrameByName("LootFrame"); while (!frame.IsVisible && isRunning) { //Log("Waiting for loot window to open"); Thread.Sleep(100); UIFrame.Update(); frame = UIFrame.GetFrameByName("LootFrame"); } while (frame.IsVisible && isRunning) { //Log("Waiting for loot window to close"); Thread.Sleep(100); UIFrame.Update(); frame = UIFrame.GetFrameByName("LootFrame"); } Thread.Sleep(100); } Log("All done!"); btnStart.Text = "Start"; isRunning = false; thread = null; RefreshActions(); }