From 967656af810e8ee656a9173924d739d6667d8703 Mon Sep 17 00:00:00 2001
From: St3eT <St3eT@users.noreply.github.com>
Date: Sat, 14 Jun 2014 08:10:16 +0000
Subject: [PATCH] BETA: More retail-like entering/unlocking hellbound.

---
 .../hellbound/AI/NPC/Warpgate/32314.htm       |  4 -
 .../hellbound/AI/NPC/Warpgate/32315.htm       |  4 -
 .../hellbound/AI/NPC/Warpgate/32316.htm       |  4 -
 .../hellbound/AI/NPC/Warpgate/32317.htm       |  4 -
 .../hellbound/AI/NPC/Warpgate/32318.htm       |  4 -
 .../hellbound/AI/NPC/Warpgate/32319.htm       |  4 -
 .../{warpgate-locked.htm => Warpgate-01.html} |  0
 .../AI/NPC/Warpgate/Warpgate-02.html          |  4 +
 .../AI/NPC/Warpgate/Warpgate-03.html          |  3 +
 .../hellbound/AI/NPC/Warpgate/Warpgate.java   | 75 +++++++------------
 .../hellbound/AI/NPC/Warpgate/warpgate-no.htm |  3 -
 .../Q00133_ThatsBloodyHot.java                |  1 +
 12 files changed, 36 insertions(+), 74 deletions(-)
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32314.htm
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32315.htm
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32316.htm
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32317.htm
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32318.htm
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32319.htm
 rename L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/{warpgate-locked.htm => Warpgate-01.html} (100%)
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate-02.html
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate-03.html
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/warpgate-no.htm

diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32314.htm b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32314.htm
deleted file mode 100644
index ba1df373ed..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32314.htm
+++ /dev/null
@@ -1,4 +0,0 @@
-<html><body>Warpgate:<br>
-The Warpgate is not operational. Something seems to be needed to open it.<br>
-<a action="bypass -h npc_%objectId%_Quest Warpgate">Enter Hellbound Island.</a>
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32315.htm b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32315.htm
deleted file mode 100644
index 0fd5a37d8d..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32315.htm
+++ /dev/null
@@ -1,4 +0,0 @@
-<html><body>Warpgate:<br>
-The Warpgate is now operational.<br>
-<a action="bypass -h npc_%objectId%_Quest Warpgate">Enter Hellbound Island.</a>
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32316.htm b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32316.htm
deleted file mode 100644
index 0fd5a37d8d..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32316.htm
+++ /dev/null
@@ -1,4 +0,0 @@
-<html><body>Warpgate:<br>
-The Warpgate is now operational.<br>
-<a action="bypass -h npc_%objectId%_Quest Warpgate">Enter Hellbound Island.</a>
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32317.htm b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32317.htm
deleted file mode 100644
index 0fd5a37d8d..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32317.htm
+++ /dev/null
@@ -1,4 +0,0 @@
-<html><body>Warpgate:<br>
-The Warpgate is now operational.<br>
-<a action="bypass -h npc_%objectId%_Quest Warpgate">Enter Hellbound Island.</a>
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32318.htm b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32318.htm
deleted file mode 100644
index 0fd5a37d8d..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32318.htm
+++ /dev/null
@@ -1,4 +0,0 @@
-<html><body>Warpgate:<br>
-The Warpgate is now operational.<br>
-<a action="bypass -h npc_%objectId%_Quest Warpgate">Enter Hellbound Island.</a>
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32319.htm b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32319.htm
deleted file mode 100644
index 0fd5a37d8d..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/32319.htm
+++ /dev/null
@@ -1,4 +0,0 @@
-<html><body>Warpgate:<br>
-The Warpgate is now operational.<br>
-<a action="bypass -h npc_%objectId%_Quest Warpgate">Enter Hellbound Island.</a>
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/warpgate-locked.htm b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate-01.html
similarity index 100%
rename from L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/warpgate-locked.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate-01.html
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate-02.html b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate-02.html
new file mode 100644
index 0000000000..126c2640c7
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate-02.html
@@ -0,0 +1,4 @@
+<html><body>Warpgate:<br>
+The Warpgate is now operational.<br>
+<a action="bypass -h Quest Warpgate enter">Enter Hellbound Island.</a>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate-03.html b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate-03.html
new file mode 100644
index 0000000000..f5404b2c63
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate-03.html
@@ -0,0 +1,3 @@
+<html><body>Warp Gate:<br>
+You cannot enter the gate. Apparently some other requirement must be met.
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate.java
index cca2107f42..cafc24c7bb 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate.java
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate.java
@@ -47,13 +47,14 @@ public final class Warpgate extends AbstractNpcAI
 		32316,
 		32317,
 		32318,
-		32319
+		32319,
 	};
 	// Locations
