Ejemplo n.º 1
0
 @Override
 public void execute(MapleClient c, MessageCallback mc, String[] splitted)
     throws Exception, IllegalCommandSyntaxException {
   if (splitted[0].equals("!whosthere")) {
     MessageCallback callback = new ServernoticeMapleClientMessageCallback(c);
     StringBuilder builder = new StringBuilder("Players on Map: ");
     for (MapleCharacter chr : c.getPlayer().getMap().getCharacters()) {
       if (builder.length() > 150) { // wild guess :o
         builder.setLength(builder.length() - 2);
         callback.dropMessage(builder.toString());
         builder = new StringBuilder();
       }
       builder.append(MapleCharacter.makeMapleReadable(chr.getName()));
       builder.append(", ");
     }
     builder.setLength(builder.length() - 2);
     c.getSession().write(MaplePacketCreator.serverNotice(6, builder.toString()));
   } else if (splitted[0].equals("!cheaters")) {
     try {
       List<CheaterData> cheaters =
           c.getChannelServer().getWorldInterface().getCheaters(c.getWorld());
       for (int x = cheaters.size() - 1; x >= 0; x--) {
         CheaterData cheater = cheaters.get(x);
         mc.dropMessage(cheater.getInfo());
       }
     } catch (RemoteException e) {
       c.getChannelServer().reconnectWorld();
     }
   }
 }
Ejemplo n.º 2
0
  public static void CreateChar(LittleEndianAccessor slea, MapleClient c) {
    String name = slea.readMapleAsciiString();
    slea.skip(4);
    final JobType jobType =
        JobType.getByType(
            slea
                .readInt()); // BIGBANG: 0 = Resistance, 1 = Adventurer, 2 = Cygnus, 3 = Aran, 4 =
                             // Evan, 5 = Mercedes
    final short subCategory = slea.readShort(); // whether dual blade = 1 or adventurer = 0
    final byte gender = slea.readByte();
    byte skinColor = slea.readByte(); // 01
    int hairColor = 0;
    slea.skip(1);
    boolean mercedes = (jobType == JobType.Mercedes);
    boolean demon = (jobType == JobType.Demon);
    boolean adventurer = (jobType == JobType.Adventurer);
    int face = slea.readInt();
    int hair = slea.readInt();

    final int demonMark = demon ? slea.readInt() : 0;
    int top = slea.readInt();
    int bottom = (mercedes || demon || adventurer) ? 0 : slea.readInt();
    int shoes = slea.readInt();
    int weapon = slea.readInt();
    int shield = demon ? slea.readInt() : (mercedes ? 1352000 : 0);

    MapleCharacter newchar = MapleCharacter.getDefault(c);
    newchar.setWorld((byte) c.getWorld());
    newchar.setFace(face);
    newchar.setHair(hair + hairColor);
    newchar.setGender(gender);
    newchar.setName(name);
    newchar.setSkinColor(skinColor);
    newchar.setDemonMarking(demonMark);
    newchar.setSubcategory(subCategory);

    MapleInventory equip = newchar.getInventory(MapleInventoryType.EQUIPPED);
    Item eq_top = MapleItemInformationProvider.getInstance().getEquipById(top);
    eq_top.setPosition((byte) -5);
    equip.addFromDB(eq_top);
    Item eq_bottom = MapleItemInformationProvider.getInstance().getEquipById(bottom);
    eq_bottom.setPosition((byte) -6);
    Item eq_shoes = MapleItemInformationProvider.getInstance().getEquipById(shoes);
    eq_shoes.setPosition((byte) -7);
    equip.addFromDB(eq_shoes);
    Item eq_weapon = MapleItemInformationProvider.getInstance().getEquipById(weapon);
    eq_weapon.setPosition((byte) -11);
    equip.addFromDB(eq_weapon);

    if (MapleCharacterUtil.canCreateChar(name, false)
        && !LoginInformationProvider.getInstance().isForbiddenName(name)) {
      MapleCharacter.saveNewCharToDB(newchar, (short) 0);
      c.getSession().write(LoginPacket.addNewCharEntry(newchar, true));
      c.createdChar(newchar.getId());
    } else {
      c.getSession().write(LoginPacket.addNewCharEntry(newchar, false));
    }
    newchar = null;
  }
