Support for random teleport list locations.

Contributed by Index.
This commit is contained in:
MobiusDevelopment 2022-07-19 11:28:14 +00:00
parent 5483e1a4b7
commit 2d72634dc3
48 changed files with 1008 additions and 555 deletions

View File

@ -1,22 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="teleport" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:integer" name="id" use="required" />
<xs:attribute type="xs:integer" name="x" use="required" />
<xs:attribute type="xs:integer" name="y" use="required" />
<xs:attribute type="xs:integer" name="z" use="required" />
<xs:attribute type="xs:integer" name="price" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list" type="listType" />
<xs:complexType name="teleportType" mixed="true">
<xs:sequence>
<xs:element type="locationType" name="location" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="id" use="optional" />
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
<xs:attribute type="xs:string" name="price" use="optional" />
</xs:complexType>
<xs:complexType name="locationType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="listType">
<xs:sequence>
<xs:element type="teleportType" name="teleport" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -17,13 +17,16 @@
package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -34,7 +37,7 @@ public class TeleportListData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(TeleportListData.class.getName());
private final Map<Integer, TeleportListHolder> _teleports = new HashMap<>();
private int _teleportsCount = 0;
private int _teleportCount = 0;
protected TeleportListData()
{
@ -46,8 +49,8 @@ public class TeleportListData implements IXmlReader
{
_teleports.clear();
parseDatapackFile("data/TeleportListData.xml");
_teleportsCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportsCount + " teleports.");
_teleportCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportCount + " teleports.");
}
@Override
@ -57,11 +60,18 @@ public class TeleportListData implements IXmlReader
{
final StatSet set = new StatSet(parseAttributes(teleportNode));
final int tpId = set.getInt("id");
final int x = set.getInt("x");
final int y = set.getInt("y");
final int z = set.getInt("z");
final int tpPrice = set.getInt("price");
_teleports.put(tpId, new TeleportListHolder(tpId, x, y, z, tpPrice));
final List<Location> locations = new ArrayList<>();
forEach(teleportNode, "location", locationsNode ->
{
final StatSet locationSet = new StatSet(parseAttributes(locationsNode));
locations.add(new Location(locationSet.getInt("x"), locationSet.getInt("y"), locationSet.getInt("z")));
});
if (locations.isEmpty())
{
locations.add(new Location(set.getInt("x"), set.getInt("y"), set.getInt("z")));
}
_teleports.put(tpId, new TeleportListHolder(tpId, locations, tpPrice));
}));
}
@ -70,9 +80,9 @@ public class TeleportListData implements IXmlReader
return _teleports.get(teleportId);
}
public int getTeleportsCount()
public int getTeleportCount()
{
return _teleportsCount;
return _teleportCount;
}
public static TeleportListData getInstance()

View File

@ -16,23 +16,33 @@
*/
package org.l2jmobius.gameserver.model.holders;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.Location;
/**
* @author NviX
* @author NviX, Index
*/
public class TeleportListHolder
{
private final int _locId;
private final int _x;
private final int _y;
private final int _z;
private final List<Location> _locations;
private final int _price;
public TeleportListHolder(int locId, int x, int y, int z, int price)
{
_locId = locId;
_x = x;
_y = y;
_z = z;
_locations = new ArrayList<>(1);
_locations.add(new Location(x, y, z));
_price = price;
}
public TeleportListHolder(int locId, List<Location> locations, int price)
{
_locId = locId;
_locations = locations;
_price = price;
}
@ -41,23 +51,18 @@ public class TeleportListHolder
return _locId;
}
public int getX()
public List<Location> getLocations()
{
return _x;
}
public int getY()
{
return _y;
}
public int getZ()
{
return _z;
return _locations;
}
public int getPrice()
{
return _price;
}
public Location getLocation()
{
return _locations.get(Rnd.get(_locations.size()));
}
}

View File

@ -20,6 +20,7 @@ import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.TeleportListData;
import org.l2jmobius.gameserver.instancemanager.CastleManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectFlag;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -94,9 +95,10 @@ public class ExRequestTeleport implements IClientIncomingPacket
return;
}
final Location location = teleport.getLocation();
if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
{
final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
final Castle castle = CastleManager.getInstance().getCastle(location.getX(), location.getY(), location.getZ());
if ((castle != null) && castle.getSiege().isInProgress())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
@ -120,6 +122,6 @@ public class ExRequestTeleport implements IClientIncomingPacket
player.abortCast();
player.stopMove(null);
player.teleToLocation(teleport.getX(), teleport.getY(), teleport.getZ());
player.teleToLocation(location);
}
}

View File

@ -1,22 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="teleport" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:integer" name="id" use="required" />
<xs:attribute type="xs:integer" name="x" use="required" />
<xs:attribute type="xs:integer" name="y" use="required" />
<xs:attribute type="xs:integer" name="z" use="required" />
<xs:attribute type="xs:integer" name="price" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list" type="listType" />
<xs:complexType name="teleportType" mixed="true">
<xs:sequence>
<xs:element type="locationType" name="location" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="id" use="optional" />
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
<xs:attribute type="xs:string" name="price" use="optional" />
</xs:complexType>
<xs:complexType name="locationType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="listType">
<xs:sequence>
<xs:element type="teleportType" name="teleport" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -17,13 +17,16 @@
package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -34,7 +37,7 @@ public class TeleportListData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(TeleportListData.class.getName());
private final Map<Integer, TeleportListHolder> _teleports = new HashMap<>();
private int _teleportsCount = 0;
private int _teleportCount = 0;
protected TeleportListData()
{
@ -46,8 +49,8 @@ public class TeleportListData implements IXmlReader
{
_teleports.clear();
parseDatapackFile("data/TeleportListData.xml");
_teleportsCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportsCount + " teleports.");
_teleportCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportCount + " teleports.");
}
@Override
@ -57,11 +60,18 @@ public class TeleportListData implements IXmlReader
{
final StatSet set = new StatSet(parseAttributes(teleportNode));
final int tpId = set.getInt("id");
final int x = set.getInt("x");
final int y = set.getInt("y");
final int z = set.getInt("z");
final int tpPrice = set.getInt("price");
_teleports.put(tpId, new TeleportListHolder(tpId, x, y, z, tpPrice));
final List<Location> locations = new ArrayList<>();
forEach(teleportNode, "location", locationsNode ->
{
final StatSet locationSet = new StatSet(parseAttributes(locationsNode));
locations.add(new Location(locationSet.getInt("x"), locationSet.getInt("y"), locationSet.getInt("z")));
});
if (locations.isEmpty())
{
locations.add(new Location(set.getInt("x"), set.getInt("y"), set.getInt("z")));
}
_teleports.put(tpId, new TeleportListHolder(tpId, locations, tpPrice));
}));
}
@ -70,9 +80,9 @@ public class TeleportListData implements IXmlReader
return _teleports.get(teleportId);
}
public int getTeleportsCount()
public int getTeleportCount()
{
return _teleportsCount;
return _teleportCount;
}
public static TeleportListData getInstance()

View File

@ -16,23 +16,33 @@
*/
package org.l2jmobius.gameserver.model.holders;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.Location;
/**
* @author NviX
* @author NviX, Index
*/
public class TeleportListHolder
{
private final int _locId;
private final int _x;
private final int _y;
private final int _z;
private final List<Location> _locations;
private final int _price;
public TeleportListHolder(int locId, int x, int y, int z, int price)
{
_locId = locId;
_x = x;
_y = y;
_z = z;
_locations = new ArrayList<>(1);
_locations.add(new Location(x, y, z));
_price = price;
}
public TeleportListHolder(int locId, List<Location> locations, int price)
{
_locId = locId;
_locations = locations;
_price = price;
}
@ -41,23 +51,18 @@ public class TeleportListHolder
return _locId;
}
public int getX()
public List<Location> getLocations()
{
return _x;
}
public int getY()
{
return _y;
}
public int getZ()
{
return _z;
return _locations;
}
public int getPrice()
{
return _price;
}
public Location getLocation()
{
return _locations.get(Rnd.get(_locations.size()));
}
}

View File

@ -20,6 +20,7 @@ import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.TeleportListData;
import org.l2jmobius.gameserver.instancemanager.CastleManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectFlag;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -95,9 +96,10 @@ public class ExRequestTeleport implements IClientIncomingPacket
return;
}
final Location location = teleport.getLocation();
if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
{
final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
final Castle castle = CastleManager.getInstance().getCastle(location.getX(), location.getY(), location.getZ());
if ((castle != null) && castle.getSiege().isInProgress())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
@ -121,6 +123,6 @@ public class ExRequestTeleport implements IClientIncomingPacket
player.abortCast();
player.stopMove(null);
player.teleToLocation(teleport.getX(), teleport.getY(), teleport.getZ());
player.teleToLocation(location);
}
}

View File

