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

    switch (event) {
      case "30346-04.htm":
        {
          st.startQuest();
          htmltext = event;
          break;
        }
      case "30346-07.html":
        {
          st.exitQuest(true, true);
          htmltext = event;
          break;
        }
      case "30346-08.html":
        {
          htmltext = event;
          break;
        }
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    final QuestState st = getQuestState(player, true);
    if (st == null) {
      return htmltext;
    }

    switch (st.getState()) {
      case State.CREATED:
        {
          htmltext =
              (player.getRace() == Race.DARK_ELF)
                  ? (player.getLevel() >= MIN_LEVEL) ? "30346-03.htm" : "30346-02.htm"
                  : "30346-01.htm";
          break;
        }
      case State.STARTED:
        {
          if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) {
            final long amulets = st.getQuestItemsCount(ORC_AMULET);
            final long necklaces = st.getQuestItemsCount(ORC_NECKLACE);
            st.giveAdena(
                ((amulets * 20) + (necklaces * 30) + ((amulets + necklaces) >= 10 ? 1100 : 0)),
                true);
            takeItems(player, -1, getRegisteredItemIds());
            htmltext = "30346-06.html";
          } else {
            htmltext = "30346-05.html";
          }
          break;
        }
    }
    return htmltext;
  }
  @Override
  public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
    QuestState st = getQuestState(killer, false);
    if (st == null) {
      return null;
    }

    final int npcId = npc.getId();
    if (killer.getParty() != null) {
      final List<QuestState> PartyMembers = new ArrayList<>();
      for (L2PcInstance member : killer.getParty().getMembers()) {
        st = getQuestState(member, false);
        if ((st != null) && st.isStarted() && !st.hasQuestItems(TISSUE_WA)) {
          PartyMembers.add(st);
        }
      }

      if (!PartyMembers.isEmpty()) {
        rewardItem(npcId, PartyMembers.get(getRandom(PartyMembers.size())));
      }
    } else if (st.isStarted() && !st.hasQuestItems(TISSUE_WA)) {
      rewardItem(npcId, st);
    }
    return null;
  }
Exemplo n.º 4
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 "30307-04.htm":
       {
         htmltext = event;
         break;
       }
     case "30307-05.htm":
       {
         if (qs.isCreated()) {
           qs.startQuest();
           giveItems(player, KAROYDS_LETTER, 1);
           htmltext = event;
         }
         break;
       }
   }
   return htmltext;
 }
  @Override
  public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
    final List<L2PcInstance> randomList = new ArrayList<>();
    final QuestState st = killer.getQuestState(getName());
    if ((st != null) && st.isStarted()) {
      randomList.add(killer);
      randomList.add(killer);
    }

    final int monsterChance = MONSTER_DROP_CHANCES.get(npc.getId());
    if (killer.isInParty()) {
      for (L2PcInstance member : killer.getParty().getMembers()) {
        final QuestState qs = member.getQuestState(getName());
        if ((qs != null) && qs.isStarted()) {
          randomList.add(member);
        }
      }
    }

    if (!randomList.isEmpty()) {
      final L2PcInstance player = randomList.get(getRandom(randomList.size()));
      if ((getRandom(1000) < monsterChance) && Util.checkIfInRange(1500, npc, player, true)) {
        giveItems(player, REMNANTS_OF_OLD_DWARVES_DREAMS, 1);
        playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
      }
    }
    return super.onKill(npc, killer, isSummon);
  }
 @Override
 public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
   String htmltext = event;
   QuestState qs = player.getQuestState("10273_GoodDayToFly");
   if (qs == null || qs.getState() != State.COMPLETED) {
     player.sendPacket(new RadarControl(2, 2, 0, 0, 0));
     player.sendPacket(new RadarControl(0, 2, -184545, 243120, 1581));
     htmltext = "32627.htm";
   } else if (event.equals("32627-3.htm")) {
     player.sendPacket(new RadarControl(2, 2, 0, 0, 0));
     player.sendPacket(new RadarControl(0, 2, -192361, 254528, 3598));
   } else if (event.equals("32627-4.htm")) {
     player.sendPacket(new RadarControl(2, 2, 0, 0, 0));
     player.sendPacket(new RadarControl(0, 2, -174600, 219711, 4424));
   } else if (event.equals("32627-5.htm")) {
     player.sendPacket(new RadarControl(2, 2, 0, 0, 0));
     player.sendPacket(new RadarControl(0, 2, -181989, 208968, 4424));
   } else if (event.equals("32627-6.htm")) {
     player.sendPacket(new RadarControl(2, 2, 0, 0, 0));
     player.sendPacket(new RadarControl(0, 2, -252898, 235845, 5343));
   } else if (event.equals("32627-8.htm")) {
     player.sendPacket(new RadarControl(2, 2, 0, 0, 0));
     player.sendPacket(new RadarControl(0, 2, -212819, 209813, 4288));
   } else if (event.equals("32627-9.htm")) {
     player.sendPacket(new RadarControl(2, 2, 0, 0, 0));
     player.sendPacket(new RadarControl(0, 2, -246899, 251918, 4352));
   }
   return htmltext;
 }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    final QuestState st = player.getQuestState(getName());
    if (st == null) {
      return htmltext;
    }

    if (npc.getId() == MOUEN) {
      switch (st.getState()) {
        case State.CREATED:
          htmltext = (player.getLevel() >= 82) ? "30196-01.htm" : "30196-00.htm";
          break;
        case State.STARTED:
          if (st.isCond(1)) {
            htmltext = "30196-04.htm";
          }
          break;
        case State.COMPLETED:
          htmltext = "30196-05.htm";
          break;
      }
    } else if (npc.getId() == JOHNNY) {
      if (st.isCond(1)) {
        htmltext = "32744-01.htm";
      } else if (st.isCompleted()) {
        htmltext = "32744-04.htm";
      }
    }
    return htmltext;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = player.getQuestState(getName());
    if (st == null) {
      return null;
    }

    String htmltext = event;
    switch (event) {
      case "32740.html":
      case "32740-01.html":
      case "32744-02.html":
      case "32744-03.htm":
        break;
      case "32744-04.htm":
        st.startQuest();
        break;
      case "32744-quit.html":
        st.exitQuest(true);
        break;
      default:
        htmltext = null;
        break;
    }
    return htmltext;
  }