Ejemplo n.º 3
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));
  }
Ejemplo n.º 4
0
 public static final void updateCCards(LittleEndianAccessor slea, MapleClient c) {
   if ((slea.available() != 36) || (!c.isLoggedIn())) {
     c.getSession().close(true);
     return;
   }
   Map<Integer, Integer> cids = new LinkedHashMap();
   for (int i = 1; i <= 9; i++) {
     int charId = slea.readInt();
     if (((!c.login_Auth(charId)) && (charId != 0))
         || (ChannelServer.getInstance(c.getChannel()) == null)
         || (c.getWorld() != 0)) {
       c.getSession().close(true);
       return;
     }
     cids.put(Integer.valueOf(i), Integer.valueOf(charId));
   }
   c.updateCharacterCards(cids);
 }
Ejemplo n.º 5
0
 public static final void updateCCards(final LittleEndianAccessor slea, final MapleClient c) {
   if (slea.available() != 24 || !c.isLoggedIn()) {
     c.getSession().close();
     return;
   }
   final Map<Integer, Integer> cids = new LinkedHashMap<>();
   for (int i = 1; i <= 6; i++) { // 6 chars
     final int charId = slea.readInt();
     if ((!c.login_Auth(charId) && charId != 0)
         || ChannelServer.getInstance(c.getChannel()) == null
         || c.getWorld() != 0) {
       c.getSession().close();
       return;
     }
     cids.put(i, charId);
   }
   c.updateCharacterCards(cids);
 }
