@Override
 public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
   final QuestState st = getQuestState(player, false);
   if (st == null) {
     return getNoQuestMsg(player);
   }
   switch (event) {
     case "30070-02.htm":
       st.startQuest();
       st.giveItems(TEMPLE_MANIFESTO, 1);
       break;
     case "30070-05.html":
       st.giveAdena(84593, true);
       if ((player.getLevel() < 42)) {
         st.addExpAndSp(187062, 11307);
       }
       st.exitQuest(false, true);
       break;
     case "30070-03.html":
       st.setCond(2, true);
       break;
     case "30118-06.html":
       st.setCond(3, true);
       break;
     case "30118-09.html":
       st.setCond(6, true);
       st.giveItems(PUPINAS_RECOMMENDATION, 1);
       break;
     case "30474-02.html":
       st.setCond(4, true);
       break;
     case "30666-02.html":
       if (st.hasQuestItems(PUPINAS_RECOMMENDATION)) {
         st.set("talk", "1");
         st.takeItems(PUPINAS_RECOMMENDATION, -1);
       }
       break;
     case "30666-03.html":
       if (st.hasQuestItems(TEMPLE_MANIFESTO)) {
         st.set("talk", "2");
         st.takeItems(TEMPLE_MANIFESTO, -1);
       }
       break;
     case "30666-08.html":
       st.setCond(7, true);
       st.unset("talk");
       break;
   }
   return event;
 }
 @Override
 public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) {
   final QuestState st = getQuestState(player, false);
   if ((st != null)
       && st.isStarted()
       && st.isCond(4)
       && (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) < 10)) {
     st.giveItems(RELICS_OF_THE_DARK_ELF_TRAINEE, 1);
     if (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) >= 10) {
       st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
     } else {
       st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
     }
   }
   return super.onKill(npc, player, isSummon);
 }
Esempio n. 3
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);
    if (st == null) {
      return getNoQuestMsg(player);
    }

    switch (event) {
      case "31338-1.html":
        st.giveItems(ANCIENT_BOOK, 1);
        st.startQuest();
        break;
      case "32113-2.html":
      case "32113-2a.html":
        st.giveAdena(191678, true);
        st.addExpAndSp(251602, 25245);
        st.exitQuest(false, true);
        break;
    }
    return event;
  }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   String htmltext = getNoQuestMsg(player);
   final QuestState st = getQuestState(player, true);
   if (st == null) {
     return htmltext;
   }
   switch (npc.getId()) {
     case SYLVAIN:
       switch (st.getCond()) {
         case 1:
           htmltext = "30070-02.htm";
           break;
         case 2:
         case 3:
         case 4:
         case 5:
         case 6:
           htmltext = "30070-03.html";
           break;
         case 7:
           htmltext = "30070-04.html";
           break;
         default:
           if (st.isCompleted()) {
             return getAlreadyCompletedMsg(player);
           }
           final QuestState qs =
               player.getQuestState(Q00137_TempleChampionPart1.class.getSimpleName());
           htmltext =
               (player.getLevel() >= 36)
                   ? ((qs != null) && qs.isCompleted()) ? "30070-01.htm" : "30070-00a.htm"
                   : "30070-00.htm";
           break;
       }
       break;
     case PUPINA:
       switch (st.getCond()) {
         case 2:
           htmltext = "30118-01.html";
           break;
         case 3:
         case 4:
           htmltext = "30118-07.html";
           break;
         case 5:
           htmltext = "30118-08.html";
           if (st.hasQuestItems(ANGUS_RECOMMENDATION)) {
             st.takeItems(ANGUS_RECOMMENDATION, -1);
           }
           break;
         case 6:
           htmltext = "30118-10.html";
           break;
       }
       break;
     case ANGUS:
       switch (st.getCond()) {
         case 3:
           htmltext = "30474-01.html";
           break;
         case 4:
           if (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) >= 10) {
             st.takeItems(RELICS_OF_THE_DARK_ELF_TRAINEE, -1);
             st.giveItems(ANGUS_RECOMMENDATION, 1);
             st.setCond(5, true);
             htmltext = "30474-04.html";
           } else {
             htmltext = "30474-03.html";
           }
           break;
         case 5:
           htmltext = "30474-05.html";
           break;
       }
       break;
     case SLA:
       switch (st.getCond()) {
         case 6:
           switch (st.getInt("talk")) {
             case 1:
               htmltext = "30666-02.html";
               break;
             case 2:
               htmltext = "30666-03.html";
               break;
             default:
               htmltext = "30666-01.html";
               break;
           }
           break;
         case 7:
           htmltext = "30666-09.html";
           break;
       }
       break;
   }
   return htmltext;
 }
