@Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    QuestState st = player.getQuestState(getClass());
    if (st == null || player.getLevel() < 79) {
      return htmltext;
    }
    int cond = st.getCond();

    if (npc.getNpcId() == WOOD) {
      QuestState first = player.getQuestState(_00196_SevenSignSealOfTheEmperor.class);
      if (first != null
          && first.getState() == COMPLETED
          && st.getState() == CREATED
          && player.getLevel() >= 79) {
        htmltext = "32593-01.htm";
      } else if (cond == 0) {
        htmltext = "32593-00.htm";
        st.exitQuest(QuestType.REPEATABLE);
      } else if (cond == 1) {
        htmltext = "32593-05.htm";
      } else if (cond == 6) {
        htmltext = "32593-06.htm";
      }
    } else if (npc.getNpcId() == ORVEN) {
      if (cond == 1) {
        htmltext = "30857-01.htm";
      } else if (cond == 2) {
        htmltext = "30857-05.htm";
      }
    } else if (npc.getNpcId() == LEOPARD) {
      if (cond == 2) {
        htmltext = "32594-01.htm";
      } else if (cond == 3) {
        htmltext = "32594-04.htm";
      }
    } else if (npc.getNpcId() == LAWRENCE) {
      if (cond == 3) {
        htmltext = "32595-01.htm";
      } else if (cond == 4) {
        htmltext = "32595-05.htm";
      } else if (cond == 5) {
        htmltext = "32595-09.htm";
      }
    } else if (npc.getNpcId() == SOFIA) {
      if (cond == 5) {
        htmltext = "32596-01.htm";
      } else if (cond == 6) {
        htmltext = "32596-05.htm";
      }
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    int npcId = npc.getNpcId();
    int cond = st.getCond();
    L2PcInstance player = st.getPlayer();

    if (npcId == Rafforty) {
      switch (st.getState()) {
        case COMPLETED:
          return "repre_q10283_02.htm";
        case CREATED:
          QuestState prevst = player.getQuestState(_00115_TheOtherSideOfTruth.class);
          return player.getLevel() < 82 || prevst == null || !prevst.isCompleted()
              ? "repre_q10283_03.htm"
              : "repre_q10283_01.htm";
        case STARTED:
          switch (cond) {
            case 1:
              return "repre_q10283_06.htm";
            case 2:
              return "repre_q10283_10.htm";
          }
      }
    }
    return getNoQuestMsg(player);
  }
  @Override
  public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet) {
    QuestState st = killer.getQuestState(getClass());

    if (npc == null || st == null) {
      return null;
    }

    if (st.getCond() == 1) {
      if (ArrayUtils.contains(ДревниеГерои, npc.getNpcId())) {
        if (killer.getParty() == null) {
          st.giveItem(ПроклятаяСлизь);
          st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
          if (st.getQuestItemsCount(ПроклятаяСлизь) >= 8) {
            st.setCond(2);
            st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
          }
        } else {
          QuestState pst = killer.getParty().getRandomPartyMember().getQuestState(getClass());
          if (pst != null && pst.getCond() == 1) {
            pst.giveItem(ПроклятаяСлизь);
            pst.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
            if (pst.getQuestItemsCount(ПроклятаяСлизь) >= 8) {
              pst.setCond(2);
              pst.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
            }
          }
        }
      }
    }
    return super.onKill(npc, killer, isPet);
  }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    L2PcInstance player = st.getPlayer();

    if (npc.getNpcId() == Типия) {
      switch (st.getState()) {
        case COMPLETED:
          return "orbis_typia_q10318_03.htm";
        case CREATED:
          QuestState previous = player.getQuestState(_10317_OrbisWitch.class);
          if (previous == null || !previous.isCompleted() || player.getLevel() < 95) {
            st.exitQuest(QuestType.REPEATABLE);
            return "orbis_typia_q10318_02.htm";
          } else {
            return "orbis_typia_q10318_01.htm";
          }
        case STARTED:
          if (st.getCond() == 1) {
            return !st.hasQuestItems(ПроклятаяСлизь)
                ? "orbis_typia_q10318_08.htm"
                : "orbis_typia_q10318_09.htm";
          } else if (st.getCond() == 2 && st.getQuestItemsCount(ПроклятаяСлизь) >= 8) {
            st.addExpAndSp(79260650, 36253450);
            st.giveAdena(5427900, true);
            st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
            st.exitQuest(QuestType.ONE_TIME);
            return "orbis_typia_q10318_10.htm";
          }
      }
    }
    return getNoQuestMsg(player);
  }
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
    if (player.getClan() == null) {
      return null;
    }

    QuestState st = null;

    if (player.isClanLeader()) {
      st = player.getQuestState(getClass());
    } else {
      L2PcInstance pleader = player.getClan().getLeader().getPlayerInstance();
      if (pleader != null && player.isInsideRadius(pleader, 1500, true, false)) {
        st = pleader.getQuestState(getClass());
      }
    }

    if (st != null && st.isStarted()) {
      int raid = st.getInt("raid");
      if (REWARD_POINTS.containsKey(raid)) {
        if (npc.getNpcId() == REWARD_POINTS.get(raid)[0]
            && !st.hasQuestItems(REWARD_POINTS.get(raid)[1])) {
          st.rewardItems(REWARD_POINTS.get(raid)[1], 1);
          st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
        }
      }
    }
    return null;
  }
  @Override
  public String onAsk(L2PcInstance player, L2Npc npc, QuestState st, int reply) {
    if (st == null) {
      return null;
    }

    int cond = st.getCond();
    int npcId = npc.getNpcId();
    switch (npcId) {
      case ELIYAH:
        if (reply == 1) {
          return "priest_eliyah_q10388_05.htm";
        }
        if (reply == 5) {
          return "priest_eliyah_q10388_06.htm";
        }
        if (reply == 6) {
          return "priest_eliyah_q10388_07.htm";
        }
        break;
      case KARGOS:
        if (reply == 1) {
          return "kargos_q10388_03.htm";
        }
        if (reply == 2) {
          return "kargos_q10388_04.htm";
        }
        if (reply == 3 && cond == 1) {
          st.setCond(2);
          st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
          return "kargos_q10388_05.htm";
        }
        break;
      case KITCHEN:
        if (reply == 1 && cond == 2) {
          st.setCond(3);
          st.giveItem(VISITOR_BADGE);
          st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
          return "kitchen_q10388_02.htm";
        }
        break;
      case RAZEN:
        if (reply == 1) {
          return "razen_q10388_02.htm";
        }
        if (reply == 2 && cond == 3) {
          st.takeItems(VISITOR_BADGE, -1);
          st.addExpAndSp(29638350, 7113);
          st.giveAdena(65136, true);
          st.exitQuest(QuestType.ONE_TIME);
          st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
          return "razen_q10388_03.htm";
        }
        break;
    }
    return getNoQuestMsg(st.getPlayer());
  }
 @Override
 public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
   QuestState st = player.getQuestState(getClass());
   if (st == null) {
     return null;
   }
   if (npc.getNpcId() == SHILENSEVIL && st.getCond() == 3) {
     npc.broadcastPacket(
         new NS(
                 npc.getObjectId(),
                 ChatType.NPC_ALL,
                 npc.getNpcId(),
                 NpcStringId.S1_YOU_MAY_HAVE_WON_THIS_TIME_BUT_NEXT_TIME_I_WILL_SURELY_CAPTURE_YOU)
             .addStringParameter(player.getName()));
     st.giveItems(SCULPTURE, 1);
     st.setCond(4);
   }
   return null;
 }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    if (st == null) {
      return null;
    }

    int cond = st.getCond();
    switch (npc.getNpcId()) {
      case ELIYAH:
        if (st.isCompleted()) {
          return "priest_eliyah_q10388_03.htm";
        }
        if (st.isCreated()) {
          if (st.getPlayer().getLevel() >= 97 && !st.isCompleted()) {
            return "priest_eliyah_q10388_01.htm";
          } else {
            st.exitQuest(QuestType.REPEATABLE);
            return "priest_eliyah_q10388_02.htm";
          }
        }
        if (cond >= 1) {
          return "priest_eliyah_q10388_09.htm";
        }
        break;
      case KARGOS:
        if (cond == 1) {
          return "kargos_q10388_02.htm";
        }
        if (cond >= 2) {
          return "kargos_q10388_06.htm";
        }
        break;
      case KITCHEN:
        if (cond == 2) {
          return "kitchen_q10388_01.htm";
        }
        if (cond == 3 && !st.getPlayer().getInventory().hasItems(VISITOR_BADGE)) {
          st.giveItem(VISITOR_BADGE);
          return "kitchen_q10388_03.htm";
        }
        if (cond == 3) {
          return "kitchen_q10388_04.htm";
        }
        break;
      case RAZEN:
        if (st.isCompleted()) {
          return getAlreadyCompletedMsg(st.getPlayer(), QuestType.ONE_TIME);
        }
        if (cond == 3) {
          return "razen_q10388_01.htm";
        }
        break;
    }
    return getNoQuestMsg(st.getPlayer());
  }
 @Override
 public String onAsk(L2PcInstance player, L2Npc npc, QuestState st, int reply) {
   if (npc.getNpcId() == Типия) {
     switch (reply) {
       case 1:
         return "orbis_typia_q10318_04.htm";
       case 2:
         return "orbis_typia_q10318_05.htm";
       case 3:
         return "orbis_typia_q10318_06.htm";
     }
   }
   return null;
 }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    QuestState st = player.getQuestState(getClass());

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

    if (npc.getNpcId() == EDRIC) {
      if (event.equalsIgnoreCase("32527-05.htm")) {
        st.startQuest();
        st.unset("timeDiff"); // if any
      }
    }
    return event;
  }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    L2PcInstance player = st.getPlayer();

    if (npc.getNpcId() == EDRIC) {
      if (player.getLevel() < 75) {
        return "32527-00.htm";
      } else if (st.isCreated()) {
        return "32527-01.htm";
      } else if (player.isGM()) {
        st.startQuest();
        return "32527-10.html";
      } else if (st.getCond() == 1) {
        L2Party party = player.getParty();
        if (st.getInt("timeDiff") > 0) {
          if (giveReward(st, st.getInt("timeDiff"))) {
            // Clear quest
            st.unset("timeDiff");
            st.unset("cond");
            st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
            st.exitQuest(QuestType.REPEATABLE);
            return "32527-reward.html";
          } else {
            // Clear quest
            st.unset("timeDiff");
            st.unset("cond");
            st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
            st.exitQuest(QuestType.REPEATABLE);
            return "32527-noreward.html";
          }
        } else if (party == null) {
          return "32527-noparty.html";
        } else if (!party.getLeader().equals(player)) {
          return prepareHtml(player, "32527-noleader.html", party.getLeader().getName());
        } else {
          for (L2PcInstance pm : party.getMembers()) {
            QuestState state = pm.getQuestState(getClass());
            if (state == null || state.getCond() != 1) {
              return prepareHtml(player, "32527-noquest.html", pm.getName());
            }
          }
          return "32527-10.html";
        }
      }
    }
    return null;
  }
