Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package monFind;
- use Settings;
- use Plugins;
- use Globals;
- use Actor;
- use Task;
- use Utils::Win32;
- use Commands; # Commands::cmdUseSkill
- use Log qw(message); # debugger
- use utf8;
- Plugins::register("monFind", "", \&Unload, \&Reload);
- my $hooks = Plugins::addHooks(
- ['AI_post', \&default, undef]
- );
- ##### PLUGIN VARIABLES
- ##### SYSTEM METHODS
- sub Unload {
- foreach my $hook (@{$hooks}) {
- Plugins::delHook($hook);
- }
- undef @{$hooks};
- }
- sub Reload {
- &Unload;
- &debugger("Reload Successful");
- }
- ##### PLUGIN FEATURES
- # Add plugin information on screem
- sub debugger {
- my $datetime = localtime time;
- # use Data::Dumper;
- # message Dumper($_[0])."\n";
- message "[HAR] $datetime: $_[0].\n";
- }
- ##### PLUGIN BEHAVIOR
- sub default {
- my (undef, $args) = @_;
- my $ID = unpack("V1", $args->{ID});
- my %count;
- # get the avariable targets
- my $monsters = $Globals::monstersList->getItems();
- # setup the actors list
- foreach my $monster (@{$monsters}) {
- # type >= 100 : monster
- # hair_style != 0x64: not pet
- if ($monster->{type} >= 1000 and $monster->{hair_style} ne 0x64) {
- # count them by the ID
- $count{$monster->{binType}}++;
- }
- }
- # loop the actors list
- foreach my $k (keys %count) {
- # &debugger("key: $k / val: $count{$k}");
- # if target is: and the amount is greater than 1
- if($k == "1086" && $count{$k} < 1) {
- # alert
- Utils::Win32::playSound($config{"alertSound_death_play"});
- }
- else {
- # teleport
- main::useTeleport(1);
- }
- }
- }
- 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement