Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        public void ThreadMain()
        {
            while (true)
            {
                if (chkPauseWhenChat.Checked)
                {
                    UIFrame.Frame chatEditbox = UIFrame.GetFrameByName("ChatFrame1EditBox");
                    if (Keyboard.IsChatboxOpened && !isChatOpen && chatEditbox != null && chatEditbox.IsVisible && !Mailbox.IsMailboxOpen)
                    {
                        string currentState = API.Bot.Overrides.FiniteStateMachine.Engine.CurrentState;

                        string[] disableChatStates = new string[] { "Moving", "Combat", "Loot", "SkinAround", "Mount" };

                        if (API.Bot.Overrides.FiniteStateMachine.Engine.Running && disableChatStates.Contains(currentState))
                        {
                            // Pause
                            Log("Chatting - Pausing bot");
                            isChatOpen = true;
                            //MyWoW.Helpers.Movements.StopMove();
                            API.Bot.Stop();
                            Thread.Sleep(1000);
                        }
                    }
                    else if (!Keyboard.IsChatboxOpened && isChatOpen)
                    {
                        // unpause
                        Log("Done chatting - Resuming bot");
                        isChatOpen = false;
                        API.Bot.Start();
                        Thread.Sleep(1000);
                        if (!API.Bot.Overrides.FiniteStateMachine.Engine.Running)
                        {
                            API.Bot.Overrides.FiniteStateMachine.Engine.StartEngine();
                        }
                    }
                }
                Thread.Sleep(10);
            }
        }
Exemplo n.º 3
0
        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();
        }