Browse Source

BETA: Cleanup after [L5745]
* Removing !teleCord class using Location instead!

Rumen Nikiforov 12 years ago
parent
commit
04fd283ca3

+ 6 - 12
L2J_DataPack_BETA/dist/game/data/scripts/handlers/itemhandlers/PaganKeys.java

@@ -83,13 +83,10 @@ public class PaganKeys implements IItemHandler
 				{
 					if (activeChar.getInstanceId() != door.getInstanceId())
 					{
-						for (L2DoorInstance instanceDoor : InstanceManager.getInstance().getInstance(activeChar.getInstanceId()).getDoors())
+						final L2DoorInstance instanceDoor = InstanceManager.getInstance().getInstance(activeChar.getInstanceId()).getDoor(door.getDoorId());
+						if (instanceDoor != null)
 						{
-							if (instanceDoor.getDoorId() == door.getDoorId())
-							{
-								instanceDoor.openMe();
-								break;
-							}
+							instanceDoor.openMe();
 						}
 					}
 					else
@@ -107,13 +104,10 @@ public class PaganKeys implements IItemHandler
 				{
 					if (activeChar.getInstanceId() != door.getInstanceId())
 					{
-						for (L2DoorInstance instanceDoor : InstanceManager.getInstance().getInstance(activeChar.getInstanceId()).getDoors())
+						final L2DoorInstance instanceDoor = InstanceManager.getInstance().getInstance(activeChar.getInstanceId()).getDoor(door.getDoorId());
+						if (instanceDoor != null)
 						{
-							if (instanceDoor.getDoorId() == door.getDoorId())
-							{
-								instanceDoor.openMe();
-								break;
-							}
+							instanceDoor.openMe();
 						}
 					}
 					else

+ 5 - 7
L2J_DataPack_BETA/dist/game/data/scripts/handlers/skillhandlers/Unlock.java

@@ -66,15 +66,13 @@ public class Unlock implements ISkillHandler
 						activeChar.sendPacket(ActionFailed.STATIC_PACKET);
 						return;
 					}
-					for (L2DoorInstance instanceDoor : inst.getDoors())
+					final L2DoorInstance instanceDoor = inst.getDoor(door.getDoorId());
+					if (instanceDoor != null)
 					{
-						if (instanceDoor.getDoorId() == door.getDoorId())
-						{
-							// Door found
-							door = instanceDoor;
-							break;
-						}
+						// Door found
+						door = instanceDoor;
 					}
+					
 					// Checking instance again
 					if (activeChar.getInstanceId() != door.getInstanceId())
 					{

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

@@ -1437,39 +1437,6 @@ public class CrystalCaverns extends Quest
 	private static final int DRAGONSCALETIME = 3000;
 	private static final int DRAGONCLAWTIME = 3000;
 	
-	protected static class teleCoord
-	{
-		int instanceId;
-		int x;
-		int y;
-		int z;
-	}
-	
-	protected void openDoor(int doorId, int instanceId)
-	{
-		for (L2DoorInstance door : InstanceManager.getInstance().getInstance(instanceId).getDoors())
-		{
-			if (door.getDoorId() == doorId)
-			{
-				door.openMe();
-			}
-		}
-	}
-	
-	protected void closeDoor(int doorId, int instanceId)
-	{
-		for (L2DoorInstance door : InstanceManager.getInstance().getInstance(instanceId).getDoors())
-		{
-			if (door.getDoorId() == doorId)
-			{
-				if (door.getOpen())
-				{
-					door.closeMe();
-				}
-			}
-		}
-	}
-	
 	private boolean checkConditions(L2PcInstance player)
 	{
 		if (debug)
@@ -1649,15 +1616,7 @@ public class CrystalCaverns extends Quest
 		effected.broadcastPacket(new ValidateLocation(effected));
 	}
 	
-	private void teleportplayer(L2PcInstance player, teleCoord teleto)
-	{
-		player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
-		player.setInstanceId(teleto.instanceId);
-		player.teleToLocation(teleto.x, teleto.y, teleto.z);
-		return;
-	}
-	
-	protected int enterInstance(L2PcInstance player, String template, teleCoord teleto)
+	protected int enterInstance(L2PcInstance player, String template, Location loc)
 	{
 		// check for existing instances for this player
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
@@ -1669,8 +1628,7 @@ public class CrystalCaverns extends Quest
 				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
 				return 0;
 			}
-			teleto.instanceId = world.getInstanceId();
-			teleportplayer(player, teleto);
+			teleportPlayer(player, loc, world.getInstanceId());
 			return world.getInstanceId();
 		}
 		
@@ -1688,13 +1646,12 @@ public class CrystalCaverns extends Quest
 		_log.info("Crystal Caverns started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
 		runOracle((CCWorld) world);
 		// teleport players
-		teleto.instanceId = instanceId;
 		if (player.getParty() == null)
 		{
 			// this can happen only if debug is true
 			player.sendMessage("Welcome to Crystal Caverns.");
 			InstanceManager.getInstance().setInstanceTime(player.getObjectId(), INSTANCEID, ((System.currentTimeMillis() + INSTANCEPENALTY)));
-			teleportplayer(player, teleto);
+			teleportPlayer(player, loc, world.getInstanceId());
 			world.isAllowed(player.getObjectId());
 		}
 		else
@@ -1703,20 +1660,13 @@ public class CrystalCaverns extends Quest
 			{
 				partyMember.sendMessage("Welcome to Crystal Caverns.");
 				InstanceManager.getInstance().setInstanceTime(partyMember.getObjectId(), INSTANCEID, ((System.currentTimeMillis() + INSTANCEPENALTY)));
-				teleportplayer(partyMember, teleto);
+				teleportPlayer(partyMember, loc, world.getInstanceId());
 				world.addAllowed(partyMember.getObjectId());
 			}
 		}
 		return instanceId;
 	}
 	
