123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- /*
- * Copyright (C) 2004-2015 L2J DataPack
- *
- * This file is part of L2J DataPack.
- *
- * L2J DataPack is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * L2J DataPack is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package quests.Q00154_SacrificeToTheSea;
- import com.l2jserver.gameserver.model.actor.L2Npc;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jserver.gameserver.model.quest.Quest;
- import com.l2jserver.gameserver.model.quest.QuestState;
- /**
- * Sacrifice to the Sea (154)
- * @author Pandragon
- */
- public final class Q00154_SacrificeToTheSea extends Quest
- {
- // NPCs
- private static final int ROCKSWELL = 30312;
- private static final int CRISTEL = 30051;
- private static final int ROLLFNAN = 30055;
- // Items
- private static final int FOX_FUR = 1032;
- private static final int FOX_FUR_YAM = 1033;
- private static final int MAIDEN_DOLL = 1034;
- // Monsters
- private static final int ELDER_KELTIR = 20544;
- private static final int YOUNG_KELTIR = 20545;
- private static final int KELTIR = 20481;
- // Reward
- private static final int MAGE_EARING = 113;
- // Misc
- private static final int MIN_LVL = 2;
-
- public Q00154_SacrificeToTheSea()
- {
- super(154, Q00154_SacrificeToTheSea.class.getSimpleName(), "Sacrifice to the Sea");
- addStartNpc(ROCKSWELL);
- addTalkId(ROCKSWELL, CRISTEL, ROLLFNAN);
- addKillId(ELDER_KELTIR, YOUNG_KELTIR, KELTIR);
- registerQuestItems(FOX_FUR, FOX_FUR_YAM, MAIDEN_DOLL);
- }
-
- @Override
- public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
- {
- final QuestState qs = getQuestState(player, false);
- if ((qs != null) && event.equals("30312-03.htm"))
- {
- qs.startQuest();
- return event;
- }
- return null;
- }
-
- @Override
- public String onTalk(L2Npc npc, L2PcInstance talker)
- {
- final QuestState qs = getQuestState(talker, true);
- String htmltext = getNoQuestMsg(talker);
- switch (npc.getId())
- {
- case ROCKSWELL:
- {
- if (qs.isCreated())
- {
- htmltext = ((talker.getLevel() >= MIN_LVL) ? "30312-01.htm" : "30312-02.htm");
- }
- else if (qs.isStarted())
- {
- switch (qs.getCond())
- {
- case 1:
- {
- htmltext = "30312-04.html";
- break;
- }
- case 2:
- {
- htmltext = "30312-07.html";
- break;
- }
- case 3:
- {
- htmltext = "30312-05.html";
- break;
- }
- case 4:
- {
- takeItems(talker, MAIDEN_DOLL, -1);
- rewardItems(talker, MAGE_EARING, 1);
- addExpAndSp(talker, 0, 1000);
- qs.exitQuest(false, true);
- htmltext = "30312-06.html";
- break;
- }
- }
- }
- else
- {
- htmltext = getAlreadyCompletedMsg(talker);
- }
- break;
- }
- case CRISTEL:
- {
- switch (qs.getCond())
- {
- case 1:
- {
- htmltext = "30051-02.html";
- break;
- }
- case 2:
- {
- takeItems(talker, FOX_FUR, -1);
- giveItems(talker, FOX_FUR_YAM, 1);
- qs.setCond(3, true);
- htmltext = "30051-01.html";
- break;
- }
- case 3:
- {
- htmltext = "30051-03.html";
- break;
- }
- case 4:
- {
- htmltext = "30051-04.html";
- break;
- }
- }
- break;
- }
- case ROLLFNAN:
- {
- switch (qs.getCond())
- {
- case 1:
- case 2:
- {
- htmltext = "30055-03.html";
- break;
- }
- case 3:
- {
- takeItems(talker, FOX_FUR_YAM, -1);
- giveItems(talker, MAIDEN_DOLL, 1);
- qs.setCond(4, true);
- htmltext = "30055-01.html";
- break;
- }
- case 4:
- {
- htmltext = "30055-02.html";
- break;
- }
- }
- break;
- }
- }
- return htmltext;
- }
-
- @Override
- public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
- {
- final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc);
- if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, FOX_FUR, 1, 10, 0.3, true))
- {
- qs.setCond(2);
- }
- return super.onKill(npc, killer, isSummon);
- }
- }
|