コード例 #1
0
  @Override
  public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
    final QuestState qs = getQuestState(killer, false);

    if ((qs != null)
        && qs.isCond(1)
        && (getQuestItemsCount(killer, PECULIAR_MUSHROOM_SPORE) < 10)) {
      switch (npc.getId()) {
        case GROWLER:
        case ROBUST_GROWLER:
          {
            final int killCount = qs.getInt(KILL_VAR) + 1;
            if (killCount >= 3) {
              addAttackPlayerDesire(addSpawn(EVOLVED_GROWLER, npc.getLocation()), killer);
              qs.set(KILL_VAR, 0);
            } else {
              qs.set(KILL_VAR, killCount);
            }
            break;
          }
        case EVOLVED_GROWLER:
          {
            if (giveItemRandomly(killer, npc, PECULIAR_MUSHROOM_SPORE, 1, 10, 1.0, true)) {
              qs.setCond(2);
            }
            break;
          }
      }
    }
    return super.onKill(npc, killer, isSummon);
  }
コード例 #2
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 "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;
 }
コード例 #3
0
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState st = getQuestState(player, true);
   final QuestState st2 = player.getQuestState(Q00115_TheOtherSideOfTruth.class.getSimpleName());
   String htmltext = getNoQuestMsg(player);
   switch (npc.getId()) {
     case RAFFORTY:
       {
         if (st.isCreated()) {
           if (player.getLevel() < MIN_LVL) {
             htmltext = "32020-01.htm";
           } else {
             htmltext = ((st2 != null) && (st2.isCompleted())) ? "32020-02.htm" : "32020-03.htm";
           }
         } else if (st.isStarted()) {
           final long hasQuestItems =
               getQuestItemsCount(player, SILVER_ICE_CRYSTAL, BLACK_ICE_CRYSTAL);
           if ((st2 != null) && st2.isCompleted()) {
             htmltext = (hasQuestItems > 0) ? "32020-13.html" : "32020-11.html";
             if (st.isCond(1)) {
               st.setCond(2, true);
             }
           } else {
             htmltext = (hasQuestItems > 0) ? "32020-12.html" : "32020-10.html";
           }
         }
         break;
       }
     case ICE_SHELF:
       {
         // TODO: In High Five this quest have an updated reward system.
         if (st.isStarted()) {
           if (hasQuestItems(player, SILVER_ICE_CRYSTAL)) {
             final int val = st.getInt("ex") % 10;
             if (val == 0) {
               htmltext = "32023-03.html";
               st.set("ex", 0);
             } else {
               htmltext = "32023-09.html";
             }
           } else {
             htmltext = "32023-02.html";
           }
         } else {
           htmltext = "32023-01.html";
         }
         break;
       }
   }
   return htmltext;
 }
コード例 #4
0
ファイル: NornilsGarden.java プロジェクト: impos89/trunk
  @Override
  public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    String htmltext = event;
    final QuestState st = getQuestState(player, false);
    if (st == null) {
      return getNoQuestMsg(player);
    }

    if ((npc.getId() == _garden_guard) && event.equalsIgnoreCase("enter_instance")) {
      try {
        htmltext = enterInstance(npc, player);
      } catch (Exception e) {
      }
    } else if ((npc.getId() == 32258) && event.equalsIgnoreCase("exit")) {
      try {
        exitInstance(player);
      } catch (Exception e) {
      }
    } else if (Util.contains(_final_gates, npc.getId())) {
      if (event.equalsIgnoreCase("32260-02.html")
          || event.equalsIgnoreCase("32261-02.html")
          || event.equalsIgnoreCase("32262-02.html")) {
        st.unset("correct");
      } else if (Util.isDigit(event)) {
        int correct = st.getInt("correct");
        correct++;
        st.set("correct", String.valueOf(correct));
        htmltext = npc.getId() + "-0" + String.valueOf(correct + 2) + ".html";
      } else if (event.equalsIgnoreCase("check")) {
        final int correct = st.getInt("correct");
        if ((npc.getId() == 32260) && (correct == 3)) {
          openDoor(st, player, 16200014);
        } else if ((npc.getId() == 32261) && (correct == 3)) {
          openDoor(st, player, 16200015);
        } else if ((npc.getId() == 32262) && (correct == 4)) {
          openDoor(st, player, 16200016);
        } else {
          return npc.getId() + "-00.html";
        }
      }
    }
    return htmltext;
  }
