From b99eec7b0dea58624316abeb2db1a2eefe5c82a4 Mon Sep 17 00:00:00 2001
From: Zoey76 <zoey_76@msn.com>
Date: Sun, 24 May 2015 20:19:51 -0300
Subject: [PATCH] Missing Nornil's Garden Quest instance for quest Seeds Of
 Chaos (236)

---
 .../scripts/instances/InstanceLoader.java     |   2 +
 .../NornilsGardenQuest/32190-02.html          |   3 +
 .../NornilsGardenQuest/32190-03.html          |   4 +
 .../NornilsGardenQuest/32237-01.html}         |   0
 .../NornilsGardenQuest/32237-02.html          |   4 +
 .../NornilsGardenQuest/32239-01.html          |   4 +
 .../NornilsGardenQuest/32239-02.html          |   6 +
 .../NornilsGardenQuest/32239-03.html          |   4 +
 .../NornilsGardenQuest.java                   | 137 ++++++++++++++++++
 9 files changed, 164 insertions(+)
 create mode 100644 L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32190-02.html
 create mode 100644 L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32190-03.html
 rename L2J_DataPack/dist/game/data/{html/default/32237.htm => scripts/instances/NornilsGardenQuest/32237-01.html} (100%)
 create mode 100644 L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32237-02.html
 create mode 100644 L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32239-01.html
 create mode 100644 L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32239-02.html
 create mode 100644 L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32239-03.html
 create mode 100644 L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/NornilsGardenQuest.java

diff --git a/L2J_DataPack/dist/game/data/scripts/instances/InstanceLoader.java b/L2J_DataPack/dist/game/data/scripts/instances/InstanceLoader.java
index 741457b251..e9a4249a9d 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/InstanceLoader.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/InstanceLoader.java
@@ -42,6 +42,7 @@ import instances.LibraryOfSages.LibraryOfSages;
 import instances.MithrilMine.MithrilMine;
 import instances.MonasteryOfSilence1.MonasteryOfSilence1;
 import instances.NornilsGarden.NornilsGarden;
+import instances.NornilsGardenQuest.NornilsGardenQuest;
 import instances.PailakaDevilsLegacy.PailakaDevilsLegacy;
 import instances.PailakaSongOfIceAndFire.PailakaSongOfIceAndFire;
 import instances.SanctumOftheLordsOfDawn.SanctumOftheLordsOfDawn;
@@ -83,6 +84,7 @@ public final class InstanceLoader
 		MithrilMine.class,
 		MonasteryOfSilence1.class,
 		NornilsGarden.class,