-	private static final Location HELLBOUND = new Location(-11272, 236464, -3248);
-	protected static final Location REMOVE_LOC = new Location(-16555, 209375, -3670);
-	// Misc
+	private static final Location ENTER_LOC = new Location(-11272, 236464, -3248);
+	private static final Location REMOVE_LOC = new Location(-16555, 209375, -3670);
+	// Item
 	private static final int MAP = 9994;
+	// Misc
 	private static final int ZONE = 40101;
 	
 	public Warpgate()
@@ -68,7 +69,18 @@ public final class Warpgate extends AbstractNpcAI
 	@Override
 	public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
 	{
-		if (event.equals("TELEPORT"))
+		if (event.equals("enter"))
+		{
+			if (canEnter(player))
+			{
+				player.teleToLocation(ENTER_LOC, true);
+			}
+			else
+			{
+				return "Warpgate-03.html";
+			}
+		}
+		else if (event.equals("TELEPORT"))
 		{
 			player.teleToLocation(REMOVE_LOC, true);
 		}
@@ -78,30 +90,7 @@ public final class Warpgate extends AbstractNpcAI
 	@Override
 	public String onFirstTalk(L2Npc npc, L2PcInstance player)
 	{
-		if (!canEnter(player))
-		{
-			if (HellboundEngine.getInstance().isLocked())
-			{
-				return "warpgate-locked.htm";
-			}
-		}
-		return npc.getId() + ".htm";
-	}
-	
-	@Override
-	public String onTalk(L2Npc npc, L2PcInstance player)
-	{
-		if (!canEnter(player))
-		{
-			return "warpgate-no.htm";
-		}
-		player.teleToLocation(HELLBOUND, true);
-		
-		if (HellboundEngine.getInstance().isLocked())
-		{
-			HellboundEngine.getInstance().setLevel(1);
-		}
-		return super.onTalk(npc, player);
+		return HellboundEngine.getInstance().isLocked() ? "Warpgate-01.html" : "Warpgate-02.html";
 	}
 	
 	@Override
@@ -109,16 +98,15 @@ public final class Warpgate extends AbstractNpcAI
 	{
 		if (character.isPlayer())
 		{
-			if (!canEnter(character.getActingPlayer()) && !character.canOverrideCond(PcCondOverride.ZONE_CONDITIONS))
+			final L2PcInstance player = character.getActingPlayer();
+			
+			if (!canEnter(player) && !player.canOverrideCond(PcCondOverride.ZONE_CONDITIONS) && !player.isOnEvent())
 			{
-				startQuestTimer("TELEPORT", 1000, null, (L2PcInstance) character);
+				startQuestTimer("TELEPORT", 1000, null, player);
 			}
-			else if (!character.getActingPlayer().isMinimapAllowed())
+			else if (!player.isMinimapAllowed() && hasAtLeastOneQuestItem(player, MAP))
 			{
-				if (character.getInventory().getItemByItemId(MAP) != null)
-				{
-					character.getActingPlayer().setMinimapAllowed(true);
-				}
+				player.setMinimapAllowed(true);
 			}
 		}
 		return super.onEnterZone(character, zone);
@@ -136,16 +124,9 @@ public final class Warpgate extends AbstractNpcAI
 			return true;
 		}
 		
-		QuestState st;
-		if (!HellboundEngine.getInstance().isLocked())
-		{
-			st = player.getQuestState(Q00130_PathToHellbound.class.getSimpleName());
-			if ((st != null) && st.isCompleted())
-			{
-				return true;
-			}
-		}
-		st = player.getQuestState(Q00133_ThatsBloodyHot.class.getSimpleName());
-		return ((st != null) && st.isCompleted());
+		final QuestState path_to_hellbound_st = player.getQuestState(Q00130_PathToHellbound.class.getSimpleName());
+		final QuestState thats_bloody_hot_st = player.getQuestState(Q00133_ThatsBloodyHot.class.getSimpleName());
+		
+		return (((path_to_hellbound_st != null) && path_to_hellbound_st.isCompleted()) || ((thats_bloody_hot_st != null) && thats_bloody_hot_st.isCompleted()));
 	}
 }
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/warpgate-no.htm b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/warpgate-no.htm
deleted file mode 100644
index 9fd5a7c142..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/warpgate-no.htm
+++ /dev/null
@@ -1,3 +0,0 @@
-<html><body>Warp Gate:<br>
-You cannot enter the gate. Apparently some other requirements must be met.
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00133_ThatsBloodyHot/Q00133_ThatsBloodyHot.java b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00133_ThatsBloodyHot/Q00133_ThatsBloodyHot.java
index 96bf6b7230..625eeac6cf 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00133_ThatsBloodyHot/Q00133_ThatsBloodyHot.java
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00133_ThatsBloodyHot/Q00133_ThatsBloodyHot.java
@@ -136,6 +136,7 @@ public class Q00133_ThatsBloodyHot extends Quest
 					}
 					else
 					{
+						HellboundEngine.getInstance().setLevel(1);
 						st.giveAdena(254247, true);
 						st.addExpAndSp(325881, 32524);
 						st.exitQuest(false, true);
-- 
GitLab