Code clean up
authorLiza Carvelli <liza@carvel.li>
Wed, 14 May 2025 00:12:53 +0000 (02:12 +0200)
committerLiza Carvelli <liza@carvel.li>
Wed, 14 May 2025 00:12:53 +0000 (02:12 +0200)
Questionable/Controller/Steps/Shared/ExtraConditionUtils.cs
Questionable/External/QuestionableIpc.cs
Questionable/Windows/JournalComponents/QuestJournalUtils.cs
Questionable/Windows/QuestComponents/ActiveQuestComponent.cs
Questionable/Windows/QuestSelectionWindow.cs

index 1572f4e4674db2eecdd77d1f861d928600d0ff1c..2f9e039cdfc9c251021da2a21d512b64a31dc76e 100644 (file)
@@ -10,18 +10,11 @@ namespace Questionable.Controller.Steps.Shared;
 
 internal sealed class ExtraConditionUtils
 {
-    private readonly Configuration _configuration;
     private readonly IClientState _clientState;
-    private readonly ILogger<ExtraConditionUtils> _logger;
 
-    public ExtraConditionUtils(
-        Configuration configuration,
-        IClientState clientState,
-        ILogger<ExtraConditionUtils> logger)
+    public ExtraConditionUtils(IClientState clientState)
     {
-        _configuration = configuration;
         _clientState = clientState;
-        _logger = logger;
     }
 
     public bool MatchesExtraCondition(EExtraSkipCondition skipCondition)
index b1aed8994bdc4ca96ce95020f73f06ec5f71f7a1..b59ae3faf1812bdbbf643164a10c3350d226fb93 100644 (file)
@@ -121,8 +121,8 @@ internal sealed class QuestionableIpc : IDisposable
         if (progress == null)
             return null;
 
-        string? questId = progress.Quest.Id.ToString();
-        if (questId == null)
+        string questId = progress.Quest.Id.ToString();
+        if (string.IsNullOrEmpty(questId))
             return null;
 
         QuestStep? step = progress.Quest.FindSequence(progress.Sequence)?.FindStep(progress.Step);
index 906dd9d220c308594ee6fdd4e3764354a2d878bc..bb921e5065bc051909d4ebb69908655028365cea 100644 (file)
@@ -40,11 +40,10 @@ internal sealed class QuestJournalUtils
             _questController.Start(label);
         }
 
-        bool openInQuestMap = _commandManager.Commands.TryGetValue("/questinfo", out var commandInfo);
+        bool openInQuestMap = _commandManager.Commands.ContainsKey("/questinfo");
         if (ImGui.MenuItem("View in Quest Map", questInfo.QuestId is QuestId && openInQuestMap))
         {
-            _commandManager.DispatchCommand("/questinfo", questInfo.QuestId.ToString() ?? string.Empty,
-                commandInfo!);
+            _commandManager.ProcessCommand($"/questinfo {questInfo.QuestId}");
         }
     }
 
index 520fd10221ba383b1ed7182cb7021b8cbd56a211..7da6ae591161918b344881e07d45ca3a18888d52 100644 (file)
@@ -335,12 +335,11 @@ internal sealed partial class ActiveQuestComponent
             if (ImGuiComponents.IconButton(FontAwesomeIcon.SortAmountDown))
                 _priorityWindow.ToggleOrUncollapse();
 
-            if (_commandManager.Commands.TryGetValue("/questinfo", out var commandInfo))
+            if (_commandManager.Commands.ContainsKey("/questinfo"))
             {
                 ImGui.SameLine();
                 if (ImGuiComponents.IconButton(FontAwesomeIcon.Atlas))
-                    _commandManager.DispatchCommand("/questinfo",
-                        currentQuest.Quest.Id.ToString() ?? string.Empty, commandInfo);
+                    _commandManager.ProcessCommand($"/questinfo {currentQuest.Quest.Id}");
             }
         }
     }
index c93c7f3e1a3f98d50b5a490f7e4b0feefef69cf3..fa5b56da2262609edb5bb7134ddd16300889deef 100644 (file)
@@ -170,7 +170,7 @@ internal sealed class QuestSelectionWindow : LWindow
         {
             ImGui.TableNextRow();
 
-            string questId = quest.QuestId.ToString() ?? string.Empty;
+            string questId = quest.QuestId.ToString();
             bool isKnownQuest = _questRegistry.TryGetQuest(quest.QuestId, out var knownQuest);
 
             if (ImGui.TableNextColumn())