Henrybk

wrongPasswordSound

Feb 12th, 2016
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.91 KB | None | 0 0
  1. ############################################################
  2. #
  3. # wrongPasswordSound
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License
  7. # as published by the Free Software Foundation; either version 2
  8. # of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18. #
  19. #
  20. # Plugin made by Henrybk from openkore Brasil
  21. #
  22. # What id does: When your openkore recieve a message of worng password from
  23. # the server it player a sound. By default the sound is 'SystemDefault' but
  24. # it can be changed using the key 'wrongPasswordAlertSound' on the config
  25. # Example:
  26. # wrongPasswordAlertSound C:\Users\Henrybk\Desktop\password.wav
  27. #
  28. # By Henrybk
  29. #
  30. ############################################################
  31. package wrongPasswordSound;
  32.  
  33. use Plugins;
  34. use Globals;
  35. use Utils;
  36. use Log qw(message);
  37. use Network::Send;
  38. use Utils::Win32;
  39.  
  40. Plugins::register('wrongPasswordSound', 'playes an alert sound when your kore inputs the wrong password', \&Unload);
  41.  
  42. my $hooks = Plugins::addHooks(
  43.     ['packet_pre/login_error', \&checkError, undef],
  44. );
  45.  
  46.  
  47. # onUnload
  48. sub Unload {
  49.     message "Plugin wrongPasswordSound unloading\n", 'success';
  50.     Plugins::delHooks($hooks);
  51. }
  52.  
  53. sub checkError {
  54.     my ($self, $args) = @_;
  55.     if ($args->{type} == 1) {
  56.         my $sound = $config{'wrongPasswordAlertSound'} ? $config{'wrongPasswordAlertSound'} : 'SystemDefault';
  57.         Utils::Win32::playSound($sound);
  58.     }
  59. }
  60.  
  61. return 1;
Add Comment
Please, Sign In to add comment