浏览代码

BETA: Instance fixes:
* Unhardcoded some HTMLs.
* Renamed `INSTNACEID` to `TEMPLATE_ID`.
* Fixed missuse of template ID and instance ID in multiple instances.
* Fixed Ranku, Demon Prince, Urban Area, Monastery Of Silence, Library Of Sages.

Reported by: !FinalDestination, !CostyKiller, JOJO

Zoey76 11 年之前
父节点
当前提交
cbebaac93d
共有 28 个文件被更改,包括 216 次插入234 次删除
  1. 26 22
      L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java
  2. 26 23
      L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java
  3. 17 18
      L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java
  4. 4 4
      L2J_DataPack_BETA/dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java
  5. 5 5
      L2J_DataPack_BETA/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java
  6. 8 13
      L2J_DataPack_BETA/dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java
  7. 2 2
      L2J_DataPack_BETA/dist/game/data/scripts/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java
  8. 2 2
      L2J_DataPack_BETA/dist/game/data/scripts/instances/ElcadiasTent/ElcadiasTent.java
  9. 6 7
      L2J_DataPack_BETA/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java
  10. 2 2
      L2J_DataPack_BETA/dist/game/data/scripts/instances/HideoutOfTheDawn/HideoutOfTheDawn.java
  11. 2 2
      L2J_DataPack_BETA/dist/game/data/scripts/instances/IceQueensCastle/IceQueensCastle.java
  12. 9 9
      L2J_DataPack_BETA/dist/game/data/scripts/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java
  13. 7 8
      L2J_DataPack_BETA/dist/game/data/scripts/instances/JiniaGuildHideout1/JiniaGuildHideout1.java
  14. 2 2
      L2J_DataPack_BETA/dist/game/data/scripts/instances/JiniaGuildHideout2/JiniaGuildHideout2.java
  15. 2 2
      L2J_DataPack_BETA/dist/game/data/scripts/instances/JiniaGuildHideout3/JiniaGuildHideout3.java
  16. 2 2
      L2J_DataPack_BETA/dist/game/data/scripts/instances/JiniaGuildHideout4/JiniaGuildHideout4.java
  17. 9 26
      L2J_DataPack_BETA/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java
  18. 12 12
      L2J_DataPack_BETA/dist/game/data/scripts/instances/LibraryOfSages/LibraryOfSages.java
  19. 2 2
      L2J_DataPack_BETA/dist/game/data/scripts/instances/MithrilMine/MithrilMine.java
  20. 28 28
      L2J_DataPack_BETA/dist/game/data/scripts/instances/MonasteryOfSilence1/MonasteryOfSilence1.java
  21. 4 4
      L2J_DataPack_BETA/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java
  22. 3 3
      L2J_DataPack_BETA/dist/game/data/scripts/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java
  23. 3 3
      L2J_DataPack_BETA/dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java
  24. 2 2
      L2J_DataPack_BETA/dist/game/data/scripts/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java
  25. 3 0
      L2J_DataPack_BETA/dist/game/data/scripts/instances/SecretArea/32566-01.html
  26. 3 0
      L2J_DataPack_BETA/dist/game/data/scripts/instances/SecretArea/32567-01.html
  27. 21 26
      L2J_DataPack_BETA/dist/game/data/scripts/instances/SecretArea/SecretArea.java
  28. 4 5
      L2J_DataPack_BETA/dist/game/data/scripts/instances/SeedOfInfinity/HallOfSuffering.java

+ 26 - 22
L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java

@@ -40,6 +40,11 @@ import com.l2jserver.gameserver.util.Util;
  */
  */
 public final class DemonPrinceFloor extends AbstractNpcAI
 public final class DemonPrinceFloor extends AbstractNpcAI
 {
 {
+	protected class DPFWorld extends InstanceWorld
+	{
+		
+	}
+	
 	// NPCs
 	// NPCs
 	private static final int GK_4 = 32748;
 	private static final int GK_4 = 32748;
 	private static final int CUBE = 32375;
 	private static final int CUBE = 32375;
@@ -47,7 +52,7 @@ public final class DemonPrinceFloor extends AbstractNpcAI
 	// Item
 	// Item
 	private static final int SEAL_BREAKER_5 = 15515;
 	private static final int SEAL_BREAKER_5 = 15515;
 	// Misc
 	// Misc
-	private static final int INSTANCEID = 142; // this is the client number
+	private static final int TEMPLATE_ID = 142;
 	private static final int RESET_HOUR = 6;
 	private static final int RESET_HOUR = 6;
 	private static final int RESET_MIN = 30;
 	private static final int RESET_MIN = 30;
 	private static final Location ENTRY_POINT = new Location(-22208, 277056, -8239);
 	private static final Location ENTRY_POINT = new Location(-22208, 277056, -8239);
@@ -79,7 +84,7 @@ public final class DemonPrinceFloor extends AbstractNpcAI
 		else if (npc.getId() == CUBE)
 		else if (npc.getId() == CUBE)
 		{
 		{
 			InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId());
 			InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId());
-			if ((world != null) && (world.getInstanceId() == INSTANCEID))
+			if (world instanceof DPFWorld)
 			{
 			{
 				world.removeAllowed(player.getObjectId());
 				world.removeAllowed(player.getObjectId());
 				teleportPlayer(player, EXIT_POINT, 0);
 				teleportPlayer(player, EXIT_POINT, 0);
@@ -106,7 +111,7 @@ public final class DemonPrinceFloor extends AbstractNpcAI
 			
 			
 			inst.setEmptyDestroyTime(0);
 			inst.setEmptyDestroyTime(0);
 			
 			
-			if ((world != null) && (world.getInstanceId() == INSTANCEID))
+			if (world instanceof DPFWorld)
 			{
 			{
 				setReenterTime(world);
 				setReenterTime(world);
 			}
 			}
@@ -170,7 +175,7 @@ public final class DemonPrinceFloor extends AbstractNpcAI
 				return false;
 				return false;
 			}
 			}
 			
 			
-			Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), INSTANCEID);
+			Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID);
 			if (System.currentTimeMillis() < reentertime)
 			if (System.currentTimeMillis() < reentertime)
 			{
 			{
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
@@ -190,48 +195,47 @@ public final class DemonPrinceFloor extends AbstractNpcAI
 		return true;
 		return true;
 	}
 	}
 	
 	
-	private int enterInstance(L2PcInstance player, String template)
+	private void enterInstance(L2PcInstance player, String template)
 	{
 	{
-		int instanceId = 0;
-		// check for existing instances for this player
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
-		// existing instance
+		
 		if (world != null)
 		if (world != null)
 		{
 		{
-			if ((world.getInstanceId() != INSTANCEID))
+			if (world instanceof DPFWorld)
 			{
 			{
-				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
-				return 0;
+				teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
+				return;
 			}
 			}
-			teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
-			return world.getInstanceId();
+			player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
+			return;
 		}
 		}
 		
 		
 		if (!checkTeleport(player))
 		if (!checkTeleport(player))
 		{
 		{
-			return 0;
+			return;
 		}
 		}
 		
 		
-		instanceId = InstanceManager.getInstance().createDynamicInstance(template);
-		world = new InstanceWorld();
-		world.setInstanceId(instanceId);
-		world.setTemplateId(INSTANCEID);
+		world = new DPFWorld();
+		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
+		world.setTemplateId(TEMPLATE_ID);
+		world.addAllowed(player.getObjectId());
 		world.setStatus(0);
 		world.setStatus(0);
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);
-		_log.info("Tower of Infinitum - Demon Prince floor started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
+		teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
+		
+		_log.info("Tower of Infinitum - Demon Prince floor started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
 		
 		
 		for (L2PcInstance partyMember : player.getParty().getMembers())
 		for (L2PcInstance partyMember : player.getParty().getMembers())
 		{
 		{
-			teleportPlayer(partyMember, ENTRY_POINT, instanceId);
+			teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId());
 			partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_5, 1, null, true);
 			partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_5, 1, null, true);
 			world.addAllowed(partyMember.getObjectId());
 			world.addAllowed(partyMember.getObjectId());
 		}
 		}
