diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/xsd/instance.xsd b/L2J_Mobius_8.0_Homunculus/dist/game/data/xsd/instance.xsd
index 4430bc9b58..81b705e0ce 100644
--- a/L2J_Mobius_8.0_Homunculus/dist/game/data/xsd/instance.xsd
+++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/xsd/instance.xsd
@@ -89,6 +89,7 @@
+
diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java
index 39cd0d2c8b..122d6aeafa 100644
--- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java
+++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java
@@ -24,5 +24,6 @@ public enum InstanceTeleportType
NONE,
FIXED,
RANDOM,
- ORIGIN
+ ORIGIN,
+ TOWN
}
\ No newline at end of file
diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java
index d1f8cd35e2..e36183899e 100644
--- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java
+++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java
@@ -209,6 +209,10 @@ public class InstanceManager implements IXmlReader
{
template.setExitLocation(type, null);
}
+ else if (type.equals(InstanceTeleportType.TOWN))
+ {
+ template.setExitLocation(type, null);
+ }
else
{
final List locations = new ArrayList<>();
diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java
index 920d974e48..bcf562cad9 100644
--- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java
+++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java
@@ -325,23 +325,7 @@ public class MapRegionManager implements IXmlReader
// Karma player land out of city
if (player.getReputation() < 0)
{
- try
- {
- final RespawnZone zone = ZoneManager.getInstance().getZone(player, RespawnZone.class);
- if (zone != null)
- {
- return getRestartRegion(creature, zone.getRespawnPoint((PlayerInstance) creature)).getChaoticSpawnLoc();
- }
- return getMapRegion(creature).getChaoticSpawnLoc();
- }
- catch (Exception e)
- {
- if (player.isFlyingMounted())
- {
- return REGIONS.get("union_base_of_kserth").getChaoticSpawnLoc();
- }
- return REGIONS.get(DEFAULT_RESPAWN).getChaoticSpawnLoc();
- }
+ return getNearestKarmaRespawn(player);
}
// Checking if needed to be respawned in "far" town from the castle;
@@ -377,6 +361,32 @@ public class MapRegionManager implements IXmlReader
}
// Get the nearest town
+ return getNearestTownRespawn(creature);
+ }
+
+ public Location getNearestKarmaRespawn(PlayerInstance player)
+ {
+ try
+ {
+ final RespawnZone zone = ZoneManager.getInstance().getZone(player, RespawnZone.class);
+ if (zone != null)
+ {
+ return getRestartRegion(player, zone.getRespawnPoint(player)).getChaoticSpawnLoc();
+ }
+ return getMapRegion(player).getChaoticSpawnLoc();
+ }
+ catch (Exception e)
+ {
+ if (player.isFlyingMounted())
+ {
+ return REGIONS.get("union_base_of_kserth").getChaoticSpawnLoc();
+ }
+ return REGIONS.get(DEFAULT_RESPAWN).getChaoticSpawnLoc();
+ }
+ }
+
+ public Location getNearestTownRespawn(Creature creature)
+ {
try
{
final RespawnZone zone = ZoneManager.getInstance().getZone(creature, RespawnZone.class);
diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java
index e82a9a7bc6..0b6094a968 100644
--- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java
+++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java
@@ -33,6 +33,7 @@ import org.l2jmobius.gameserver.enums.InstanceReenterType;
import org.l2jmobius.gameserver.enums.InstanceRemoveBuffType;
import org.l2jmobius.gameserver.enums.InstanceTeleportType;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
+import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.model.AbstractPlayerGroup;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.PlayerCondOverride;
@@ -367,7 +368,6 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
public Location getExitLocation(PlayerInstance player)
{
Location location = null;
-
switch (_exitLocationType)
{
case RANDOM:
@@ -391,6 +391,18 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
}
break;
}
+ case TOWN:
+ {
+ if (player.getReputation() < 0)
+ {
+ location = MapRegionManager.getInstance().getNearestKarmaRespawn(player);
+ }
+ else
+ {
+ location = MapRegionManager.getInstance().getNearestTownRespawn(player);
+ }
+ break;
+ }
}
return location;
}
diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/xsd/instance.xsd b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/xsd/instance.xsd
index 4430bc9b58..81b705e0ce 100644
--- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/xsd/instance.xsd
+++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/xsd/instance.xsd
@@ -89,6 +89,7 @@
+
diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java
index 39cd0d2c8b..122d6aeafa 100644
--- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java
+++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java
@@ -24,5 +24,6 @@ public enum InstanceTeleportType
NONE,
FIXED,
RANDOM,
- ORIGIN
+ ORIGIN,
+ TOWN
}
\ No newline at end of file
diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java
index d1f8cd35e2..e36183899e 100644
--- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java
+++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java
@@ -209,6 +209,10 @@ public class InstanceManager implements IXmlReader
{
template.setExitLocation(type, null);
}
+ else if (type.equals(InstanceTeleportType.TOWN))
+ {
+ template.setExitLocation(type, null);
+ }
else
{
final List locations = new ArrayList<>();
diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java
index 920d974e48..bcf562cad9 100644
--- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java
+++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java
@@ -325,23 +325,7 @@ public class MapRegionManager implements IXmlReader
// Karma player land out of city
if (player.getReputation() < 0)
{
- try
- {
- final RespawnZone zone = ZoneManager.getInstance().getZone(player, RespawnZone.class);
- if (zone != null)
- {
- return getRestartRegion(creature, zone.getRespawnPoint((PlayerInstance) creature)).getChaoticSpawnLoc();
- }
- return getMapRegion(creature).getChaoticSpawnLoc();
- }
- catch (Exception e)
- {
- if (player.isFlyingMounted())
- {
- return REGIONS.get("union_base_of_kserth").getChaoticSpawnLoc();
- }
- return REGIONS.get(DEFAULT_RESPAWN).getChaoticSpawnLoc();
- }
+ return getNearestKarmaRespawn(player);
}
// Checking if needed to be respawned in "far" town from the castle;
@@ -377,6 +361,32 @@ public class MapRegionManager implements IXmlReader
}
// Get the nearest town
+ return getNearestTownRespawn(creature);
+ }
+
+ public Location getNearestKarmaRespawn(PlayerInstance player)
+ {
+ try
+ {
+ final RespawnZone zone = ZoneManager.getInstance().getZone(player, RespawnZone.class);
+ if (zone != null)
+ {
+ return getRestartRegion(player, zone.getRespawnPoint(player)).getChaoticSpawnLoc();
+ }
+ return getMapRegion(player).getChaoticSpawnLoc();
+ }
+ catch (Exception e)
+ {
+ if (player.isFlyingMounted())
+ {
+ return REGIONS.get("union_base_of_kserth").getChaoticSpawnLoc();
+ }
+ return REGIONS.get(DEFAULT_RESPAWN).getChaoticSpawnLoc();
+ }
+ }
+
+ public Location getNearestTownRespawn(Creature creature)
+ {
try
{
final RespawnZone zone = ZoneManager.getInstance().getZone(creature, RespawnZone.class);
diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java
index e82a9a7bc6..0b6094a968 100644
--- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java
+++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java
@@ -33,6 +33,7 @@ import org.l2jmobius.gameserver.enums.InstanceReenterType;
import org.l2jmobius.gameserver.enums.InstanceRemoveBuffType;
import org.l2jmobius.gameserver.enums.InstanceTeleportType;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
+import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.model.AbstractPlayerGroup;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.PlayerCondOverride;
@@ -367,7 +368,6 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
public Location getExitLocation(PlayerInstance player)
{
Location location = null;
-
switch (_exitLocationType)
{
case RANDOM:
@@ -391,6 +391,18 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
}
break;
}
+ case TOWN:
+ {
+ if (player.getReputation() < 0)
+ {
+ location = MapRegionManager.getInstance().getNearestKarmaRespawn(player);
+ }
+ else
+ {
+ location = MapRegionManager.getInstance().getNearestTownRespawn(player);
+ }
+ break;
+ }
}
return location;
}
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/instance.xsd b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/instance.xsd
index 8c43060e41..e016f29366 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/instance.xsd
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/instance.xsd
@@ -89,6 +89,7 @@
+
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java
index 39cd0d2c8b..122d6aeafa 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java
@@ -24,5 +24,6 @@ public enum InstanceTeleportType
NONE,
FIXED,
RANDOM,
- ORIGIN
+ ORIGIN,
+ TOWN
}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java
index d1f8cd35e2..e36183899e 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java
@@ -209,6 +209,10 @@ public class InstanceManager implements IXmlReader
{
template.setExitLocation(type, null);
}
+ else if (type.equals(InstanceTeleportType.TOWN))
+ {
+ template.setExitLocation(type, null);
+ }
else
{
final List locations = new ArrayList<>();
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java
index 97f2cf5b63..c01f5c6c3a 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java
@@ -325,28 +325,7 @@ public class MapRegionManager implements IXmlReader
// Karma player land out of city
if (player.getReputation() < 0)
{
- try
- {
- final RespawnZone zone = ZoneManager.getInstance().getZone(player, RespawnZone.class);
- if (zone != null)
- {
- return getRestartRegion(creature, zone.getRespawnPoint((PlayerInstance) creature)).getChaoticSpawnLoc();
- }
- // Opposing race check.
- if (getMapRegion(creature).getBannedRace().containsKey(creature.getRace()))
- {
- return REGIONS.get(getMapRegion(creature).getBannedRace().get(creature.getRace())).getChaoticSpawnLoc();
- }
- return getMapRegion(creature).getChaoticSpawnLoc();
- }
- catch (Exception e)
- {
- if (player.isFlyingMounted())
- {
- return REGIONS.get("union_base_of_kserth").getChaoticSpawnLoc();
- }
- return REGIONS.get(DEFAULT_RESPAWN).getChaoticSpawnLoc();
- }
+ return getNearestKarmaRespawn(player);
}
// Checking if needed to be respawned in "far" town from the castle;
@@ -382,6 +361,37 @@ public class MapRegionManager implements IXmlReader
}
// Get the nearest town
+ return getNearestTownRespawn(creature);
+ }
+
+ public Location getNearestKarmaRespawn(PlayerInstance player)
+ {
+ try
+ {
+ final RespawnZone zone = ZoneManager.getInstance().getZone(player, RespawnZone.class);
+ if (zone != null)
+ {
+ return getRestartRegion(player, zone.getRespawnPoint(player)).getChaoticSpawnLoc();
+ }
+ // Opposing race check.
+ if (getMapRegion(player).getBannedRace().containsKey(player.getRace()))
+ {
+ return REGIONS.get(getMapRegion(player).getBannedRace().get(player.getRace())).getChaoticSpawnLoc();
+ }
+ return getMapRegion(player).getChaoticSpawnLoc();
+ }
+ catch (Exception e)
+ {
+ if (player.isFlyingMounted())
+ {
+ return REGIONS.get("union_base_of_kserth").getChaoticSpawnLoc();
+ }
+ return REGIONS.get(DEFAULT_RESPAWN).getChaoticSpawnLoc();
+ }
+ }
+
+ public Location getNearestTownRespawn(Creature creature)
+ {
try
{
final RespawnZone zone = ZoneManager.getInstance().getZone(creature, RespawnZone.class);
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java
index e82a9a7bc6..0b6094a968 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java
@@ -33,6 +33,7 @@ import org.l2jmobius.gameserver.enums.InstanceReenterType;
import org.l2jmobius.gameserver.enums.InstanceRemoveBuffType;
import org.l2jmobius.gameserver.enums.InstanceTeleportType;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
+import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.model.AbstractPlayerGroup;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.PlayerCondOverride;
@@ -367,7 +368,6 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
public Location getExitLocation(PlayerInstance player)
{
Location location = null;
-
switch (_exitLocationType)
{
case RANDOM:
@@ -391,6 +391,18 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
}
break;
}
+ case TOWN:
+ {
+ if (player.getReputation() < 0)
+ {
+ location = MapRegionManager.getInstance().getNearestKarmaRespawn(player);
+ }
+ else
+ {
+ location = MapRegionManager.getInstance().getNearestTownRespawn(player);
+ }
+ break;
+ }
}
return location;
}
diff --git a/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/instance.xsd b/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/instance.xsd
index 8c43060e41..e016f29366 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/instance.xsd
+++ b/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/instance.xsd
@@ -89,6 +89,7 @@
+
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java
index 39cd0d2c8b..122d6aeafa 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/enums/InstanceTeleportType.java
@@ -24,5 +24,6 @@ public enum InstanceTeleportType
NONE,
FIXED,
RANDOM,
- ORIGIN
+ ORIGIN,
+ TOWN
}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java
index d1f8cd35e2..e36183899e 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/instancemanager/InstanceManager.java
@@ -209,6 +209,10 @@ public class InstanceManager implements IXmlReader
{
template.setExitLocation(type, null);
}
+ else if (type.equals(InstanceTeleportType.TOWN))
+ {
+ template.setExitLocation(type, null);
+ }
else
{
final List locations = new ArrayList<>();
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java
index 97f2cf5b63..c01f5c6c3a 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/instancemanager/MapRegionManager.java
@@ -325,28 +325,7 @@ public class MapRegionManager implements IXmlReader
// Karma player land out of city
if (player.getReputation() < 0)
{
- try
- {
- final RespawnZone zone = ZoneManager.getInstance().getZone(player, RespawnZone.class);
- if (zone != null)
- {
- return getRestartRegion(creature, zone.getRespawnPoint((PlayerInstance) creature)).getChaoticSpawnLoc();
- }
- // Opposing race check.
- if (getMapRegion(creature).getBannedRace().containsKey(creature.getRace()))
- {
- return REGIONS.get(getMapRegion(creature).getBannedRace().get(creature.getRace())).getChaoticSpawnLoc();
- }
- return getMapRegion(creature).getChaoticSpawnLoc();
- }
- catch (Exception e)
- {
- if (player.isFlyingMounted())
- {
- return REGIONS.get("union_base_of_kserth").getChaoticSpawnLoc();
- }
- return REGIONS.get(DEFAULT_RESPAWN).getChaoticSpawnLoc();
- }
+ return getNearestKarmaRespawn(player);
}
// Checking if needed to be respawned in "far" town from the castle;
@@ -382,6 +361,37 @@ public class MapRegionManager implements IXmlReader
}
// Get the nearest town
+ return getNearestTownRespawn(creature);
+ }
+
+ public Location getNearestKarmaRespawn(PlayerInstance player)
+ {
+ try
+ {
+ final RespawnZone zone = ZoneManager.getInstance().getZone(player, RespawnZone.class);
+ if (zone != null)
+ {
+ return getRestartRegion(player, zone.getRespawnPoint(player)).getChaoticSpawnLoc();
+ }
+ // Opposing race check.
+ if (getMapRegion(player).getBannedRace().containsKey(player.getRace()))
+ {
+ return REGIONS.get(getMapRegion(player).getBannedRace().get(player.getRace())).getChaoticSpawnLoc();
+ }
+ return getMapRegion(player).getChaoticSpawnLoc();
+ }
+ catch (Exception e)
+ {
+ if (player.isFlyingMounted())
+ {
+ return REGIONS.get("union_base_of_kserth").getChaoticSpawnLoc();
+ }
+ return REGIONS.get(DEFAULT_RESPAWN).getChaoticSpawnLoc();
+ }
+ }
+
+ public Location getNearestTownRespawn(Creature creature)
+ {
try
{
final RespawnZone zone = ZoneManager.getInstance().getZone(creature, RespawnZone.class);
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java
index e82a9a7bc6..0b6094a968 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/instancezone/InstanceTemplate.java
@@ -33,6 +33,7 @@ import org.l2jmobius.gameserver.enums.InstanceReenterType;
import org.l2jmobius.gameserver.enums.InstanceRemoveBuffType;
import org.l2jmobius.gameserver.enums.InstanceTeleportType;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
+import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.model.AbstractPlayerGroup;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.PlayerCondOverride;
@@ -367,7 +368,6 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
public Location getExitLocation(PlayerInstance player)
{
Location location = null;
-
switch (_exitLocationType)
{
case RANDOM:
@@ -391,6 +391,18 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
}
break;
}
+ case TOWN:
+ {
+ if (player.getReputation() < 0)
+ {
+ location = MapRegionManager.getInstance().getNearestKarmaRespawn(player);
+ }
+ else
+ {
+ location = MapRegionManager.getInstance().getNearestTownRespawn(player);
+ }
+ break;
+ }
}
return location;
}