Reset quest state on logout
authorLiza Carvelli <liza@carvel.li>
Mon, 28 Jul 2025 20:50:08 +0000 (22:50 +0200)
committerLiza Carvelli <liza@carvel.li>
Mon, 28 Jul 2025 20:50:08 +0000 (22:50 +0200)
Questionable/Controller/QuestController.cs

index 7c52b73..a8024fb 100644 (file)
@@ -162,20 +162,25 @@ internal sealed class QuestController : MiniTaskController<QuestController>
         {
             _logger.LogInformation("Reload, resetting curent quest progress");
 
-            _startedQuest = null;
-            _nextQuest = null;
-            _gatheringQuest = null;
-            _pendingQuest = null;
-            _simulatedQuest = null;
-            _safeAnimationEnd = DateTime.MinValue;
-
-            DebugState = null;
+            ResetInternalState();
 
             _questRegistry.Reload();
             _singlePlayerDutyConfigComponent.Reload();
         }
     }
 
+    private void ResetInternalState()
+    {
+        _startedQuest = null;
+        _nextQuest = null;
+        _gatheringQuest = null;
+        _pendingQuest = null;
+        _simulatedQuest = null;
+        _safeAnimationEnd = DateTime.MinValue;
+
+        DebugState = null;
+    }
+
     public void Update()
     {
         unsafe
@@ -250,6 +255,13 @@ internal sealed class QuestController : MiniTaskController<QuestController>
         {
             DebugState = null;
 
+            if (!_clientState.IsLoggedIn)
+            {
+                ResetInternalState();
+                DebugState = "Not logged in";
+                return;
+            }
+
             if (_pendingQuest != null)
             {
                 if (!_questFunctions.IsQuestAccepted(_pendingQuest.Quest.Id))