123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- /*
- * 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.Q00131_BirdInACage;
- import com.l2jserver.gameserver.model.Location;
- 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;
- /**
- * Bird in a Cage (131)
- * @author Zoey76
- */
- public class Q00131_BirdInACage extends Quest
- {
- // NPCs
- private static final int KANIS = 32264;
- private static final int PARME = 32271;
- // Items
- private static final int ECHO_CRYSTAL_OF_FREE_THOUGHT = 9783;
- private static final int PARMES_LETTER = 9784;
- private static final int FIRE_STONE = 9546;
- // Locations
- private static final Location INSTANCE_EXIT = new Location(143281, 148843, -12004);
- // Misc
- private static final int MIN_LEVEL = 78;
-
- public Q00131_BirdInACage()
- {
- super(131, Q00131_BirdInACage.class.getSimpleName(), "Bird in a Cage");
- addStartNpc(KANIS);
- addTalkId(KANIS, PARME);
- registerQuestItems(ECHO_CRYSTAL_OF_FREE_THOUGHT, PARMES_LETTER);
- }
-
- @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 "32264-04.html":
- {
- if (player.getLevel() >= MIN_LEVEL)
- {
- st.startQuest();
- htmltext = event;
- }
- break;
- }
- case "32264-06.html":
- {
- if (st.isCond(1))
- {
- htmltext = event;
- }
- break;
- }
- case "32264-07.html":
- {
- if (st.isCond(1))
- {
- st.setCond(2);
- htmltext = event;
- }
- break;
- }
- case "32264-09.html":
- case "32264-10.html":
- case "32264-11.html":
- {
- if (st.isCond(2))
- {
- htmltext = event;
- }
- break;
- }
- case "32264-12.html":
- {
- if (st.isCond(2))
- {
- st.giveItems(ECHO_CRYSTAL_OF_FREE_THOUGHT, 1);
- st.setCond(3, true);
- htmltext = event;
- }
- break;
- }
- case "32264-14.html":
- case "32264-15.html":
- {
- if (st.isCond(3))
- {
- htmltext = event;
- }
- break;
- }
- case "32264-17.html":
- {
- if (st.isCond(4) && st.hasQuestItems(PARMES_LETTER))
- {
- st.takeItems(PARMES_LETTER, -1);
- st.setCond(5);
- htmltext = event;
- }
- break;
- }
- case "32264-19.html":
- {
- if (st.isCond(5) && st.hasQuestItems(ECHO_CRYSTAL_OF_FREE_THOUGHT))
- {
- st.addExpAndSp(250677, 25019);
- st.giveItems(FIRE_STONE + getRandom(4), 4);
- st.exitQuest(false, true);
- htmltext = event;
- }
- break;
- }
- case "32271-03.html":
- {
- if (st.isCond(3))
- {
- htmltext = event;
- }
- break;
- }
- case "32271-04.html":
- {
- if (st.isCond(3))
- {
- st.giveItems(PARMES_LETTER, 1);
- st.setCond(4, true);
- player.setInstanceId(0);
- player.teleToLocation(INSTANCE_EXIT, true);
- htmltext = event;
- }
- 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.COMPLETED:
- {
- htmltext = getAlreadyCompletedMsg(player);
- break;
- }
- case State.CREATED:
- {
- if (npc.getId() == KANIS)
- {
- htmltext = (player.getLevel() >= MIN_LEVEL) ? "32264-01.htm" : "32264-02.html";
- }
- break;
- }
- case State.STARTED:
- {
- if (npc.getId() == KANIS)
- {
- switch (st.getCond())
- {
- case 1:
- {
- htmltext = "32264-05.html";
- break;
- }
- case 2:
- {
- htmltext = "32264-08.html";
- break;
- }
- case 3:
- {
- htmltext = "32264-13.html";
- break;
- }
- case 4:
- {
- htmltext = "32264-16.html";
- break;
- }
- case 5:
- {
- htmltext = "32264-18.html";
- break;
- }
- }
- }
- else if (npc.getId() == PARME)
- {
- if (st.getCond() < 3)
- {
- htmltext = "32271-01.html";
- }
- else if (st.isCond(3))
- {
- htmltext = "32271-02.html";
- }
- }
- break;
- }
- }
- return htmltext;
- }
- }
|