-		return instanceId;
 	}
 	}
 	
 	
 	public void setReenterTime(InstanceWorld world)
 	public void setReenterTime(InstanceWorld world)
 	{
 	{
-		if (world.getInstanceId() == INSTANCEID)
+		if (world instanceof DPFWorld)
 		{
 		{
 			// Reenter time should be cleared every Wed and Sat at 6:30 AM, so we set next suitable
 			// Reenter time should be cleared every Wed and Sat at 6:30 AM, so we set next suitable
 			Calendar reenter;
 			Calendar reenter;

+ 26 - 23
L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java

@@ -40,6 +40,11 @@ import com.l2jserver.gameserver.util.Util;
  */
  */
 public final class RankuFloor extends AbstractNpcAI
 public final class RankuFloor extends AbstractNpcAI
 {
 {
+	protected class RFWorld extends InstanceWorld
+	{
+		
+	}
+	
 	// NPCs
 	// NPCs
 	private static final int GK_9 = 32752;
 	private static final int GK_9 = 32752;
 	private static final int CUBE = 32374;
 	private static final int CUBE = 32374;
@@ -47,7 +52,7 @@ public final class RankuFloor extends AbstractNpcAI
 	// Item
 	// Item
 	private static final int SEAL_BREAKER_10 = 15516;
 	private static final int SEAL_BREAKER_10 = 15516;
 	// Misc
 	// Misc
-	private static final int INSTANCEID = 143; // this is the client number
+	private static final int TEMPLATE_ID = 143;
 	private static final int RESET_HOUR = 6;
 	private static final int RESET_HOUR = 6;
 	private static final int RESET_MIN = 30;
 	private static final int RESET_MIN = 30;
 	private static final Location ENTRY_POINT = new Location(-19008, 277024, -15000);
 	private static final Location ENTRY_POINT = new Location(-19008, 277024, -15000);
@@ -80,7 +85,7 @@ public final class RankuFloor extends AbstractNpcAI
 		else if (npc.getId() == CUBE)
 		else if (npc.getId() == CUBE)
 		{
 		{
 			final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId());
 			final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId());
-			if ((world != null) && (world.getInstanceId() == INSTANCEID))
+			if (world instanceof RFWorld)
 			{
 			{
 				world.removeAllowed(player.getObjectId());
 				world.removeAllowed(player.getObjectId());
 				teleportPlayer(player, EXIT_POINT, 0);
 				teleportPlayer(player, EXIT_POINT, 0);
@@ -107,7 +112,7 @@ public final class RankuFloor extends AbstractNpcAI
 			
 			
 			inst.setEmptyDestroyTime(0);
 			inst.setEmptyDestroyTime(0);
 			
 			
-			if ((world != null) && (world.getInstanceId() == INSTANCEID))
+			if (world instanceof RFWorld)
 			{
 			{
 				setReenterTime(world);
 				setReenterTime(world);
 			}
 			}
@@ -172,7 +177,7 @@ public final class RankuFloor extends AbstractNpcAI
 				return false;
 				return false;
 			}
 			}
 			
 			
-			final Long reenterTime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), INSTANCEID);
+			final Long reenterTime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID);
 			if (System.currentTimeMillis() < reenterTime)
 			if (System.currentTimeMillis() < reenterTime)
 			{
 			{
 				final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
 				final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
@@ -192,49 +197,47 @@ public final class RankuFloor extends AbstractNpcAI
 		return true;
 		return true;
 	}
 	}
 	
 	
-	private int enterInstance(L2PcInstance player, String template)
+	private void enterInstance(L2PcInstance player, String template)
 	{
 	{
-		int instanceId = 0;
-		// check for existing instances for this player
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
-		// existing instance
+		
 		if (world != null)
 		if (world != null)
 		{
 		{
-			if (world.getInstanceId() != INSTANCEID)
+			if (world instanceof RFWorld)
 			{
 			{
-				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
-				return 0;
+				teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
+				return;
 			}
 			}
-			teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
-			return world.getInstanceId();
+			player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
+			return;
 		}
 		}
 		
 		
 		if (!checkTeleport(player))
 		if (!checkTeleport(player))
 		{
 		{
-			return 0;
+			return;
 		}
 		}
 		
 		
-		instanceId = InstanceManager.getInstance().createDynamicInstance(template);
-		world = new InstanceWorld();
-		world.setInstanceId(instanceId);
-		world.setTemplateId(INSTANCEID);
+		world = new RFWorld();
+		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
+		world.setTemplateId(TEMPLATE_ID);
+		world.addAllowed(player.getObjectId());
 		world.setStatus(0);
 		world.setStatus(0);
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);
-		_log.info("Tower of Infinitum - Ranku floor started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
+		teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
+		
+		_log.info("Tower of Infinitum - Ranku floor started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
 		
 		
 		for (L2PcInstance partyMember : player.getParty().getMembers())
 		for (L2PcInstance partyMember : player.getParty().getMembers())
 		{
 		{
-			teleportPlayer(partyMember, ENTRY_POINT, instanceId);
+			teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId());
 			partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_10, 1, null, true);
 			partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_10, 1, null, true);
 			world.addAllowed(partyMember.getObjectId());
 			world.addAllowed(partyMember.getObjectId());
 		}
 		}
-		
-		return instanceId;
 	}
 	}
 	
 	
 	public void setReenterTime(InstanceWorld world)
 	public void setReenterTime(InstanceWorld world)
 	{
 	{
-		if (world.getInstanceId() == INSTANCEID)
+		if (world instanceof RFWorld)
 		{
 		{
 			// Reenter time should be cleared every Wed and Sat at 6:30 AM, so we set next suitable
 			// Reenter time should be cleared every Wed and Sat at 6:30 AM, so we set next suitable
 			Calendar reenter;
 			Calendar reenter;

+ 17 - 18
L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java

@@ -56,7 +56,7 @@ public final class UrbanArea extends AbstractNpcAI
 		public boolean isAmaskariDead = false;
 		public boolean isAmaskariDead = false;
 	}
 	}
 	
 	
-	private static final int INSTANCEID = 2;
+	private static final int TEMPLATE_ID = 2;
 	
 	
 	private static final NpcStringId[] NPCSTRING_ID =
 	private static final NpcStringId[] NPCSTRING_ID =
 	{
 	{
@@ -385,44 +385,43 @@ public final class UrbanArea extends AbstractNpcAI
 		return true;
 		return true;
 	}
 	}
 	
 	
-	private int enterInstance(L2PcInstance player, String template)
+	private void enterInstance(L2PcInstance player, String template)
 	{
 	{
-		int instanceId = 0;
-		// check for existing instances for this player
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
-		// existing instance
+		
 		if (world != null)
 		if (world != null)
 		{
 		{
-			if (!(world instanceof UrbanAreaWorld))
+			if (world instanceof UrbanAreaWorld)
 			{
 			{
-				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
-				return 0;
+				teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
+				return;
 			}
 			}
-			teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
-			return world.getInstanceId();
+			player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
+			return;
 		}
 		}
 		
 		
 		if (!checkTeleport(player))
 		if (!checkTeleport(player))
 		{
 		{
-			return 0;
+			return;
 		}
 		}
 		
 		
-		instanceId = InstanceManager.getInstance().createDynamicInstance(template);
 		world = new UrbanAreaWorld();
 		world = new UrbanAreaWorld();
-		world.setInstanceId(instanceId);
-		world.setTemplateId(INSTANCEID);
+		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
+		world.setTemplateId(TEMPLATE_ID);
+		world.addAllowed(player.getObjectId());
 		world.setStatus(0);
 		world.setStatus(0);
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);
-		_log.info("Hellbound Town started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
+		teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
+		
+		_log.info("Hellbound Town started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
 		
 		
 		for (L2PcInstance partyMember : player.getParty().getMembers())
 		for (L2PcInstance partyMember : player.getParty().getMembers())
 		{
 		{
-			teleportPlayer(partyMember, ENTRY_POINT, instanceId);
+			teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId());
 			world.addAllowed(partyMember.getObjectId());
 			world.addAllowed(partyMember.getObjectId());
 		}
 		}
 		
 		
-		((UrbanAreaWorld) world).spawnedAmaskari = (L2MonsterInstance) addSpawn(AMASKARI, AMASKARI_SPAWN_POINT, false, 0, false, instanceId);
-		return instanceId;
+		((UrbanAreaWorld) world).spawnedAmaskari = (L2MonsterInstance) addSpawn(AMASKARI, AMASKARI_SPAWN_POINT, false, 0, false, world.getInstanceId());
 	}
 	}
 	
 	
 	private static class CallAmaskari implements Runnable
 	private static class CallAmaskari implements Runnable

+ 4 - 4
L2J_DataPack_BETA/dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java

@@ -129,8 +129,8 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
 	private static final int PLAYERS_60_MAX = 27;
 	private static final int PLAYERS_60_MAX = 27;
 	private static final int PLAYERS_83_MIN = 9;
 	private static final int PLAYERS_83_MIN = 9;
 	private static final int PLAYERS_83_MAX = 27;
 	private static final int PLAYERS_83_MAX = 27;
-	private static final int INSTANCE_ID_60 = 133;
-	private static final int INSTANCE_ID_83 = 135;
+	private static final int TEMPLATE_ID_60 = 133;
+	private static final int TEMPLATE_ID_83 = 135;
 	private static final int HOURS = 6;
 	private static final int HOURS = 6;
 	private static final int MINUTES = 30;
 	private static final int MINUTES = 30;
 	private static final int DAY_A = Calendar.MONDAY;
 	private static final int DAY_A = Calendar.MONDAY;
@@ -188,7 +188,7 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
 		{
 		{
 			world = new CavernOfThePirateCaptainWorld();
 			world = new CavernOfThePirateCaptainWorld();
 			world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 			world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-			world.setTemplateId(is83 ? INSTANCE_ID_83 : INSTANCE_ID_60);
+			world.setTemplateId(is83 ? TEMPLATE_ID_83 : TEMPLATE_ID_60);
 			world.setStatus(0);
 			world.setStatus(0);
 			InstanceManager.getInstance().addWorld(world);
 			InstanceManager.getInstance().addWorld(world);
 			final CavernOfThePirateCaptainWorld curworld = (CavernOfThePirateCaptainWorld) world;
 			final CavernOfThePirateCaptainWorld curworld = (CavernOfThePirateCaptainWorld) world;
@@ -276,7 +276,7 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
 				return false;
 				return false;
 			}
 			}
 			
 			
-			final Long reentertime = InstanceManager.getInstance().getInstanceTime(groupMembers.getObjectId(), (is83 ? INSTANCE_ID_83 : INSTANCE_ID_60));
+			final Long reentertime = InstanceManager.getInstance().getInstanceTime(groupMembers.getObjectId(), (is83 ? TEMPLATE_ID_83 : TEMPLATE_ID_60));
 			if (System.currentTimeMillis() < reentertime)
 			if (System.currentTimeMillis() < reentertime)
 			{
 			{
 				broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_MAY_NOT_REENTER_YET, true);
 				broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_MAY_NOT_REENTER_YET, true);

+ 5 - 5
L2J_DataPack_BETA/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java

@@ -127,7 +127,7 @@ public final class CrystalCaverns extends Quest
 		}
 		}
 	}
 	}
 	
 	
-	private static final int INSTANCEID = 10; // this is the client number
+	private static final int TEMPLATE_ID = 10;
 	private static final boolean debug = false;
 	private static final boolean debug = false;
 	
 	
 	// Items
 	// Items
@@ -1517,7 +1517,7 @@ public final class CrystalCaverns extends Quest
 				party.broadcastPacket(sm);
 				party.broadcastPacket(sm);
 				return false;
 				return false;
 			}
 			}
