From 46bdef24a4d3b881a01d580168553fc3cbae2f9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com> Date: Wed, 19 Jul 2023 15:41:10 +0800 Subject: [PATCH] fix: add a button to record. --- ActionTimelineEx/Configurations/Settings.cs | 2 +- ActionTimelineEx/Timeline/TimelineManager.cs | 6 +++--- ActionTimelineEx/Windows/SettingsWindow.cs | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ActionTimelineEx/Configurations/Settings.cs b/ActionTimelineEx/Configurations/Settings.cs index 42f8275..49f3feb 100644 --- a/ActionTimelineEx/Configurations/Settings.cs +++ b/ActionTimelineEx/Configurations/Settings.cs @@ -9,7 +9,7 @@ public class Settings : IPluginConfiguration { public bool ShowTimelineOnlyInDuty = false; public bool ShowTimelineOnlyInCombat = false; - //public float StatusCheckDelay = 0.1f; + public bool Record = true; public List TimelineSettings = new(); public HashSet HideStatusIds = new HashSet(); public bool PrintClipping = false; diff --git a/ActionTimelineEx/Timeline/TimelineManager.cs b/ActionTimelineEx/Timeline/TimelineManager.cs index 29d7a83..e05f8b5 100644 --- a/ActionTimelineEx/Timeline/TimelineManager.cs +++ b/ActionTimelineEx/Timeline/TimelineManager.cs @@ -221,7 +221,7 @@ private void ActionFromSelf(ActionEffectSet set) #if DEBUG //Svc.Chat.Print($"Id: {set.Header.ActionID}; {set.Header.ActionType}; Source: {set.Source.ObjectId}"); #endif - if (set.Source.ObjectId != Player.Object.ObjectId) return; + if (set.Source.ObjectId != Player.Object.ObjectId || !Plugin.Settings.Record) return; DamageType damage = DamageType.None; if(set.TargetEffects[0][0].type is ActionEffectType.Damage or ActionEffectType.Heal) @@ -379,7 +379,7 @@ private async void OnActorControl(uint entityId, ActorControlCategory type, uint // } //#endif - if (entityId != Player.Object?.ObjectId) return; + if (entityId != Player.Object?.ObjectId || !Plugin.Settings.Record) return; switch (type) { @@ -432,7 +432,7 @@ private unsafe void OnCast(uint sourceId, IntPtr ptr) { _onCastHook?.Original(sourceId, ptr); - if (sourceId != Player.Object?.ObjectId) return; + if (sourceId != Player.Object?.ObjectId || !Plugin.Settings.Record) return; var actionId = *(ushort*)ptr; diff --git a/ActionTimelineEx/Windows/SettingsWindow.cs b/ActionTimelineEx/Windows/SettingsWindow.cs index 04b0e11..3225d5e 100644 --- a/ActionTimelineEx/Windows/SettingsWindow.cs +++ b/ActionTimelineEx/Windows/SettingsWindow.cs @@ -116,6 +116,7 @@ private void DrawGeneralSetting() Name = (Settings.TimelineSettings.Count + 1).ToString(), }); } + ImGui.Checkbox("Record Data", ref Settings.Record); 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);