fix(quest): harden quest parsing and mission update mapping across server variants#4206
Open
boscv wants to merge 4 commits intoOpenKore:masterfrom
Open
fix(quest): harden quest parsing and mission update mapping across server variants#4206boscv wants to merge 4 commits intoOpenKore:masterfrom
boscv wants to merge 4 commits intoOpenKore:masterfrom
Conversation
Normalize and harden quest handling across servers: add helpers to resolve mob names and normalize (possibly reversed) quest time windows; prefer start time for certain no-mission quests in cmdQuest. Store last killed monster nameID/time to help map hunt-only updates. Rework quest mission parsing and quest_update_mission_hunt to handle various server formats (hunt_id, hunt_id_cont, mob_id), build synthetic hunt identifiers, prefer exact mission_index matches, use packet-order and recent-kill/progress-delta fallbacks for ambiguous updates, and avoid noisy duplicate progress messages by only notifying on real changes. Add debug logging for resolved time windows and ambiguous mappings.
Normalize and robustly handle quest data from server packets. Add helpers to normalize swapped start/expire times and to resolve mob names (falling back to monsters_lut when packet names are empty or contain control chars). Use quest start time as display_time for wait/return quests without missions. Track last killed monster nameID/time to aid mapping of hunt-only updates. Rework quest_update_mission_hunt to derive a stable hunt identifier (including hunt_id_cont), maintain per-quest packet sequence, and attempt multiple deterministic fallbacks (direct hunt/mob lookup, exact/legacy mission_index, packet-order, recent kill, and progress-delta) while skipping ambiguous updates. Suppress display/logging when mission progress didn't actually change.
Refactor quest_update_mission_hunt to tighten conditional blocks, improve deterministic mapping, and add a recent-kill fallback lifecycle. Introduces a $used_recent_kill_fallback flag so the last-killed-monster signal is consumed and cleared only when actually used, and enhances debug output to show the resolved mob id/name and detailed unresolved mapping info. Also normalizes indentation/brace placement to reduce accidental logic errors. Adds new QuestReceiveTest with cases for hunt_id_cont mapping, recent-kill fallback consumption, and unresolved update logging, and registers it in test/unittests.pl.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves quest hunt mission parsing/mapping for servers that send incomplete or non-standard identifiers (e.g., unresolved
mission_id, atypicalhunt_id, orhunt_id_contpatterns), and adds regression coverage for the new behavior.What changed
Quest mission mapping robustness
quest_update_mission_huntmapping flow to better handle hunt-only updates wheremob_idis missing.hunt_id/mob_idlookups,hunt_id_cont(ROla-like behavior) to keep mission index mapping deterministic.Recent-kill fallback behavior
Logging / diagnostics
MobID/Namein hunt-only packet scenarios).Tests
src/test/QuestReceiveTest.pmwith focused coverage for:hunt_id_cont,src/test/unittests.pl.Why
Some servers send hunt mission updates with identifiers that are incomplete, swapped, or non-standard.
These changes reduce incorrect mission updates, improve compatibility across server variants, and make troubleshooting easier when packets are ambiguous.
Validation
perl src/test/unittests.pl QuestReceiveTest