diff --git a/Dalamud.sln b/Dalamud.sln index 3b1c4fd91..758253b9c 100644 --- a/Dalamud.sln +++ b/Dalamud.sln @@ -184,18 +184,18 @@ Global {88FB719B-EB41-73C5-8D25-C03E0C69904F}.Debug|Any CPU.Build.0 = Debug|Any CPU {88FB719B-EB41-73C5-8D25-C03E0C69904F}.Release|Any CPU.ActiveCfg = Release|Any CPU {88FB719B-EB41-73C5-8D25-C03E0C69904F}.Release|Any CPU.Build.0 = Release|Any CPU - {27AA9F87-D2AA-41D9-A559-0F1EBA38C5F8}.Debug|Any CPU.ActiveCfg = Debug|x64 - {27AA9F87-D2AA-41D9-A559-0F1EBA38C5F8}.Debug|Any CPU.Build.0 = Debug|x64 - {27AA9F87-D2AA-41D9-A559-0F1EBA38C5F8}.Release|Any CPU.ActiveCfg = Release|x64 - {27AA9F87-D2AA-41D9-A559-0F1EBA38C5F8}.Release|Any CPU.Build.0 = Release|x64 - {8CDAEB2D-5022-450A-A97F-181C6270185F}.Debug|Any CPU.ActiveCfg = Debug|x64 - {8CDAEB2D-5022-450A-A97F-181C6270185F}.Debug|Any CPU.Build.0 = Debug|x64 - {8CDAEB2D-5022-450A-A97F-181C6270185F}.Release|Any CPU.ActiveCfg = Release|x64 - {8CDAEB2D-5022-450A-A97F-181C6270185F}.Release|Any CPU.Build.0 = Release|x64 - {F5D92D2D-D36F-4471-B657-8B9AA6C98AD6}.Debug|Any CPU.ActiveCfg = Debug|x64 - {F5D92D2D-D36F-4471-B657-8B9AA6C98AD6}.Debug|Any CPU.Build.0 = Debug|x64 - {F5D92D2D-D36F-4471-B657-8B9AA6C98AD6}.Release|Any CPU.ActiveCfg = Release|x64 - {F5D92D2D-D36F-4471-B657-8B9AA6C98AD6}.Release|Any CPU.Build.0 = Release|x64 + {27AA9F87-D2AA-41D9-A559-0F1EBA38C5F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27AA9F87-D2AA-41D9-A559-0F1EBA38C5F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27AA9F87-D2AA-41D9-A559-0F1EBA38C5F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27AA9F87-D2AA-41D9-A559-0F1EBA38C5F8}.Release|Any CPU.Build.0 = Release|Any CPU + {8CDAEB2D-5022-450A-A97F-181C6270185F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8CDAEB2D-5022-450A-A97F-181C6270185F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8CDAEB2D-5022-450A-A97F-181C6270185F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8CDAEB2D-5022-450A-A97F-181C6270185F}.Release|Any CPU.Build.0 = Release|Any CPU + {F5D92D2D-D36F-4471-B657-8B9AA6C98AD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F5D92D2D-D36F-4471-B657-8B9AA6C98AD6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F5D92D2D-D36F-4471-B657-8B9AA6C98AD6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F5D92D2D-D36F-4471-B657-8B9AA6C98AD6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Dalamud/Game/NativeWrapper/AgentInterfacePtr.cs b/Dalamud/Game/NativeWrapper/AgentInterfacePtr.cs index b5a6375a9..b5e8938dd 100644 --- a/Dalamud/Game/NativeWrapper/AgentInterfacePtr.cs +++ b/Dalamud/Game/NativeWrapper/AgentInterfacePtr.cs @@ -81,7 +81,7 @@ public readonly unsafe struct AgentInterfacePtr(nint address) : IEquatable /// true when the addon was focused, false otherwise. - public readonly bool FocusAddon() => this.IsNull && this.Struct->FocusAddon(); + public readonly bool FocusAddon() => !this.IsNull && this.Struct->FocusAddon(); /// Determines whether the specified AgentInterfacePtr is equal to the current AgentInterfacePtr. /// The AgentInterfacePtr to compare with the current AgentInterfacePtr. diff --git a/Dalamud/Game/UnlockState/UnlockState.cs b/Dalamud/Game/UnlockState/UnlockState.cs index 939548803..5ccd7fadb 100644 --- a/Dalamud/Game/UnlockState/UnlockState.cs +++ b/Dalamud/Game/UnlockState/UnlockState.cs @@ -311,9 +311,12 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState } /// - public bool IsMcGuffinUnlocked(McGuffin row) + public bool IsLeveCompleted(Leve row) { - return PlayerState.Instance()->IsMcGuffinUnlocked(row.RowId); + if (!this.IsLoaded) + return false; + + return QuestManager.Instance()->IsLevequestComplete((ushort)row.RowId); } /// @@ -328,6 +331,15 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState return this.IsUnlockLinkUnlocked(row.UnlockLink); } + /// + public bool IsMcGuffinUnlocked(McGuffin row) + { + if (!this.IsLoaded) + return false; + + return PlayerState.Instance()->IsMcGuffinUnlocked(row.RowId); + } + /// public bool IsMountUnlocked(Mount row) { @@ -376,9 +388,21 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState return UIState.IsPublicContentUnlocked(row.RowId); } + /// + public bool IsQuestCompleted(Quest row) + { + if (!this.IsLoaded) + return false; + + return QuestManager.IsQuestComplete(row.RowId); + } + /// public bool IsRecipeUnlocked(Recipe row) { + if (!this.IsLoaded) + return false; + return this.recipeData.IsRecipeUnlocked(row); } @@ -509,6 +533,9 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState if (rowRef.TryGetValue(out var itemRow)) return this.IsItemUnlocked(itemRow); + if (rowRef.TryGetValue(out var leveRow)) + return this.IsLeveCompleted(leveRow); + if (rowRef.TryGetValue(out var mjiLandmarkRow)) return this.IsMJILandmarkUnlocked(mjiLandmarkRow); @@ -536,6 +563,9 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState if (rowRef.TryGetValue(out var publicContentRow)) return this.IsPublicContentUnlocked(publicContentRow); + if (rowRef.TryGetValue(out var questRow)) + return this.IsQuestCompleted(questRow); + if (rowRef.TryGetValue(out var recipeRow)) return this.IsRecipeUnlocked(recipeRow); @@ -596,6 +626,8 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState if (!this.IsLoaded) return; + Log.Verbose("Checking for new unlocks..."); + this.UpdateUnlocksForSheet(); this.UpdateUnlocksForSheet(); this.UpdateUnlocksForSheet(); @@ -629,6 +661,7 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState this.UpdateUnlocksForSheet(); this.UpdateUnlocksForSheet(); this.UpdateUnlocksForSheet(); + this.UpdateUnlocksForSheet(); this.UpdateUnlocksForSheet(); this.UpdateUnlocksForSheet(); this.UpdateUnlocksForSheet(); @@ -637,6 +670,7 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState // Not implemented: // - DescriptionPage: quite complex // - QuestAcceptAdditionCondition: ignored + // - Leve: AgentUpdateFlag.UnlocksUpdate is not set and the completed status can be unset again! // For some other day: // - FishingSpot @@ -676,7 +710,7 @@ internal unsafe class UnlockState : IInternalDisposableService, IUnlockState unlockedRowIds.Add(row.RowId); - Log.Verbose($"Unlock detected: {typeof(T).Name}#{row.RowId}"); + // Log.Verbose($"Unlock detected: {typeof(T).Name}#{row.RowId}"); foreach (var action in Delegate.EnumerateInvocationList(this.Unlock)) { @@ -796,7 +830,7 @@ internal class UnlockStatePluginScoped : IInternalDisposableService, IUnlockStat public bool IsItemUnlocked(Item row) => this.unlockStateService.IsItemUnlocked(row); /// - public bool IsMcGuffinUnlocked(McGuffin row) => this.unlockStateService.IsMcGuffinUnlocked(row); + public bool IsLeveCompleted(Leve row) => this.unlockStateService.IsLeveCompleted(row); /// public bool IsMJILandmarkUnlocked(MJILandmark row) => this.unlockStateService.IsMJILandmarkUnlocked(row); @@ -804,6 +838,9 @@ internal class UnlockStatePluginScoped : IInternalDisposableService, IUnlockStat /// public bool IsMKDLoreUnlocked(MKDLore row) => this.unlockStateService.IsMKDLoreUnlocked(row); + /// + public bool IsMcGuffinUnlocked(McGuffin row) => this.unlockStateService.IsMcGuffinUnlocked(row); + /// public bool IsMountUnlocked(Mount row) => this.unlockStateService.IsMountUnlocked(row); @@ -822,6 +859,9 @@ internal class UnlockStatePluginScoped : IInternalDisposableService, IUnlockStat /// public bool IsPublicContentUnlocked(PublicContentSheet row) => this.unlockStateService.IsPublicContentUnlocked(row); + /// + public bool IsQuestCompleted(Quest row) => this.unlockStateService.IsQuestCompleted(row); + /// public bool IsRecipeUnlocked(Recipe row) => this.unlockStateService.IsRecipeUnlocked(row); diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/UIColorWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/UIColorWidget.cs index dc1ab4e30..bc6e5376c 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/UIColorWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/UIColorWidget.cs @@ -3,11 +3,11 @@ using System.Numerics; using System.Text; using Dalamud.Bindings.ImGui; -using Dalamud.Interface.Utility.Raii; using Dalamud.Data; using Dalamud.Interface.ImGuiNotification; using Dalamud.Interface.ImGuiNotification.Internal; using Dalamud.Interface.ImGuiSeStringRenderer.Internal; +using Dalamud.Interface.Utility.Raii; using Lumina.Excel.Sheets; diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index 3cbd1a521..dab3506c0 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -11,6 +11,7 @@ using Dalamud.Game.ClientState.Keys; using Dalamud.Interface.Colors; using Dalamud.Interface.Components; using Dalamud.Interface.Internal; +using Dalamud.Interface.Internal.Windows.StyleEditor; using Dalamud.Interface.Textures.Internal; using Dalamud.Interface.Textures.TextureWraps; using Dalamud.Interface.Utility; @@ -461,7 +462,7 @@ public abstract class Window ImGuiHelpers.ForceNextWindowMainViewport(); var wasFocused = this.IsFocused; - if (wasFocused) + if (wasFocused && this is not StyleEditorWindow) { var style = ImGui.GetStyle(); var focusedHeaderColor = style.Colors[(int)ImGuiCol.TitleBgActive]; @@ -616,7 +617,7 @@ public abstract class Window this.DrawTitleBarButtons(); } - if (wasFocused) + if (wasFocused && this is not StyleEditorWindow) { ImGui.PopStyleColor(); } diff --git a/Dalamud/Plugin/Services/IUnlockState.cs b/Dalamud/Plugin/Services/IUnlockState.cs index 6703ece2e..f51222ba1 100644 --- a/Dalamud/Plugin/Services/IUnlockState.cs +++ b/Dalamud/Plugin/Services/IUnlockState.cs @@ -205,6 +205,13 @@ public interface IUnlockState : IDalamudService /// if unlocked; otherwise, . bool IsItemUnlocked(Item row); + /// + /// Determines whether the specified Leve is completed. + /// + /// The Leve row to check. + /// if completed; otherwise, . + bool IsLeveCompleted(Leve row); + /// /// Determines whether the specified McGuffin is unlocked. /// @@ -268,6 +275,13 @@ public interface IUnlockState : IDalamudService /// if unlocked; otherwise, . bool IsPublicContentUnlocked(PublicContent row); + /// + /// Determines whether the specified Quest is completed. + /// + /// The Quest row to check. + /// if completed; otherwise, . + bool IsQuestCompleted(Quest row); + /// /// Determines whether the specified Recipe is unlocked. /// diff --git a/lib/FFXIVClientStructs b/lib/FFXIVClientStructs index d83e0c13d..127047085 160000 --- a/lib/FFXIVClientStructs +++ b/lib/FFXIVClientStructs @@ -1 +1 @@ -Subproject commit d83e0c13d3c802d4a483f373edcd129bc4802073 +Subproject commit 1270470855d6ac2d2f726b07019e21644c5658ec