-			Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), INSTANCEID);
+			Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID);
 			if (System.currentTimeMillis() < reentertime)
 			if (System.currentTimeMillis() < reentertime)
 			{
 			{
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
@@ -1680,7 +1680,7 @@ public final class CrystalCaverns extends Quest
 		int instanceId = InstanceManager.getInstance().createDynamicInstance(template);
 		int instanceId = InstanceManager.getInstance().createDynamicInstance(template);
 		world = new CCWorld(System.currentTimeMillis() + 5400000);
 		world = new CCWorld(System.currentTimeMillis() + 5400000);
 		world.setInstanceId(instanceId);
 		world.setInstanceId(instanceId);
-		world.setTemplateId(INSTANCEID);
+		world.setTemplateId(TEMPLATE_ID);
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);
 		_log.info("Crystal Caverns started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
 		_log.info("Crystal Caverns started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
 		runOracle((CCWorld) world);
 		runOracle((CCWorld) world);
@@ -1689,7 +1689,7 @@ public final class CrystalCaverns extends Quest
 		{
 		{
 			// this can happen only if debug is true
 			// this can happen only if debug is true
 			player.sendMessage("Welcome to Crystal Caverns.");
 			player.sendMessage("Welcome to Crystal Caverns.");
-			InstanceManager.getInstance().setInstanceTime(player.getObjectId(), INSTANCEID, ((System.currentTimeMillis() + INSTANCEPENALTY)));
+			InstanceManager.getInstance().setInstanceTime(player.getObjectId(), TEMPLATE_ID, ((System.currentTimeMillis() + INSTANCEPENALTY)));
 			teleportPlayer(player, loc, world.getInstanceId());
 			teleportPlayer(player, loc, world.getInstanceId());
 			world.isAllowed(player.getObjectId());
 			world.isAllowed(player.getObjectId());
 		}
 		}
@@ -1698,7 +1698,7 @@ public final class CrystalCaverns extends Quest
 			for (L2PcInstance partyMember : party.getMembers())
 			for (L2PcInstance partyMember : party.getMembers())
 			{
 			{
 				partyMember.sendMessage("Welcome to Crystal Caverns.");
 				partyMember.sendMessage("Welcome to Crystal Caverns.");
-				InstanceManager.getInstance().setInstanceTime(partyMember.getObjectId(), INSTANCEID, ((System.currentTimeMillis() + INSTANCEPENALTY)));
+				InstanceManager.getInstance().setInstanceTime(partyMember.getObjectId(), TEMPLATE_ID, ((System.currentTimeMillis() + INSTANCEPENALTY)));
 				teleportPlayer(partyMember, loc, world.getInstanceId());
 				teleportPlayer(partyMember, loc, world.getInstanceId());
 				world.addAllowed(partyMember.getObjectId());
 				world.addAllowed(partyMember.getObjectId());
 			}
 			}

+ 8 - 13
L2J_DataPack_BETA/dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java

@@ -43,7 +43,7 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  */
  */
 public final class DarkCloudMansion extends Quest
 public final class DarkCloudMansion extends Quest
 {
 {
-	private static final int INSTANCEID = 9;
+	private static final int TEMPLATE_ID = 9;
 	
 	
 	private static boolean debug = false;
 	private static boolean debug = false;
 	private static boolean noRndWalk = true;
 	private static boolean noRndWalk = true;
@@ -525,32 +525,29 @@ public final class DarkCloudMansion extends Quest
 		return true;
 		return true;
 	}
 	}
 	
 	
-	protected int enterInstance(L2PcInstance player, String template, Location loc)
+	protected void enterInstance(L2PcInstance player, String template, Location loc)
 	{
 	{
-		int instanceId = 0;
-		// check for existing instances for this player
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
-		// existing instance
 		if (world != null)
 		if (world != null)
 		{
 		{
 			if (!(world instanceof DMCWorld))
 			if (!(world instanceof DMCWorld))
 			{
 			{
 				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
 				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
-				return 0;
+				return;
 			}
 			}
 			teleportPlayer(player, loc, world.getInstanceId());
 			teleportPlayer(player, loc, world.getInstanceId());
-			return instanceId;
+			return;
 		}
 		}
-		// New instance
+		
 		if (!checkConditions(player))
 		if (!checkConditions(player))
 		{
 		{
-			return 0;
+			return;
 		}
 		}
 		L2Party party = player.getParty();
 		L2Party party = player.getParty();
-		instanceId = InstanceManager.getInstance().createDynamicInstance(template);
+		final int instanceId = InstanceManager.getInstance().createDynamicInstance(template);
 		world = new DMCWorld();
 		world = new DMCWorld();
 		world.setInstanceId(instanceId);
 		world.setInstanceId(instanceId);
-		world.setTemplateId(INSTANCEID);
+		world.setTemplateId(TEMPLATE_ID);
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);
 		_log.info("DarkCloudMansion: started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
 		_log.info("DarkCloudMansion: started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
 		runStartRoom((DMCWorld) world);
 		runStartRoom((DMCWorld) world);
@@ -572,8 +569,6 @@ public final class DarkCloudMansion extends Quest
 				teleportPlayer(partyMember, loc, instanceId);
 				teleportPlayer(partyMember, loc, instanceId);
 			}
 			}
 		}
 		}
-		
-		return instanceId;
 	}
 	}
 	
 	
 	protected void runStartRoom(DMCWorld world)
 	protected void runStartRoom(DMCWorld world)

+ 2 - 2
L2J_DataPack_BETA/dist/game/data/scripts/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java

@@ -54,7 +54,7 @@ public final class DisciplesNecropolisPast extends Quest
 	}
 	}
 	
 	
 	// Instance
 	// Instance
-	private static final int INSTANCEID = 112;
+	private static final int TEMPLATE_ID = 112;
 	// NPCs
 	// NPCs
 	private static final int SEAL_DEVICE = 27384;
 	private static final int SEAL_DEVICE = 27384;
 	private static final int PROMISE_OF_MAMMON = 32585;
 	private static final int PROMISE_OF_MAMMON = 32585;
@@ -196,7 +196,7 @@ public final class DisciplesNecropolisPast extends Quest
 		// New instance
 		// New instance
 		world = new DNPWorld();
 		world = new DNPWorld();
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-		world.setTemplateId(INSTANCEID);
+		world.setTemplateId(TEMPLATE_ID);
 		world.setStatus(0);
 		world.setStatus(0);
 		((DNPWorld) world).storeTime = System.currentTimeMillis();
 		((DNPWorld) world).storeTime = System.currentTimeMillis();
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);

+ 2 - 2
L2J_DataPack_BETA/dist/game/data/scripts/instances/ElcadiasTent/ElcadiasTent.java

@@ -42,7 +42,7 @@ public final class ElcadiasTent extends AbstractNpcAI
 		
 		
 	}
 	}
 	
 	
-	private static final int INSTANCEID = 158;
+	private static final int TEMPLATE_ID = 158;
 	// NPCs
 	// NPCs
 	private static final int ELCADIA = 32784;
 	private static final int ELCADIA = 32784;
 	private static final int GRUFF_LOOKING_MAN = 32862;
 	private static final int GRUFF_LOOKING_MAN = 32862;
@@ -107,7 +107,7 @@ public final class ElcadiasTent extends AbstractNpcAI
 			// New instance.
 			// New instance.
 			world = new ETWorld();
 			world = new ETWorld();
 			world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 			world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-			world.setTemplateId(INSTANCEID);
+			world.setTemplateId(TEMPLATE_ID);
 			world.setStatus(0);
 			world.setStatus(0);
 			InstanceManager.getInstance().addWorld(world);
 			InstanceManager.getInstance().addWorld(world);
 			_log.info("Elcadia's Tent started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
 			_log.info("Elcadia's Tent started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());

+ 6 - 7
L2J_DataPack_BETA/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java

@@ -142,7 +142,7 @@ public final class FinalEmperialTomb extends Quest
 		}
 		}
 	}
 	}
 	
 	
-	private static final int INSTANCEID = 136; // this is the client number
+	private static final int TEMPLATE_ID = 136; // this is the client number
 	private static final int MIN_PLAYERS = 36;
 	private static final int MIN_PLAYERS = 36;
 	private static final int MAX_PLAYERS = 45;
 	private static final int MAX_PLAYERS = 45;
 	private static final boolean debug = false;
 	private static final boolean debug = false;
@@ -583,7 +583,7 @@ public final class FinalEmperialTomb extends Quest
 				party.broadcastPacket(sm);
 				party.broadcastPacket(sm);
 				return false;
 				return false;
 			}
 			}
-			Long reentertime = InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), INSTANCEID);
+			Long reentertime = InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID);
 			if (System.currentTimeMillis() < reentertime)
 			if (System.currentTimeMillis() < reentertime)
 			{
 			{
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
@@ -597,7 +597,6 @@ public final class FinalEmperialTomb extends Quest
 	
 	
 	protected int enterInstance(L2PcInstance player, String template, Location loc)
 	protected int enterInstance(L2PcInstance player, String template, Location loc)
 	{
 	{
-		int instanceId = 0;
 		// check for existing instances for this player
 		// check for existing instances for this player
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		// existing instance
 		// existing instance
@@ -621,11 +620,11 @@ public final class FinalEmperialTomb extends Quest
 		{
 		{
 			return 0;
 			return 0;
 		}
 		}
-		instanceId = InstanceManager.getInstance().createDynamicInstance(template);
+		final int instanceId = InstanceManager.getInstance().createDynamicInstance(template);
 		// Instance ins = InstanceManager.getInstance().getInstance(instanceId);
 		// Instance ins = InstanceManager.getInstance().getInstance(instanceId);
 		// ins.setSpawnLoc(new int[]{player.getX(),player.getY(),player.getZ()});
 		// ins.setSpawnLoc(new int[]{player.getX(),player.getY(),player.getZ()});
 		world = new FETWorld();
 		world = new FETWorld();
-		world.setTemplateId(INSTANCEID);
+		world.setTemplateId(TEMPLATE_ID);
 		world.setInstanceId(instanceId);
 		world.setInstanceId(instanceId);
 		world.setStatus(0);
 		world.setStatus(0);
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);
@@ -1430,13 +1429,13 @@ public final class FinalEmperialTomb extends Quest
 		}
 		}
 		
 		
 		SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED);
 		SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED);