Ejemplo n.º 6
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));
   }
 }
  @Override
  public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
    int cid = slea.readInt();
    MapleCharacter player = null;
    try {
      player = MapleCharacter.loadCharFromDB(cid, c, true);
      c.setPlayer(player);
    } catch (SQLException e) {
    }
    c.setAccID(player.getAccountID());
    int state = c.getLoginState();
    boolean allowLogin = true;
    ChannelServer cserv = c.getChannelServer();
    synchronized (this) {
      try {
        WorldChannelInterface worldInterface = cserv.getWorldInterface();
        if (state == MapleClient.LOGIN_SERVER_TRANSITION) {
          for (String charName : c.loadCharacterNames(c.getWorld())) {
            if (worldInterface.isConnected(charName)) {
              int chanNum = c.getChannelServer().getWorldInterface().getLocation(charName).channel;
              System.err.print(
                  charName
                      + " on channel "
                      + chanNum
                      + " has been unstuck, for bug-testing purposes.");
              MapleCharacter player_to_dc =
                  ChannelServer.getInstance(chanNum)
                      .getPlayerStorage()
                      .getCharacterByName(charName);
              if (player_to_dc.getEventInstance() != null)
                player_to_dc.getEventInstance().removePlayer(player_to_dc);
              player_to_dc.getMap().removePlayer(player_to_dc);
              ChannelServer.getInstance(chanNum).removePlayer(player_to_dc);
              player_to_dc.getClient().disconnect();
              player_to_dc.getClient().getSession().close();
              c.disconnect();
              allowLogin = false;
              break;
            }
          }
        }
      } catch (RemoteException e) {
        cserv.reconnectWorld();
        allowLogin = false;
      } catch (Exception e) {
        System.out.println("Error unsticking char:");
        e.printStackTrace();
      }
      if (state != MapleClient.LOGIN_SERVER_TRANSITION || !allowLogin) {
        c.setPlayer(null);
        c.getSession().close(true);
        return;
      }
      c.updateLoginState(MapleClient.LOGIN_LOGGEDIN);
    }
    cserv.addPlayer(player);
    try {
      List<PlayerBuffValueHolder> buffs = cserv.getWorldInterface().getBuffsFromStorage(cid);
      if (buffs != null) {
        c.getPlayer().silentGiveBuffs(buffs);
      }
    } catch (RemoteException e) {
      cserv.reconnectWorld();
    }
    Connection con = DatabaseConnection.getConnection();
    try {
      PreparedStatement ps =
          con.prepareStatement("SELECT SkillID,StartTime,length FROM cooldowns WHERE charid = ?");
      ps.setInt(1, c.getPlayer().getId());
      ResultSet rs = ps.executeQuery();
      while (rs.next()) {
        final long length = rs.getLong("length"), startTime = rs.getLong("StartTime");
        if (length + startTime > System.currentTimeMillis()) {
          c.getPlayer().giveCoolDowns(rs.getInt("SkillID"), startTime, length);
        }
      }
      rs.close();
      ps.close();
      ps = con.prepareStatement("DELETE FROM cooldowns WHERE charid = ?");
      ps.setInt(1, c.getPlayer().getId());
      ps.executeUpdate();
      ps.close();
      ps =
          con.prepareStatement(
              "SELECT Mesos FROM dueypackages WHERE RecieverId = ? and Checked = 1");
      ps.setInt(1, c.getPlayer().getId());
      rs = ps.executeQuery();
      if (rs.next()) {
        try {
          PreparedStatement pss =
              DatabaseConnection.getConnection()
                  .prepareStatement("UPDATE dueypackages SET Checked = 0 where RecieverId = ?");
          pss.setInt(1, c.getPlayer().getId());
          pss.executeUpdate();
          pss.close();
        } catch (SQLException e) {
        }
        c.getSession().write(MaplePacketCreator.sendDueyMSG((byte) 0x1B));
      }
      rs.close();
      ps.close();
      rs = null;
      ps = null;
    } catch (SQLException e) {
      e.printStackTrace();
    }
    c.getSession().write(MaplePacketCreator.getCharInfo(player));
    c.getPlayer().InitiateSaveEvent();
    if (player.isGM()) {
      SkillFactory.getSkill(GM.HIDE).getEffect(1).applyTo(player);
    }
    player.sendKeymap();
    player.sendMacros();
    player.getMap().addPlayer(player);
    try {
      int buddyIds[] = player.getBuddylist().getBuddyIds();
      cserv
          .getWorldInterface()
          .loggedOn(player.getName(), player.getId(), c.getChannel(), buddyIds);
      for (CharacterIdChannelPair onlineBuddy :
          cserv.getWorldInterface().multiBuddyFind(player.getId(), buddyIds)) {
        BuddylistEntry ble = player.getBuddylist().get(onlineBuddy.getCharacterId());
        ble.setChannel(onlineBuddy.getChannel());
        player.getBuddylist().put(ble);
      }
      c.getSession().write(MaplePacketCreator.updateBuddylist(player.getBuddylist().getBuddies()));
    } catch (RemoteException e) {
      cserv.reconnectWorld();
    }
    /*  c.getSession().write(MaplePacketCreator.loadFamily(player));
    if (player.getFamilyId() > 0) {
        c.getSession().write(MaplePacketCreator.getFamilyInfo(player));
    }*/
    if (player.getGuildId() > 0) {
      try {
        MapleGuild playerGuild =
            cserv.getWorldInterface().getGuild(player.getGuildId(), player.getMGC());
        if (playerGuild == null) {
          player.deleteGuild(player.getGuildId());
          player.resetMGC();
          player.setGuildId(0);
        } else {
          cserv.getWorldInterface().setGuildMemberOnline(player.getMGC(), true, c.getChannel());
          c.getSession().write(MaplePacketCreator.showGuildInfo(player));
          int allianceId = player.getGuild().getAllianceId();
          if (allianceId > 0) {
            MapleAlliance newAlliance = cserv.getWorldInterface().getAlliance(allianceId);
            if (newAlliance == null) {
              newAlliance = MapleAlliance.loadAlliance(allianceId);
              if (newAlliance != null) {
                cserv.getWorldInterface().addAlliance(allianceId, newAlliance);
              } else {
                player.getGuild().setAllianceId(0);
              }
            }
            if (newAlliance != null) {
              c.getSession().write(MaplePacketCreator.getAllianceInfo(newAlliance));
              c.getSession().write(MaplePacketCreator.getGuildAlliances(newAlliance, c));
              cserv
                  .getWorldInterface()
                  .allianceMessage(
                      allianceId,
                      MaplePacketCreator.allianceMemberOnline(player, true),
                      player.getId(),
                      -1);
            }
          }
        }
      } catch (RemoteException e) {
        cserv.reconnectWorld();
      }
    }
    try {
      //  c.getPlayer().showNote();
      if (player.getParty() != null) {
        cserv
            .getWorldInterface()
            .updateParty(
                player.getParty().getId(),
                PartyOperation.LOG_ONOFF,
                new MaplePartyCharacter(player));
      }
      player.updatePartyMemberHP();
    } catch (RemoteException e) {
      cserv.reconnectWorld();
    }
    for (MapleQuestStatus status : player.getStartedQuests()) {
      if (status.hasMobKills()) {
        c.getSession().write(MaplePacketCreator.updateQuestMobKills(status));
      }
    }
    CharacterNameAndId pendingBuddyRequest = player.getBuddylist().pollPendingRequest();
    if (pendingBuddyRequest != null) {
      player
          .getBuddylist()
          .put(
              new BuddylistEntry(
                  pendingBuddyRequest.getName(), "그룹 미지정", pendingBuddyRequest.getId(), -1, false));
      c.getSession()
          .write(
              MaplePacketCreator.requestBuddylistAdd(
                  pendingBuddyRequest.getId(),
                  c.getPlayer().getId(),
                  pendingBuddyRequest.getName(),
                  0,
                  0)); // todo: make actual levels / jobids appear
    }
    c.getSession().write(MaplePacketCreator.updateBuddylist(player.getBuddylist().getBuddies()));
    //    c.getSession().write(MaplePacketCreator.updateGender(player));
    player.checkMessenger();
    //  c.getSession().write(MaplePacketCreator.enableReport());
    /*     if (!player.isGM() && !player.hasWatchedCygnusIntro() && player.getLevel() > 19 && !player.isCygnus() && player.getCygnusLinkId() == 0) {
        player.startCygnusIntro();
        player.setWatchedCygnusIntro(true);
    }*/
    // unneeded in 83+ as cygnus is created at char select

    ISkill bof =
        SkillFactory.getSkill(
            10000000 * player.getJobType() + 12); // todo: find opcode and re-enable
    player.changeSkillLevel(bof, player.getLinkedLevel() / 10, bof.getMaxLevel());
    player.checkBerserk();
    player.expirationTask();
    player.setRates(false);
  }
