From 3a84a0ea9ca9ff686881e939d41efb1547d96832 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 22 Jul 2016 23:12:55 +0000 Subject: [PATCH] Quest Completely Lost (454). Contributed by gigilo1968. --- .../scripts/ai/group/SeedOfAnnihilation.java | 15 +- .../Q00454_CompletelyLost/32736-01.html | 4 + .../Q00454_CompletelyLost/32736-02.html | 4 + .../Q00454_CompletelyLost/32736-03.html | 3 + .../quests/Q00454_CompletelyLost/32738-01.htm | 5 + .../Q00454_CompletelyLost/32738-01a.htm | 4 + .../Q00454_CompletelyLost/32738-01b.htm | 4 + .../Q00454_CompletelyLost/32738-01c.htm | 4 + .../quests/Q00454_CompletelyLost/32738-02.htm | 4 + .../quests/Q00454_CompletelyLost/32738-03.htm | 4 + .../quests/Q00454_CompletelyLost/32738-04.htm | 7 + .../Q00454_CompletelyLost/32738-04a.htm | 4 + .../Q00454_CompletelyLost/32738-05.html | 7 + .../Q00454_CompletelyLost/32738-05a.html | 5 + .../Q00454_CompletelyLost/32738-06.html | 3 + .../Q00454_CompletelyLost/32738-07.html | 3 + .../Q00454_CompletelyLost/32738-08.html | 3 + .../Q00454_CompletelyLost.java | 789 ++++++++++++++++++ .../scripts/quests/QuestMasterHandler.java | 8 +- .../data/spawns/Gracia/SeedOfAnnihilation.xml | 5 + 20 files changed, 881 insertions(+), 4 deletions(-) create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32736-01.html create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32736-02.html create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32736-03.html create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01.htm create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01a.htm create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01b.htm create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01c.htm create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-02.htm create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-03.htm create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-04.htm create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-04a.htm create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-05.html create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-05a.html create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-06.html create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-07.html create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-08.html create mode 100644 trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java diff --git a/trunk/dist/game/data/scripts/ai/group/SeedOfAnnihilation.java b/trunk/dist/game/data/scripts/ai/group/SeedOfAnnihilation.java index 0813c74ab1..c8465fc6e5 100644 --- a/trunk/dist/game/data/scripts/ai/group/SeedOfAnnihilation.java +++ b/trunk/dist/game/data/scripts/ai/group/SeedOfAnnihilation.java @@ -21,8 +21,10 @@ import java.util.HashMap; import java.util.Map; import com.l2jmobius.commons.util.CommonUtil; +import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.instancemanager.ZoneManager; +import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Npc; @@ -40,7 +42,6 @@ import ai.AbstractNpcAI; public final class SeedOfAnnihilation extends AbstractNpcAI { private static final Map TELEPORT_ZONES = new HashMap<>(); - static { TELEPORT_ZONES.put(60002, new Location(-213175, 182648, -10992)); @@ -341,6 +342,18 @@ public final class SeedOfAnnihilation extends AbstractNpcAI if (TELEPORT_ZONES.containsKey(zone.getId())) { final Location teleLoc = TELEPORT_ZONES.get(zone.getId()); + // Conditions for Quest 454 + L2World.getInstance().forEachVisibleObject(character, L2Npc.class, 500, npc -> + { + if ((npc.getId() == 32738) && (npc.getTarget() != null)) + { + if (npc.getTarget().getObjectId() == character.getObjectId()) + { + npc.teleToLocation(teleLoc, false); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, character, 150); + } + } + }); character.teleToLocation(teleLoc, false); } return super.onEnterZone(character, zone); diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32736-01.html b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32736-01.html new file mode 100644 index 0000000000..e023beef51 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32736-01.html @@ -0,0 +1,4 @@ +General Ermian:
+What did you say?! You saw a wounded soldier still alive? You should have brought him here.
+We can't abandon our own here. Right now, it's our priority to save as many of the lost soldiers as possible and bring them back. If you see any, lead them here. Trust me, I'll make it worth the trouble. + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32736-02.html b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32736-02.html new file mode 100644 index 0000000000..01017d021e --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32736-02.html @@ -0,0 +1,4 @@ +General Ermian:
+You found him wandering the Seed? It's a miracle he's still alive!
+You truly saved his life. Allow me to thank you... here. You deserve more for what you've done but for now, this is all I have to give. + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32736-03.html b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32736-03.html new file mode 100644 index 0000000000..f7e62c76e3 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32736-03.html @@ -0,0 +1,3 @@ +General Ermian:
+I can't thank you enough! In this world, there are too few men and women who would answer the call to help someone the way you just did, and even fewer who would be able to in this nightmarish place. Rest up. You've earned it! + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01.htm b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01.htm new file mode 100644 index 0000000000..09777a4ce2 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01.htm @@ -0,0 +1,5 @@ +Injured Soldier:
+The last thing I remember is jumping from a sinking airship. Then as I was about to be attacked by the monsters of the Seed, I blanked out. I can only remember bits and pieces of what happened, and it's all so terrifying.
+When I regained consciousness, I was here. I... don't want to be here anymore. No one should have to be here. I just want to see my family again. This is a hard request to make, but can you take me someplace safe?
+ + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01a.htm b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01a.htm new file mode 100644 index 0000000000..7752d7e60c --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01a.htm @@ -0,0 +1,4 @@ +Injured Soldier:
+I have agreed to follow %leader%. He has promised to take me to a safe place. %name% is also in the same group as %leader%, so you will help to bring me to a safe place, right?
+ + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01b.htm b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01b.htm new file mode 100644 index 0000000000..1e3dd85dc1 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01b.htm @@ -0,0 +1,4 @@ +Injured Soldier:
+I have already agreed to follow %leader% and his group. They have promised to take me to a safe place.
+Aren't they wonderful people? + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01c.htm b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01c.htm new file mode 100644 index 0000000000..0305916c70 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-01c.htm @@ -0,0 +1,4 @@ +Injured Soldier:
+I fight to stay alive, anything I can if it means getting out of here! I really need to concentrate on that.
+(Another character is already in progress of this quest.) + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-02.htm b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-02.htm new file mode 100644 index 0000000000..4076292b22 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-02.htm @@ -0,0 +1,4 @@ +Injured Soldier:
+You! This land, it's so chaotic, so much death. I feel like I'm trapped in a nightmare. I just have to calm down. I need to calm down. Can you leave me alone a while?
+(This quest can be taken once a day and resets at 6:30am.) + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-03.htm b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-03.htm new file mode 100644 index 0000000000..db6de62ba5 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-03.htm @@ -0,0 +1,4 @@ +Injured Soldier:
+I... I couldn't ask you for help. It'd be the blind leading the blind (laughs meekly).
+(This quest is only available to characters level 84 and above.) + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-04.htm b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-04.htm new file mode 100644 index 0000000000..8100a32e11 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-04.htm @@ -0,0 +1,7 @@ +Injured Soldier:
+Th, thank you. If General Ermian is still alive, I'd bet he's set up camp somewhere safe.
+But it would be best if it doesn't take too long. As you can see, I've been wounded and it won't be long until I either bleed out or disease takes it toll.
+If you're prepared, let's depart.
+ + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-04a.htm b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-04a.htm new file mode 100644 index 0000000000..1411167a6c --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-04a.htm @@ -0,0 +1,4 @@ +Injured Soldier:
+Th, thank you. Then, if General Ermian is there, it should be a safe place.
+But it would be best if it doesn't take too long. As you can see, I'm wounded... If %leader%'s preparations are complete, please tell me that you are ready to depart. + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-05.html b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-05.html new file mode 100644 index 0000000000..8100a32e11 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-05.html @@ -0,0 +1,7 @@ +Injured Soldier:
+Th, thank you. If General Ermian is still alive, I'd bet he's set up camp somewhere safe.
+But it would be best if it doesn't take too long. As you can see, I've been wounded and it won't be long until I either bleed out or disease takes it toll.
+If you're prepared, let's depart.
+ + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-05a.html b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-05a.html new file mode 100644 index 0000000000..fe4b4e85a0 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-05a.html @@ -0,0 +1,5 @@ +Injured Soldier:
+But adventurer... You cannot carry me all by yourself. Aren't there more of you? We'll never make it just the two of us... get some people to help! I don't have much time.
+ + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-06.html b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-06.html new file mode 100644 index 0000000000..e7dd01667e --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-06.html @@ -0,0 +1,3 @@ +Injured Soldier:
+Alright, let's head out. I'll follow. + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-07.html b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-07.html new file mode 100644 index 0000000000..fab331e1fe --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-07.html @@ -0,0 +1,3 @@ +Injured Soldier:
+Alright, let me know when you're ready to go. + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-08.html b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-08.html new file mode 100644 index 0000000000..7ce1a564ee --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/32738-08.html @@ -0,0 +1,3 @@ +Injured Soldier:
+I hope Ermian's camp is close, it's getting harder and harder to walk. I'm sorry to ask, but can we hurry? + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java new file mode 100644 index 0000000000..76b0659309 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00454_CompletelyLost/Q00454_CompletelyLost.java @@ -0,0 +1,789 @@ +/* + * 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 quests.Q00454_CompletelyLost; + +import com.l2jmobius.gameserver.ai.CtrlIntention; +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.enums.QuestType; +import com.l2jmobius.gameserver.model.L2Object; +import com.l2jmobius.gameserver.model.Location; +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.events.EventType; +import com.l2jmobius.gameserver.model.events.ListenerRegisterType; +import com.l2jmobius.gameserver.model.events.annotations.Id; +import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent; +import com.l2jmobius.gameserver.model.events.annotations.RegisterType; +import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureAttacked; +import com.l2jmobius.gameserver.model.events.returns.TerminateReturn; +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.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.NpcSay; +import com.l2jmobius.gameserver.util.Util; + +/** + * Completely Lost (454) + * @author Zoey76 + */ +public final class Q00454_CompletelyLost extends Quest +{ + // NPCs + private static final int INJURED_SOLDIER = 32738; + private static final int ERMIAN = 32736; + // Misc + private static final int MIN_LEVEL = 84; + private static final Location MOVE_TO = new Location(-180219, 186341, -10600); + + public Q00454_CompletelyLost() + { + super(454); + addStartNpc(INJURED_SOLDIER); + addTalkId(INJURED_SOLDIER, ERMIAN); + addSpawnId(ERMIAN); + addMoveFinishedId(INJURED_SOLDIER); + addSeeCreatureId(INJURED_SOLDIER); + addEventReceivedId(INJURED_SOLDIER); + } + + @Override + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "QUEST_TIMER": + { + npc.broadcastEvent("SCE_IM_ERMIAN", 300, null); + startQuestTimer("QUEST_TIMER", 100, npc, null); + break; + } + case "SAY_TIMER1": + { + // TODO: npc.changeStatus(3); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, INJURED_SOLDIER, NpcStringId.GASP)); + break; + } + case "SAY_TIMER2": + { + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, INJURED_SOLDIER, NpcStringId.SOB_TO_SEE_ERMIAN_AGAIN_CAN_I_GO_TO_MY_FAMILY_NOW)); + startQuestTimer("EXPIRED_TIMER", 2000, npc, null); + break; + } + case "CHECK_TIMER": + { + final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); + if (leader != null) + { + double dist = Util.calculateDistance(npc, leader, false, false); + if (dist > 1000) + { + if (((dist > 5000) && (dist < 6900)) || ((dist > 31000) && (dist < 32000))) + { + npc.teleToLocation(leader); + } + else if (npc.getVariables().getInt("whisper", 0) == 0) + { + whisper(npc, leader, NpcStringId.WHERE_ARE_YOU_I_CAN_T_SEE_ANYTHING); + npc.getVariables().set("whisper", 1); + } + else if (npc.getVariables().getInt("whisper", 0) == 1) + { + whisper(npc, leader, NpcStringId.WHERE_ARE_YOU_REALLY_I_CAN_T_FOLLOW_YOU_LIKE_THIS); + npc.getVariables().set("whisper", 2); + } + else if (npc.getVariables().getInt("whisper", 0) == 2) + { + whisper(npc, leader, NpcStringId.I_M_SORRY_THIS_IS_IT_FOR_ME); + npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_FAILURE", npc, null); + } + } + } + startQuestTimer("CHECK_TIMER", 2000, npc, null); + break; + } + case "TIME_LIMIT1": + { + final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); + if (leader != null) + { + startQuestTimer("TIME_LIMIT2", 150000, npc, null); + whisper(npc, leader, NpcStringId.IS_IT_STILL_LONG_OFF); + } + break; + } + case "TIME_LIMIT2": + { + final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); + if (leader != null) + { + startQuestTimer("TIME_LIMIT3", 150000, npc, null); + whisper(npc, leader, NpcStringId.IS_ERMIAN_WELL_EVEN_I_CAN_T_BELIEVE_THAT_I_SURVIVED_IN_A_PLACE_LIKE_THIS); + } + break; + } + case "TIME_LIMIT3": + { + final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); + if (leader != null) + { + startQuestTimer("TIME_LIMIT4", 150000, npc, null); + whisper(npc, leader, NpcStringId.I_DON_T_KNOW_HOW_LONG_IT_S_BEEN_SINCE_I_PARTED_COMPANY_WITH_YOU_TIME_DOESN_T_SEEM_TO_MOVE_IT_JUST_FEELS_TOO_LONG); + } + break; + } + case "TIME_LIMIT4": + { + final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); + if (leader != null) + { + startQuestTimer("TIME_LIMIT5", 150000, npc, null); + whisper(npc, leader, NpcStringId.SORRY_TO_SAY_THIS_BUT_THE_PLACE_YOU_STRUCK_ME_BEFORE_NOW_HURTS_GREATLY); + } + break; + } + case "TIME_LIMIT5": + { + final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); + if (leader != null) + { + whisper(npc, leader, NpcStringId.UGH_I_M_SORRY_IT_LOOKS_LIKE_THIS_IS_IT_FOR_ME_I_WANTED_TO_LIVE_AND_SEE_MY_FAMILY); + } + npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_FAILURE", npc, null); + startQuestTimer("EXPIRED_TIMER", 2000, npc, null); + break; + } + case "EXPIRED_TIMER": + { + npc.deleteMe(); + break; + } + } + + // For NPC-only timers, player is null and no further checks or actions are required. + if (player == null) + { + return null; + } + + final QuestState qs = getQuestState(player, false); + if (qs == null) + { + return null; + } + + String htmltext = null; + switch (event) + { + case "32738-04.htm": + { + if (player.getLevel() >= MIN_LEVEL) + { + if (npc.getVariables().getInt("quest_escort", 0) == 0) + { + npc.getVariables().set("leader", player); + npc.getVariables().set("quest_escort", 1); + if (player.isInParty()) + { + npc.getVariables().set("partyId", player.getParty().getLeaderObjectId()); + } + qs.setMemoState(1); + qs.startQuest(); + htmltext = event; + } + else + { + final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); + if (leader.isInParty() && leader.getParty().containsPlayer(player)) + { + qs.startQuest(); + qs.setMemoState(1); + htmltext = getHtm(player.getHtmlPrefix(), "32738-04a.htm"); + htmltext = htmltext.replaceAll("leader", leader.getName()); + } + else + { + htmltext = getHtm(player.getHtmlPrefix(), "32738-01b.htm"); + htmltext = htmltext.replaceAll("leader", leader.getName()); + } + } + } + break; + } + case "agree1": + { + if (qs.isMemoState(1)) + { + final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); + if (leader != null) + { + if (leader.isInParty()) + { + qs.setMemoState(2); + npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_START", npc, null); + htmltext = "32738-06.html"; + } + else + { + htmltext = "32738-05a.html"; + } + } + } + break; + } + case "agree2": + { + if (qs.isMemoState(1)) + { + qs.setMemoState(2); + htmltext = "32738-06.html"; + npc.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_START", npc, null); + final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); + if (leader != null) + { + if (leader.isInParty()) + { + for (L2PcInstance member : leader.getParty().getMembers()) + { + if (member != null) + { + final QuestState qsMember = getQuestState(member, false); + if ((qsMember != null) && qsMember.isMemoState(1) // + && (npc.getVariables().getInt("partyId", 0) == leader.getParty().getLeaderObjectId())) + { + qsMember.setMemoState(2); + } + } + } + } + } + } + break; + } + case "32738-07.html": + { + if (qs.isMemoState(1)) + { + htmltext = event; + } + break; + } + } + return htmltext; + } + + @Override + public String onEventReceived(String eventName, L2Npc sender, L2Npc receiver, L2Object reference) + { + switch (eventName) + { + case "SCE_IM_ERMIAN": + { + if (receiver.getVariables().getInt("state", 0) == 2) + { + receiver.getVariables().set("state", 3); + receiver.getVariables().set("ermian", sender); + receiver.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + addMoveToDesire(receiver, MOVE_TO, 10000000); + receiver.sendScriptEvent("SCE_A_SEED_ESCORT_QUEST_SUCCESS", receiver, null); + } + break; + } + case "SCE_A_SEED_ESCORT_QUEST_START": + { + final L2PcInstance leader = receiver.getVariables().getObject("leader", L2PcInstance.class); + if (leader != null) + { + receiver.setTarget(leader); + receiver.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, leader); + } + + startQuestTimer("CHECK_TIMER", 1000, receiver, null); + startQuestTimer("TIME_LIMIT1", 60000, receiver, null); + receiver.getVariables().set("state", 2); + receiver.getVariables().set("quest_escort", 99); + break; + } + case "SCE_A_SEED_ESCORT_QUEST_SUCCESS": + { + final L2PcInstance leader = receiver.getVariables().getObject("leader", L2PcInstance.class); + if (leader != null) + { + if (leader.isInParty()) + { + for (L2PcInstance member : leader.getParty().getMembers()) + { + if (member != null) + { + final QuestState qs = getQuestState(member, false); + if ((qs != null) && qs.isMemoState(2)) + { + qs.setMemoState(4); + } + } + } + } + else + { + final QuestState qs = getQuestState(leader, false); + if ((qs != null) && qs.isMemoState(2)) + { + qs.setMemoState(4); + } + } + } + // Timers cleanup + cancelQuestTimer("CHECK_TIMER", receiver, null); + cancelQuestTimer("TIME_LIMIT1", receiver, null); + cancelQuestTimer("TIME_LIMIT2", receiver, null); + cancelQuestTimer("TIME_LIMIT3", receiver, null); + cancelQuestTimer("TIME_LIMIT4", receiver, null); + cancelQuestTimer("TIME_LIMIT5", receiver, null); + break; + } + case "SCE_A_SEED_ESCORT_QUEST_FAILURE": + { + final L2PcInstance leader = receiver.getVariables().getObject("leader", L2PcInstance.class); + if (leader != null) + { + if (leader.isInParty()) + { + for (L2PcInstance member : leader.getParty().getMembers()) + { + if (member != null) + { + final QuestState qs = getQuestState(member, false); + if ((qs != null) && qs.isMemoState(2)) + { + qs.setMemoState(3); + } + } + } + } + else + { + final QuestState qs = getQuestState(leader, false); + if ((qs != null) && qs.isMemoState(2)) + { + qs.setMemoState(3); + } + } + } + receiver.deleteMe(); + // Timers cleanup + cancelQuestTimer("CHECK_TIMER", receiver, null); + cancelQuestTimer("TIME_LIMIT1", receiver, null); + cancelQuestTimer("TIME_LIMIT2", receiver, null); + cancelQuestTimer("TIME_LIMIT3", receiver, null); + cancelQuestTimer("TIME_LIMIT4", receiver, null); + cancelQuestTimer("TIME_LIMIT5", receiver, null); + break; + } + } + return super.onEventReceived(eventName, sender, receiver, reference); + } + + @Override + public void onMoveFinished(L2Npc npc) + { + final L2Npc ermian = npc.getVariables().getObject("ermian", L2Npc.class); + if (ermian != null) + { + npc.setHeading(Util.calculateHeadingFrom(npc, ermian)); + startQuestTimer("SAY_TIMER2", 2000, npc, null); + } + } + + @Override + public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) + { + if (creature.isPlayer() && (npc.getVariables().getInt("state", 0) == 0)) + { + addAttackPlayerDesire(npc, creature.getActingPlayer(), 10); + } + return super.onSeeCreature(npc, creature, isSummon); + } + + @Override + public String onTalk(L2Npc npc, L2PcInstance player) + { + final QuestState qs = getQuestState(player, true); + String htmltext = getNoQuestMsg(player); + + switch (qs.getState()) + { + case State.COMPLETED: + { + if (!qs.isNowAvailable()) + { + htmltext = "32738-02.htm"; + break; + } + qs.setState(State.CREATED); + } + case State.CREATED: + { + if (player.getLevel() >= MIN_LEVEL) + { + final int quest_escort = npc.getVariables().getInt("quest_escort", 0); + if (quest_escort == 0) + { + htmltext = "32738-01.htm"; + } + else if (quest_escort == 99) + { + htmltext = "32738-01c.htm"; + } + else + { + final L2PcInstance leader = npc.getVariables().getObject("leader", L2PcInstance.class); + if (leader.isInParty() && leader.getParty().containsPlayer(player)) + { + htmltext = getHtm(player.getHtmlPrefix(), "32738-01a.htm"); + htmltext = htmltext.replaceAll("leader", leader.getName()); + htmltext = htmltext.replaceAll("name", player.getName()); + } + else + { + htmltext = getHtm(player.getHtmlPrefix(), "32738-01b.htm"); + htmltext = htmltext.replaceAll("leader", leader.getName()); + } + } + } + else + { + htmltext = "32738-03.htm"; + } + break; + } + case State.STARTED: + { + switch (npc.getId()) + { + case INJURED_SOLDIER: + { + if (qs.isMemoState(1)) + { + htmltext = "32738-05.html"; + } + else if (qs.isMemoState(2)) + { + htmltext = "32738-08.html"; + } + break; + } + case ERMIAN: + { + switch (qs.getMemoState()) + { + case 1: + case 2: + { + htmltext = "32736-01.html"; + break; + } + case 3: + { + qs.exitQuest(QuestType.DAILY, true); + htmltext = "32736-02.html"; + break; + } + case 4: + { + final int group = getRandom(3); + final int chance = getRandom(100); + if (group == 0) + { + if (getRandomBoolean()) + { + if (chance < 11) + { + giveItems(player, 15792, 1); // Recipe - Sealed Vesper Helmet (60%) + } + else if ((chance <= 11) && (chance < 22)) + { + giveItems(player, 15798, 1); // Recipe - Sealed Vesper Gaiter (60%) + } + else if ((chance <= 22) && (chance < 33)) + { + giveItems(player, 15795, 1); // Recipe - Sealed Vesper Breastplate (60%) + } + else if ((chance <= 33) && (chance < 44)) + { + giveItems(player, 15801, 1); // Recipe - Sealed Vesper Gauntlet (60%) + } + else if ((chance <= 44) && (chance < 55)) + { + giveItems(player, 15808, 1); // Recipe - Sealed Vesper Shield (60%) + } + else if ((chance <= 55) && (chance < 66)) + { + giveItems(player, 15804, 1); // Recipe - Sealed Vesper Boots (60%) + } + else if ((chance <= 66) && (chance < 77)) + { + giveItems(player, 15809, 1); // Recipe - Sealed Vesper Ring (70%) + } + else if ((chance <= 77) && (chance < 88)) + { + giveItems(player, 15810, 1); // Recipe - Sealed Vesper Earring (70%) + } + else + { + giveItems(player, 15811, 1); // Recipe - Sealed Vesper Necklace (70%) + } + } + else + { + if (chance < 11) + { + giveItems(player, 15660, 3); // Sealed Vesper Helmet Piece + } + else if ((chance <= 11) && (chance < 22)) + { + giveItems(player, 15666, 3); // Sealed Vesper Gaiter Piece + } + else if ((chance <= 22) && (chance < 33)) + { + giveItems(player, 15663, 3); // Sealed Vesper Breastplate Piece + } + else if ((chance <= 33) && (chance < 44)) + { + giveItems(player, 15667, 3); // Sealed Vesper Gauntlet Piece + } + else if ((chance <= 44) && (chance < 55)) + { + giveItems(player, 15669, 3); // Sealed Vesper Verteidiger Piece + } + else if ((chance <= 55) && (chance < 66)) + { + giveItems(player, 15668, 3); // Sealed Vesper Boots Piece + } + else if ((chance <= 66) && (chance < 77)) + { + giveItems(player, 15769, 3); // Sealed Vesper Ring Gem + } + else if ((chance <= 77) && (chance < 88)) + { + giveItems(player, 15770, 3); // Sealed Vesper Earring Gem + } + else + { + giveItems(player, 15771, 3); // Sealed Vesper Necklace Gem + } + } + } + else if (group == 1) + { + if (getRandomBoolean()) + { + if (chance < 12) + { + giveItems(player, 15805, 1); // Recipe - Sealed Vesper Leather Boots (60%) + } + else if ((chance <= 12) && (chance < 24)) + { + giveItems(player, 15796, 1); // Recipe - Sealed Vesper Leather Breastplate (60%) + } + else if ((chance <= 24) && (chance < 36)) + { + giveItems(player, 15793, 1); // Recipe - Sealed Vesper Leather Helmet (60%) + } + else if ((chance <= 36) && (chance < 48)) + { + giveItems(player, 15799, 1); // Recipe - Sealed Vesper Leather Legging (60%) + } + else if ((chance <= 48) && (chance < 60)) + { + giveItems(player, 15802, 1); // Recipe - Sealed Vesper Leather Gloves (60%) + } + else if ((chance <= 60) && (chance < 72)) + { + giveItems(player, 15809, 1); // Recipe - Sealed Vesper Ring (70%) + } + else if ((chance <= 72) && (chance < 84)) + { + giveItems(player, 15810, 1); // Recipe - Sealed Vesper Earring (70%) + } + else + { + giveItems(player, 15811, 1); // Recipe - Sealed Vesper Necklace (70%) + } + } + else + { + if (chance < 12) + { + giveItems(player, 15672, 3); // Sealed Vesper Leather Boots Piece + } + else if ((chance <= 12) && (chance < 24)) + { + giveItems(player, 15664, 3); // Sealed Vesper Leather Breastplate Piece + } + else if ((chance <= 24) && (chance < 36)) + { + giveItems(player, 15661, 3); // Sealed Vesper Leather Helmet Piece + } + else if ((chance <= 36) && (chance < 48)) + { + giveItems(player, 15670, 3); // Sealed Vesper Leather Legging Piece + } + else if ((chance <= 48) && (chance < 60)) + { + giveItems(player, 15671, 3); // Sealed Vesper Leather Gloves Piece + } + else if ((chance <= 60) && (chance < 72)) + { + giveItems(player, 15769, 3); // Sealed Vesper Ring Gem + } + else if ((chance <= 72) && (chance < 84)) + { + giveItems(player, 15770, 3); // Sealed Vesper Earring Gem + } + else + { + giveItems(player, 15771, 3); // Sealed Vesper Necklace Gem + } + } + } + else if (getRandomBoolean()) + { + if (chance < 11) + { + giveItems(player, 15800, 1); + } + else if ((chance <= 11) && (chance < 22)) // Recipe - Sealed Vesper Stockings (60%) + { + giveItems(player, 15803, 1); // Recipe - Sealed Vesper Gloves (60%) + } + else if ((chance <= 22) && (chance < 33)) + { + giveItems(player, 15806, 1); // Recipe - Sealed Vesper Shoes (60%) + } + else if ((chance <= 33) && (chance < 44)) + { + giveItems(player, 15807, 1); // Recipe - Sealed Vesper Sigil (60%) + } + else if ((chance <= 44) && (chance < 55)) + { + giveItems(player, 15797, 1); // Recipe - Sealed Vesper Tunic (60%) + } + else if ((chance <= 55) && (chance < 66)) + { + giveItems(player, 15794, 1); // Recipe - Sealed Vesper Circlet (60%) + } + else if ((chance <= 66) && (chance < 77)) + { + giveItems(player, 15809, 1); // Recipe - Sealed Vesper Ring (70%) + } + else if ((chance <= 77) && (chance < 88)) + { + giveItems(player, 15810, 1); // Recipe - Sealed Vesper Earring (70%) + } + else + { + giveItems(player, 15811, 1); // Recipe - Sealed Vesper Necklace (70%) + } + } + else + { + if (chance < 11) + { + giveItems(player, 15673, 3); // Sealed Vesper Stockings Piece + } + else if ((chance <= 11) && (chance < 22)) + { + giveItems(player, 15674, 3); // Sealed Vesper Gloves Piece + } + else if ((chance <= 22) && (chance < 33)) + { + giveItems(player, 15675, 3); // Sealed Vesper Shoes Piece + } + else if ((chance <= 33) && (chance < 44)) + { + giveItems(player, 15691, 3); // Sealed Vesper Sigil Piece + } + else if ((chance <= 44) && (chance < 55)) + { + giveItems(player, 15665, 3); // Sealed Vesper Tunic Piece + } + else if ((chance <= 55) && (chance < 66)) + { + giveItems(player, 15662, 3); // Sealed Vesper Circlet Piece + } + else if ((chance <= 66) && (chance < 77)) + { + giveItems(player, 15769, 3); // Sealed Vesper Ring Gem + } + else if ((chance <= 77) && (chance < 88)) + { + giveItems(player, 15770, 3); // Sealed Vesper Earring Gem + } + else + { + giveItems(player, 15771, 3); // Sealed Vesper Necklace Gem + } + } + + qs.exitQuest(QuestType.DAILY, true); + htmltext = "32736-03.html"; + break; + } + } + break; + } + } + break; + } + } + return htmltext; + } + + @RegisterEvent(EventType.ON_CREATURE_ATTACKED) + @RegisterType(ListenerRegisterType.NPC) + @Id(INJURED_SOLDIER) + public TerminateReturn onAttacked(OnCreatureAttacked event) + { + final L2Npc npc = (L2Npc) event.getTarget(); + // TODO: npc.changeStatus(2); + npc.getVariables().set("state", 1); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + startQuestTimer("SAY_TIMER1", 2000, npc, null); + + return new TerminateReturn(true, false, false); + } + + @Override + public String onSpawn(L2Npc npc) + { + startQuestTimer("QUEST_TIMER", 1000, npc, null); + return super.onSpawn(npc); + } + + /** + * Send a whisper to the given player. + * @param npc the NPC + * @param player the player + * @param stringId the NPC String + */ + private static void whisper(L2Npc npc, L2PcInstance player, NpcStringId stringId) + { + player.sendPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), stringId)); + } +} diff --git a/trunk/dist/game/data/scripts/quests/QuestMasterHandler.java b/trunk/dist/game/data/scripts/quests/QuestMasterHandler.java index 47729f77da..112c861813 100644 --- a/trunk/dist/game/data/scripts/quests/QuestMasterHandler.java +++ b/trunk/dist/game/data/scripts/quests/QuestMasterHandler.java @@ -16,6 +16,9 @@ */ package quests; +import java.util.logging.Level; +import java.util.logging.Logger; + import quests.Q00013_ParcelDelivery.Q00013_ParcelDelivery; import quests.Q00015_SweetWhispers.Q00015_SweetWhispers; import quests.Q00016_TheComingDarkness.Q00016_TheComingDarkness; @@ -107,6 +110,7 @@ import quests.Q00450_GraveRobberRescue.Q00450_GraveRobberRescue; import quests.Q00451_LuciensAltar.Q00451_LuciensAltar; import quests.Q00452_FindingtheLostSoldiers.Q00452_FindingtheLostSoldiers; import quests.Q00453_NotStrongEnoughAlone.Q00453_NotStrongEnoughAlone; +import quests.Q00454_CompletelyLost.Q00454_CompletelyLost; import quests.Q00455_WingsOfSand.Q00455_WingsOfSand; import quests.Q00456_DontKnowDontCare.Q00456_DontKnowDontCare; import quests.Q00457_LostAndFound.Q00457_LostAndFound; @@ -329,9 +333,6 @@ import quests.Q10813_ForGlory.Q10813_ForGlory; import quests.Q10814_BefittingOfTheStatus.Q10814_BefittingOfTheStatus; import quests.Q10815_StepUp.Q10815_StepUp; -import java.util.logging.Level; -import java.util.logging.Logger; - /** * @author NosBit */ @@ -432,6 +433,7 @@ public class QuestMasterHandler Q00451_LuciensAltar.class, Q00452_FindingtheLostSoldiers.class, Q00453_NotStrongEnoughAlone.class, + Q00454_CompletelyLost.class, Q00455_WingsOfSand.class, Q00456_DontKnowDontCare.class, Q00457_LostAndFound.class, diff --git a/trunk/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml b/trunk/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml index 5746f1a2b1..851c19fd95 100644 --- a/trunk/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml +++ b/trunk/dist/game/data/spawns/Gracia/SeedOfAnnihilation.xml @@ -292,6 +292,11 @@ + + + + + \ No newline at end of file