waitForParty -- Don't get separeted! by Chontrad

Other plugins for extending OpenKore's functionality. This forum is only for posting new plugins and commenting on existing plugins. For support, use the Support forum.

Moderator: Moderators

Message
Author
Chontrad
Human
Human
Posts: 30
Joined: 23 Apr 2008, 10:11
Noob?: No
Location: Indonesia TANAH AIRKU
Contact:

Added Some Features! Author's Version

#61 Post by Chontrad »

Updated a little:
- 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;
Hooks Modify
Open : Src/Network/Receive.pm

Search

Code: Select all

	if ($mustAdd) {
		if (UNIVERSAL::isa($actor, "Actor::Player")) {
			$playersList->add($actor);
Add below

Code: Select all

			Plugins::callHook('player_appeared',{player => $actor});
Search

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");
	}
Add below

Code: Select all

	Plugins::callHook('party_share');
Search

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";
Add below

Code: Select all

	Plugins::callHook('party_move');
Search

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);
Edit

Code: Select all

			$player->{sitting} = 1 if ($player);
to

Code: Select all

			if ($player) {
				$player->{sitting} = 1;
				Plugins::callHook('actor_action_sit',{actor => $player});
			}
Search

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);
Edit

Code: Select all

			$player->{sitting} = 0 if ($player);
to

Code: Select all

			if ($player) {
				$player->{sitting} = 0;
				Plugins::callHook('actor_action_stand',{actor => $player});
			}
A very special thanks to Mucilon for taking care of these... ;)
Last edited by Chontrad on 03 Feb 2009, 12:31, edited 1 time in total.

Ni4-Spawn
Noob
Noob
Posts: 4
Joined: 08 Dec 2008, 10:15
Noob?: Yes

Re: waitForParty -- Don't get separeted! by Chontrad

#62 Post by Ni4-Spawn »

Man, im very greatfull for this update. Thx for implementing what i asked! it will help me so much! : x

Ni4-Spawn
Noob
Noob
Posts: 4
Joined: 08 Dec 2008, 10:15
Noob?: Yes

Re: waitForParty -- Don't get separeted! by Chontrad

#63 Post by Ni4-Spawn »

I got an error on line 65 : p

Anyone knows what it could be ?
Appears a red msg when my kore log in, and ask me to ENTER to exit.
Error on line 65 of Wait4Party.pl

chantling
Noob
Noob
Posts: 1
Joined: 18 Jan 2009, 22:07
Noob?: Yes

Re: waitForParty -- Don't get separeted! by Chontrad

#64 Post by chantling »

Change:

Code: Select all

next if existsInList($config{'wait4party_ignore'}, $actor->{name});
to:

Code: Select all

next if Utils::existsInList($config{'wait4party_ignore'}, $actor->{name});

Chontrad
Human
Human
Posts: 30
Joined: 23 Apr 2008, 10:11
Noob?: No
Location: Indonesia TANAH AIRKU
Contact:

Re: waitForParty -- Don't get separeted! by Chontrad

#65 Post by Chontrad »

Fixed! Sorry my fault... :oops:

ark_beetle
Noob
Noob
Posts: 3
Joined: 09 Feb 2009, 09:45
Noob?: No

Re: waitForParty -- Don't get separeted! by Chontrad

#66 Post by ark_beetle »

I got this error
Image
can anyone help me? thanks before

zly_guy
Noob
Noob
Posts: 1
Joined: 25 Jan 2009, 06:55
Noob?: Yes

Re: waitForParty -- Don't get separeted! by Chontrad

#67 Post by zly_guy »

What does it mean ??? Please help ...
Attachments
Please, help fix this ... &gt;.&lt;
Please, help fix this ... >.<

Ni4-Spawn
Noob
Noob
Posts: 4
Joined: 08 Dec 2008, 10:15
Noob?: Yes

Re: waitForParty -- Don't get separeted! by Chontrad

#68 Post by Ni4-Spawn »

This plugin, with the last changes like attackonsearchparty, is not working with openkore 2.0.7 and the new version of macro plugin on bibian site.

Can someone fix it ?

There is no msg of error or something, but it just dont work.

popcorn
Noob
Noob
Posts: 3
Joined: 23 Mar 2009, 09:02
Noob?: No

Re: waitForParty -- Don't get separeted! by Chontrad

#69 Post by popcorn »

I try to use this WaitParty code (on the first page)
http://forums.openkore.com/download/file.php?id=580
but seems like having some problem.
My party have 1 melee and 4 priest to follow, and i'm not sure why it keep receive spam message of
Party Found.
Calculating random route to
and it stuck there. This spam come out when 1 of the priest is out of master bot's sight, the master bot will stuck there keep printing the error message and when i move the lost priest back to him then he continue move.
Party Found.
Calculating random route to: Lighthalzen Field(lhz_fild01): 243, 96
Party Found.
Calculating random route to: Lighthalzen Field(lhz_fild01): 299, 244
Party Found.
Party is far way.
Searching party: lhz_fild01 (151,56)
Party Found.
Calculating random route to: Lighthalzen Field(lhz_fild01): 289, 294
Party Found.
Calculating random route to: Lighthalzen Field(lhz_fild01): 89, 186
Party Found.
Calculating random route to: Lighthalzen Field(lhz_fild01): 197, 342
Party Found.
Calculating random route to: Lighthalzen Field(lhz_fild01): 307, 175
Party Found.
My configure is

Code: Select all

follow_wait 1
follow_wait_inLockOnly 1
follow_wait_timeOut 30
follow_wait_noPartyMember
with openkore version 2.0.6

wschew
Noob
Noob
Posts: 2
Joined: 06 Feb 2009, 08:03
Noob?: Yes

Re: waitForParty -- Don't get separeted! by Chontrad

#70 Post by wschew »

the links for downloading the pl and pm files are not working... can someone fix them?

Post Reply