- Attacking monster when searching member
- Ignores party member named on the list
Sits and wait also available... See the documentation!
Download my <Src\Network\Receive.pm> to use modified hooks
Sorry, i haven't managed to get some time to work at this project too much...I will try to implement all u'r suggestions as soon as i can...
Wait4Party -- Author's Version
Code: Select all
########################################
# Wait4Party v1.5 -- Stick Together Team!
# ©2008 by Contrad
#
# This software is open source, licensed under the GNU General Public
# License, version 3.
# Basically, this means that you're allowed to modify and/or distribute
# this software. However, if you distribute modified versions, you MUST
# also distribute the source code.
# See <http://www.gnu.org/licenses/> for the full license.
#
# How to install :
# I uses self defined hooks instead of 'AI_pre' to reduce PC usage
# So u must copy my modified <Src\Network\Receive.pm> files or
# modify your own file.
# Else, just change the hooks to a single 'AI_pre' hook.
#
# How to use :
# <config.txt>
# wait4party (0|1) Wait4Party On or Off
# wait4party_sameMapOnly (0|1) Only activate if the party member are in the same map
# wait4party_waitBySitting (0|1) Don't search, just sit and wait
# wait4party_attackOnSearch (0{No}|1{Retaliate}|2{Yes})
# Attacking monster when searching member
# wait4party_ignore <list_of_names> Ignores party member named on the list
# LIST are separated by comma(,)
# wait4party_followSit (0|1) Sitting when party is sitting
# ATTENTION! Turn OFF 'followSitAuto' on slave or they'll sit forever!
#
# Anyway I use 'Bahasa' instead of 'English' to promote INDONESIA. :D
# U'r free to translate it.
package wait4party;
use Plugins;
use Globals;
use Utils::DataStructures qw(existsInList);
use Log qw(message error warning debug);
my $findParty;
my $followSit;
Plugins::register('Wait4Party', 'Tungguin anggota grup', \&unload, \&unload);
my $hooks = Plugins::addHooks( ['player_appeared', \&waitForOthers, undef],
['player_disappeared', \&waitForOthers, undef],
['party_share', \&waitForOthers, undef],
['party_move', \&waitForOthers, undef],
['actor_action_sit', \&waitForOthers, undef],
['actor_action_stand', \&waitForOthers, undef]);
# Use this if u don't want to modify your <Src\Network\Receive.pm> files
#my $hooks = Plugins::addHook('AI_pre', \&waitForOthers);
sub unload {
Plugins::delHook($hooks);
}
sub waitForOthers {
return if (AI::action eq "attack");
return unless $config{'wait4party'};
return unless defined @partyUsersID;
my $actor;
foreach (@partyUsersID) {
next if $_ eq "" || $_ eq $accountID;
$actor = $playersList->getByID($_);
next if existsInList($config{'wait4party_ignore'}, $actor->{name});
if(!$actor && $char->{'party'}{'users'}{$_}{'online'}) {
if ($config{'wait4party_waitBySitting'}) {
Commands::cmdSit() if !$char->{sitting};
if (!$findParty) {
warning "Party hilang - Duduk untuk tunggu anggota yang hilang.\n", "waitParty";
$findParty = $_;
}
return;
}
my %party;
$party{x} = $char->{party}{users}{$_}{pos}{x};
$party{y} = $char->{party}{users}{$_}{pos}{y};
($party{map}) = $char->{party}{users}{$_}{map} =~ /([\s\S]*)\.gat/;
if ($party{map} ne $field{name} || $party{x} == 0 || $party{y} == 0) {
return if $config{'wait4party_sameMapOnly'};
return unless Misc::timeOut($timeout{ai}{time},3);
delete $party{x};
delete $party{y};
}
return unless ($party{map} ne $field{name} || exists $party{x});
if ((exists $ai_v{party} && AI::distance(\%party, $ai_v{party}) > 15)
|| $party{map} != $ai_v{party}{map}
|| (AI::timeOut($ai_v{party}{time}, 15) && AI::distance(\%party, $char->{pos_to}) > $config{followDistanceMax})) {
$ai_v{party}{x} = $party{x};
$ai_v{party}{y} = $party{y};
$ai_v{party}{map} = $party{map};
$ai_v{party}{time} = time;
warning "Party hilang - Cari anggota yang hilang.\n", "waitParty";
if ($ai_v{party}{map} ne $field{name}) {
message "Mencari anggota grup: $ai_v{party}{map}\n", , "follow";
} elsif (AI::distance(\%party, $char->{pos_to}) > $config{followDistanceMax} ) {
message "Mencari anggota grup: $ai_v{party}{map} ($ai_v{party}{x},$ai_v{party}{y})\n", "follow";
} else {
return;
}
AI::clear("move", "route", "mapRoute");
AI::ai_route($ai_v{party}{map}, $ai_v{party}{x}, $ai_v{party}{y}, distFromGoal => $config{followDistanceMin}, attackOnRoute => $config{'wait4party_attackOnSearch'});
my $followIndex = AI::findAction("follow");
if (defined $followIndex) {
$ai_seq_args[$followIndex]{ai_follow_lost_end}{timeout} = $timeout{ai_follow_lost_end}{timeout};
}
}
$findParty = $_;
return;
} elsif ($findParty eq $_ && ($actor = $playersList->getByID($_))) {
Commands::cmdStand() if $char->{sitting};
warning "Party ditemukan.\n", "waitParty";
undef $findParty;
} elsif ($findParty && !$char->{'party'}{'users'}{$_}{'online'}) {
warning "Party sudah offline atau hilang.\n", "waitParty";
undef $findParty;
return;
}
if ($config{'wait4party_followSit'} && AI::action ne "sitAuto" && $actor) {
if ($actor->{sitting} && !$followSit) {
Commands::cmdSit();
warning "Party duduk.\n", "waitParty";
$followSit = 1;
} elsif (!$actor->{sitting} && $followSit) {
Commands::cmdStand();
warning "Party berdiri.\n", "waitParty";
undef $followSit;
}
}
}
}
1;
Open : Src/Network/Receive.pm
Search
Code: Select all
if ($mustAdd) {
if (UNIVERSAL::isa($actor, "Actor::Player")) {
$playersList->add($actor);
Code: Select all
Plugins::callHook('player_appeared',{player => $actor});
Code: Select all
sub party_exp {
my ($self, $args) = @_;
$char->{party}{share} = $args->{type};
if ($args->{type} == 0) {
message T("Party EXP set to Individual Take\n"), "party", 1;
} elsif ($args->{type} == 1) {
message T("Party EXP set to Even Share\n"), "party", 1;
} else {
error T("Error setting party option\n");
}
Code: Select all
Plugins::callHook('party_share');
Code: Select all
sub party_location {
my ($self, $args) = @_;
my $ID = $args->{ID};
$char->{party}{users}{$ID}{pos}{x} = $args->{x};
$char->{party}{users}{$ID}{pos}{y} = $args->{y};
$char->{party}{users}{$ID}{online} = 1;
debug "Party member location: $char->{party}{users}{$ID}{name} - $args->{x}, $args->{y}\n", "parseMsg";
Code: Select all
Plugins::callHook('party_move');
Code: Select all
} else {
message TF("%s is sitting.\n", getActorName($args->{sourceID})), 'parseMsg_statuslook', 2;
my $player = $playersList->getByID($args->{sourceID});
$player->{sitting} = 1 if ($player);
Code: Select all
$player->{sitting} = 1 if ($player);
Code: Select all
if ($player) {
$player->{sitting} = 1;
Plugins::callHook('actor_action_sit',{actor => $player});
}
Code: Select all
} else {
message TF("%s is standing.\n", getActorName($args->{sourceID})), 'parseMsg_statuslook', 2;
my $player = $playersList->getByID($args->{sourceID});
$player->{sitting} = 0 if ($player);
Code: Select all
$player->{sitting} = 0 if ($player);
Code: Select all
if ($player) {
$player->{sitting} = 0;
Plugins::callHook('actor_action_stand',{actor => $player});
}