123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639 |
- /*
- * 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.Q00223_TestOfTheChampion;
- 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.base.ClassId;
- import com.l2jserver.gameserver.model.quest.Quest;
- import com.l2jserver.gameserver.model.quest.QuestState;
- import com.l2jserver.gameserver.network.serverpackets.SocialAction;
- import com.l2jserver.gameserver.util.Util;
- /**
- * Test Of The Champion (223)
- * @author ivantotov
- */
- public final class Q00223_TestOfTheChampion extends Quest
- {
- // NPCs
- private static final int TRADER_GROOT = 30093;
- private static final int CAPTAIN_MOUEN = 30196;
- private static final int VETERAN_ASCALON = 30624;
- private static final int MASON = 30625;
- // Items
- private static final int ASCALONS_1ST_LETTER = 3277;
- private static final int MASONS_LETTER = 3278;
- private static final int IRON_ROSE_RING = 3279;
- private static final int ASCALONS_2ND_LETTER = 3280;
- private static final int WHITE_ROSE_INSIGNIA = 3281;
- private static final int GROOTS_LETTER = 3282;
- private static final int ASCALONS_3RD_LETTER = 3283;
- private static final int MOUENS_1ST_ORDER = 3284;
- private static final int MOUENS_2ND_ORDER = 3285;
- private static final int MOUENS_LETTER = 3286;
- private static final int HARPYS_EGG = 3287;
- private static final int MEDUSA_VENOM = 3288;
- private static final int WINDSUS_BILE = 3289;
- private static final int BLOODY_AXE_HEAD = 3290;
- private static final int ROAD_RATMAN_HEAD = 3291;
- private static final int LETO_LIZARDMAN_FANG = 3292;
- // Reward
- private static final int MARK_OF_CHAMPION = 3276;
- private static final int DIMENSIONAL_DIAMOND = 7562;
- // Monster
- private static final int HARPY = 20145;
- private static final int MEDUSA = 20158;
- private static final int ROAD_SCAVENGER = 20551;
- private static final int WINDSUS = 20553;
- private static final int LETO_LIZARDMAN = 20577;
- private static final int LETO_LIZARDMAN_ARCHER = 20578;
- private static final int LETO_LIZARDMAN_SOLDIER = 20579;
- private static final int LETO_LIZARDMAN_WARRIOR = 20580;
- private static final int LETO_LIZARDMAN_SHAMAN = 20581;
- private static final int LETO_LIZARDMAN_OCERLORD = 20582;
- private static final int BLOODY_AXE_ELITE = 20780;
- // Quest Monster
- private static final int HARPY_MATRIARCH = 27088;
- private static final int ROAD_COLLECTOR = 27089;
- // Misc
- private static final int MIN_LEVEL = 39;
-
- public Q00223_TestOfTheChampion()
- {
- super(223, Q00223_TestOfTheChampion.class.getSimpleName(), "Test Of The Champion");
- addStartNpc(VETERAN_ASCALON);
- addTalkId(VETERAN_ASCALON, TRADER_GROOT, CAPTAIN_MOUEN, MASON);
- addKillId(HARPY, MEDUSA, WINDSUS, ROAD_SCAVENGER, LETO_LIZARDMAN, LETO_LIZARDMAN_ARCHER, LETO_LIZARDMAN_SOLDIER, LETO_LIZARDMAN_WARRIOR, LETO_LIZARDMAN_SHAMAN, LETO_LIZARDMAN_OCERLORD, BLOODY_AXE_ELITE, HARPY_MATRIARCH, ROAD_COLLECTOR);
- addAttackId(HARPY, ROAD_SCAVENGER, BLOODY_AXE_ELITE);
- registerQuestItems(ASCALONS_1ST_LETTER, MASONS_LETTER, IRON_ROSE_RING, ASCALONS_2ND_LETTER, WHITE_ROSE_INSIGNIA, GROOTS_LETTER, ASCALONS_3RD_LETTER, MOUENS_1ST_ORDER, MOUENS_2ND_ORDER, MOUENS_LETTER, HARPYS_EGG, MEDUSA_VENOM, WINDSUS_BILE, BLOODY_AXE_HEAD, ROAD_RATMAN_HEAD, LETO_LIZARDMAN_FANG);
- }
-
- @Override
- public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
- {
- final QuestState qs = getQuestState(player, false);
- if (qs == null)
- {
- return null;
- }
-
- String htmltext = null;
- switch (event)
- {
- case "ACCEPT":
- {
- if (qs.isCreated())
- {
- qs.startQuest();
- playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
- giveItems(player, ASCALONS_1ST_LETTER, 1);
- if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0)
- {
- if (player.getClassId() == ClassId.warrior)
- {
- giveItems(player, DIMENSIONAL_DIAMOND, 72);
- }
- else
- {
- giveItems(player, DIMENSIONAL_DIAMOND, 64);
- }
- player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1);
- htmltext = "30624-06a.htm";
- }
- else
- {
- htmltext = "30624-06.htm";
- }
- }
- break;
- }
- case "30624-05.htm":
- case "30196-02.html":
- case "30625-02.html":
- {
- htmltext = event;
- break;
- }
- case "30624-10.html":
- {
- if (hasQuestItems(player, MASONS_LETTER))
- {
- takeItems(player, MASONS_LETTER, 1);
- giveItems(player, ASCALONS_2ND_LETTER, 1);
- qs.setCond(5, true);
- htmltext = event;
- }
- break;
- }
- case "30624-14.html":
- {
- if (hasQuestItems(player, GROOTS_LETTER))
- {
- takeItems(player, GROOTS_LETTER, 1);
- giveItems(player, ASCALONS_3RD_LETTER, 1);
- qs.setCond(9, true);
- htmltext = event;
- }
- break;
- }
- case "30093-02.html":
- {
- if (hasQuestItems(player, ASCALONS_2ND_LETTER))
- {
- takeItems(player, ASCALONS_2ND_LETTER, 1);
- giveItems(player, WHITE_ROSE_INSIGNIA, 1);
- qs.setCond(6, true);
- htmltext = event;
- }
- break;
- }
- case "30196-03.html":
- {
- if (hasQuestItems(player, ASCALONS_3RD_LETTER))
- {
- takeItems(player, ASCALONS_3RD_LETTER, 1);
- giveItems(player, MOUENS_1ST_ORDER, 1);
- qs.setCond(10, true);
- htmltext = event;
- }
- break;
- }
- case "30196-06.html":
- {
- if (getQuestItemsCount(player, ROAD_RATMAN_HEAD) >= 10)
- {
- takeItems(player, MOUENS_1ST_ORDER, 1);
- giveItems(player, MOUENS_2ND_ORDER, 1);
- takeItems(player, ROAD_RATMAN_HEAD, -1);
- qs.setCond(12, true);
- htmltext = event;
- }
- break;
- }
- case "30625-03.html":
- {
- if (hasQuestItems(player, ASCALONS_1ST_LETTER))
- {
- takeItems(player, ASCALONS_1ST_LETTER, 1);
- giveItems(player, IRON_ROSE_RING, 1);
- qs.setCond(2, true);
- htmltext = event;
- }
- break;
- }
- }
- return htmltext;
- }
-
- @Override
- public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
- {
- final QuestState qs = getQuestState(attacker, false);
- if ((qs != null) && qs.isStarted())
- {
- switch (npc.getId())
- {
- case HARPY:
- {
- switch (npc.getScriptValue())
- {
- case 0:
- {
- npc.getVariables().set("lastAttacker", attacker.getObjectId());
- if (hasQuestItems(attacker, WHITE_ROSE_INSIGNIA) && (getQuestItemsCount(attacker, HARPYS_EGG) < 30))
- {
- if (getRandomBoolean())
- {
- if (getRandom(10) < 7)
- {
- addAttackPlayerDesire(addSpawn(HARPY_MATRIARCH, npc, true, 0, false), attacker);
- }
- else
- {
- addAttackPlayerDesire(addSpawn(HARPY_MATRIARCH, npc, true, 0, false), attacker);
- addAttackPlayerDesire(addSpawn(HARPY_MATRIARCH, npc, true, 0, false), attacker);
- }
- }
- }
- npc.setScriptValue(1);
- break;
- }
- case 1:
- {
- npc.setScriptValue(2);
- break;
- }
- }
- break;
- }
- case ROAD_SCAVENGER:
- {
- switch (npc.getScriptValue())
- {
- case 0:
- {
- npc.getVariables().set("lastAttacker", attacker.getObjectId());
- if (hasQuestItems(attacker, MOUENS_1ST_ORDER) && (getQuestItemsCount(attacker, ROAD_RATMAN_HEAD) < 10))
- {
- if (getRandomBoolean())
- {
- if (getRandom(10) < 7)
- {
- addAttackPlayerDesire(addSpawn(ROAD_COLLECTOR, npc, true, 0, false), attacker);
- }
- else
- {
- addAttackPlayerDesire(addSpawn(ROAD_COLLECTOR, npc, true, 0, false), attacker);
- addAttackPlayerDesire(addSpawn(ROAD_COLLECTOR, npc, true, 0, false), attacker);
- }
- }
- }
- npc.setScriptValue(1);
- break;
- }
- case 1:
- {
- npc.setScriptValue(2);
- break;
- }
- }
- break;
- }
- case BLOODY_AXE_ELITE:
- {
- switch (npc.getScriptValue())
- {
- case 0:
- {
- npc.getVariables().set("lastAttacker", attacker.getObjectId());
- if (hasQuestItems(attacker, IRON_ROSE_RING) && (getQuestItemsCount(attacker, BLOODY_AXE_HEAD) < 10))
- {
- if (getRandomBoolean())
- {
- addAttackPlayerDesire(addSpawn(BLOODY_AXE_ELITE, npc, true, 0, false), attacker);
- }
- }
- npc.setScriptValue(1);
- break;
- }
- case 1:
- {
- npc.setScriptValue(2);
- break;
- }
- }
- break;
- }
- }
- }
- return super.onAttack(npc, attacker, damage, isSummon);
- }
-
- @Override
- public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
- {
- final QuestState qs = getQuestState(killer, false);
- if ((qs != null) && qs.isStarted() && Util.checkIfInRange(1500, npc, killer, true))
- {
- switch (npc.getId())
- {
- case HARPY:
- case HARPY_MATRIARCH:
- {
- if (hasQuestItems(killer, WHITE_ROSE_INSIGNIA) && (getQuestItemsCount(killer, HARPYS_EGG) < 30))
- {
- if (getQuestItemsCount(killer, HARPYS_EGG) >= 28)
- {
- giveItems(killer, HARPYS_EGG, 2);
- playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE);
- if ((getQuestItemsCount(killer, MEDUSA_VENOM) >= 30) && (getQuestItemsCount(killer, WINDSUS_BILE) >= 30))
- {
- qs.setCond(7);
- }
- }
- else
- {
- giveItems(killer, HARPYS_EGG, 2);
- playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
- }
- }
- break;
- }
- case MEDUSA:
- {
- if (hasQuestItems(killer, WHITE_ROSE_INSIGNIA) && (getQuestItemsCount(killer, MEDUSA_VENOM) < 30))
- {
- if (getQuestItemsCount(killer, MEDUSA_VENOM) >= 27)
- {
- giveItems(killer, MEDUSA_VENOM, 3);
- playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE);
- if ((getQuestItemsCount(killer, HARPYS_EGG) >= 30) && (getQuestItemsCount(killer, WINDSUS_BILE) >= 30))
- {
- qs.setCond(7);
- }
- }
- else
- {
- giveItems(killer, MEDUSA_VENOM, 3);
- playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
- }
- }
- break;
- }
- case WINDSUS:
- {
- if (hasQuestItems(killer, WHITE_ROSE_INSIGNIA) && (getQuestItemsCount(killer, WINDSUS_BILE) < 30))
- {
- if (getQuestItemsCount(killer, WINDSUS_BILE) >= 27)
- {
- giveItems(killer, WINDSUS_BILE, 3);
- playSound(killer, QuestSound.ITEMSOUND_QUEST_MIDDLE);
- if ((getQuestItemsCount(killer, HARPYS_EGG) >= 30) && (getQuestItemsCount(killer, MEDUSA_VENOM) >= 30))
- {
- qs.setCond(7);
- }
- }
- else
- {
- giveItems(killer, WINDSUS_BILE, 3);
- playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
- }
- }
- break;
- }
- case ROAD_SCAVENGER:
- case ROAD_COLLECTOR:
- {
- if (hasQuestItems(killer, MOUENS_1ST_ORDER) && (getQuestItemsCount(killer, ROAD_RATMAN_HEAD) < 10))
- {
- if (getQuestItemsCount(killer, ROAD_RATMAN_HEAD) >= 9)
- {
- giveItems(killer, ROAD_RATMAN_HEAD, 1);
- qs.setCond(11, true);
- }
- else
- {
- giveItems(killer, ROAD_RATMAN_HEAD, 1);
- playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
- }
- }
- break;
- }
- case LETO_LIZARDMAN:
- case LETO_LIZARDMAN_ARCHER:
- case LETO_LIZARDMAN_SOLDIER:
- case LETO_LIZARDMAN_WARRIOR:
- case LETO_LIZARDMAN_SHAMAN:
- case LETO_LIZARDMAN_OCERLORD:
- {
- if (hasQuestItems(killer, MOUENS_2ND_ORDER) && (getQuestItemsCount(killer, LETO_LIZARDMAN_FANG) < 10))
- {
- if (getQuestItemsCount(killer, LETO_LIZARDMAN_FANG) >= 9)
- {
- giveItems(killer, LETO_LIZARDMAN_FANG, 1);
- qs.setCond(13, true);
- }
- else
- {
- giveItems(killer, LETO_LIZARDMAN_FANG, 1);
- playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
- }
- }
- break;
- }
- case BLOODY_AXE_ELITE:
- {
- if (hasQuestItems(killer, IRON_ROSE_RING) && (getQuestItemsCount(killer, BLOODY_AXE_HEAD) < 10))
- {
- if (getQuestItemsCount(killer, BLOODY_AXE_HEAD) >= 9)
- {
- giveItems(killer, BLOODY_AXE_HEAD, 1);
- qs.setCond(3, true);
- }
- else
- {
- giveItems(killer, BLOODY_AXE_HEAD, 1);
- playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
- }
- }
- break;
- }
- }
- }
- return super.onKill(npc, killer, isSummon);
- }
-
- @Override
- public String onTalk(L2Npc npc, L2PcInstance player)
- {
- final QuestState qs = getQuestState(player, true);
- String htmltext = getNoQuestMsg(player);
- if (qs.isCreated())
- {
- if (npc.getId() == VETERAN_ASCALON)
- {
- if ((player.getClassId() == ClassId.warrior) || (player.getClassId() == ClassId.orcRaider))
- {
- if (player.getLevel() >= MIN_LEVEL)
- {
- if (player.getClassId() == ClassId.warrior)
- {
- htmltext = "30624-03.htm";
- }
- else
- {
- htmltext = "30624-04.html";
- }
- }
- else
- {
- htmltext = "30624-01.html";
- }
- }
- else
- {
- htmltext = "30624-02.html";
- }
- }
- }
- else if (qs.isStarted())
- {
- switch (npc.getId())
- {
- case VETERAN_ASCALON:
- {
- if (hasQuestItems(player, ASCALONS_1ST_LETTER))
- {
- htmltext = "30624-07.html";
- }
- else if (hasQuestItems(player, IRON_ROSE_RING))
- {
- htmltext = "30624-08.html";
- }
- else if (hasQuestItems(player, MASONS_LETTER))
- {
- htmltext = "30624-09.html";
- }
- else if (hasQuestItems(player, ASCALONS_2ND_LETTER))
- {
- htmltext = "30624-11.html";
- }
- else if (hasQuestItems(player, WHITE_ROSE_INSIGNIA))
- {
- htmltext = "30624-12.html";
- }
- else if (hasQuestItems(player, GROOTS_LETTER))
- {
- htmltext = "30624-13.html";
- }
- else if (hasQuestItems(player, ASCALONS_3RD_LETTER))
- {
- htmltext = "30624-15.html";
- }
- else if (hasAtLeastOneQuestItem(player, MOUENS_1ST_ORDER, MOUENS_2ND_ORDER))
- {
- htmltext = "30624-16.html";
- }
- else if (hasQuestItems(player, MOUENS_LETTER))
- {
- giveAdena(player, 229764, true);
- giveItems(player, MARK_OF_CHAMPION, 1);
- addExpAndSp(player, 1270742, 87200);
- qs.exitQuest(false, true);
- player.sendPacket(new SocialAction(player.getObjectId(), 3));
- htmltext = "30624-17.html";
- }
- break;
- }
- case TRADER_GROOT:
- {
- if (hasQuestItems(player, ASCALONS_2ND_LETTER))
- {
- htmltext = "30093-01.html";
- }
- else if (hasQuestItems(player, WHITE_ROSE_INSIGNIA))
- {
- if ((getQuestItemsCount(player, HARPYS_EGG) >= 30) && (getQuestItemsCount(player, MEDUSA_VENOM) >= 30) && (getQuestItemsCount(player, WINDSUS_BILE) >= 30))
- {
- takeItems(player, WHITE_ROSE_INSIGNIA, 1);
- giveItems(player, GROOTS_LETTER, 1);
- takeItems(player, HARPYS_EGG, -1);
- takeItems(player, MEDUSA_VENOM, -1);
- takeItems(player, WINDSUS_BILE, -1);
- qs.setCond(8, true);
- htmltext = "30093-04.html";
- }
- else
- {
- htmltext = "30093-03.html";
- }
- }
- else if (hasQuestItems(player, GROOTS_LETTER))
- {
- htmltext = "30093-05.html";
- }
- else if (hasAtLeastOneQuestItem(player, ASCALONS_3RD_LETTER, MOUENS_1ST_ORDER, MOUENS_2ND_ORDER, MOUENS_LETTER))
- {
- htmltext = "30093-06.html";
- }
- break;
- }
- case CAPTAIN_MOUEN:
- {
- if (hasQuestItems(player, ASCALONS_3RD_LETTER))
- {
- htmltext = "30196-01.html";
- }
- else if (hasQuestItems(player, MOUENS_1ST_ORDER))
- {
- if (getQuestItemsCount(player, ROAD_RATMAN_HEAD) < 10)
- {
- htmltext = "30196-04.html";
- }
- else
- {
- htmltext = "30196-05.html";
- }
- }
- else if (hasQuestItems(player, MOUENS_2ND_ORDER))
- {
- if (getQuestItemsCount(player, LETO_LIZARDMAN_FANG) < 10)
- {
- htmltext = "30196-07.html";
- }
- else
- {
- takeItems(player, MOUENS_2ND_ORDER, 1);
- giveItems(player, MOUENS_LETTER, 1);
- takeItems(player, LETO_LIZARDMAN_FANG, -1);
- qs.setCond(14, true);
- htmltext = "30196-08.html";
- }
- }
- else if (hasQuestItems(player, MOUENS_LETTER))
- {
- htmltext = "30196-09.html";
- }
- break;
- }
- case MASON:
- {
- if (hasQuestItems(player, ASCALONS_1ST_LETTER))
- {
- htmltext = "30625-01.html";
- }
- else if (hasQuestItems(player, IRON_ROSE_RING))
- {
- if (getQuestItemsCount(player, BLOODY_AXE_HEAD) < 10)
- {
- htmltext = "30625-04.html";
- }
- else
- {
- giveItems(player, MASONS_LETTER, 1);
- takeItems(player, IRON_ROSE_RING, 1);
- takeItems(player, BLOODY_AXE_HEAD, -1);
- qs.setCond(4, true);
- htmltext = "30625-05.html";
- }
- }
- else if (hasQuestItems(player, MASONS_LETTER))
- {
- htmltext = "30625-06.html";
- }
- else if (hasAtLeastOneQuestItem(player, ASCALONS_2ND_LETTER, WHITE_ROSE_INSIGNIA, GROOTS_LETTER, ASCALONS_3RD_LETTER, MOUENS_1ST_ORDER, MOUENS_2ND_ORDER, MOUENS_LETTER))
- {
- htmltext = "30625-07.html";
- }
- break;
- }
- }
- }
- else if (qs.isCompleted())
- {
- if (npc.getId() == VETERAN_ASCALON)
- {
- htmltext = getAlreadyCompletedMsg(player);
- }
- }
- return htmltext;
- }
- }
|