From 5f8f6df5f67e1e22f1cce19d23aa06ef30202935 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 12 Apr 2016 08:29:37 +0000 Subject: [PATCH] Reworked Quest The Man Of Mystery (10791). Contributed by gigilo1968. --- trunk/dist/game/data/scripts.cfg | 1 + .../ai/npc/KainVanHalter/33993-01.html | 4 + .../scripts/ai/npc/KainVanHalter/33993.html | 6 + .../ai/npc/KainVanHalter/KainVanHalter.java | 114 ++++++++++++ .../Q10791_TheManOfMystery/33847-01.htm | 2 +- .../Q10791_TheManOfMystery/33847-03.htm | 3 +- .../Q10791_TheManOfMystery/33847-07.html | 2 +- .../Q10791_TheManOfMystery.java | 171 +++++++++--------- .../Q10791_TheManOfMystery/noErtheia.html | 2 +- .../Q10791_TheManOfMystery/no_level.html | 5 +- .../Q10791_TheManOfMystery/no_quest.html | 4 +- .../Q10791_TheManOfMystery/restriction.html | 3 + 12 files changed, 218 insertions(+), 99 deletions(-) create mode 100644 trunk/dist/game/data/scripts/ai/npc/KainVanHalter/33993-01.html create mode 100644 trunk/dist/game/data/scripts/ai/npc/KainVanHalter/33993.html create mode 100644 trunk/dist/game/data/scripts/ai/npc/KainVanHalter/KainVanHalter.java create mode 100644 trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/restriction.html diff --git a/trunk/dist/game/data/scripts.cfg b/trunk/dist/game/data/scripts.cfg index de470f40b8..84a93035c0 100644 --- a/trunk/dist/game/data/scripts.cfg +++ b/trunk/dist/game/data/scripts.cfg @@ -42,6 +42,7 @@ ai/npc/FortressSiegeManager/FortressSiegeManager.java ai/npc/FreyasSteward/FreyasSteward.java ai/npc/Hardin/Hardin.java ai/npc/Jinia/Jinia.java +ai/npc/KainVanHalter/KainVanHalter.java ai/npc/KetraOrcSupport/KetraOrcSupport.java ai/npc/LaVieEnRose/LaVieEnRose.java ai/npc/Mammons/Mammons.java diff --git a/trunk/dist/game/data/scripts/ai/npc/KainVanHalter/33993-01.html b/trunk/dist/game/data/scripts/ai/npc/KainVanHalter/33993-01.html new file mode 100644 index 0000000000..1dc0e6d63d --- /dev/null +++ b/trunk/dist/game/data/scripts/ai/npc/KainVanHalter/33993-01.html @@ -0,0 +1,4 @@ +Kain:
+You aren't strong enough to be out here alone.
+I stopped by because someone was having trouble with Stakato. How funny it's another Ertheia.
+ \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/ai/npc/KainVanHalter/33993.html b/trunk/dist/game/data/scripts/ai/npc/KainVanHalter/33993.html new file mode 100644 index 0000000000..e3689cd610 --- /dev/null +++ b/trunk/dist/game/data/scripts/ai/npc/KainVanHalter/33993.html @@ -0,0 +1,6 @@ +Kain:
+What are Stakatos doing here?
+Huh? You're Ertheia. Faeron must be stable enough for you to leave town, eh?
+But what are you doing here? Did Stakatos attack you?
+ + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/ai/npc/KainVanHalter/KainVanHalter.java b/trunk/dist/game/data/scripts/ai/npc/KainVanHalter/KainVanHalter.java new file mode 100644 index 0000000000..31fc433e9f --- /dev/null +++ b/trunk/dist/game/data/scripts/ai/npc/KainVanHalter/KainVanHalter.java @@ -0,0 +1,114 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program 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. + * + * This program 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 . + */ +package ai.npc.KainVanHalter; + +import com.l2jmobius.gameserver.ai.CtrlIntention; +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.L2Object; +import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.actor.instance.L2QuestGuardInstance; +import com.l2jmobius.gameserver.model.quest.QuestState; + +import ai.npc.AbstractNpcAI; +import quests.Q10791_TheManOfMystery.Q10791_TheManOfMystery; + +/** + * Kain Ven Halter AI + * @author Gigi and + */ +final class KainVanHalter extends AbstractNpcAI +{ + // NPC + private static final int KAIN_VAN_HALTER = 33993; + // Monster + private static final int NEEDLE_STAKATO_CAPTAIN = 27542; + private static final int NEEDLE_STAKATO = 27543; + + private KainVanHalter() + { + super(KainVanHalter.class.getSimpleName(), "ai/npc"); + addStartNpc(KAIN_VAN_HALTER); + addFirstTalkId(KAIN_VAN_HALTER); + addTalkId(KAIN_VAN_HALTER); + addSeeCreatureId(KAIN_VAN_HALTER); + } + + @Override + public String onFirstTalk(L2Npc npc, L2PcInstance player) + { + final QuestState qs = player.getQuestState(Q10791_TheManOfMystery.class.getSimpleName()); + if ((qs != null) && (player.getRace() == Race.ERTHEIA)) + { + return "33993.html"; + } + return super.onFirstTalk(npc, player); + } + + @Override + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) + { + if ("thank".equals(event)) + { + npc.deleteMe(); + return "33993-01.html"; + } + + if (npc instanceof L2QuestGuardInstance) + { + final L2QuestGuardInstance kain = (L2QuestGuardInstance) npc; + + //@formatter:off + final L2Npc stacato = (L2Npc) kain.getKnownList().getKnownCharactersInRadius(150) + .stream() + .filter(L2Object::isMonster) + .filter(obj -> ((obj.getId() == NEEDLE_STAKATO_CAPTAIN) || (obj.getId() == NEEDLE_STAKATO))) + .findFirst() + .orElse(null); + //@formatter:on + + if (stacato != null) + { + addAttackDesire(kain, stacato); + kain.setCanStopAttackByTime(false); + kain.setCanReturnToSpawnPoint(false); + kain.setIsInvul(true); + } + else + { + startQuestTimer("START_ATTACK", 250, npc, null); + } + } + return super.onAdvEvent(event, npc, player); + } + + @Override + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) + { + if (creature.isPlayer() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK)) + { + startQuestTimer("START_ATTACK", 1000, npc, null); + } + return super.onSeeCreature(npc, creature, isSummon); + } + + public static void main(String[] args) + { + new KainVanHalter(); + } +} \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/33847-01.htm b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/33847-01.htm index a91037c5b3..2ca1b9ad51 100644 --- a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/33847-01.htm +++ b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/33847-01.htm @@ -1,4 +1,4 @@ Tracker Dokara:
Wait! I thought if we felled that many Stakatos it'd be enough, but there's more of them. We'll need to find a better solution to this.
- + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/33847-03.htm b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/33847-03.htm index afe85c38dc..aa62ea020f 100644 --- a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/33847-03.htm +++ b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/33847-03.htm @@ -1,6 +1,5 @@ Tracker Dokara:
-A cocoon? No!
-Are all these Stakatos being born out of cocoons? Wait, it sounds plausible. This means we need to get rid of more than just the Stakatos!
+A cocoon? No!
Are all these Stakatos being born out of cocoons? Wait, it sounds plausible. This means we need to get rid of more than just the Stakatos!
I need your help again, in that case.
\ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/33847-07.html b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/33847-07.html index b709f82e7f..8130a38402 100644 --- a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/33847-07.html +++ b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/33847-07.html @@ -1,4 +1,4 @@ -Tracker Dokara:
+html>Tracker Dokara:
So, this Kain has appeared and helped you again? Pa'agrio always shows the way to outstanding warriors.
Anyway, we know that those Suspicious Cocoons are the root of our problems, and you've gotten rid of a high number of them, so there's no longer a need to worry. Of course, this Kain fellow helped you, but to me, the outcome is all the same.
Thank you for your help. diff --git a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/Q10791_TheManOfMystery.java b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/Q10791_TheManOfMystery.java index aef7278a25..b65c697b2e 100644 --- a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/Q10791_TheManOfMystery.java +++ b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/Q10791_TheManOfMystery.java @@ -16,8 +16,7 @@ */ package quests.Q10791_TheManOfMystery; -import quests.Q10790_AMercenaryHelper.Q10790_AMercenaryHelper; - +import com.l2jmobius.gameserver.enums.QuestSound; import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -25,57 +24,60 @@ import com.l2jmobius.gameserver.model.base.ClassId; import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.quest.Quest; import com.l2jmobius.gameserver.model.quest.QuestState; -import com.l2jmobius.gameserver.model.quest.State; import com.l2jmobius.gameserver.network.serverpackets.ExQuestNpcLogList; +import com.l2jmobius.gameserver.util.Util; + +import quests.Q10790_AMercenaryHelper.Q10790_AMercenaryHelper; /** - * The Man of Mystery (10791) - * @author Stayway + * The Man Of Mystery (10791) + * @URL https://l2wiki.com/The_Man_of_Mystery + * @author Stayway reworked Gigi */ public class Q10791_TheManOfMystery extends Quest { - // NPC + // NPCs private static final int DOKARA = 33847; - private static final int VAN_HALTER = 33993; - // Monsters + private static final int KAIN_VAN_HALTER = 33993; + // Monster private static final int SUSPICIOUS_COCOON = 27536; private static final int SUSPICIOUS_COCOON1 = 27537; private static final int SUSPICIOUS_COCOON2 = 27538; private static final int NEEDLE_STAKATO_CAPTAIN = 27542; private static final int NEEDLE_STAKATO = 27543; - // Item - private static final ItemHolder GUILD_COIN = new ItemHolder(37045, 63); - private static final ItemHolder ENCHANT_ARMOR_A = new ItemHolder(26351, 5); - // Rewards + // Items + private static final ItemHolder STEEL_DOOR_GUILD = new ItemHolder(37045, 63); + private static final ItemHolder EAA = new ItemHolder(730, 2); + // Reward private static final int EXP_REWARD = 16968420; private static final int SP_REWARD = 4072; - // Other + // Misc private static final int MIN_LEVEL = 65; private static final int MAX_LEVEL = 70; - private static final String KILL_VAR = "KillCount"; public Q10791_TheManOfMystery() { - super(10791, Q10791_TheManOfMystery.class.getSimpleName(), "The Man of Mystery"); + super(10791, Q10791_TheManOfMystery.class.getSimpleName(), "The Man Of Mystery"); addStartNpc(DOKARA); - addTalkId(DOKARA, VAN_HALTER); - addKillId(SUSPICIOUS_COCOON, SUSPICIOUS_COCOON1, SUSPICIOUS_COCOON2, NEEDLE_STAKATO_CAPTAIN, NEEDLE_STAKATO); - addFirstTalkId(VAN_HALTER); + addTalkId(DOKARA); + addKillId(SUSPICIOUS_COCOON, SUSPICIOUS_COCOON1, SUSPICIOUS_COCOON2, NEEDLE_STAKATO_CAPTAIN); + addAttackId(NEEDLE_STAKATO_CAPTAIN); + addCondLevel(MIN_LEVEL, MAX_LEVEL, "no_level.html"); addCondRace(Race.ERTHEIA, "noErtheia.html"); - addCondClassId(ClassId.MARAUDER, "no_class.html"); - addCondCompletedQuest(Q10790_AMercenaryHelper.class.getSimpleName(), "no_quest.html"); + addCondClassId(ClassId.MARAUDER, "no_quest.html"); + addCondCompletedQuest(Q10790_AMercenaryHelper.class.getSimpleName(), "restriction.html"); } @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { + String htmltext = event; final QuestState qs = getQuestState(player, false); if (qs == null) { - return null; + return getNoQuestMsg(player); } - String htmltext = null; switch (event) { case "33847-02.htm": @@ -84,10 +86,11 @@ public class Q10791_TheManOfMystery extends Quest htmltext = event; break; } - case "33847-04.htm": // start the quest + case "33847-04.htm": { qs.startQuest(); qs.set(Integer.toString(SUSPICIOUS_COCOON), 0); + qs.set(Integer.toString(NEEDLE_STAKATO_CAPTAIN), 0); htmltext = event; break; } @@ -95,13 +98,13 @@ public class Q10791_TheManOfMystery extends Quest { if (qs.isCond(3)) { - giveItems(player, GUILD_COIN); - giveItems(player, ENCHANT_ARMOR_A); addExpAndSp(player, EXP_REWARD, SP_REWARD); + giveItems(player, STEEL_DOOR_GUILD); + giveItems(player, EAA); qs.exitQuest(false, true); htmltext = event; + break; } - break; } } return htmltext; @@ -111,73 +114,56 @@ public class Q10791_TheManOfMystery extends Quest public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); - String htmltext = null; - final int npcId = npc.getId(); - switch (qs.getState()) + String htmltext = getNoQuestMsg(player); + + if (qs.isCreated()) { - case State.CREATED: + htmltext = "33847-01.htm"; + } + else if (qs.isStarted()) + { + if ((qs.getCond() > 0) && (qs.getCond() < 3)) { - if ((player.getLevel() < MIN_LEVEL) || (player.getLevel() > MAX_LEVEL)) - { - htmltext = "no_level.html"; - } - else - { - htmltext = "33847-01.htm"; - } - break; + htmltext = "33847-05.html"; } - case State.STARTED: + else if (qs.isCond(3)) { - if (qs.isCond(1)) - { - htmltext = "33847-05.html"; - } - else if ((qs.isCond(3) && (npcId == DOKARA))) - { - htmltext = "33847-06.html"; - } - else if ((qs.isCond(3) && (npcId == VAN_HALTER))) - { - htmltext = "33993-02.html"; - } - break; - } - case State.COMPLETED: - { - htmltext = getAlreadyCompletedMsg(player); - break; + htmltext = "33847-06.html"; } } + else if (qs.isCompleted()) + { + htmltext = getAlreadyCompletedMsg(player); + } + return htmltext; } @Override - public String onFirstTalk(L2Npc npc, L2PcInstance player) + public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { - final QuestState qs = getQuestState(player, true); - String htmltext = null; - - switch (npc.getId()) + if (npc.isScriptValue(0)) { - case VAN_HALTER: + for (int i = 0; i < 5; i++) { - if (qs.isCond(3)) - { - htmltext = "33993-01.html"; - } - break; + final L2Npc creature = addSpawn(NEEDLE_STAKATO, npc.getX() + getRandom(-20, 20), npc.getY() + getRandom(-20, 20), npc.getZ(), npc.getHeading(), true, 120000, false); + addAttackDesire(creature, attacker); } + for (int i1 = 0; i1 < 1; i1++) + { + L2Npc helper = addSpawn(KAIN_VAN_HALTER, npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ(), npc.getHeading(), true, 300000, false); + addAttackDesire(helper, npc); + } + npc.setScriptValue(1); } - return htmltext; + 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.isCond(1)) + final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); + if ((qs != null) && (qs.getCond() > 0) && (Util.checkIfInRange(1500, npc, qs.getPlayer(), false))) { switch (npc.getId()) { @@ -186,34 +172,41 @@ public class Q10791_TheManOfMystery extends Quest case SUSPICIOUS_COCOON2: { int kills = qs.getInt(Integer.toString(SUSPICIOUS_COCOON)); - kills++; - qs.set(Integer.toString(SUSPICIOUS_COCOON), kills); - final ExQuestNpcLogList log = new ExQuestNpcLogList(getId()); - log.addNpc(SUSPICIOUS_COCOON, kills); - killer.sendPacket(log); + if (kills < 5) + { + kills++; + qs.set(Integer.toString(SUSPICIOUS_COCOON), kills); + playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); + } if (kills >= 5) { + qs.unset(Integer.toString(SUSPICIOUS_COCOON)); + final L2Npc mob1 = addSpawn(NEEDLE_STAKATO_CAPTAIN, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), true, 600000, false); + addAttackDesire(mob1, qs.getPlayer()); qs.setCond(2); - addAttackDesire(addSpawn(NEEDLE_STAKATO_CAPTAIN, npc.getLocation()), killer); - addAttackDesire(addSpawn(NEEDLE_STAKATO, npc.getLocation()), killer); - addAttackDesire(addSpawn(NEEDLE_STAKATO, npc.getLocation()), killer); - addAttackDesire(addSpawn(NEEDLE_STAKATO, npc.getLocation()), killer); - addAttackDesire(addSpawn(NEEDLE_STAKATO, npc.getLocation()), killer); } + break; } - case NEEDLE_STAKATO_CAPTAIN: { - final int killCount = qs.getInt(KILL_VAR) + 1; - if ((killCount == 1) && (qs.isCond(2))) + int kills = qs.getInt(Integer.toString(NEEDLE_STAKATO_CAPTAIN)); + if ((kills < 1) && (qs.isCond(2))) { - qs.unset(Integer.toString(SUSPICIOUS_COCOON)); - addSpawn(VAN_HALTER, npc.getX() + 20, npc.getY() + 20, npc.getZ(), npc.getHeading(), false, 80000); - qs.setCond(3); + kills++; + qs.set(Integer.toString(NEEDLE_STAKATO_CAPTAIN), kills); + playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); + } + if (qs.getInt(Integer.toString(NEEDLE_STAKATO_CAPTAIN)) >= 1) + { + qs.setCond(3, true); } break; } } + final ExQuestNpcLogList log = new ExQuestNpcLogList(getId()); + log.addNpc(SUSPICIOUS_COCOON, qs.getInt(Integer.toString(SUSPICIOUS_COCOON))); + log.addNpc(NEEDLE_STAKATO_CAPTAIN, qs.getInt(Integer.toString(NEEDLE_STAKATO_CAPTAIN))); + qs.getPlayer().sendPacket(log); } return super.onKill(npc, killer, isSummon); } diff --git a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/noErtheia.html b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/noErtheia.html index 3a8b6aef06..9cf9d66a8d 100644 --- a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/noErtheia.html +++ b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/noErtheia.html @@ -1,3 +1,3 @@ -Vorbos:
+Tracker Dokara:
You are not Ertheia, this quest is not for you. \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/no_level.html b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/no_level.html index d3e0c67d22..cecbd2469a 100644 --- a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/no_level.html +++ b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/no_level.html @@ -1,3 +1,4 @@ -You don't meet level requirements
-(Quest available from level 65 to 70) +Tracker Dokara:
+You don't meet level requirements
+(Quest available from level 65 - 70) \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/no_quest.html b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/no_quest.html index 0c49613fb0..26b4e5a666 100644 --- a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/no_quest.html +++ b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/no_quest.html @@ -1,3 +1 @@ -You don't meet requirements
-(This quest is available for Ertheia Marauders who's completed quest A Mercenary helper. ) - \ No newline at end of file +You are not Marauder class, this quest is not for you. \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/restriction.html b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/restriction.html new file mode 100644 index 0000000000..09f4081ea4 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q10791_TheManOfMystery/restriction.html @@ -0,0 +1,3 @@ +Research Pio:
+(Quest only available to Ertheia characters Lv. 58-61 who have completed the quest "A Mercenary Helper.") + \ No newline at end of file