+		NornilsGardenQuest.class,
 		PailakaDevilsLegacy.class,
 		PailakaSongOfIceAndFire.class,
 		SanctumOftheLordsOfDawn.class,
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32190-02.html b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32190-02.html
new file mode 100644
index 0000000000..06b67c806c
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32190-02.html
@@ -0,0 +1,3 @@
+<html><body>Vice Heirarch Mao:<br>
+I have never seen a case like this before... Good luck!
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32190-03.html b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32190-03.html
new file mode 100644
index 0000000000..d10989eb36
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32190-03.html
@@ -0,0 +1,4 @@
+<html><body>Vice Hierarch Mao:<br>
+Wait a moment...<br>
+Eh? Oh, it seems that we cannot contact Mother Nornil at this time. Come back later.
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/html/default/32237.htm b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32237-01.html
similarity index 100%
rename from L2J_DataPack/dist/game/data/html/default/32237.htm
rename to L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32237-01.html
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32237-02.html b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32237-02.html
new file mode 100644
index 0000000000..0c6b31343c
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32237-02.html
@@ -0,0 +1,4 @@
+<html><body>Rodenpicula:<br>
+Speak with Mother Nornil about how to depart this place.<br>
+She will tell you how.
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32239-01.html b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32239-01.html
new file mode 100644
index 0000000000..37f047bc33
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32239-01.html
@@ -0,0 +1,4 @@
+<html><body>Mother Nornil:<br>
+You see a huge statue of a goddess with searching, merciful eyes. An enormous mechanical device seems attached to it.<br>
+<a action="bypass -h npc_%objectId%_Quest">Quest.</a>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32239-02.html b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32239-02.html
new file mode 100644
index 0000000000..92b9266d5a
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32239-02.html
@@ -0,0 +1,6 @@
+<html><body>Mother Nornil:<br>
+Ah, you who have achieved the new power... I look forward to your future path.<br>
+Although it seems but a half power, that may be a natural limitation for a being not created by the gods in a world they did create. However, they cannot learn our skills, either...<br>
+I will watch you closely, and expect great things. You are the pinnacle of the Kamael...<br>
+<a action="bypass -h Quest NornilsGardenQuest exit">Go outside.</a>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32239-03.html b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32239-03.html
new file mode 100644
index 0000000000..16cb5ddbe9
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/32239-03.html
@@ -0,0 +1,4 @@
+<html><body>Mother Nornil:<br>
+Now, go forth with the power of chaos, the unconquerable free will, centered in your body.<br>
+Your adventures have only begun...
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/NornilsGardenQuest.java b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/NornilsGardenQuest.java
new file mode 100644
index 0000000000..a6ab0819f3
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGardenQuest/NornilsGardenQuest.java
@@ -0,0 +1,137 @@
+/*
+ * 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 instances.NornilsGardenQuest;
+
+import instances.AbstractInstance;
+import quests.Q00236_SeedsOfChaos.Q00236_SeedsOfChaos;
+
+import com.l2jserver.gameserver.instancemanager.InstanceManager;
+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.instancezone.InstanceWorld;
+import com.l2jserver.gameserver.model.quest.QuestState;
+
+/**
+ * Nornil's Garden Quest instant zone.
+ * @author Zoey76
+ */
+public final class NornilsGardenQuest extends AbstractInstance
+{
+	protected static final class NornilsGardenQuestWorld extends InstanceWorld
+	{
+		protected Location ORIGIN_LOC;
+	}
+	
+	// NPCs
+	private static final int RODENPICULA = 32237;
+	private static final int MOTHER_NORNIL = 32239;
+	// Location
+	private static final Location ENTER_LOC = new Location(-119538, 87177, -12592);
+	// Misc
+	private static final int TEMPLATE_ID = 12;
+	
+	public NornilsGardenQuest()
+	{
+		super(NornilsGardenQuest.class.getSimpleName());
+		
+		addStartNpc(RODENPICULA, MOTHER_NORNIL);
+		addTalkId(RODENPICULA, MOTHER_NORNIL);
+		addFirstTalkId(RODENPICULA, MOTHER_NORNIL);
+	}
+	
+	@Override
+	protected boolean checkConditions(L2PcInstance player)
+	{
+		final QuestState qs = player.getQuestState(Q00236_SeedsOfChaos.class.getSimpleName());
+		return (qs != null) && (qs.getMemoState() >= 40) && (qs.getMemoState() <= 45);
+	}
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = null;
+		final QuestState q236 = player.getQuestState(Q00236_SeedsOfChaos.class.getSimpleName());
+		switch (event)
+		{
+			case "enter":
+			{
+				if (checkConditions(player))
+				{
+					final NornilsGardenQuestWorld world = new NornilsGardenQuestWorld();
+					world.ORIGIN_LOC = player.getLocation();
+					enterInstance(player, world, "NornilsGardenQuest.xml", TEMPLATE_ID);
+					q236.setCond(16, true);
+					htmltext = "32190-02.html";
+				}
+				else
+				{
+					htmltext = "32190-03.html";
+				}
+				break;
+			}
+			case "exit":
+			{
+				if ((q236 != null) && q236.isCompleted())
+				{
+					final NornilsGardenQuestWorld world = (NornilsGardenQuestWorld) InstanceManager.getInstance().getPlayerWorld(player);
+					world.removeAllowed(player.getObjectId());
+					finishInstance(world, 5000);
+					
+					player.setInstanceId(0);
+					player.teleToLocation(world.ORIGIN_LOC);
+					htmltext = "32239-03.html";
+				}
+				break;
+			}
+		}
+		return htmltext;
+	}
+	
+	@Override
+	protected void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
+	{
+		if (firstEntrance)
+		{
+			world.addAllowed(player.getObjectId());
+		}
+		teleportPlayer(player, ENTER_LOC, world.getInstanceId(), false);
+	}
+	
+	@Override
+	public String onFirstTalk(L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = null;
+		final QuestState q236 = player.getQuestState(Q00236_SeedsOfChaos.class.getSimpleName());
+		switch (npc.getId())
+		{
+			case RODENPICULA:
+			{
+				htmltext = (q236 != null) && (q236.isCompleted()) ? "32237-02.html" : "32237-01.html";
+				break;
+			}
+			case MOTHER_NORNIL:
+			{
+				htmltext = (q236 != null) && (q236.isCompleted()) ? "32239-02.html" : "32239-01.html";
+				break;
+			}
+		}
+		return htmltext;
+	}
+}
-- 
GitLab