예제 #1
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);
    if (st == null) {
      return htmltext;
    }

    switch (st.getState()) {
      case State.COMPLETED:
        {
          if (npc.getId() == NAMELESS_SPIRIT) {
            htmltext = "31453-06.html";
          }
          break;
        }
      case State.CREATED:
        {
          htmltext =
              ((player.getLevel() >= MIN_LEVEL) && st.hasQuestItems(ANTIQUE_BROOCH))
                  ? "31453-01.htm"
                  : "31453-05.html";
          break;
        }
      case State.STARTED:
        {
          if (npc.getId() == NAMELESS_SPIRIT) {
            if (st.isCond(1)) {
              if (st.hasQuestItems(ANTIQUE_BROOCH)) {
                htmltext = "31453-07.html";
              } else {
                htmltext = "31453-08.html";
                st.exitQuest(true);
              }
            } else if (st.isCond(2)) {
              htmltext = "31453-09.html";
            }
          } else if (npc.getId() == DEVORIN) {
            if (st.isCond(1)) {
              htmltext = "32009-01.html";
            } else if (st.isCond(2)) {
              htmltext = "32009-05.html";
            }
          }
          break;
        }
    }
    return htmltext;
  }
예제 #2
0
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState qs = getQuestState(player, true);
   String texthtml = null;
   switch (qs.getState()) {
     case State.CREATED:
       {
         texthtml = npc.getId() == ZENATH ? "33509-01.htm" : getNoQuestMsg(player);
         break;
       }
     case State.STARTED:
       {
         switch (npc.getId()) {
           case ZENATH:
             {
               if (qs.isCond(1)) {
                 texthtml = "33509-03.htm";
               } else if (qs.isCond(2)) // report defeated kanilov, get the sketch
               {
                 giveItems(player, SAKUMS_SKETCH_A, 1);
                 qs.setCond(3);
                 texthtml = "33509-05.html";
               } else {
                 texthtml = "33509-06.html";
               }
               break;
             }
           case ADV_GUILDSMAN:
             {
               if (qs.isCond(3)) // start end quest dialogs
               {
                 texthtml = "31795-01.html";
               } else {
                 texthtml = getNoQuestMsg(player);
               }
               break;
             }
         }
         break;
       }
     case State.COMPLETED:
       {
         texthtml =
             npc.getId() == ADV_GUILDSMAN ? "31795-04.html" : getAlreadyCompletedMsg(player);
         break;
       }
   }
   return texthtml;
 }
예제 #3
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);
    if (st == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "31453-02.htm":
      case "31453-03.htm":
      case "31453-10.html":
        {
          htmltext = event;
          break;
        }
      case "31453-04.html":
        {
          st.startQuest();
          htmltext = event;
          break;
        }
      case "31453-11.html":
        {
          if (st.isCond(2)) {
            st.giveAdena(150292, true);
            st.addExpAndSp(902439, 90067);
            st.exitQuest(false, true);
            htmltext = event;
          }
          break;
        }
      case "brooch":
        {
          htmltext = (st.hasQuestItems(ANTIQUE_BROOCH)) ? "32009-02.html" : "32009-03.html";
          break;
        }
      case "32009-04.html":
        {
          if (st.isCond(1) && st.hasQuestItems(ANTIQUE_BROOCH)) {
            st.setCond(2, true);
            htmltext = event;
          }
          break;
        }
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);
    if (qs.isCompleted()) {
      return getAlreadyCompletedMsg(player);
    }
    if (player.getRace() == Race.ERTHEIA) {
      return "31292-noErtheia.html";
    }
    if (player.isMageClass()) {
      return "31292-noMage.html";
    }

    switch (npc.getId()) {
      case ANDREI:
        {
          if (qs.isCreated()) {
            htmltext = "31292-01.htm";
          } else if (qs.isStarted()) {
            htmltext = "31292-03.html";
          }
          break;
        }
      case JANITT:
        {
          if (qs.isCond(1)) {
            htmltext = "33851-01.html";
          }
          break;
        }
    }
    return htmltext;
  }
예제 #5
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);

    if (qs.isCompleted()) {
      htmltext = getAlreadyCompletedMsg(player);
    }

    switch (npc.getId()) {
      case LEIRA:
        {
          if (qs.isCreated()) {
            htmltext = "33952-01.htm";
          } else if (qs.isStarted()) {
            htmltext = "33952-03.html";
          }
          break;
        }
      case MILONE:
        {
          if (qs.isCond(2)) {
            htmltext = "33953-01.html";
          }
          break;
        }
    }

    return htmltext;
  }