-		sm.addInstanceName(INSTANCEID);
+		sm.addInstanceName(TEMPLATE_ID);
 		
 		
 		// set instance reenter time for all allowed players
 		// set instance reenter time for all allowed players
 		for (int objectId : world.getAllowed())
 		for (int objectId : world.getAllowed())
 		{
 		{
 			L2PcInstance player = L2World.getInstance().getPlayer(objectId);
 			L2PcInstance player = L2World.getInstance().getPlayer(objectId);
-			InstanceManager.getInstance().setInstanceTime(objectId, INSTANCEID, reenter.getTimeInMillis());
+			InstanceManager.getInstance().setInstanceTime(objectId, TEMPLATE_ID, reenter.getTimeInMillis());
 			if ((player != null) && player.isOnline())
 			if ((player != null) && player.isOnline())
 			{
 			{
 				player.sendPacket(sm);
 				player.sendPacket(sm);

+ 2 - 2
L2J_DataPack_BETA/dist/game/data/scripts/instances/HideoutOfTheDawn/HideoutOfTheDawn.java

@@ -38,7 +38,7 @@ public final class HideoutOfTheDawn extends Quest
 		long storeTime = 0;
 		long storeTime = 0;
 	}
 	}
 	
 	
-	private static final int INSTANCEID = 113;
+	private static final int TEMPLATE_ID = 113;
 	// NPCs
 	// NPCs
 	private static final int WOOD = 32593;
 	private static final int WOOD = 32593;
 	private static final int JAINA = 32617;
 	private static final int JAINA = 32617;
@@ -94,7 +94,7 @@ public final class HideoutOfTheDawn extends Quest
 		// New instance
 		// New instance
 		world = new HotDWorld();
 		world = new HotDWorld();
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-		world.setTemplateId(INSTANCEID);
+		world.setTemplateId(TEMPLATE_ID);
 		world.setStatus(0);
 		world.setStatus(0);
 		((HotDWorld) world).storeTime = System.currentTimeMillis();
 		((HotDWorld) world).storeTime = System.currentTimeMillis();
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);

+ 2 - 2
L2J_DataPack_BETA/dist/game/data/scripts/instances/IceQueensCastle/IceQueensCastle.java

@@ -61,7 +61,7 @@ public final class IceQueensCastle extends AbstractNpcAI
 	// Skill
 	// Skill
 	private static SkillHolder ETHERNAL_BLIZZARD = new SkillHolder(6276, 1);
 	private static SkillHolder ETHERNAL_BLIZZARD = new SkillHolder(6276, 1);
 	// Misc
 	// Misc
-	private static final int INSTANCEID = 137;
+	private static final int TEMPLATE_ID = 137;
 	private static final int ICE_QUEEN_DOOR = 23140101;
 	private static final int ICE_QUEEN_DOOR = 23140101;
 	private static final int MIN_LV = 82;
 	private static final int MIN_LV = 82;
 	
 	
@@ -210,7 +210,7 @@ public final class IceQueensCastle extends AbstractNpcAI
 		{
 		{
 			world = new IQCWorld();
 			world = new IQCWorld();
 			world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 			world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-			world.setTemplateId(INSTANCEID);
+			world.setTemplateId(TEMPLATE_ID);
 			world.setStatus(0);
 			world.setStatus(0);
 			InstanceManager.getInstance().addWorld(world);
 			InstanceManager.getInstance().addWorld(world);
 			_log.info("Ice Queen's Castle started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
 			_log.info("Ice Queen's Castle started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());

+ 9 - 9
L2J_DataPack_BETA/dist/game/data/scripts/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java

@@ -162,7 +162,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
 	private static final int RESET_MIN = 30;
 	private static final int RESET_MIN = 30;
 	private static final int RESET_DAY_1 = 4; // Wednesday
 	private static final int RESET_DAY_1 = 4; // Wednesday
 	private static final int RESET_DAY_2 = 7; // Saturday
 	private static final int RESET_DAY_2 = 7; // Saturday
-	private static final int INSTANCEID = 139; // Ice Queen's Castle
+	private static final int TEMPLATE_ID = 139; // Ice Queen's Castle
 	private static final int DOOR_ID = 23140101;
 	private static final int DOOR_ID = 23140101;
 	
 	
 	private IceQueensCastleNormalBattle()
 	private IceQueensCastleNormalBattle()
@@ -689,7 +689,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
 	{
 	{
 		final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
 		final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
 		
 		
-		if ((tmpworld != null) && (tmpworld instanceof IQCNBWorld))
+		if (tmpworld instanceof IQCNBWorld)
 		{
 		{
 			final IQCNBWorld world = (IQCNBWorld) tmpworld;
 			final IQCNBWorld world = (IQCNBWorld) tmpworld;
 			
 			
@@ -717,7 +717,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
 	{
 	{
 		final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
 		final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
 		
 		
-		if ((tmpworld != null) && (tmpworld instanceof IQCNBWorld))
+		if (tmpworld instanceof IQCNBWorld)
 		{
 		{
 			final IQCNBWorld world = (IQCNBWorld) tmpworld;
 			final IQCNBWorld world = (IQCNBWorld) tmpworld;
 			switch (npc.getId())
 			switch (npc.getId())
@@ -1014,7 +1014,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
 	{
 	{
 		final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
 		final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
 		
 		
-		if ((tmpworld != null) && (tmpworld instanceof IQCNBWorld))
+		if (tmpworld instanceof IQCNBWorld)
 		{
 		{
 			final IQCNBWorld world = (IQCNBWorld) tmpworld;
 			final IQCNBWorld world = (IQCNBWorld) tmpworld;
 			
 			
@@ -1062,7 +1062,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
 	{
 	{
 		final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
 		final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
 		
 		
-		if ((tmpworld != null) && (tmpworld instanceof IQCNBWorld))
+		if (tmpworld instanceof IQCNBWorld)
 		{
 		{
 			final IQCNBWorld world = (IQCNBWorld) tmpworld;
 			final IQCNBWorld world = (IQCNBWorld) tmpworld;
 			switch (npc.getId())
 			switch (npc.getId())
@@ -1102,9 +1102,9 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
 									reenter.add(Calendar.DAY_OF_MONTH, 1);
 									reenter.add(Calendar.DAY_OF_MONTH, 1);
 								}
 								}
 							}
 							}
-							InstanceManager.getInstance().setInstanceTime(player.getObjectId(), INSTANCEID, reenter.getTimeInMillis());
+							InstanceManager.getInstance().setInstanceTime(player.getObjectId(), TEMPLATE_ID, reenter.getTimeInMillis());
 							final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED);
 							final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED);
-							sm.addInstanceName(INSTANCEID);
+							sm.addInstanceName(TEMPLATE_ID);
 							player.sendPacket(sm);
 							player.sendPacket(sm);
 						}
 						}
 					}
 					}
@@ -1201,7 +1201,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
 		{
 		{
 			world = new IQCNBWorld();
 			world = new IQCNBWorld();
 			world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 			world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-			world.setTemplateId(INSTANCEID);
+			world.setTemplateId(TEMPLATE_ID);
 			world.setStatus(0);
 			world.setStatus(0);
 			InstanceManager.getInstance().addWorld(world);
 			InstanceManager.getInstance().addWorld(world);
 			_log.info("Ice Queen Castle started (Normal Battle)" + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
 			_log.info("Ice Queen Castle started (Normal Battle)" + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
@@ -1285,7 +1285,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
 				party.broadcastPacket(sm);
 				party.broadcastPacket(sm);
 				return false;
 				return false;
 			}
 			}
-			else if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), INSTANCEID))
+			else if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID))
 			{
 			{
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
 				sm.addPcName(channelMember);
 				sm.addPcName(channelMember);

+ 7 - 8
L2J_DataPack_BETA/dist/game/data/scripts/instances/JiniaGuildHideout1/JiniaGuildHideout1.java

@@ -44,7 +44,7 @@ public final class JiniaGuildHideout1 extends Quest
 	// NPC
 	// NPC
 	private static final int RAFFORTY = 32020;
 	private static final int RAFFORTY = 32020;
 	// Location
 	// Location
-	private static final Location START_LOC = new Location(-23530, -8963, -5413, 0, 0);
+	private static final Location START_LOC = new Location(-23530, -8963, -5413);
 	
 	
 	private JiniaGuildHideout1()
 	private JiniaGuildHideout1()
 	{
 	{
@@ -59,13 +59,13 @@ public final class JiniaGuildHideout1 extends Quest
 		final QuestState qs = talker.getQuestState(Q10284_AcquisitionOfDivineSword.class.getSimpleName());
 		final QuestState qs = talker.getQuestState(Q10284_AcquisitionOfDivineSword.class.getSimpleName());
 		if ((qs != null) && qs.isCond(1))
 		if ((qs != null) && qs.isCond(1))
 		{
 		{
-			enterInstance(talker, "JiniaGuildHideout1.xml", START_LOC);
+			enterInstance(talker, "JiniaGuildHideout1.xml");
 			qs.setCond(2, true);
 			qs.setCond(2, true);
 		}
 		}
 		return super.onTalk(npc, talker);
 		return super.onTalk(npc, talker);
 	}
 	}
 	
 	
-	protected int enterInstance(L2PcInstance player, String template, Location loc)
+	protected void enterInstance(L2PcInstance player, String template)
 	{
 	{
 		// check for existing instances for this player
 		// check for existing instances for this player
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
@@ -75,10 +75,10 @@ public final class JiniaGuildHideout1 extends Quest
 			if (!(world instanceof JGH1World))
 			if (!(world instanceof JGH1World))
 			{
 			{
 				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
 				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
-				return 0;
+				return;
 			}
 			}
-			teleportPlayer(player, loc, world.getInstanceId(), false);
-			return 0;
+			teleportPlayer(player, START_LOC, world.getInstanceId(), false);
+			return;
 		}
 		}
 		// New instance
 		// New instance
 		world = new JGH1World();
 		world = new JGH1World();
@@ -89,9 +89,8 @@ public final class JiniaGuildHideout1 extends Quest
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);
 		_log.info("Jinia Guild Hideout started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
 		_log.info("Jinia Guild Hideout started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
 		// teleport players
 		// teleport players
-		teleportPlayer(player, loc, world.getInstanceId(), false);
+		teleportPlayer(player, START_LOC, world.getInstanceId(), false);
 		world.addAllowed(player.getObjectId());
 		world.addAllowed(player.getObjectId());
-		return world.getInstanceId();
 	}
 	}
 	
 	
 	public static void main(String[] args)
 	public static void main(String[] args)

+ 2 - 2
L2J_DataPack_BETA/dist/game/data/scripts/instances/JiniaGuildHideout2/JiniaGuildHideout2.java

@@ -40,7 +40,7 @@ public final class JiniaGuildHideout2 extends Quest
 		long storeTime = 0;
 		long storeTime = 0;
 	}
 	}
 	
 	
-	private static final int INSTANCEID = 141;
+	private static final int TEMPLATE_ID = 141;
 	// NPC
 	// NPC
 	private static final int RAFFORTY = 32020;
 	private static final int RAFFORTY = 32020;
 	// Location
 	// Location
@@ -83,7 +83,7 @@ public final class JiniaGuildHideout2 extends Quest
 		// New instance
 		// New instance
 		world = new JGH2World();
 		world = new JGH2World();
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-		world.setTemplateId(INSTANCEID);
+		world.setTemplateId(TEMPLATE_ID);
 		world.setStatus(0);
 		world.setStatus(0);
 		((JGH2World) world).storeTime = System.currentTimeMillis();
 		((JGH2World) world).storeTime = System.currentTimeMillis();
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);

+ 2 - 2
L2J_DataPack_BETA/dist/game/data/scripts/instances/JiniaGuildHideout3/JiniaGuildHideout3.java

@@ -40,7 +40,7 @@ public final class JiniaGuildHideout3 extends Quest
 		long storeTime = 0;
 		long storeTime = 0;
 	}
 	}
 	
 	
-	private static final int INSTANCEID = 145;
+	private static final int TEMPLATE_ID = 145;
 	// NPC
 	// NPC
 	private static final int RAFFORTY = 32020;
 	private static final int RAFFORTY = 32020;
 	// Location
 	// Location
@@ -83,7 +83,7 @@ public final class JiniaGuildHideout3 extends Quest
 		// New instance
 		// New instance
 		world = new JGH2World();
 		world = new JGH2World();
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-		world.setTemplateId(INSTANCEID);
+		world.setTemplateId(TEMPLATE_ID);
 		world.setStatus(0);
 		world.setStatus(0);
 		((JGH2World) world).storeTime = System.currentTimeMillis();
 		((JGH2World) world).storeTime = System.currentTimeMillis();
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);

+ 2 - 2
L2J_DataPack_BETA/dist/game/data/scripts/instances/JiniaGuildHideout4/JiniaGuildHideout4.java

@@ -40,7 +40,7 @@ public final class JiniaGuildHideout4 extends Quest
 		long storeTime = 0;
 		long storeTime = 0;
 	}
 	}
 	
 	
-	private static final int INSTANCEID = 146;
+	private static final int TEMPLATE_ID = 146;
 	// NPC
 	// NPC
 	private static final int RAFFORTY = 32020;
 	private static final int RAFFORTY = 32020;
 	// Location
 	// Location
@@ -83,7 +83,7 @@ public final class JiniaGuildHideout4 extends Quest
 		// New instance
 		// New instance
 		world = new JGH2World();
 		world = new JGH2World();
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-		world.setTemplateId(INSTANCEID);
+		world.setTemplateId(TEMPLATE_ID);
 		world.setStatus(0);
 		world.setStatus(0);
 		((JGH2World) world).storeTime = System.currentTimeMillis();
 		((JGH2World) world).storeTime = System.currentTimeMillis();
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);

