Exemplo n.º 1
0
  @SuppressWarnings("unchecked")
  private void restoreBBSBuff() {
    Connection con = null;
    PreparedStatement statement = null;
    try {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("SELECT * FROM bbs_buff");
      ResultSet rset = statement.executeQuery();

      while (rset.next()) {
        int idSkill = rset.getInt("id_skill");
        int lvlSkill = rset.getInt("lvl_skill");
        int idGroup = rset.getInt("id_group");
        if (this._skill.containsKey(Integer.valueOf(idGroup)))
          ((Map<Integer, Integer>) this._skill.get(Integer.valueOf(idGroup)))
              .put(Integer.valueOf(idSkill), Integer.valueOf(lvlSkill));
        else
          _log.warning("BuffBBSTable: no search group id " + idGroup + " for skill id " + idSkill);
      }
    } catch (Exception e) {
      _log.log(Level.SEVERE, "BuffBBSTable: Error reading buff_bbs table: " + e.getMessage(), e);
    } finally {
      L2DatabaseFactory.close(con);
    }
  }
Exemplo n.º 2
0
  private void restoreGroupBuff() {
    Connection con = null;
    PreparedStatement statement = null;
    try {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("SELECT * FROM bbs_group_buff");
      ResultSet rset = statement.executeQuery();

      while (rset.next()) {
        int idGroup = rset.getInt("id");
        String nameGroup = rset.getString("name");
        int priceGroup = rset.getInt("price");
        if (!this._groupBuff.containsKey(Integer.valueOf(idGroup))) {
          this._groupBuff.put(
              Integer.valueOf(idGroup), new BBSGroupBuffStat(priceGroup, nameGroup));
          this._skill.put(Integer.valueOf(idGroup), new FastMap<Object, Object>());
        }
      }
      _log.info("BuffBBSTable: Loaded " + this._groupBuff.size() + " group buff.");
    } catch (Exception e) {
      _log.log(
          Level.SEVERE, "BuffBBSTable: Error reading group_bbs_buff table: " + e.getMessage(), e);
    } finally {
      L2DatabaseFactory.close(con);
    }
  }