like the name. just waypoint walking on lockmap.
oh!!, i found parseUltimate in FileParsers. that's great fileparser function !!
all wap files go in waypoints folder. wap name format is mapname.wap like prontera.wap or prt_fild05.wap
wap file format
Code: Select all
[option]
#walkMode [0 = restart mode | 1 = reverse mode]
walkMode 1
[waypoint]
308:262
263:279
218:274
185:268
155:279
125:272
101:250
73:232
53:211
59:180
100:175
146:226
91:206
152:253
176:237
239:247
295:244
319:196
310:137
314:67
232:54
142:47
56:58
73:87
68:146
117:141
138:101
163:127
212:126
140:159
186:184
229:140
270:146
298:172
280:221
262:179
241:163
211:219
Code: Select all
#########################################################################
# This software is open source, licensed under the GNU General Public
# License, version 2.
# Basically, this means that you're allowed to modify and distribute
# this software. However, if you distribute modified versions, you MUST
# also distribute the source code.
# See http://www.gnu.org/licenses/gpl.html for the full license.
#########################################################################
# Lockmap Waypoint (initial)
# d3fc0n 24/04/2008
#########################################################################
package waypoint;
use strict;
use Plugins;
use AI;
use Globals qw($char %config $conState %field);
use FileParsers qw(processUltimate);
use Log qw(message error);
Plugins::register('waypoint', 'Lockmap Waypoint.', \&on_unload);
my $hooks = Plugins::addHooks(
['AI_pre', \&AI_pre, undef]
);
sub on_unload {
Plugins::delHook($hooks);
}
sub AI_pre {
return unless ($conState == 5);
if (AI::isIdle && (!$char->{homunculus} || AI::Homunculus::isIdle()) && $field{name} eq $config{lockMap}) {
if (-e "waypoints/$field{name}.wap") {
message "[lockmapwp] $field{name}.wap found.\n", "system";
my %args;
processUltimate("waypoints/$field{name}.wap", \%args, {waypoint => 'list'});
AI::queue('waypoint', \%args);
}
} elsif (AI::action eq 'waypoint') {
if ($field{name} ne $config{lockMap}) {
AI::dequeue();
return;
}
my $args = AI::args;
if (!defined ${$args->{option}}{step}) {
${$args->{option}}{step} = 0;
${$args->{option}}{mode} = 0;
message "[lockmapwp] initial waypoint.\n", "system";
}
if (!defined ${$args->{waypoint}}[${$args->{option}}{step}]) {
if (${$args->{option}}{walkMode} eq "0") {
${$args->{option}}{step} = 0;
message "[lockmapwp] restart waypoint.\n", "system";
} else {
if (${$args->{option}}{mode} == 1) {
${$args->{option}}{mode} = 0;
${$args->{option}}{step} = 0;
message "[lockmapwp] reverse waypoint.\n", "system";
} else {
${$args->{option}}{mode} = 1;
${$args->{option}}{step}--;
message "[lockmapwp] reverse waypoint.\n", "system";
}
}
}
my @point = split /:/, ${$args->{waypoint}}[${$args->{option}}{step}];
if (@point == 2) {
message "[lockmapwp] routing to $point[0]:$point[1].\n", "system";
ai_route(
$field{name},
$point[0],
$point[1],
attackOnRoute => $config{attackAuto},
maxRouteTime => $config{route_randomWalk_maxRouteTime},
noMapRoute => 1
);
if (${$args->{option}}{mode} == 0) {
${$args->{option}}{step}++;
} else {
${$args->{option}}{step}--;
}
}
}
}
return 1;