Code: Select all
#------------------------------------------------------------
# Geographer plugin - OpenKore Team
#
# Prohibit attacking a geographer:
# + healed by another one
# + situated too close to another one
# Stop attacking monsters under above circumstances
# (prohibit to attack means setting up null damage from kore
# and 1 damage from player (from kore's id))
#------------------------------------------------------------
package geographer;
use strict;
use Globals;
use Log;
use Misc;
use Plugins;
use Utils;
Plugins::register("geographer", "Reaction on two close geographers", \&Unload);
my $hooks = Plugins::addHooks(
["AI_pre",\&positionReact, undef],
["packet/skill_cast", \&healReact, undef],
["packet/skill_used_no_damage", \&healReact, undef]);
sub positionReact {
foreach (@monstersID) {
my $monster = $monsters{$_};
if ($monster->{type} == 1368 && !$monster->{dmgFromPlayer}) {
foreach my $mobCopy (@monstersID) {
my $monsterCopy = $monsters{$mobCopy};
if ($monsterCopy->{type} == 1368) {
if ($monster->{ID} ne $monsterCopy->{ID}) {
if (distance($monster->{pos},$monsterCopy->{pos}) <= 10) {
prohibitAttacking($monster);
prohibitAttacking($monsterCopy);
last;
}
}
}
}
}
}
}
sub healReact {
# After cast, not before
my $monsterS = $monsters{@_[1]->{sourceID}};
my $monsterO = $monsters{@_[1]->{targetID}};
if(!$monsterO
|| @_[1]->{skillID} != 28
|| $monsterO->{type} != 1368) {
return;
}
prohibitAttacking($monsterO);
if ($monsterS->{type} == 1368) {
prohibitAttacking($monsterS);
}
}
sub prohibitAttacking {
undef @_[0]->{dmgFromYou};
undef @_[0]->{missedFromYou};
@_[0]->{dmgFromPlayer}{$char->{ID}} = 1;
if (AI::action eq "attack" && AI::args()->{ID} eq @_[0]->{ID}) {
AI::dequeue;
stopAttack();
}
}
sub Unload {
Plugins::delHooks($hooks);
}
1;
Code: Select all
Undefined subroutine &geographer::stopAttack called at /plugins/geographer.pl line 66.
Stack trace:
Undefined subroutine &geographer::stopAttack called at /plugins/geographer.pl line 66.
at /plugins/geographer.pl line 66
geographer::prohibitAttacking('Actor::Monster=HASH(0x4985624)') called at /plugins/geographer.pl line 37
geographer::positionReact('AI_pre', undef, undef) called at src/Plugins.pm line 431
Plugins::callHook('AI_pre') called at src/AI/CoreLogic.pm line 112
AI::CoreLogic::iterate() called at src/functions.pl line 736
main::mainLoop_initialized() called at src/functions.pl line 69
main::mainLoop() called at src/Interface.pm line 75
Interface::mainLoop('Interface::Console::Win32=HASH(0x126f8bc)') called at openkore.pl line 97
main::__start() called at start.pl line 129
Died at this line:
AI::dequeue;
stopAttack();
}