Esempio n. 5
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    final QuestState st = getQuestState(player, true);

    if (st == null) {
      return htmltext;
    }

    if (npc.getId() == KANEMIKA) {
      switch (st.getState()) {
        case State.COMPLETED:
          if (!st.isNowAvailable()) {
            htmltext = "32650-03.html";
            break;
          }
          st.setState(State.CREATED);
        case State.CREATED:
          htmltext = (player.getLevel() >= MIN_LEVEL) ? "32650-01.htm" : "32650-02.htm";
          break;
        case State.STARTED:
          if (st.isCond(1)) {
            htmltext =
                (!st.hasQuestItems(EVIDENCE_OF_MIGRATION)) ? "32650-08.html" : "32650-09.html";
          } else {
            st.giveAdena(
                65000, true); // Glory days reward: 6 886 980 exp, 8 116 410 sp, 371 400 Adena
            st.exitQuest(QuestType.DAILY, true);
            htmltext = "32650-10.html";
          }
          break;
      }
    } else if (st.isCond(1)) {
      if (npc.isBusy()) {
        return null;
      }

      if (getRandom(100) < 66) {
        st.giveItems(EVIDENCE_OF_MIGRATION, 1);
        st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
        npc.getAI()
            .setIntention(
                CtrlIntention.AI_INTENTION_MOVE_TO,
                new Location(npc.getX() + 100, npc.getY() + 100, npc.getZ(), 0));
        npc.setBusy(true);

        startQuestTimer("despawn", 3000, npc, player);

        if (st.getQuestItemsCount(EVIDENCE_OF_MIGRATION) == 10) {
          st.setCond(2, true);
        }
        htmltext = "32651-01.html";
      } else {
        if (getRandom(100) < 50) {
          npc.broadcastPacket(
              new NpcSay(
                  npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GRUNT_OH));
        } else {
          npc.broadcastPacket(
              new NpcSay(
                  npc.getObjectId(),
                  ChatType.NPC_GENERAL,
                  npc.getId(),
                  NpcStringId.GRUNT_WHAT_S_WRONG_WITH_ME));
        }
        npc.deleteMe();
        htmltext = null;

        final L2Attackable monster =
            (L2Attackable)
                addSpawn(
                    WARRIOR_MON,
                    npc.getX(),
                    npc.getY(),
                    npc.getZ(),
                    npc.getHeading(),
                    true,
                    600000);
        monster.setRunning();
        monster.addDamageHate(player, 0, 999);
        monster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
        showOnScreenMsg(
            player,
            NpcStringId
                .THE_GRAVE_ROBBER_WARRIOR_HAS_BEEN_FILLED_WITH_DARK_ENERGY_AND_IS_ATTACKING_YOU,
            5,
            5000);
      }
    }

    return htmltext;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);
    if (st == null) {
      return null;
    }

    String htmltext = event;
    switch (event) {
      case "30894-02.html":
      case "30297-04.html":
      case "30612-05.html":
      case "30612-06.html":
      case "30612-07.html":
      case "30612-08.html":
      case "32369-04.html":
      case "32369-05.html":
      case "32369-07.html":
      case "32369-08.html":
      case "32369-09.html":
      case "32369-10.html":
        break;
      case "30894-01.html":
        st.startQuest();
        break;
      case "30894-03.html":
        st.setCond(2, true);
        st.giveItems(SEALED_PROPHECY_PATH_OF_THE_GOD, 1);
        break;
      case "30297-03.html":
        st.takeItems(SEALED_PROPHECY_PATH_OF_THE_GOD, -1);
        st.set("talk", "1");
        break;
      case "30297-05.html":
        st.unset("talk");
        st.setCond(3, true);
        st.giveItems(PROPHECY_PATH_OF_THE_GOD, 1);
        st.giveItems(EMPTY_SOUND_CRYSTAL, 1);
        break;
      case "30612-03.html":
        st.takeItems(PROPHECY_PATH_OF_THE_GOD, -1);
        st.set("talk", "1");
        break;
      case "30612-09.html":
        st.unset("talk");
        st.setCond(4, true);
        st.giveItems(ANGEL_MEDICINE, 1);
        break;
      case "32368-04.html":
        if (isAngelSpawned) {
          return "32368-03.html";
        }
        addSpawn(ANGEL, npc.getX() + 100, npc.getY() + 100, npc.getZ(), 0, false, 120000);
        startQuestTimer("despawn", 120000, null, player);
        isAngelSpawned = true;
        break;
      case "32369-03.html":
        st.takeItems(ANGEL_MEDICINE, -1);
        st.set("talk", "1");
        break;
      case "32369-06.html":
        st.set("talk", "2");
        break;
      case "32369-11.html":
        st.unset("talk");
        st.takeItems(EMPTY_SOUND_CRYSTAL, -1);
        st.giveItems(ANGELS_MESSAGE, 1);
        st.setCond(5, true);
        npc.deleteMe();
        isAngelSpawned = false;
        break;
      case "despawn":
        if (isAngelSpawned) {
          isAngelSpawned = false;
        }
      default:
        htmltext = null;
        break;
    }
    return htmltext;
  }