+ 9 - 26
L2J_DataPack_BETA/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java

@@ -71,36 +71,23 @@ public final class Kamaloka extends Quest
 	 * If true shaman in the first room will have same npcId as other mobs, making radar useless Default: true (but not retail like)
 	 * If true shaman in the first room will have same npcId as other mobs, making radar useless Default: true (but not retail like)
 	 */
 	 */
 	private static final boolean STEALTH_SHAMAN = true;
 	private static final boolean STEALTH_SHAMAN = true;
-	
-	/*
-	 * Hardcoded instance ids for kamaloka
-	 */
+	// Template IDs for Kamaloka
 	// @formatter:off
 	// @formatter:off
-	// TODO optimize instance data, this can be compressed to look much more readable
-	private static final int[] INSTANCE_IDS =
+	private static final int[] TEMPLATE_IDS =
 	{
 	{
 		57, 58, 73, 60, 61, 74, 63, 64, 75, 66, 67, 76, 69, 70, 77, 72, 78, 79, 134
 		57, 58, 73, 60, 61, 74, 63, 64, 75, 66, 67, 76, 69, 70, 77, 72, 78, 79, 134
 	};
 	};
-	
-	/*
-	 * Level of the kamaloka
-	 */
+	// Level of the Kamaloka
 	private static final int[] LEVEL =
 	private static final int[] LEVEL =
 	{
 	{
 		23, 26, 29, 33, 36, 39, 43, 46, 49, 53, 56, 59, 63, 66, 69, 73, 78, 81, 83
 		23, 26, 29, 33, 36, 39, 43, 46, 49, 53, 56, 59, 63, 66, 69, 73, 78, 81, 83
 	};
 	};
-	
-	/*
-	 * Duration of the instance, minutes
-	 */
+	// Duration of the instance, minutes
 	private static final int[] DURATION =
 	private static final int[] DURATION =
 	{
 	{
 		30, 30, 45, 30, 30, 45, 30, 30, 45, 30, 30, 45, 30, 30, 45, 30, 45, 45, 45
 		30, 30, 45, 30, 30, 45, 30, 30, 45, 30, 30, 45, 30, 30, 45, 30, 45, 45, 45
 	};
 	};
-	
-	/*
-	 * Maximum party size for the instance
-	 */
+	// Maximum party size for the instance
 	private static final int[] MAX_PARTY_SIZE =
 	private static final int[] MAX_PARTY_SIZE =
 	{
 	{
 		6, 6, 9, 6, 6, 9, 6, 6, 9, 6, 6, 9, 6, 6, 9, 6, 9, 9, 9
 		6, 6, 9, 6, 6, 9, 6, 6, 9, 6, 6, 9, 6, 6, 9, 6, 9, 9, 9
@@ -116,9 +103,7 @@ public final class Kamaloka extends Quest
 		4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 5632, 5637, 5950
 		4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 5632, 5637, 5950
 	};
 	};
 	// @formatter:on
 	// @formatter:on
-	/*
-	 * Teleport points into instances x, y, z
-	 */
+	// Teleport points into instances x, y, z
 	private static final Location[] TELEPORTS =
 	private static final Location[] TELEPORTS =
 	{
 	{
 		new Location(-88429, -220629, -7903),
 		new Location(-88429, -220629, -7903),
@@ -142,9 +127,7 @@ public final class Kamaloka extends Quest
 		new Location(22003, -174886, -10900),
 		new Location(22003, -174886, -10900),
 	};
 	};
 	
 	
