Code: Select all
[pay_dun01]
126,214
201,130
251,145
[moc_pryd01]
132,131
213,211
43,137
150,122
23,50Code: Select all
use Plugins;
use Global qw(%config);
use Commands qw(cmdMove);
Plugins::register('Waypoints', 'POC waypoint implementation.', undef);
my $hooks = Plugins::addHooks(
['start3', \&onLoad, undef],
['in_game', \&waypoint, undef],
['Network::Receive::map_changed', \&waypoint, undef]
);
our %waypoints;
sub onLoad {
my $section;
open WP, "<waypoints.txt" or die $!;
while (my $line = <WP>) {
next if ($line =~ /^#/);
$line =~ s/[\r\n]//g;
$line =~ s/\s+$//g;
next if ($line eq "");
if ($line =~ /^\[(.*)\]$/i) {
$section = $1;
$waypoints{$section} = ()
next;
} else {
if ($line =~ /(\d),(\d)/) {
push @waypoints{$section}, ($1, $2)
}
}
}
}
sub waypoint {
if ($config{waypoints} == 1) {
if (!defined $config{waypoints_pause}) {
$config{waypoints_pause} = 5000;
} else {
$config{waypoints_pause} = $config{waypoints_pause} * 1000;
}
if (defined $waypoints{$char{map}}) {
foreach (@waypoints{$char{map}}) {
cmdMove("$_[0] $_[1]");
sleep $config{waypoints_pause};
}
} else {
return;
}
}
}