コード例 #1
0
        public static void ReforgeItem()
        {
            // DISABLE MOUSE HOOKS TO PREVENT LAG
            HardwareListener.UnregisterMouseHooks();

            Coord    cubeFill     = coords["cube_fill"];
            Coord    cubeTransute = coords["cube_transmute"];
            Position cubeLeft     = SwitchPagesLeft;
            Position cubeRight    = SwitchPagesRight;

            InventoryIterator inventory = Player.Player.Inventory.Get1SlotIterator();
            Position          p         = inventory.GetNext();

            HardwareRobot.DoRightClick(p.x, p.y);
            Sleep(0);
            HardwareRobot.DoLeftClick(cubeFill);
            Sleep(0);
            HardwareRobot.DoLeftClick(cubeTransute);
            Sleep(40);
            HardwareRobot.DoLeftClick(cubeRight);
            Sleep(0);
            HardwareRobot.DoLeftClick(cubeLeft);
            Sleep(0);

            HardwareRobot.MovePhysicalCursor(p);

            // RE-ENABLE MOUSE HOOKS
            HardwareListener.RegisterMouseHooks();
        }
コード例 #2
0
        public static void DoCube1Space()
        {
            // DISABLE MOUSE HOOKS TO PREVENT LAG
            HardwareListener.UnregisterMouseHooks();

            Coord    cubeFill     = coords["cube_fill"];
            Coord    cubeTransute = coords["cube_transmute"];
            Position cubeLeft     = SwitchPagesLeft;
            Position cubeRight    = SwitchPagesRight;

            InventoryIterator inventory = Player.Player.Inventory.Get1SlotIterator();

            while (inventory.HasNext)
            {
                Position p = inventory.GetNext();
                HardwareRobot.DoRightClick(p);
                Sleep(0);
                HardwareRobot.DoLeftClick(cubeFill);
                Sleep(0);
                HardwareRobot.DoLeftClick(cubeTransute);
                Sleep(70);
                HardwareRobot.DoLeftClick(cubeRight);
                Sleep(0);
                HardwareRobot.DoLeftClick(cubeLeft);
                Sleep(0);
            }

            // RE-ENABLE MOUSE HOOKS
            HardwareListener.RegisterMouseHooks();
        }
コード例 #3
0
        public void DelegatesToTheHardwareToTurnLeft()
        {
            var room = NewMock <RoomStub>();

            new TurnLeftCommand(HardwareRobot, room).Execute();
            HardwareRobot.AssertWasCalled(robot => robot.TurnLeft());
            room.AssertWasCalled(r => r.TrackCleaning(HardwareRobot));
        }
コード例 #4
0
 private static void SalvageYellows()
 {
     if (ScreenTools.GetPixelColor(SalvageYellowPos.X, SalvageYellowPos.Y).Item1.Equals(SalvageYellowCol))
     {
         HardwareRobot.DoLeftClick(SalvageYellowPos.X, SalvageYellowPos.Y, HardwareRobot.ActionTypes.SIMULATE);
         Confirm();
     }
 }
コード例 #5
0
        public void DelegatesToTheHardwareToWalkAnTracksCleaningWithRoom()
        {
            var room = NewMock <RoomStub>();

            new WalkCommand(HardwareRobot, room).Execute();
            HardwareRobot.AssertWasCalled(robot => robot.Walk());
            room.AssertWasCalled(r => r.TrackCleaning(HardwareRobot));
        }
コード例 #6
0
 public static void Upgrade(int count)
 {
     HardwareRobot.DoLeftClick(GemLoc.X, GemLoc.Y, HardwareRobot.ActionTypes.SIMULATE);
     Thread.Sleep(50);
     for (int i = 0; i < count; i++)
     {
         ConfirmUpgrade();
         if (count - i == 3)
         {
             SendKeys.SendWait("t");
         }
         Thread.Sleep(1600);
     }
 }
コード例 #7
0
 private static void SRT(object obj)
 {
     while (true)
     {
         if (!HardwareListener.IsAltDown)
         {
             srtWait.Reset();
             srtRunning = false;
         }
         srtWait.WaitOne();
         HardwareRobot.DoRightClick();
         Sleep(-35);
     }
 }
