The Scenario:
When my role routes from ama_in02 into ama_dun01 or from ama_dun01 back to ama_in02 with npc-talking portal,
it ("MapRoute" task) make disconnection from Map server.
What Happen:
The iterate of MapRoute is more fast then Map Wrap !
Or, I can say that
The "close" of NPC-Talking subtask is too quickly than Map Wrap !
After my tracing as following :
(I has simplized the tracing messages. The "...." indents are tracing messages):
士兵#10: 那麼,我就幫你打開門了
士兵#10: 千萬好好保重囉...
士兵#10: Done talking
.......Sent 士兵#10: Done talking
.......Sent talk cancel: 1A CC 00 00
Done talking with 士兵#10.
.......Target NPC Not Started !
.......Target NPC 士兵#10 at (115,177) found.
.......Sent look: 3
.......Sent talk: 1A CC 00 00
Map Change: ama_dun01.gat (229, 10)
.......Sending Map Loaded
.......Checking for new portals...
.......No source portal found.
Done talking with 士兵#10.
.......Map Router has finished traversing the map solution
Calculating random route to: 榻榻米 迷宮 (ama_dun01): 220, 228
.......You on route to: 榻榻米 迷宮(ama_dun01): 220, 228
Disconnected from Map Server, connecting to Account Server in 30 seconds...
The black is the normal console messages.
The green is the ending of first TalkNPC subtask for npc-taliking portal.
The red is the starting of second TalkNPC subtask for npc-taliking portal and the disconnection message.
The blue is the random route after map wrap.
You can see that the "Map Change" is between two "Done talking"'s.
Because, it (iterate of MapRoute) is too fast, it re-generate a New TalkNPC subtask before the complete of "Map Change".
So, the second TalkNPC subtask make opnekore to disconect from Map server.
My solution is to add a timeOut check (2 seconds) for the "close" of npc-talking. As following:
Original Code in src/Task/MapRoute.pm:
Code: Select all
......
if ( $self->{substage} eq 'Waiting for Warp' ) {
$self->{timeout} = time unless $self->{timeout};
if (timeOut($self->{timeout}, $timeout{ai_route_npcTalk}{timeout} || 10)
|| $ai_v{npc_talk}{talk} eq 'close') {
# We waited for 10 seconds and got nothing
delete $self->{substage};
delete $self->{timeout};
if (++$self->{mapSolution}[0]{retry} >= ($config{route_maxNpcTries} || 5)) {
# NPC sequence is a failure
# We delete that portal and try again
delete $portals_lut{"$self->{mapSolution}[0]{map} $self->{mapSolution}[0]{pos}{x} $self->{mapSolution}[0]{pos}{y}"};
warning TF("Unable to talk to NPC at %s (%s,%s).\n", $field->baseName, $self->{mapSolution}[0]{pos}{x}, $self->{mapSolution}[0]{pos}{y}), "route";
$self->initMapCalculator(); # redo MAP router
}
}
......
Code: Select all
......
if ( $self->{substage} eq 'Waiting for Warp' ) {
$self->{timeout} = time unless $self->{timeout};
if (timeOut($self->{timeout}, $timeout{ai_route_npcTalk}{timeout} || 10)
|| (($ai_v{npc_talk}{talk} eq 'close') && (timeOut($self->{timeout}, 2)))) {
# We waited for 10 seconds and got nothing
delete $self->{substage};
delete $self->{timeout};
if (++$self->{mapSolution}[0]{retry} >= ($config{route_maxNpcTries} || 5)) {
# NPC sequence is a failure
# We delete that portal and try again
delete $portals_lut{"$self->{mapSolution}[0]{map} $self->{mapSolution}[0]{pos}{x} $self->{mapSolution}[0]{pos}{y}"};
warning TF("Unable to talk to NPC at %s (%s,%s).\n", $field->baseName, $self->{mapSolution}[0]{pos}{x}, $self->{mapSolution}[0]{pos}{y}), "route";
$self->initMapCalculator(); # redo MAP router
}
}
......
There should be a better solution than this.
Or
There should be better solutions than this.