コード例 #5
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    if ("DESPAWN_GUARDIAN".equals(event)) {
      if (npc != null) {
        npc.deleteMe();
      }
      return super.onAdvEvent(event, npc, player);
    }

    final QuestState qs = getQuestState(player, false);
    String htmltext = null;
    if (qs == null) {
      return htmltext;
    }

    switch (event) {
      case "30610-05.htm":
        {
          if (qs.isCreated()) {
            if (getQuestItemsCount(
                    player, DRAGONFLUTE_OF_WIND, DRAGONFLUTE_OF_STAR, DRAGONFLUTE_OF_TWILIGHT)
                == 1) {
              final L2ItemInstance flute = getFlute(player);

              if (flute.getEnchantLevel() < MIN_HACHLING_LVL) {
                htmltext = "30610-06.html";
              } else {
                qs.startQuest();
                qs.setMemoState(100);
                qs.set("fluteObjectId", flute.getObjectId());
                htmltext = event;
              }
            } else {
              htmltext = "30610-06.html";
            }
          }
          break;
        }
      case "30747-04.html":
        {
          final L2Summon summon = player.getPet();

          if (summon == null) {
            htmltext = "30747-02.html";
          } else if (summon.getControlObjectId() != qs.getInt("fluteObjectId")) {
            htmltext = "30747-03.html";
          } else {
            htmltext = event;
          }
          break;
        }
      case "30747-05.html":
        {
          final L2Summon summon = player.getPet();

          if (summon == null) {
            htmltext = "30747-06.html";
          } else if (summon.getControlObjectId() != qs.getInt("fluteObjectId")) {
            htmltext = "30747-06.html";
          } else {
            giveItems(player, FAIRY_LEAF, 4);
            qs.setCond(2, true);
            qs.setMemoState(0);
            htmltext = event;
          }
          break;
        }
      case "30747-07.html":
      case "30747-08.html":
      case "30747-09.html":
      case "30747-10.html":
        {
          htmltext = event;
          break;
        }
    }
    return htmltext;
  }
コード例 #6
0
  @Override
  public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) {
    final QuestState qs = getQuestState(attacker, false);
    if ((qs != null) && qs.isCond(2)) {
      if (isSummon) {
        final NpcData data = NPC_DATA.get(npc.getId());
        if ((qs.getMemoState() % data.memoStateMod) < data.memoStateValue) {
          final L2Summon pet = attacker.getPet();
          if ((pet != null) && (pet.getControlObjectId() == qs.getInt("fluteObjectId"))) {
            final int hits = qs.getInt("hits") + 1;
            qs.set("hits", hits);

            if (hits < data.minHits) {
              if ((npc.getId() == TREE_OF_ABYSS) && (getRandom(100) < 2)) {
                npc.setTarget(attacker);
                npc.doCast(DRYAD_ROOT.getSkill());
              }
            } else if (getRandom(100) < 2) {
              if (hasQuestItems(attacker, FAIRY_LEAF)) {
                npc.broadcastPacket(
                    new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.GIVE_ME_A_FAIRY_LEAF));
                takeItems(attacker, FAIRY_LEAF, 1);
                qs.setMemoState(qs.getMemoState() + data.memoStateValue);
                qs.unset("hits");
                playSound(attacker, QuestSound.ITEMSOUND_QUEST_MIDDLE);

                if (qs.getMemoState() == 15) {
                  qs.setCond(3);
                }
              }
            }
          }
        } else {
          switch (getRandom(3)) {
            case 0:
              npc.broadcastPacket(
                  new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.WHY_DO_YOU_BOTHER_ME_AGAIN));
              break;
            case 1:
              npc.broadcastPacket(new NpcSay(npc, ChatType.NPC_GENERAL, data.message));
              break;
            case 2:
              npc.broadcastPacket(
                  new NpcSay(
                      npc,
                      ChatType.NPC_GENERAL,
                      NpcStringId.LEAVE_NOW_BEFORE_YOU_INCUR_THE_WRATH_OF_THE_GUARDIAN_GHOST));
              break;
          }
        }
      } else if (getRandom(100) < 30) {
        npc.setTarget(attacker);
        npc.doCast(VICIOUS_POISON.getSkill());
      }
    } else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.67)) && (getRandom(100) < 30)) {
      npc.setTarget(attacker);
      npc.doCast(VICIOUS_POISON.getSkill());
    }

    return super.onAttack(npc, attacker, damage, isSummon);
  }
