diff --git a/ActionTimelineEx/Configurations/DrawingSettings.cs b/ActionTimelineEx/Configurations/DrawingSettings.cs index 51940e2..09baa2d 100644 --- a/ActionTimelineEx/Configurations/DrawingSettings.cs +++ b/ActionTimelineEx/Configurations/DrawingSettings.cs @@ -73,6 +73,6 @@ public class DrawingSettings public bool ShowGCDClippingSetting = true; public bool ShowGCDClipping => IsRotation ? false : ShowGCDClippingSetting; public float GCDClippingThreshold = 0.15f; - public int GCDClippingMaxTime = 5; + public int GCDClippingMaxTime = 2; public Vector4 GCDClippingColor = new Vector4(1f, 0.2f, 0.2f, 0.3f); } diff --git a/ActionTimelineEx/Configurations/Settings.cs b/ActionTimelineEx/Configurations/Settings.cs index fe39bc3..811f6b7 100644 --- a/ActionTimelineEx/Configurations/Settings.cs +++ b/ActionTimelineEx/Configurations/Settings.cs @@ -12,6 +12,9 @@ public class Settings : IPluginConfiguration //public float StatusCheckDelay = 0.1f; public DrawingSettings TimelineSetting = new DrawingSettings(); public HashSet HideStatusIds = new HashSet(); + public bool PrintClipping = false; + public int PrintClippingMin = 150; + public int PrintClippingMax = 2000; public int Version { get; set; } = 6; public void Save() diff --git a/ActionTimelineEx/Timeline/TimelineManager.cs b/ActionTimelineEx/Timeline/TimelineManager.cs index a622de5..79ad300 100644 --- a/ActionTimelineEx/Timeline/TimelineManager.cs +++ b/ActionTimelineEx/Timeline/TimelineManager.cs @@ -258,10 +258,22 @@ private void ActionFromSelfAsync(ActionEffectSet set) }); } - Svc.Chat.Print(set.Header.ActionID.ToString()); - + var now = DateTime.Now; var type = GetActionType(set.Header.ActionID, set.Header.ActionType); + if (Plugin.Settings.PrintClipping && type == TimelineItemType.GCD) + { + var lastGcd = _items.LastOrDefault(i => i.Type == TimelineItemType.GCD); + if(lastGcd != null) + { + var time = (int)(now - lastGcd.EndTime).TotalMilliseconds; + if(time >= Plugin.Settings.PrintClippingMin && time <= Plugin.Settings.PrintClippingMax) + { + Svc.Chat.Print($"Clipping: {time} ms ({lastGcd.Name} - {set.Name})"); + } + } + } + if (_lastItem != null && _lastItem.CastingTime > 0 && type == TimelineItemType.GCD && _lastItem.State == TimelineItemState.Casting) // Finish the casting. { @@ -271,7 +283,7 @@ private void ActionFromSelfAsync(ActionEffectSet set) { AddItem(new TimelineItem() { - StartTime = DateTime.Now, + StartTime = now, AnimationLockTime = type == TimelineItemType.AutoAttack ? 0 : set.Header.AnimationLockTime, GCDTime = type == TimelineItemType.GCD ? GCD : 0, Type = type, diff --git a/ActionTimelineEx/Windows/SettingsWindow.cs b/ActionTimelineEx/Windows/SettingsWindow.cs index 112a762..e5c27be 100644 --- a/ActionTimelineEx/Windows/SettingsWindow.cs +++ b/ActionTimelineEx/Windows/SettingsWindow.cs @@ -91,6 +91,12 @@ private void DrawGeneralSetting() { ImGui.Checkbox("Show Only In Duty", ref Settings.ShowTimelineOnlyInDuty); ImGui.Checkbox("Show Only In Combat", ref Settings.ShowTimelineOnlyInCombat); + ImGui.Checkbox("Print Clipping Time On Chat", ref Settings.PrintClipping); + if (Settings.PrintClipping) + { + ImGui.SameLine(); + ImGui.DragIntRange2("Clipping Range", ref Settings.PrintClippingMin, ref Settings.PrintClippingMax); + } //ImGui.NewLine(); @@ -390,7 +396,7 @@ private void DrawGCDClippingTab(DrawingSettings settings) int clippingThreshold = (int)(settings.GCDClippingThreshold * 1000f); if (ImGui.DragInt("Threshold (ms)", ref clippingThreshold, 0.1f, 0, 1000)) { - settings.GCDClippingThreshold = (float)clippingThreshold / 1000f; + settings.GCDClippingThreshold = clippingThreshold / 1000f; } DrawHelper.SetTooltip("This can be used filter out \"false positives\" due to latency or other factors. Any GCD clipping detected that is shorter than this value will be ignored.\nIt is strongly recommended that you test out different values and find out what works best for your setup.");