refactor(route): improve k-step npc dialog flow in auto-talk and map routing#4194
Open
boscv wants to merge 3 commits intoOpenKore:masterfrom
Open
refactor(route): improve k-step npc dialog flow in auto-talk and map routing#4194boscv wants to merge 3 commits intoOpenKore:masterfrom
boscv wants to merge 3 commits intoOpenKore:masterfrom
Conversation
Refactor NPC auto-talk and portal-approach logic and update portal table. - Misc.pm: Consolidate route-check logic and add helpers (_routeActionHasTalkNpcSubtask, resolveAutoNpcTalkSequence, _stripLeadingPortalApproachStep). Auto-created TalkNPC tasks now receive a resolved conversation sequence and improved debug output. - Task/MapRoute.pm: Add _npcRouteDistancesFromSteps to detect a leading 'k' (direct approach) and compute route/dist-from-goal and talk-trigger distances. Use these values when queuing Route tasks and when deciding to initiate NPC interaction; improve debug messages. - Task/TalkNPC.pm: If an active conversation started (leading 'k' step), drop the initial 'k' step from the task steps to avoid duplicating input. - tables/ROla/portals.txt: Normalize header, comment out many unused/inexistent entries for ROla, and add updated Kafra/Zonda and New World warp entries for the server. These changes ensure correct handling of portal-approach sequences (especially leading 'k' portal conversations), avoid duplicate talk actions, and provide updated portal mappings for the ROla server.
k (approach + talk), so routing and auto-talk remain consistent and avoid duplicate TalkNPC flows. ## Changes - Refactored autoNpcTalk in src/Misc.pm to: - replace ad-hoc route checks with _routeActionHasTalkNpcSubtask. - resolve sequence from active mapRoute/route through resolveAutoNpcTalkSequence. - strip the leading k approach step when appropriate before creating Task::TalkNPC. - Added _npcRouteDistancesFromSteps in src/Task/MapRoute.pm and applied it to NPC/airship routing: - derive distFromGoal and talk-trigger distance from route steps. - for k-prefixed sequences, require exact-tile approach (distFromGoal = 0, talk trigger distance = 0). - Updated src/Task/TalkNPC.pm to drop a leading k when conversation is already active with the expected NPC, preventing repeated approach logic in an already-open dialog.Parse optional airship wait_area from portals_airship entries and store as x1/x2/y1/y2 on portal dests. Propagate wait_area through CalcMapRoute so route nodes include it. In MapRoute add helpers (_isInsideWaitArea, _pickAirshipWaitPos), use isCellOccupied, and implement logic to move the actor into a random free/walkable cell inside the wait area while waiting for the airship broadcast; keep backwards compatibility for legacy quoted steps. Also adjust plugin retry/error handling and update portal table files to include wait_area coordinates and reorganize some airship entries.
alisonrag
approved these changes
Mar 24, 2026
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
MapRoutetask can move the actor into a free cell in the wait area and wait for the expected broadcast before initiating NPC conversation.k(approach + talk), so routing and auto-talk remain consistent and avoid duplicateTalkNPCflows.Description
parsePortalsAirshipto accept an optional"x1-x2,y1-y2"wait area and populatewait_areaon parsed portal entries, while preserving backwards compatibility with legacy quotedstepsvalues.wait_areainto route calculation by addingwait_areato openlist/closelist values inTask::CalcMapRoute, so map solutions carry wait-area metadata._isInsideWaitAreaand_pickAirshipWaitPoshelpers (withisCellOccupied) inTask::MapRouteto pick a random unoccupied, walkable cell inside the wait area and route there before waiting for broadcast.Task::MapRouteairship handling to:airship_message;steps).wait_area, markwait_area_positionedimmediately instead of trying to pick a different cell;autoNpcTalkinsrc/Misc.pmto:_routeActionHasTalkNpcSubtask;mapRoute/routethroughresolveAutoNpcTalkSequence;kapproach step when appropriate before creatingTask::TalkNPC._npcRouteDistancesFromStepsinsrc/Task/MapRoute.pmand apply it to NPC/airship routing:distFromGoaland talk-trigger distance from routesteps;k-prefixed sequences, require exact-tile approach (distFromGoal = 0, talk trigger distance =0).src/Task/TalkNPC.pmto drop a leadingkwhen conversation is already active with the expected NPC, preventing repeated approach logic in an already-open dialog.npc_airship_teleport_missing.tables/portals_airship.txtandtables/ROla/portals_airship.txt, including the wait-area parameter.