예제 #6
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);
  }
예제 #7
0
  @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 ANTON:
        switch (st.getState()) {
          case State.CREATED:
            htmltext = (player.getLevel() < 75) ? "31338-0a.htm" : "31338-0b.htm";
            break;
          case State.STARTED:
            htmltext = "31338-1a.html";
            break;
          case State.COMPLETED:
            htmltext = getAlreadyCompletedMsg(player);
            break;
        }
        break;
      case MARQUEZ:
        if (st.isCond(1)) {
          htmltext = "32113-1.html";
        }
        break;
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);
    if (qs.isCompleted()) {
      return getAlreadyCompletedMsg(player);
    }
    if (player.getRace() == Race.ERTHEIA) {
      return "33864-noErtheia.html";
    }

    switch (npc.getId()) {
      case PATERSON:
        {
          if (qs.isCreated()) {
            htmltext = "33864-01.htm";
          } else if (qs.isStarted()) {
            htmltext = "33864-03.html";
          }
          break;
        }
      case SHUVANN:
        {
          if (qs.isCond(1)) {
            htmltext = "33867-01.html";
          }
          break;
        }
    }
    return htmltext;
  }
예제 #9
0
 @Override
 public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
   final QuestState qs = getQuestState(killer, false); // kill counts independent on party/no party
   if ((qs != null)
       && qs.isStarted()
       && qs.isCond(1)
       && (Util.checkIfInRange(1500, npc, qs.getPlayer(), false))) {
     qs.setCond(2);
   }
   return super.onKill(npc, killer, isSummon);
 }
예제 #10
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;
 }
 @Override
 public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) {
   final QuestState st = getQuestState(player, false);
   if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) {
     final long currentCount = getQuestItemsCount(player, ZAKENS_SOUL_FRAGMENT);
     final long count = getRandom(1, 3);
     if (count >= (FRAGMENT_COUNT - currentCount)) {
       giveItems(player, ZAKENS_SOUL_FRAGMENT, FRAGMENT_COUNT - currentCount);
       st.setCond(2, true);
     } else {
       giveItems(player, ZAKENS_SOUL_FRAGMENT, count);
       playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
     }
   }
 }
예제 #12
0
 @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);
 }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, false);
    if (qs == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "33864-03.html":
        {
          qs.startQuest();
          giveItems(player, SCROLL_OF_ESCAPE_FIELDS_OF_MASSACRE);
          htmltext = event;
          break;
        }
      case "33867-02.html":
        {
          if (qs.isCond(1)) {
            giveItems(player, STEEL_DOOR_GUILD);
            giveItems(player, ENCHANT_WEAPON_A);
            addExpAndSp(player, 807240, 193);
            showOnScreenMsg(
                player,
                NpcStringId
                    .GROW_STRONGER_HERE_UNTIL_YOU_RECEIVE_THE_NEXT_LETTER_FROM_KEKROPUS_AT_LV_65,
                ExShowScreenMessage.TOP_CENTER,
                4500);
            qs.exitQuest(false, true);
            htmltext = event;
          }
          break;
        }
      case "33864-02.htm":
        {
          htmltext = event;
          break;
        }
    }
    return htmltext;
  }
예제 #14
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, false);
    if (qs == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "33952-02.htm":
      case "33953-02.html":
        {
          htmltext = event;
          break;
        }
      case "33952-03.html":
        {
          qs.startQuest();
          htmltext = event;
          break;
        }
      case "33953-03.html":
        {
          if (qs.isCond(2)) {
            giveAdena(player, 62000, true);
            addExpAndSp(player, 62876, 0);
            giveItems(player, LEATHER_SHOES);
            showOnScreenMsg(
                player,
                NpcStringId.CHECK_YOUR_EQUIPMENT_IN_YOUR_INVENTORY,
                ExShowScreenMessage.TOP_CENTER,
                4500);
            qs.exitQuest(false, true);
            htmltext = event;
          }
          break;
        }
    }
    return htmltext;
  }
예제 #15
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;
  }