@ -1,22 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="teleport" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:integer" name="id" use="required" />
<xs:attribute type="xs:integer" name="x" use="required" />
<xs:attribute type="xs:integer" name="y" use="required" />
<xs:attribute type="xs:integer" name="z" use="required" />
<xs:attribute type="xs:integer" name="price" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list" type="listType" />
<xs:complexType name="teleportType" mixed="true">
<xs:sequence>
<xs:element type="locationType" name="location" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="id" use="optional" />
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
<xs:attribute type="xs:string" name="price" use="optional" />
</xs:complexType>
<xs:complexType name="locationType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="listType">
<xs:sequence>
<xs:element type="teleportType" name="teleport" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -17,13 +17,16 @@
package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -34,7 +37,7 @@ public class TeleportListData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(TeleportListData.class.getName());
private final Map<Integer, TeleportListHolder> _teleports = new HashMap<>();
private int _teleportsCount = 0;
private int _teleportCount = 0;
protected TeleportListData()
{
@ -46,8 +49,8 @@ public class TeleportListData implements IXmlReader
{
_teleports.clear();
parseDatapackFile("data/TeleportListData.xml");
_teleportsCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportsCount + " teleports.");
_teleportCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportCount + " teleports.");
}
@Override
@ -57,11 +60,18 @@ public class TeleportListData implements IXmlReader
{
final StatSet set = new StatSet(parseAttributes(teleportNode));
final int tpId = set.getInt("id");
final int x = set.getInt("x");
final int y = set.getInt("y");
final int z = set.getInt("z");
final int tpPrice = set.getInt("price");
_teleports.put(tpId, new TeleportListHolder(tpId, x, y, z, tpPrice));
final List<Location> locations = new ArrayList<>();
forEach(teleportNode, "location", locationsNode ->
{
final StatSet locationSet = new StatSet(parseAttributes(locationsNode));
locations.add(new Location(locationSet.getInt("x"), locationSet.getInt("y"), locationSet.getInt("z")));
});
if (locations.isEmpty())
{
locations.add(new Location(set.getInt("x"), set.getInt("y"), set.getInt("z")));
}
_teleports.put(tpId, new TeleportListHolder(tpId, locations, tpPrice));
}));
}
@ -70,9 +80,9 @@ public class TeleportListData implements IXmlReader
return _teleports.get(teleportId);
}
public int getTeleportsCount()
public int getTeleportCount()
{
return _teleportsCount;
return _teleportCount;
}
public static TeleportListData getInstance()

View File

@ -16,23 +16,33 @@
*/
package org.l2jmobius.gameserver.model.holders;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.Location;
/**
* @author NviX
* @author NviX, Index
*/
public class TeleportListHolder
{
private final int _locId;
private final int _x;
private final int _y;
private final int _z;
private final List<Location> _locations;
private final int _price;
public TeleportListHolder(int locId, int x, int y, int z, int price)
{
_locId = locId;
_x = x;
_y = y;
_z = z;
_locations = new ArrayList<>(1);
_locations.add(new Location(x, y, z));
_price = price;
}
public TeleportListHolder(int locId, List<Location> locations, int price)
{
_locId = locId;
_locations = locations;
_price = price;
}
@ -41,23 +51,18 @@ public class TeleportListHolder
return _locId;
}
public int getX()
public List<Location> getLocations()
{
return _x;
}
public int getY()
{
return _y;
}
public int getZ()
{
return _z;
return _locations;
}
public int getPrice()
{
return _price;
}
public Location getLocation()
{
return _locations.get(Rnd.get(_locations.size()));
}
}

View File

@ -20,6 +20,7 @@ import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.TeleportListData;
import org.l2jmobius.gameserver.instancemanager.CastleManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectFlag;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -95,9 +96,10 @@ public class ExRequestTeleport implements IClientIncomingPacket
return;
}
final Location location = teleport.getLocation();
if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
{
final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
final Castle castle = CastleManager.getInstance().getCastle(location.getX(), location.getY(), location.getZ());
if ((castle != null) && castle.getSiege().isInProgress())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
@ -121,6 +123,6 @@ public class ExRequestTeleport implements IClientIncomingPacket
player.abortCast();
player.stopMove(null);
player.teleToLocation(teleport.getX(), teleport.getY(), teleport.getZ());
player.teleToLocation(location);
}
}

View File

@ -1,22 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="teleport" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:integer" name="id" use="required" />
<xs:attribute type="xs:integer" name="x" use="required" />
<xs:attribute type="xs:integer" name="y" use="required" />
<xs:attribute type="xs:integer" name="z" use="required" />
<xs:attribute type="xs:integer" name="price" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list" type="listType" />
<xs:complexType name="teleportType" mixed="true">
<xs:sequence>
<xs:element type="locationType" name="location" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="id" use="optional" />
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
<xs:attribute type="xs:string" name="price" use="optional" />
</xs:complexType>
<xs:complexType name="locationType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="listType">
<xs:sequence>
<xs:element type="teleportType" name="teleport" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -17,13 +17,16 @@
package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -34,7 +37,7 @@ public class TeleportListData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(TeleportListData.class.getName());
private final Map<Integer, TeleportListHolder> _teleports = new HashMap<>();
private int _teleportsCount = 0;
private int _teleportCount = 0;
protected TeleportListData()
{
@ -46,8 +49,8 @@ public class TeleportListData implements IXmlReader
{
_teleports.clear();
parseDatapackFile("data/TeleportListData.xml");
_teleportsCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportsCount + " teleports.");
_teleportCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportCount + " teleports.");
}
@Override
@ -57,11 +60,18 @@ public class TeleportListData implements IXmlReader
{
final StatSet set = new StatSet(parseAttributes(teleportNode));
final int tpId = set.getInt("id");
final int x = set.getInt("x");
final int y = set.getInt("y");
final int z = set.getInt("z");
final int tpPrice = set.getInt("price");
_teleports.put(tpId, new TeleportListHolder(tpId, x, y, z, tpPrice));
final List<Location> locations = new ArrayList<>();
forEach(teleportNode, "location", locationsNode ->
{
final StatSet locationSet = new StatSet(parseAttributes(locationsNode));
locations.add(new Location(locationSet.getInt("x"), locationSet.getInt("y"), locationSet.getInt("z")));
});
if (locations.isEmpty())
{
locations.add(new Location(set.getInt("x"), set.getInt("y"), set.getInt("z")));
}
_teleports.put(tpId, new TeleportListHolder(tpId, locations, tpPrice));
}));
}
@ -70,9 +80,9 @@ public class TeleportListData implements IXmlReader
return _teleports.get(teleportId);
}
public int getTeleportsCount()
public int getTeleportCount()
{
return _teleportsCount;
return _teleportCount;
}
public static TeleportListData getInstance()

View File

@ -16,23 +16,33 @@
*/
package org.l2jmobius.gameserver.model.holders;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.Location;
/**
* @author NviX
* @author NviX, Index
*/
public class TeleportListHolder
{
private final int _locId;
private final int _x;
private final int _y;
private final int _z;
private final List<Location> _locations;
private final int _price;
public TeleportListHolder(int locId, int x, int y, int z, int price)
{
_locId = locId;
_x = x;
_y = y;
_z = z;
_locations = new ArrayList<>(1);
_locations.add(new Location(x, y, z));
_price = price;
}
public TeleportListHolder(int locId, List<Location> locations, int price)
{
_locId = locId;
_locations = locations;
_price = price;
}
@ -41,23 +51,18 @@ public class TeleportListHolder
return _locId;
}
public int getX()
public List<Location> getLocations()
{
return _x;
}
public int getY()
{
return _y;
}
public int getZ()
{
return _z;
return _locations;
}
public int getPrice()
{
return _price;
}
public Location getLocation()
{
return _locations.get(Rnd.get(_locations.size()));
}
}

View File

@ -20,6 +20,7 @@ import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.TeleportListData;
import org.l2jmobius.gameserver.instancemanager.CastleManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectFlag;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -95,9 +96,10 @@ public class ExRequestTeleport implements IClientIncomingPacket
return;
}
final Location location = teleport.getLocation();
if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
{
final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
final Castle castle = CastleManager.getInstance().getCastle(location.getX(), location.getY(), location.getZ());
if ((castle != null) && castle.getSiege().isInProgress())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
@ -121,6 +123,6 @@ public class ExRequestTeleport implements IClientIncomingPacket
player.abortCast();
player.stopMove(null);
player.teleToLocation(teleport.getX(), teleport.getY(), teleport.getZ());
player.teleToLocation(location);
}
}

View File

@ -1,22 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="teleport" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:integer" name="id" use="required" />
<xs:attribute type="xs:integer" name="x" use="required" />
<xs:attribute type="xs:integer" name="y" use="required" />
<xs:attribute type="xs:integer" name="z" use="required" />
<xs:attribute type="xs:integer" name="price" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list" type="listType" />
<xs:complexType name="teleportType" mixed="true">
<xs:sequence>
<xs:element type="locationType" name="location" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="id" use="optional" />
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
<xs:attribute type="xs:string" name="price" use="optional" />
</xs:complexType>
<xs:complexType name="locationType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="listType">
<xs:sequence>
<xs:element type="teleportType" name="teleport" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -17,13 +17,16 @@
package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -34,7 +37,7 @@ public class TeleportListData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(TeleportListData.class.getName());
private final Map<Integer, TeleportListHolder> _teleports = new HashMap<>();
private int _teleportsCount = 0;
private int _teleportCount = 0;
protected TeleportListData()
{
@ -46,8 +49,8 @@ public class TeleportListData implements IXmlReader
{
_teleports.clear();
parseDatapackFile("data/TeleportListData.xml");
_teleportsCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportsCount + " teleports.");
_teleportCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportCount + " teleports.");
}
@Override
@ -57,11 +60,18 @@ public class TeleportListData implements IXmlReader
{
final StatSet set = new StatSet(parseAttributes(teleportNode));
final int tpId = set.getInt("id");
final int x = set.getInt("x");
final int y = set.getInt("y");
final int z = set.getInt("z");
final int tpPrice = set.getInt("price");
_teleports.put(tpId, new TeleportListHolder(tpId, x, y, z, tpPrice));
final List<Location> locations = new ArrayList<>();
forEach(teleportNode, "location", locationsNode ->
{
final StatSet locationSet = new StatSet(parseAttributes(locationsNode));
locations.add(new Location(locationSet.getInt("x"), locationSet.getInt("y"), locationSet.getInt("z")));
});
if (locations.isEmpty())
{
locations.add(new Location(set.getInt("x"), set.getInt("y"), set.getInt("z")));
}
_teleports.put(tpId, new TeleportListHolder(tpId, locations, tpPrice));
}));
}
@ -70,9 +80,9 @@ public class TeleportListData implements IXmlReader
return _teleports.get(teleportId);
}
public int getTeleportsCount()
public int getTeleportCount()
{
return _teleportsCount;
return _teleportCount;
}
public static TeleportListData getInstance()

