コード例 #1
0
        private bool repRoute(ref Random rnd, int run_time)
        {
            //first run click
            Tools.LeftClick(rnd.Next(777, 781), rnd.Next(66, 70), false);
            //vendor click
            Tools.LeftClick(rnd.Next(407, 411), rnd.Next(126, 130), true, run_time * 15, (run_time * 15) + 500, true);


            //at vendor
            //click rep
            Tools.LeftClick(rnd.Next(283, 289), rnd.Next(296, 312), true, run_time * 5, (run_time * 5) + 500);
            Tools.LeftClick(rnd.Next(92, 211), rnd.Next(352, 360), true, 1000, 1500);

            run_was = possibleRuns.rep;
            rep_anz++;
            return(true);
        }
コード例 #2
0
        protected override void storeRoute(ref Random rnd, int run_number)
        {
            if (!GameStateChecker.getInstance().current_game_state.ingame_flags.inTown)
            {
                return;
            }

            run_was = possibleRuns.invalid;
            Tools.LeftClick(rnd.Next(452, 480), rnd.Next(150, 185), true, 100, 200, true);

            //3 sec max waiting for stash open
            TimeSpan max   = new TimeSpan(0, 0, 3);
            DateTime start = DateTime.Now;

            for (int i = 0; !GameStateChecker.getInstance().current_game_state.ingame_flags.isStashOpen; i++)
            {
                if (DateTime.Now - start >= max)
                {
                    return;
                }

                System.Threading.Thread.Sleep(500);
            }
            int free_slots = 0;

            if ((free_slots = D3InventoryStuff.getInstance().getNumberOfFreeInventorySlots(module_name, false)) <= 20)
            {
                int clicks = D3InventoryStuff.getInstance().rightClickToAllFullPositions(module_name);
                writeToMainLog(free_slots + " free slots were left. Stored items to stash with " + clicks + " clicks at inventory.");
                finished_store_runs++;
                this.free_slots = D3InventoryStuff.getInstance().getNumberOfFreeInventorySlots(module_name, true);
            }
            else
            {
                this.free_slots = free_slots;
            }

            return;
        }
コード例 #3
0
        private bool farmRoute(ref Random rnd, int run_time, int run_number)
        {
            /*
            Point item_watch_area = new Point(20, 80);
            List<Point> p;
            for (int i = 0; ; i++)
            {
                p = Tools.checkImageToD3(new Bitmap(Image.FromFile("./config/Image/Common/set.png")), 1, 1, 1, item_watch_area.X, item_watch_area.Y, item_watch_area.X, item_watch_area.Y, 5);
                if (p.Count == 1)
                {
                    writeToMainLog(i + "YES!");
                }
                else
                    writeToMainLog(i + "NO!");

                System.Threading.Thread.Sleep(500);
            }
            /* testing image recognition
            */

            int rt_mult = 5;

            Tools.clickSkill4();
            Tools.clickSkill1();
            Tools.middleClick(rnd.Next(25, 29), rnd.Next(230, 234));

            Tools.middleClick(rnd.Next(25, 29), rnd.Next(230, 234), true,  run_time * rt_mult, run_time * rt_mult + 200);
            Tools.clickSkill1(true, run_time * rt_mult, run_time * rt_mult + 200);
            Tools.middleClick(rnd.Next(25, 29), rnd.Next(230, 234));

            Tools.clickSkill2(true, run_time * rt_mult, run_time * rt_mult + 200);
            Tools.clickSkill3();

            if(!isCellarOpen())
            {
                Tools.middleClick(rnd.Next(570, 580), rnd.Next(540, 550), false);

                Tools.clickSkill1();
                Tools.clickSkill2(true, run_time * (rt_mult - 3), run_time * (rt_mult-3) + 200);

                Tools.portToTown(ref rnd, module_name);
                run_was = possibleRuns.closed;
                closed_anz++;
                return true;
            }

            //click to enter
            Tools.LeftClick(rnd.Next(114, 118), rnd.Next(163, 167), false, 50, 100, true);
            Tools.clickSkill1();

            int max_wait = 4;
            for (int i = 0; !inCellar(); i++)
            {
                System.Threading.Thread.Sleep(1000);
                if (i >= max_wait)
                {
                    writeToMainLog("Failed to enter cellar (" + (++failed_to_enter_cellar) + ")");
                    run_was = possibleRuns.closed;
                    closed_anz++;
                    return true;
                }
            }


            //in the cellar
            run_was = possibleRuns.open;
            open_anz++;

            Tools.middleClick(rnd.Next(96, 100), rnd.Next(502, 506));
            Tools.middleClick(rnd.Next(243, 247), rnd.Next(285, 289), true, run_time * rt_mult, run_time * rt_mult + 200);


            Tools.clickSkill2(true, 800, 1000);
            Tools.rightClick(rnd.Next(174, 178), rnd.Next(104, 108), false);

            Point cursor = Tools.rightClickHold(rnd.Next(174, 178), rnd.Next(104, 108));
            //attack for 2 sec
            System.Threading.Thread.Sleep(2000);

            //now attack as long there are enemys (max 10 sec)

            TimeSpan max = new TimeSpan(0, 0, 8);
            DateTime start = DateTime.Now;
            for (int no_enemy_counter = 0; no_enemy_counter < 5;)
            {
                System.Threading.Thread.Sleep(100);
                if (!isEnemy())
                    no_enemy_counter++;
                else
                    no_enemy_counter = 0;

                if (DateTime.Now - start >= max)
                    break;
            }
            Tools.rightClickHoldOff(cursor.X, cursor.Y, false);

            //loot the shit
            loot(ref rnd, run_time, rt_mult);

            Tools.portToTown(ref rnd, module_name);

            return true;
        }
