Пример #1
0
  public static final void DeleteChar(LittleEndianAccessor slea, MapleClient c) {
    String Secondpw_Client = GameConstants.GMS ? slea.readMapleAsciiString() : null;
    if (Secondpw_Client == null) {
      if (slea.readByte() > 0) {
        Secondpw_Client = slea.readMapleAsciiString();
      }
      slea.readMapleAsciiString();
    }

    int Character_ID = slea.readInt();

    if ((!c.login_Auth(Character_ID)) || (!c.isLoggedIn()) || (loginFailCount(c))) {
      c.getSession().close(true);
      return;
    }
    byte state = 0;

    if (c.getSecondPassword() != null) {
      if (Secondpw_Client == null) {
        c.getSession().close(true);
        return;
      }
      if (!c.CheckSecondPassword(Secondpw_Client)) {
        state = 20;
      }
    }

    if (state == 0) {
      state = (byte) c.deleteCharacter(Character_ID);
    }
    c.getSession().write(LoginPacket.deleteCharResponse(Character_ID, state));
  }
Пример #2
0
  public static final void CharlistRequest(LittleEndianAccessor slea, MapleClient c) {
    if (!c.isLoggedIn()) {
      c.getSession().close(true);
      return;
    }
    if (GameConstants.GMS) {
      slea.readByte();
    }
    int server = slea.readByte();
    int channel = slea.readByte() + 1;
    if ((!World.isChannelAvailable(channel)) || (server != 0)) {
      c.getSession().write(LoginPacket.getLoginFailed(10));
      return;
    }

    List chars = c.loadCharacters(server);
    if ((chars != null) && (ChannelServer.getInstance(channel) != null)) {
      c.setWorld(server);
      c.setChannel(channel);

      c.getSession()
          .write(LoginPacket.getCharList(c.getSecondPassword(), chars, c.getCharacterSlots()));
    } else {
      c.getSession().close(true);
    }
  }
Пример #3
0
  public static final void DeleteChar(final LittleEndianAccessor slea, final MapleClient c) {
    String Secondpw_Client = GameConstants.GMS ? slea.readMapleAsciiString() : null;
    if (Secondpw_Client == null) {
      if (slea.readByte() > 0) { // Specific if user have second password or not
        Secondpw_Client = slea.readMapleAsciiString();
      }
      slea.readMapleAsciiString();
    }

    final int Character_ID = slea.readInt();

    if (!c.login_Auth(Character_ID) || !c.isLoggedIn() || loginFailCount(c)) {
      c.getSession().close();
      return; // Attempting to delete other character
    }
    byte state = 0;

    if (c.getSecondPassword() != null) { // On the server, there's a second password
      if (Secondpw_Client == null) { // Client's hacking
        c.getSession().close();
        return;
      } else {
        if (!c.CheckSecondPassword(Secondpw_Client)) { // Wrong Password
          state = 20;
        }
      }
    }

    if (state == 0) {
      state = (byte) c.deleteCharacter(Character_ID);
    }
    c.getSession().write(LoginPacket.deleteCharResponse(Character_ID, state));
  }
Пример #4
0
  public static final void CharlistRequest(final LittleEndianAccessor slea, final MapleClient c) {
    if (!c.isLoggedIn()) {
      c.getSession().close();
      return;
    }
    if (GameConstants.GMS) {
      slea.readByte(); // 2?
    }
    final int server = slea.readByte();
    final int channel = slea.readByte() + 1;
    if (!World.isChannelAvailable(channel) || server != 0) { // TODOO: MULTI WORLDS
      c.getSession().write(LoginPacket.getLoginFailed(10)); // cannot process so many
      return;
    }

    // System.out.println("Client " + c.getSession().getRemoteAddress().toString().split(":")[0] + "
    // is connecting to server " + server + " channel " + channel + "");

    final List<MapleCharacter> chars = c.loadCharacters(server);
    if (chars != null && ChannelServer.getInstance(channel) != null) {
      c.setWorld(server);
      c.setChannel(channel);
      c.getSession().write(LoginPacket.getSecondAuthSuccess(c));
      c.getSession()
          .write(LoginPacket.getCharList(c.getSecondPassword(), chars, c.getCharacterSlots()));
    } else {
      c.getSession().close();
    }
  }
Пример #5
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));
  }
Пример #6
0
 public static void ViewChar(LittleEndianAccessor slea, MapleClient c) {
   Map<Byte, ArrayList<MapleCharacter>> worlds = new HashMap<Byte, ArrayList<MapleCharacter>>();
   List<MapleCharacter> chars = c.loadCharacters(0); // TODO multi world
   c.getSession().write(LoginPacket.showAllCharacter(chars.size()));
   for (MapleCharacter chr : chars) {
     if (chr != null) {
       ArrayList<MapleCharacter> chrr;
       if (!worlds.containsKey(chr.getWorld())) {
         chrr = new ArrayList<MapleCharacter>();
         worlds.put(chr.getWorld(), chrr);
       } else {
         chrr = worlds.get(chr.getWorld());
       }
       chrr.add(chr);
     }
   }
   for (Entry<Byte, ArrayList<MapleCharacter>> w : worlds.entrySet()) {
     c.getSession()
         .write(LoginPacket.showAllCharacterInfo(w.getKey(), w.getValue(), c.getSecondPassword()));
   }
 }
Пример #7
0
 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));
   }
 }