View File

@ -16,23 +16,33 @@
*/
package org.l2jmobius.gameserver.model.holders;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.Location;
/**
* @author NviX
* @author NviX, Index
*/
public class TeleportListHolder
{
private final int _locId;
private final int _x;
private final int _y;
private final int _z;
private final List<Location> _locations;
private final int _price;
public TeleportListHolder(int locId, int x, int y, int z, int price)
{
_locId = locId;
_x = x;
_y = y;
_z = z;
_locations = new ArrayList<>(1);
_locations.add(new Location(x, y, z));
_price = price;
}
public TeleportListHolder(int locId, List<Location> locations, int price)
{
_locId = locId;
_locations = locations;
_price = price;
}
@ -41,23 +51,18 @@ public class TeleportListHolder
return _locId;
}
public int getX()
public List<Location> getLocations()
{
return _x;
}
public int getY()
{
return _y;
}
public int getZ()
{
return _z;
return _locations;
}
public int getPrice()
{
return _price;
}
public Location getLocation()
{
return _locations.get(Rnd.get(_locations.size()));
}
}

View File

@ -20,6 +20,7 @@ import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.TeleportListData;
import org.l2jmobius.gameserver.instancemanager.CastleManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectFlag;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -95,9 +96,10 @@ public class ExRequestTeleport implements IClientIncomingPacket
return;
}
final Location location = teleport.getLocation();
if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
{
final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
final Castle castle = CastleManager.getInstance().getCastle(location.getX(), location.getY(), location.getZ());
if ((castle != null) && castle.getSiege().isInProgress())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
@ -121,6 +123,6 @@ public class ExRequestTeleport implements IClientIncomingPacket
player.abortCast();
player.stopMove(null);
player.teleToLocation(teleport.getX(), teleport.getY(), teleport.getZ());
player.teleToLocation(location);
}
}

View File

@ -1,22 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="teleport" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:integer" name="id" use="required" />
<xs:attribute type="xs:integer" name="x" use="required" />
<xs:attribute type="xs:integer" name="y" use="required" />
<xs:attribute type="xs:integer" name="z" use="required" />
<xs:attribute type="xs:integer" name="price" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list" type="listType" />
<xs:complexType name="teleportType" mixed="true">
<xs:sequence>
<xs:element type="locationType" name="location" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="id" use="optional" />
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
<xs:attribute type="xs:string" name="price" use="optional" />
</xs:complexType>
<xs:complexType name="locationType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="listType">
<xs:sequence>
<xs:element type="teleportType" name="teleport" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -17,13 +17,16 @@
package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -34,7 +37,7 @@ public class TeleportListData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(TeleportListData.class.getName());
private final Map<Integer, TeleportListHolder> _teleports = new HashMap<>();
private int _teleportsCount = 0;
private int _teleportCount = 0;
protected TeleportListData()
{
@ -46,8 +49,8 @@ public class TeleportListData implements IXmlReader
{
_teleports.clear();
parseDatapackFile("data/TeleportListData.xml");
_teleportsCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportsCount + " teleports.");
_teleportCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportCount + " teleports.");
}
@Override
@ -57,11 +60,18 @@ public class TeleportListData implements IXmlReader
{
final StatSet set = new StatSet(parseAttributes(teleportNode));
final int tpId = set.getInt("id");
final int x = set.getInt("x");
final int y = set.getInt("y");
final int z = set.getInt("z");
final int tpPrice = set.getInt("price");
_teleports.put(tpId, new TeleportListHolder(tpId, x, y, z, tpPrice));
final List<Location> locations = new ArrayList<>();
forEach(teleportNode, "location", locationsNode ->
{
final StatSet locationSet = new StatSet(parseAttributes(locationsNode));
locations.add(new Location(locationSet.getInt("x"), locationSet.getInt("y"), locationSet.getInt("z")));
});
if (locations.isEmpty())
{
locations.add(new Location(set.getInt("x"), set.getInt("y"), set.getInt("z")));
}
_teleports.put(tpId, new TeleportListHolder(tpId, locations, tpPrice));
}));
}
@ -70,9 +80,9 @@ public class TeleportListData implements IXmlReader
return _teleports.get(teleportId);
}
public int getTeleportsCount()
public int getTeleportCount()
{
return _teleportsCount;
return _teleportCount;
}
public static TeleportListData getInstance()

View File

@ -16,23 +16,33 @@
*/
package org.l2jmobius.gameserver.model.holders;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.Location;
/**
* @author NviX
* @author NviX, Index
*/
public class TeleportListHolder
{
private final int _locId;
private final int _x;
private final int _y;
private final int _z;
private final List<Location> _locations;
private final int _price;
public TeleportListHolder(int locId, int x, int y, int z, int price)
{
_locId = locId;
_x = x;
_y = y;
_z = z;
_locations = new ArrayList<>(1);
_locations.add(new Location(x, y, z));
_price = price;
}
public TeleportListHolder(int locId, List<Location> locations, int price)
{
_locId = locId;
_locations = locations;
_price = price;
}
@ -41,23 +51,18 @@ public class TeleportListHolder
return _locId;
}
public int getX()
public List<Location> getLocations()
{
return _x;
}
public int getY()
{
return _y;
}
public int getZ()
{
return _z;
return _locations;
}
public int getPrice()
{
return _price;
}
public Location getLocation()
{
return _locations.get(Rnd.get(_locations.size()));
}
}

View File

@ -20,6 +20,7 @@ import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.TeleportListData;
import org.l2jmobius.gameserver.instancemanager.CastleManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectFlag;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -94,9 +95,10 @@ public class ExRequestTeleport implements IClientIncomingPacket
return;
}
final Location location = teleport.getLocation();
if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
{
final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
final Castle castle = CastleManager.getInstance().getCastle(location.getX(), location.getY(), location.getZ());
if ((castle != null) && castle.getSiege().isInProgress())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
@ -120,6 +122,6 @@ public class ExRequestTeleport implements IClientIncomingPacket
player.abortCast();
player.stopMove(null);
player.teleToLocation(teleport.getX(), teleport.getY(), teleport.getZ());
player.teleToLocation(location);
}
}

View File

