PDA

View Full Version : can openkore use warp portal skill


podidle33
7th December 2005, 19:18
its only just a thought if the skill warp portal can be used by the bot. like going to a specific location (e.i. GH, Lutie, Etc.)

but the bot can use it does it have a plug-in or you must put a command?

gachoman
8th December 2005, 08:21
yes. . . . .openkore can

ow ow plugin sha

podidle33
13th December 2005, 01:59
aww..damn a plugin... anyways i have search the ragnarok config files and its not there..where is it >_>

cris10
13th December 2005, 04:51
Try to search from the Forum of opnekore... if your REG try to read there you will see Plug-in for Warp Skill

gachoman
13th December 2005, 06:47
Plugin (PL file)

# autowarpn (completely new code by Joseph)
# licensed under gpl v2

package autowarpn;

use strict;
use Globals;
use Log qw(message);
use Utils;
use Network::Send;
use Misc;
use AI;

Plugins::register('autowarpn', 'Auto warp before walk to lockmap.', \&unload);

my $hooks = Plugins::addHooks(
['AI_pre', \&AI_hook],
['is_casting', \&casting_hook],
['parseMsg/pre', \&packet_hook],
);

sub unload {
Plugins::delHooks($hooks);
}

sub AI_hook {
#my $hookName = shift;

if ($config{lockMap} ne $field{name} &&
$ai_seq[0] eq "move" && $ai_seq[1] eq "route" && $ai_seq[2] eq "mapRoute" && $ai_seq[3] eq "" &&
existsInList($config{autoWarp_from}, $field{name}) &&
$char->{skills}{AL_WARP} && $char->{skills}{AL_WARP}{lv} > 0
) {
AI::queue("autowarp");
AI::args->{timeout} = 5;
AI::args->{time} = time;
AI::args->{map} = $field{name};
message "Preparing to cast a warp portal to $config{autoWarp_to}\n";
}

if (AI::action eq "autowarp") {
if ($field{name} ne AI::args->{map}) {
AI::dequeue;
return;
}
if (timeOut(AI::args)) {
my $pos = getEmptyPos($char, 4);
sendSkillUseLoc(\$remote_socket, 27, 4, $pos->{x}, $pos->{y});
stopAttack();
message "Attempting to open warp portal at $pos->{x} $pos->{y}\n";
AI::args->{timeout} = 15;
AI::args->{time} = time;
}
}
}

sub packet_hook {
my $hookName = shift;
my $args = shift;
my $switch = $args->{switch};
my $msg = $args->{msg};

if ($switch eq "011C") {
sendOpenWarp(\$remote_socket, $config{'autoWarp_to'}.".gat");
}
}

sub casting_hook {
my $hookName = shift;
my $args = shift;

# it's our warp portal! ok lets go in
if ($args->{sourceID} eq $accountID && $args->{skillID} eq 27) {
message "Moving into warp portal at $args->{x} $args->{y}\n";
main::ai_route($field{name}, $args->{x}, $args->{y},
noSitAuto => 1,
attackOnRoute => 0);
}
}

sub getEmptyPos {
my $obj = shift;
my $maxDist = shift;

# load info about everyone's location
my %pos;
for (my $i = 0; $i < @playersID; $i++) {
next if (!$playersID[$i]);
my $player = $players{$playersID[$i]};
$pos{$player->{pos_to}{x}}{$player->{pos_to}{y}} = 1;
}

# crazy algorithm i made for spiral scanning the area around you
# i wont bother to document it since im lazy and it already confuses me

my @vectors = (-1, 0, 1, 0);

my $vecx = int abs rand 4;
my $vecy = $vectors[$vecx] ? 2 * int(abs(rand(2))) + 1 : 2 * int(abs(rand(2)));

my ($posx, $posy);

for (my $i = 1; $i <= $maxDist; $i++) {
for (my $j = 0; $j < 4; $j++) {
$posx = $obj->{pos_to}{x} + ( $vectors[$vecx] * $i * -1) || ( ($i*2) /2 );
$posy = $obj->{pos_to}{y} + ( $vectors[$vecy] * $i * -1) || ( ($i*2) /-2 );
for (my $k = 0; $k < ($i*2); $k++) {
#debug "Checking $posx $posy $vecx $vecy $i\n";
if (checkFieldWalkable(\%field, $posx, $posy) && !$pos{$posx}{$posy}) {
my $pos = {x=>$posx, y=>$posy};
return $pos if checkLineWalkable($obj->{pos_to}, $pos);
}

$posx += $vectors[$vecx];
$posy += $vectors[$vecy];
}
$vecx = ($vecx+1)%4;
$vecy = ($vecy+1)%4;
}
}
return undef;
}


1;

config

autoWarp_from <---------where you're currently warping from
autoWarp_to <-------to where you're going

note:

COMPLETE THANKS AND CREDITS GO TO JOSEPH OF OPENKORE FORUMS AND OPENKORE FORUM ITSELF. . . .U GUYS ROCK!

podidle33
17th January 2006, 03:00
can you set the number of cells where you can place your warp here???

gachoman
17th January 2006, 05:54
no. . . . if u want that u'll have to use the one using a macro. . . . kase un mas concise u can set ur warp where u want. . . eto ata warp agad then go. . . . .u have no control over the coords it places its warps

rubentan
17th January 2006, 14:49
Next tym read and search.. it has been here for a long time...
-Closed