Atm all it does is adding a condition for the players level
and a condition for guildtitle, but feel free to add more conditions and share.
Got suggestions to improve the code/to add more features? Just post em up.
Code: Select all
# checkExtraCondition by Technology
#
# $Id: checkExtraCondition.pl 6603 2008-11-21 16:48:56Z Technology $
#
# This source code is licensed under the
# GNU General Public License, Version 2.
# See http://www.gnu.org/licenses/gpl.html
package checkExtraCondition;
use strict;
use Plugins;
use Globals qw(%config $char);
use Utils qw(inRange);
use Utils::DataStructures qw(existsInList);
use Log qw(message error warning debug);
Plugins::register('checkExtraCondition', 'check extra conditions', \&onUnload);
my $hooks = Plugins::addHooks(
['checkSelfCondition', \&checkSelfCondition, undef],
['checkPlayerCondition', \&checkPlayerCondition, undef],
['checkMonsterCondition', \&checkMonsterCondition, undef],
);
sub onUnload {
Plugins::delHooks($hooks);
}
sub checkSelfCondition {
my ($self, $args) = @_;
my $prefix = $args->{prefix};
# conditions
($args->{return} = 0) unless (
checkActorLevel($prefix, $char) &&
checkActorGuildTitle($prefix, $char)
);
debug ("self: $args->{return}\n"), "checkExtraCondition";
}
sub checkPlayerCondition {
my ($self, $args) = @_;
my $prefix = $args->{prefix};
my $player = $args->{player};
# conditions
($args->{return} = 0) unless (
checkActorLevel($prefix, $player) &&
checkActorGuildTitle($prefix, $player)
);
debug ("player: $args->{return}\n"), "checkExtraCondition";
}
sub checkMonsterCondition {
my ($self, $args) = @_;
my $prefix = $args->{prefix};
my $player = $args->{monster};
# conditions
debug ("monster: $args->{return}\n"), "checkExtraCondition";
}
#######################################
#######################################
### CONDITION FUNCTIONS
#######################################
#######################################
sub checkActorLevel {
my ($prefix, $actor) = @_;
if ($config{$prefix . "_blvl"}) { return 0 unless inRange($actor->{lv}, $config{$prefix."_blvl"}); }
else { return 1 }
}
sub checkActorGuildTitle {
my ($prefix, $actor) = @_;
if ($config{$prefix."_isGuildTitle"}) { return 0 unless ($actor->{guild} && existsInList($config{$prefix . "_isGuildTitle"}, $actor->{guild}{title})); }
else { return 1 }
}
return 1;
Code: Select all
partySkill Spirit of Rebirth {
lvl 5
target_isJob High Novice, High Swordsman, High Magician, High Archer, High Acolyte, High Merchant, High Thief
target_whenStatusInactive Spirit
target_blvl <= 50
target_isGuild guildname
target_isGuildTitle guildtitle
}