示例#12
0
  @Override
  public String onAsk(L2PcInstance player, L2Npc npc, int ask, int reply) {
    if (npc.getNpcId() == NPC) {
      if (ask == 100) {
        if (reply == 1) {
          if (player.getItemsCount(Shield) > 0) {
            if (player.getAdenaCount() >= 5000) {
              player.exchangeItemsById(ProcessType.NPC, npc, Shield, 1, ShieldImproved, 1, true);
              player.getInventory().reduceAdena(ProcessType.NPC, 5000, player, npc);
              return "orbis_rykus009.htm";
            } else {
              return "orbis_rykus011.htm";
            }
          } else {
            return "orbis_rykus012.htm";
          }
        } else if (reply == 2) {
          long shieldsCount = player.getItemsCount(Shield);
          long adenaCount = player.getAdenaCount();

          if (shieldsCount > 0) {
            long availableShields = adenaCount / 5000;
            if (availableShields > 0) {
              player.exchangeItemsById(
                  ProcessType.NPC,
                  npc,
                  Shield,
                  availableShields,
                  ShieldImproved,
                  availableShields,
                  true);
              player
                  .getInventory()
                  .reduceAdena(ProcessType.NPC, 5000 * availableShields, player, npc);
              return "orbis_rykus010.htm";
            } else {
              return "orbis_rykus011.htm";
            }
          } else {
            return "orbis_rykus012.htm";
          }
        }
      }
    }
    return null;
  }
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
    QuestState st = player.getQuestState(getClass());
    if (st == null) {
      return null;
    }

    int npcId = npc.getNpcId();
    if (ArrayUtils.contains(MOBS, npcId)) {
      if (st.getState() == STARTED) {
        st.dropQuestItems(SPIRIT_BEAD, 1, -1, DROP_CHANCE, true);
      } else {
        return null;
      }
    }
    return super.onKill(npc, player, isPet);
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    QuestState st = player.getQuestState(getClass());
    if (st == null) {
      return null;
    }

    switch (event) {
      case "32593-04.htm":
        st.startQuest();
        break;
      case "30857-04.htm":
        st.setCond(2);
        st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
        break;
      case "32594-03.htm":
        st.setCond(3);
        st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
        break;
      case "32595-04.htm":
        L2Npc monster = addSpawn(SHILENSEVIL, 152520, -57685, -3438, 0, false, 60000, true);
        monster.broadcastPacket(
            new NS(
                monster.getObjectId(),
                ChatType.NPC_ALL,
                monster.getNpcId(),
                NpcStringId.YOU_ARE_NOT_THE_OWNER_OF_THAT_ITEM));
        monster.setRunning();
        monster.getAttackable().attackCharacter(player);
        break;
      case "32595-08.htm":
        st.setCond(5);
        st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
        break;
      case "32596-04.htm":
        st.setCond(6);
        st.giveItems(TEXT, 1);
        st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
        break;
      case "32593-08.htm":
        if (player.isSubClassActive()) {
          return "subclass_forbidden.htm";
        }
        st.takeItems(TEXT, 1);
        st.takeItems(SCULPTURE, 1);
        st.addExpAndSp(10000000, 2500000);
        st.unset("cond");
        st.exitQuest(QuestType.ONE_TIME);
        st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
        break;
    }
    return event;
  }
  @Override
  public String onKill(L2Npc npc, QuestState st) {
    int npcId = npc.getNpcId();

    if ((npcId >= 22200 && npcId <= 22202 || npcId == 22219 || npcId == 22224)
        && st.getQuestItemsCount(OrClaw) < 2
        && Rnd.getChance(10 * (int) Config.RATE_QUEST_DROP)) {
      st.giveItems(OrClaw, 1);
      st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
    }
    if ((npcId >= 22203 && npcId <= 22205 || npcId == 22220 || npcId == 22225)
        && st.getQuestItemsCount(DienBone) < 2
        && Rnd.getChance(10 * (int) Config.RATE_QUEST_DROP)) {
      st.giveItems(DienBone, 1);
      st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
    }

    return null;
  }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    L2PcInstance player = st.getPlayer();
    int npcId = npc.getNpcId();
    QuestStateType id = st.getState();
    if (npcId == WILBERT && id == CREATED) {
      if (player.getLevel() >= 50) {
        return "Wilbert_start.htm";
      } else {

        st.exitQuest(QuestType.REPEATABLE);
        return "<html><body>Этот квест доступен персонажам, достигшим 50 уровня.</body></html>";
      }
    }
    if (npcId == WILBERT && id == STARTED) {
      return "Wilbert_QuestInProgress.htm";
    }
    return null;
  }