コード例 #8
0
 private static void SLT(object obj)
 {
     while (true)
     {
         if (!HardwareListener.IsAltDown)
         {
             sltWait.Reset();
             sltRunning = false;
         }
         sltWait.WaitOne();
         HardwareRobot.DoLeftClick();
         Sleep(-25);
     }
 }
コード例 #9
0
        public static void Accept()
        {
            string mode = SettingsManager.GetSetting("auto-accept");

            if (mode == "inactive")
            {
                return;
            }
            if (mode == "empower")
            {
                HardwareRobot.DoLeftClick(EmpowerLoc.X, EmpowerLoc.Y);
                Thread.Sleep(10);
            }
            HardwareRobot.DoLeftClick(AcceptLoc.X, AcceptLoc.Y);
        }
コード例 #10
0
        public static void MoveInventory()
        {
            // DISABLE MOUSE HOOKS TO PREVENT LAG
            HardwareListener.UnregisterMouseHooks();

            InventoryIterator inventory = Player.Player.Inventory.Get1SlotIterator();

            while (inventory.HasNext)
            {
                Position p = inventory.GetNext();
                HardwareRobot.DoRightClick(p);
            }

            // RE-ENABLE MOUSE HOOKS
            HardwareListener.RegisterMouseHooks();
        }
コード例 #11
0
        private static void RunScript(string script)
        {
            string[] calls = script.Split(';');
            foreach (string call in calls)
            {
                string   command = call.Split(',')[0];
                string[] args    = call.Replace(command + ",", "").Split(',');

                switch (command)
                {
                case "send":
                    SendKeys.SendWait(args[0]);
                    break;

                case "sleep":
                    InternalScripts.Sleep(int.Parse(args[0]));
                    break;

                case "move":
                    HardwareRobot.MovePhysicalCursor(int.Parse(args[0]), int.Parse(args[1]));
                    break;

                case "click":
                    for (int i = int.Parse(args[1]); i > 0; i--)
                    {
                        if (args[0] == "left")
                        {
                            HardwareRobot.DoLeftClick(Cursor.Position.X, Cursor.Position.Y, HardwareRobot.ActionTypes.PHYSICAL);
                        }
                        else
                        {
                            HardwareRobot.DoRightClick(Cursor.Position.X, Cursor.Position.Y, HardwareRobot.ActionTypes.PHYSICAL);
                        }
                    }
                    break;

                case "unreg_mouse_hooks":
                    HardwareListener.UnregisterMouseHooks();
                    break;

                case "reg_mouse_hooks":
                    HardwareListener.RegisterMouseHooks();
                    break;
                }
            }
        }
コード例 #12
0
        public static void Move()
        {
            if (Environment.TickCount - lastClick <= 75)
            {
                return;
            }

            if (currentState)
            {
                HardwareRobot.DoMButtonClick((int)sx * (961 + 50), (int)sy * 507);
            }
            else
            {
                HardwareRobot.DoMButtonClick((int)sx * (961 - 50), (int)sy * 507);
            }

            lastClick    = Environment.TickCount;
            currentState = !currentState;
        }
コード例 #13
0
ファイル: Orek.cs プロジェクト: TheRealLegend27/tlhelper-temp
        public static void Open()
        {
            string mode = SettingsManager.GetSetting("auto-rift");

            if (mode == "inactive")
            {
                return;
            }
            if (mode == "r")
            {
                HardwareRobot.DoLeftClick(RiftLoc.X, RiftLoc.Y);
            }
            else if (mode == "gr")
            {
                HardwareRobot.DoLeftClick(GRiftLoc.X, GRiftLoc.Y);
            }

            HardwareRobot.DoLeftClick(AcceptLoc.X, AcceptLoc.Y);
        }
コード例 #14
0
        public static void ClearInv2Space()
        {
            SaveCursor();
            HardwareListener.UnregisterMouseHooks();

            HardwareRobot.DoLeftClick(coords["smith_salvage"]);
            InventoryIterator inventory = Player.Player.Inventory.Get2SlotIterator();

            while (inventory.HasNext)
            {
                Position p = inventory.GetNext();
                HardwareRobot.MovePhysicalCursor(p);
                HardwareRobot.DoLeftClick(p, HardwareRobot.ActionTypes.PHYSICAL);
                SendKeys.SendWait("{ENTER}");
                SendKeys.SendWait("{ENTER}");
            }

            HardwareListener.RegisterMouseHooks();
            RecoverCursor();
        }
