Ejemplo n.º 1
0
 /** Respawn all doors */
 public void spawnDoor(boolean isDoorWeak) {
   for (int i = 0; i < getDoors().size(); i++) {
     L2DoorInstance door = getDoors().get(i);
     if (door.getStatus().getCurrentHp() <= 0) {
       door.decayMe(); // Kill current if not killed already
       door = DoorTable.parseLine(_doorDefault.get(i));
       if (isDoorWeak) door.getStatus().setCurrentHp(door.getMaxHp() / 2);
       door.spawnMe(door.getX(), door.getY(), door.getZ());
       getDoors().set(i, door);
     } else if (door.getOpen()) door.closeMe();
   }
 }
Ejemplo n.º 2
0
  // This method loads fort door data from database
  private void loadDoor() {
    Connection con = null;
    try {
      con = L2DatabaseFactory.getInstance().getConnection(con);
      PreparedStatement statement =
          con.prepareStatement(
              "SELECT * FROM fort_staticobjects WHERE fortId = ? AND objectType = ?");
      statement.setInt(1, getFortId());
      statement.setInt(2, 0);
      ResultSet rs = statement.executeQuery();

      // L2EMU_EDIT Visor123
      while (rs.next()) {
        // Create list of the door default for use when respawning dead doors
        _doorDefault.add(
            rs.getString("name")
                + ";"
                + rs.getInt("id")
                + ";"
                + rs.getInt("x")
                + ";"
                + rs.getInt("y")
                + ";"
                + rs.getInt("z")
                + ";"
                + rs.getInt("range_xmin")
                + ";"
                + rs.getInt("range_ymin")
                + ";"
                + rs.getInt("range_zmin")
                + ";"
                + rs.getInt("range_xmax")
                + ";"
                + rs.getInt("range_ymax")
                + ";"
                + rs.getInt("range_zmax")
                + ";"
                + rs.getInt("hp")
                + ";"
                + rs.getInt("pDef")
                + ";"
                + rs.getInt("mDef")
                + ";"
                + rs.getString("openType")
                + ";"
                + rs.getString("commanderDoor"));
        L2DoorInstance door;
        _doors.add(door = DoorTable.parseLine(_doorDefault.get(_doorDefault.size() - 1)));
        door.spawnMe(door.getX(), door.getY(), door.getZ());
        DoorTable.getInstance().putDoor(door);
      }
      // L2EMU_EDIT

      rs.close();
      statement.close();
    } catch (Exception e) {
      _log.warn("Exception: loadFortDoor(): " + e.getMessage(), e);
    } finally {
      try {
        if (con != null) con.close();
      } catch (SQLException e) {
        e.printStackTrace();
      }
    }
  }