AuthRequest.java 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package com.l2jserver.gameserver.network.gameserverpackets;
  16. import java.io.IOException;
  17. import com.l2jserver.util.network.BaseSendablePacket;
  18. public class AuthRequest extends BaseSendablePacket
  19. {
  20. /**
  21. * Format: cccSddb
  22. * c desired ID
  23. * c accept alternative ID
  24. * c reserve Host
  25. * s ExternalHostName
  26. * s InetranlHostName
  27. * d max players
  28. * d hexid size
  29. * b hexid
  30. *
  31. * @param id
  32. * @param acceptAlternate
  33. * @param hexid
  34. * @param externalHost
  35. * @param internalHost
  36. * @param reserveHost
  37. * @param maxplayer
  38. */
  39. public AuthRequest(int id, boolean acceptAlternate, byte[] hexid, String externalHost,String internalHost, int port, boolean reserveHost, int maxplayer)
  40. {
  41. writeC(0x01);
  42. writeC(id);
  43. writeC(acceptAlternate? 0x01 : 0x00);
  44. writeC(reserveHost? 0x01 : 0x00);
  45. writeS(externalHost);
  46. writeS(internalHost);
  47. writeH(port);
  48. writeD(maxplayer);
  49. writeD(hexid.length);
  50. writeB(hexid);
  51. }
  52. /* (non-Javadoc)
  53. * @see com.l2jserver.gameserver.gameserverpackets.GameServerBasePacket#getContent()
  54. */
  55. @Override
  56. public byte[] getContent() throws IOException
  57. {
  58. return getBytes();
  59. }
  60. }