AuthLogin.java 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 net.sf.l2j.gameserver.clientpackets;
  16. import java.util.logging.Logger;
  17. import net.sf.l2j.Config;
  18. import net.sf.l2j.gameserver.LoginServerThread;
  19. import net.sf.l2j.gameserver.LoginServerThread.SessionKey;
  20. import net.sf.l2j.gameserver.network.L2GameClient;
  21. /**
  22. * This class ...
  23. *
  24. * @version $Revision: 1.9.2.3.2.4 $ $Date: 2005/03/27 15:29:30 $
  25. */
  26. public final class AuthLogin extends L2GameClientPacket
  27. {
  28. private static final String _C__08_AUTHLOGIN = "[C] 08 AuthLogin";
  29. private static Logger _log = Logger.getLogger(AuthLogin.class.getName());
  30. // loginName + keys must match what the loginserver used.
  31. private String _loginName;
  32. /*private final long _key1;
  33. private final long _key2;
  34. private final long _key3;
  35. private final long _key4;*/
  36. private int _playKey1;
  37. private int _playKey2;
  38. private int _loginKey1;
  39. private int _loginKey2;
  40. /**
  41. * @param decrypt
  42. */
  43. @Override
  44. protected void readImpl()
  45. {
  46. _loginName = readS().toLowerCase();
  47. _playKey2 = readD();
  48. _playKey1 = readD();
  49. _loginKey1 = readD();
  50. _loginKey2 = readD();
  51. }
  52. @Override
  53. protected void runImpl()
  54. {
  55. SessionKey key = new SessionKey(_loginKey1, _loginKey2, _playKey1, _playKey2);
  56. if (Config.DEBUG)
  57. {
  58. _log.info("user:" + _loginName);
  59. _log.info("key:" + key);
  60. }
  61. L2GameClient client = getClient();
  62. // avoid potential exploits
  63. if (client.getAccountName() == null)
  64. {
  65. client.setAccountName(_loginName);
  66. LoginServerThread.getInstance().addGameServerLogin(_loginName, client);
  67. LoginServerThread.getInstance().addWaitingClientAndSendRequest(_loginName, client, key);
  68. }
  69. }
  70. /* (non-Javadoc)
  71. * @see net.sf.l2j.gameserver.clientpackets.ClientBasePacket#getType()
  72. */
  73. @Override
  74. public String getType()
  75. {
  76. return _C__08_AUTHLOGIN;
  77. }
  78. }