Пример #1
0
        static void Main(string[] args)
        {
            //Minitouch.connect("localhost", 1111);
            //Minitouch.setPos(1, 100, 100);
            //Minitouch.press(1);

            using var lua = new Lua();
            var env = lua.CreateEnvironment();

            env.RegisterPackage("autopcr", typeof(Autopcr));
            env.RegisterPackage("minitouch", typeof(Minitouch));

            var chunk = lua.CompileChunk(File.ReadAllText("timeline.lua"), "timeline.lua", new LuaCompileOptions());

            Console.Write("pid>");
            var pid = int.Parse(Console.ReadLine());

            //var pid = 11892;
            hwnd = NativeFunctions.OpenProcess(NativeFunctions.PROCESS_ALL_ACCESS, false, pid);

            var tuple = AobscanHelper.Aobscan(hwnd, idcode, addr =>
            {
                var frame = TryGetInfo(hwnd, addr);
                if (frame.Item1 >= 0 && frame.Item1 < 1000 && frame.Item2 > 80 && frame.Item2 < 100)
                {
                    Console.WriteLine($"data found, frameCount = {frame.Item1}, limitTime = {frame.Item2}");
                    return(true);
                }
                return(false);
            });

            addr = tuple.Item1;

            Console.WriteLine($"addr = {addr:x}");

            Console.WriteLine();

            if (addr == -1)
            {
                Console.WriteLine("aobscan failed.");
                return;
            }

            seed_addr = AobscanHelper.Aobscan(hwnd, seed_code, addr =>
            {
                Console.WriteLine($"seed found.");
                return(true);
            }).Item1 - 0x90;

            chunk.Run(env);

            Console.WriteLine("script finished.");
            Minitouch.exit();

            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            //Minitouch.connect("localhost", 1111);
            //Minitouch.setPos(1, 100, 100);
            //Minitouch.press(1);

            using var lua = new Lua();
            var env = lua.CreateEnvironment();

            env.RegisterPackage("autopcr", typeof(Autopcr));
            env.RegisterPackage("minitouch", typeof(Minitouch));
            env.RegisterPackage("input", typeof(Input));
            env.RegisterPackage("monitor", typeof(Monitor));

            var chunk = lua.CompileChunk(File.ReadAllText("timeline.lua"), "timeline.lua", new LuaCompileOptions());

            Console.Write("pid>");
            var pid = int.Parse(Console.ReadLine());

            //var pid = 11892;
            hwnd = NativeFunctions.OpenProcess(NativeFunctions.PROCESS_ALL_ACCESS, false, pid);

            var tuple = AobscanHelper.Aobscan(hwnd, idcode, addr =>
            {
                var frame = TryGetInfo(hwnd, addr);
                if (frame.Item1 >= 0 && frame.Item1 < 1000 && frame.Item2 > 80 && frame.Item2 < 100)
                {
                    Console.WriteLine($"data found, frameCount = {frame.Item1}, limitTime = {frame.Item2}");
                    return(true);
                }
                return(false);
            });

            addr = tuple.Item1;

            Console.WriteLine($"addr = {addr:x}");

            Console.WriteLine();

            if (addr == -1)
            {
                Console.WriteLine("aobscan failed.");
                return;
            }

            seed_addr = AobscanHelper.Aobscan(hwnd, seed_code, addr =>
            {
                Console.WriteLine($"seed found.");
                return(true);
            }).Item1 - 0x90;

            /*
             * UnityRandom.State state0;
             * NativeFunctions.ReadProcessMemory(Program.hwnd, Program.seed_addr, out state0);
             * UnityRandom.State state;
             * int last = 0;
             * while (true)
             * {
             *  NativeFunctions.ReadProcessMemory(Program.hwnd, Program.seed_addr, out state);
             *  int i = 0;
             *  List<float> rands;
             *  UnityRandom.state = state0;
             *  while (state.x != UnityRandom.state.x)
             *  {
             ++i;
             *      UnityRandom.Random();
             *  }
             *  if (i > last) Console.WriteLine($"rand times={i}");
             *  last = i;
             * }
             */
            chunk.Run(env);

            Console.WriteLine("script finished.");
            exiting = true;
            Minitouch.exit();

            Console.ReadLine();
        }
Пример #3
0
        static void Main(string[] args)
        {
            //Minitouch.connect("localhost", 1111);
            //Minitouch.setPos(1, 100, 100);
            //Minitouch.press(1);

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            using var lua = new Lua();
            var env = lua.CreateEnvironment();

            env.RegisterPackage("autopcr", typeof(Autopcr));
            env.RegisterPackage("minitouch", typeof(Minitouch));
            env.RegisterPackage("input", typeof(Input));
            env.RegisterPackage("monitor", typeof(Monitor));

            LuaChunk chunk;

            try
            {
                chunk = lua.CompileChunk(File.ReadAllText("timeline.lua"), "timeline.lua", new LuaCompileOptions());
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("你timeline.lua呢?");
                throw;
            }
            catch (LuaParseException e)
            {
                Console.WriteLine($"lua写错了!滚去学编程 行{e.Line}, 列{e.Column}");
                throw;
            }

            Console.Write("pid>");
            var pid = int.Parse(Console.ReadLine());

            //var pid = 11892;
            hwnd = NativeFunctions.OpenProcess(NativeFunctions.PROCESS_ALL_ACCESS, false, pid);

            Console.Write("当前世界(以秒为单位,别给我填100,1.00,要是超过了20s直接挂树吧)");
            var time = int.Parse(Console.ReadLine());

            var tuple = AobscanHelper.Aobscan(hwnd, idcode, addr =>
            {
                var frame = TryGetInfo(hwnd, addr);
                Console.WriteLine(frame);
                if (frame.Item1 >= 0 && frame.Item1 < 1200 && frame.Item2 > time - 1 && frame.Item2 < time + 1)
                {
                    Console.WriteLine($"data found, frameCount = {frame.Item1}, limitTime = {frame.Item2}");
                    return(true);
                }
                return(false);
            });

            addr = tuple.Item1;

            Console.WriteLine($"addr = {addr:x}");

            Console.WriteLine();

            if (addr == -1)
            {
                Console.WriteLine("没找到数据!好好看看是不是输错进程pid了或者没进对战,进对战不要开倍速!");
                throw new Exception();
            }

            seed_addr = AobscanHelper.Aobscan(hwnd, seed_code, addr =>
            {
                Console.WriteLine($"seed found.");
                return(true);
            }).Item1 - 0x90;

            /*
             * UnityRandom.State state0;
             * NativeFunctions.ReadProcessMemory(Program.hwnd, Program.seed_addr, out state0);
             * UnityRandom.State state;
             * int last = 0;
             * while (true)
             * {
             *  NativeFunctions.ReadProcessMemory(Program.hwnd, Program.seed_addr, out state);
             *  int i = 0;
             *  List<float> rands;
             *  UnityRandom.state = state0;
             *  while (state.x != UnityRandom.state.x)
             *  {
             ++i;
             *      UnityRandom.Random();
             *  }
             *  if (i > last) Console.WriteLine($"rand times={i}");
             *  last = i;
             * }
             */

            chunk.Run(env);
            exiting = true;
            Minitouch.exit();

            Console.ReadLine();
        }