123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- /*
- * 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.Q10275_ContainingTheAttributePower;
- import com.l2jserver.gameserver.enums.QuestSound;
- import com.l2jserver.gameserver.model.Elementals;
- import com.l2jserver.gameserver.model.actor.L2Npc;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jserver.gameserver.model.holders.SkillHolder;
- import com.l2jserver.gameserver.model.itemcontainer.Inventory;
- 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.util.Util;
- /**
- * Containing the Attribute Power (10275)<br>
- * Original Jython script by Kerberos v1.0 on 2009/05/03.
- * @author nonom
- */
- public class Q10275_ContainingTheAttributePower extends Quest
- {
- // NPCs
- private static final int HOLLY = 30839;
- private static final int WEBER = 31307;
- private static final int YIN = 32325;
- private static final int YANG = 32326;
- private static final int WATER = 27380;
- private static final int AIR = 27381;
- // Items
- private static final int YINSWORD = 13845;
- private static final int YANGSWORD = 13881;
- private static final int SOULPIECEWATER = 13861;
- private static final int SOULPIECEAIR = 13862;
- // Skills
- private static final SkillHolder BLESSING_OF_FIRE = new SkillHolder(2635, 1);
- private static final SkillHolder BLESSING_OF_EARTH = new SkillHolder(2636, 1);
-
- public Q10275_ContainingTheAttributePower()
- {
- super(10275, Q10275_ContainingTheAttributePower.class.getSimpleName(), "Containing the Attribute Power");
- addStartNpc(HOLLY, WEBER);
- addTalkId(HOLLY, WEBER, YIN, YANG);
- addKillId(AIR, WATER);
- registerQuestItems(YINSWORD, YANGSWORD, SOULPIECEWATER, SOULPIECEAIR);
- }
-
- @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 "30839-02.html":
- case "31307-02.html":
- st.startQuest();
- break;
- case "30839-05.html":
- st.setCond(2, true);
- break;
- case "31307-05.html":
- st.setCond(7, true);
- break;
- case "32325-03.html":
- st.setCond(3, true);
- st.giveItems(YINSWORD, 1, Elementals.FIRE, 10);
- break;
- case "32326-03.html":
- st.setCond(8, true);
- st.giveItems(YANGSWORD, 1, Elementals.EARTH, 10);
- break;
- case "32325-06.html":
- if (st.hasQuestItems(YINSWORD))
- {
- st.takeItems(YINSWORD, 1);
- htmltext = "32325-07.html";
- }
- st.giveItems(YINSWORD, 1, Elementals.FIRE, 10);
- break;
- case "32326-06.html":
- if (st.hasQuestItems(YANGSWORD))
- {
- st.takeItems(YANGSWORD, 1);
- htmltext = "32326-07.html";
- }
- st.giveItems(YANGSWORD, 1, Elementals.EARTH, 10);
- break;
- case "32325-09.html":
- st.setCond(5, true);
- BLESSING_OF_FIRE.getSkill().applyEffects(player, player);
- st.giveItems(YINSWORD, 1, Elementals.FIRE, 10);
- break;
- case "32326-09.html":
- st.setCond(10, true);
- BLESSING_OF_EARTH.getSkill().applyEffects(player, player);
- st.giveItems(YANGSWORD, 1, Elementals.EARTH, 10);
- break;
- }
-
- if (Util.isDigit(event))
- {
- htmltext = Integer.toString(npc.getId()) + "-1" + event + ".html";
- st.giveItems(10520 + Integer.valueOf(event), 2);
- st.addExpAndSp(202160, 20375);
- st.exitQuest(false, true);
- }
-
- return htmltext;
- }
-
- @Override
- public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
- {
- final QuestState st = getQuestState(player, false);
- if (st == null)
- {
- return null;
- }
-
- switch (npc.getId())
- {
- case AIR:
- if ((st.isCond(8) || st.isCond(10)) && (st.getItemEquipped(Inventory.PAPERDOLL_RHAND) == YANGSWORD) && (st.getQuestItemsCount(SOULPIECEAIR) < 6) && (getRandom(100) < 30))
- {
- st.giveItems(SOULPIECEAIR, 1);
- if (st.getQuestItemsCount(SOULPIECEAIR) >= 6)
- {
- st.setCond(st.getCond() + 1, true);
- }
- else
- {
- st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
- }
- }
- break;
- case WATER:
- if (((st.getCond() >= 3) || (st.getCond() <= 5)) && (st.getItemEquipped(Inventory.PAPERDOLL_RHAND) == YINSWORD) && (st.getQuestItemsCount(SOULPIECEWATER) < 6) && (getRandom(100) < 30))
- {
- st.giveItems(SOULPIECEWATER, 1);
- if (st.getQuestItemsCount(SOULPIECEWATER) >= 6)
- {
- st.setCond(st.getCond() + 1, true);
- }
- else
- {
- st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
- }
- }
- break;
- }
- return null;
-
- }
-
- @Override
- public String onTalk(L2Npc npc, L2PcInstance player)
- {
- String htmltext = getNoQuestMsg(player);
- final QuestState st = getQuestState(player, true);
- if (st == null)
- {
- return htmltext;
- }
-
- switch (npc.getId())
- {
- case HOLLY:
- {
- switch (st.getState())
- {
- case State.CREATED:
- htmltext = (player.getLevel() > 75) ? "30839-01.htm" : "30839-00.html";
- break;
- case State.STARTED:
- switch (st.getCond())
- {
- case 1:
- htmltext = "30839-03.html";
- break;
- case 2:
- htmltext = "30839-05.html";
- break;
- }
- break;
- case State.COMPLETED:
- htmltext = "30839-0a.html";
- break;
- }
- break;
- }
- case WEBER:
- {
- switch (st.getState())
- {
- case State.CREATED:
- htmltext = (player.getLevel() > 75) ? "31307-01.htm" : "31307-00.html";
- break;
- case State.STARTED:
- switch (st.getCond())
- {
- case 1:
- htmltext = "31307-03.html";
- break;
- case 7:
- htmltext = "31307-05.html";
- break;
- }
- break;
- case State.COMPLETED:
- htmltext = "31307-0a.html";
- break;
- }
- break;
- }
- case YIN:
- {
- if (st.isStarted())
- {
- switch (st.getCond())
- {
- case 2:
- htmltext = "32325-01.html";
- break;
- case 3:
- case 5:
- htmltext = "32325-04.html";
- break;
- case 4:
- htmltext = "32325-08.html";
- st.takeItems(YINSWORD, 1);
- st.takeItems(SOULPIECEWATER, -1);
- break;
- case 6:
- htmltext = "32325-10.html";
- break;
- }
- }
- break;
- }
- case YANG:
- {
- if (st.isStarted())
- {
- switch (st.getCond())
- {
- case 7:
- htmltext = "32326-01.html";
- break;
- case 8:
- case 10:
- htmltext = "32326-04.html";
- break;
- case 9:
- htmltext = "32326-08.html";
- st.takeItems(YANGSWORD, 1);
- st.takeItems(SOULPIECEAIR, -1);
- break;
- case 11:
- htmltext = "32326-10.html";
- break;
- }
- }
- break;
- }
- }
- return htmltext;
- }
- }
|