示例#17
0
  @Override
  public String onAsk(L2PcInstance player, L2Npc npc, QuestState st, int reply) {
    int npcId = npc.getNpcId();
    int cond = st.getCond();

    if (npcId == Kusto) {
      if (reply == 1 && cond == 2) {
        st.setCond(3);
        st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
        return "head_blacksmith_kusto_q0190_06.htm";
      }
    } else if (npcId == Juris) {
      if (reply == 1) {
        return "juria_q0190_02.htm";
      } else if (reply == 2 && cond == 1) {
        st.setCond(2);
        st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
        return "juria_q0190_03.htm";
      }
    }
    return null;
  }
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
    QuestState qs = player.getQuestState(getClass());
    if (qs == null) {
      return null;
    }

    if (qs.getState() == STARTED && qs.getCond() == 3) {
      if (npc.getNpcId() == Cruma_Marshlands_Traitor) {
        qs.giveItems(Giants_Technology_Report, 1);
        if (qs.getQuestItemsCount(Giants_Technology_Report) < 3) {
          qs.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
        } else {
          qs.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
          qs.setCond(4);
        }
      } else if (qs.getQuestItemsCount(Giants_Experimental_Tool) < 1) {
        if (Rnd.getChance(Giants_Experimental_Tool_Fragment_chance)) {
          qs.giveItems(Giants_Experimental_Tool_Fragment, 1);
        }
      } else {
        qs.takeItems(Giants_Experimental_Tool, 1);
        if (Rnd.getChance(Cruma_Marshlands_Traitor_spawnchance)) {
          qs.addSpawn(
              Cruma_Marshlands_Traitor,
              qs.getPlayer().getX(),
              qs.getPlayer().getY(),
              qs.getPlayer().getZ(),
              0,
              true,
              900000);
        }
      }
    }
    return null;
  }
