Zoinkwiz / quest-helper

Helps with Quests.
BSD 2-Clause "Simplified" License
236 stars 415 forks source link

fix: ensure last step is reset on quest shutdown #1862

Closed pajlada closed 23 hours ago

pajlada commented 1 day ago

Previously, when a quest was shut down, we did not reset the lastStep variable in QuestManager

The lastStep variable is used to check if the highlight in the quest helper's side panel should change, and if we don't reset it, then stop & start the same quest, we'll have an active but unhighlighted step. This PR prevents this.

The first commit consolidates all public QuestManager "shut down quest" functions into a single one to ensure I don't have to copy paste the lastStep logic elsewhere. It would be good to take an extra look at this to ensure I have missed anything where maybe the background helper should actually remain closed if a quest is shut down in a special way. I tested this to the best of my ability (starting/stopping the "Check all items" quest & other quests, while toggling the "Highlight all items" option on and off) and everything seems to work as expected.