-	/*
-	 * Respawn delay for the mobs in the first room, seconds Default: 25
-	 */
+	// Respawn delay for the mobs in the first room, seconds Default: 25
 	private static final int FIRST_ROOM_RESPAWN_DELAY = 25;
 	private static final int FIRST_ROOM_RESPAWN_DELAY = 25;
 	
 	
 	/**
 	/**
@@ -1268,7 +1251,7 @@ public final class Kamaloka extends Quest
 		// get level of the instance
 		// get level of the instance
 		final int level = LEVEL[index];
 		final int level = LEVEL[index];
 		// and client name
 		// and client name
-		final String instanceName = InstanceManager.getInstance().getInstanceIdName(INSTANCE_IDS[index]);
+		final String instanceName = InstanceManager.getInstance().getInstanceIdName(TEMPLATE_IDS[index]);
 		
 		
 		Map<Integer, Long> instanceTimes;
 		Map<Integer, Long> instanceTimes;
 		// for each party member
 		// for each party member
@@ -1349,7 +1332,7 @@ public final class Kamaloka extends Quest
 		int templateId;
 		int templateId;
 		try
 		try
 		{
 		{
-			templateId = INSTANCE_IDS[index];
+			templateId = TEMPLATE_IDS[index];
 		}
 		}
 		catch (ArrayIndexOutOfBoundsException e)
 		catch (ArrayIndexOutOfBoundsException e)
 		{
 		{

+ 12 - 12
L2J_DataPack_BETA/dist/game/data/scripts/instances/LibraryOfSages/LibraryOfSages.java

@@ -41,7 +41,7 @@ public final class LibraryOfSages extends AbstractNpcAI
 		protected long storeTime = 0;
 		protected long storeTime = 0;
 	}
 	}
 	
 	
-	private static final int INSTANCEID = 156;
+	private static final int TEMPLATE_ID = 156;
 	// NPCs
 	// NPCs
 	private static final int SOPHIA1 = 32596;
 	private static final int SOPHIA1 = 32596;
 	private static final int PILE_OF_BOOKS1 = 32809;
 	private static final int PILE_OF_BOOKS1 = 32809;
@@ -53,9 +53,9 @@ public final class LibraryOfSages extends AbstractNpcAI
 	private static final int SOPHIA3 = 32863;
 	private static final int SOPHIA3 = 32863;
 	private static final int ELCADIA_INSTANCE = 32785;
 	private static final int ELCADIA_INSTANCE = 32785;
 	// Locations
 	// Locations
-	private static final Location START_LOC = new Location(37063, -49813, -1128, 0, INSTANCEID);
+	private static final Location START_LOC = new Location(37063, -49813, -1128);
 	private static final Location EXIT_LOC = new Location(37063, -49813, -1128, 0, 0);
 	private static final Location EXIT_LOC = new Location(37063, -49813, -1128, 0, 0);
-	private static final Location LIBRARY_LOC = new Location(37355, -50065, -1127, 0, INSTANCEID);
+	private static final Location LIBRARY_LOC = new Location(37355, -50065, -1127);
 	// NpcString
 	// NpcString
 	private static final NpcStringId[] ELCADIA_DIALOGS =
 	private static final NpcStringId[] ELCADIA_DIALOGS =
 	{
 	{
@@ -87,8 +87,8 @@ public final class LibraryOfSages extends AbstractNpcAI
 		{
 		{
 			case "TELEPORT2":
 			case "TELEPORT2":
 			{
 			{
-				player.teleToLocation(LIBRARY_LOC);
-				world.elcadia.teleToLocation(LIBRARY_LOC);
+				teleportPlayer(player, LIBRARY_LOC, world.getInstanceId());
+				world.elcadia.teleToLocation(LIBRARY_LOC.getX(), LIBRARY_LOC.getY(), LIBRARY_LOC.getZ(), 0, world.getInstanceId());
 				break;
 				break;
 			}
 			}
 			case "EXIT":
 			case "EXIT":
@@ -109,8 +109,8 @@ public final class LibraryOfSages extends AbstractNpcAI
 			case "ENTER":
 			case "ENTER":
 			{
 			{
 				cancelQuestTimer("FOLLOW", npc, player);
 				cancelQuestTimer("FOLLOW", npc, player);
-				player.teleToLocation(START_LOC);
-				world.elcadia.teleToLocation(START_LOC);
+				teleportPlayer(player, START_LOC, world.getInstanceId());
+				world.elcadia.teleToLocation(START_LOC.getX(), START_LOC.getY(), START_LOC.getZ(), 0, world.getInstanceId());
 				break;
 				break;
 			}
 			}
 		}
 		}
@@ -120,11 +120,11 @@ public final class LibraryOfSages extends AbstractNpcAI
 	@Override
 	@Override
 	public String onTalk(L2Npc npc, L2PcInstance talker)
 	public String onTalk(L2Npc npc, L2PcInstance talker)
 	{
 	{
-		enterInstance(talker, "LibraryOfSages.xml", START_LOC);
+		enterInstance(talker, "LibraryOfSages.xml");
 		return super.onTalk(npc, talker);
 		return super.onTalk(npc, talker);
 	}
 	}
 	
 	
-	protected int enterInstance(L2PcInstance player, String template, Location loc)
+	protected int enterInstance(L2PcInstance player, String template)
 	{
 	{
 		// check for existing instances for this player
 		// check for existing instances for this player
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
@@ -136,20 +136,20 @@ public final class LibraryOfSages extends AbstractNpcAI
 				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
 				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
 				return 0;
 				return 0;
 			}
 			}
-			teleportPlayer(player, loc, world.getInstanceId(), false);
+			teleportPlayer(player, START_LOC, world.getInstanceId(), false);
 			spawnNPC(player, (LoSWorld) world);
 			spawnNPC(player, (LoSWorld) world);
 			return 0;
 			return 0;
 		}
 		}
 		// New instance
 		// New instance
 		world = new LoSWorld();
 		world = new LoSWorld();
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-		world.setTemplateId(INSTANCEID);
+		world.setTemplateId(TEMPLATE_ID);
 		world.setStatus(0);
 		world.setStatus(0);
 		((LoSWorld) world).storeTime = System.currentTimeMillis();
 		((LoSWorld) world).storeTime = System.currentTimeMillis();
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);
 		_log.info("Library of Sages started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
 		_log.info("Library of Sages started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
 		// teleport players
 		// teleport players
-		teleportPlayer(player, loc, world.getInstanceId(), false);
+		teleportPlayer(player, START_LOC, world.getInstanceId(), false);
 		world.addAllowed(player.getObjectId());
 		world.addAllowed(player.getObjectId());
 		spawnNPC(player, (LoSWorld) world);
 		spawnNPC(player, (LoSWorld) world);
 		return world.getInstanceId();
 		return world.getInstanceId();

+ 2 - 2
L2J_DataPack_BETA/dist/game/data/scripts/instances/MithrilMine/MithrilMine.java

@@ -47,7 +47,7 @@ public final class MithrilMine extends AbstractNpcAI
 		int _count = 0;
 		int _count = 0;
 	}
 	}
 	
 	
-	private static final int INSTANCEID = 138;
+	private static final int TEMPLATE_ID = 138;
 	// NPCs
 	// NPCs
 	private static final int KEGOR = 18846;
 	private static final int KEGOR = 18846;
 	private static final int MITHRIL_MILLIPEDE = 22766;
 	private static final int MITHRIL_MILLIPEDE = 22766;
@@ -245,7 +245,7 @@ public final class MithrilMine extends AbstractNpcAI
 		// New instance
 		// New instance
 		world = new MMWorld();
 		world = new MMWorld();
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-		world.setTemplateId(INSTANCEID);
+		world.setTemplateId(TEMPLATE_ID);
 		world.setStatus(0);
 		world.setStatus(0);
 		((MMWorld) world).storeTime = System.currentTimeMillis();
 		((MMWorld) world).storeTime = System.currentTimeMillis();
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);

+ 28 - 28
L2J_DataPack_BETA/dist/game/data/scripts/instances/MonasteryOfSilence1/MonasteryOfSilence1.java

@@ -42,7 +42,7 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI
 		protected L2Npc elcadia = null;
 		protected L2Npc elcadia = null;
 	}
 	}
 	
 	
-	private static final int INSTANCEID = 151;
+	private static final int TEMPLATE_ID = 151;
 	// NPCs
 	// NPCs
 	private static final int ELCADIA_INSTANCE = 32787;
 	private static final int ELCADIA_INSTANCE = 32787;
 	private static final int ERIS_EVIL_THOUGHTS = 32792;
 	private static final int ERIS_EVIL_THOUGHTS = 32792;
@@ -57,14 +57,14 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI
 	private static final int TELEPORT_CONTROL_DEVICE3 = 32819;
 	private static final int TELEPORT_CONTROL_DEVICE3 = 32819;
 	private static final int TELEPORT_CONTROL_DEVICE4 = 32820;
 	private static final int TELEPORT_CONTROL_DEVICE4 = 32820;
 	// Locations
 	// Locations
-	private static final Location START_LOC = new Location(120710, -86971, -3392, 0, INSTANCEID);
+	private static final Location START_LOC = new Location(120710, -86971, -3392);
 	private static final Location EXIT_LOC = new Location(115983, -87351, -3397, 0, 0);
 	private static final Location EXIT_LOC = new Location(115983, -87351, -3397, 0, 0);
-	private static final Location CENTRAL_ROOM_LOC = new Location(85794, -249788, -8320, 0, INSTANCEID);
-	private static final Location SOUTH_WATCHERS_ROOM_LOC = new Location(85798, -246566, -8320, 0, INSTANCEID);
-	private static final Location WEST_WATCHERS_ROOM_LOC = new Location(82531, -249405, -8320, 0, INSTANCEID);
-	private static final Location EAST_WATCHERS_ROOM_LOC = new Location(88665, -249784, -8320, 0, INSTANCEID);
-	private static final Location NORTH_WATCHERS_ROOM_LOC = new Location(85792, -252336, -8320, 0, INSTANCEID);
-	private static final Location BACK_LOC = new Location(120710, -86971, -3392, 0, INSTANCEID);
+	private static final Location CENTRAL_ROOM_LOC = new Location(85794, -249788, -8320);
+	private static final Location SOUTH_WATCHERS_ROOM_LOC = new Location(85798, -246566, -8320);
+	private static final Location WEST_WATCHERS_ROOM_LOC = new Location(82531, -249405, -8320);
+	private static final Location EAST_WATCHERS_ROOM_LOC = new Location(88665, -249784, -8320);
+	private static final Location NORTH_WATCHERS_ROOM_LOC = new Location(85792, -252336, -8320);
+	private static final Location BACK_LOC = new Location(120710, -86971, -3392);
 	// NpcString
 	// NpcString
 	private static final NpcStringId[] ELCADIA_DIALOGS =
 	private static final NpcStringId[] ELCADIA_DIALOGS =
 	{
 	{
@@ -88,7 +88,7 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI
 		addTalkId(ODD_GLOBE, ERIS_EVIL_THOUGHTS, RELIC_GUARDIAN, RELIC_WATCHER1, RELIC_WATCHER2, RELIC_WATCHER3, RELIC_WATCHER4, TELEPORT_CONTROL_DEVICE1, TELEPORT_CONTROL_DEVICE2, TELEPORT_CONTROL_DEVICE3, TELEPORT_CONTROL_DEVICE4, ERIS_EVIL_THOUGHTS);
 		addTalkId(ODD_GLOBE, ERIS_EVIL_THOUGHTS, RELIC_GUARDIAN, RELIC_WATCHER1, RELIC_WATCHER2, RELIC_WATCHER3, RELIC_WATCHER4, TELEPORT_CONTROL_DEVICE1, TELEPORT_CONTROL_DEVICE2, TELEPORT_CONTROL_DEVICE3, TELEPORT_CONTROL_DEVICE4, ERIS_EVIL_THOUGHTS);
 	}
 	}
 	
 	
-	private void enterInstance(L2PcInstance player, String template, Location loc)
+	private void enterInstance(L2PcInstance player, String template)
 	{
 	{
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		if (world != null)
 		if (world != null)
@@ -100,7 +100,7 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI
 			else
 			else
 			{
 			{
 				// Teleport player.
 				// Teleport player.
-				teleportPlayer(player, loc, world.getInstanceId(), false);
+				teleportPlayer(player, START_LOC, world.getInstanceId(), false);
 				spawnNPC(player, (MoSWorld) world);
 				spawnNPC(player, (MoSWorld) world);
 				removeBuffs(player);
 				removeBuffs(player);
 			}
 			}
@@ -110,12 +110,12 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI
 			// New instance.
 			// New instance.
 			world = new MoSWorld();
 			world = new MoSWorld();
 			world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 			world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-			world.setTemplateId(INSTANCEID);
+			world.setTemplateId(TEMPLATE_ID);
 			world.setStatus(0);
 			world.setStatus(0);
 			InstanceManager.getInstance().addWorld(world);
 			InstanceManager.getInstance().addWorld(world);
 			_log.info("Monastery of Silence started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
 			_log.info("Monastery of Silence started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
 			// Teleport players.
 			// Teleport players.
-			teleportPlayer(player, loc, world.getInstanceId(), false);
+			teleportPlayer(player, START_LOC, world.getInstanceId(), false);
 			spawnNPC(player, (MoSWorld) world);
 			spawnNPC(player, (MoSWorld) world);
 			removeBuffs(player);
 			removeBuffs(player);
 			world.addAllowed(player.getObjectId());
 			world.addAllowed(player.getObjectId());
@@ -136,15 +136,15 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI
 		{
 		{
 			case "TELE2":
 			case "TELE2":
 			{
 			{
-				player.teleToLocation(CENTRAL_ROOM_LOC);
-				world.elcadia.teleToLocation(CENTRAL_ROOM_LOC);
+				teleportPlayer(player, CENTRAL_ROOM_LOC, world.getInstanceId());
+				world.elcadia.teleToLocation(CENTRAL_ROOM_LOC.getX(), CENTRAL_ROOM_LOC.getY(), CENTRAL_ROOM_LOC.getZ(), 0, world.getInstanceId());
 				startQuestTimer("START_MOVIE", 2000, npc, player);
 				startQuestTimer("START_MOVIE", 2000, npc, player);
 				break;
 				break;
 			}
 			}
 			case "EXIT":
 			case "EXIT":
 			{
 			{
 				cancelQuestTimer("FOLLOW", npc, player);
 				cancelQuestTimer("FOLLOW", npc, player);
-				player.teleToLocation(EXIT_LOC);
+				teleportPlayer(player, EXIT_LOC, 0);
 				world.elcadia.deleteMe();
 				world.elcadia.deleteMe();
 				break;
 				break;
 			}
 			}
@@ -155,38 +155,38 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI
 			}
 			}
 			case "BACK":
 			case "BACK":
 			{
 			{
-				player.teleToLocation(BACK_LOC);
-				world.elcadia.teleToLocation(BACK_LOC);
+				teleportPlayer(player, BACK_LOC, world.getInstanceId());
+				world.elcadia.teleToLocation(BACK_LOC.getX(), BACK_LOC.getY(), BACK_LOC.getZ(), 0, world.getInstanceId());
 				break;
 				break;
 			}
 			}
 			case "EAST":
 			case "EAST":
 			{
 			{
-				player.teleToLocation(EAST_WATCHERS_ROOM_LOC);
-				world.elcadia.teleToLocation(EAST_WATCHERS_ROOM_LOC);
+				teleportPlayer(player, EAST_WATCHERS_ROOM_LOC, world.getInstanceId());
+				world.elcadia.teleToLocation(EAST_WATCHERS_ROOM_LOC.getX(), EAST_WATCHERS_ROOM_LOC.getY(), EAST_WATCHERS_ROOM_LOC.getZ(), 0, world.getInstanceId());
 				break;
 				break;
 			}
 			}
 			case "WEST":
 			case "WEST":
 			{
 			{
-				player.teleToLocation(WEST_WATCHERS_ROOM_LOC);
-				world.elcadia.teleToLocation(WEST_WATCHERS_ROOM_LOC);
+				teleportPlayer(player, WEST_WATCHERS_ROOM_LOC, world.getInstanceId());
+				world.elcadia.teleToLocation(WEST_WATCHERS_ROOM_LOC.getX(), WEST_WATCHERS_ROOM_LOC.getY(), WEST_WATCHERS_ROOM_LOC.getZ(), 0, world.getInstanceId());
 				break;
 				break;
 			}
 			}
 			case "NORTH":
 			case "NORTH":
 			{
 			{
-				player.teleToLocation(NORTH_WATCHERS_ROOM_LOC);
-				world.elcadia.teleToLocation(NORTH_WATCHERS_ROOM_LOC);
+				teleportPlayer(player, NORTH_WATCHERS_ROOM_LOC, world.getInstanceId());
+				world.elcadia.teleToLocation(NORTH_WATCHERS_ROOM_LOC.getX(), NORTH_WATCHERS_ROOM_LOC.getY(), NORTH_WATCHERS_ROOM_LOC.getZ(), 0, world.getInstanceId());
 				break;
 				break;
 			}
 			}
 			case "SOUTH":
 			case "SOUTH":
 			{
 			{
-				player.teleToLocation(SOUTH_WATCHERS_ROOM_LOC);
-				world.elcadia.teleToLocation(SOUTH_WATCHERS_ROOM_LOC);
+				teleportPlayer(player, SOUTH_WATCHERS_ROOM_LOC, world.getInstanceId());
+				world.elcadia.teleToLocation(SOUTH_WATCHERS_ROOM_LOC.getX(), SOUTH_WATCHERS_ROOM_LOC.getY(), SOUTH_WATCHERS_ROOM_LOC.getZ(), 0, world.getInstanceId());
 				break;
 				break;
 			}
 			}
 			case "CENTER":
 			case "CENTER":
 			{
 			{
-				player.teleToLocation(CENTRAL_ROOM_LOC);
-				world.elcadia.teleToLocation(CENTRAL_ROOM_LOC);
+				teleportPlayer(player, CENTRAL_ROOM_LOC, world.getInstanceId());
+				world.elcadia.teleToLocation(CENTRAL_ROOM_LOC.getX(), CENTRAL_ROOM_LOC.getY(), CENTRAL_ROOM_LOC.getZ(), 0, world.getInstanceId());
 				break;
 				break;
 			}
 			}
 			case "FOLLOW":
 			case "FOLLOW":
@@ -215,7 +215,7 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI
 	{
 	{
 		if (npc.getId() == ODD_GLOBE)
 		if (npc.getId() == ODD_GLOBE)
 		{
 		{
-			enterInstance(talker, "MonasteryOfSilence.xml", START_LOC);
+			enterInstance(talker, "MonasteryOfSilence.xml");
 		}
 		}
 		return super.onTalk(npc, talker);
 		return super.onTalk(npc, talker);
 	}
 	}

+ 4 - 4
L2J_DataPack_BETA/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java

@@ -55,7 +55,7 @@ public final class NornilsGarden extends Quest
 		public boolean spawned_4 = false;
 		public boolean spawned_4 = false;
 	}
 	}
 	
 	
-	private static final int INSTANCE_ID = 11;
+	private static final int TEMPLATE_ID = 11;
 	
 	
 	private static final int DURATION_TIME = 70;
 	private static final int DURATION_TIME = 70;
 	private static final int EMPTY_DESTROY_TIME = 5;
 	private static final int EMPTY_DESTROY_TIME = 5;
@@ -269,7 +269,7 @@ public final class NornilsGarden extends Quest
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		if (world != null)
 		if (world != null)
 		{
 		{
-			if (!(world instanceof NornilsWorld) || (world.getTemplateId() != INSTANCE_ID))
+			if (!(world instanceof NornilsWorld) || (world.getTemplateId() != TEMPLATE_ID))
 			{
 			{
 				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
 				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
 				return null;
 				return null;
@@ -300,14 +300,14 @@ public final class NornilsGarden extends Quest
 		final int instanceId = InstanceManager.getInstance().createDynamicInstance("NornilsGarden.xml");
 		final int instanceId = InstanceManager.getInstance().createDynamicInstance("NornilsGarden.xml");
 		final Instance inst = InstanceManager.getInstance().getInstance(instanceId);
 		final Instance inst = InstanceManager.getInstance().getInstance(instanceId);
 		
 		
-		inst.setName(InstanceManager.getInstance().getInstanceIdName(INSTANCE_ID));
+		inst.setName(InstanceManager.getInstance().getInstanceIdName(TEMPLATE_ID));
 		inst.setSpawnLoc(new Location(player));
 		inst.setSpawnLoc(new Location(player));
 		inst.setAllowSummon(false);
 		inst.setAllowSummon(false);
 		inst.setDuration(DURATION_TIME * 60000);
 		inst.setDuration(DURATION_TIME * 60000);
 		inst.setEmptyDestroyTime(EMPTY_DESTROY_TIME * 60000);
 		inst.setEmptyDestroyTime(EMPTY_DESTROY_TIME * 60000);
 		world = new NornilsWorld();
 		world = new NornilsWorld();
 		world.setInstanceId(instanceId);
 		world.setInstanceId(instanceId);
-		world.setTemplateId(INSTANCE_ID);
+		world.setTemplateId(TEMPLATE_ID);
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);
 		_log.info("Nornils Garden: started, Instance: " + instanceId + " created by player: " + player.getName());
 		_log.info("Nornils Garden: started, Instance: " + instanceId + " created by player: " + player.getName());
 		
 		

+ 3 - 3
L2J_DataPack_BETA/dist/game/data/scripts/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java

@@ -85,7 +85,7 @@ public final class PailakaDevilsLegacy extends AbstractNpcAI
 		new Location(85139, -208630, -3339, 31777),
 		new Location(85139, -208630, -3339, 31777),
 	};
 	};
 	// Misc
 	// Misc
-	private static final int INSTANCE_ID = 44;
+	private static final int TEMPLATE_ID = 44;
 	private static final int ZONE = 20109;
 	private static final int ZONE = 20109;
 	
 	
 	private PailakaDevilsLegacy()
 	private PailakaDevilsLegacy()
@@ -286,7 +286,7 @@ public final class PailakaDevilsLegacy extends AbstractNpcAI
 		if ((character.isPlayer()) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline())
 		if ((character.isPlayer()) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline())
 		{
 		{
 			final InstanceWorld world = InstanceManager.getInstance().getWorld(character.getInstanceId());
 			final InstanceWorld world = InstanceManager.getInstance().getWorld(character.getInstanceId());
-			if ((world != null) && (world.getTemplateId() == INSTANCE_ID))
+			if ((world != null) && (world.getTemplateId() == TEMPLATE_ID))
 			{
 			{
 				startQuestTimer("TELEPORT", 1000, ((DIWorld) world)._lematanNpc, (L2PcInstance) character);
 				startQuestTimer("TELEPORT", 1000, ((DIWorld) world)._lematanNpc, (L2PcInstance) character);
 			}
 			}
@@ -320,7 +320,7 @@ public final class PailakaDevilsLegacy extends AbstractNpcAI
 		}
 		}
 		world = new DIWorld();
 		world = new DIWorld();
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-		world.setTemplateId(INSTANCE_ID);
+		world.setTemplateId(TEMPLATE_ID);
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);
 		world.addAllowed(player.getObjectId());
 		world.addAllowed(player.getObjectId());
 		teleportPlayer(player, TELEPORT, world.getInstanceId());
 		teleportPlayer(player, TELEPORT, world.getInstanceId());

+ 3 - 3
L2J_DataPack_BETA/dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java

@@ -56,7 +56,7 @@ public final class PailakaSongOfIceAndFire extends AbstractNpcAI
 	// Location
 	// Location
 	private static final Location TELEPORT = new Location(-52875, 188232, -4696);
 	private static final Location TELEPORT = new Location(-52875, 188232, -4696);
 	// Misc
 	// Misc
-	private static final int INSTANCE_ID = 43;
+	private static final int TEMPLATE_ID = 43;
 	private static final int ZONE = 20108;
 	private static final int ZONE = 20108;
 	
 	
 	private PailakaSongOfIceAndFire()
 	private PailakaSongOfIceAndFire()
@@ -87,7 +87,7 @@ public final class PailakaSongOfIceAndFire extends AbstractNpcAI
 		}
 		}
 		world = new PSoIWorld();
 		world = new PSoIWorld();
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-		world.setTemplateId(INSTANCE_ID);
+		world.setTemplateId(TEMPLATE_ID);
 		InstanceManager.getInstance().addWorld(world);
 		InstanceManager.getInstance().addWorld(world);
 		world.addAllowed(player.getObjectId());
 		world.addAllowed(player.getObjectId());
 		teleportPlayer(player, TELEPORT, world.getInstanceId());
 		teleportPlayer(player, TELEPORT, world.getInstanceId());
@@ -192,7 +192,7 @@ public final class PailakaSongOfIceAndFire extends AbstractNpcAI
 		if ((character.isPlayer()) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline())
 		if ((character.isPlayer()) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline())
 		{
 		{
 			final InstanceWorld world = InstanceManager.getInstance().getWorld(character.getInstanceId());
 			final InstanceWorld world = InstanceManager.getInstance().getWorld(character.getInstanceId());
-			if ((world != null) && (world.getTemplateId() == INSTANCE_ID))
+			if ((world != null) && (world.getTemplateId() == TEMPLATE_ID))
 			{
 			{
 				startQuestTimer("TELEPORT", 1000, null, (L2PcInstance) character);
 				startQuestTimer("TELEPORT", 1000, null, (L2PcInstance) character);
 			}
 			}

+ 2 - 2
L2J_DataPack_BETA/dist/game/data/scripts/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java

@@ -59,7 +59,7 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
 	}
 	}
 	
 	
 	// Instance
 	// Instance
-	private static final int INSTANCEID = 111;
+	private static final int TEMPLATE_ID = 111;
 	// NPCs
 	// NPCs
 	private static final int GUARDS_OF_THE_DAWN = 18834;
 	private static final int GUARDS_OF_THE_DAWN = 18834;
 	private static final int GUARDS_OF_THE_DAWN_2 = 18835;
 	private static final int GUARDS_OF_THE_DAWN_2 = 18835;
@@ -171,7 +171,7 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
 			// New instance,
 			// New instance,
 			world = new HSWorld();
 			world = new HSWorld();
 			world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
 			world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
-			world.setTemplateId(INSTANCEID);
+			world.setTemplateId(TEMPLATE_ID);
 			world.setStatus(0);
 			world.setStatus(0);
 			((HSWorld) world).storeTime = System.currentTimeMillis();
 			((HSWorld) world).storeTime = System.currentTimeMillis();
 			InstanceManager.getInstance().addWorld(world);
 			InstanceManager.getInstance().addWorld(world);

+ 3 - 0
L2J_DataPack_BETA/dist/game/data/scripts/instances/SecretArea/32566-01.html

@@ -0,0 +1,3 @@
+<html><body>Soldier Ginby:<br>
+Hurry! Come back before anybody sees you!
+</body></html>

+ 3 - 0
L2J_DataPack_BETA/dist/game/data/scripts/instances/SecretArea/32567-01.html

@@ -0,0 +1,3 @@
+<html><body>Shilen Priest Lelrikia:<br>
+Doomed creature, either you obey the power of Shilen or you fight.Regardless of your decision, the shadow of death will not simply fade away...
+</body></html>

+ 21 - 26
L2J_DataPack_BETA/dist/game/data/scripts/instances/SecretArea/SecretArea.java

@@ -22,7 +22,6 @@ import com.l2jserver.gameserver.instancemanager.InstanceManager;
 import com.l2jserver.gameserver.model.Location;
 import com.l2jserver.gameserver.model.Location;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.entity.Instance;
 import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
 import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
 import com.l2jserver.gameserver.model.quest.Quest;
 import com.l2jserver.gameserver.model.quest.Quest;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.SystemMessageId;
@@ -33,10 +32,12 @@ import com.l2jserver.gameserver.network.SystemMessageId;
  */
  */
 public final class SecretArea extends Quest
 public final class SecretArea extends Quest
 {
 {
-	private static final int INSTANCE_ID = 117;
-	// TODO Unharcode htmls.
-	private static final String _ENTER = "<html><head><body>Soldier Ginby:<br>Hurry! Come back before anybody sees you!</body></html>";
-	private static final String _EXIT = "<html><head><body>Shilen Priest Lelrikia:<br>Doomed creature, either you obey the power of Shilen or you fight.Regardless of your decision, the shadow of death will not simply fade away...</body></html>";
+	protected class SAWorld extends InstanceWorld
+	{
+		
+	}
+	
+	private static final int TEMPLATE_ID = 117;
 	private static final int GINBY = 32566;
 	private static final int GINBY = 32566;
 	private static final int LELRIKIA = 32567;
 	private static final int LELRIKIA = 32567;
 	private static final int ENTER = 0;
 	private static final int ENTER = 0;
@@ -58,31 +59,25 @@ public final class SecretArea extends Quest
 	protected void enterInstance(L2PcInstance player)
 	protected void enterInstance(L2PcInstance player)
 	{
 	{
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
+		
 		if (world != null)
 		if (world != null)
 		{
 		{
-			if (world.getInstanceId() != INSTANCE_ID)
-			{
-				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
-				return;
-			}
-			Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
-			if (inst != null)
+			if (world instanceof SAWorld)
 			{
 			{
 				teleportPlayer(player, TELEPORTS[ENTER], world.getInstanceId());
 				teleportPlayer(player, TELEPORTS[ENTER], world.getInstanceId());
+				return;
 			}
 			}
+			player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
+			return;
 		}
 		}
-		else
-		{
-			final int instanceId = InstanceManager.getInstance().createDynamicInstance("SecretArea.xml");
-			world = new InstanceWorld();
-			world.setInstanceId(INSTANCE_ID);
-			world.setTemplateId(instanceId);
-			world.setStatus(0);
-			InstanceManager.getInstance().addWorld(world);
-			
-			world.addAllowed(player.getObjectId());
-			teleportPlayer(player, TELEPORTS[ENTER], instanceId);
-		}
+		
+		world = new SAWorld();
+		world.setInstanceId(InstanceManager.getInstance().createDynamicInstance("SecretArea.xml"));
+		world.setTemplateId(TEMPLATE_ID);
+		world.addAllowed(player.getObjectId());
+		world.setStatus(0);
+		InstanceManager.getInstance().addWorld(world);
+		teleportPlayer(player, TELEPORTS[ENTER], world.getInstanceId());
 	}
 	}
 	
 	
 	@Override
 	@Override
@@ -92,12 +87,12 @@ public final class SecretArea extends Quest
 		if ((npc.getId() == GINBY) && event.equalsIgnoreCase("enter"))
 		if ((npc.getId() == GINBY) && event.equalsIgnoreCase("enter"))
 		{
 		{
 			enterInstance(player);
 			enterInstance(player);
-			return _ENTER;
+			return "32566-01.html";
 		}
 		}
 		else if ((npc.getId() == LELRIKIA) && event.equalsIgnoreCase("exit"))
 		else if ((npc.getId() == LELRIKIA) && event.equalsIgnoreCase("exit"))
 		{
 		{
 			teleportPlayer(player, TELEPORTS[EXIT], 0);
 			teleportPlayer(player, TELEPORTS[EXIT], 0);
-			return _EXIT;
+			return "32567-01.html";
 		}
 		}
 		return htmltext;
 		return htmltext;
 	}
 	}

