From aad978f5f68bb36eb43f78f18c45ce7160c993e3 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Tue, 8 Apr 2025 22:53:59 +0200 Subject: [PATCH] Pass actor in GearsetDataLoaded instead of looking it up. --- Glamourer/Events/GearsetDataLoaded.cs | 2 +- Glamourer/Interop/UpdateSlotService.cs | 2 +- Glamourer/State/StateListener.cs | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Glamourer/Events/GearsetDataLoaded.cs b/Glamourer/Events/GearsetDataLoaded.cs index 4750939..620bdab 100644 --- a/Glamourer/Events/GearsetDataLoaded.cs +++ b/Glamourer/Events/GearsetDataLoaded.cs @@ -11,7 +11,7 @@ namespace Glamourer.Events; /// /// public sealed class GearsetDataLoaded() - : EventWrapper(nameof(GearsetDataLoaded)) + : EventWrapper(nameof(GearsetDataLoaded)) { public enum Priority { diff --git a/Glamourer/Interop/UpdateSlotService.cs b/Glamourer/Interop/UpdateSlotService.cs index ffa6581..3ef99d9 100644 --- a/Glamourer/Interop/UpdateSlotService.cs +++ b/Glamourer/Interop/UpdateSlotService.cs @@ -120,7 +120,7 @@ public unsafe class UpdateSlotService : IDisposable { var ret = _loadGearsetDataHook.Original(drawDataContainer, gearsetData); var drawObject = drawDataContainer->OwnerObject->DrawObject; - GearsetDataLoadedEvent.Invoke(drawObject); + GearsetDataLoadedEvent.Invoke(drawDataContainer->OwnerObject, drawObject); Glamourer.Log.Excessive($"[LoadAllEquipmentDetour] GearsetItemData: {FormatGearsetItemDataStruct(*gearsetData)}"); return ret; } diff --git a/Glamourer/State/StateListener.cs b/Glamourer/State/StateListener.cs index 24f641c..90520b2 100644 --- a/Glamourer/State/StateListener.cs +++ b/Glamourer/State/StateListener.cs @@ -264,10 +264,9 @@ public class StateListener : IDisposable } } - private void OnGearsetDataLoaded(Model model) + private void OnGearsetDataLoaded(Actor actor, Model model) { - var actor = _penumbra.GameObjectFromDrawObject(model); - if (_condition[ConditionFlag.CreatingCharacter] && actor.Index >= ObjectIndex.CutsceneStart) + if (!actor.Valid || (_condition[ConditionFlag.CreatingCharacter] && actor.Index >= ObjectIndex.CutsceneStart)) return; // ensure actor and state are valid.