-	protected void exitInstance(L2PcInstance player, teleCoord tele)
-	{
-		player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
-		player.setInstanceId(0);
-		player.teleToLocation(tele.x, tele.y, tele.z);
-	}
-	
 	protected void stopAttack(L2PcInstance player)
 	{
 		player.setTarget(null);
@@ -2049,11 +1999,7 @@ public class CrystalCaverns extends Quest
 				if ((world.getStatus() != 4) && (attacker != null))
 				{
 					// Lucky cheater, the code only kicks his/her ass out of the dungeon
-					teleCoord tele = new teleCoord();
-					tele.x = 149361;
-					tele.y = 172327;
-					tele.z = -945;
-					exitInstance(attacker, tele);
+					teleportPlayer(attacker, new Location(149361, 172327, -945), 0);
 					world.removeAllowed(attacker.getObjectId());
 				}
 				else if (world.tears != npc)
@@ -2141,33 +2087,19 @@ public class CrystalCaverns extends Quest
 		if (tmpworld instanceof CCWorld)
 		{
 			CCWorld world = (CCWorld) tmpworld;
-			teleCoord teleto = new teleCoord();
-			teleto.instanceId = world.getInstanceId();
 			if (event.equalsIgnoreCase("TeleportOut"))
 			{
-				teleCoord tele = new teleCoord();
-				tele.x = 149413;
-				tele.y = 173078;
-				tele.z = -5014;
-				exitInstance(player, tele);
+				teleportPlayer(player, new Location(149413, 173078, -5014), 0);
 			}
 			else if (event.equalsIgnoreCase("TeleportParme"))
 			{
-				teleCoord tele = new teleCoord();
-				tele.x = 153689;
-				tele.y = 142226;
-				tele.z = -9750;
-				tele.instanceId = world.getInstanceId();
-				teleportplayer(player, tele);
+				teleportPlayer(player, new Location(153689, 142226, -9750), world.getInstanceId());
 			}
 			else if (event.equalsIgnoreCase("Timer2") || event.equalsIgnoreCase("Timer3") || event.equalsIgnoreCase("Timer4") || event.equalsIgnoreCase("Timer5"))
 			{
-				teleto.x = 144653;
-				teleto.y = 152606;
-				teleto.z = -12126;
 				if (player.getInstanceId() == world.getInstanceId())
 				{
-					teleportplayer(player, teleto);
+					teleportPlayer(player, new Location(144653, 152606, -12126), world.getInstanceId());
 					player.stopSkillEffects(5239);
 					SkillTable.getInstance().getInfo(5239, 1).getEffects(player, player);
 					startQuestTimer("Timer2", 300000, npc, player);
@@ -2794,11 +2726,7 @@ public class CrystalCaverns extends Quest
 		}
 		if (npcId == ORACLE_GUIDE_1)
 		{
-			teleCoord tele = new teleCoord();
-			tele.x = 143348;
-			tele.y = 148707;
-			tele.z = -11972;
-			enterInstance(player, "CrystalCaverns.xml", tele);
+			enterInstance(player, "CrystalCaverns.xml", new Location(143348, 148707, -11972));
 			return "";
 		}
 		
@@ -2812,8 +2740,7 @@ public class CrystalCaverns extends Quest
 			else if ((npc.getNpcId() >= 32275) && (npc.getNpcId() <= 32277) && world.OracleTriggered[npc.getNpcId() - 32275])
 			{
 				boolean doTeleport = false;
-				teleCoord teleto = new teleCoord();
-				teleto.instanceId = npc.getInstanceId();
+				Location loc = null;
 				L2Party party = player.getParty();
 				doTeleport = true;
 				switch (npc.getNpcId())
@@ -2823,9 +2750,7 @@ public class CrystalCaverns extends Quest
 						{
 							runSteamRooms(world, STEAM2_SPAWNS, 23);
 						}
-						teleto.x = 147529;
-						teleto.y = 152587;
-						teleto.z = -12169;
+						loc = new Location(147529, 152587, -12169);
 						cancelQuestTimers("Timer2");
 						cancelQuestTimers("Timer21");
 						if (party != null)
@@ -2853,9 +2778,7 @@ public class CrystalCaverns extends Quest
 						{
 							runSteamRooms(world, STEAM3_SPAWNS, 24);
 						}
-						teleto.x = 150194;
-						teleto.y = 152610;
-						teleto.z = -12169;
+						loc = new Location(150194, 152610, -12169);
 						cancelQuestTimers("Timer3");
 						cancelQuestTimers("Timer31");
 						if (party != null)
@@ -2883,9 +2806,7 @@ public class CrystalCaverns extends Quest
 						{
 							runSteamRooms(world, STEAM4_SPAWNS, 25);
 						}
-						teleto.x = 149743;
-						teleto.y = 149986;
-						teleto.z = -12141;
+						loc = new Location(149743, 149986, -12141);
 						cancelQuestTimers("Timer4");
 						cancelQuestTimers("Timer41");
 						if (party != null)
@@ -2912,7 +2833,7 @@ public class CrystalCaverns extends Quest
 						// something is wrong
 						doTeleport = false;
 				}
-				if (doTeleport)
+				if (doTeleport && (loc != null))
 				{
 					if (!checkOracleConditions(player))
 					{
@@ -2923,12 +2844,12 @@ public class CrystalCaverns extends Quest
 						for (L2PcInstance partyMember : party.getMembers())
 						{
 							partyMember.destroyItemByItemId("Quest", RED_CORAL, 1, player, true);
-							teleportplayer(partyMember, teleto);
+							teleportPlayer(partyMember, loc, npc.getInstanceId());
 						}
 					}
 					else
 					{
-						teleportplayer(player, teleto);
+						teleportPlayer(player, loc, npc.getInstanceId());
 					}
 				}
 			}
@@ -2982,12 +2903,7 @@ public class CrystalCaverns extends Quest
 			}
 			else if ((npc.getNpcId() == ORACLE_GUIDE_4) && (world.getStatus() == 31))
 			{
-				teleCoord teleto = new teleCoord();
-				teleto.instanceId = npc.getInstanceId();
-				teleto.x = 153522;
-				teleto.y = 144212;
-				teleto.z = -9747;
-				teleportplayer(player, teleto);
+				teleportPlayer(player, new Location(153522, 144212, -9747), npc.getInstanceId());
 			}
 		}
 		return "";