示例#19
0
  @TextCommand("manor_menu_select")
  public boolean manorMenu(BypassHandlerParams params) {
    L2PcInstance activeChar = params.getPlayer();
    L2Npc manager = activeChar.getLastFolkNPC();
    if (!activeChar.isInsideRadius(manager, L2Npc.INTERACTION_DISTANCE, true, false)) {
      return false;
    }

    try {
      Castle castle = manager.getCastle();

      if (CastleManorManager.getInstance().isUnderMaintenance()) {
        activeChar.sendActionFailed();
        activeChar.sendPacket(SystemMessageId.THE_MANOR_SYSTEM_IS_CURRENTLY_UNDER_MAINTENANCE);
        return true;
      }

      int ask = Integer.parseInt(params.getQueryArgs().get("ask"));
      int state = Integer.parseInt(params.getQueryArgs().get("state"));
      int time = Integer.parseInt(params.getQueryArgs().get("time"));

      int castleId;
      castleId = state < 0 ? castle.getCastleId() : state;

      switch (ask) {
        case 1: // Seed purchase
          if (castleId == castle.getCastleId()) {
            activeChar.sendPacket(
                new BuyListSeed(
                    activeChar.getAdenaCount(),
                    castleId,
                    castle.getSeedProduction(CastleManorManager.PERIOD_CURRENT)));
          } else {
            activeChar.sendPacket(
                SystemMessage.getSystemMessage(
                        SystemMessageId.HERE_YOU_CAN_BUY_ONLY_SEEDS_OF_S1_MANOR)
                    .addString(manager.getCastle().getName()));
          }
          break;
        case 2: // Crop sales
          activeChar.sendPacket(
              new ExShowSellCropList(
                  activeChar, castleId, castle.getCropProcure(CastleManorManager.PERIOD_CURRENT)));
          break;
        case 3: // Current seeds (Manor info)
          if (time == 1
              && !CastleManager.getInstance().getCastleById(castleId).isNextPeriodApproved()) {
            activeChar.sendPacket(new ExShowSeedInfo(castleId, null));
          } else {
            activeChar.sendPacket(
                new ExShowSeedInfo(
                    castleId,
                    CastleManager.getInstance().getCastleById(castleId).getSeedProduction(time)));
          }
          break;
        case 4: // Current crops (Manor info)
          if (time == 1
              && !CastleManager.getInstance().getCastleById(castleId).isNextPeriodApproved()) {
            activeChar.sendPacket(new ExShowCropInfo(castleId, null));
          } else {
            activeChar.sendPacket(
                new ExShowCropInfo(
                    castleId,
                    CastleManager.getInstance().getCastleById(castleId).getCropProcure(time)));
          }
          break;
        case 5: // Basic info (Manor info)
          activeChar.sendPacket(new ExShowManorDefaultInfo());
          break;
        case 6: // Buy harvester
          manager.showBuyList(activeChar, 0);
          break;
        case 7: // Edit seed setup
          if (castle.isNextPeriodApproved()) {
            activeChar.sendPacket(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_6_AM_AND_8_PM);
          } else {
            activeChar.sendPacket(new ExShowSeedSetting(castle.getCastleId()));
          }
          break;
        case 8: // Edit crop setup
          if (castle.isNextPeriodApproved()) {
            activeChar.sendPacket(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_6_AM_AND_8_PM);
          } else {
            activeChar.sendPacket(new ExShowCropSetting(castle.getCastleId()));
          }
          break;
        case 9: // Edit sales (Crop sales)
          activeChar.sendPacket(new ExShowProcureCropDetail(state));
          break;
        default:
          return false;
      }
      return true;
    } catch (Exception e) {
      log.log(Level.ERROR, e);
    }
    return false;
  }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    String htmltext = getNoQuestMsg(st.getPlayer());
    int npcId = npc.getNpcId();
    int cond = st.getCond();
    if (npcId == Mushika) {
      QuestState qs124 = st.getPlayer().getQuestState(_00124_MeetingTheElroki.class);
      if (cond == 0) {
        if (st.getPlayer().getLevel() < 76) {
          htmltext = "32114-02.htm";
          st.exitQuest(QuestType.REPEATABLE);
        } else if (qs124 != null && qs124.isCompleted()) {
          htmltext = "32114-01.htm";
        } else {
          htmltext = "32114-04.htm";
          st.exitQuest(QuestType.REPEATABLE);
        }
      } else if (cond == 1) {
        htmltext = "32114-10.htm";
      } else if (cond > 1 && cond < 8) {
        htmltext = "32114-14.htm";
      } else if (cond == 8) {
        st.unset("T32119");
        st.unset("E32119");
        st.unset("P32119");
        st.unset("U32119");
        st.unset("T32120");
        st.unset("O32120");
        st.unset("O32120_2");
        st.unset("N32120");
        st.unset("W32121");
        st.unset("A32121");
        st.unset("G32121");
        st.unset("U32121");
        st.unset("cond");

        htmltext = "32114-15.htm";
        st.addExpAndSp(898056, 1008100);
        st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
        st.exitQuest(QuestType.ONE_TIME);
      }
    } else if (npcId == Karakawei) {
      if (cond == 1) {
        htmltext = "32117-02.htm";
      } else if (cond == 2) {
        htmltext = "32117-01.htm";
      } else if (cond == 3
          && (st.getQuestItemsCount(OrClaw) < 2 || st.getQuestItemsCount(DienBone) < 2)) {
        htmltext = "32117-12.htm";
      } else if (cond == 3
          && st.getQuestItemsCount(OrClaw) == 2
          && st.getQuestItemsCount(DienBone) == 2) {
        htmltext = "32117-11.htm";
        st.takeItems(OrClaw, 2);
        st.takeItems(DienBone, 2);
        st.setCond(4);
        st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
      } else if (cond > 4 && cond < 8) {
        htmltext = "32117-19.htm";
      } else if (cond == 8) {
        htmltext = "32117-20.htm";
      }
    } else if (npcId == UluKaimu) {
      if (cond == 5) {
        htmltext = "32119-01.htm";
      } else if (cond < 5) {
        htmltext = "32119-02.htm";
      } else if (cond > 5) {
        htmltext = "32119-03.htm";
      }
    } else if (npcId == BaluKaimu) {
      if (cond == 6) {
        htmltext = "32120-01.htm";
      } else if (cond < 6) {
        htmltext = "32120-02.htm";
      } else if (cond > 6) {
        htmltext = "32120-03.htm";
      }
    } else if (npcId == ChutaKaimu) {
      if (cond == 7) {
        htmltext = "32121-01.htm";
      } else if (cond < 7) {
        htmltext = "32121-02.htm";
      } else if (cond > 7) {
        htmltext = "32121-03.htm";
      } else if (cond == 8) {
        htmltext = "32121-24.htm";
      }
    } else {
      htmltext = getAlreadyCompletedMsg(st.getPlayer(), QuestType.ONE_TIME);
    }
    return htmltext;
  }
