diff --git a/Dalamud/Game/UnlockState/RecipeData.cs b/Dalamud/Game/UnlockState/RecipeData.cs index 593b7fd38..b96cab951 100644 --- a/Dalamud/Game/UnlockState/RecipeData.cs +++ b/Dalamud/Game/UnlockState/RecipeData.cs @@ -54,7 +54,7 @@ internal unsafe class RecipeData : IInternalDisposableService this.clientState.Login += this.Update; this.clientState.Logout += this.OnLogout; this.clientState.LevelChanged += this.OnlevelChanged; - this.gameGui.UnlocksUpdate += this.Update; + this.gameGui.AgentUpdate += this.OnAgentUpdate; } /// @@ -63,7 +63,7 @@ internal unsafe class RecipeData : IInternalDisposableService this.clientState.Login -= this.Update; this.clientState.Logout -= this.OnLogout; this.clientState.LevelChanged -= this.OnlevelChanged; - this.gameGui.UnlocksUpdate -= this.Update; + this.gameGui.AgentUpdate -= this.OnAgentUpdate; } /// @@ -121,6 +121,12 @@ internal unsafe class RecipeData : IInternalDisposableService } } + private void OnAgentUpdate(AgentUpdateFlag agentUpdateFlag) + { + if (agentUpdateFlag.HasFlag(AgentUpdateFlag.UnlocksUpdate)) + this.Update(); + } + private void Update() { // based on Client::Game::UI::RecipeNote.InitializeStructs diff --git a/Dalamud/Game/UnlockState/UnlockState.cs b/Dalamud/Game/UnlockState/UnlockState.cs index 846be8294..a4b9381cc 100644 --- a/Dalamud/Game/UnlockState/UnlockState.cs +++ b/Dalamud/Game/UnlockState/UnlockState.cs @@ -49,9 +49,9 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState [ServiceManager.ServiceConstructor] private UnlockState() { - this.clientState.Login += this.UpdateUnlocks; + this.clientState.Login += this.OnLogin; this.clientState.Logout += this.OnLogout; - this.gameGui.UnlocksUpdate += this.UpdateUnlocks; + this.gameGui.AgentUpdate += this.OnAgentUpdate; } /// @@ -62,9 +62,9 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState /// void IInternalDisposableService.DisposeService() { - this.clientState.Login -= this.UpdateUnlocks; + this.clientState.Login -= this.OnLogin; this.clientState.Logout -= this.OnLogout; - this.gameGui.UnlocksUpdate -= this.UpdateUnlocks; + this.gameGui.AgentUpdate -= this.OnAgentUpdate; } /// @@ -577,12 +577,23 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState return UIState.Instance()->IsUnlockLinkUnlockedOrQuestCompleted(unlockLink); } + private void OnLogin() + { + this.Update(); + } + private void OnLogout(int type, int code) { this.cachedUnlockedRowIds.Clear(); } - private void UpdateUnlocks() + private void OnAgentUpdate(AgentUpdateFlag agentUpdateFlag) + { + if (agentUpdateFlag.HasFlag(AgentUpdateFlag.UnlocksUpdate)) + this.Update(); + } + + private void Update() { if (!this.IsLoaded) return;