@ -10,12 +10,27 @@
<teleport id="17" x="105918" y="109759" z="-3192" price="3000" /> <!-- Hardin's Academy -->
<teleport id="18" x="73024" y="118485" z="-3696" price="34200" /> <!-- Dragon Valley -->
<teleport id="19" x="132219" y="114392" z="-3720" price="34200" /> <!-- Antharas' Lair -->
<teleport id="21" x="70576" y="128047" z="-3752" price="770" /> <!-- Death Pass -->
<teleport id="21" price="770" > <!-- Death Pass -->
<location x="70610" y="118363" z="-3664" />
<location x="70576" y="128047" z="-3752" />
<location x="67018" y="108177" z="-3680" />
<location x="67882" y="99782" z="-3712" />
</teleport>
<teleport id="23" x="43408" y="206881" z="-3752" price="15300" /> <!-- Devil's Isle -->
<teleport id="24" x="47935" y="186810" z="-3480" price="2000" /> <!-- Giran Harbor -->
<teleport id="25" x="83386" y="148014" z="-3400" price="1000" /> <!-- Town of Giran -->
<teleport id="29" x="102369" y="137818" z="-3328" price="770" /> <!-- Gorgon Flower Garden -->
<teleport id="32" x="-53117" y="119693" z="-2968" price="200" /> <!-- Ruins of Agony -->
<teleport id="29" price="770" > <!-- Gorgon Flower Garden -->
<location x="102369" y="137818" z="-3328" />
<location x="119184" y="135484" z="-3544" />
<location x="106615" y="138612" z="-3536" />
</teleport>
<teleport id="32" price="200" > <!-- Ruins of Agony -->
<location x="-42307" y="120810" z="-3368" />
<location x="-47785" y="111957" z="-3584" />
<location x="-46166" y="108893" z="-3792" />
<location x="-57040" y="112462" z="-3064" />
<location x="-53117" y="119693" z="-2968" />
</teleport>
<teleport id="34" x="-9970" y="175793" z="-4128" price="770" /> <!-- Ant Nest -->
<teleport id="35" x="-80684" y="149770" z="-3040" price="1000" /> <!-- Gludin Village -->
<teleport id="36" x="-91080" y="149860" z="-3624" price="2000" /> <!-- Gludin Harbor -->
@ -41,21 +56,49 @@
<teleport id="79" x="64328" y="26803" z="-3768" price="770" /> <!-- Sea Of Spores -->
<teleport id="81" x="85391" y="16228" z="-3672" price="3900" /> <!-- Ivory Tower -->
<teleport id="82" x="82927" y="53255" z="-1488" price="1000" /> <!-- Town of Oren -->
<teleport id="84" x="82911" y="92847" z="-3328" price="15300" /> <!-- Plains of the Lizardmen -->
<teleport id="84" price="15300" > <!-- Plains of the Lizardmen -->
<location x="87252" y="85514" z="-3103" />
<location x="82911" y="92847" z="-3328" />
<location x="95842" y="89089" z="-3472" />
<location x="95198" y="76261" z="-3480" />
<location x="81160" y="75068" z="-3592" />
</teleport>
<teleport id="90" x="92278" y="15469" z="-4384" price="3900" /> <!-- Ivory Tower Crater -->
<teleport id="98" x="114649" y="11115" z="-5120" price="15300" /> <!-- Tower of Insolence -->
<teleport id="99" x="155310" y="-16339" z="-3320" price="6750" /> <!-- Blazing Swamp -->
<teleport id="101" x="187383" y="20498" z="-3584" price="6750" /> <!-- Seal of Shilen -->
<teleport id="102" x="177116" y="45786" z="-4168" price="15300" /> <!-- Giant's Cave -->
<teleport id="104" x="173678" y="9256" z="-2736" price="1950" /> <!-- Cemetery -->
<teleport id="104" price="1950" > <!-- Cemetery -->
<location x="178863" y="20306" z="-3168" />
<location x="172204" y="20322" z="-3328" />
<location x="173668" y="9235" z="-2736" />
</teleport>
<teleport id="105" x="138012" y="81947" z="-3104" price="8000" /> <!-- Forest of Mirrors -->
<teleport id="108" x="117051" y="76854" z="-2704" price="1000" /> <!-- Hunters Village -->
<teleport id="113" x="106517" y="-2871" z="-3416" price="6750" /> <!-- Ancient Battleground -->
<teleport id="115" x="171827" y="56589" z="-5624" price="15300" /> <!-- Silent Valley -->
<teleport id="115" price="15300" > <!-- Silent Valley -->
<location x="184222" y="46666" z="-5794" />
<location x="171827" y="56589" z="-5624" />
</teleport>
<teleport id="116" x="105659" y="82974" z="-2776" price="8000" /> <!-- Hunters' Valley -->
<teleport id="117" x="139004" y="19891" z="-3584" price="6750" /> <!-- Plains of Glory -->
<teleport id="118" x="183524" y="-14991" z="-2768" price="6750" /> <!-- Fields of Massacre -->
<teleport id="119" x="162205" y="27090" z="-3712" price="6750" /> <!-- War-Torn Plains -->
<teleport id="117" price="6750" > <!-- Plains of Glory -->
<location x="138989" y="19915" z="-3616" />
<location x="131435" y="24184" z="-3728" />
<location x="139353" y="-904" z="-4136" />
<location x="132390" y="12644" z="-4040" />
</teleport>
<teleport id="118" price="6750" > <!-- Fields of Massacre -->
<location x="183543" y="-14974" z="-2768" />
<location x="179446" y="-7811" z="-3528" />
<location x="188259" y="-25385" z="-1456" />
<location x="163928" y="-10188" z="-3440" />
</teleport>
<teleport id="119" price="6750" > <!-- War-Torn Plains -->
<location x="159795" y="21131" z="-3696" />
<location x="162595" y="27467" z="-3728" />
<location x="164262" y="1849" z="-3480" />
<location x="153025" y="10061" z="-3928" />
</teleport>
<teleport id="131" x="-45158" y="-112583" z="-240" price="1000" /> <!-- Orc Village -->
<teleport id="133" x="9340" y="-112509" z="-2536" price="500" /> <!-- Cave of Trials -->
<teleport id="134" x="8652" y="-139941" z="-1144" price="500" /> <!-- Frozen Waterfalls -->
@ -107,7 +150,19 @@
<teleport id="432" x="111187" y="-12334" z="-1723" price="50000" /> <!-- Orc Fortress -->
<teleport id="433" x="104712" y="4803" z="-3288" price="1000" /> <!-- Road to Orc Fortress -->
<teleport id="434" x="-48363" y="140230" z="-2944" price="15300" /> <!-- Sel Mahum Base -->
<teleport id="435" x="73024" y="118485" z="-3720" price="15300" /> <!-- Entrance to Dragon Valley -->
<teleport id="436" x="88088" y="121578" z="-2960" price="15300" /> <!-- Center of the Dragon Valley -->
<teleport id="435" price="15300" > <!-- Entrance to Dragon Valley -->
<location x="75886" y="117511" z="-3752" />
<location x="82103" y="114066" z="-3144" />
<location x="85021" y="109046" z="-3200" />
<location x="93983" y="113863" z="-3120" />
<location x="87890" y="121193" z="-3056" />
</teleport>
<teleport id="436" price="15300" > <!-- Center of the Dragon Valley -->
<location x="101676" y="113865" z="-3696" />
<location x="119029" y="116799" z="-3728" />
<location x="127474" y="116503" z="-3736" />
<location x="124836" y="109958" z="-3096" />
<location x="116098" y="119102" z="-3720" />
</teleport>
<teleport id="437" x="92821" y="18847" z="-3608" price="2000" /> <!-- Outskirts of the Ivory Tower -->
</list>

View File

@ -1,22 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="teleport" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:integer" name="id" use="required" />
<xs:attribute type="xs:integer" name="x" use="required" />
<xs:attribute type="xs:integer" name="y" use="required" />
<xs:attribute type="xs:integer" name="z" use="required" />
<xs:attribute type="xs:integer" name="price" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list" type="listType" />
<xs:complexType name="teleportType" mixed="true">
<xs:sequence>
<xs:element type="locationType" name="location" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="id" use="optional" />
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
<xs:attribute type="xs:string" name="price" use="optional" />
</xs:complexType>
<xs:complexType name="locationType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="listType">
<xs:sequence>
<xs:element type="teleportType" name="teleport" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -17,13 +17,16 @@
package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -34,7 +37,7 @@ public class TeleportListData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(TeleportListData.class.getName());
private final Map<Integer, TeleportListHolder> _teleports = new HashMap<>();
private int _teleportsCount = 0;
private int _teleportCount = 0;
protected TeleportListData()
{
@ -46,8 +49,8 @@ public class TeleportListData implements IXmlReader
{
_teleports.clear();
parseDatapackFile("data/TeleportListData.xml");
_teleportsCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportsCount + " teleports.");
_teleportCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportCount + " teleports.");
}
@Override
@ -57,11 +60,18 @@ public class TeleportListData implements IXmlReader
{
final StatSet set = new StatSet(parseAttributes(teleportNode));
final int tpId = set.getInt("id");
final int x = set.getInt("x");
final int y = set.getInt("y");
final int z = set.getInt("z");
final int tpPrice = set.getInt("price");
_teleports.put(tpId, new TeleportListHolder(tpId, x, y, z, tpPrice));
final List<Location> locations = new ArrayList<>();
forEach(teleportNode, "location", locationsNode ->
{
final StatSet locationSet = new StatSet(parseAttributes(locationsNode));
locations.add(new Location(locationSet.getInt("x"), locationSet.getInt("y"), locationSet.getInt("z")));
});
if (locations.isEmpty())
{
locations.add(new Location(set.getInt("x"), set.getInt("y"), set.getInt("z")));
}
_teleports.put(tpId, new TeleportListHolder(tpId, locations, tpPrice));
}));
}
@ -70,9 +80,9 @@ public class TeleportListData implements IXmlReader
return _teleports.get(teleportId);
}
public int getTeleportsCount()
public int getTeleportCount()
{
return _teleportsCount;
return _teleportCount;
}
public static TeleportListData getInstance()

View File

@ -16,23 +16,33 @@
*/
package org.l2jmobius.gameserver.model.holders;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.Location;
/**
* @author NviX
* @author NviX, Index
*/
public class TeleportListHolder
{
private final int _locId;
private final int _x;
private final int _y;
private final int _z;
private final List<Location> _locations;
private final int _price;
public TeleportListHolder(int locId, int x, int y, int z, int price)
{
_locId = locId;
_x = x;
_y = y;
_z = z;
_locations = new ArrayList<>(1);
_locations.add(new Location(x, y, z));
_price = price;
}
public TeleportListHolder(int locId, List<Location> locations, int price)
{
_locId = locId;
_locations = locations;
_price = price;
}
@ -41,23 +51,18 @@ public class TeleportListHolder
return _locId;
}
public int getX()
public List<Location> getLocations()
{
return _x;
}
public int getY()
{
return _y;
}
public int getZ()
{
return _z;
return _locations;
}
public int getPrice()
{
return _price;
}
public Location getLocation()
{
return _locations.get(Rnd.get(_locations.size()));
}
}

View File

@ -97,9 +97,10 @@ public class ExRequestTeleport implements IClientIncomingPacket
return;
}
final Location location = teleport.getLocation();
if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
{
final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
final Castle castle = CastleManager.getInstance().getCastle(location.getX(), location.getY(), location.getZ());
if ((castle != null) && castle.getSiege().isInProgress())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
@ -124,7 +125,7 @@ public class ExRequestTeleport implements IClientIncomingPacket
player.abortCast();
player.stopMove(null);
player.setTeleportLocation(new Location(teleport.getX(), teleport.getY(), teleport.getZ()));
player.setTeleportLocation(location);
player.doCast(CommonSkill.TELEPORT.getSkill());
}
}

View File

@ -109,9 +109,10 @@ public class ExTeleportToRaidPosition implements IClientIncomingPacket
return;
}
final Location location = teleport.getLocation();
if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
{
final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
final Castle castle = CastleManager.getInstance().getCastle(location.getX(), location.getY(), location.getZ());
if ((castle != null) && castle.getSiege().isInProgress())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
@ -143,7 +144,7 @@ public class ExTeleportToRaidPosition implements IClientIncomingPacket
player.abortCast();
player.stopMove(null);
player.setTeleportLocation(new Location(teleport.getX(), teleport.getY(), teleport.getZ()));
player.setTeleportLocation(location);
player.doCast(CommonSkill.TELEPORT.getSkill());
player.sendPacket(new ExRaidTeleportInfo());
}

View File

