public ValidateLocation(L2Character cha) {
   _charObjId = cha.getObjectId();
   _x = cha.getX();
   _y = cha.getY();
   _z = cha.getZ();
   _heading = cha.getHeading();
 }
Exemple #2
0
  @Override
  public void useSkill(L2Character activeChar, L2Object[] targets) {
    if (activeChar instanceof L2PcInstance) {
      // Thanks nbd
      if (!TvTEvent.onEscapeUse(((L2PcInstance) activeChar).getObjectId())) {
        activeChar.sendPacket(ActionFailed.STATIC_PACKET);
        return;
      }
      // Check invalid states.
      if (activeChar.isAfraid()
          || ((L2PcInstance) activeChar).isInOlympiadMode()
          || (GrandBossManager.getInstance().getZone(activeChar) != null && !activeChar.isGM()))
        return;
    }

    for (L2Character target : (L2Character[]) targets) {
      if (target == null) return;

      if (target instanceof L2PcInstance) {
        L2PcInstance targetChar = (L2PcInstance) target;

        // Check invalid states.
        if (targetChar.isFestivalParticipant() || targetChar.isInJail() || targetChar.isInDuel())
          continue;

        if (targetChar != activeChar) {
          if (targetChar.isInOlympiadMode()) continue;

          if (GrandBossManager.getInstance().getZone(targetChar) != null) continue;
        }
      }

      Location loc = null;
      if (getSkillType() == L2SkillType.TELEPORT) {
        if (_loc != null) {
          if (!(target instanceof L2PcInstance) || !target.isFlying()) loc = _loc;
        }
      } else {
        if (_recallType.equalsIgnoreCase("Castle"))
          loc =
              MapRegionData.getInstance()
                  .getTeleToLocation(target, MapRegionData.TeleportWhereType.Castle);
        else if (_recallType.equalsIgnoreCase("ClanHall"))
          loc =
              MapRegionData.getInstance()
                  .getTeleToLocation(target, MapRegionData.TeleportWhereType.ClanHall);
        else
          loc =
              MapRegionData.getInstance()
                  .getTeleToLocation(target, MapRegionData.TeleportWhereType.Town);
      }

      if (loc != null) {
        if (target instanceof L2PcInstance) ((L2PcInstance) target).setIsIn7sDungeon(false);

        target.teleToLocation(loc, true);
      }
    }
  }
Exemple #3
0
 public final SystemMessage addCharName(final L2Character cha) {
   if (cha instanceof L2Npc) {
     if (((L2Npc) cha).getTemplate().isServerSideName())
       return addString(((L2Npc) cha).getTemplate().getName());
     return addNpcName((L2Npc) cha);
   } else if (cha instanceof L2PcInstance) {
     return addPcName((L2PcInstance) cha);
   } else if (cha instanceof L2Summon) {
     if (((L2Summon) cha).getTemplate().isServerSideName())
       return addString(((L2Summon) cha).getTemplate().getName());
     return addNpcName((L2Summon) cha);
   }
   return addString(cha.getName());
 }