GameServerAuth.java 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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.loginserver.gameserverpackets;
  16. import java.util.logging.Logger;
  17. import com.l2jserver.util.network.BaseRecievePacket;
  18. /**
  19. * Format: cccddb
  20. * c desired ID
  21. * c accept alternative ID
  22. * c reserve Host
  23. * s ExternalHostName
  24. * s InetranlHostName
  25. * d max players
  26. * d hexid size
  27. * b hexid
  28. * @author -Wooden-
  29. *
  30. */
  31. public class GameServerAuth extends BaseRecievePacket
  32. {
  33. protected static Logger _log = Logger.getLogger(GameServerAuth.class.getName());
  34. private byte[] _hexId;
  35. private int _desiredId;
  36. private boolean _hostReserved;
  37. private boolean _acceptAlternativeId;
  38. private int _maxPlayers;
  39. private int _port;
  40. private String _externalHost;
  41. private String _internalHost;
  42. /**
  43. * @param decrypt
  44. */
  45. public GameServerAuth(byte[] decrypt)
  46. {
  47. super(decrypt);
  48. _desiredId = readC();
  49. _acceptAlternativeId = (readC() == 0 ? false : true);
  50. _hostReserved = (readC() == 0 ? false : true);
  51. _externalHost = readS();
  52. _internalHost = readS();
  53. _port = readH();
  54. _maxPlayers = readD();
  55. int size = readD();
  56. _hexId = readB(size);
  57. }
  58. /**
  59. * @return
  60. */
  61. public byte[] getHexID()
  62. {
  63. return _hexId;
  64. }
  65. public boolean getHostReserved()
  66. {
  67. return _hostReserved;
  68. }
  69. public int getDesiredID()
  70. {
  71. return _desiredId;
  72. }
  73. public boolean acceptAlternateID()
  74. {
  75. return _acceptAlternativeId;
  76. }
  77. /**
  78. * @return Returns the max players.
  79. */
  80. public int getMaxPlayers()
  81. {
  82. return _maxPlayers;
  83. }
  84. /**
  85. * @return Returns the externalHost.
  86. */
  87. public String getExternalHost()
  88. {
  89. return _externalHost;
  90. }
  91. /**
  92. * @return Returns the internalHost.
  93. */
  94. public String getInternalHost()
  95. {
  96. return _internalHost;
  97. }
  98. /**
  99. * @return Returns the port.
  100. */
  101. public int getPort()
  102. {
  103. return _port;
  104. }
  105. }