@ -10,12 +10,27 @@
<teleport id="17" x="105918" y="109759" z="-3192" price="3000" /> <!-- Hardin's Academy -->
<teleport id="18" x="73024" y="118485" z="-3696" price="34200" /> <!-- Dragon Valley -->
<teleport id="19" x="132219" y="114392" z="-3720" price="34200" /> <!-- Antharas' Lair -->
<teleport id="21" x="70576" y="128047" z="-3752" price="770" /> <!-- Death Pass -->
<teleport id="21" price="770" > <!-- Death Pass -->
<location x="70610" y="118363" z="-3664" />
<location x="70576" y="128047" z="-3752" />
<location x="67018" y="108177" z="-3680" />
<location x="67882" y="99782" z="-3712" />
</teleport>
<teleport id="23" x="43408" y="206881" z="-3752" price="15000" /> <!-- Devil's Isle -->
<teleport id="24" x="47935" y="186810" z="-3480" price="2000" /> <!-- Giran Harbor -->
<teleport id="25" x="83386" y="148014" z="-3400" price="1000" /> <!-- Town of Giran -->
<teleport id="29" x="102369" y="137818" z="-3328" price="770" /> <!-- Gorgon Flower Garden -->
<teleport id="32" x="-53117" y="119693" z="-2968" price="200" /> <!-- Ruins of Agony -->
<teleport id="29" price="770" > <!-- Gorgon Flower Garden -->
<location x="102369" y="137818" z="-3328" />
<location x="119184" y="135484" z="-3544" />
<location x="106615" y="138612" z="-3536" />
</teleport>
<teleport id="32" price="200" > <!-- Ruins of Agony -->
<location x="-42307" y="120810" z="-3368" />
<location x="-47785" y="111957" z="-3584" />
<location x="-46166" y="108893" z="-3792" />
<location x="-57040" y="112462" z="-3064" />
<location x="-53117" y="119693" z="-2968" />
</teleport>
<teleport id="34" x="-9970" y="175793" z="-4128" price="770" /> <!-- Ant Nest -->
<teleport id="35" x="-80684" y="149770" z="-3040" price="1000" /> <!-- Gludin Village -->
<teleport id="36" x="-91080" y="149860" z="-3624" price="2000" /> <!-- Gludin Harbor -->
@ -41,21 +56,49 @@
<teleport id="79" x="64328" y="26803" z="-3768" price="770" /> <!-- Sea Of Spores -->
<teleport id="81" x="85391" y="16228" z="-3672" price="3900" /> <!-- Ivory Tower -->
<teleport id="82" x="82927" y="53255" z="-1488" price="1000" /> <!-- Town of Oren -->
<teleport id="84" x="82911" y="92847" z="-3328" price="9000" /> <!-- Plains of the Lizardmen -->
<teleport id="84" price="9000" > <!-- Plains of the Lizardmen -->
<location x="87252" y="85514" z="-3103" />
<location x="82911" y="92847" z="-3328" />
<location x="95842" y="89089" z="-3472" />
<location x="95198" y="76261" z="-3480" />
<location x="81160" y="75068" z="-3592" />
</teleport>
<teleport id="90" x="92278" y="15469" z="-4384" price="3900" /> <!-- Ivory Tower Crater -->
<teleport id="98" x="114649" y="11115" z="-5120" price="15000" /> <!-- Tower of Insolence -->
<teleport id="99" x="155310" y="-16339" z="-3320" price="6750" /> <!-- Blazing Swamp -->
<teleport id="101" x="187383" y="20498" z="-3584" price="6750" /> <!-- Seal of Shilen -->
<teleport id="102" x="177116" y="45786" z="-4168" price="15300" /> <!-- Giant's Cave -->
<teleport id="104" x="173678" y="9256" z="-2736" price="1500" /> <!-- Cemetery -->
<teleport id="104" price="1500" > <!-- Cemetery -->
<location x="178863" y="20306" z="-3168" />
<location x="172204" y="20322" z="-3328" />
<location x="173668" y="9235" z="-2736" />
</teleport>
<teleport id="105" x="138012" y="81947" z="-3104" price="1800" /> <!-- Forest of Mirrors -->
<teleport id="108" x="117051" y="76854" z="-2704" price="1000" /> <!-- Hunters Village -->
<teleport id="113" x="106517" y="-2871" z="-3416" price="6750" /> <!-- Ancient Battleground -->
<teleport id="115" x="171827" y="56589" z="-5624" price="3000" /> <!-- Silent Valley -->
<teleport id="115" price="3000" > <!-- Silent Valley -->
<location x="184222" y="46666" z="-5794" />
<location x="171827" y="56589" z="-5624" />
</teleport>
<teleport id="116" x="105659" y="82974" z="-2776" price="8000" /> <!-- Hunters' Valley -->
<teleport id="117" x="139004" y="19891" z="-3584" price="2000" /> <!-- Plains of Glory -->
<teleport id="118" x="183524" y="-14991" z="-2768" price="1800" /> <!-- Fields of Massacre -->
<teleport id="119" x="162205" y="27090" z="-3712" price="2500" /> <!-- War-Torn Plains -->
<teleport id="117" price="2000" > <!-- Plains of Glory -->
<location x="138989" y="19915" z="-3616" />
<location x="131435" y="24184" z="-3728" />
<location x="139353" y="-904" z="-4136" />
<location x="132390" y="12644" z="-4040" />
</teleport>
<teleport id="118" price="1800" > <!-- Fields of Massacre -->
<location x="183543" y="-14974" z="-2768" />
<location x="179446" y="-7811" z="-3528" />
<location x="188259" y="-25385" z="-1456" />
<location x="163928" y="-10188" z="-3440" />
</teleport>
<teleport id="119" price="2500" > <!-- War-Torn Plains -->
<location x="159795" y="21131" z="-3696" />
<location x="162595" y="27467" z="-3728" />
<location x="164262" y="1849" z="-3480" />
<location x="153025" y="10061" z="-3928" />
</teleport>
<teleport id="131" x="-45158" y="-112583" z="-240" price="1000" /> <!-- Orc Village -->
<teleport id="133" x="9340" y="-112509" z="-2536" price="500" /> <!-- Cave of Trials -->
<teleport id="134" x="8652" y="-139941" z="-1144" price="500" /> <!-- Frozen Waterfalls -->
@ -107,8 +150,20 @@
<teleport id="432" x="111187" y="-12334" z="-1723" price="50000" /> <!-- Orc Fortress -->
<teleport id="433" x="104712" y="4803" z="-3288" price="1000" /> <!-- Road to Orc Fortress -->
<teleport id="434" x="-48363" y="140230" z="-2944" price="18000" /> <!-- Sel Mahum Base -->
<teleport id="435" x="73024" y="118485" z="-3720" price="15000" /> <!-- Entrance to Dragon Valley -->
<teleport id="436" x="88088" y="121578" z="-2960" price="18000" /> <!-- Center of the Dragon Valley -->
<teleport id="435" price="15000" > <!-- Entrance to Dragon Valley -->
<location x="75886" y="117511" z="-3752" />
<location x="82103" y="114066" z="-3144" />
<location x="85021" y="109046" z="-3200" />
<location x="93983" y="113863" z="-3120" />
<location x="87890" y="121193" z="-3056" />
</teleport>
<teleport id="436" price="18000" > <!-- Center of the Dragon Valley -->
<location x="101676" y="113865" z="-3696" />
<location x="119029" y="116799" z="-3728" />
<location x="127474" y="116503" z="-3736" />
<location x="124836" y="109958" z="-3096" />
<location x="116098" y="119102" z="-3720" />
</teleport>
<teleport id="437" x="92821" y="18847" z="-3608" price="2000" /> <!-- Outskirts of the Ivory Tower -->
<teleport id="438" x="15074" y="246054" z="-176" price="200" special="true" /> <!-- Hellbound -->
<teleport id="439" x="8890" y="239060" z="-2440" price="200" special="true" /> <!-- Satina's Laboratory -->

View File

@ -1,23 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="teleport" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:integer" name="id" use="required" />
<xs:attribute type="xs:integer" name="x" use="required" />
<xs:attribute type="xs:integer" name="y" use="required" />
<xs:attribute type="xs:integer" name="z" use="required" />
<xs:attribute type="xs:integer" name="price" use="required" />
<xs:attribute type="xs:boolean" name="special" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list" type="listType" />
<xs:complexType name="teleportType" mixed="true">
<xs:sequence>
<xs:element type="locationType" name="location" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="id" use="optional" />
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
<xs:attribute type="xs:string" name="price" use="optional" />
<xs:attribute type="xs:string" name="special" use="optional" />
</xs:complexType>
<xs:complexType name="locationType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="listType">
<xs:sequence>
<xs:element type="teleportType" name="teleport" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -17,13 +17,16 @@
package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -34,7 +37,7 @@ public class TeleportListData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(TeleportListData.class.getName());
private final Map<Integer, TeleportListHolder> _teleports = new HashMap<>();
private int _teleportsCount = 0;
private int _teleportCount = 0;
protected TeleportListData()
{
@ -46,8 +49,8 @@ public class TeleportListData implements IXmlReader
{
_teleports.clear();
parseDatapackFile("data/TeleportListData.xml");
_teleportsCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportsCount + " teleports.");
_teleportCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportCount + " teleports.");
}
@Override
@ -57,12 +60,19 @@ public class TeleportListData implements IXmlReader
{
final StatSet set = new StatSet(parseAttributes(teleportNode));
final int tpId = set.getInt("id");
final int x = set.getInt("x");
final int y = set.getInt("y");
final int z = set.getInt("z");
final int tpPrice = set.getInt("price");
final boolean special = set.getBoolean("special", false);
_teleports.put(tpId, new TeleportListHolder(tpId, x, y, z, tpPrice, special));
final List<Location> locations = new ArrayList<>();
forEach(teleportNode, "location", locationsNode ->
{
final StatSet locationSet = new StatSet(parseAttributes(locationsNode));
locations.add(new Location(locationSet.getInt("x"), locationSet.getInt("y"), locationSet.getInt("z")));
});
if (locations.isEmpty())
{
locations.add(new Location(set.getInt("x"), set.getInt("y"), set.getInt("z")));
}
_teleports.put(tpId, new TeleportListHolder(tpId, locations, tpPrice, special));
}));
}
@ -71,9 +81,9 @@ public class TeleportListData implements IXmlReader
return _teleports.get(teleportId);
}
public int getTeleportsCount()
public int getTeleportCount()
{
return _teleportsCount;
return _teleportCount;
}
public static TeleportListData getInstance()

