Пример #1
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);
    }
  }
Пример #2
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();
    }
  }
Пример #3
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()));
   }
 }