Exemplo n.º 9
0
  @Override
  public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
    final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc);
    if (qs == null) {
      return super.onKill(npc, killer, isSummon);
    }

    switch (npc.getId()) {
      case MARSH_ZOMBIE:
        {
          if (hasQuestItems(killer, PRESERVE_OIL)
              && (getRandom(10) < 5)
              && Util.checkIfInRange(1500, npc, killer, true)) {
            giveItems(killer, ZOMBIE_HEAD, 1);
            takeItems(killer, PRESERVE_OIL, -1);
            qs.setCond(7, true);
          }
          break;
        }
      case DOOM_SOLDIER:
      case SKELETON_HUNTER:
      case SKELETON_HUNTER_ARCHER:
        {
          if (hasQuestItems(killer, CECKTINONS_VOUCHER2)
              && giveItemRandomly(qs.getPlayer(), npc, BONE_FRAGMENT, 1, 10, 1.0, true)) {
            qs.setCond(4, true);
          }
          break;
        }
    }
    return super.onKill(npc, killer, isSummon);
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);
    if (st == null) {
      return null;
    }

    String htmltext = null;
    if ((player.getLevel() >= MIN_LEVEL) && st.hasQuestItems(VACUALITE_FLOATING_STONE)) {
      switch (event) {
        case "31540-05.htm":
        case "31540-06.htm":
          {
            htmltext = event;
            break;
          }
        case "31540-07.html":
          {
            st.startQuest();
            htmltext = event;
            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)) {
     st.setCond(2, true);
   }
 }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    final QuestState st = getQuestState(player, true);
    if (st == null) {
      return htmltext;
    }

    switch (st.getState()) {
      case State.CREATED:
        htmltext = (player.getLevel() >= MIN_LEVEL) ? "30847-01.htm" : "30847-02.html";
        break;
      case State.STARTED:
        switch (st.getCond()) {
          case 1:
            htmltext = "30847-04.html";
            break;
          case 2:
            htmltext = "30847-05.html";
            break;
          case 3:
            htmltext =
                ((st.getQuestItemsCount(ARTISANS_FRAME) >= COUNT)
                        && (st.getQuestItemsCount(ORIHARUKON) >= COUNT))
                    ? "30847-07.html"
                    : "30847-08.html";
            break;
        }
        break;
      case State.COMPLETED:
        htmltext = getAlreadyCompletedMsg(player);
        break;
    }
    return htmltext;
  }
 @Override
 public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
   final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc);
   if (qs != null) {
     final ItemChanceHolder info = MOBS_DROP_CHANCES.get(npc.getId());
     switch (info.getId()) {
       case RIB_BONE_OF_A_BLACK_MAGUS:
         {
           if (qs.isCond(1)
               && giveItemRandomly(
                   qs.getPlayer(),
                   npc,
                   RIB_BONE_OF_A_BLACK_MAGUS,
                   1,
                   RIB_BONE_REQUIRED_COUNT,
                   info.getChance(),
                   true)) {
             qs.setCond(2);
           }
           break;
         }
       case ZOMBIES_LIVER:
         {
           giveItemRandomly(qs.getPlayer(), npc, ZOMBIES_LIVER, 1, 0, info.getChance(), true);
           break;
         }
     }
   }
   return super.onKill(npc, killer, isSummon);
 }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = player.getQuestState(getName());
    if (st == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "30926-02.htm":
        {
          st.startQuest();
          htmltext = event;
          break;
        }
      case "30926-05.html":
        {
          st.exitQuest(true, true);
          htmltext = event;
          break;
        }
      case "30926-06.html":
        {
          htmltext = event;
          break;
        }
    }
    return htmltext;
  }