View File

@ -16,24 +16,35 @@
*/
package org.l2jmobius.gameserver.model.holders;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.Location;
/**
* @author NviX
* @author NviX, Index
*/
public class TeleportListHolder
{
private final int _locId;
private final int _x;
private final int _y;
private final int _z;
private final List<Location> _locations;
private final int _price;
private final boolean _special;
public TeleportListHolder(int locId, int x, int y, int z, int price, boolean special)
{
_locId = locId;
_x = x;
_y = y;
_z = z;
_locations = new ArrayList<>(1);
_locations.add(new Location(x, y, z));
_price = price;
_special = special;
}
public TeleportListHolder(int locId, List<Location> locations, int price, boolean special)
{
_locId = locId;
_locations = locations;
_price = price;
_special = special;
}
@ -43,19 +54,9 @@ public class TeleportListHolder
return _locId;
}
public int getX()
public List<Location> getLocations()
{
return _x;
}
public int getY()
{
return _y;
}
public int getZ()
{
return _z;
return _locations;
}
public int getPrice()
@ -67,4 +68,9 @@ public class TeleportListHolder
{
return _special;
}
public Location getLocation()
{
return _locations.get(Rnd.get(_locations.size()));
}
}

View File

@ -98,9 +98,10 @@ public class ExRequestTeleport implements IClientIncomingPacket
return;
}
final Location location = teleport.getLocation();
if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
{
final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
final Castle castle = CastleManager.getInstance().getCastle(location.getX(), location.getY(), location.getZ());
if ((castle != null) && castle.getSiege().isInProgress())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
@ -142,7 +143,7 @@ public class ExRequestTeleport implements IClientIncomingPacket
player.abortCast();
player.stopMove(null);
player.setTeleportLocation(new Location(teleport.getX(), teleport.getY(), teleport.getZ()));
player.setTeleportLocation(location);
player.doCast(CommonSkill.TELEPORT.getSkill());
}
}

View File

@ -109,9 +109,10 @@ public class ExTeleportToRaidPosition implements IClientIncomingPacket
return;
}
final Location location = teleport.getLocation();
if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
{
final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
final Castle castle = CastleManager.getInstance().getCastle(location.getX(), location.getY(), location.getZ());
if ((castle != null) && castle.getSiege().isInProgress())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
@ -143,7 +144,7 @@ public class ExTeleportToRaidPosition implements IClientIncomingPacket
player.abortCast();
player.stopMove(null);
player.setTeleportLocation(new Location(teleport.getX(), teleport.getY(), teleport.getZ()));
player.setTeleportLocation(location);
player.doCast(CommonSkill.TELEPORT.getSkill());
player.sendPacket(new ExRaidTeleportInfo());
}

View File

@ -10,12 +10,27 @@
<teleport id="17" x="105918" y="109759" z="-3192" price="3000" /> <!-- Hardin's Academy -->
<teleport id="18" x="73024" y="118485" z="-3696" price="34200" /> <!-- Dragon Valley -->
<teleport id="19" x="132219" y="114392" z="-3720" price="34200" /> <!-- Antharas' Lair -->
<teleport id="21" x="70576" y="128047" z="-3752" price="770" /> <!-- Death Pass -->
<teleport id="21" price="770" > <!-- Death Pass -->
<location x="70610" y="118363" z="-3664" />
<location x="70576" y="128047" z="-3752" />
<location x="67018" y="108177" z="-3680" />
<location x="67882" y="99782" z="-3712" />
</teleport>
<teleport id="23" x="43408" y="206881" z="-3752" price="15000" /> <!-- Devil's Isle -->
<teleport id="24" x="47935" y="186810" z="-3480" price="2000" /> <!-- Giran Harbor -->
<teleport id="25" x="83386" y="148014" z="-3400" price="1000" /> <!-- Town of Giran -->
<teleport id="29" x="102369" y="137818" z="-3328" price="770" /> <!-- Gorgon Flower Garden -->
<teleport id="32" x="-53117" y="119693" z="-2968" price="200" /> <!-- Ruins of Agony -->
<teleport id="29" price="770" > <!-- Gorgon Flower Garden -->
<location x="102369" y="137818" z="-3328" />
<location x="119184" y="135484" z="-3544" />
<location x="106615" y="138612" z="-3536" />
</teleport>
<teleport id="32" price="200" > <!-- Ruins of Agony -->
<location x="-42307" y="120810" z="-3368" />
<location x="-47785" y="111957" z="-3584" />
<location x="-46166" y="108893" z="-3792" />
<location x="-57040" y="112462" z="-3064" />
<location x="-53117" y="119693" z="-2968" />
</teleport>
<teleport id="34" x="-9970" y="175793" z="-4128" price="770" /> <!-- Ant Nest -->
<teleport id="35" x="-80684" y="149770" z="-3040" price="1000" /> <!-- Gludin Village -->
<teleport id="36" x="-91080" y="149860" z="-3624" price="2000" /> <!-- Gludin Harbor -->
@ -41,21 +56,49 @@
<teleport id="79" x="64328" y="26803" z="-3768" price="770" /> <!-- Sea Of Spores -->
<teleport id="81" x="85391" y="16228" z="-3672" price="3900" /> <!-- Ivory Tower -->
<teleport id="82" x="82927" y="53255" z="-1488" price="1000" /> <!-- Town of Oren -->
<teleport id="84" x="82911" y="92847" z="-3328" price="9000" /> <!-- Plains of the Lizardmen -->
<teleport id="84" price="9000" > <!-- Plains of the Lizardmen -->
<location x="87252" y="85514" z="-3103" />
<location x="82911" y="92847" z="-3328" />
<location x="95842" y="89089" z="-3472" />
<location x="95198" y="76261" z="-3480" />
<location x="81160" y="75068" z="-3592" />
</teleport>
<teleport id="90" x="92278" y="15469" z="-4384" price="3900" /> <!-- Ivory Tower Crater -->
<teleport id="98" x="114649" y="11115" z="-5120" price="15000" /> <!-- Tower of Insolence -->
<teleport id="99" x="155310" y="-16339" z="-3320" price="6750" /> <!-- Blazing Swamp -->
<teleport id="101" x="187383" y="20498" z="-3584" price="6750" /> <!-- Seal of Shilen -->
<teleport id="102" x="177116" y="45786" z="-4168" price="15300" /> <!-- Giant's Cave -->
<teleport id="104" x="173678" y="9256" z="-2736" price="1500" /> <!-- Cemetery -->
<teleport id="104" price="1500" > <!-- Cemetery -->
<location x="178863" y="20306" z="-3168" />
<location x="172204" y="20322" z="-3328" />
<location x="173668" y="9235" z="-2736" />
</teleport>
<teleport id="105" x="138012" y="81947" z="-3104" price="1800" /> <!-- Forest of Mirrors -->
<teleport id="108" x="117051" y="76854" z="-2704" price="1000" /> <!-- Hunters Village -->
<teleport id="113" x="106517" y="-2871" z="-3416" price="6750" /> <!-- Ancient Battleground -->
<teleport id="115" x="171827" y="56589" z="-5624" price="3000" /> <!-- Silent Valley -->
<teleport id="115" price="3000" > <!-- Silent Valley -->
<location x="184222" y="46666" z="-5794" />
<location x="171827" y="56589" z="-5624" />
</teleport>
<teleport id="116" x="105659" y="82974" z="-2776" price="8000" /> <!-- Hunters' Valley -->
<teleport id="117" x="139004" y="19891" z="-3584" price="2000" /> <!-- Plains of Glory -->
<teleport id="118" x="183524" y="-14991" z="-2768" price="1800" /> <!-- Fields of Massacre -->
<teleport id="119" x="162205" y="27090" z="-3712" price="2500" /> <!-- War-Torn Plains -->
<teleport id="117" price="2000" > <!-- Plains of Glory -->
<location x="138989" y="19915" z="-3616" />
<location x="131435" y="24184" z="-3728" />
<location x="139353" y="-904" z="-4136" />
<location x="132390" y="12644" z="-4040" />
</teleport>
<teleport id="118" price="1800" > <!-- Fields of Massacre -->
<location x="183543" y="-14974" z="-2768" />
<location x="179446" y="-7811" z="-3528" />
<location x="188259" y="-25385" z="-1456" />
<location x="163928" y="-10188" z="-3440" />
</teleport>
<teleport id="119" price="2500" > <!-- War-Torn Plains -->
<location x="159795" y="21131" z="-3696" />
<location x="162595" y="27467" z="-3728" />
<location x="164262" y="1849" z="-3480" />
<location x="153025" y="10061" z="-3928" />
</teleport>
<teleport id="131" x="-45158" y="-112583" z="-240" price="1000" /> <!-- Orc Village -->
<teleport id="133" x="9340" y="-112509" z="-2536" price="500" /> <!-- Cave of Trials -->
<teleport id="134" x="8652" y="-139941" z="-1144" price="500" /> <!-- Frozen Waterfalls -->
@ -107,8 +150,20 @@
<teleport id="432" x="111187" y="-12334" z="-1723" price="50000" /> <!-- Orc Fortress -->
<teleport id="433" x="104712" y="4803" z="-3288" price="1000" /> <!-- Road to Orc Fortress -->
<teleport id="434" x="-48363" y="140230" z="-2944" price="18000" /> <!-- Sel Mahum Base -->
<teleport id="435" x="73024" y="118485" z="-3720" price="15000" /> <!-- Entrance to Dragon Valley -->
<teleport id="436" x="88088" y="121578" z="-2960" price="18000" /> <!-- Center of the Dragon Valley -->
<teleport id="435" price="15000" > <!-- Entrance to Dragon Valley -->
<location x="75886" y="117511" z="-3752" />
<location x="82103" y="114066" z="-3144" />
<location x="85021" y="109046" z="-3200" />
<location x="93983" y="113863" z="-3120" />
<location x="87890" y="121193" z="-3056" />
</teleport>
<teleport id="436" price="18000" > <!-- Center of the Dragon Valley -->
<location x="101676" y="113865" z="-3696" />
<location x="119029" y="116799" z="-3728" />
<location x="127474" y="116503" z="-3736" />
<location x="124836" y="109958" z="-3096" />
<location x="116098" y="119102" z="-3720" />
</teleport>
<teleport id="437" x="92821" y="18847" z="-3608" price="2000" /> <!-- Outskirts of the Ivory Tower -->
<teleport id="438" x="15074" y="246054" z="-176" price="200" special="true" /> <!-- Hellbound -->
<teleport id="439" x="8890" y="239060" z="-2440" price="200" special="true" /> <!-- Satina's Laboratory -->

