예제 #1
0
  @Override
  public String onSpawn(L2Npc npc) {
    for (L2PcInstance target : npc.getKnownList().getKnownType(L2PcInstance.class)) {
      if (!target.isDead()
          && GeoData.getInstance().canSeeTarget(npc, target)
          && Util.checkIfInRange(npc.getAggroRange(), npc, target, true)) {
        if (target.getActiveWeaponInstance() != null
            && !npc.isInCombat()
            && npc.getTarget() == null) {
          npc.setTarget(target);
          npc.broadcastNpcSay(
              ((target.getAppearance().getSex()) ? "Sister " : "Brother ")
                  + target.getName()
                  + ", move your weapon away!");

          switch (npc.getNpcId()) {
            case 22124:
            case 22126:
            case 22127:
              npc.doCast(SkillTable.getInstance().getInfo(4589, 8));
              break;

            default:
              attack(((L2Attackable) npc), target);
              break;
          }
        }
      }
    }
    return super.onSpawn(npc);
  }
예제 #2
0
  @Override
  public void useItem(L2Playable playable, ItemInstance item, boolean forceUse) {
    if (!(playable instanceof L2PcInstance)) return;

    final L2PcInstance activeChar = (L2PcInstance) playable;
    final ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
    final Weapon weaponItem = activeChar.getActiveWeaponItem();
    final int itemId = item.getItemId();

    // Check if bss can be used
    if (weaponInst == null || weaponItem == null || weaponItem.getSpiritShotCount() == 0) {
      if (!activeChar.getAutoSoulShot().contains(itemId))
        activeChar.sendPacket(SystemMessageId.CANNOT_USE_SPIRITSHOTS);
      return;
    }

    // Check if bss is already active (it can be charged over SpiritShot)
    if (activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOT)) return;

    // Check for correct grade.
    if (weaponItem.getCrystalType() != item.getItem().getCrystalType()) {
      if (!activeChar.getAutoSoulShot().contains(itemId))
        activeChar.sendPacket(SystemMessageId.SPIRITSHOTS_GRADE_MISMATCH);

      return;
    }

    // Consume bss if player has enough of them
    if (!activeChar.destroyItemWithoutTrace(
        "Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false)) {
      if (!activeChar.disableAutoShot(itemId))
        activeChar.sendPacket(SystemMessageId.NOT_ENOUGH_SPIRITSHOTS);

      return;
    }

    final IntIntHolder[] skills = item.getItem().getSkills();

    activeChar.sendPacket(SystemMessageId.ENABLED_SPIRITSHOT);
    activeChar.setChargedShot(ShotType.BLESSED_SPIRITSHOT, true);
    Broadcast.toSelfAndKnownPlayersInRadiusSq(
        activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getId(), 1, 0, 0), 360000);
  }
예제 #3
0
  @Override
  public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isPet) {
    if (!npc.isInCombat()) {
      if (player.getActiveWeaponInstance() != null) {
        npc.setTarget(player);
        npc.broadcastNpcSay(
            ((player.getAppearance().getSex()) ? "Sister " : "Brother ")
                + player.getName()
                + ", move your weapon away!");

        switch (npc.getNpcId()) {
          case 22124:
          case 22126:
            npc.doCast(SkillTable.getInstance().getInfo(4589, 8));
            break;

          default:
            attack(((L2Attackable) npc), player);
            break;
        }
      } else if (((L2Attackable) npc).getMostHated() == null) return null;
    }
    return super.onAggroRangeEnter(npc, player, isPet);
  }