diff --git a/Questionable/Configuration.cs b/Questionable/Configuration.cs index eaef49365..15a07b8c3 100644 --- a/Questionable/Configuration.cs +++ b/Questionable/Configuration.cs @@ -17,6 +17,7 @@ internal sealed class Configuration : IPluginConfiguration public bool AutoAcceptNextQuest { get; set; } public uint MountId { get; set; } = 71; public GrandCompany GrandCompany { get; set; } = GrandCompany.None; + public bool HideInAllInstances { get; set; } = true; } internal sealed class AdvancedConfiguration diff --git a/Questionable/Data/TerritoryData.cs b/Questionable/Data/TerritoryData.cs index 7d3fc59e8..fc541e778 100644 --- a/Questionable/Data/TerritoryData.cs +++ b/Questionable/Data/TerritoryData.cs @@ -10,7 +10,8 @@ namespace Questionable.Data; internal sealed class TerritoryData { private readonly ImmutableDictionary _territoryNames; - private readonly ImmutableHashSet _territoriesWithMount; + private readonly ImmutableHashSet _territoriesWithMount; + private readonly ImmutableHashSet _dutyTerritories; public TerritoryData(IDataManager dataManager) { @@ -27,7 +28,12 @@ internal sealed class TerritoryData _territoriesWithMount = dataManager.GetExcelSheet()! .Where(x => x.RowId > 0 && x.Mount) - .Select(x => x.RowId) + .Select(x => (ushort)x.RowId) + .ToImmutableHashSet(); + + _dutyTerritories = dataManager.GetExcelSheet()! + .Where(x => x.RowId > 0 && x.ContentFinderCondition.Row != 0) + .Select(x => (ushort)x.RowId) .ToImmutableHashSet(); } @@ -43,4 +49,6 @@ internal sealed class TerritoryData } public bool CanUseMount(ushort territoryId) => _territoriesWithMount.Contains(territoryId); + + public bool IsDutyInstance(ushort territoryId) => _dutyTerritories.Contains(territoryId); } diff --git a/Questionable/Windows/ConfigWindow.cs b/Questionable/Windows/ConfigWindow.cs index 48ef339f3..a24b6734e 100644 --- a/Questionable/Windows/ConfigWindow.cs +++ b/Questionable/Windows/ConfigWindow.cs @@ -69,6 +69,13 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig Save(); } + bool hideInAllInstances = _configuration.General.HideInAllInstances; + if (ImGui.Checkbox("Hide quest window in all instanced duties", ref hideInAllInstances)) + { + _configuration.General.HideInAllInstances = hideInAllInstances; + Save(); + } + ImGui.EndTabItem(); } diff --git a/Questionable/Windows/QuestWindow.cs b/Questionable/Windows/QuestWindow.cs index aef55d0b2..17f400849 100644 --- a/Questionable/Windows/QuestWindow.cs +++ b/Questionable/Windows/QuestWindow.cs @@ -95,6 +95,9 @@ internal sealed class QuestWindow : LWindow, IPersistableWindowConfig if (!_clientState.IsLoggedIn || _clientState.LocalPlayer == null) return false; + if (_configuration.General.HideInAllInstances && _territoryData.IsDutyInstance(_clientState.TerritoryType)) + return false; + var currentQuest = _questController.CurrentQuest; return currentQuest == null || !currentQuest.Quest.Data.TerritoryBlacklist.Contains(_clientState.TerritoryType); }