View File

@ -1,23 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="teleport" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:integer" name="id" use="required" />
<xs:attribute type="xs:integer" name="x" use="required" />
<xs:attribute type="xs:integer" name="y" use="required" />
<xs:attribute type="xs:integer" name="z" use="required" />
<xs:attribute type="xs:integer" name="price" use="required" />
<xs:attribute type="xs:boolean" name="special" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list" type="listType" />
<xs:complexType name="teleportType" mixed="true">
<xs:sequence>
<xs:element type="locationType" name="location" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="id" use="optional" />
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
<xs:attribute type="xs:string" name="price" use="optional" />
<xs:attribute type="xs:string" name="special" use="optional" />
</xs:complexType>
<xs:complexType name="locationType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="listType">
<xs:sequence>
<xs:element type="teleportType" name="teleport" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -17,13 +17,16 @@
package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -34,7 +37,7 @@ public class TeleportListData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(TeleportListData.class.getName());
private final Map<Integer, TeleportListHolder> _teleports = new HashMap<>();
private int _teleportsCount = 0;
private int _teleportCount = 0;
protected TeleportListData()
{
@ -46,8 +49,8 @@ public class TeleportListData implements IXmlReader
{
_teleports.clear();
parseDatapackFile("data/TeleportListData.xml");
_teleportsCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportsCount + " teleports.");
_teleportCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportCount + " teleports.");
}
@Override
@ -57,12 +60,19 @@ public class TeleportListData implements IXmlReader
{
final StatSet set = new StatSet(parseAttributes(teleportNode));
final int tpId = set.getInt("id");
final int x = set.getInt("x");
final int y = set.getInt("y");
final int z = set.getInt("z");
final int tpPrice = set.getInt("price");
final boolean special = set.getBoolean("special", false);
_teleports.put(tpId, new TeleportListHolder(tpId, x, y, z, tpPrice, special));
final List<Location> locations = new ArrayList<>();
forEach(teleportNode, "location", locationsNode ->
{
final StatSet locationSet = new StatSet(parseAttributes(locationsNode));
locations.add(new Location(locationSet.getInt("x"), locationSet.getInt("y"), locationSet.getInt("z")));
});
if (locations.isEmpty())
{
locations.add(new Location(set.getInt("x"), set.getInt("y"), set.getInt("z")));
}
_teleports.put(tpId, new TeleportListHolder(tpId, locations, tpPrice, special));
}));
}
@ -71,9 +81,9 @@ public class TeleportListData implements IXmlReader
return _teleports.get(teleportId);
}
public int getTeleportsCount()
public int getTeleportCount()
{
return _teleportsCount;
return _teleportCount;
}
public static TeleportListData getInstance()

View File

@ -16,24 +16,35 @@
*/
package org.l2jmobius.gameserver.model.holders;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.Location;
/**
* @author NviX
* @author NviX, Index
*/
public class TeleportListHolder
{
private final int _locId;
private final int _x;
private final int _y;
private final int _z;
private final List<Location> _locations;
private final int _price;
private final boolean _special;
public TeleportListHolder(int locId, int x, int y, int z, int price, boolean special)
{
_locId = locId;
_x = x;
_y = y;
_z = z;
_locations = new ArrayList<>(1);
_locations.add(new Location(x, y, z));
_price = price;
_special = special;
}
public TeleportListHolder(int locId, List<Location> locations, int price, boolean special)
{
_locId = locId;
_locations = locations;
_price = price;
_special = special;
}
@ -43,19 +54,9 @@ public class TeleportListHolder
return _locId;
}
public int getX()
public List<Location> getLocations()
{
return _x;
}
public int getY()
{
return _y;
}
public int getZ()
{
return _z;
return _locations;
}
public int getPrice()
@ -67,4 +68,9 @@ public class TeleportListHolder
{
return _special;
}
public Location getLocation()
{
return _locations.get(Rnd.get(_locations.size()));
}
}

View File

@ -98,9 +98,10 @@ public class ExRequestTeleport implements IClientIncomingPacket
return;
}
final Location location = teleport.getLocation();
if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
{
final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
final Castle castle = CastleManager.getInstance().getCastle(location.getX(), location.getY(), location.getZ());
if ((castle != null) && castle.getSiege().isInProgress())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
@ -142,7 +143,7 @@ public class ExRequestTeleport implements IClientIncomingPacket
player.abortCast();
player.stopMove(null);
player.setTeleportLocation(new Location(teleport.getX(), teleport.getY(), teleport.getZ()));
player.setTeleportLocation(location);
player.doCast(CommonSkill.TELEPORT.getSkill());
}
}

View File

@ -109,9 +109,10 @@ public class ExTeleportToRaidPosition implements IClientIncomingPacket
return;
}
final Location location = teleport.getLocation();
if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
{
final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
final Castle castle = CastleManager.getInstance().getCastle(location.getX(), location.getY(), location.getZ());
if ((castle != null) && castle.getSiege().isInProgress())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
@ -143,7 +144,7 @@ public class ExTeleportToRaidPosition implements IClientIncomingPacket
player.abortCast();
player.stopMove(null);
player.setTeleportLocation(new Location(teleport.getX(), teleport.getY(), teleport.getZ()));
player.setTeleportLocation(location);
player.doCast(CommonSkill.TELEPORT.getSkill());
player.sendPacket(new ExRaidTeleportInfo());
}

View File

