From 2eb9a57626dcbbbe8bea2d01d14c1fb2157e50c7 Mon Sep 17 00:00:00 2001
From: malyelfik <malyelfik@users.noreply.github.com>
Date: Thu, 27 Sep 2012 19:32:15 +0000
Subject: [PATCH] BETA: Improved quest '''Control Device of the Giants (307)
 '''  * Now Hekaton respawn isn't stored only for players who killed him

---
 .../32711-03.htm                              |   2 +-
 .../{32711-04.htm => 32711-04.html}           |   4 +-
 .../{32711-04a.htm => 32711-04a.html}         |   0
 .../{32711-05.htm => 32711-05.html}           |   6 +-
 .../{32711-05a.htm => 32711-05a.html}         |   0
 .../{32711-05b.htm => 32711-05b.html}         |   0
 .../{32711-05c.htm => 32711-05c.html}         |   0
 .../{32711-06.htm => 32711-06.html}           |   0
 .../{32711-07.htm => 32711-07.html}           |   6 +-
 .../{32711-08.htm => 32711-08.html}           |   0
 .../{32711-09.htm => 32711-09.html}           |   0
 .../{32711-09a.htm => 32711-09a.html}         |   0
 .../{32711-10.htm => 32711-10.html}           |   0
 .../Q00307_ControlDeviceOfTheGiants.java      | 184 +++++++-----------
 .../dist/sql/game/updates/20120927update.sql  |   1 +
 15 files changed, 81 insertions(+), 122 deletions(-)
 rename L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/{32711-04.htm => 32711-04.html} (86%)
 rename L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/{32711-04a.htm => 32711-04a.html} (100%)
 rename L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/{32711-05.htm => 32711-05.html} (78%)
 rename L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/{32711-05a.htm => 32711-05a.html} (100%)
 rename L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/{32711-05b.htm => 32711-05b.html} (100%)
 rename L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/{32711-05c.htm => 32711-05c.html} (100%)
 rename L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/{32711-06.htm => 32711-06.html} (100%)
 rename L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/{32711-07.htm => 32711-07.html} (82%)
 rename L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/{32711-08.htm => 32711-08.html} (100%)
 rename L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/{32711-09.htm => 32711-09.html} (100%)
 rename L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/{32711-09a.htm => 32711-09a.html} (100%)
 rename L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/{32711-10.htm => 32711-10.html} (100%)
 create mode 100644 L2J_DataPack_BETA/dist/sql/game/updates/20120927update.sql

diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-03.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-03.htm
index c6d68b8fac..9c29fad21b 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-03.htm
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-03.htm
@@ -1,4 +1,4 @@
 <html><body>Dwarf Explorer Droph:<br>
 There is a Raid Monster named <font color="LEVEL">Hekaton Prime</font> in the deep substratum of this Giants' Cave. In fact, it is the central core that controls this area!<br>
 If we can expel it, our exploration will be much easier. Doing so is beyond my power, though.<br>Perhaps you have some equally powerful friends who would be willing to help you do it? I'll happily pay you for your work!<br>
-<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-04.htm">Accept.</a></body></html>
\ No newline at end of file
+<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-04.html">Accept.</a></body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-04.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-04.html
similarity index 86%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-04.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-04.html
index ac34119e89..e7a972f75e 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-04.htm
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-04.html
@@ -2,6 +2,6 @@
 Good decision! I'll fill you in on the information then, aye?<br>
 This Hekaton Prime does not show itself often: it's a controling unit that prefers to work at the back, see? He has three monsters... that's <font color="LEVEL">Gorgos, the Last Titan Utenes, and Giant Marpanak</font>, and each guard Hekaton Prime's cave.<br>
 To capture Hekaton Prime, you need to take care of the three monsters first. Capture these monsters and collect the <font color="LEVEL">Cave Exploration Text</font>1 to 3. I'll then translate them and summon Hekaton Prime for you.<br>
-<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-05.htm">"Tell me the about the monsters I need to capture."</a><br>
-<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-06.htm">"I'll get started now."</a>
+<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-05.html">"Tell me the about the monsters I need to capture."</a><br>
+<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-06.html">"I'll get started now."</a>
 </body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-04a.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-04a.html
similarity index 100%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-04a.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-04a.html
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05.html
similarity index 78%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05.html
index 5fd3864155..55c812e7a2 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05.htm
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05.html
@@ -1,6 +1,6 @@
 <html><body>Dwarf Adventurer Droph:<br>
 They are the right-hand creatures of Hekaton Prime: Gorgos, the Last Titan Utenes, and the Giant Marpanak. If you want to know where they are, I'd be more than willing to help. Which would you like to face first?<br>