Ejemplo n.º 8
0
  public static void EnterFarm(final CharacterTransfer transfer, final MapleClient c) {
    if (transfer == null) {
      c.getSession().close(true);
      return;
    }
    MapleCharacter chr = MapleCharacter.ReconstructChr(transfer, c, false);

    c.setPlayer(chr);
    c.setAccID(chr.getAccountID());

    if (!c.CheckIPAddress()) { // Remote hack
      c.getSession().close(true);
      return;
    }

    final int state = c.getLoginState();
    boolean allowLogin = false;
    if (state == MapleClient.LOGIN_SERVER_TRANSITION || state == MapleClient.CHANGE_CHANNEL) {
      if (!World.isCharacterListConnected(c.loadCharacterNames(c.getWorld()))) {
        allowLogin = true;
      }
    }
    if (!allowLogin) {
      c.setPlayer(null);
      c.getSession().close(true);
      return;
    }
    c.updateLoginState(MapleClient.LOGIN_LOGGEDIN, c.getSessionIPAddress());
    FarmServer.getPlayerStorage().registerPlayer(chr);
    c.getSession().write(FarmPacket.updateMonster(new LinkedList()));
    c.getSession().write(FarmPacket.enterFarm(c));
    c.getSession().write(FarmPacket.farmQuestData(new LinkedList(), new LinkedList()));
    c.getSession().write(FarmPacket.updateMonsterInfo(new LinkedList()));
    c.getSession().write(FarmPacket.updateAesthetic(c.getFarm().getAestheticPoints()));
    c.getSession().write(FarmPacket.spawnFarmMonster1());
    c.getSession().write(FarmPacket.farmPacket1());
    c.getSession().write(FarmPacket.updateFarmFriends(new LinkedList()));
    c.getSession().write(FarmPacket.updateFarmInfo(c));
    // c.getSession().write(CField.getPacketFromHexString("19 72 1E 02 00 00 00 00 00 00 00 00 00 00
    // 00 00 0B 00 43 72 65 61 74 69 6E 67 2E 2E 2E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    // 00 00 00 00 02 00 00 00 00 00 00 00 00 01 00 00 00 00 0B 00 43 72 65 61 74 69 6E 67 2E 2E 2E
    // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 01 00
    // 00 00 00 00 00 00 00 FF FF FF FF 00"));
    c.getSession().write(FarmPacket.updateQuestInfo(21002, (byte) 1, ""));
    SimpleDateFormat sdfGMT = new SimpleDateFormat("yyyy-MM-dd-HH-mm");
    sdfGMT.setTimeZone(TimeZone.getTimeZone("Canada/Pacific"));
    String timeStr = sdfGMT.format(Calendar.getInstance().getTime()).replaceAll("-", "");
    c.getSession().write(FarmPacket.updateQuestInfo(21001, (byte) 1, timeStr));
    c.getSession().write(FarmPacket.updateQuestInfo(21003, (byte) 1, "30"));
    c.getSession().write(FarmPacket.updateUserFarmInfo(chr, false));
    List<Pair<MapleFarm, Integer>> ranking = new LinkedList();
    ranking.add(new Pair<>(MapleFarm.getDefault(1, c, "Pyrous"), 999999));
    ranking.add(new Pair<>(MapleFarm.getDefault(1, c, "Sango"), 1));
    ranking.add(new Pair<>(MapleFarm.getDefault(1, c, "Hemmi"), -1));
    c.getSession().write(FarmPacket.sendFarmRanking(chr, ranking));
    c.getSession()
        .write(
            FarmPacket.updateAvatar(new Pair<>(WorldConstants.getMainWorld(), chr), null, false));
    if (c.getFarm().getName().equals("Creating...")) {
      c.getSession().write(FarmPacket.updateQuestInfo(1111, (byte) 0, "A1/"));
      c.getSession().write(FarmPacket.updateQuestInfo(2001, (byte) 0, "A1/"));
    }
  }