コード例 #7
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);
    final QuestState q115 = player.getQuestState(Q00115_TheOtherSideOfTruth.class.getSimpleName());
    if (st == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "ACCEPT":
        {
          st.startQuest();
          if ((q115 != null) && (q115.isCompleted())) {
            htmltext = "32020-04.htm";
          } else {
            st.setCond(2);
            htmltext = "32020-05.htm";
          }
          break;
        }
      case "ASK":
        {
          if (st.getCond() >= 1) {
            htmltext = ((q115 != null) && !q115.isCompleted()) ? "32020-14.html" : "32020-15.html";
          }
          break;
        }
      case "LATER":
        {
          if (st.getCond() >= 1) {
            htmltext = ((q115 != null) && !q115.isCompleted()) ? "32020-19.html" : "32020-20.html";
          }
          break;
        }
      case "REWARD":
        {
          if (st.getCond() >= 1) {
            final long silverCryCount = getQuestItemsCount(player, SILVER_ICE_CRYSTAL);
            final long blackCryCount = getQuestItemsCount(player, BLACK_ICE_CRYSTAL);
            if ((silverCryCount + blackCryCount) > 0) {
              giveAdena(player, (silverCryCount * 300) + (blackCryCount * 1200), true);
              takeItems(player, -1, SILVER_ICE_CRYSTAL, BLACK_ICE_CRYSTAL);
              htmltext =
                  ((q115 != null) && !q115.isCompleted()) ? "32020-16.html" : "32020-17.html";
            } else {
              htmltext = "32020-18.html";
            }
          }
          break;
        }
      case "QUIT":
        {
          if (st.getCond() >= 1) {
            if ((q115 != null) && !q115.isCompleted()) {
              htmltext = "32020-21.html";
              st.exitQuest(true, true);
            } else {
              htmltext = "32020-22.html";
            }
          }
          break;
        }
      case "32020-06.html":
      case "32020-07.html":
      case "32020-08.html":
      case "32020-09.html":
        {
          if (st.getCond() >= 1) {
            htmltext = event;
          }
          break;
        }
      case "32020-23.html":
        {
          if (st.getCond() >= 1) {
            st.exitQuest(true, true);
            htmltext = event;
          }
          break;
        }
      case "32023-04.html":
        {
          if ((st.getCond() >= 1)
              && hasQuestItems(player, SILVER_ICE_CRYSTAL)
              && (st.getInt("ex") == 0)) {
            st.set("ex", ((getRandom(4) + 1) * 10));
            htmltext = event;
          }
          break;
        }
      case "32023-05.html":
        {
          if ((st.getCond() >= 1)
              && hasQuestItems(player, SILVER_ICE_CRYSTAL)
              && (st.getInt("ex") > 0)) {
            takeItems(player, SILVER_ICE_CRYSTAL, 1);
            final int val = (st.getInt("ex") + 1);
            st.set("ex", val);
            playSound(player, QuestSound.ITEMSOUND_BROKEN_KEY);
            htmltext = event;
          }
          break;
        }
      case "32023-06.html":
        {
          if ((st.getCond() >= 1)
              && hasQuestItems(player, SILVER_ICE_CRYSTAL)
              && (st.getInt("ex") > 0)) {
            takeItems(player, SILVER_ICE_CRYSTAL, 1);
            final int val = (st.getInt("ex") + 2);
            st.set("ex", val);
            playSound(player, QuestSound.ITEMSOUND_BROKEN_KEY);
            htmltext = event;
          }
          break;
        }
      case "REPLY4":
        {
          if ((st.getCond() >= 1) && (st.getInt("ex") > 0)) {
            final int ex = st.getInt("ex");
            final int val1 = ex / 10;
            final int val2 = ex - (val1 * 10);
            if (val1 == val2) {
              htmltext = "32023-07.html";
              giveItems(player, BLACK_ICE_CRYSTAL, 1);
              playSound(player, QuestSound.ITEMSOUND_ENCHANT_SUCCESS);
            } else {
              htmltext = "32023-08.html";
              playSound(player, QuestSound.ITEMSOUND_ENCHANT_FAILED);
            }
            st.set("ex", 0);
          }
          break;
        }
      case "REPLY5":
        {
          if ((st.getCond() >= 1) && (st.getInt("ex") > 0)) {
            final int ex = st.getInt("ex");
            final int val1 = ex / 10;
            final int val2 = ((ex - (val1 * 10)) + 2);
            if (val1 == val2) {
              htmltext = "32023-07.html";
              giveItems(player, BLACK_ICE_CRYSTAL, 1);
              playSound(player, QuestSound.ITEMSOUND_ENCHANT_SUCCESS);
            } else {
              htmltext = "32023-08.html";
              playSound(player, QuestSound.ITEMSOUND_ENCHANT_FAILED);
            }
            st.set("ex", 0);
          }
          break;
        }
    }
    return htmltext;
  }
コード例 #8
0
  @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;
  }