示例#1
0
  private void loadData(String SQL) {
    Connection con = null;
    try {
      con = L2DatabaseFactory.getInstance().getConnection(con);
      // L2EMU_EDIT
      PreparedStatement statement = con.prepareStatement(SQL);
      // L2EMU_EDIT
      ResultSet rset = statement.executeQuery();

      while (rset.next()) {
        int chest = rset.getInt("chest");
        int legs = rset.getInt("legs");
        int head = rset.getInt("head");
        int gloves = rset.getInt("gloves");
        int feet = rset.getInt("feet");
        int skill_id = rset.getInt("skill_id");
        int skill_lvl = rset.getInt("skill_lvl");

        // L2EMU_ADD
        int skillset_id = rset.getInt("skillset_id");
        // L2EMU_ADD

        int shield = rset.getInt("shield");
        int shield_skill_id = rset.getInt("shield_skill_id");
        int enchant6skill = rset.getInt("enchant6skill");

        // L2EMU_EDIT
        _armorSets.put(
            chest,
            new L2ArmorSet(
                chest,
                legs,
                head,
                gloves,
                feet,
                skill_id,
                skill_lvl,
                skillset_id,
                shield,
                shield_skill_id,
                enchant6skill));
        // L2EMU_EDIT
      }

      _log.info("ArmorSetsTable: Loaded " + _armorSets.size() + " armor sets.");

      rset.close();
      statement.close();
    } catch (Exception e) {
      _log.warn("Error while loading armor sets " + e.getMessage());
    } finally {
      try {
        if (con != null) con.close();
      } catch (Exception e) {
      }
    }
  }
示例#2
0
  private void loadTable() {

    java.sql.Connection con = null;
    PreparedStatement pstm = null;
    ResultSet rs = null;
    try {

      con = L1DatabaseFactory.getInstance().getConnection();
      pstm = con.prepareStatement("SELECT * FROM ub_settings");
      rs = pstm.executeQuery();
      L1UltimateBattle ub = null;
      while (rs.next()) {

        ub = new L1UltimateBattle();
        ub.setUbId(rs.getInt("ub_id"));
        ub.setMapId(rs.getShort("ub_mapid"));
        ub.setLocX1(rs.getInt("ub_area_x1"));
        ub.setLocY1(rs.getInt("ub_area_y1"));
        ub.setLocX2(rs.getInt("ub_area_x2"));
        ub.setLocY2(rs.getInt("ub_area_y2"));
        ub.setMinLevel(rs.getInt("min_lvl"));
        ub.setMaxLevel(rs.getInt("max_lvl"));
        ub.setMaxPlayer(rs.getInt("max_player"));
        ub.setEnterRoyal(rs.getBoolean("enter_royal"));
        ub.setEnterKnight(rs.getBoolean("enter_knight"));
        ub.setEnterMage(rs.getBoolean("enter_mage"));
        ub.setEnterElf(rs.getBoolean("enter_elf"));
        ub.setEnterDarkelf(rs.getBoolean("enter_darkelf"));
        ub.setEnterDragonknight(rs.getBoolean("enter_dragonknight"));
        ub.setEnterBlackwizard(rs.getBoolean("enter_blackwizard"));
        ub.setEnterMale(rs.getBoolean("enter_male"));
        ub.setEnterFemale(rs.getBoolean("enter_female"));
        ub.setUsePot(rs.getBoolean("use_pot"));
        ub.setHpr(rs.getInt("hpr_bonus"));
        ub.setMpr(rs.getInt("mpr_bonus"));
        ub.resetLoc();

        _ub.put(ub.getUbId(), ub);
      }
    } catch (SQLException e) {
      _log.warning("ubsettings couldnt be initialized:" + e);
    } finally {
      SQLUtil.close(rs);
      SQLUtil.close(pstm);
    }

    // ub_managers load
    try {
      pstm = con.prepareStatement("SELECT * FROM ub_managers");
      rs = pstm.executeQuery();
      L1UltimateBattle ub = null;
      while (rs.next()) {
        ub = getUb(rs.getInt("ub_id"));
        if (ub != null) {
          ub.addManager(rs.getInt("ub_manager_npc_id"));
        }
      }
    } catch (SQLException e) {
      _log.warning("ub_managers couldnt be initialized:" + e);
    } finally {
      SQLUtil.close(rs);
      SQLUtil.close(pstm);
    }

    // ub_times load
    try {
      pstm = con.prepareStatement("SELECT * FROM ub_times");
      rs = pstm.executeQuery();
      L1UltimateBattle ub = null;
      while (rs.next()) {
        ub = getUb(rs.getInt("ub_id"));
        if (ub != null) {
          ub.addUbTime(rs.getInt("ub_time"));
        }
      }
    } catch (SQLException e) {
      _log.warning("ub_times couldnt be initialized:" + e);
    } finally {
      SQLUtil.close(rs, pstm, con);
    }
    _log.config("UB리스트 " + _ub.size() + "건 로드");
  }