Package com.l2jfrozen.loginserver.network.clientpackets

Source Code of com.l2jfrozen.loginserver.network.clientpackets.AuthGameGuard

/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jfrozen.loginserver.network.clientpackets;

import com.l2jfrozen.loginserver.L2LoginClient.LoginClientState;
import com.l2jfrozen.loginserver.network.serverpackets.GGAuth;
import com.l2jfrozen.loginserver.network.serverpackets.LoginFail.LoginFailReason;

/**
* @author -Wooden- Format: ddddd
*/
public class AuthGameGuard extends L2LoginClientPacket
{
  private int _sessionId;
  private int _data1;
  private int _data2;
  private int _data3;
  private int _data4;
  private boolean CRYPT_TOKEN = true;

  public int getSessionId()
  {
    return _sessionId;
  }

  public int getData1()
  {
    return _data1;
  }

  public int getData2()
  {
    return _data2;
  }

  public int getData3()
  {
    return _data3;
  }

  public int getData4()
  {
    return _data4;
  }

  /**
   * @see com.l2jfrozen.loginserver.network.clientpackets.L2LoginClientPacket#readImpl()
   */
  @Override
  protected boolean readImpl()
  {
    if (super._buf.remaining() >= 20)
    {
      _sessionId = readD();
      _data1 = readD();
      _data2 = readD();
      _data3 = readD();
      _data4 = readD();
      return true;
    }
    return false;
  }
 
  @Override
  public void run()
  {
    if(CRYPT_TOKEN)
    {
      int key = _data1 ^ 0x797183
      _sessionId ^= key;
    }
    if(_sessionId == getClient().getSessionId())
    {
      getClient().setState(LoginClientState.AUTHED_GG);
      getClient().sendPacket(new GGAuth(getClient().getSessionId()));
    }
    else
    {
      getClient().close(LoginFailReason.REASON_ACCESS_FAILED);
    }
  }
}
TOP

Related Classes of com.l2jfrozen.loginserver.network.clientpackets.AuthGameGuard

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.