Beispiel #1
0
  public static final void Character_WithoutSecondPassword(
      final LittleEndianAccessor slea,
      final MapleClient c,
      final boolean haspic,
      final boolean view) {
    slea.readByte(); // 1?
    slea.readByte(); // 1?
    final int charId = slea.readInt();
    if (view) {
      c.setChannel(1);
      c.setWorld(slea.readInt());
    }
    final String currentpw = c.getSecondPassword();
    if (!c.isLoggedIn()
        || loginFailCount(c)
        || (currentpw != null && (!currentpw.equals("") || haspic))
        || !c.login_Auth(charId)
        || ChannelServer.getInstance(c.getChannel()) == null
        || c.getWorld() != 0) { // TODOO: MULTI WORLDS
      c.getSession().close();
      return;
    }
    c.updateMacs(slea.readMapleAsciiString());
    slea.readMapleAsciiString();
    if (slea.available() != 0) {
      final String setpassword = slea.readMapleAsciiString();

      if (setpassword.length() >= 6 && setpassword.length() <= 16) {
        c.setSecondPassword(setpassword);
        c.updateSecondPassword();
      } else {
        c.getSession().write(LoginPacket.secondPwError((byte) 0x14));
        return;
      }
    } else if (GameConstants.GMS && haspic) {
      return;
    }
    if (c.getIdleTask() != null) {
      c.getIdleTask().cancel(true);
    }
    final String s = c.getSessionIPAddress();
    LoginServer.putLoginAuth(
        charId, s.substring(s.indexOf('/') + 1, s.length()), c.getTempIP(), c.getChannel());
    c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION, s);
    c.getSession()
        .write(
            CField.getServerIP(
                c,
                Integer.parseInt(ChannelServer.getInstance(c.getChannel()).getIP().split(":")[1]),
                charId));
  }
 public static final void Character_WithSecondPassword(
     LittleEndianAccessor slea, MapleClient c, boolean view) {
   String password = slea.readMapleAsciiString();
   int charId = slea.readInt();
   if (view) {
     c.setChannel(1);
     c.setWorld(slea.readInt());
   }
   if ((!c.isLoggedIn())
       || (loginFailCount(c))
       || (c.getSecondPassword() == null)
       || (!c.login_Auth(charId))
       || (ChannelServer.getInstance(c.getChannel()) == null)
       || (c.getWorld() != 0)) {
     c.getSession().close(true);
     return;
   }
   if (GameConstants.GMS) {
     c.updateMacs(slea.readMapleAsciiString());
   }
   if ((c.CheckSecondPassword(password))
       && (password.length() >= 6)
       && (password.length() <= 16)) {
     if (c.getIdleTask() != null) {
       c.getIdleTask().cancel(true);
     }
     String s = c.getSessionIPAddress();
     LoginServer.putLoginAuth(charId, s.substring(s.indexOf('/') + 1, s.length()), c.getTempIP());
     c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION, s);
     c.getSession()
         .write(
             CField.getServerIP(
                 c,
                 Integer.parseInt(ChannelServer.getInstance(c.getChannel()).getIP().split(":")[1]),
                 charId));
     System.out.println("Sent serverIp");
   } else {
     c.getSession().write(LoginPacket.secondPwError((byte) 0x14));
   }
 }