AuthRequest.java 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 reserveHost
  35. * @param maxplayer
  36. */
  37. public AuthRequest(int id, boolean acceptAlternate, byte[] hexid, int port, boolean reserveHost, int maxplayer, String[] subnets, String[] hosts)
  38. {
  39. writeC(0x01);
  40. writeC(id);
  41. writeC(acceptAlternate? 0x01 : 0x00);
  42. writeC(reserveHost? 0x01 : 0x00);
  43. writeH(port);
  44. writeD(maxplayer);
  45. writeD(hexid.length);
  46. writeB(hexid);
  47. writeD(subnets.length);
  48. for (int i = 0; i < subnets.length; i++)
  49. {
  50. writeS(subnets[i]);
  51. writeS(hosts[i]);
  52. }
  53. }
  54. /* (non-Javadoc)
  55. * @see com.l2jserver.gameserver.gameserverpackets.GameServerBasePacket#getContent()
  56. */
  57. @Override
  58. public byte[] getContent() throws IOException
  59. {
  60. return getBytes();
  61. }
  62. }