From: Liza Carvelli Date: Wed, 14 May 2025 00:12:53 +0000 (+0200) Subject: Code clean up X-Git-Tag: v5.11~1 X-Git-Url: https://git.jacobcasper.com/?a=commitdiff_plain;h=44f598dfe1a0f5f8cf97904139476c59c9acdf81;p=Questionable.git Code clean up --- diff --git a/Questionable/Controller/Steps/Shared/ExtraConditionUtils.cs b/Questionable/Controller/Steps/Shared/ExtraConditionUtils.cs index 1572f4e4..2f9e039c 100644 --- a/Questionable/Controller/Steps/Shared/ExtraConditionUtils.cs +++ b/Questionable/Controller/Steps/Shared/ExtraConditionUtils.cs @@ -10,18 +10,11 @@ namespace Questionable.Controller.Steps.Shared; internal sealed class ExtraConditionUtils { - private readonly Configuration _configuration; private readonly IClientState _clientState; - private readonly ILogger _logger; - public ExtraConditionUtils( - Configuration configuration, - IClientState clientState, - ILogger logger) + public ExtraConditionUtils(IClientState clientState) { - _configuration = configuration; _clientState = clientState; - _logger = logger; } public bool MatchesExtraCondition(EExtraSkipCondition skipCondition) diff --git a/Questionable/External/QuestionableIpc.cs b/Questionable/External/QuestionableIpc.cs index b1aed899..b59ae3fa 100644 --- a/Questionable/External/QuestionableIpc.cs +++ b/Questionable/External/QuestionableIpc.cs @@ -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); diff --git a/Questionable/Windows/JournalComponents/QuestJournalUtils.cs b/Questionable/Windows/JournalComponents/QuestJournalUtils.cs index 906dd9d2..bb921e50 100644 --- a/Questionable/Windows/JournalComponents/QuestJournalUtils.cs +++ b/Questionable/Windows/JournalComponents/QuestJournalUtils.cs @@ -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}"); } } diff --git a/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs b/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs index 520fd102..7da6ae59 100644 --- a/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs +++ b/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs @@ -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}"); } } } diff --git a/Questionable/Windows/QuestSelectionWindow.cs b/Questionable/Windows/QuestSelectionWindow.cs index c93c7f3e..fa5b56da 100644 --- a/Questionable/Windows/QuestSelectionWindow.cs +++ b/Questionable/Windows/QuestSelectionWindow.cs @@ -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())