Henrybk

moveFast v1

Mar 24th, 2016
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.09 KB | None | 0 0
  1. package moveFast;
  2.  
  3. use strict;
  4. use warnings;
  5. use Modules 'register';
  6. use Globals;
  7. use Log qw(message debug error warning);
  8. use Misc;
  9. use Network;
  10. use Network::Send ();
  11. use Settings;
  12. use Plugins;
  13. use Skill;
  14. use Utils;
  15. use Utils::Exceptions;
  16. use AI;
  17. use Task;
  18.  
  19. Plugins::register("moveFast", "moveFast", \&unload, \&unload);
  20.  
  21. my $hooks = Plugins::addHooks(
  22.     ['packet_pre/character_moves',\&on_move, undef]
  23. );
  24.  
  25. sub unload {
  26.     Plugins::delHooks($hooks);
  27. }
  28.  
  29. sub on_move {
  30.     my ($self, $args) = @_;
  31.     return if (!$net || $net->getState() != Network::IN_GAME);
  32.     return if (!$config{'moveFastActive'});
  33.     my $pre_coords = {};
  34.     my $pos_coords = {};
  35.     makeCoordsFromTo($pre_coords, $pos_coords, $args->{coords});
  36.     if ($pos_coords->{'x'} == $config{'moveFastX1'} && $pos_coords->{'y'} == $config{'moveFastY1'}) {
  37.         $messageSender->sendMove($config{'moveFastX2'}, $config{'moveFastY2'});
  38.     } elsif ($pos_coords->{'x'} == $config{'moveFastX2'} && $pos_coords->{'y'} == $config{'moveFastY2'}) {
  39.         $messageSender->sendMove($config{'moveFastX1'}, $config{'moveFastY1'});
  40.     }
  41.     return;
  42. }
  43.  
  44. return 1;
Advertisement
Add Comment
Please, Sign In to add comment