123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498 |
- /*
- * 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.Q00125_TheNameOfEvil1;
- import java.util.HashMap;
- import java.util.Map;
- import quests.Q00124_MeetingTheElroki.Q00124_MeetingTheElroki;
- import com.l2jserver.Config;
- import com.l2jserver.gameserver.enums.QuestSound;
- 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;
- import com.l2jserver.gameserver.model.quest.State;
- import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
- /**
- * The Name of Evil - 1 (125)
- * @author Adry_85
- */
- public class Q00125_TheNameOfEvil1 extends Quest
- {
- // NPCs
- private static final int MUSHIKA = 32114;
- private static final int KARAKAWEI = 32117;
- private static final int ULU_KAIMU = 32119;
- private static final int BALU_KAIMU = 32120;
- private static final int CHUTA_KAIMU = 32121;
- // Items
- private static final int ORNITHOMIMUS_CLAW = 8779;
- private static final int DEINONYCHUS_BONE = 8780;
- private static final int EPITAPH_OF_WISDOM = 8781;
- private static final int GAZKH_FRAGMENT = 8782;
-
- private static final Map<Integer, Integer> ORNITHOMIMUS = new HashMap<>();
- private static final Map<Integer, Integer> DEINONYCHUS = new HashMap<>();
-
- static
- {
- ORNITHOMIMUS.put(22200, 661);
- ORNITHOMIMUS.put(22201, 330);
- ORNITHOMIMUS.put(22202, 661);
- ORNITHOMIMUS.put(22219, 327);
- ORNITHOMIMUS.put(22224, 327);
- DEINONYCHUS.put(22203, 651);
- DEINONYCHUS.put(22204, 326);
- DEINONYCHUS.put(22205, 651);
- DEINONYCHUS.put(22220, 319);
- DEINONYCHUS.put(22225, 319);
- }
-
- public Q00125_TheNameOfEvil1()
- {
- super(125, Q00125_TheNameOfEvil1.class.getSimpleName(), "The Name of Evil - 1");
- addStartNpc(MUSHIKA);
- addTalkId(MUSHIKA, KARAKAWEI, ULU_KAIMU, BALU_KAIMU, CHUTA_KAIMU);
- addKillId(ORNITHOMIMUS.keySet());
- addKillId(DEINONYCHUS.keySet());
- registerQuestItems(ORNITHOMIMUS_CLAW, DEINONYCHUS_BONE, EPITAPH_OF_WISDOM, GAZKH_FRAGMENT);
- }
-
- @Override
- public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
- {
- QuestState st = getQuestState(player, false);
- if (st == null)
- {
- return getNoQuestMsg(player);
- }
-
- String htmltext = event;
- switch (event)
- {
- case "32114-05.html":
- st.startQuest();
- break;
- case "32114-08.html":
- if (st.isCond(1))
- {
- st.giveItems(GAZKH_FRAGMENT, 1);
- st.setCond(2, true);
- }
- break;
- case "32117-09.html":
- if (st.isCond(2))
- {
- st.setCond(3, true);
- }
- break;
- case "32117-15.html":
- if (st.isCond(4))
- {
- st.setCond(5, true);
- }
- break;
- case "T_One":
- st.set("T", "1");
- htmltext = "32119-04.html";
- break;
- case "E_One":
- st.set("E", "1");
- htmltext = "32119-05.html";
- break;
- case "P_One":
- st.set("P", "1");
- htmltext = "32119-06.html";
- break;
- case "U_One":
- st.set("U", "1");
- if (st.isCond(5) && (st.getInt("T") > 0) && (st.getInt("E") > 0) && (st.getInt("P") > 0) && (st.getInt("U") > 0))
- {
- htmltext = "32119-08.html";
- st.set("Memo", "1");
- }
- else
- {
- htmltext = "32119-07.html";
- }
- st.unset("T");
- st.unset("E");
- st.unset("P");
- st.unset("U");
- break;
- case "32119-07.html":
- st.unset("T");
- st.unset("E");
- st.unset("P");
- st.unset("U");
- break;
- case "32119-18.html":
- if (st.isCond(5))
- {
- st.setCond(6, true);
- st.unset("Memo");
- }
- break;
- case "T_Two":
- st.set("T", "1");
- htmltext = "32120-04.html";
- break;
- case "O_Two":
- st.set("O", "1");
- htmltext = "32120-05.html";
- break;
- case "O2_Two":
- st.set("O2", "1");
- htmltext = "32120-06.html";
- break;
- case "N_Two":
- st.set("N", "1");
- if (st.isCond(6) && (st.getInt("T") > 0) && (st.getInt("O") > 0) && (st.getInt("O2") > 0) && (st.getInt("N") > 0))
- {
- htmltext = "32120-08.html";
- st.set("Memo", "1");
- }
- else
- {
- htmltext = "32120-07.html";
- }
- st.unset("T");
- st.unset("O");
- st.unset("O2");
- st.unset("N");
- break;
- case "32120-07.html":
- st.unset("T");
- st.unset("O");
- st.unset("O2");
- st.unset("N");
- case "32120-17.html":
- if (st.isCond(6))
- {
- st.setCond(7, true);
- st.unset("Memo");
- }
- break;
- case "W_Three":
- st.set("W", "1");
- htmltext = "32121-04.html";
- break;
- case "A_Three":
- st.set("A", "1");
- htmltext = "32121-05.html";
- break;
- case "G_Three":
- st.set("G", "1");
- htmltext = "32121-06.html";
- break;
- case "U_Three":
- st.set("U", "1");
- if (st.isCond(7) && (st.getInt("W") > 0) && (st.getInt("A") > 0) && (st.getInt("G") > 0) && (st.getInt("U") > 0))
- {
- htmltext = "32121-08.html";
- st.set("Memo", "1");
- }
- else
- {
- htmltext = "32121-07.html";
- }
- st.unset("W");
- st.unset("A");
- st.unset("G");
- st.unset("U");
- break;
- case "32121-07.html":
- st.unset("W");
- st.unset("A");
- st.unset("G");
- st.unset("U");
- break;
- case "32121-11.html":
- st.set("Memo", "2");
- break;
- case "32121-16.html":
- st.set("Memo", "3");
- break;
- case "32121-18.html":
- if (st.isCond(7) && st.hasQuestItems(GAZKH_FRAGMENT))
- {
- st.giveItems(EPITAPH_OF_WISDOM, 1);
- st.takeItems(GAZKH_FRAGMENT, -1);
- st.setCond(8, true);
- st.unset("Memo");
- }
- break;
- }
- return htmltext;
- }
-
- @Override
- public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
- {
- final L2PcInstance partyMember = getRandomPartyMember(player, 3);
- if (partyMember == null)
- {
- return null;
- }
-
- final QuestState st = getQuestState(partyMember, false);
- int npcId = npc.getId();
- if (ORNITHOMIMUS.containsKey(npcId))
- {
- if (st.getQuestItemsCount(ORNITHOMIMUS_CLAW) < 2)
- {
- float chance = ORNITHOMIMUS.get(npcId) * Config.RATE_QUEST_DROP;
- if (getRandom(1000) < chance)
- {
- st.giveItems(ORNITHOMIMUS_CLAW, 1);
- st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
- }
- }
- }
- else if (DEINONYCHUS.containsKey(npcId))
- {
- if (st.getQuestItemsCount(DEINONYCHUS_BONE) < 2)
- {
- float chance = DEINONYCHUS.get(npcId) * Config.RATE_QUEST_DROP;
- if (getRandom(1000) < chance)
- {
- st.giveItems(DEINONYCHUS_BONE, 1);
- st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
- }
- }
- }
-
- if ((st.getQuestItemsCount(ORNITHOMIMUS_CLAW) == 2) && (st.getQuestItemsCount(DEINONYCHUS_BONE) == 2))
- {
- st.setCond(4, true);
- }
- return super.onKill(npc, player, isSummon);
- }
-
- @Override
- public String onTalk(L2Npc npc, L2PcInstance player)
- {
- String htmltext = getNoQuestMsg(player);
- QuestState st = getQuestState(player, true);
- if (st == null)
- {
- return htmltext;
- }
-
- switch (npc.getId())
- {
- case MUSHIKA:
- switch (st.getState())
- {
- case State.CREATED:
- if (player.getLevel() < 76)
- {
- htmltext = "32114-01a.htm";
- }
- else
- {
- st = player.getQuestState(Q00124_MeetingTheElroki.class.getSimpleName());
- htmltext = ((st != null) && st.isCompleted()) ? "32114-01.htm" : "32114-01b.htm";
- }
- break;
- case State.STARTED:
- switch (st.getCond())
- {
- case 1:
- htmltext = "32114-09.html";
- break;
- case 2:
- htmltext = "32114-10.html";
- break;
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- htmltext = "32114-11.html";
- break;
- case 8:
- if (st.hasQuestItems(EPITAPH_OF_WISDOM))
- {
- htmltext = "32114-12.html";
- st.addExpAndSp(859195, 86603);
- st.exitQuest(false, true);
- }
- break;
- }
- break;
- case State.COMPLETED:
- htmltext = getAlreadyCompletedMsg(player);
- break;
- }
- break;
- case KARAKAWEI:
- if (st.isStarted())
- {
- switch (st.getCond())
- {
- case 1:
- htmltext = "32117-01.html";
- break;
- case 2:
- htmltext = "32117-02.html";
- break;
- case 3:
- htmltext = "32117-10.html";
- break;
- case 4:
- if ((st.getQuestItemsCount(ORNITHOMIMUS_CLAW) >= 2) && (st.getQuestItemsCount(DEINONYCHUS_BONE) >= 2))
- {
- st.takeItems(ORNITHOMIMUS_CLAW, -1);
- st.takeItems(DEINONYCHUS_BONE, -1);
- htmltext = "32117-11.html";
- }
- break;
- case 5:
- htmltext = "32117-16.html";
- break;
- case 6:
- case 7:
- htmltext = "32117-17.html";
- break;
- case 8:
- htmltext = "32117-18.html";
- break;
- }
- }
- break;
- case ULU_KAIMU:
- if (st.isStarted())
- {
- switch (st.getCond())
- {
- case 1:
- case 2:
- case 3:
- case 4:
- htmltext = "32119-01.html";
- break;
- case 5:
- if (st.get("Memo") == null)
- {
- htmltext = "32119-02.html";
- npc.broadcastPacket(new MagicSkillUse(npc, player, 5089, 1, 1000, 0));
- st.unset("T");
- st.unset("E");
- st.unset("P");
- st.unset("U");
- }
- else
- {
- htmltext = "32119-09.html";
- }
- break;
- case 6:
- htmltext = "32119-18.html";
- break;
- default:
- htmltext = "32119-19.html";
- break;
- }
- }
- break;
- case BALU_KAIMU:
- if (st.isStarted())
- {
- switch (st.getCond())
- {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- htmltext = "32120-01.html";
- break;
- case 6:
- if (st.get("Memo") == null)
- {
- htmltext = "32120-02.html";
- npc.broadcastPacket(new MagicSkillUse(npc, player, 5089, 1, 1000, 0));
- st.unset("T");
- st.unset("O");
- st.unset("O2");
- st.unset("N");
- }
- else
- {
- htmltext = "32120-09.html";
- }
- break;
- case 7:
- htmltext = "32120-17.html";
- break;
- default:
- htmltext = "32119-18.html";
- break;
- }
- }
- break;
- case CHUTA_KAIMU:
- if (st.isStarted())
- {
- switch (st.getCond())
- {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- htmltext = "32121-01.html";
- break;
- case 7:
- switch (st.getInt("Memo"))
- {
- case 0:
- htmltext = "32121-02.html";
- npc.broadcastPacket(new MagicSkillUse(npc, player, 5089, 1, 1000, 0));
- st.unset("W");
- st.unset("A");
- st.unset("G");
- st.unset("U");
- break;
- case 1:
- htmltext = "32121-09.html";
- break;
- case 2:
- htmltext = "32121-19.html";
- break;
- case 3:
- htmltext = "32121-20.html";
- break;
- }
- break;
- case 8:
- htmltext = "32121-21.html";
- break;
- }
- }
- break;
- }
- return htmltext;
- }
- }
|