thanks in advance...
original plugin
Code: Select all
package locationSkill;
#
# Based on the suggestions by pmak
# This plugin is licensed under the GNU GPL
# Copyright 2005 by kaliwanagan
# --------------------------------------------------
use strict;
use Plugins;
use Globals;
use Log qw(message warning error);
use AI;
use Skills;
Plugins::register('locationSkill', 'cast skill at a certain location', \&Unload);
my $hook1 = Plugins::addHook('AI_post', \&call);
my $hook2 = Plugins::addHook('packet_skilluse', \&packet_skilluse);
sub Unload {
Plugins::delHook('packet_skilluse', $hook2);
Plugins::delHook('AI_post', $hook1);
}
my %skillUse;
my %delay;
sub packet_skilluse {
my (undef, $args) = @_;
my $skillID = $args->{'skillID'};
my $sourceID = $args->{'sourceID'};
my $x = $args->{'x'};
my $y = $args->{'y'};
if ($sourceID eq $accountID) {
$skillUse{$skillID} = 1;
}
}
sub call {
if (AI::action eq 'locationSkill') {
my $args = AI::args;
if ($args->{'stage'} eq 'end') {
AI::dequeue;
} elsif ($args->{'stage'} eq 'skillUse') {
main::ai_skillUse(
$args->{'handle'},
$args->{'lvl'},
$args->{'maxCastTime'},
$args->{'minCastTime'},
$args->{'x'}, $args->{'y'}
);
$args->{'stage'} = 'end';
}
}
locationSkill() if (AI::isIdle);
}
sub locationSkill {
my $prefix = "locationSkill_";
my $i = 0;
while (exists $config{$prefix.$i}) {
if ((main::checkSelfCondition($prefix.$i)) &&
main::timeOut($delay{$prefix.$i."_blockDelayBeforeUse"}) &&
main::timeOut($delay{$prefix.$i."_blockDelayAfterUse"})
) {
my $skillObj = Skills->new(name => $config{$prefix.$i});
unless ($skillObj->handle) {
my $msg = "Unknown skill name ".$config{$prefix.$i}." in $prefix.$i\n";
error $msg;
configModify($prefix.$i."_disabled", 1);
next;
}
my %skill;
($skill{'x'}, $skill{'y'}, my $map) = split / *, */, $config{$prefix.$i."_coords"};
my $pos = main::calcPosition($char);
$skill{'x'} = $skill{'x'} || $pos->{'x'};
$skill{'y'} = $skill{'y'} || $pos->{'y'};
$delay{$prefix.$i."_blockDelayBeforeUse"}{'timeout'} = $config{$prefix.$i."_blockDelayBeforeUse"};
if (!$delay{$prefix.$i."_blockDelayBeforeUse"}{'set'}) {
$delay{$prefix.$i."_blockDelayBeforeUse"}{'time'} = time;
$delay{$prefix.$i."_blockDelayBeforeUse"}{'set'} = 1;
}
$delay{$prefix.$skillObj->handle."_skillDelay"}{'timeout'} = $config{$prefix.$i."_skillDelay"};
if ($skillUse{$skillObj->id}) { # set the delays only when the skill gets successfully cast
$delay{$prefix.$skillObj->handle."_skillDelay"}{'time'} = time;
$skillUse{$skillObj->id} = 0;
}
my %range;
($range{'x'}, $range{'y'}, $range{'range'}) = split / *, */, $config{$prefix.$i."_whenAtCoords"};
my $inRange;
$inRange = (($pos->{'x'} <= ($range{'x'} + $range{'range'})) &&
($pos->{'x'} >= ($range{'x'} - $range{'range'})) &&
($pos->{'y'} <= ($range{'y'} + $range{'range'})) &&
($pos->{'y'} >= ($range{'y'} - $range{'range'})));
undef %range;
if ((checkCoordsCondition($prefix.$i."_coords",\%skill)) &&
main::timeOut($delay{$prefix.$skillObj->handle."_skillDelay"}) &&
(($inRange || (!$config{$prefix.$i."_whenAtCoords"}))) &&
(($map eq $field{'name'}) || !$map)
) {
$skill{'handle'} = $skillObj->handle;
$skill{'lvl'} = ($config{$prefix.$i."_lvl"}) || 10;
$skill{'maxCastTime'} = $config{$prefix.$i."_maxCastTime"};
$skill{'minCastTime'} = $config{$prefix.$i."_minCastTime"};
$skill{'stage'} = 'skillUse';
AI::queue('locationSkill', \%skill);
$delay{$prefix.$i."_blockDelayAfterUse"}{'timeout'} = $config{$prefix.$i."_blockDelayAfterUse"};
$delay{$prefix.$i."_blockDelayAfterUse"}{'time'} = time;
$delay{$prefix.$i."_blockDelayBeforeUse"}{'set'} = 0;
last;
}
}
$i++;
}
}
sub checkCoordsCondition {
my $prefix = shift;
my $coord = shift;
if ($config{$prefix."_whenGround"}) {
return 0 unless main::whenGroundStatus($coord, $config{$prefix."_whenGround"});
}
if ($config{$prefix."_whenNotGround"}) {
return 0 if main::whenGroundStatus($coord, $config{$prefix."_whenNotGround"});
}
return 1;
}
return 1;
Code: Select all
*** OpenKore what-will-become-2.1 ( r7622 ) - Custom Ragnarok Online client ***
*** http://www.openkore.com/ ***
Loading all plugins...
Loading plugin plugins/locationSkill.pl...
This plugin cannot be loaded because of a problem in the plugin. Please notify
the plugin's author about this problem, or remove the plugin so OpenKore can
start.
The error message is:
Plugin contains syntax errors:
Can't locate Skills.pm in @INC (@INC contains: src src/deps C:openkore/src/deps C:/openkore/src
C:/openkore .) at C:/openkore/plugins/locationSkill.pl line 14.
BEGIN failed--compilation aborted at C:/Documents and
Settings/BEP/Desktop/HW/plugins/locationSkill.pl line 14.
Press ENTER to exit this program.
Code: Select all
use Skills;
Code: Select all
use Skill;
Code: Select all
*** OpenKore what-will-become-2.1 ( r7622 ) - Custom Ragnarok Online client ***
*** http://www.openkore.com/ ***
Loading all plugins...
Loading plugin plugins/locationSkill.pl...
Variable "%field" is not imported at C:openkore/plugins/locationSkill.pl line 106.
This plugin cannot be loaded because of a problem in the plugin. Please notify
the plugin's author about this problem, or remove the plugin so OpenKore can
start.
The error message is:
Plugin contains syntax errors:
Global symbol "%field" requires explicit package name at C:/openkore/plugins/locationSkill.pl line 106.
Press ENTER to exit this program.