diff --git a/RotationSolver.Basic/DataCenter.cs b/RotationSolver.Basic/DataCenter.cs index 35502da6f..f213f27e6 100644 --- a/RotationSolver.Basic/DataCenter.cs +++ b/RotationSolver.Basic/DataCenter.cs @@ -347,9 +347,18 @@ public static unsafe void AddActionRec(Action act) case ActionCate.Spell: case ActionCate.WeaponSkill: LastAction = LastGCD = id; + if (ActionManager.GetAdjustedCastTime(ActionType.Spell, (uint)id) == 0) + { + FetchTime = WeaponElapsed; + } break; case ActionCate.Ability: LastAction = LastAbility = id; + + if (!act.IsRealGCD() && ActionManager.GetMaxCharges((uint)id, Service.Player.Level) < 2) + { + FetchTime = ActionManager.Instance()->GetRecastGroupDetail(act.CooldownGroup - 1)->Elapsed; + } break; default: return; diff --git a/RotationSolver/Watcher.cs b/RotationSolver/Watcher.cs index 6a8becd64..82468abdb 100644 --- a/RotationSolver/Watcher.cs +++ b/RotationSolver/Watcher.cs @@ -15,28 +15,19 @@ public class Watcher : IDisposable { private unsafe delegate void ReceiveAbilityDelegate(uint sourceId, IntPtr sourceCharacter, Vector3* pos, ActionEffectHeader* effectHeader, ActionEffect* effectArray, ulong* effectTargets); - private delegate long ActionRequestDelegate(long a1, uint a2, uint a3); /// /// https://github.com/Tischel/ActionTimeline/blob/master/ActionTimeline/Helpers/TimelineManager.cs#L86 /// [Signature("4C 89 44 24 ?? 55 56 41 54 41 55 41 56", DetourName = nameof(ReceiveAbilityEffect))] private static Hook _receiveAbilityHook; - /// - /// https://github.com/Bluefissure/DoubleWeaver/blob/master/DoubleWeaver/Plugin.cs#L94 - /// - [Signature("E8 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? FF 50 18", DetourName = nameof(ActionRequest))] - private static Hook _actionRequestDelegate; public static ICallGateSubscriber IpcSubscriber; - private static SortedDictionary _requestTime = new SortedDictionary(); - public Watcher() { SignatureHelper.Initialise(this); _receiveAbilityHook?.Enable(); - _actionRequestDelegate?.Enable(); IpcSubscriber = Service.Interface.GetIpcSubscriber("PingPlugin.Ipc"); IpcSubscriber.Subscribe(UpdateRTTDetour); @@ -51,13 +42,6 @@ private void UpdateRTTDetour(dynamic obj) public static string ShowStrSelf { get; private set; } = string.Empty; public static string ShowStrEnemy { get; private set; } = string.Empty; - private static long ActionRequest(long a1, uint a2, uint a3) - { - _requestTime[a3] = DateTime.Now; - Service.ChatGui.Print($"Sent: {a3}"); - return _actionRequestDelegate.Original(a1, a2, a3); - } - private static unsafe void ReceiveAbilityEffect(uint sourceId, IntPtr sourceCharacter, Vector3* pos, ActionEffectHeader* effectHeader, ActionEffect* effectArray, ulong* effectTargets) { @@ -125,11 +109,6 @@ private static void ActionFromEnemy(uint sourceId, ActionEffectSet set) private static void ActionFromSelf(uint sourceId, ActionEffectSet set, uint id) { if (sourceId != Service.Player.ObjectId) return; - if(_requestTime.TryGetValue(id, out var time)) - { - DataCenter.FetchTime = (float)(DateTime.Now - time).TotalSeconds; - _requestTime.Remove(id); - } if (set.Type != ActionType.Spell && set.Type != ActionType.Item) return; if (set.Action == null) return; if ((ActionCate)set.Action.ActionCategory.Value.RowId == ActionCate.AutoAttack) return;