+ 4 - 5
L2J_DataPack_BETA/dist/game/data/scripts/instances/SeedOfInfinity/HallOfSuffering.java

@@ -65,7 +65,7 @@ public final class HallOfSuffering extends Quest
 		public boolean isRewarded = false;
 		public boolean isRewarded = false;
 	}
 	}
 	
 	
-	private static final int INSTANCEID = 115; // this is the client number
+	private static final int TEMPLATE_ID = 115;
 	private static final boolean debug = false;
 	private static final boolean debug = false;
 	
 	
 	// NPCs
 	// NPCs
@@ -449,7 +449,7 @@ public final class HallOfSuffering extends Quest
 				party.broadcastPacket(sm);
 				party.broadcastPacket(sm);
 				return false;
 				return false;
 			}
 			}
-			Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), INSTANCEID);
+			Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID);
 			if (System.currentTimeMillis() < reentertime)
 			if (System.currentTimeMillis() < reentertime)
 			{
 			{
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
 				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
@@ -469,7 +469,6 @@ public final class HallOfSuffering extends Quest
 	
 	
 	protected int enterInstance(L2PcInstance player, String template, int[] coords)
 	protected int enterInstance(L2PcInstance player, String template, int[] coords)
 	{
 	{
-		int instanceId = 0;
 		// check for existing instances for this player
 		// check for existing instances for this player
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
 		// existing instance
 		// existing instance
@@ -489,10 +488,10 @@ public final class HallOfSuffering extends Quest
 			return 0;
 			return 0;
 		}
 		}
 		L2Party party = player.getParty();
 		L2Party party = player.getParty();
-		instanceId = InstanceManager.getInstance().createDynamicInstance(template);
+		final int instanceId = InstanceManager.getInstance().createDynamicInstance(template);
 		world = new HSWorld();
 		world = new HSWorld();
 		world.setInstanceId(instanceId);
 		world.setInstanceId(instanceId);
-		world.setTemplateId(INSTANCEID);
+		world.setTemplateId(TEMPLATE_ID);
 		world.setStatus(0);
 		world.setStatus(0);
 		((HSWorld) world).startTime = System.currentTimeMillis();
 		((HSWorld) world).startTime = System.currentTimeMillis();
 		((HSWorld) world).ptLeaderName = player.getName();
 		((HSWorld) world).ptLeaderName = player.getName();