示例#21
0
  @Override
  public String onAsk(L2PcInstance player, L2Npc npc, int ask, int reply) {
    int ownerId;
    if (ask == -1724) {
      switch (reply) {
        case 1: // Взойти на корабль
          if (player.isTransformed()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_TRANSFORMED);
            return null;
          }
          if (player.isParalyzed()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_PETRIFIED);
            return null;
          }
          if (player.isDead() || player.isFakeDeath()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_DEAD);
            return null;
          }
          if (player.isFishing()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_FISHING);
            return null;
          }
          if (player.isInCombat()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_IN_BATTLE);
            return null;
          }
          if (player.isInDuel()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_IN_A_DUEL);
            return null;
          }
          if (player.isSitting()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_SITTING);
            return null;
          }
          if (player.isCastingNow()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_CASTING);
            return null;
          }
          if (player.isCursedWeaponEquipped()) {
            player.sendPacket(
                SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_CURSED_WEAPON_IS_EQUIPPED);
            return null;
          }
          if (player.isCombatFlagEquipped()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_HOLDING_A_FLAG);
            return null;
          }
          if (!player.getPets().isEmpty() || player.isMounted()) {
            player.sendPacket(
                SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
            return null;
          }
          if (player.isFlyingMounted()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_NOT_MEET_REQUEIREMENTS);
            return null;
          }

          if (_dockedShip != null) {
            _dockedShip.addPassenger(player);
          }
          break;
        case 2: // Призвать корабль
          if (_dockedShip != null) {
            if (_dockedShip.isOwner(player)) {
              player.sendPacket(SystemMessageId.THE_AIRSHIP_IS_ALREADY_EXISTS);
            }
            return null;
          }
          if (_isBusy) {
            player.sendPacket(SystemMessageId.ANOTHER_AIRSHIP_ALREADY_SUMMONED);
            return null;
          }
          if ((player.getClanPrivileges() & L2Clan.CP_CL_SUMMON_AIRSHIP)
              != L2Clan.CP_CL_SUMMON_AIRSHIP) {
            player.sendPacket(SystemMessageId.THE_AIRSHIP_NO_PRIVILEGES);
            return null;
          }
          ownerId = player.getClanId();
          if (!AirShipManager.getInstance().hasAirShipLicense(ownerId)) {
            player.sendPacket(SystemMessageId.THE_AIRSHIP_NEED_LICENSE_TO_SUMMON);
            return null;
          }
          if (AirShipManager.getInstance().hasAirShip(ownerId)) {
            player.sendPacket(SystemMessageId.THE_AIRSHIP_ALREADY_USED);
            return null;
          }
          if (!player.destroyItemByItemId(ProcessType.CONSUME, STARSTONE, SUMMON_COST, npc, true)) {
            player.sendPacket(
                SystemMessage.getSystemMessage(SystemMessageId.THE_AIRSHIP_NEED_MORE_S1)
                    .addItemName(STARSTONE));
            return null;
          }

          _isBusy = true;
          L2AirShipInstance ship =
              AirShipManager.getInstance()
                  .getNewAirShip(_shipSpawnX, _shipSpawnY, _shipSpawnZ, _shipHeading, ownerId);
          if (ship != null) {
            if (_arrivalPath != null) {
              ship.executePath(_arrivalPath);
            }

            if (_arrivalMessage == null) {
              _arrivalMessage =
                  new NS(
                      npc.getObjectId(),
                      ChatType.SHOUT,
                      npc.getNpcId(),
                      NpcStringId
                          .THE_AIRSHIP_HAS_BEEN_SUMMONED_IT_WILL_AUTOMATICALLY_DEPART_IN_5_MINUTES);
            }

            npc.broadcastPacket(_arrivalMessage);
          } else {
            _isBusy = false;
          }
          break;
        case 3: // Подать заявку
          if (player.getClan() == null || player.getClan().getLevel() < 5) {
            player.sendPacket(SystemMessageId.THE_AIRSHIP_NEED_CLANLVL_5_TO_SUMMON);
            return null;
          }
          if (!player.isClanLeader()) {
            player.sendPacket(SystemMessageId.THE_AIRSHIP_NO_PRIVILEGES);
            return null;
          }
          ownerId = player.getClanId();
          if (AirShipManager.getInstance().hasAirShipLicense(ownerId)) {
            player.sendPacket(SystemMessageId.THE_AIRSHIP_SUMMON_LICENSE_ALREADY_ACQUIRED);
            return null;
          }
          if (!player.destroyItemByItemId(ProcessType.CONSUME, LICENSE, 1, npc, true)) {
            player.sendPacket(
                SystemMessage.getSystemMessage(SystemMessageId.THE_AIRSHIP_NEED_MORE_S1)
                    .addItemName(STARSTONE));
            return null;
          }

          AirShipManager.getInstance().registerLicense(ownerId);
          player.sendPacket(SystemMessageId.THE_AIRSHIP_SUMMON_LICENSE_ENTERED);
          break;
      }
    } else if (ask == -2011) {
      switch (reply) {
        case 1: // Отправиться в Семя Бессмертия
          player.teleToLocation(-212808, 209672, 4257);
          return null;
        case 2: // Отправиться в Семя Разрушения
          player.teleToLocation(-248536, 250280, 4311);
          return null;
        case 3: // Отправиться в Семя Уничтожения
          player.teleToLocation(-175512, 154488, 2689);
          return null;
        case 4:
          player.teleToLocation(-149406, 255247, -80);
          return null;
        case 5: // Отправиться в Семя Индустриализции
          if (player.getLevel() >= 95) {
            player.teleToLocation(-147348, 152615, -14048);
            return null;
          }
      }
    }
    return null;
  }
