Exemple #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);
  }
Exemple #2
0
 @Override
 public String onSkillSee(
     L2Npc npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet) {
   if (skill.getSkillType() == L2SkillType.AGGDAMAGE && targets.length != 0) {
     for (L2Object obj : targets) {
       if (obj.equals(npc)) {
         npc.broadcastNpcSay(
             ((caster.getAppearance().getSex()) ? "Sister " : "Brother ")
                 + caster.getName()
                 + ", move your weapon away!");
         attack(((L2Attackable) npc), caster);
         break;
       }
     }
   }
   return super.onSkillSee(npc, caster, skill, targets, isPet);
 }
Exemple #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);
  }
Exemple #4
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    String htmltext = event;
    QuestState st = player.getQuestState(qn);
    if (st == null) return htmltext;

    if (event.equalsIgnoreCase("31522-02.htm")) {
      st.setState(STATE_STARTED);
      st.set("cond", "1");
      st.playSound(QuestState.SOUND_ACCEPT);
    } else if (event.equalsIgnoreCase("31523-03.htm")) {
      st.set("cond", "2");
      st.playSound(QuestState.SOUND_MIDDLE);
      spawnVonHellmann(st);
    } else if (event.equalsIgnoreCase("31524-06.htm")) {
      st.set("cond", "3");
      st.playSound(QuestState.SOUND_MIDDLE);

      // Spawn the page.
      if (_vonHellmannPage == null) {
        _vonHellmannPage = addSpawn(VON_HELLMAN_PAGE, 51462, -54539, -3176, 0, false, 90000, true);
        _vonHellmannPage.broadcastNpcSay(
            "My master has instructed me to be your guide, " + player.getName() + ".");

        // Make it move.
        startQuestTimer("1", 4000, _vonHellmannPage, player, false);
        startQuestTimer("pageDespawn", 88000, _vonHellmannPage, player, false);
      }
    } else if (event.equalsIgnoreCase("31526-08.htm")) {
      st.set("cond", "5");
      st.playSound(QuestState.SOUND_MIDDLE);
    } else if (event.equalsIgnoreCase("31526-14.htm")) {
      st.set("cond", "6");
      st.playSound(QuestState.SOUND_MIDDLE);
      st.giveItems(CROSS_OF_EINHASAD, 1);
    } else if (event.equalsIgnoreCase("1")) {
      _vonHellmannPage
          .getAI()
          .setIntention(CtrlIntention.MOVE_TO, new L2CharPosition(52373, -54296, -3136, 0));
      _vonHellmannPage.broadcastNpcSay("Follow me...");
      startQuestTimer("2", 5000, _vonHellmannPage, player, false);
      return null;
    } else if (event.equalsIgnoreCase("2")) {
      _vonHellmannPage
          .getAI()
          .setIntention(CtrlIntention.MOVE_TO, new L2CharPosition(52279, -53064, -3161, 0));
      startQuestTimer("3", 12000, _vonHellmannPage, player, false);
      return null;
    } else if (event.equalsIgnoreCase("3")) {
      _vonHellmannPage
          .getAI()
          .setIntention(CtrlIntention.MOVE_TO, new L2CharPosition(51909, -51725, -3125, 0));
      startQuestTimer("4", 15000, _vonHellmannPage, player, false);
      return null;
    } else if (event.equalsIgnoreCase("4")) {
      _vonHellmannPage
          .getAI()
          .setIntention(CtrlIntention.MOVE_TO, new L2CharPosition(52438, -51240, -3097, 0));
      _vonHellmannPage.broadcastNpcSay("This where that here...");
      startQuestTimer("5", 5000, _vonHellmannPage, player, false);
      return null;
    } else if (event.equalsIgnoreCase("5")) {
      _vonHellmannPage
          .getAI()
          .setIntention(CtrlIntention.MOVE_TO, new L2CharPosition(52143, -51418, -3085, 0));
      _vonHellmannPage.broadcastNpcSay("I want to speak to you...");
      return null;
    } else if (event.equalsIgnoreCase("31328-05.htm")) {
      if (st.hasQuestItems(CROSS_OF_EINHASAD)) {
        st.takeItems(CROSS_OF_EINHASAD, 1);
        st.giveItems(CROSS_OF_EINHASAD_NEXT_QUEST, 1);
        st.playSound(QuestState.SOUND_FINISH);
        st.exitQuest(false);
      }
    } else if (event.equalsIgnoreCase("pageDespawn")) _vonHellmannPage = null;

    return htmltext;
  }
Exemple #5
0
 private void spawnVonHellmann(QuestState st) {
   if (_vonHellmann == null) {
     _vonHellmann = addSpawn(VON_HELLMAN, 51432, -54570, -3136, 0, false, 0, true);
     _vonHellmann.broadcastNpcSay("Who awoke me?");
   }
 }