+ 7 - 52
L2J_DataPack_BETA/dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java

@@ -21,11 +21,10 @@ package instances.DarkCloudMansion;
 import javolution.util.FastList;
 import javolution.util.FastMap;
 
-import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.instancemanager.InstanceManager;
 import com.l2jserver.gameserver.model.L2Party;
+import com.l2jserver.gameserver.model.Location;
 import com.l2jserver.gameserver.model.actor.L2Npc;
-import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.entity.Instance;
 import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
@@ -484,25 +483,6 @@ public class DarkCloudMansion extends Quest
 		public FastMap<String, DMCRoom> rooms = new FastMap<>();
 	}
 	
-	protected static class teleCoord
-	{
-		int instanceId;
-		int x;
-		int y;
-		int z;
-	}
-	
-	protected void openDoor(int doorId, int instanceId)
-	{
-		for (L2DoorInstance door : InstanceManager.getInstance().getInstance(instanceId).getDoors())
-		{
-			if (door.getDoorId() == doorId)
-			{
-				door.openMe();
-			}
-		}
-	}
-	
 	private boolean checkConditions(L2PcInstance player)
 	{
 		if (debug)
@@ -547,15 +527,7 @@ public class DarkCloudMansion extends Quest
 		return true;
 	}
 	
-	private void teleportplayer(L2PcInstance player, teleCoord teleto)
-	{
-		player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
-		player.setInstanceId(teleto.instanceId);
-		player.teleToLocation(teleto.x, teleto.y, teleto.z);
-		return;
-	}
-	
-	protected int enterInstance(L2PcInstance player, String template, teleCoord teleto)
+	protected int enterInstance(L2PcInstance player, String template, Location loc)
 	{
 		int instanceId = 0;
 		// check for existing instances for this player
@@ -568,8 +540,7 @@ public class DarkCloudMansion extends Quest
 				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
 				return 0;
 			}
-			teleto.instanceId = world.getInstanceId();
-			teleportplayer(player, teleto);
+			teleportPlayer(player, loc, world.getInstanceId());
 			return instanceId;
 		}
 		// New instance
@@ -586,11 +557,10 @@ public class DarkCloudMansion extends Quest
 		_log.info("DarkCloudMansion: started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
 		runStartRoom((DMCWorld) world);
 		// teleport players
-		teleto.instanceId = instanceId;
 		if (debug && (party == null))
 		{
 			world.addAllowed(player.getObjectId());
-			teleportplayer(player, teleto);
+			teleportPlayer(player, loc, instanceId);
 		}
 		else
 		{
@@ -601,20 +571,13 @@ public class DarkCloudMansion extends Quest
 					newQuestState(partyMember);
 				}
 				world.addAllowed(partyMember.getObjectId());
-				teleportplayer(partyMember, teleto);
+				teleportPlayer(partyMember, loc, instanceId);
 			}
 		}
 		
 		return instanceId;
 	}
 	
-	protected void exitInstance(L2PcInstance player, teleCoord tele)
-	{
-		player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
-		player.setInstanceId(0);
-		player.teleToLocation(tele.x, tele.y, tele.z);
-	}
-	
 	protected void runStartRoom(DMCWorld world)
 	{
 		world.setStatus(0);
@@ -1474,11 +1437,7 @@ public class DarkCloudMansion extends Quest
 		int npcId = npc.getNpcId();
 		if (npcId == YIYEN)
 		{
-			teleCoord tele = new teleCoord();
-			tele.x = 146534;
-			tele.y = 180464;
-			tele.z = -6117;
-			enterInstance(player, "DarkCloudMansion.xml", tele);
+			enterInstance(player, "DarkCloudMansion.xml", new Location(146534, 180464, -6117));
 		}
 		else
 		{
@@ -1495,10 +1454,6 @@ public class DarkCloudMansion extends Quest
 			
 			if (npcId == SOTruth)
 			{
-				teleCoord tele = new teleCoord();
-				tele.x = 139968;
-				tele.y = 150367;
-				tele.z = -3111;
 				if (world.isAllowed(player.getObjectId()))
 				{
 					if (debug)
@@ -1507,7 +1462,7 @@ public class DarkCloudMansion extends Quest
 					}
 					world.removeAllowed(player.getObjectId());
 				}
-				exitInstance(player, tele);
+				teleportPlayer(player, new Location(139968, 150367, -3111), 0);
 				int instanceId = npc.getInstanceId();
 				Instance instance = InstanceManager.getInstance().getInstance(instanceId);
 				if (instance.getPlayers().isEmpty())

+ 0 - 8
L2J_DataPack_BETA/dist/game/data/scripts/instances/DemonPrinceFloor/DemonPrinceFloor.java

@@ -20,7 +20,6 @@ package instances.DemonPrinceFloor;
 
 import java.util.Calendar;
 
-import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.instancemanager.InstanceManager;
 import com.l2jserver.gameserver.model.L2Party;
 import com.l2jserver.gameserver.model.L2World;
@@ -273,13 +272,6 @@ public class DemonPrinceFloor extends Quest
 		}
 	}
 	
-	private void teleportPlayer(L2PcInstance player, Location loc, int instanceId)
-	{
-		player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
-		player.setInstanceId(instanceId);
-		player.teleToLocation(loc, true);
-	}
-	
 	public static void main(String[] args)
 	{
 		new DemonPrinceFloor(-1, DemonPrinceFloor.class.getSimpleName(), "instances");

+ 0 - 26
L2J_DataPack_BETA/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java

@@ -52,7 +52,6 @@ import com.l2jserver.gameserver.model.PcCondOverride;
 import com.l2jserver.gameserver.model.actor.L2Attackable;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Npc;
-import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@@ -521,31 +520,6 @@ public class FinalEmperialTomb extends Quest
 		}
 	}
 	
-	protected void openDoor(int doorId, int instanceId)
-	{
-		for (L2DoorInstance door : InstanceManager.getInstance().getInstance(instanceId).getDoors())
-		{
-			if (door.getDoorId() == doorId)
-			{
-				door.openMe();
-			}
-		}
-	}
-	
-	protected void closeDoor(int doorId, int instanceId)
-	{
-		for (L2DoorInstance door : InstanceManager.getInstance().getInstance(instanceId).getDoors())
-		{
-			if (door.getDoorId() == doorId)
-			{
-				if (door.getOpen())
-				{
-					door.closeMe();
-				}
-			}
-		}
-	}
-	
 	private boolean checkConditions(L2PcInstance player)
 	{
 		if (debug || player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS))

+ 7 - 29
L2J_DataPack_BETA/dist/game/data/scripts/instances/HellboundTown/HellboundTown.java

@@ -25,6 +25,7 @@ import com.l2jserver.gameserver.instancemanager.HellboundManager;
 import com.l2jserver.gameserver.instancemanager.InstanceManager;
 import com.l2jserver.gameserver.instancemanager.WalkingManager;
 import com.l2jserver.gameserver.model.L2Party;
+import com.l2jserver.gameserver.model.Location;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@@ -99,27 +100,11 @@ public class HellboundTown extends Quest
 	private static final int TOWN_GUARD = 22359;
 	private static final int TOWN_PATROL = 22360;
 	
-	private static final int[] AMASKARI_SPAWN_POINT =
-	{
-		19424,
-		253360,
-		-2032,
-		16860
-	};
+	private static final Location AMASKARI_SPAWN_POINT = new Location(19424, 253360, -2032, 16860);
 	
-	private static final int[] ENTRY_POINT =
-	{
-		14117,
-		255434,
-		-2016
-	};
+	private static final Location ENTRY_POINT = new Location(14117, 255434, -2016);
 	
-	protected static final int[] EXIT_POINT =
-	{
-		16262,
-		283651,
-		-9700
-	};
+	protected static final Location EXIT_POINT = new Location(16262, 283651, -9700);
 	
 	private static final SkillHolder STONE = new SkillHolder(4616, 1);
 	
@@ -436,12 +421,6 @@ public class HellboundTown extends Quest
 		return true;
 	}
 	
-	private void teleportPlayer(L2PcInstance player, int[] tele, int instanceId)
-	{
-		player.setInstanceId(instanceId);
-		player.teleToLocation((tele[0] - 50) + getRandom(100), (tele[1] - 50) + getRandom(100), tele[2]);
-	}
-	
 	private int enterInstance(L2PcInstance player, String template)
 	{
 		int instanceId = 0;
@@ -478,7 +457,7 @@ public class HellboundTown extends Quest
 			world.addAllowed(partyMember.getObjectId());
 		}
 		
-		((TownWorld) world).spawnedAmaskari = (L2MonsterInstance) addSpawn(AMASKARI, AMASKARI_SPAWN_POINT[0], AMASKARI_SPAWN_POINT[1], AMASKARI_SPAWN_POINT[2], AMASKARI_SPAWN_POINT[3], false, 0, false, instanceId);
+		((TownWorld) world).spawnedAmaskari = (L2MonsterInstance) addSpawn(AMASKARI, AMASKARI_SPAWN_POINT, false, 0, false, instanceId);
 		return instanceId;
 	}
 	
@@ -530,7 +509,7 @@ public class HellboundTown extends Quest
 		return ret >= 0 ? ret + 2 : -1;
 	}
 	
-	private static class ExitInstance implements Runnable
+	private class ExitInstance implements Runnable
 	{
 		private final L2Party _party;
 		private final TownWorld _world;
@@ -551,8 +530,7 @@ public class HellboundTown extends Quest
 					if ((partyMember != null) && !partyMember.isDead())
 					{
 						_world.removeAllowed(partyMember.getObjectId());
-						partyMember.setInstanceId(0);
-						partyMember.teleToLocation((EXIT_POINT[0] - 100) + getRandom(50), (EXIT_POINT[1] - 100) + getRandom(50), EXIT_POINT[2]);
+						teleportPlayer(partyMember, EXIT_POINT, 0);
 					}
 				}
 			}

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

@@ -18,7 +18,6 @@
  */
 package instances.HideoutOfTheDawn;
 
-import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.instancemanager.InstanceManager;
 import com.l2jserver.gameserver.model.Location;
 import com.l2jserver.gameserver.model.actor.L2Character;
@@ -79,13 +78,6 @@ public class HideoutOfTheDawn extends Quest
 		return super.onTalk(npc, talker);
 	}
 	
-	private void teleportPlayer(L2PcInstance player, Location loc)
-	{
-		removeBuffs(player);
-		player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
-		player.teleToLocation(loc, 0);
-	}
-	
 	protected int enterInstance(L2PcInstance player, String template, Location loc)
 	{
 		// check for existing instances for this player
@@ -98,8 +90,8 @@ public class HideoutOfTheDawn extends Quest
 				player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
 				return 0;
 			}
-			loc.setInstanceId(world.getInstanceId());
-			teleportPlayer(player, loc);
+			teleportPlayer(player, loc, world.getInstanceId(), false);
+			removeBuffs(player);
 			return 0;
 		}
 		// New instance
@@ -111,8 +103,8 @@ public class HideoutOfTheDawn extends Quest
 		InstanceManager.getInstance().addWorld(world);
 		_log.info("SevenSign started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
 		// teleport players
-		loc.setInstanceId(world.getInstanceId());
-		teleportPlayer(player, loc);
+		teleportPlayer(player, loc, world.getInstanceId(), false);
+		removeBuffs(player);
 		world.addAllowed(player.getObjectId());
 		
 		return world.getInstanceId();

+ 0 - 14
L2J_DataPack_BETA/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java

@@ -25,7 +25,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.logging.Level;
 
-import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.datatables.SkillTable;
 import com.l2jserver.gameserver.instancemanager.InstanceManager;
 import com.l2jserver.gameserver.model.L2Party;
@@ -1393,19 +1392,6 @@ public class Kamaloka extends Quest
 		}
 	}
 	
-	/**
-	 * Teleport player and pet to/from instance
-	 * @param player
-	 * @param loc
-	 * @param instanceId
-	 */
-	private static final void teleportPlayer(L2PcInstance player, Location loc, int instanceId)
-	{
-		player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
-		player.setInstanceId(instanceId);
-		player.teleToLocation(loc, true);
-	}
-	
 	/**
 	 * Handling enter of the players into kamaloka
 	 * @param player party leader

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

@@ -20,7 +20,6 @@ package instances.NornilsGarden;
 
 import quests.Q00179_IntoTheLargeCavern.Q00179_IntoTheLargeCavern;
 
-import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.datatables.SkillTable;
 import com.l2jserver.gameserver.instancemanager.InstanceManager;
 import com.l2jserver.gameserver.model.L2Party;
@@ -76,18 +75,8 @@ public class NornilsGarden extends Quest
 		32262
 	};
 	
-	private static final int[] SPAWN_PPL =
-	{
-		-111184,
-		74540,
-		-12430
-	};
-	private static final int[] EXIT_PPL =
-	{
-		-74058,
-		52040,
-		-3680
-	};
+	private static final Location SPAWN_PPL = new Location(-111184, 74540, -12430);
+	private static final Location EXIT_PPL = new Location(-74058, 52040, -3680);
 	
 	private static final int[][] _auto_gates =
 	{
@@ -242,7 +231,8 @@ public class NornilsGarden extends Quest
 		}
 	}
 	
-	private final void teleportPlayer(L2PcInstance player, int[] coords, int instanceId)
+	@Override
+	public final void teleportPlayer(L2PcInstance player, Location loc, int instanceId)
 	{
 		QuestState st = player.getQuestState(qn);
 		if (st == null)
@@ -256,9 +246,7 @@ public class NornilsGarden extends Quest
 			removeBuffs(player.getSummon());
 			giveBuffs(player.getSummon());
 		}
-		player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
-		player.setInstanceId(instanceId);
-		player.teleToLocation(coords[0], coords[1], coords[2], true);
+		super.teleportPlayer(player, loc, instanceId);
 	}
 	
 	private void exitInstance(L2PcInstance player)
@@ -268,9 +256,7 @@ public class NornilsGarden extends Quest
 		{
 			NornilsWorld world = ((NornilsWorld) inst);
 			world.removeAllowed(player.getObjectId());
-			player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
-			player.setInstanceId(0);
-			player.teleToLocation(EXIT_PPL[0], EXIT_PPL[1], EXIT_PPL[2], true);
+			teleportPlayer(player, EXIT_PPL, 0);
 		}
 	}
 	
@@ -340,7 +326,7 @@ public class NornilsGarden extends Quest
 	{
 		world.first_npc = addSpawn(18362, -109702, 74696, -12528, 49568, false, 0, false, world.getInstanceId());
 		
-		L2DoorInstance door = InstanceManager.getInstance().getInstance(world.getInstanceId()).getDoor(16200010);
+		final L2DoorInstance door = getDoor(16200010, world.getInstanceId());
 		if (door != null)
 		{
 			door.setTargetable(false);
@@ -420,17 +406,13 @@ public class NornilsGarden extends Quest
 		}
 	}
 	
-	private void openDoor(QuestState st, L2PcInstance player, int doorId)
+	public void openDoor(QuestState st, L2PcInstance player, int doorId)
 	{
 		st.unset("correct");
 		InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(player.getInstanceId());
 		if (tmpworld instanceof NornilsWorld)
 		{
-			L2DoorInstance door = InstanceManager.getInstance().getInstance(tmpworld.getInstanceId()).getDoor(doorId);
-			if (door != null)
-			{
-				door.openMe();
-			}
+			openDoor(doorId, tmpworld.getInstanceId());
 		}
 	}
 	
@@ -518,11 +500,7 @@ public class NornilsGarden extends Quest
 				{
 					if (zone.getId() == _auto[0])
 					{
-						L2DoorInstance door = InstanceManager.getInstance().getInstance(tmpworld.getInstanceId()).getDoor(_auto[1]);
-						if (door != null)
-						{
-							door.openMe();
-						}
+						openDoor(_auto[1], tmpworld.getInstanceId());
 					}
 					if (zone.getId() == 20111)
 					{
@@ -673,12 +651,7 @@ public class NornilsGarden extends Quest
 					InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(player.getInstanceId());
 					if (tmpworld instanceof NornilsWorld)
 					{
-						L2DoorInstance door = InstanceManager.getInstance().getInstance(tmpworld.getInstanceId()).getDoor(_gk[2]);
-						if (door != null)
-						{
-							door.openMe();
-							door.sendInfo(player);
-						}
+						openDoor(_gk[2], tmpworld.getInstanceId());
 					}
 				}
 			}

+ 0 - 8
L2J_DataPack_BETA/dist/game/data/scripts/instances/RankuFloor/RankuFloor.java

@@ -20,7 +20,6 @@ package instances.RankuFloor;
 
 import java.util.Calendar;
 
-import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.instancemanager.InstanceManager;
 import com.l2jserver.gameserver.model.L2Party;
 import com.l2jserver.gameserver.model.L2World;
@@ -275,13 +274,6 @@ public class RankuFloor extends Quest
 		}
 	}
 	
-	private void teleportPlayer(L2PcInstance player, Location loc, int instanceId)
-	{
-		player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
-		player.setInstanceId(instanceId);
-		player.teleToLocation(loc, true);
-	}
-	
 	public static void main(String[] args)
 	{
 		new RankuFloor(-1, RankuFloor.class.getSimpleName(), "instances");

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

@@ -26,7 +26,6 @@ import com.l2jserver.gameserver.model.L2CharPosition;
 import com.l2jserver.gameserver.model.L2World;
 import com.l2jserver.gameserver.model.Location;
 import com.l2jserver.gameserver.model.actor.L2Npc;
-import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.holders.SkillHolder;
 import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
@@ -460,17 +459,6 @@ public class SanctumOftheLordsOfDawn extends Quest
 		startQuestTimer("Part2", 3000, world.w_npc_7, null);
 	}
 	
-	protected void openDoor(int doorId, int instanceId)
-	{
-		for (L2DoorInstance door : InstanceManager.getInstance().getInstance(instanceId).getDoors())
-		{
-			if (door.getDoorId() == doorId)
-			{
-				door.openMe();
-			}
-		}
-	}
-	
 	@Override
 	public String onTalk(L2Npc npc, L2PcInstance talker)
 	{

+ 0 - 6
L2J_DataPack_BETA/dist/game/data/scripts/instances/SecretArea/SecretArea.java

@@ -47,12 +47,6 @@ public class SecretArea extends Quest
 		new Location(-185057, 242821, 1576)
 	};
 	
-	private void teleportPlayer(L2PcInstance player, Location loc, int instanceId)
-	{
-		player.setInstanceId(instanceId);
-		player.teleToLocation(loc, false);
-	}
-	
 	protected void enterInstance(L2PcInstance player)
 	{
 		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);

+ 1 - 26
L2J_DataPack_BETA/dist/game/data/scripts/instances/SeedOfDestruction/Stage1.java

@@ -457,31 +457,6 @@ public class Stage1 extends Quest
 		}
 	}
 	
-	protected void openDoor(int doorId, int instanceId)
-	{
-		for (L2DoorInstance door : InstanceManager.getInstance().getInstance(instanceId).getDoors())
-		{
-			if (door.getDoorId() == doorId)
-			{
-				door.openMe();
-			}
-		}
-	}
-	
-	protected void closeDoor(int doorId, int instanceId)
-	{
-		for (L2DoorInstance door : InstanceManager.getInstance().getInstance(instanceId).getDoors())
-		{
-			if (door.getDoorId() == doorId)
-			{
-				if (door.getOpen())
-				{
-					door.closeMe();
-				}
-			}
-		}
-	}
-	
 	private boolean checkConditions(L2PcInstance player)
 	{
 		final L2Party party = player.getParty();
@@ -918,7 +893,7 @@ public class Stage1 extends Quest
 			}
 			else if (event.equalsIgnoreCase("DoorCheck"))
 			{
-				L2DoorInstance tmp = InstanceManager.getInstance().getInstance(npc.getInstanceId()).getDoor(FORTRESS_DOOR);
+				L2DoorInstance tmp = getDoor(FORTRESS_DOOR, npc.getInstanceId());
 				if (tmp.getCurrentHp() < tmp.getMaxHp())
 				{
 					world.deviceSpawnedMobCount = 0;