Package lineage2.loginserver

Examples of lineage2.loginserver.L2LoginClient


   * @param template NpcTemplate
   */
  public Kama26BossInstance(int objectId, NpcTemplate template)
  {
    super(objectId, template);
    getMinionList().addMinion(new MinionData(18556, 1));
  }
View Full Code Here


    ThreadPoolManager.getInstance().schedule(new RunnableImpl()
    {
      @Override
      public void runImpl()
      {
        final NpcTemplate template = NpcHolder.getInstance().getTemplate(18602);
        if (template != null)
        {
          final NpcInstance a = template.getNewInstance();
          a.setCurrentHpMp(a.getMaxHp(), a.getMaxMp());
          a.spawnMe(actor.getLoc());
        }
      }
    }, 10000L);
View Full Code Here

      {
        player.sendPacket(Msg.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
        return;
      }
    }
    final Location pos = Location.findPointToStay(x, y, z, 50, 100, player.getGeoIndex());
    if (price > 0)
    {
      player.reduceAdena(price, true);
    }
    player.teleToLocation(pos);
View Full Code Here

      player.sendPacket(SystemMessage2.removeItems(item, count));
    }
    final int x = Integer.parseInt(param[0]);
    final int y = Integer.parseInt(param[1]);
    final int z = Integer.parseInt(param[2]);
    final Location pos = Location.findPointToStay(x, y, z, 20, 70, player.getGeoIndex());
    player.teleToLocation(pos);
  }
View Full Code Here

      return;
    }
    final String var = player.getVar("DCBackCoords");
    if ((var == null) || var.isEmpty())
    {
      player.teleToLocation(new Location(43768, -48232, -800), 0);
      return;
    }
    player.teleToLocation(Location.parseLoc(var), 0);
    player.unsetVar("DCBackCoords");
  }
View Full Code Here

    }
    for (Player player : World.getAroundPlayers(actor, 200, 200))
    {
      if (player != null)
      {
        player.teleToLocation(new Location(207559, 86429, -1000));
      }
    }
    return true;
  }
View Full Code Here

   * Method runImpl.
   */
  @Override
  protected void runImpl()
  {
    L2LoginClient client = getClient();
    if ((_sessionId == 0) || (_sessionId == client.getSessionId()))
    {
      client.setState(LoginClientState.AUTHED_GG);
      client.sendPacket(new GGAuth(client.getSessionId()));
    }
    else
    {
      client.close(LoginFail.LoginFailReason.REASON_ACCESS_FAILED);
    }
  }
View Full Code Here

   * Method runImpl.
   */
  @Override
  protected void runImpl()
  {
    L2LoginClient client = getClient();
    SessionKey skey = client.getSessionKey();
    if ((skey == null) || !skey.checkLoginPair(_loginOkID1, _loginOkID2))
    {
      client.close(LoginFailReason.REASON_ACCESS_FAILED);
      return;
    }
    Account account = client.getAccount();
    GameServer gs = GameServerManager.getInstance().getGameServerById(_serverId);
    if ((gs == null) || !gs.isAuthed() || (gs.isGmOnly() && (account.getAccessLevel() < 100)) || ((gs.getOnline() >= gs.getMaxPlayers()) && (account.getAccessLevel() < 50)))
    {
      client.close(LoginFailReason.REASON_ACCESS_FAILED);
      return;
    }
    account.setLastServer(_serverId);
    account.update();
    client.close(new PlayOk(skey));
  }
View Full Code Here

   * Method runImpl.
   */
  @Override
  protected void runImpl()
  {
    L2LoginClient client = getClient();
    SessionKey skey = client.getSessionKey();
    if ((skey == null) || !skey.checkLoginPair(_loginOkID1, _loginOkID2))
    {
      client.close(LoginFailReason.REASON_ACCESS_FAILED);
      return;
    }
    client.sendPacket(new ServerList(client.getAccount()));
  }
View Full Code Here

   * @throws Exception
   */
  @Override
  protected void runImpl() throws Exception
  {
    L2LoginClient client = getClient();
    byte[] decrypted;
    try
    {
      Cipher rsaCipher = Cipher.getInstance("RSA/ECB/nopadding");
      rsaCipher.init(Cipher.DECRYPT_MODE, client.getRSAPrivateKey());
      decrypted = rsaCipher.doFinal(_raw, 0x00, 0x80);
    }
    catch (Exception e)
    {
      client.closeNow(true);
      return;
    }
    String user = new String(decrypted, 0x5E, 14).trim();
    user = user.toLowerCase();
    String password = new String(decrypted, 0x6C, 16).trim();
    int currentTime = (int) (System.currentTimeMillis() / 1000L);
    Account account = new Account(user);
    account.restore();
    String passwordHash = Config.DEFAULT_CRYPT.encrypt(password);
    if (account.getPasswordHash() == null)
    {
      if (Config.AUTO_CREATE_ACCOUNTS && user.matches(Config.ANAME_TEMPLATE) && password.matches(Config.APASSWD_TEMPLATE))
      {
        account.setAllowedIP("");
        account.setPasswordHash(passwordHash);
        account.save();
      }
      else
      {
        client.close(LoginFailReason.REASON_USER_OR_PASS_WRONG);
        return;
      }
    }
    boolean passwordCorrect = account.getPasswordHash().equals(passwordHash);
    if (!passwordCorrect)
    {
      for (PasswordHash c : Config.LEGACY_CRYPT)
      {
        if (c.compare(password, account.getPasswordHash()))
        {
          passwordCorrect = true;
          account.setPasswordHash(passwordHash);
          break;
        }
      }
    }
    if (!IpBanManager.getInstance().tryLogin(client.getIpAddress(), passwordCorrect))
    {
      client.closeNow(false);
      return;
    }
    if (!passwordCorrect)
    {
      client.close(LoginFailReason.REASON_USER_OR_PASS_WRONG);
      return;
    }
    if (account.getAccessLevel() < 0)
    {
      client.close(LoginFailReason.REASON_ACCESS_FAILED);
      return;
    }
    if (account.getBanExpire() > currentTime)
    {
      client.close(LoginFailReason.REASON_ACCESS_FAILED);
      return;
    }
    if (!account.isAllowedIP(client.getIpAddress()))
    {
      client.close(LoginFailReason.REASON_ATTEMPTED_RESTRICTED_IP);
      return;
    }
    for (GameServer gs : GameServerManager.getInstance().getGameServers())
    {
      if ((gs.getProtocol() >= 2) && gs.isAuthed())
      {
        gs.sendPacket(new GetAccountInfo(user));
      }
    }
    account.setLastAccess(currentTime);
    account.setLastIP(client.getIpAddress());
    Log.LogAccount(account);
    Session session = SessionManager.getInstance().openSession(account);
    client.setAuthed(true);
    client.setLogin(user);
    client.setAccount(account);
    client.setSessionKey(session.getSessionKey());
    client.setState(LoginClientState.AUTHED);
    client.sendPacket(new LoginOk(client.getSessionKey()));
  }
View Full Code Here

TOP

Related Classes of lineage2.loginserver.L2LoginClient

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.