fix(quest): use mission-state names and refine single-entry hunt slot matching#4205
Closed
boscv wants to merge 6 commits intoOpenKore:masterfrom
Closed
fix(quest): use mission-state names and refine single-entry hunt slot matching#4205boscv wants to merge 6 commits intoOpenKore:masterfrom
boscv wants to merge 6 commits intoOpenKore:masterfrom
Conversation
Improve quest mission ordering and robustly handle server hunt updates. Commands.pm: sort mission entries by mission_index (fallback to 9999) then by numeric mobID so missions display in intended order. Network/Receive.pm: ignore mission updates for unknown quests early, and add a fallback mapping for servers that send updates keyed only by hunt_id — derive a mission_index from hunt_id and match against existing missions (allowing off-by-one), with safety checks to avoid applying updates to non-existent missions. These changes prevent incorrect ordering and missed/incorrect mission updates from varied server implementations.
Track the last killed monster (nameID and timestamp) and use this as a heuristic to resolve ambiguous quest hunt updates. Extract raw mission data earlier and advance the offset immediately after reading. Treat servers' hunt_id field as a usable hunt identifier only when it looks like a unique hunt token (greater than questID*1000), and prefer exact mission_index matches while retaining a legacy fallback (mission_index - 1). Add debug logging for ambiguous mappings and simplify hunt/mob lookup logic to better handle servers that omit mob_id in hunt updates.
Only record a monster as "last killed" if the player or party dealt damage, avoiding misattribution from non-player kills. Track per-quest packet sequence for multi-entry quest updates and simplify mission_index matching logic to pick the proper mission_id deterministically. Add fallbacks: prefer the current attack target for hunt-only updates, then recent kills for single-entry packets; use packet order within a quest when servers omit mob IDs. Reduce noisy quest progress logs by only showing updates for single-packet updates or when mission progress actually changes, and prefer a combat-context mob name in those messages.
Refactor quest hunt update logic to prefer direct identifiers and remove reliance on a tracked "last killed" mob. Stop storing _last_killed_monster_nameID/_time when actors die. In quest_update_mission_hunt, use mission->{hunt_id} for direct lookups, add safer fallbacks that map hunt-only updates by the current attack target or by matching mission progress for single-entry updates, and remove legacy heuristics that used the last-killed mob for mapping or name selection. Progress logging now always uses quest_mission->{mob_name}. These changes improve robustness against servers sending hunt-only updates and avoid stale/incorrect last-kill metadata.
Track the last killed monster (nameID + timestamp) when actors die to help map hunt-only quest updates. Replace fragile packet-sequence and multiple heuristic fallbacks with a more deterministic mapping: prefer direct hunt/mob IDs, use a hunt_identifier, then match mission_index with exact and legacy (index-1) candidates, and log ambiguous mappings. Remove several legacy fallbacks (packet order, AI-target mapping, progress-based mapping) and the unused quest_update_seq state. Also simplify quest display triggering and tighten handling for server inconsistencies to make mission mapping more reliable (uses a 3s recent-kill window to disambiguate).
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.
Motivation
Servers may send ambiguous hunt mission updates (especially hunt-only packets with missing or unreliable identifiers).
This can lead to:
Description
This update keeps the robust hunt mapping work and addresses review feedback by tightening behavior in two places:
Single-entry hunt-only reconciliation
incoming mob_count == stored mob_count + 1Quest progress display naming
quest_mission->{mob_name}),instead of using current attack target name overrides.
quest listnaming and avoids transient naming mismatches.Logging behavior
Testing
perl -c src/Network/Receive.pmprove -lr t/