Package l2p.gameserver.network

Examples of l2p.gameserver.network.L2GameClient


  protected abstract void readImpl() throws Exception;

  @Override
  public void run()
  {
    L2GameClient client = getClient();
    try
    {
      runImpl();
    }
    catch(Exception e)
    {
      _log.severe("Client: " + client.toString() + " from IP: " + client.getIpAddr() + " - Failed running: " + getType() + " - L2P Server Version: " + Config.SERVER_VERSION);
      e.printStackTrace();
      handleIncompletePacket();
    }
    client.can_runImpl = true;
  }
View Full Code Here


    return checkReadArray(expected_elements, element_size, true);
  }

  public void handleIncompletePacket()
  {
    L2GameClient client = getClient();
    L2Player activeChar = client.getActiveChar();
    if(activeChar == null)
    {
      _log.warning("Packet not completed. Maybe cheater. IP:" + client.getIpAddr() + ", account:" + client.getLoginName());
    }
    else
    {
      _log.warning("Packet not completed. Maybe cheater. IP:" + client.getIpAddr() + ", account:" + client.getLoginName() + ", character:" + activeChar.getName());
    }
    client.onClientPacketFail();
  }
View Full Code Here

  }

  @Override
  protected final void writeImpl()
  {
    L2GameClient client = getClient();
    if(client == null || positions.isEmpty())
    {
      return;
    }
    L2Player player = client.getActiveChar();
    if(player == null)
    {
      return;
    }
    int this_player_id = player.getObjectId();
View Full Code Here

  @Override
  public void read()
  {
    String account = readS();
    boolean changed = readD() == 1;
    L2GameClient client = getLoginServer().getCon().getAccountInGame(account);
    if(client == null)
    {
      return;
    }
    L2Player activeChar = client.getActiveChar();
    if(activeChar == null)
    {
      return;
    }
    if(changed)
View Full Code Here

  @Override
  public void read()
  {
    String account = readS();
    int changed = readD();
    L2GameClient client = getLoginServer().getCon().getAccountInGame(account);
    if(client == null)
    {
      return;
    }
    L2Player activeChar = client.getActiveChar();
    if(activeChar == null)
    {
      return;
    }
    if(changed == 2)
View Full Code Here

    int loginOkId2 = readD();
    String s_bonus = readS();
    String account_fields = readS();
    int bonusExpire = readD();
    float bonus = s_bonus == null || s_bonus.equals("") ? 1 : Float.parseFloat(s_bonus);
    L2GameClient client = getLoginServer().getCon().removeWaitingClient(account);
    if(client != null)
    {
      if(client.getState() != L2GameClient.GameClientState.CONNECTED)
      {
        log.severe("Trying to authd allready authed client.");
        client.closeNow(true);
        return;
      }
      if(client.getLoginName() == null || client.getLoginName().isEmpty())
      {
        client.closeNow(true);
        log.warning("PlayerAuthResponse: empty accname for " + client);
        return;
      }
      SessionKey key = client.getSessionId();
      if(authed)
      {
        if(getLoginServer().isLicenseShown())
        {
          authed = key.playOkID1 == playOkId1 && key.playOkID2 == playOkId2 && key.loginOkID1 == loginOkId1 && key.loginOkID2 == loginOkId2;
        }
        else
        {
          authed = key.playOkID1 == playOkId1 && key.playOkID2 == playOkId2;
        }
      }
      if(authed)
      {
        client.account_fields = StatsSet.unserialize(account_fields);
        client.setState(L2GameClient.GameClientState.AUTHED);
        client.setBonus(bonus);
        client.setBonusExpire(bonusExpire);
        getLoginServer().getCon().addAccountInGame(client);
        CharacterSelectionInfo csi = new CharacterSelectionInfo(client.getLoginName(), client.getSessionId().playOkID1);
        client.sendPacket(csi);
        client.setCharSelection(csi.getCharInfo());
        sendPacket(new PlayerInGame(client.getLoginName(), Stats.getOnline(true)));
      }
      else
      {
        //log.severe("Cheater? SessionKey invalid! Login: " + client.getLoginName() + ", IP: " + client.getIpAddr());
        client.sendPacket(new LoginFail(LoginFail.INCORRECT_ACCOUNT_INFO_CONTACT_CUSTOMER_SUPPORT));
        ThreadPoolManager.getInstance().scheduleGeneral(new KickWaitingClientTask(client), 1000);
        LSConnection.getInstance().sendPacket(new PlayerLogout(client.getLoginName()));
        LSConnection.getInstance().removeAccount(client);
      }
    }
  }
View Full Code Here

      {
        client.sendPacket(new LoginFail(LoginFail.SYSTEM_ERROR_LOGIN_LATER));
        ThreadPoolManager.getInstance().scheduleGeneral(new KickWaitingClientTask(client), 1000);
        return;
      }
      L2GameClient sameClient = waitingClients.remove(client.getLoginName());
      if(sameClient != null)
      {
        sameClient.sendPacket(new LoginFail(LoginFail.ACOUNT_ALREADY_IN_USE));
        ThreadPoolManager.getInstance().scheduleGeneral(new KickWaitingClientTask(sameClient), 1000);
      }
      waitingClients.put(client.getLoginName(), client);
      sendPacket(new PlayerAuthRequest(client));
    }
View Full Code Here

    }
  }

  public L2GameClient removeWaitingClient(String account)
  {
    L2GameClient client;
    synchronized(waitingClients)
    {
      client = waitingClients.remove(account);
    }
    return client;
View Full Code Here

      {
        client.sendPacket(new LoginFail(LoginFail.SYSTEM_ERROR_LOGIN_LATER));
        ThreadPoolManager.getInstance().scheduleGeneral(new KickWaitingClientTask(client), 1000);
        return;
      }
      L2GameClient oldClient = null;
      if(client.getLoginName() != null)
      {
        oldClient = accountsInGame.remove(client.getLoginName());
      }
      if(oldClient != null)
      {
        L2Player activeChar = oldClient.getActiveChar();
        if(activeChar != null)
        {
          activeChar.sendPacket(Msg.ANOTHER_PERSON_HAS_LOGGED_IN_WITH_THE_SAME_ACCOUNT);
          oldClient.sendPacket(Msg.ServerClose);
        }
        else
        {
          oldClient.sendPacket(Msg.ServerClose);
        }
        ThreadPoolManager.getInstance().scheduleGeneral(new KickPlayerInGameTask(oldClient), 1000);
      }
      if(client.getLoginName() != null)
      {
View Full Code Here

  public void removeAccountInGame(L2GameClient client)
  {
    synchronized(accountsInGame)
    {
      String loginName = client.getLoginName();
      L2GameClient oldClient = accountsInGame.get(loginName);
      if(client.equals(oldClient))
      {
        accountsInGame.remove(loginName);
      }
    }
View Full Code Here

TOP

Related Classes of l2p.gameserver.network.L2GameClient

Copyright © 2018 www.massapicom. 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.