Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. package monFind;
  2.  
  3. use Settings;
  4. use Plugins;
  5. use Globals;
  6. use Actor;
  7. use Task;
  8. use Utils::Win32;
  9. use Commands; # Commands::cmdUseSkill
  10. use Log qw(message); # debugger
  11.  
  12. use utf8;
  13.  
  14. Plugins::register("monFind", "", \&Unload, \&Reload);
  15.  
  16. my $hooks = Plugins::addHooks(
  17. ['AI_post', \&default, undef]
  18. );
  19.  
  20. ##### PLUGIN VARIABLES
  21.  
  22.  
  23. ##### SYSTEM METHODS
  24.  
  25. sub Unload {
  26. foreach my $hook (@{$hooks}) {
  27. Plugins::delHook($hook);
  28. }
  29. undef @{$hooks};
  30. }
  31.  
  32. sub Reload {
  33. &Unload;
  34. &debugger("Reload Successful");
  35. }
  36.  
  37. ##### PLUGIN FEATURES
  38.  
  39. # Add plugin information on screem
  40. sub debugger {
  41. my $datetime = localtime time;
  42.  
  43. # use Data::Dumper;
  44. # message Dumper($_[0])."\n";
  45. message "[HAR] $datetime: $_[0].\n";
  46. }
  47.  
  48. ##### PLUGIN BEHAVIOR
  49.  
  50. sub default {
  51. my (undef, $args) = @_;
  52.  
  53. my $ID = unpack("V1", $args->{ID});
  54.  
  55. my %count;
  56.  
  57. # get the avariable targets
  58. my $monsters = $Globals::monstersList->getItems();
  59.  
  60. # setup the actors list
  61. foreach my $monster (@{$monsters}) {
  62. # type >= 100 : monster
  63. # hair_style != 0x64: not pet
  64. if ($monster->{type} >= 1000 and $monster->{hair_style} ne 0x64) {
  65. # count them by the ID
  66. $count{$monster->{binType}}++;
  67. }
  68. }
  69.  
  70. # loop the actors list
  71. foreach my $k (keys %count) {
  72. # &debugger("key: $k / val: $count{$k}");
  73. # if target is: and the amount is greater than 1
  74. if($k == "1086" && $count{$k} < 1) {
  75. # alert
  76. Utils::Win32::playSound($config{"alertSound_death_play"});
  77. }
  78. else {
  79. # teleport
  80. main::useTeleport(1);
  81. }
  82. }
  83. }
  84.  
  85. 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement