@Override
  public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) {
    if (activeChar.getAccessLevel().isGm()) {
      activeChar.setTarget(target);
      final L2DoorInstance door = (L2DoorInstance) target;
      activeChar.sendPacket(new StaticObject(door, activeChar.isGM()));

      final NpcHtmlMessage html = new NpcHtmlMessage();
      html.setFile(activeChar.getHtmlPrefix(), "html/admin/doorinfo.htm");
      html.replace("%class%", target.getClass().getSimpleName());
      html.replace("%hp%", String.valueOf((int) door.getCurrentHp()));
      html.replace("%hpmax%", String.valueOf(door.getMaxHp()));
      html.replace("%objid%", String.valueOf(target.getObjectId()));
      html.replace("%doorid%", String.valueOf(door.getId()));

      html.replace("%minx%", String.valueOf(door.getX(0)));
      html.replace("%miny%", String.valueOf(door.getY(0)));
      html.replace("%minz%", String.valueOf(door.getZMin()));

      html.replace("%maxx%", String.valueOf(door.getX(2)));
      html.replace("%maxy%", String.valueOf(door.getY(2)));
      html.replace("%maxz%", String.valueOf(door.getZMax()));
      html.replace(
          "%unlock%",
          door.isOpenableBySkill()
              ? "<font color=00FF00>YES<font>"
              : "<font color=FF0000>NO</font>");

      activeChar.sendPacket(html);
    }
    return true;
  }
示例#2
0
  /**
   * Called on every onAction in L2PcIstance<br>
   * <br>
   *
   * @param playerInstance
   * @param targetedPlayerObjectId
   * @return boolean: true if player is allowed to target, otherwise false
   */
  public static boolean onAction(L2PcInstance playerInstance, int targetedPlayerObjectId) {
    if ((playerInstance == null) || !isStarted()) {
      return true;
    }

    if (playerInstance.isGM()) {
      return true;
    }

    final byte playerTeamId = getParticipantTeamId(playerInstance.getObjectId());
    final byte targetedPlayerTeamId = getParticipantTeamId(targetedPlayerObjectId);

    if (((playerTeamId != -1) && (targetedPlayerTeamId == -1))
        || ((playerTeamId == -1) && (targetedPlayerTeamId != -1))) {
      return false;
    }

    if ((playerTeamId != -1)
        && (targetedPlayerTeamId != -1)
        && (playerTeamId == targetedPlayerTeamId)
        && (playerInstance.getObjectId() != targetedPlayerObjectId)
        && !Config.TVT_EVENT_TARGET_TEAM_MEMBERS_ALLOWED) {
      return false;
    }

    return true;
  }