예제 #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 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);
  }