Support for exiting instance at nearest town.
This commit is contained in:
parent
35553698f1
commit
f4f7c98c29
@ -89,6 +89,7 @@
|
|||||||
<xs:enumeration value="FIXED" />
|
<xs:enumeration value="FIXED" />
|
||||||
<xs:enumeration value="RANDOM" />
|
<xs:enumeration value="RANDOM" />
|
||||||
<xs:enumeration value="ORIGIN" />
|
<xs:enumeration value="ORIGIN" />
|
||||||
|
<xs:enumeration value="TOWN" />
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
</xs:attribute>
|
</xs:attribute>
|
||||||
|
@ -24,5 +24,6 @@ public enum InstanceTeleportType
|
|||||||
NONE,
|
NONE,
|
||||||
FIXED,
|
FIXED,
|
||||||
RANDOM,
|
RANDOM,
|
||||||
ORIGIN
|
ORIGIN,
|
||||||
|
TOWN
|
||||||
}
|
}
|
@ -209,6 +209,10 @@ public class InstanceManager implements IXmlReader
|
|||||||
{
|
{
|
||||||
template.setExitLocation(type, null);
|
template.setExitLocation(type, null);
|
||||||
}
|
}
|
||||||
|
else if (type.equals(InstanceTeleportType.TOWN))
|
||||||
|
{
|
||||||
|
template.setExitLocation(type, null);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final List<Location> locations = new ArrayList<>();
|
final List<Location> locations = new ArrayList<>();
|
||||||
|
@ -325,23 +325,7 @@ public class MapRegionManager implements IXmlReader
|
|||||||
// Karma player land out of city
|
// Karma player land out of city
|
||||||
if (player.getReputation() < 0)
|
if (player.getReputation() < 0)
|
||||||
{
|
{
|
||||||
try
|
return getNearestKarmaRespawn(player);
|
||||||
{
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checking if needed to be respawned in "far" town from the castle;
|
// 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
|
// 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
|
try
|
||||||
{
|
{
|
||||||
final RespawnZone zone = ZoneManager.getInstance().getZone(creature, RespawnZone.class);
|
final RespawnZone zone = ZoneManager.getInstance().getZone(creature, RespawnZone.class);
|
||||||
|
@ -33,6 +33,7 @@ import org.l2jmobius.gameserver.enums.InstanceReenterType;
|
|||||||
import org.l2jmobius.gameserver.enums.InstanceRemoveBuffType;
|
import org.l2jmobius.gameserver.enums.InstanceRemoveBuffType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceTeleportType;
|
import org.l2jmobius.gameserver.enums.InstanceTeleportType;
|
||||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||||
|
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||||
import org.l2jmobius.gameserver.model.AbstractPlayerGroup;
|
import org.l2jmobius.gameserver.model.AbstractPlayerGroup;
|
||||||
import org.l2jmobius.gameserver.model.Location;
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
import org.l2jmobius.gameserver.model.PlayerCondOverride;
|
import org.l2jmobius.gameserver.model.PlayerCondOverride;
|
||||||
@ -367,7 +368,6 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
|
|||||||
public Location getExitLocation(PlayerInstance player)
|
public Location getExitLocation(PlayerInstance player)
|
||||||
{
|
{
|
||||||
Location location = null;
|
Location location = null;
|
||||||
|
|
||||||
switch (_exitLocationType)
|
switch (_exitLocationType)
|
||||||
{
|
{
|
||||||
case RANDOM:
|
case RANDOM:
|
||||||
@ -391,6 +391,18 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TOWN:
|
||||||
|
{
|
||||||
|
if (player.getReputation() < 0)
|
||||||
|
{
|
||||||
|
location = MapRegionManager.getInstance().getNearestKarmaRespawn(player);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
location = MapRegionManager.getInstance().getNearestTownRespawn(player);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,7 @@
|
|||||||
<xs:enumeration value="FIXED" />
|
<xs:enumeration value="FIXED" />
|
||||||
<xs:enumeration value="RANDOM" />
|
<xs:enumeration value="RANDOM" />
|
||||||
<xs:enumeration value="ORIGIN" />
|
<xs:enumeration value="ORIGIN" />
|
||||||
|
<xs:enumeration value="TOWN" />
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
</xs:attribute>
|
</xs:attribute>
|
||||||
|
@ -24,5 +24,6 @@ public enum InstanceTeleportType
|
|||||||
NONE,
|
NONE,
|
||||||
FIXED,
|
FIXED,
|
||||||
RANDOM,
|
RANDOM,
|
||||||
ORIGIN
|
ORIGIN,
|
||||||
|
TOWN
|
||||||
}
|
}
|
@ -209,6 +209,10 @@ public class InstanceManager implements IXmlReader
|
|||||||
{
|
{
|
||||||
template.setExitLocation(type, null);
|
template.setExitLocation(type, null);
|
||||||
}
|
}
|
||||||
|
else if (type.equals(InstanceTeleportType.TOWN))
|
||||||
|
{
|
||||||
|
template.setExitLocation(type, null);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final List<Location> locations = new ArrayList<>();
|
final List<Location> locations = new ArrayList<>();
|
||||||
|
@ -325,23 +325,7 @@ public class MapRegionManager implements IXmlReader
|
|||||||
// Karma player land out of city
|
// Karma player land out of city
|
||||||
if (player.getReputation() < 0)
|
if (player.getReputation() < 0)
|
||||||
{
|
{
|
||||||
try
|
return getNearestKarmaRespawn(player);
|
||||||
{
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checking if needed to be respawned in "far" town from the castle;
|
// 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
|
// 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
|
try
|
||||||
{
|
{
|
||||||
final RespawnZone zone = ZoneManager.getInstance().getZone(creature, RespawnZone.class);
|
final RespawnZone zone = ZoneManager.getInstance().getZone(creature, RespawnZone.class);
|
||||||
|
@ -33,6 +33,7 @@ import org.l2jmobius.gameserver.enums.InstanceReenterType;
|
|||||||
import org.l2jmobius.gameserver.enums.InstanceRemoveBuffType;
|
import org.l2jmobius.gameserver.enums.InstanceRemoveBuffType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceTeleportType;
|
import org.l2jmobius.gameserver.enums.InstanceTeleportType;
|
||||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||||
|
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||||
import org.l2jmobius.gameserver.model.AbstractPlayerGroup;
|
import org.l2jmobius.gameserver.model.AbstractPlayerGroup;
|
||||||
import org.l2jmobius.gameserver.model.Location;
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
import org.l2jmobius.gameserver.model.PlayerCondOverride;
|
import org.l2jmobius.gameserver.model.PlayerCondOverride;
|
||||||
@ -367,7 +368,6 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
|
|||||||
public Location getExitLocation(PlayerInstance player)
|
public Location getExitLocation(PlayerInstance player)
|
||||||
{
|
{
|
||||||
Location location = null;
|
Location location = null;
|
||||||
|
|
||||||
switch (_exitLocationType)
|
switch (_exitLocationType)
|
||||||
{
|
{
|
||||||
case RANDOM:
|
case RANDOM:
|
||||||
@ -391,6 +391,18 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TOWN:
|
||||||
|
{
|
||||||
|
if (player.getReputation() < 0)
|
||||||
|
{
|
||||||
|
location = MapRegionManager.getInstance().getNearestKarmaRespawn(player);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
location = MapRegionManager.getInstance().getNearestTownRespawn(player);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,7 @@
|
|||||||
<xs:enumeration value="FIXED" />
|
<xs:enumeration value="FIXED" />
|
||||||
<xs:enumeration value="RANDOM" />
|
<xs:enumeration value="RANDOM" />
|
||||||
<xs:enumeration value="ORIGIN" />
|
<xs:enumeration value="ORIGIN" />
|
||||||
|
<xs:enumeration value="TOWN" />
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
</xs:attribute>
|
</xs:attribute>
|
||||||
|
@ -24,5 +24,6 @@ public enum InstanceTeleportType
|
|||||||
NONE,
|
NONE,
|
||||||
FIXED,
|
FIXED,
|
||||||
RANDOM,
|
RANDOM,
|
||||||
ORIGIN
|
ORIGIN,
|
||||||
|
TOWN
|
||||||
}
|
}
|
@ -209,6 +209,10 @@ public class InstanceManager implements IXmlReader
|
|||||||
{
|
{
|
||||||
template.setExitLocation(type, null);
|
template.setExitLocation(type, null);
|
||||||
}
|
}
|
||||||
|
else if (type.equals(InstanceTeleportType.TOWN))
|
||||||
|
{
|
||||||
|
template.setExitLocation(type, null);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final List<Location> locations = new ArrayList<>();
|
final List<Location> locations = new ArrayList<>();
|
||||||
|
@ -325,28 +325,7 @@ public class MapRegionManager implements IXmlReader
|
|||||||
// Karma player land out of city
|
// Karma player land out of city
|
||||||
if (player.getReputation() < 0)
|
if (player.getReputation() < 0)
|
||||||
{
|
{
|
||||||
try
|
return getNearestKarmaRespawn(player);
|
||||||
{
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checking if needed to be respawned in "far" town from the castle;
|
// 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
|
// 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
|
try
|
||||||
{
|
{
|
||||||
final RespawnZone zone = ZoneManager.getInstance().getZone(creature, RespawnZone.class);
|
final RespawnZone zone = ZoneManager.getInstance().getZone(creature, RespawnZone.class);
|
||||||
|
@ -33,6 +33,7 @@ import org.l2jmobius.gameserver.enums.InstanceReenterType;
|
|||||||
import org.l2jmobius.gameserver.enums.InstanceRemoveBuffType;
|
import org.l2jmobius.gameserver.enums.InstanceRemoveBuffType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceTeleportType;
|
import org.l2jmobius.gameserver.enums.InstanceTeleportType;
|
||||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||||
|
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||||
import org.l2jmobius.gameserver.model.AbstractPlayerGroup;
|
import org.l2jmobius.gameserver.model.AbstractPlayerGroup;
|
||||||
import org.l2jmobius.gameserver.model.Location;
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
import org.l2jmobius.gameserver.model.PlayerCondOverride;
|
import org.l2jmobius.gameserver.model.PlayerCondOverride;
|
||||||
@ -367,7 +368,6 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
|
|||||||
public Location getExitLocation(PlayerInstance player)
|
public Location getExitLocation(PlayerInstance player)
|
||||||
{
|
{
|
||||||
Location location = null;
|
Location location = null;
|
||||||
|
|
||||||
switch (_exitLocationType)
|
switch (_exitLocationType)
|
||||||
{
|
{
|
||||||
case RANDOM:
|
case RANDOM:
|
||||||
@ -391,6 +391,18 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TOWN:
|
||||||
|
{
|
||||||
|
if (player.getReputation() < 0)
|
||||||
|
{
|
||||||
|
location = MapRegionManager.getInstance().getNearestKarmaRespawn(player);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
location = MapRegionManager.getInstance().getNearestTownRespawn(player);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,7 @@
|
|||||||
<xs:enumeration value="FIXED" />
|
<xs:enumeration value="FIXED" />
|
||||||
<xs:enumeration value="RANDOM" />
|
<xs:enumeration value="RANDOM" />
|
||||||
<xs:enumeration value="ORIGIN" />
|
<xs:enumeration value="ORIGIN" />
|
||||||
|
<xs:enumeration value="TOWN" />
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
</xs:attribute>
|
</xs:attribute>
|
||||||
|
@ -24,5 +24,6 @@ public enum InstanceTeleportType
|
|||||||
NONE,
|
NONE,
|
||||||
FIXED,
|
FIXED,
|
||||||
RANDOM,
|
RANDOM,
|
||||||
ORIGIN
|
ORIGIN,
|
||||||
|
TOWN
|
||||||
}
|
}
|
@ -209,6 +209,10 @@ public class InstanceManager implements IXmlReader
|
|||||||
{
|
{
|
||||||
template.setExitLocation(type, null);
|
template.setExitLocation(type, null);
|
||||||
}
|
}
|
||||||
|
else if (type.equals(InstanceTeleportType.TOWN))
|
||||||
|
{
|
||||||
|
template.setExitLocation(type, null);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final List<Location> locations = new ArrayList<>();
|
final List<Location> locations = new ArrayList<>();
|
||||||
|
@ -325,28 +325,7 @@ public class MapRegionManager implements IXmlReader
|
|||||||
// Karma player land out of city
|
// Karma player land out of city
|
||||||
if (player.getReputation() < 0)
|
if (player.getReputation() < 0)
|
||||||
{
|
{
|
||||||
try
|
return getNearestKarmaRespawn(player);
|
||||||
{
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checking if needed to be respawned in "far" town from the castle;
|
// 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
|
// 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
|
try
|
||||||
{
|
{
|
||||||
final RespawnZone zone = ZoneManager.getInstance().getZone(creature, RespawnZone.class);
|
final RespawnZone zone = ZoneManager.getInstance().getZone(creature, RespawnZone.class);
|
||||||
|
@ -33,6 +33,7 @@ import org.l2jmobius.gameserver.enums.InstanceReenterType;
|
|||||||
import org.l2jmobius.gameserver.enums.InstanceRemoveBuffType;
|
import org.l2jmobius.gameserver.enums.InstanceRemoveBuffType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceTeleportType;
|
import org.l2jmobius.gameserver.enums.InstanceTeleportType;
|
||||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||||
|
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||||
import org.l2jmobius.gameserver.model.AbstractPlayerGroup;
|
import org.l2jmobius.gameserver.model.AbstractPlayerGroup;
|
||||||
import org.l2jmobius.gameserver.model.Location;
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
import org.l2jmobius.gameserver.model.PlayerCondOverride;
|
import org.l2jmobius.gameserver.model.PlayerCondOverride;
|
||||||
@ -367,7 +368,6 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
|
|||||||
public Location getExitLocation(PlayerInstance player)
|
public Location getExitLocation(PlayerInstance player)
|
||||||
{
|
{
|
||||||
Location location = null;
|
Location location = null;
|
||||||
|
|
||||||
switch (_exitLocationType)
|
switch (_exitLocationType)
|
||||||
{
|
{
|
||||||
case RANDOM:
|
case RANDOM:
|
||||||
@ -391,6 +391,18 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TOWN:
|
||||||
|
{
|
||||||
|
if (player.getReputation() < 0)
|
||||||
|
{
|
||||||
|
location = MapRegionManager.getInstance().getNearestKarmaRespawn(player);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
location = MapRegionManager.getInstance().getNearestTownRespawn(player);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user