@ -10,12 +10,27 @@
<teleport id="17" x="105918" y="109759" z="-3192" price="3000" /> <!-- Hardin's Academy -->
<teleport id="18" x="73024" y="118485" z="-3696" price="34200" /> <!-- Dragon Valley -->
<teleport id="19" x="132219" y="114392" z="-3720" price="34200" /> <!-- Antharas' Lair -->
<teleport id="21" x="70576" y="128047" z="-3752" price="770" /> <!-- Death Pass -->
<teleport id="21" price="770" > <!-- Death Pass -->
<location x="70610" y="118363" z="-3664" />
<location x="70576" y="128047" z="-3752" />
<location x="67018" y="108177" z="-3680" />
<location x="67882" y="99782" z="-3712" />
</teleport>
<teleport id="23" x="43408" y="206881" z="-3752" price="15000" /> <!-- Devil's Isle -->
<teleport id="24" x="47935" y="186810" z="-3480" price="2000" /> <!-- Giran Harbor -->
<teleport id="25" x="83386" y="148014" z="-3400" price="1000" /> <!-- Town of Giran -->
<teleport id="29" x="102369" y="137818" z="-3328" price="770" /> <!-- Gorgon Flower Garden -->
<teleport id="32" x="-53117" y="119693" z="-2968" price="200" /> <!-- Ruins of Agony -->
<teleport id="29" price="770" > <!-- Gorgon Flower Garden -->
<location x="102369" y="137818" z="-3328" />
<location x="119184" y="135484" z="-3544" />
<location x="106615" y="138612" z="-3536" />
</teleport>
<teleport id="32" price="200" > <!-- Ruins of Agony -->
<location x="-42307" y="120810" z="-3368" />
<location x="-47785" y="111957" z="-3584" />
<location x="-46166" y="108893" z="-3792" />
<location x="-57040" y="112462" z="-3064" />
<location x="-53117" y="119693" z="-2968" />
</teleport>
<teleport id="34" x="-9970" y="175793" z="-4128" price="770" /> <!-- Ant Nest -->
<teleport id="35" x="-80684" y="149770" z="-3040" price="1000" /> <!-- Gludin Village -->
<teleport id="36" x="-91080" y="149860" z="-3624" price="2000" /> <!-- Gludin Harbor -->
@ -41,21 +56,49 @@
<teleport id="79" x="64328" y="26803" z="-3768" price="770" /> <!-- Sea Of Spores -->
<teleport id="81" x="85391" y="16228" z="-3672" price="3900" /> <!-- Ivory Tower -->
<teleport id="82" x="82927" y="53255" z="-1488" price="1000" /> <!-- Town of Oren -->
<teleport id="84" x="82911" y="92847" z="-3328" price="9000" /> <!-- Plains of the Lizardmen -->
<teleport id="84" price="9000" > <!-- Plains of the Lizardmen -->
<location x="87252" y="85514" z="-3103" />
<location x="82911" y="92847" z="-3328" />
<location x="95842" y="89089" z="-3472" />
<location x="95198" y="76261" z="-3480" />
<location x="81160" y="75068" z="-3592" />
</teleport>
<teleport id="90" x="92278" y="15469" z="-4384" price="3900" /> <!-- Ivory Tower Crater -->
<teleport id="98" x="114649" y="11115" z="-5120" price="15000" /> <!-- Tower of Insolence -->
<teleport id="99" x="155310" y="-16339" z="-3320" price="6750" /> <!-- Blazing Swamp -->
<teleport id="101" x="187383" y="20498" z="-3584" price="6750" /> <!-- Seal of Shilen -->
<teleport id="102" x="177116" y="45786" z="-4168" price="15300" /> <!-- Giant's Cave -->
<teleport id="104" x="173678" y="9256" z="-2736" price="1500" /> <!-- Cemetery -->
<teleport id="104" price="1500" > <!-- Cemetery -->
<location x="178863" y="20306" z="-3168" />
<location x="172204" y="20322" z="-3328" />
<location x="173668" y="9235" z="-2736" />
</teleport>
<teleport id="105" x="138012" y="81947" z="-3104" price="1800" /> <!-- Forest of Mirrors -->
<teleport id="108" x="117051" y="76854" z="-2704" price="1000" /> <!-- Hunters Village -->
<teleport id="113" x="106517" y="-2871" z="-3416" price="6750" /> <!-- Ancient Battleground -->
<teleport id="115" x="171827" y="56589" z="-5624" price="3000" /> <!-- Silent Valley -->
<teleport id="115" price="3000" > <!-- Silent Valley -->
<location x="184222" y="46666" z="-5794" />
<location x="171827" y="56589" z="-5624" />
</teleport>
<teleport id="116" x="105659" y="82974" z="-2776" price="8000" /> <!-- Hunters' Valley -->
<teleport id="117" x="139004" y="19891" z="-3584" price="2000" /> <!-- Plains of Glory -->
<teleport id="118" x="183524" y="-14991" z="-2768" price="1800" /> <!-- Fields of Massacre -->
<teleport id="119" x="162205" y="27090" z="-3712" price="2500" /> <!-- War-Torn Plains -->
<teleport id="117" price="2000" > <!-- Plains of Glory -->
<location x="138989" y="19915" z="-3616" />
<location x="131435" y="24184" z="-3728" />
<location x="139353" y="-904" z="-4136" />
<location x="132390" y="12644" z="-4040" />
</teleport>
<teleport id="118" price="1800" > <!-- Fields of Massacre -->
<location x="183543" y="-14974" z="-2768" />
<location x="179446" y="-7811" z="-3528" />
<location x="188259" y="-25385" z="-1456" />
<location x="163928" y="-10188" z="-3440" />
</teleport>
<teleport id="119" price="2500" > <!-- War-Torn Plains -->
<location x="159795" y="21131" z="-3696" />
<location x="162595" y="27467" z="-3728" />
<location x="164262" y="1849" z="-3480" />
<location x="153025" y="10061" z="-3928" />
</teleport>
<teleport id="131" x="-45158" y="-112583" z="-240" price="1000" /> <!-- Orc Village -->
<teleport id="133" x="9340" y="-112509" z="-2536" price="500" /> <!-- Cave of Trials -->
<teleport id="134" x="8652" y="-139941" z="-1144" price="500" /> <!-- Frozen Waterfalls -->
@ -107,8 +150,20 @@
<teleport id="432" x="111187" y="-12334" z="-1723" price="50000" /> <!-- Orc Fortress -->
<teleport id="433" x="104712" y="4803" z="-3288" price="1000" /> <!-- Road to Orc Fortress -->
<teleport id="434" x="-48363" y="140230" z="-2944" price="18000" /> <!-- Sel Mahum Base -->
<teleport id="435" x="73024" y="118485" z="-3720" price="15000" /> <!-- Entrance to Dragon Valley -->
<teleport id="436" x="88088" y="121578" z="-2960" price="18000" /> <!-- Center of the Dragon Valley -->
<teleport id="435" price="15000" > <!-- Entrance to Dragon Valley -->
<location x="75886" y="117511" z="-3752" />
<location x="82103" y="114066" z="-3144" />
<location x="85021" y="109046" z="-3200" />
<location x="93983" y="113863" z="-3120" />
<location x="87890" y="121193" z="-3056" />
</teleport>
<teleport id="436" price="18000" > <!-- Center of the Dragon Valley -->
<location x="101676" y="113865" z="-3696" />
<location x="119029" y="116799" z="-3728" />
<location x="127474" y="116503" z="-3736" />
<location x="124836" y="109958" z="-3096" />
<location x="116098" y="119102" z="-3720" />
</teleport>
<teleport id="437" x="92821" y="18847" z="-3608" price="2000" /> <!-- Outskirts of the Ivory Tower -->
<teleport id="438" x="15074" y="246054" z="-176" price="200" special="true" /> <!-- Hellbound -->
<teleport id="439" x="8890" y="239060" z="-2440" price="200" special="true" /> <!-- Satina's Laboratory -->

View File

@ -1,23 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="teleport" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:integer" name="id" use="required" />
<xs:attribute type="xs:integer" name="x" use="required" />
<xs:attribute type="xs:integer" name="y" use="required" />
<xs:attribute type="xs:integer" name="z" use="required" />
<xs:attribute type="xs:integer" name="price" use="required" />
<xs:attribute type="xs:boolean" name="special" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list" type="listType" />
<xs:complexType name="teleportType" mixed="true">
<xs:sequence>
<xs:element type="locationType" name="location" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
<xs:attribute type="xs:string" name="id" use="optional" />
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
<xs:attribute type="xs:string" name="price" use="optional" />
<xs:attribute type="xs:string" name="special" use="optional" />
</xs:complexType>
<xs:complexType name="locationType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="x" use="optional" />
<xs:attribute type="xs:string" name="y" use="optional" />
<xs:attribute type="xs:string" name="z" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="listType">
<xs:sequence>
<xs:element type="teleportType" name="teleport" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -17,13 +17,16 @@
package org.l2jmobius.gameserver.data.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
@ -34,7 +37,7 @@ public class TeleportListData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(TeleportListData.class.getName());
private final Map<Integer, TeleportListHolder> _teleports = new HashMap<>();
private int _teleportsCount = 0;
private int _teleportCount = 0;
protected TeleportListData()
{
@ -46,8 +49,8 @@ public class TeleportListData implements IXmlReader
{
_teleports.clear();
parseDatapackFile("data/TeleportListData.xml");
_teleportsCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportsCount + " teleports.");
_teleportCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportCount + " teleports.");
}
@Override
@ -57,12 +60,19 @@ public class TeleportListData implements IXmlReader
{
final StatSet set = new StatSet(parseAttributes(teleportNode));
final int tpId = set.getInt("id");
final int x = set.getInt("x");
final int y = set.getInt("y");
final int z = set.getInt("z");
final int tpPrice = set.getInt("price");
final boolean special = set.getBoolean("special", false);
_teleports.put(tpId, new TeleportListHolder(tpId, x, y, z, tpPrice, special));
final List<Location> locations = new ArrayList<>();
forEach(teleportNode, "location", locationsNode ->
{
final StatSet locationSet = new StatSet(parseAttributes(locationsNode));
locations.add(new Location(locationSet.getInt("x"), locationSet.getInt("y"), locationSet.getInt("z")));
});
if (locations.isEmpty())
{
locations.add(new Location(set.getInt("x"), set.getInt("y"), set.getInt("z")));
}
_teleports.put(tpId, new TeleportListHolder(tpId, locations, tpPrice, special));
}));
}
@ -71,9 +81,9 @@ public class TeleportListData implements IXmlReader
return _teleports.get(teleportId);
}
public int getTeleportsCount()
public int getTeleportCount()
{
return _teleportsCount;
return _teleportCount;
}
public static TeleportListData getInstance()

View File

@ -16,24 +16,35 @@
*/
package org.l2jmobius.gameserver.model.holders;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.Location;
/**
* @author NviX
* @author NviX, Index
*/
public class TeleportListHolder
{
private final int _locId;
private final int _x;
private final int _y;
private final int _z;
private final List<Location> _locations;
private final int _price;
private final boolean _special;
public TeleportListHolder(int locId, int x, int y, int z, int price, boolean special)
{
_locId = locId;
_x = x;
_y = y;
_z = z;
_locations = new ArrayList<>(1);
_locations.add(new Location(x, y, z));
_price = price;
_special = special;
}
public TeleportListHolder(int locId, List<Location> locations, int price, boolean special)
{
_locId = locId;
_locations = locations;
_price = price;
_special = special;
}
@ -43,19 +54,9 @@ public class TeleportListHolder
return _locId;
}
public int getX()
public List<Location> getLocations()
{
return _x;
}
public int getY()
{
return _y;
}
public int getZ()
{
return _z;
return _locations;
}
public int getPrice()
@ -67,4 +68,9 @@ public class TeleportListHolder
{
return _special;
}
public Location getLocation()
{
return _locations.get(Rnd.get(_locations.size()));
}
}

View File

@ -98,9 +98,10 @@ public class ExRequestTeleport implements IClientIncomingPacket
return;
}
final Location location = teleport.getLocation();
if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
{
final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
final Castle castle = CastleManager.getInstance().getCastle(location.getX(), location.getY(), location.getZ());
if ((castle != null) && castle.getSiege().isInProgress())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
@ -142,7 +143,7 @@ public class ExRequestTeleport implements IClientIncomingPacket
player.abortCast();
player.stopMove(null);
player.setTeleportLocation(new Location(teleport.getX(), teleport.getY(), teleport.getZ()));
player.setTeleportLocation(location);
player.doCast(CommonSkill.TELEPORT.getSkill());
}
}

View File

@ -109,9 +109,10 @@ public class ExTeleportToRaidPosition implements IClientIncomingPacket
return;
}
final Location location = teleport.getLocation();
if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
{
final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
final Castle castle = CastleManager.getInstance().getCastle(location.getX(), location.getY(), location.getZ());
if ((castle != null) && castle.getSiege().isInProgress())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
@ -143,7 +144,7 @@ public class ExTeleportToRaidPosition implements IClientIncomingPacket
player.abortCast();
player.stopMove(null);
player.setTeleportLocation(new Location(teleport.getX(), teleport.getY(), teleport.getZ()));
player.setTeleportLocation(location);
player.doCast(CommonSkill.TELEPORT.getSkill());
player.sendPacket(new ExRaidTeleportInfo());
}