Esempio n. 1
0
        private void MyPather()
        {
            GSpellTimer taskTimer         = new GSpellTimer(300);
            GSpellTimer updateStatusTimer = new GSpellTimer(2000);
            GSpellTimer nothingToDoTimer  = new GSpellTimer(3 * 1000);
            bool        exit = false;
            GSpellTimer Tick = new GSpellTimer(100);

            do
            {
                if (RunState != WantedState)
                {
                    RunState = WantedState;
                }

                if (updateStatusTimer.IsReady)
                {
                    UpdateXP();
                    updateStatusTimer.Reset();
                }
                if (RunState == RunState_e.Stopped)
                {
                    //Context.Log("Stop wanted. Stopping glide");
                    //Context.KillAction("PPather wants to stop", false);
                    Thread.Sleep(500); // pause
                }
                else if (RunState == RunState_e.Paused)
                {
                    UpdateMyPos();
                    Thread.Sleep(100); // pause
                }
                else if (RunState == RunState_e.Running)
                {
                    UpdateMyPos();
                    if (Me.IsDead)
                    {
                        Thread.Sleep(1000);
                        GhostRun();
                        Thread.Sleep(1500);
                        if (Me.IsDead)
                        {
                            //!!!
                        }
                        else
                        {
                            //Rest();
                        }
                    }

                    Tick.Wait();
                    Thread.Sleep(10); // min sleep time
                    Tick.Reset();
                }
            } while (!exit);
        }
Esempio n. 2
0
        void PushKeys()
        {
            if (old_runForwards != runForwards)
            {
                if (runForwards)
                {
                    BoogieCore.WorldServerClient.StartMoveForward();
                }
                else
                {
                    BoogieCore.WorldServerClient.StopMoveForward();
                }
                //Context.Log("Forwards: " + runForwards);
            }

            /*
             *
             *              if(runForwards)
             *              {
             *                  GContext.Main.StartRun(); //
             *              }
             *              else
             *              {
             *                  GContext.Main.ReleaseRun(); //
             *              }
             */
            if (old_runBackwards != runBackwards)
            {
                KeyT.Wait();
                KeyT.Reset();
                if (runBackwards)
                {
                    PressKey("Common.Back");
                }
                else
                {
                    ReleaseKey("Common.Back");
                }
                //Context.Log("Backwards: " + runBackwards);
            }
            if (old_strafeLeft != strafeLeft)
            {
                KeyT.Wait();
                KeyT.Reset();
                if (strafeLeft)
                {
                    PressKey("Common.StrafeLeft");
                }
                else
                {
                    ReleaseKey("Common.StrafeLeft");
                }
                //Context.Log("StrageLeft: " + strafeLeft);
            }
            if (old_strafeRight != strafeRight)
            {
                KeyT.Wait();
                KeyT.Reset();
                if (strafeRight)
                {
                    PressKey("Common.StrafeRight");
                }
                else
                {
                    ReleaseKey("Common.StrafeRight");
                }
                //Context.Log("StrageRight: " + strafeRight);
            }

            /*
             *              if(rotateRight || rotateLeft)
             *              {
             *                  double head = GContext.Main.Me.Heading;
             *                  if(rotateRight) head -= Math.PI/2;
             *                  else if(rotateLeft)  head += Math.PI/2;
             *                  GContext.Main.StartSpinTowards(head);
             *              }
             *              else
             *              {
             *                  GContext.Main.ReleaseSpin();
             *              }
             */

            if (old_rotateLeft != rotateLeft)
            {
                KeyT.Wait();
                KeyT.Reset();
                if (rotateLeft)
                {
                    PressKey("Common.RotateLeft");
                }
                else
                {
                    ReleaseKey("Common.RotateLeft");
                }
                //Context.Log("RotateLeft: " + rotateLeft);
            }
            if (old_rotateRight != rotateRight)
            {
                KeyT.Wait();
                KeyT.Reset();
                if (rotateRight)
                {
                    PressKey("Common.RotateRight");
                }
                else
                {
                    ReleaseKey("Common.RotateRight");
                }
                //Context.Log("RotateRight: " + rotateRight);
            }

            old_runForwards  = runForwards;
            old_runBackwards = runBackwards;
            old_strafeLeft   = strafeLeft;
            old_strafeRight  = strafeRight;
            old_rotateLeft   = rotateLeft;
            old_rotateRight  = rotateRight;
        }
Esempio n. 3
0
        private void MyPather()
        {
            GSpellTimer taskTimer = new GSpellTimer(300);
            GSpellTimer updateStatusTimer = new GSpellTimer(2000);
            GSpellTimer nothingToDoTimer = new GSpellTimer(3 * 1000);
            bool exit = false;
            GSpellTimer Tick = new GSpellTimer(100);
            do
            {
                if (RunState != WantedState)
                {
                    RunState = WantedState;
                }

                if (updateStatusTimer.IsReady)
                {
                    UpdateXP();
                    updateStatusTimer.Reset();
                }
                if (RunState == RunState_e.Stopped)
                {
                    //Context.Log("Stop wanted. Stopping glide");
                    //Context.KillAction("PPather wants to stop", false);
                    Thread.Sleep(500); // pause
                }
                else if (RunState == RunState_e.Paused)
                {
                    UpdateMyPos();
                    Thread.Sleep(100); // pause
                }
                else if (RunState == RunState_e.Running)
                {
                    UpdateMyPos();
                    if (Me.IsDead)
                    {
                        Thread.Sleep(1000);
                        GhostRun();
                        Thread.Sleep(1500);
                        if (Me.IsDead)
                        {
                            //!!!
                        }
                        else
                        {
                            //Rest();
                        }
                    }

                    Tick.Wait();
                    Thread.Sleep(10); // min sleep time
                    Tick.Reset();
                }
            } while (!exit);
        }