Exemple #1
0
            //private static long bossaddr;

            public void Refresh(int frame, float time)
            {
                //if (bossaddr == 0) bossaddr = Autopcr.getBossAddr(401041501);

                NativeFunctions.ReadProcessMemory(Program.hwnd, handle + 0x18C, out int state);
                if (curaction != null)
                {
                    foreach (var action in curaction.Where(x => exectime[x] == framesince))
                    {
                        // Console.WriteLine($"{prefab} action executed {action}@{frame} {Autopcr.getDef(bossaddr)}");
                        ActionExec?.Invoke((int)action);
                    }
                }
                ActionState cur = (ActionState)state;

                if (cur != this.state)
                {
                    curaction = null;
                    if (cur == ActionState.SKILL || cur == ActionState.SKILL_1)
                    {
                        NativeFunctions.ReadProcessMemory(Program.hwnd, handle + 0x110, out skillid);
                        curaction  = actions[skillid];
                        framesince = Autopcr.frameoff;
                    }
                    else
                    {
                        skillid = cur == ActionState.ATK ? 1 : 0;
                    }

                    this.frame = frame;
                    this.time  = time;
                    //Console.WriteLine($"{prefab} action changed state={cur}/{skillid}@{frame}");
                }
                else
                {
                    ++framesince;
                }
                this.state = cur;
                last       = time;
            }
            public void Refresh(int frame, float time)
            {
                NativeFunctions.ReadProcessMemory(Program.hwnd, handle + 0x18C, out int state);
                if (curaction != null)
                {
                    foreach (var action in curaction)
                    {
                        var exec = exectime[action] + lastskill;
                        if (exec <= time && exec > last)
                        {
                            ActionExec?.Invoke((int)action);
                        }
                    }
                }
                ActionState cur = (ActionState)state;

                if (cur != this.state)
                {
                    curaction = null;
                    if (cur == ActionState.SKILL || cur == ActionState.SKILL_1)
                    {
                        NativeFunctions.ReadProcessMemory(Program.hwnd, handle + 0x110, out skillid);
                        curaction = actions[skillid];
                        lastskill = time;
                    }
                    else
                    {
                        skillid = cur == ActionState.ATK ? 1 : 0;
                    }

                    this.frame = frame;
                    this.time  = time;
                    //Console.WriteLine($"{prefab} action changed state={cur}/{skillid}@{frame}");
                }
                this.state = cur;
                last       = time;
            }