예제 #16
0
 @Override
 public String onTalk(L2Npc npc, L2PcInstance talker) {
   final QuestState qs = getQuestState(talker, true);
   String htmltext = getNoQuestMsg(talker);
   switch (npc.getId()) {
     case IRIS:
       {
         switch (qs.getCond()) {
           case 3:
             {
               htmltext = "30034-01.html";
               break;
             }
           case 4:
             {
               htmltext = "30034-04.html";
               break;
             }
           case 5:
             {
               htmltext = "30034-05.html";
               break;
             }
           case 6:
             {
               htmltext = "30034-09.html";
               break;
             }
           case 7:
             {
               if (hasItem(talker, TOTEM_TOOTH_2ND)) {
                 htmltext = "30034-08.html";
               }
               break;
             }
         }
         break;
       }
     case MAGISTER_ROHMER:
       {
         if (qs.isCond(4)) {
           htmltext = "30344-01.html";
         } else if (qs.isCond(5)) {
           htmltext = "30344-04.html";
         }
         break;
       }
     case GUARD_LUIS:
       {
         if (qs.isCreated()) {
           htmltext = (talker.getLevel() >= MIN_LVL) ? "30386-01.htm" : "30386-02.htm";
         } else if (qs.isStarted()) {
           switch (qs.getCond()) {
             case 1:
               {
                 htmltext = "30386-05.html";
                 break;
               }
             case 2:
               {
                 if (hasItem(talker, FEATHER)) {
                   htmltext = "30386-04.html";
                 }
                 break;
               }
             case 3:
               {
                 htmltext = "30386-08.html";
                 break;
               }
           }
         } else if (qs.isCompleted()) {
           htmltext = getAlreadyCompletedMsg(talker);
         }
         break;
       }
   }
   return htmltext;
 }
예제 #17
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, false);
    String htmltext = null;
    if (qs == null) {
      return htmltext;
    }
    switch (event) {
      case "30386-03.htm":
        {
          if (qs.isCreated()) {
            qs.startQuest();
            htmltext = event;
          }
          break;
        }
      case "30386-06.html":
        {
          if (qs.isCond(2)) {
            if (hasItem(player, FEATHER)) {
              qs.setCond(3, true);
              takeItem(player, FEATHER);
              giveItems(player, TOTEM_TOOTH_1ST, 1);
              htmltext = event;
            } else {
              htmltext = "30386-07.html";
            }
          }

          break;
        }
      case "30034-02.html":
        {
          if (qs.isCond(3)) {
            if (hasQuestItems(player, TOTEM_TOOTH_1ST)) {
              qs.setCond(4, true);
              takeItems(player, TOTEM_TOOTH_1ST, 1);
              giveItems(player, LETTER_1ST, 1);
              htmltext = event;
            } else {
              htmltext = "30034-03.html";
            }
          }
          break;
        }
      case "30034-06.html":
        {
          if (qs.isCond(5)) {
            if (hasQuestItems(player, LETTER_2ND)) {
              qs.setCond(6, true);
              takeItems(player, LETTER_2ND, 1);
              htmltext = event;
            } else {
              htmltext = "30034-07.html";
            }
          }
          break;
        }
      case "30034-10.html":
        {
          if (qs.isCond(7)) {
            if (hasItem(player, TOTEM_TOOTH_2ND)) {
              addExpAndSp(player, 435117, 23977);
              final int chance = getRandom(1000);
              if (chance < 250) {
                rewardItems(player, BONE_HELMET, 1);
                giveAdena(player, 5200, true);
              } else if (chance < 500) {
                rewardItems(player, ASPIS, 1);
                giveAdena(player, 1500, true);
              } else if (chance < 750) {
                rewardItems(player, BLUE_BUCKSKIN_BOOTS, 1);
                giveAdena(player, 3200, true);
              } else if (chance < 1000) {
                rewardItems(player, LEATHER_GAUNTLET, 1);
                giveAdena(player, 3200, true);
              }
              qs.exitQuest(false, true);
              htmltext = event;
            } else {
              htmltext = "30034-11.html";
            }
          }
          break;
        }
      case "30344-02.html":
        {
          if (qs.isCond(4)) {
            if (hasQuestItems(player, LETTER_1ST)) {
              qs.setCond(5, true);
              takeItems(player, LETTER_1ST, 1);
              giveItems(player, LETTER_2ND, 1);
              htmltext = event;
            } else {
              htmltext = "30344-03.html";
            }
          }
          break;
        }
    }
    return htmltext;
  }
  @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);
  }