//const float delta = 1 / 60f; public void Initialize() { (_, prefab) = Autopcr.TryGetIntInt(Program.hwnd, handle + 0x244); var prefabdata = UnitPrefabData.Get(prefab).UnitActionControllerData; var exectimes = prefabdata.MainSkillEvolutionList.Concat(prefabdata.MainSkillList) .Concat(prefabdata.UnionBurstList).Concat(prefabdata.UnionBurstEvolutionList) .SelectMany(skill => skill.ActionParametersOnPrefab) .Where(prefab => prefab.Visible) .SelectMany(prefab => prefab.Details) .Where(det => det.Visible && det.ActionId > 0) .ToDictionary(ap => (long)ap.ActionId, ap => 1 + (int)Math.Ceiling(60 * ap.ExecTimeForPrefab.Select(ex => ex.Time).Max())); Dictionary <long, long> dep = null; long getexec(long a) { if (exectime.TryGetValue(a, out var res)) { return(res); } var b = dep[a]; if (b == 0) { return(exectimes[a]); } return(Math.Max(exectimes[a], getexec(b) + 1)); // coroutine is executed 1 frame after added to queue } var skilldata = UnitSkillDatum.FromUnitId(prefab); foreach (var skill in new long[] { skilldata.MainSkill1, skilldata.MainSkill2, skilldata.MainSkill3, skilldata.MainSkill4, skilldata.MainSkill5, skilldata.MainSkill6, skilldata.MainSkill7, skilldata.MainSkill8, skilldata.MainSkill9, skilldata.MainSkill10, skilldata.MainSkillEvolution1, skilldata.MainSkillEvolution2, skilldata.UnionBurst, skilldata.UnionBurstEvolution }.Where(s => s > 0)) { var data = SkillDatum.FromSkillId(skill); var a = data.Actions; var b = data.DependActions; dep = Enumerable.Range(0, 7).Where(i => a[i] > 0).ToDictionary(i => a[i], i => b[i]); foreach (var act in a) { if (act > 0) { exectime[act] = getexec(act); } } actions[skill] = a.Where(a => a > 0).ToArray(); } }
public static void waitAction(long unitHandle, int actionid) { bool action = false; void setaction(int id) { if (id == actionid) { action = true; } } units[unitHandle].ActionExec += setaction; Autopcr.WaitFor(_ => action, pair => pair.Item2); units[unitHandle].ActionExec -= setaction; }