Ejemplo n.º 9
0
  public static void CreateChar(final LittleEndianAccessor slea, final MapleClient c) {
    if (!c.isLoggedIn()) {
      c.getSession().close();
      return;
    }
    final String name = slea.readMapleAsciiString();
    final JobType jobType =
        JobType.getByType(
            slea.readInt()); // BIGBANG: 0 = Resistance, 1 = Adventurer, 2 = Cygnus, 3 = Aran, 4 =
    // Evan, 5 = mercedes
    final short db = slea.readShort(); // whether dual blade = 1 or adventurer = 0
    final byte gender = slea.readByte(); // ??idk corresponds with the thing in addCharStats
    byte skinColor = slea.readByte(); // 01
    int hairColor = 0;
    final byte unk2 = slea.readByte(); // 08
    final boolean mercedes = (jobType == JobType.Mercedes);
    final boolean demon = (jobType == JobType.Demon);
    final boolean mihile = (jobType == JobType.Mihile);
    boolean jettPhantom =
        (jobType == LoginInformationProvider.JobType.Jett)
            || (jobType == LoginInformationProvider.JobType.Phantom)
            || (jobType == LoginInformationProvider.JobType.DualBlade);
    final int face = slea.readInt();
    final int hair = slea.readInt();
    if (!mercedes
        && !mihile
        && !demon
        && !jettPhantom) { // mercedes/demon dont need hair color since its already in the hair
      hairColor = slea.readInt();
      skinColor = (byte) slea.readInt();
    }
    final int demonMark = demon ? slea.readInt() : 0;
    final int top = (mihile) ? 0 : slea.readInt();
    final int bottom = (mihile) ? 0 : slea.readInt();
    final int shoes = (mihile) ? 0 : slea.readInt();
    final int weapon =
        jobType == LoginInformationProvider.JobType.Phantom
            ? 1362046
            : mercedes ? 1522038 : (mihile || demon) ? 0 : slea.readInt();
    int shield =
        jobType == LoginInformationProvider.JobType.Phantom
            ? 1352100
            : jobType == LoginInformationProvider.JobType.Mihile
                ? 1098000
                : mercedes ? 1352000 : demon ? slea.readInt() : 0;
    MapleCharacter newchar = MapleCharacter.getDefault(c, jobType);
    newchar.setWorld((byte) c.getWorld());
    newchar.setFace(face);
    newchar.setHair(hair + hairColor);
    newchar.setGender(gender);
    newchar.setName(name);
    newchar.setSkinColor(skinColor);
    newchar.setDemonMarking(demonMark);

    final MapleItemInformationProvider li = MapleItemInformationProvider.getInstance();
    final MapleInventory equip = newchar.getInventory(MapleInventoryType.EQUIPPED);

    Item item = li.getEquipById(top);
    item.setPosition((byte) -5);
    equip.addFromDB(item);

    if (bottom > 0) { // resistance have overall
      item = li.getEquipById(bottom);
      item.setPosition((short) (byte) (jettPhantom ? -9 : -6));
      equip.addFromDB(item);
    }

    item = li.getEquipById(shoes);
    item.setPosition((byte) -7);
    equip.addFromDB(item);

    item = li.getEquipById(weapon);
    item.setPosition((byte) -11);
    equip.addFromDB(item);

    if (shield > 0) {
      item = li.getEquipById(shield);
      item.setPosition((byte) -10);
      equip.addFromDB(item);
    }

    newchar
        .getInventory(MapleInventoryType.USE)
        .addItem(new Item(2000013, (byte) 0, (short) 100, (byte) 0));
    newchar
        .getInventory(MapleInventoryType.USE)
        .addItem(new Item(2000014, (byte) 0, (short) 100, (byte) 0));
    // blue/red pots
    switch (jobType) {
      case Resistance: // Resistance
        newchar
            .getInventory(MapleInventoryType.ETC)
            .addItem(new Item(4161001, (byte) 0, (short) 1, (byte) 0));
        final Map<Skill, SkillEntry> ss = new HashMap<>();
        ss.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss, false);
        break;
      case Adventurer: // Adventurer
        newchar
            .getInventory(MapleInventoryType.ETC)
            .addItem(new Item(4161001, (byte) 0, (short) 1, (byte) 0));
        final Map<Skill, SkillEntry> ss1 = new HashMap<>();
        ss1.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss1, false);
        break;
      case Cygnus: // Cygnus
        newchar
            .getInventory(MapleInventoryType.ETC)
            .addItem(new Item(4161047, (byte) 0, (short) 1, (byte) 0));
        newchar.setQuestAdd(MapleQuest.getInstance(20022), (byte) 1, "1");
        newchar.setQuestAdd(MapleQuest.getInstance(20010), (byte) 1, null); // >_>_>_> ugh
        final Map<Skill, SkillEntry> ss2 = new HashMap<>();
        ss2.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss2, false);
        break;
      case Aran: // Aran
        newchar
            .getInventory(MapleInventoryType.ETC)
            .addItem(new Item(4161048, (byte) 0, (short) 1, (byte) 0));
        final Map<Skill, SkillEntry> ss3 = new HashMap<>();
        ss3.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss3, false);
        break;
      case Evan: // Evan
        newchar
            .getInventory(MapleInventoryType.ETC)
            .addItem(new Item(4161052, (byte) 0, (short) 1, (byte) 0));
        final Map<Skill, SkillEntry> ss4 = new HashMap<>();
        ss4.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss4, false);
        break;
      case Mercedes: // Mercedes
        newchar
            .getInventory(MapleInventoryType.ETC)
            .addItem(new Item(4161079, (byte) 0, (short) 1, (byte) 0));
        final Map<Skill, SkillEntry> ss5 = new HashMap<>();
        ss5.put(SkillFactory.getSkill(20021000), new SkillEntry((byte) 0, (byte) 0, -1));
        ss5.put(SkillFactory.getSkill(20021001), new SkillEntry((byte) 0, (byte) 0, -1));
        ss5.put(SkillFactory.getSkill(20020002), new SkillEntry((byte) 0, (byte) 0, -1));
        ss5.put(SkillFactory.getSkill(20020022), new SkillEntry((byte) 1, (byte) 1, -1));
        ss5.put(SkillFactory.getSkill(20020109), new SkillEntry((byte) 1, (byte) 1, -1));
        ss5.put(SkillFactory.getSkill(20021110), new SkillEntry((byte) 1, (byte) 1, -1));
        ss5.put(SkillFactory.getSkill(20020111), new SkillEntry((byte) 1, (byte) 1, -1));
        ss5.put(SkillFactory.getSkill(20020112), new SkillEntry((byte) 1, (byte) 1, -1));
        ss5.put(SkillFactory.getSkill(20021181), new SkillEntry((byte) -1, (byte) 0, -1));
        ss5.put(SkillFactory.getSkill(20021166), new SkillEntry((byte) -1, (byte) 0, -1));
        ss5.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss5, false);
        break;
      case Demon: // Demon
        newchar
            .getInventory(MapleInventoryType.ETC)
            .addItem(new Item(4161054, (byte) 0, (short) 1, (byte) 0));
        final Map<Skill, SkillEntry> ss6 = new HashMap<>();
        ss6.put(SkillFactory.getSkill(30011000), new SkillEntry((byte) 0, (byte) 0, -1));
        ss6.put(SkillFactory.getSkill(30011001), new SkillEntry((byte) 0, (byte) 0, -1));
        ss6.put(SkillFactory.getSkill(30010002), new SkillEntry((byte) 0, (byte) 0, -1));
        ss6.put(SkillFactory.getSkill(30010185), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30010112), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30010111), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30010110), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30010022), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30011109), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30011170), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30011169), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30011168), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30011167), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30010166), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss6, false);
        break;

      case Phantom:
        newchar.setLevel((short) 10);
        newchar.setJob(2400);
        newchar.getStat().maxhp += 294; // Beginner 10 levels
        newchar.getStat().maxmp += 113;
        newchar.getStat().hp += 294; // Beginner 10 levels
        newchar.getStat().mp += 113;
        newchar.getStat().str -= 8;
        newchar.getStat().dex -= 1;
        newchar.getStat().luk += 31;
        newchar.setRemainingAp((short) 23);
        newchar.setRemainingSp(5);
        final Map<Skill, SkillEntry> ss7 = new HashMap<>();
        ss7.put(SkillFactory.getSkill(20031203), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(20030204), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(20031205), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(20030206), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(20031207), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(20031208), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(20031209), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(20031210), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss7, false);
        break;

      case Jett:
        newchar.setLevel((short) 10);
        newchar.setJob(508);
        newchar.getStat().maxhp += 294; // Beginner 10
        newchar.getStat().maxmp += 113;
        newchar.getStat().hp += 294; // Beginner 10
        newchar.getStat().mp += 113;
        newchar.getStat().str -= 8;
        newchar.getStat().dex += 15;
        newchar.setRemainingAp((short) 38);
        newchar.setRemainingSp(1);
        final Map<Skill, SkillEntry> ss8 = new HashMap<>();
        ss8.put(SkillFactory.getSkill(228), new SkillEntry((byte) 1, (byte) 1, -1));
        ss8.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        // ss8.put(SkillFactory.getSkill(80001151), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss8, false);
        break;

      case Mihile:
        final Map<Skill, SkillEntry> ss9 = new HashMap<>();
        ss9.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss9, false);
        break;
    }

    if (MapleCharacterUtil.canCreateChar(name, c.isGm())
        && (!LoginInformationProvider.getInstance().isForbiddenName(name) || c.isGm())
        && (c.isGm() || c.canMakeCharacter(c.getWorld()))) {
      MapleCharacter.saveNewCharToDB(newchar, jobType, db);
      c.getSession().write(LoginPacket.addNewCharEntry(newchar, true));
      c.createdChar(newchar.getId());
    } else {
      c.getSession().write(LoginPacket.addNewCharEntry(newchar, false));
    }
  }