Follow Party LockMap

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
d3fc0n
Noob
Noob
Posts: 9
Joined: 04 Apr 2008, 13:34

Follow Party LockMap

#1 Post by d3fc0n »

working on SVN 2.0.5

follow only target map.

config.txt
followParty <0|1>
followPartyTarget <name>
partylockmap.pl

Code: Select all

#########################################################################
# This software is open source, licensed under the GNU General Public
# License, version 2.
# Basically, this means that you're allowed to modify and distribute
# this software. However, if you distribute modified versions, you MUST
# also distribute the source code.
# See http://www.gnu.org/licenses/gpl.html for the full license.
#########################################################################
# Party LockMap (fixed)
# d3fc0n 10/03/2008
#########################################################################

package partylockmap;

use strict;
use Plugins;
use Globals qw($accountID %config $char @partyUsersID);
use Log qw(message);

my $lockMap;

Plugins::register('partylockmap', 'Follow Party LockMap', \&on_unload);

my $hooks = Plugins::addHooks(
		['AI_pre', \&ai_pre, undef]
	);

sub on_unload {
	Plugins::delHooks($hooks);
	undef $lockMap;
}

sub ai_pre {
	if  ($char->{'party'} && $config{followParty}) {
		for (my $i = 0; $i < @partyUsersID; $i++) {
			next if ($partyUsersID[$i] eq "");
			next if ($partyUsersID[$i] eq $accountID);
			next if (!$char->{'party'}{'users'}{$partyUsersID[$i]}{'online'});
			next if ($char->{'party'}{'users'}{$partyUsersID[$i]}{'name'} ne $config{followPartyTarget});
			my ($lockMap) = $char->{'party'}{'users'}{$partyUsersID[$i]}{'map'} =~ /([\s\S]*)\.gat/;
			if ($lockMap ne $config{lockMap}) {
				message "[partylockmap] Changing lockMap to ". $lockMap. " (was ". $config{lockMap}. ").\n","system";
				$config{lockMap} = $lockMap;
			}
			return;
		}
	}
}

return 1;
sorry for my eng. i'm just another thailander.