Skip to content

fix(quest): use mission-state names and refine single-entry hunt slot matching#4205

Closed
boscv wants to merge 6 commits intoOpenKore:masterfrom
boscv:monstersQuestList
Closed

fix(quest): use mission-state names and refine single-entry hunt slot matching#4205
boscv wants to merge 6 commits intoOpenKore:masterfrom
boscv:monstersQuestList

Conversation

@boscv
Copy link
Copy Markdown
Contributor

@boscv boscv commented Apr 6, 2026

Motivation

Servers may send ambiguous hunt mission updates (especially hunt-only packets with missing or unreliable identifiers).
This can lead to:

  • progress being mapped to the wrong mission slot, and
  • inconsistent progress output names when transient combat target data is used.

Description

This update keeps the robust hunt mapping work and addresses review feedback by tightening behavior in two places:

  • Single-entry hunt-only reconciliation

    • For hunt-only packets with a single mission entry, mission slot selection now prefers a unique progress match where:
      • incoming mob_count == stored mob_count + 1
    • When exactly one slot satisfies this condition, that slot is selected.
  • Quest progress display naming

    • Progress output now consistently uses the mission name stored in quest state (quest_mission->{mob_name}),
      instead of using current attack target name overrides.
    • This aligns progress logs with quest list naming and avoids transient naming mismatches.
  • Logging behavior

    • Existing reduced-chatter behavior is preserved: progress is shown for single-entry packets or when mission state changes.

Testing

  • perl -c src/Network/Receive.pm
  • prove -lr t/

boscv added 5 commits April 1, 2026 17:52
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.
@boscv boscv marked this pull request as draft April 6, 2026 23:05
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).
@boscv boscv closed this Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant