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 e80b2a7..487339c 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