示例#22
0
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    int npcId = npc.getNpcId();
    int cond = st.getCond();

    if (npcId == Kusto) {
      switch (st.getState()) {
        case CREATED:
          QuestState pqs = st.getPlayer().getQuestState(_00187_NikolasHeart.class);
          if (st.getPlayer().getLevel() >= 42) {
            return pqs != null && pqs.isCompleted()
                ? "head_blacksmith_kusto_q0190_01.htm"
                : getNeedCompletedQuest(187);
          } else {
            return "head_blacksmith_kusto_q0190_02.htm";
          }
        case STARTED:
          switch (cond) {
            case 1:
              return "head_blacksmith_kusto_q0190_04.htm";
            case 2:
              return "head_blacksmith_kusto_q0190_05.htm";
            case 3:
              return "head_blacksmith_kusto_q0190_07.htm";
            case 5:
              st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
              st.giveAdena(127224, true);
              st.addExpAndSp(634158, 443538);
              st.exitQuest(QuestType.ONE_TIME);
              return "head_blacksmith_kusto_q0190_08.htm";
          }
          break;
        case COMPLETED:
          return getAlreadyCompletedMsg(st.getPlayer(), QuestType.ONE_TIME);
      }
    } else if (npcId == Juris) {
      if (st.isStarted()) {
        return cond == 1 ? "juria_q0190_01.htm" : "juria_q0190_04.htm";
      }
    } else if (npcId == Lorain) {
      if (st.isStarted()) {
        if (cond == 3) {
          st.setCond(4);
          st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
          return "researcher_lorain_q0190_01.htm";
        } else {
          return "researcher_lorain_q0190_02.htm";
        }
      }
    } else if (npcId == Nikola) {
      if (st.isStarted()) {
        if (cond == 4) {
          st.setCond(5);
          st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
          return "maestro_nikola_q0190_01.htm";
        } else {
          return "maestro_nikola_q0190_02.htm";
        }
      }
    }
    return null;
  }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    L2PcInstance player = st.getPlayer();

    if (st.getState() == COMPLETED) {
      return getAlreadyCompletedMsg(player, QuestType.ONE_TIME);
    }

    int npcId = npc.getNpcId();
    if (st.getState() == CREATED) {
      if (npcId != Glyvka) {
        return getNoQuestMsg(player);
      }
      if (player.getLevel() < 35) {
        st.exitQuest(QuestType.REPEATABLE);
        return "glyvka_q0134_02.htm";
      }
      st.setCond(0);
      return "glyvka_q0134_01.htm";
    }

    int cond = st.getCond();

    if (npcId == Glyvka && st.getState() == STARTED) {
      if (cond == 1) {
        return "glyvka_q0134_03.htm";
      }
      if (cond == 5) {
        if (st.getInt("Report") == 1) {
          return "glyvka_q0134_09.htm";
        }
        if (st.getQuestItemsCount(Roukes_Report) > 0) {
          st.takeItems(Roukes_Report, -1);
          st.set("Report", "1");
          return "glyvka_q0134_08.htm";
        }
        return getNoQuestMsg(player);
      }
      return "glyvka_q0134_07.htm";
    }

    if (npcId == Rouke && st.getState() == STARTED) {
      if (cond == 2) {
        return "scroll_seller_rouke_q0134_02.htm";
      }
      if (cond == 5) {
        return "scroll_seller_rouke_q0134_10.htm";
      }
      if (cond == 3) {
        long Tools = st.getQuestItemsCount(Giants_Experimental_Tool_Fragment) / 10;
        if (Tools < 1) {
          return "scroll_seller_rouke_q0134_04.htm";
        }
        st.takeItems(Giants_Experimental_Tool_Fragment, Tools * 10);
        st.giveItems(Giants_Experimental_Tool, Tools);
        return "scroll_seller_rouke_q0134_05.htm";
      }
      if (cond == 4) {
        if (st.getInt("Report") == 1) {
          return "scroll_seller_rouke_q0134_07.htm";
        }
        if (st.getQuestItemsCount(Giants_Technology_Report) > 2) {
          st.takeItems(Giants_Experimental_Tool_Fragment, -1);
          st.takeItems(Giants_Experimental_Tool, -1);
          st.takeItems(Giants_Technology_Report, -1);
          st.set("Report", "1");
          return "scroll_seller_rouke_q0134_06.htm";
        }
        return getNoQuestMsg(player);
      }
    }
    return getNoQuestMsg(player);
  }
 @Override
 public String onAsk(L2PcInstance player, L2Npc npc, QuestState st, int reply) {
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   if (npcId == Rafforty) {
     switch (reply) {
       case 1:
         return "repre_q10283_04.htm";
       case 2:
         if (cond == 1) {
           return "repre_q10283_07.htm";
         }
       case 3:
         if (cond == 1) {
           return "repre_q10283_08.htm";
         }
       case 4:
         if (cond == 1) {
           st.setCond(2);
           st.setMemoState(2);
           st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
           return "repre_q10283_09.htm";
         }
     }
   } else if (npcId == Kier) {
     switch (reply) {
       case 1:
         if (cond == 2) {
           return "keier_q10283_01.htm";
         }
       case 2:
         if (cond == 2) {
           if (currentTalkingWithKier == -1) {
             st.setCond(3);
             st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
             currentTalkingWithKier = player.getObjectId();
             L2Npc jinia = addSpawn(Jinia, 104476, -107535, -3688, 44954, false, 60000);
             jinia.setOwner(player);
             startQuestTimer("resetCurrentTalkingWithKier", 60000, npc, player);
           } else {
             return currentTalkingWithKier == player.getObjectId()
                 ? "keier_q10283_03.htm"
                 : "keier_q10283_02.htm";
           }
         }
     }
   } else if (npcId == Jinia) {
     switch (reply) {
       case 1:
         if (st.getMemoState() == 2) {
           return "jinia_npc_q10283_01.htm";
         }
         break;
       case 2:
         if (st.getMemoState() == 2) {
           return "jinia_npc_q10283_02.htm";
         }
         break;
       case 3:
         if (st.getMemoState() == 2) {
           st.giveAdena(190000, true);
           st.addExpAndSp(627000, 50300);
           st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
           st.exitQuest(QuestType.ONE_TIME);
           npc.getLocationController()
               .delete(); // TODO: myself->AddFleeDesire(talker,1000000); бежать в рандомном
           // направлении и deleteMe
           return "jinia_npc_q10283_03.htm";
         }
     }
   }
   return null;
 }
  @Override
  public String onKill(L2Npc npc, QuestState st) {
    int tempCount = st.getInt("over_tempcount");
    if (ArrayUtils.contains(_mobsGrendel, npc.getNpcId())) {
      int g0 = st.getInt("grendel_kill");
      int g1 = st.getInt("over_hit");

      if (g0 < 10) {
        g0++;
        if (((L2Attackable) npc).isOverhit()) {
          g1++;
          tempCount++;
          st.set("over_tempcount", String.valueOf(tempCount));
          st.set("over_hit", String.valueOf(g1));
          st.set("grendel_kill", String.valueOf(g0));
        } else {
          st.set("grendel_kill", String.valueOf(g0)); // всего киллов моба
          st.set("count", String.valueOf(tempCount)); // записываем предыдущее комбо оверхитов
          st.set("over_tempcount", "0"); // Обнуляем временный счетчик оверхитов
        }
      }
    } else if (ArrayUtils.contains(_mobsBuffalo, npc.getNpcId())) {
      int g0 = st.getInt("buffalo_kill");
      int g1 = st.getInt("over_hit");

      if (g0 < 10) {
        g0++;
        if (((L2Attackable) npc).isOverhit()) {
          g1++;
          tempCount++;
          st.set("over_tempcount", String.valueOf(tempCount));
          st.set("over_hit", String.valueOf(g1));
          st.set("buffalo_kill", String.valueOf(g0));
        } else {
          st.set("buffalo_kill", String.valueOf(g0));
          st.set("count", String.valueOf(tempCount)); // записываем предыдущее комбо оверхитов
          st.set("over_tempcount", "0"); // Обнуляем временный счетчик оверхитов
        }
      }
    } else if (ArrayUtils.contains(_mobsCougar, npc.getNpcId())) {
      int g0 = st.getInt("cougar_kill");
      int g1 = st.getInt("over_hit");
      if (g0 < 10) {
        g0++;
        if (((L2Attackable) npc).isOverhit()) {
          g1++;
          tempCount++;
          st.set("over_tempcount", String.valueOf(tempCount));
          st.set("over_hit", String.valueOf(g1));
          st.set("cougar_kill", String.valueOf(g0));
        } else {
          st.set("cougar_kill", String.valueOf(g0));
          st.set("count", String.valueOf(tempCount)); // записываем предыдущее комбо оверхитов
          st.set("over_tempcount", "0"); // Обнуляем временный счетчик оверхитов
        }
      }
    } else if (ArrayUtils.contains(_mobsKookaburra, npc.getNpcId())) {
      int g0 = st.getInt("kookaburra_kill");
      int g1 = st.getInt("over_hit");
      if (g0 < 10) {
        g0++;
        if (((L2Attackable) npc).isOverhit()) {
          g1++;
          tempCount++;
          st.set("over_tempcount", String.valueOf(tempCount));
          st.set("over_hit", String.valueOf(g1));
          st.set("kookaburra_kill", String.valueOf(g0));
        } else {
          st.set("kookaburra_kill", String.valueOf(g0));
          st.set("count", String.valueOf(tempCount)); // записываем предыдущее комбо оверхитов
          st.set("over_tempcount", "0"); // Обнуляем временный счетчик оверхитов
        }
      }
    }
    if (st.getInt("grendel_kill")
            + st.getInt("buffalo_kill")
            + st.getInt("cougar_kill")
            + st.getInt("kookaburra_kill")
        >= 40) {
      st.setCond(2);
    }
    if (st.getInt("over_hit") == 40) // Заглушка на случай совершения 40 из 40 оверхитов
    {
      st.set("count", "40");
    }
    return super.onKill(npc, st);
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    QuestState st = player.getQuestState(getClass());
    if (st == null) {
      return event;
    }
    int cond = st.getCond();

    if (event.equals("32768-11.htm") && cond == 0) {
      st.set("grendel_kill", "0");
      st.set("buffalo_kill", "0");
      st.set("cougar_kill", "0");
      st.set("kookaburra_kill", "0");
      st.set("over_hit", "0"); // Общее кол-во оверхитов
      st.set(
          "over_tempcount", "0"); // Количество оверхитов подряд, до того как сфейлил след. оверхит
      st.set("count", "0"); // Записанное, максимальное количество сделанных подряд оверхитов
      st.startQuest();
    } else if (event.equals("rating")) // Подводим рейтинг
    {
      int overhits = st.getInt("over_hit");
      if (overhits >= 20) {
        String content =
            HtmCache.getInstance()
                .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-14a.htm");
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setHtml(content);
        html.replace("<?number?>", String.valueOf(String.valueOf(overhits)));
        player.sendPacket(html);
      } else if (overhits < 20 && overhits >= 7) {
        String content =
            HtmCache.getInstance()
                .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-14b.htm");
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setHtml(content);
        html.replace("<?number?>", String.valueOf(String.valueOf(overhits)));
        player.sendPacket(html);
      } else if (overhits < 7) {
        String content =
            HtmCache.getInstance()
                .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-14c.htm");
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setHtml(content);
        html.replace("<?number?>", String.valueOf(String.valueOf(overhits)));
        player.sendPacket(html);
      }
    } else if (event.equals("rating")) // Подводим по оверхитам подряд
    {
      int overhits = st.getInt("count");
      if (overhits >= 20) {
        String content =
            HtmCache.getInstance()
                .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-16a.htm");
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setHtml(content);
        html.replace("<\\?number\\?>", String.valueOf(String.valueOf(overhits)));
        player.sendPacket(html);
      } else if (overhits < 20 && overhits >= 7) {
        String content =
            HtmCache.getInstance()
                .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-16b.htm");
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setHtml(content);
        html.replace("<\\?number\\?>", String.valueOf(String.valueOf(overhits)));
        player.sendPacket(html);
      } else if (overhits < 7) {
        String content =
            HtmCache.getInstance()
                .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-16c.htm");
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setHtml(content);
        html.replace("<\\?number\\?>", String.valueOf(String.valueOf(overhits)));
        player.sendPacket(html);
      }
    } else if (event.equals("32768-17.htm")) // Считаем награду и выставляем реюз квесту
    {
      calcReward(player);
      st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
      st.unset("cond");
      st.exitQuest(QuestType.DAILY);
    }
    return event;
  }