Guest User

2011-01-11aRagexeRE | Send/kRO/RagexeRE_0.pm

a guest
Aug 12th, 2011
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.76 KB | None | 0 0
  1. #########################################################################
  2. #  OpenKore - Packet sending
  3. #  This module contains functions for sending packets to the server.
  4. #
  5. #  This software is open source, licensed under the GNU General Public
  6. #  License, version 2.
  7. #  Basically, this means that you're allowed to modify and distribute
  8. #  this software. However, if you distribute modified versions, you MUST
  9. #  also distribute the source code.
  10. #  See http://www.gnu.org/licenses/gpl.html for the full license.
  11. #
  12. #  $Revision: 6687 $
  13. #  $Id: kRO.pm 6687 2009-04-19 19:04:25Z technologyguild $
  14. ########################################################################
  15. #
  16. # Edited for client : 2011-01-11aRagexeRE
  17. #
  18. # Korea (kRO)
  19. # The majority of private servers use eAthena, this is a clone of kRO
  20.  
  21. # this is an experimental class
  22. # this serverType is used for kRO Sakray RE
  23. # basically when we don't know where to put a new packet, we put it here and move it to the right class later
  24.  
  25. package Network::Send::kRO::RagexeRE_0;
  26.  
  27. use strict;
  28. use base qw(Network::Send::kRO::RagexeRE_2010_08_03a);
  29.  
  30. use Time::HiRes qw(time);
  31. use Digest::MD5;
  32.  
  33. use Network::Send ();
  34. use base qw(Network::Send);
  35. use Plugins;
  36. use Globals qw($accountID $sessionID $sessionID2 $accountSex $char $charID %config %guild @chars $masterServer $syncSync);
  37. use Log qw(debug);
  38. use Translation qw(T TF);
  39. use I18N qw(stringToBytes);
  40. use Utils;
  41. use Utils::Exceptions;
  42.  
  43. sub new {
  44.     my ($class) = @_;
  45.     return $class->SUPER::new(@_);
  46. }
  47.  
  48. sub sendGetCharacterName {
  49.     my ($self, $ID) = @_;
  50.     my $msg = pack("C*", 0x68, 0x03) . $ID;
  51.     $self->sendToServer($msg);
  52.     debug "Sent get character name: ID - ".getHex($ID)."\n", "sendPacket", 2;
  53. }
  54.  
  55. sub sendGetPlayerInfo {
  56.     my ($self, $ID) = @_;
  57.     my $msg;
  58.     $msg = pack("C*", 0x68, 0x03) . $ID;
  59.     $self->sendToServer($msg);
  60.     debug "Sent get player info: ID - ".getHex($ID)."\n", "sendPacket", 2;
  61. }
  62.  
  63.  
  64. sub sendChat {
  65.     my ($self, $message) = @_;
  66.     $message = "|00$message" if ($config{chatLangCode} && $config{chatLangCode} ne "none");
  67.  
  68.     my ($data, $charName); # Type: Bytes
  69.     $message = stringToBytes($message); # Type: Bytes
  70.     $charName = stringToBytes($char->{name}); # Type: Bytes
  71.     #$charName = stringToBytes('Ndud'); # Type: Bytes
  72.  
  73.     $data = pack('v2 Z*', 0x00F3, length($charName) + length($message) + 8, $charName . " : " . $message);
  74.  
  75.     $self->sendToServer($data);
  76. }
  77.  
  78. sub sendPrivateMsg {
  79.     my ($self, $user, $message) = @_;
  80.     $message = "|00$message" if ($config{chatLangCode} && $config{chatLangCode} ne "none");
  81.  
  82.     $message = stringToBytes($message); # Type: Bytes
  83.     $user = stringToBytes($user); # Type: Bytes
  84.  
  85.     my $data = pack('v2 Z24 Z*', 0x0096, length($message) + 29, $user, $message);
  86.  
  87.     $self->sendToServer($data);
  88. }
  89.  
  90. =pod
  91.  
  92. =cut
  93.  
  94. 1;
Advertisement
Add Comment
Please, Sign In to add comment