-<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-05a.htm">"Where's the Gorgos?"</a><br>
-<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-05b.htm">"I want Utenes."</a><br>
-<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-05c.htm">"Where's the Giant Marpanak?"</a>
+<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-05a.html">"Where's the Gorgos?"</a><br>
+<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-05b.html">"I want Utenes."</a><br>
+<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-05c.html">"Where's the Giant Marpanak?"</a>
 </body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05a.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05a.html
similarity index 100%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05a.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05a.html
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05b.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05b.html
similarity index 100%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05b.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05b.html
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05c.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05c.html
similarity index 100%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05c.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-05c.html
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-06.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-06.html
similarity index 100%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-06.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-06.html
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-07.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-07.html
similarity index 82%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-07.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-07.html
index e830685ae5..765a125bed 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-07.htm
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-07.html
@@ -1,6 +1,6 @@
 <html><body>Dwarf Explorer Droph:<br>
 You must defeat Gorgolos, last Giant ???? and Giant ????? before facing Hekaton Prime. If you want to know where they are, I am more than willing to tell you. Which one are you interested in?<br>
-<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-05a.htm">Gorgolos</a><br>
-<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-05b.htm">Last Giant ????</a><br>
-<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-05c.htm">Giant ?????</a>
+<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-05a.html">Gorgolos</a><br>
+<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-05b.html">Last Giant ????</a><br>
+<a action="bypass -h Quest Q00307_ControlDeviceOfTheGiants 32711-05c.html">Giant ?????</a>
 </body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-08.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-08.html
