Beispiel #1
0
  private void jButton1ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed
    // TODO add your handling code here:

    ItemTable i = new ItemTable();
    i.setVisible(true);
    i.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  } // GEN-LAST:event_jButton1ActionPerformed
 private void loadWeaponSkills(HashMap<Integer, L1WeaponSkill> weaponSkills) {
   Connection con = null;
   PreparedStatement pstm = null;
   ResultSet rs = null;
   try {
     PerformanceTimer timer = new PerformanceTimer();
     con = L1DatabaseFactory.getInstance().getConnection();
     pstm = con.prepareStatement("SELECT * FROM weapon_skills");
     rs = pstm.executeQuery();
     while (rs.next()) {
       int weaponId = rs.getInt("item_id");
       int skillId = rs.getInt("skill_id");
       boolean isErr = false;
       if (ItemTable.getInstance().getTemplate(weaponId) == null) {
         System.out.println(String.format(I18N_DOES_NOT_EXIST_ITEM_LIST, weaponId));
         // %s はアイテムリストに存在しません。
         isErr = true;
       }
       if (SkillTable.getInstance().findBySkillId(skillId) == null) {
         System.out.println(String.format(I18N_DOES_NOT_EXIST_SKILL_LIST, skillId));
         // %s はスキルリストに存在しません。
         isErr = true;
       }
       if (isErr) {
         continue;
       }
       int probability = rs.getInt("probability");
       int probEnchant = rs.getInt("prob_enchant");
       int fixDamage = rs.getInt("fix_damage");
       int randomDamage = rs.getInt("random_damage");
       boolean isArrowType = rs.getBoolean("arrow_type");
       boolean enableMr = rs.getBoolean("enable_mr");
       boolean enableAttrMr = rs.getBoolean("enable_attr_mr");
       L1WeaponSkill weaponSkill =
           new L1WeaponSkill(
               weaponId,
               probability,
               probEnchant,
               fixDamage,
               randomDamage,
               skillId,
               isArrowType,
               enableMr,
               enableAttrMr);
       weaponSkills.put(weaponId, weaponSkill);
     }
     _log.fine("Loaded weapon skill: " + weaponSkills.size() + "records");
     System.out.println("loading weapon skills...OK! " + timer.elapsedTimeMillis() + "ms");
   } catch (SQLException e) {
     _log.log(Level.SEVERE, "error while creating weapon_skills table", e);
   } finally {
     SqlUtil.close(rs, pstm, con);
   }
 }