コード例 #15
0
 public void Process()
 {
     if (IsActive && AvailableFunctions.Potion(0, ScreenTools.GetPixelColor(Coords.Coords.Potion50.x, Coords.Coords.Potion50.y).Item1))
     {
         if (Key.IsMouse)
         {
             if (Key.CurrentKey == Keys.LButton)
             {
                 HardwareRobot.DoLeftClick();
             }
             else if (Key.CurrentKey == Keys.RButton)
             {
                 HardwareRobot.DoRightClick();
             }
         }
         else
         {
             HardwareRobot.PressKey((char)Key.CurrentKey);
         }
     }
 }
コード例 #16
0
        private static void ProcessSkills()
        {
            foreach (string id in ActiveSkills)
            {
                var skill = Skills[id];

                if (skill.IsActive && skill.CanPress(skill.Slot, SkillCoords.GetPxlColor(skill)))
                {
                    var key = skill.Key;
                    if (key.IsMouse)
                    {
                        if (key.CurrentKey == Keys.LButton)
                        {
                            HardwareRobot.DoLeftClickShift();
                        }
                        else if (key.CurrentKey == Keys.RButton)
                        {
                            HardwareRobot.DoRightClick();
                        }
                        else if (key.CurrentKey == Keys.XButton1)
                        {
                            HardwareRobot.DoXButton1Click();
                        }
                        else if (key.CurrentKey == Keys.XButton2)
                        {
                            HardwareRobot.DoXButton2Click();
                        }
                    }
                    else
                    {
                        HardwareRobot.PressKey((char)key.CurrentKey);
                    }
                }
            }
            if (SettingsManager.GetSetting("hexing-pants") == "1")
            {
                HexingPantsSkill.Move();
            }
        }
コード例 #17
0
        public static void DropItems()
        {
            // DISABLE MOUSE HOOKS TO PREVENT LAG
            HardwareListener.UnregisterMouseHooks();

            Coord             Drop      = coords["drop_item"];
            InventoryIterator inventory = Player.Player.Inventory.Get1SlotIterator();

            SendKeys.SendWait("i");
            while (inventory.HasNext)
            {
                Position p = inventory.GetNext();
                HardwareRobot.MovePhysicalCursor(p);
                HardwareRobot.DoLeftDown(p.x, p.y, HardwareRobot.ActionTypes.PHYSICAL);
                HardwareRobot.MovePhysicalCursor(Drop);
                Sleep(-20);
                HardwareRobot.DoLeftUp(Drop.RealX, Drop.RealY, HardwareRobot.ActionTypes.PHYSICAL);
            }
            SendKeys.SendWait("i");

            // RE-ENABLE MOUSE HOOKS
            HardwareListener.RegisterMouseHooks();
        }
コード例 #18
0
 private void GivenTheRobotIsFacing(int hardwareDirection)
 {
     HardwareRobot.Stub(robot => robot.FaceTo).Return(hardwareDirection);
 }
コード例 #19
0
 public void IsAnObstacleNextCommandIsTurnRight()
 {
     GivenTheCleaningIsUnderway();
     HardwareRobot.Stub(robot => robot.IsObstacle()).Return(true);
     ThenTheNextCommandIs <TurnRightCommand>();
 }
コード例 #20
0
 protected override void PerformCommandSteps()
 {
     HardwareRobot.TurnRight();
 }
コード例 #21
0
 protected override void PerformCommandSteps()
 {
     HardwareRobot.Walk();
 }
コード例 #22
0
 private static void ConfirmUpgrade() => HardwareRobot.DoLeftClick(UpgradeLoc.X, UpgradeLoc.Y, HardwareRobot.ActionTypes.SIMULATE);
コード例 #23
0
 private static void Confirm()
 {
     HardwareRobot.DoLeftClick(ConfirmButton.X, ConfirmButton.Y, HardwareRobot.ActionTypes.SIMULATE);
 }
コード例 #24
0
 public static void Accept() => HardwareRobot.DoLeftClick(AcceptLoc.X, AcceptLoc.Y);
コード例 #25
0
ファイル: ReturnTests.cs プロジェクト: trigrass2/RobotCleaner
 public void ReturnDelegatesToResetMethodOnHardware()
 {
     new Return(HardwareRobot).Execute();
     HardwareRobot.AssertWasCalled(robot => robot.Reset());
 }