GameServerAuth.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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[] _hosts;
  41. /**
  42. * @param decrypt
  43. */
  44. public GameServerAuth(byte[] decrypt)
  45. {
  46. super(decrypt);
  47. _desiredId = readC();
  48. _acceptAlternativeId = (readC() == 0 ? false : true);
  49. _hostReserved = (readC() == 0 ? false : true);
  50. _port = readH();
  51. _maxPlayers = readD();
  52. int size = readD();
  53. _hexId = readB(size);
  54. size = 2 * readD();
  55. _hosts = new String[size];
  56. for (int i = 0; i < size; i++)
  57. _hosts[i] = readS();
  58. }
  59. /**
  60. * @return
  61. */
  62. public byte[] getHexID()
  63. {
  64. return _hexId;
  65. }
  66. public boolean getHostReserved()
  67. {
  68. return _hostReserved;
  69. }
  70. public int getDesiredID()
  71. {
  72. return _desiredId;
  73. }
  74. public boolean acceptAlternateID()
  75. {
  76. return _acceptAlternativeId;
  77. }
  78. /**
  79. * @return Returns the max players.
  80. */
  81. public int getMaxPlayers()
  82. {
  83. return _maxPlayers;
  84. }
  85. public String[] getHosts()
  86. {
  87. return _hosts;
  88. }
  89. /**
  90. * @return Returns the port.
  91. */
  92. public int getPort()
  93. {
  94. return _port;
  95. }
  96. }