similarity index 100%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-08.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-08.html
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-09.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-09.html
similarity index 100%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-09.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-09.html
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-09a.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-09a.html
similarity index 100%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-09a.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-09a.html
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-10.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-10.html
similarity index 100%
rename from L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-10.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/32711-10.html
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java
index 17b8750a6f..0e52e87cae 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00307_ControlDeviceOfTheGiants/Q00307_ControlDeviceOfTheGiants.java
@@ -29,91 +29,79 @@ public class Q00307_ControlDeviceOfTheGiants extends Quest
 {
 	// NPC
 	private final static int DROPH = 32711;
+	
 	// RB
 	private final static int GORGOLOS = 25681;
 	private final static int LAST_TITAN_UTENUS = 25684;
 	private final static int GIANT_MARPANAK = 25680;
 	private final static int HEKATON_PRIME = 25687;
+	
 	// Items
 	private final static int SUPPORT_ITEMS = 14850;
 	private final static int CET_1_SHEET = 14851;
 	private final static int CET_2_SHEET = 14852;
 	private final static int CET_3_SHEET = 14853;
 	
-	private final static int respawnDelay = 3600000; // 1 hour
+	// Misc
+	private final static int RESPAWN_DELAY = 3600000; // 1 hour
+	private static L2Npc hekaton;
 	
 	@Override
 	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
 	{
-		QuestState st = player.getQuestState(getName());
-		String htmltext = event;
-		
+		final QuestState st = player.getQuestState(getName());
 		if (st == null)
 		{
 			return null;
 		}
 		
-		if (event.equalsIgnoreCase("32711-04.htm"))
+		String htmltext = event;
+		switch (event)
 		{
-			if (st.getPlayer().getLevel() >= 79)
-			{
-				st.setState(State.STARTED);
-				st.set("cond", "1");
-				st.playSound("ItemSound.quest_accept");
-				if (!st.hasQuestItems(CET_1_SHEET) || !st.hasQuestItems(CET_2_SHEET) || !st.hasQuestItems(CET_3_SHEET))
+			case "32711-04.html":
+				if (player.getLevel() >= 79)
 				{
-					htmltext = "32711-04.htm";
+					st.startQuest();
+					htmltext = (hasQuestItems(player, CET_1_SHEET, CET_2_SHEET, CET_3_SHEET)) ? "32711-04a.html" : "32711-04.html";
 				}
-				else if (st.hasQuestItems(CET_1_SHEET) && st.hasQuestItems(CET_2_SHEET) && st.hasQuestItems(CET_3_SHEET))
+				break;
+			case "32711-05a.html":
+				player.sendPacket(new RadarControl(0, 2, 186214, 61591, -4152));
+				break;
+			case "32711-05b.html":
+				player.sendPacket(new RadarControl(0, 2, 187554, 60800, -4984));
+				break;
+			case "32711-05c.html":
+				player.sendPacket(new RadarControl(0, 2, 193432, 53922, -4368));
+				break;
+			case "spawn":
+				if (!hasQuestItems(player, CET_1_SHEET, CET_2_SHEET, CET_3_SHEET))
 				{
-					htmltext = "32711-04a.htm";
+					return getNoQuestMsg(player);
 				}
-			}
-		}
-		else if (event.equalsIgnoreCase("32711-05a.htm"))
-		{
-			player.sendPacket(new RadarControl(0, 2, 186214, 61591, -4152));
-		}
-		else if (event.equalsIgnoreCase("32711-05b.htm"))
-		{
-			player.sendPacket(new RadarControl(0, 2, 187554, 60800, -4984));
-		}
-		else if (event.equalsIgnoreCase("32711-05c.htm"))
-		{
-			player.sendPacket(new RadarControl(0, 2, 193432, 53922, -4368));
-		}
-		// Hekaton Prime spawn
-		else if (event.equalsIgnoreCase("spawn"))
-		{
-			String test = st.getGlobalQuestVar("Hekaton respawn");
-			
-			if (test.isEmpty())
-			{
-				st.takeItems(CET_1_SHEET, 1);
-				st.takeItems(CET_2_SHEET, 1);
-				st.takeItems(CET_3_SHEET, 1);
-				addSpawn(HEKATON_PRIME, 191887, 56405, -7626, 1000, false, 0);
-				st.set("spawned", "1");
-				htmltext = "32711-09.htm";
-			}
-			else
-			{
-				long remain = Long.parseLong(test) - System.currentTimeMillis();
-				
-				if (remain > 0)
+				else if ((hekaton != null) && !hekaton.isDead())
 				{
-					htmltext = "32711-09a.htm";
+					return "32711-09.html";
 				}
-				else
+				String respawn = loadGlobalQuestVar("Respawn");
+				long remain = (!respawn.isEmpty()) ? Long.parseLong(respawn) - System.currentTimeMillis() : 0;
+				if (remain > 0)
 				{
-					st.takeItems(CET_1_SHEET, 1);
-					st.takeItems(CET_2_SHEET, 1);
-					st.takeItems(CET_3_SHEET, 1);
-					addSpawn(HEKATON_PRIME, 192062, 57357, -7650, 1000, false, 0);
-					st.set("spawned", "1");
-					htmltext = "32711-09.htm";
+					return "32711-09a.html";
 				}
-			}
+				st.takeItems(CET_1_SHEET, 1);
+				st.takeItems(CET_2_SHEET, 1);
+				st.takeItems(CET_3_SHEET, 1);
+				hekaton = addSpawn(HEKATON_PRIME, 191777, 56197, -7624, 0, false, 0);
+				htmltext = "32711-09.html";
+				break;
+			case "32711-03.htm":
+			case "32711-05.html":
+			case "32711-06.html":
+				break;
+			default:
+				htmltext = null;
+				break;
 		}
 		return htmltext;
 	}
@@ -122,7 +110,7 @@ public class Q00307_ControlDeviceOfTheGiants extends Quest
 	public String onTalk(L2Npc npc, L2PcInstance player)
 	{
 		String htmltext = getNoQuestMsg(player);
-		QuestState st = player.getQuestState(getName());
+		final QuestState st = player.getQuestState(getName());
 		if (st == null)
 		{
 			return htmltext;
@@ -132,39 +120,24 @@ public class Q00307_ControlDeviceOfTheGiants extends Quest
 		{
 			case State.CREATED:
 			{
-				if (player.getLevel() >= 79)
-				{
-					htmltext = "32711-01.htm";
-				}
-				else
-				{
-					htmltext = "32711-02.htm";
-				}
+				htmltext = (player.getLevel() >= 79) ? "32711-01.htm" : "32711-02.htm";
 				break;
 			}
 			case State.STARTED:
 			{
-				if (st.getInt("spawned") == 1)
+				if ((hekaton != null) && !hekaton.isDead())
 				{
-					htmltext = "32711-09.htm";
+					htmltext = "32711-09.html";
 				}
-				else if (st.getInt("cond") == 1)
+				else if (st.isCond(1))
 				{
-					if (!st.hasQuestItems(CET_1_SHEET) || !st.hasQuestItems(CET_2_SHEET) || !st.hasQuestItems(CET_3_SHEET))
-					{
-						htmltext = "32711-07.htm";
-					}
-					else
-					{
-						htmltext = "32711-08.htm";
-					}
+					htmltext = (!hasQuestItems(player, CET_1_SHEET, CET_2_SHEET, CET_3_SHEET)) ? "32711-07.html" : "32711-08.html";
 				}
-				else if (st.getInt("cond") == 2)
+				else if (st.isCond(2))
 				{
 					st.giveItems(SUPPORT_ITEMS, 1);
-					st.playSound("ItemSound.quest_finish");
-					st.exitQuest(true);
-					htmltext = "32711-10.htm";
+					st.exitQuest(true, true);
+					htmltext = "32711-10.html";
 				}
 				break;
 			}
@@ -175,10 +148,10 @@ public class Q00307_ControlDeviceOfTheGiants extends Quest
 	@Override
 	public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
 	{
-		L2PcInstance partyMember = getRandomPartyMember(player, "1");
+		final L2PcInstance partyMember = getRandomPartyMember(player, "1");
 		if (partyMember == null)
 		{
-			return null;
+			return super.onKill(npc, player, isPet);
 		}
 		final QuestState st = partyMember.getQuestState(getName());
 		
@@ -187,67 +160,52 @@ public class Q00307_ControlDeviceOfTheGiants extends Quest
 			case GORGOLOS:
 			{
 				st.giveItems(CET_1_SHEET, 1);
-				st.playSound("ItemSound.quest_itemget");
+				st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
 				break;
 			}
 			case LAST_TITAN_UTENUS:
 			{
 				st.giveItems(CET_2_SHEET, 1);
-				st.playSound("ItemSound.quest_itemget");
+				st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
 				break;
 			}
 			case GIANT_MARPANAK:
 			{
 				st.giveItems(CET_3_SHEET, 1);
-				st.playSound("ItemSound.quest_itemget");
+				st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
 				break;
 			}
 			case HEKATON_PRIME:
 			{
-				if (player.getParty() != null)
+				if (player.isInParty())
 				{
-					for (L2PcInstance party : player.getParty().getMembers())
+					for (L2PcInstance pl : player.getParty().getMembers())
 					{
-						rewardPlayer(party);
+						final QuestState qs = pl.getQuestState(getName());
+						
+						if ((qs != null) && qs.isCond(1))
+						{
+							qs.setCond(2, true);
+						}
 					}
-				}
-				else
-				{
-					rewardPlayer(player);
+					saveGlobalQuestVar("Respawn", Long.toString(System.currentTimeMillis() + RESPAWN_DELAY));
 				}
 				break;
 			}
 		}
-		return null;
-	}
-	
-	private void rewardPlayer(L2PcInstance player)
-	{
-		QuestState st = player.getQuestState(getName());
-		
-		if ((st != null) && (st.getInt("spawned") == 1))
-		{
-			st.playSound("ItemSound.quest_middle");
-			st.unset("spawned");
-			st.set("cond", "2");
-			st.saveGlobalQuestVar("Hekaton respawn", Long.toString(System.currentTimeMillis() + respawnDelay));
-		}
+		return super.onKill(npc, player, isPet);
 	}
 	
 	public Q00307_ControlDeviceOfTheGiants(int id, String name, String descr)
 	{
 		super(id, name, descr);
-		
 		addStartNpc(DROPH);
 		addTalkId(DROPH);
-		addKillId(GORGOLOS);
-		addKillId(LAST_TITAN_UTENUS);
-		addKillId(GIANT_MARPANAK);
-		addKillId(HEKATON_PRIME);
+		addKillId(GORGOLOS, LAST_TITAN_UTENUS, GIANT_MARPANAK, HEKATON_PRIME);
 	}
 	
 	public static void main(String[] args)
 	{
-		new Q00307_ControlDeviceOfTheGiants(307, Q00307_ControlDeviceOfTheGiants.class.getSimpleName(), "Control Device Of The Giants");
+		new Q00307_ControlDeviceOfTheGiants(307, Q00307_ControlDeviceOfTheGiants.class.getSimpleName(), "Control Device of the Giants");
 	}
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/sql/game/updates/20120927update.sql b/L2J_DataPack_BETA/dist/sql/game/updates/20120927update.sql
new file mode 100644
index 0000000000..cae18f968a
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/sql/game/updates/20120927update.sql
@@ -0,0 +1 @@
+DELETE FROM character_quest_global_data WHERE var = "Hekaton respawn";
\ No newline at end of file
-- 
GitLab