예제 #1
0
파일: Fort.java 프로젝트: rean1m5/lucera2
 // This method loads fort flagpoles data from database
 private void loadFlagPoles() {
   Connection con = null;
   try {
     con = L2DatabaseFactory.getInstance().getConnection();
     PreparedStatement statement =
         con.prepareStatement(
             "SELECT * FROM fort_staticobjects WHERE fortId = ? AND objectType = ?");
     statement.setInt(1, getFortId());
     statement.setInt(2, 1);
     ResultSet rs = statement.executeQuery();
     while (rs.next()) {
       _flagPole =
           new L2ArtefactInstance(
               IdFactory.getInstance().getNextId(), NpcTable.getInstance().getTemplate(32027));
       _flagPole.setName(getName());
       _flagPole.spawnMe(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
       _flagPole.setIsInvul(true);
       _flagPole.setFort(this);
     }
     rs.close();
     statement.close();
   } catch (Exception e) {
     _log.warn("Exception: loadFlagPoles(): " + e.getMessage());
     e.printStackTrace();
   } finally {
     try {
       con.close();
     } catch (Exception e) {
       _log.warn("" + e.getMessage());
       e.printStackTrace();
     }
   }
 }
예제 #2
0
파일: Fort.java 프로젝트: rean1m5/lucera2
  /**
   * Show or hide flag inside flagpole<br>
   * <br>
   */
  public void setVisibleFlag(boolean val) {
    if (val) {
      if (_flag == null) {
        _flag =
            new L2NpcInstance(
                IdFactory.getInstance().getNextId(), NpcTable.getInstance().getTemplate(35062));
        _flag.spawnMe(_flagPole.getX(), _flagPole.getY(), _flagPole.getZ());
        _flag.setIsInvul(true);
      }

    } else if (_flag != null) {
      _flag.deleteMe();
      _flag = null;
    }
  }
예제 #3
0
 private void dropDebugItem(int itemId, int num, AbstractNodeLoc loc) {
   final L2ItemInstance item = new L2ItemInstance(IdFactory.getInstance().getNextId(), itemId);
   item.setCount(num);
   item.spawnMe(loc.getX(), loc.getY(), loc.getZ());
   _debugItems.add(item);
 }