Exemplo n.º 15
0
  @Override
  public String onFirstTalk(L2Npc npc, L2PcInstance player) {
    final MDWorld world = (MDWorld) InstanceManager.getInstance().getWorld(npc.getInstanceId());
    final QuestState qs =
        player.getQuestState(Q10327_IntruderWhoWantsTheBookOfGiants.class.getSimpleName());
    String htmltext = null;

    if (qs.isCond(1)) {
      if (world.deskSpawns.get(world.randomDesk) == npc) {
        qs.setCond(2);
        giveItems(player, THE_WAR_OF_GODS_AND_GIANTS, 1);
        world.thiefSpawns = spawnGroup("thiefs", world.getInstanceId());
        showOnScreenMsg(
            player,
            NpcStringId.WATCH_OUT_YOU_ARE_BEING_ATTACKED,
            ExShowScreenMessage.TOP_CENTER,
            5000);
        startQuestTimer("assist_player", 2000, world.toyron, player);
        htmltext = "desk_correct.html";
      } else {
        htmltext = "desk_wrong.html";
      }
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState st = player.getQuestState(getName());
    String htmltext = getNoQuestMsg(player);
    if (st == null) {
      return htmltext;
    }

    switch (st.getState()) {
      case State.CREATED:
        {
          if (player.getLevel() < MIN_LVL) {
            htmltext = "32054-02.htm";
          } else {
            final QuestState q117 = player.getQuestState("117_OceanOfDistantStar"); // TODO: Update.
            htmltext = (q117 != null) && q117.isCompleted() ? "32054-01.htm" : "32054-04.htm";
          }
          break;
        }
      case State.STARTED:
        {
          htmltext =
              st.hasQuestItems(REMNANTS_OF_OLD_DWARVES_DREAMS) ? "32054-05.html" : "32054-06.html";
          break;
        }
    }
    return htmltext;
  }
  @Override
  public final String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState st = player.getQuestState(qn);
    if (st == null) {
      return getNoQuestMsg(player);
    }

    final int cond = st.getInt("cond");
    switch (npc.getNpcId()) {
      case ADLER1:
        switch (st.getState()) {
          case State.CREATED:
            if (player.getLevel() < MIN_LEVEL) {
              return "32497-05.htm";
            }
            if (player.getLevel() > MAX_LEVEL) {
              return "32497-06.htm";
            }
            return "32497-01.htm";
          case State.STARTED:
            if (cond > 1) {
              return "32497-00.htm";
            }
            return "32497-03.htm";
          case State.COMPLETED:
            return "32497-07.htm";
          default:
            return "32497-01.htm";
        }
      case SINAI:
        if (cond > 1) {
          return "32500-00.htm";
        }
        return "32500-01.htm";
      case INSPECTOR:
        switch (st.getInt("cond")) {
          case 1:
            return "32507-01.htm";
          case 2:
            return "32507-02.htm";
          case 3:
            return "32507-03.htm";
          case 4:
          case 5:
            return "32507-05.htm";
          case 6:
            return "32507-06.htm";
          default:
            return "32507-09.htm";
        }
      case ADLER2:
        if (st.getState() == State.COMPLETED) {
          return "32510-00.htm";
        } else if (cond == 9) {
          return "32510-01.htm";
        }
    }
    return getNoQuestMsg(player);
  }
 @Override
 public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
   final QuestState st = getRandomPartyMemberState(killer, -1, 3, npc);
   if (st != null) {
     st.giveItemRandomly(npc, CRIMSON_SPIDER_CLAW, 1, 0, 0.6, true);
   }
   return super.onKill(npc, killer, isSummon);
 }
 @Override
 public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
   final QuestState st = killer.getQuestState(getName());
   if ((st != null) && st.isCond(1)) {
     st.setCond(2, true);
   }
   return super.onKill(npc, killer, isSummon);
 }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, true);
    if (st == null) {
      return getNoQuestMsg(player);
    }

    String htmltext = getNoQuestMsg(player);
    switch (st.getState()) {
      case State.CREATED:
        {
          if (player.getLevel() < MIN_LEVEL) {
            htmltext = "31540-02.html";
          } else if (!st.hasQuestItems(VACUALITE_FLOATING_STONE)) {
            htmltext = "31540-04.html";
          } else {
            htmltext = "31540-01.htm";
          }
          break;
        }
      case State.STARTED:
        {
          switch (st.getCond()) {
            case 1:
              {
                htmltext = "31540-08.html";
                break;
              }
            case 2:
              {
                st.giveItems(MEDAL_OF_GLORY, 30);
                st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
                st.exitQuest(QuestType.DAILY, true);
                htmltext = "31540-09.html";
                break;
              }
          }
          break;
        }
      case State.COMPLETED:
        {
          if (!st.isNowAvailable()) {
            htmltext = "31540-03.html";
          } else {
            st.setState(State.CREATED);
            if (player.getLevel() < MIN_LEVEL) {
              htmltext = "31540-02.html";
            } else if (!st.hasQuestItems(VACUALITE_FLOATING_STONE)) {
              htmltext = "31540-04.html";
            } else {
              htmltext = "31540-01.htm";
            }
          }
          break;
        }
    }
    return htmltext;
  }
 @Override
 public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
   final QuestState st = getQuestState(killer, false);
   if ((st != null) && (getRandom(10) > 4)) {
     st.giveItems(MONSTERS.get(npc.getId()), 1);
     st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
   }
   return super.onKill(npc, killer, isSummon);
 }
 @Override
 public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
   final QuestState st = player.getQuestState(getName());
   if ((st != null) && event.equalsIgnoreCase("36479-04.html")) {
     st.startQuest();
     return event;
   }
   return null;
 }
 @Override
 public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
   final QuestState st = getQuestState(player, false);
   if ((st != null) && event.equalsIgnoreCase("30572-04.htm")) {
     st.startQuest();
     return event;
   }
   return null;
 }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance talker) {
   final QuestState qs = getQuestState(talker, true);
   String htmltext = getNoQuestMsg(talker);
   switch (qs.getState()) {
     case State.CREATED:
       {
         if (npc.getId() == EYE_OF_ARGOS) {
           htmltext = ((talker.getLevel() < MIN_LVL) ? "31683-02.html" : "31683-01.htm");
         }
         break;
       }
     case State.STARTED:
       {
         if (npc.getId() == EYE_OF_ARGOS) {
           switch (qs.getCond()) {
             case 1:
             case 2:
             case 3:
             case 4:
             case 5:
               {
                 htmltext = "31683-04.html";
                 break;
               }
             case 6:
               {
                 htmltext = "31683-05.html";
                 break;
               }
             case 7:
               {
                 htmltext = "31683-07.html";
                 break;
               }
             case 8:
               {
                 htmltext = "31683-08.html";
                 break;
               }
           }
         } else if (qs.getInt("TABLET_" + npc.getId()) == 0) {
           htmltext = npc.getId() + "-01.html";
         } else {
           htmltext = npc.getId() + "-03.html";
         }
         break;
       }
     case State.COMPLETED:
       {
         htmltext = getAlreadyCompletedMsg(talker);
         break;
       }
   }
   return htmltext;
 }
 private void giveItem(L2Npc npc, L2PcInstance player) {
   final QuestState st = player.getQuestState(getName());
   if ((st != null)
       && (st.isStarted())
       && (!st.isCond(5))
       && Util.checkIfInRange(1500, npc, player, false)) {
     st.giveItems(MONSTER_DROPS.get(npc.getId()), 1);
     st.setCond(5, true);
   }
 }
 @Override
 public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
   final QuestState st = player.getQuestState(getName());
   if ((st != null) && event.equals("30349-03.htm")) {
     st.startQuest();
     st.giveItems(JENNAS_LETTER, 1);
     return event;
   }
   return null;
 }
 @Override
 public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) {
   final QuestState st = getRandomPartyMemberState(player, 2, 3, npc);
   if ((st != null)
       && giveItemRandomly(
           st.getPlayer(), npc, ANTELOPE_SKIN, 1, 1, MOBS_SKIN.get(npc.getId()), true)) {
     st.setCond(3);
   }
   return super.onKill(npc, player, isSummon);
 }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    String htmltext = event;
    final QuestState st = getQuestState(player, false);
    if (st == null) {
      return htmltext;
    }

    switch (event) {
      case "31296-03.html":
        st.startQuest();
        break;
      case "31256-02.html":
        if (st.isCond(1)) {
          st.setCond(2, true);
          st.giveItems(BOX, 1);
        }
        break;
      case "31371-02.html":
        if (st.isCond(2) && st.hasQuestItems(BOX)) {
          st.addExpAndSp(233125, 18142);
          st.exitQuest(false, true);
        } else {
          htmltext = "31371-03.html";
        }
        break;
    }
    return htmltext;
  }
  @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.CREATED:
        htmltext = (player.getLevel() < MIN_LEVEL) ? "32741-01.html" : "32741-02.htm";
        break;
      case State.STARTED:
        if (st.isCond(1)
            && !st.hasQuestItems(HIGH_GRADE_LIZARD_SCALE)
            && !st.hasQuestItems(MIDDLE_GRADE_LIZARD_SCALE)) {
          htmltext = "32741-05.html";
        } else if (st.isCond(2) && st.hasQuestItems(MIDDLE_GRADE_LIZARD_SCALE)) {
          htmltext = "32741-06.html";
        }

        if (st.isCond(2) && st.hasQuestItems(HIGH_GRADE_LIZARD_SCALE)) {
          htmltext = "32741-07.html";
        }
        break;
    }
    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 "32711-04.html":
        if (player.getLevel() >= 79) {
          st.startQuest();
          htmltext =
              (st.hasQuestItems(CET_1_SHEET, CET_2_SHEET, CET_3_SHEET))
                  ? "32711-04a.html"
                  : "32711-04.html";
        }
        break;
      case "32711-05a.html":
        player.sendPacket(new RadarControl(0, 2, 186214, 61591, -4152));
        break;
      case "32711-05b.html":
        player.sendPacket(new RadarControl(0, 2, 187554, 60800, -4984));
        break;
      case "32711-05c.html":
        player.sendPacket(new RadarControl(0, 2, 193432, 53922, -4368));
        break;
      case "spawn":
        if (!hasQuestItems(player, CET_1_SHEET, CET_2_SHEET, CET_3_SHEET)) {
          return getNoQuestMsg(player);
        } else if ((hekaton != null) && !hekaton.isDead()) {
          return "32711-09.html";
        }
        String respawn = loadGlobalQuestVar("Respawn");
        long remain =
            (!respawn.isEmpty()) ? Long.parseLong(respawn) - System.currentTimeMillis() : 0;
        if (remain > 0) {
          return "32711-09a.html";
        }
        st.takeItems(CET_1_SHEET, 1);
        st.takeItems(CET_2_SHEET, 1);
        st.takeItems(CET_3_SHEET, 1);
        hekaton = addSpawn(HEKATON_PRIME, 191777, 56197, -7624, 0, false, 0);
        htmltext = "32711-09.html";
        break;
      case "32711-03.htm":
      case "32711-05.html":
      case "32711-06.html":
        break;
      default:
        htmltext = null;
        break;
    }
    return htmltext;
  }