Add search by id to Priority window
authorLiza Carvelli <liza@carvel.li>
Mon, 14 Jul 2025 14:09:41 +0000 (16:09 +0200)
committerLiza Carvelli <liza@carvel.li>
Mon, 14 Jul 2025 14:09:41 +0000 (16:09 +0200)
Questionable/Windows/PriorityWindow.cs

index e80b2a7c3462a0b546274cec95b9603088d074a6..487339c95f00b9df22a05e8f2178b1b376438d20 100644 (file)
@@ -104,9 +104,17 @@ internal sealed class PriorityWindow : LWindow
             IEnumerable<Quest> foundQuests;
             if (!string.IsNullOrEmpty(_searchString))
             {
+                bool DefaultPredicate(Quest x) => x.Info.Name.Contains(_searchString, StringComparison.CurrentCultureIgnoreCase);
+
+                Func<Quest, bool> searchPredicate;
+                if (ElementId.TryFromString(_searchString, out ElementId? elementId))
+                    searchPredicate = x => DefaultPredicate(x) || x.Id == elementId;
+                else
+                    searchPredicate = DefaultPredicate;
+
                 foundQuests = _questRegistry.AllQuests
                     .Where(x => x.Id is not SatisfactionSupplyNpcId and not AlliedSocietyDailyId)
-                    .Where(x => x.Info.Name.Contains(_searchString, StringComparison.CurrentCultureIgnoreCase))
+                    .Where(searchPredicate)
                     .Where(x => !_questFunctions.IsQuestUnobtainable(x.Id));
             }
             else