コード例 #4
0
        private bool repRoute(ref Random rnd, int run_time)
        {
            //first run click
            Tools.LeftClick(rnd.Next(777, 781), rnd.Next(66, 70), false);
            //vendor click
            Tools.LeftClick(rnd.Next(407, 411), rnd.Next(126, 130), true, run_time * 15, (run_time * 15) + 500, true);


            //at vendor
            //click rep
            Tools.LeftClick(rnd.Next(283, 289), rnd.Next(296, 312), true, run_time * 5, (run_time * 5) + 500);
            Tools.LeftClick(rnd.Next(92, 211), rnd.Next(352, 360), true, 1000, 1500);

            run_was = possibleRuns.rep;
            rep_anz++;
            return true;
        }
コード例 #5
0
        protected override void storeRoute(ref Random rnd, int run_number)
        {
            if (!GameStateChecker.getInstance().current_game_state.ingame_flags.inTown)
                return;

            run_was = possibleRuns.invalid;
            Tools.LeftClick(rnd.Next(452, 480), rnd.Next(150, 185), true, 100, 200, true);

            //3 sec max waiting for stash open
            TimeSpan max = new TimeSpan(0, 0, 3);
            DateTime start = DateTime.Now;
            for (int i = 0; !GameStateChecker.getInstance().current_game_state.ingame_flags.isStashOpen; i++)
            {
                if (DateTime.Now - start >= max)
                    return;

                System.Threading.Thread.Sleep(500);    
            }
            int free_slots = 0;
            if ((free_slots=D3InventoryStuff.getInstance().getNumberOfFreeInventorySlots(module_name, false)) <= 20)
            {
                int clicks = D3InventoryStuff.getInstance().rightClickToAllFullPositions(module_name);
                writeToMainLog(free_slots + " free slots were left. Stored items to stash with " + clicks + " clicks at inventory.");
                finished_store_runs++;
                this.free_slots = D3InventoryStuff.getInstance().getNumberOfFreeInventorySlots(module_name, true);
            }
            else
                this.free_slots = free_slots;

            return;
        }
コード例 #6
0
        private bool farmRoute(ref Random rnd, int run_time, int run_number)
        {
            /*
             * Point item_watch_area = new Point(20, 80);
             * List<Point> p;
             * for (int i = 0; ; i++)
             * {
             *  p = Tools.checkImageToD3(new Bitmap(Image.FromFile("./config/Image/Common/set.png")), 1, 1, 1, item_watch_area.X, item_watch_area.Y, item_watch_area.X, item_watch_area.Y, 5);
             *  if (p.Count == 1)
             *  {
             *      writeToMainLog(i + "YES!");
             *  }
             *  else
             *      writeToMainLog(i + "NO!");
             *
             *  System.Threading.Thread.Sleep(500);
             * }
             * /* testing image recognition
             */

            int rt_mult = 5;

            Tools.clickSkill4();
            Tools.clickSkill1();
            Tools.middleClick(rnd.Next(25, 29), rnd.Next(230, 234));

            Tools.middleClick(rnd.Next(25, 29), rnd.Next(230, 234), true, run_time * rt_mult, run_time * rt_mult + 200);
            Tools.clickSkill1(true, run_time * rt_mult, run_time * rt_mult + 200);
            Tools.middleClick(rnd.Next(25, 29), rnd.Next(230, 234));

            Tools.clickSkill2(true, run_time * rt_mult, run_time * rt_mult + 200);
            Tools.clickSkill3();

            if (!isCellarOpen())
            {
                Tools.middleClick(rnd.Next(570, 580), rnd.Next(540, 550), false);

                Tools.clickSkill1();
                Tools.clickSkill2(true, run_time * (rt_mult - 3), run_time * (rt_mult - 3) + 200);

                Tools.portToTown(ref rnd, module_name);
                run_was = possibleRuns.closed;
                closed_anz++;
                return(true);
            }

            //click to enter
            Tools.LeftClick(rnd.Next(114, 118), rnd.Next(163, 167), false, 50, 100, true);
            Tools.clickSkill1();

            int max_wait = 4;

            for (int i = 0; !inCellar(); i++)
            {
                System.Threading.Thread.Sleep(1000);
                if (i >= max_wait)
                {
                    writeToMainLog("Failed to enter cellar (" + (++failed_to_enter_cellar) + ")");
                    run_was = possibleRuns.closed;
                    closed_anz++;
                    return(true);
                }
            }


            //in the cellar
            run_was = possibleRuns.open;
            open_anz++;

            Tools.middleClick(rnd.Next(96, 100), rnd.Next(502, 506));
            Tools.middleClick(rnd.Next(243, 247), rnd.Next(285, 289), true, run_time * rt_mult, run_time * rt_mult + 200);


            Tools.clickSkill2(true, 800, 1000);
            Tools.rightClick(rnd.Next(174, 178), rnd.Next(104, 108), false);

            Point cursor = Tools.rightClickHold(rnd.Next(174, 178), rnd.Next(104, 108));

            //attack for 2 sec
            System.Threading.Thread.Sleep(2000);

            //now attack as long there are enemys (max 10 sec)

            TimeSpan max   = new TimeSpan(0, 0, 8);
            DateTime start = DateTime.Now;

            for (int no_enemy_counter = 0; no_enemy_counter < 5;)
            {
                System.Threading.Thread.Sleep(100);
                if (!isEnemy())
                {
                    no_enemy_counter++;
                }
                else
                {
                    no_enemy_counter = 0;
                }

                if (DateTime.Now - start >= max)
                {
                    break;
                }
            }
            Tools.rightClickHoldOff(cursor.X, cursor.Y, false);

            //loot the shit
            loot(ref rnd, run_time, rt_mult);

            Tools.portToTown(ref rnd, module_name);

            return(true);
        }