public L1UltimateBattle getUbForNpcId(int npcId) { for (L1UltimateBattle ub : _ub.values()) { if (ub.containsManager(npcId)) { return ub; } } return null; }
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() + "건 로드"); }