Removal of CoordSynchronize configuration.
This commit is contained in:
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -938,8 +938,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
/** Attribute System */
|
/** Attribute System */
|
||||||
public static int S_WEAPON_STONE;
|
public static int S_WEAPON_STONE;
|
||||||
@@ -2477,8 +2475,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
@@ -110,18 +110,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3039,32 +3039,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-8
@@ -12699,14 +12699,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+24
-81
@@ -16,26 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision: 1.13.4.7 $ $Date: 2005/03/27 15:29:30 $
|
|
||||||
*/
|
|
||||||
public class ValidatePosition implements IClientIncomingPacket
|
public class ValidatePosition implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _x;
|
private int _x;
|
||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
private int _data; // vehicle id
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -44,7 +39,7 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
_y = packet.readD();
|
_y = packet.readD();
|
||||||
_z = packet.readD();
|
_z = packet.readD();
|
||||||
_heading = packet.readD();
|
_heading = packet.readD();
|
||||||
_data = packet.readD();
|
packet.readD(); // vehicle id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,41 +64,14 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
int dy;
|
int dy;
|
||||||
int dz;
|
int dz;
|
||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInVehicle())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
client.sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInVehiclePosition()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player.isInAirShip())
|
|
||||||
{
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
// {
|
|
||||||
// dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
// dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
// diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
// if (diffSq > 250000)
|
|
||||||
// {
|
|
||||||
// sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInBoatPosition()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -111,14 +79,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Don't allow flying transformations outside gracia area!
|
// Don't allow flying transformations outside gracia area!
|
||||||
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
||||||
{
|
{
|
||||||
@@ -133,40 +93,8 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -176,15 +104,30 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -948,8 +948,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
/** Attribute System */
|
/** Attribute System */
|
||||||
public static int S_WEAPON_STONE;
|
public static int S_WEAPON_STONE;
|
||||||
@@ -2499,8 +2497,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
@@ -110,18 +110,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3039,32 +3039,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-8
@@ -12706,14 +12706,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+24
-81
@@ -16,26 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision: 1.13.4.7 $ $Date: 2005/03/27 15:29:30 $
|
|
||||||
*/
|
|
||||||
public class ValidatePosition implements IClientIncomingPacket
|
public class ValidatePosition implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _x;
|
private int _x;
|
||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
private int _data; // vehicle id
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -44,7 +39,7 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
_y = packet.readD();
|
_y = packet.readD();
|
||||||
_z = packet.readD();
|
_z = packet.readD();
|
||||||
_heading = packet.readD();
|
_heading = packet.readD();
|
||||||
_data = packet.readD();
|
packet.readD(); // vehicle id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,41 +64,14 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
int dy;
|
int dy;
|
||||||
int dz;
|
int dz;
|
||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInVehicle())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
client.sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInVehiclePosition()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player.isInAirShip())
|
|
||||||
{
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
// {
|
|
||||||
// dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
// dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
// diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
// if (diffSq > 250000)
|
|
||||||
// {
|
|
||||||
// sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInBoatPosition()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -111,14 +79,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Don't allow flying transformations outside gracia area!
|
// Don't allow flying transformations outside gracia area!
|
||||||
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
||||||
{
|
{
|
||||||
@@ -133,40 +93,8 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -176,15 +104,30 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -961,8 +961,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
/** Attribute System */
|
/** Attribute System */
|
||||||
public static int S_WEAPON_STONE;
|
public static int S_WEAPON_STONE;
|
||||||
@@ -2521,8 +2519,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
@@ -110,18 +110,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3039,32 +3039,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-8
@@ -12708,14 +12708,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+24
-81
@@ -16,26 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision: 1.13.4.7 $ $Date: 2005/03/27 15:29:30 $
|
|
||||||
*/
|
|
||||||
public class ValidatePosition implements IClientIncomingPacket
|
public class ValidatePosition implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _x;
|
private int _x;
|
||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
private int _data; // vehicle id
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -44,7 +39,7 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
_y = packet.readD();
|
_y = packet.readD();
|
||||||
_z = packet.readD();
|
_z = packet.readD();
|
||||||
_heading = packet.readD();
|
_heading = packet.readD();
|
||||||
_data = packet.readD();
|
packet.readD(); // vehicle id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,41 +64,14 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
int dy;
|
int dy;
|
||||||
int dz;
|
int dz;
|
||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInVehicle())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
client.sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInVehiclePosition()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player.isInAirShip())
|
|
||||||
{
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
// {
|
|
||||||
// dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
// dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
// diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
// if (diffSq > 250000)
|
|
||||||
// {
|
|
||||||
// sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInBoatPosition()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -111,14 +79,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Don't allow flying transformations outside gracia area!
|
// Don't allow flying transformations outside gracia area!
|
||||||
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
||||||
{
|
{
|
||||||
@@ -133,40 +93,8 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -176,15 +104,30 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -948,8 +948,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
/** Attribute System */
|
/** Attribute System */
|
||||||
public static int S_WEAPON_STONE;
|
public static int S_WEAPON_STONE;
|
||||||
@@ -2496,8 +2494,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
@@ -110,18 +110,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-23
@@ -3039,32 +3039,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-8
@@ -12688,14 +12688,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+24
-81
@@ -16,26 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision: 1.13.4.7 $ $Date: 2005/03/27 15:29:30 $
|
|
||||||
*/
|
|
||||||
public class ValidatePosition implements IClientIncomingPacket
|
public class ValidatePosition implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _x;
|
private int _x;
|
||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
private int _data; // vehicle id
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -44,7 +39,7 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
_y = packet.readD();
|
_y = packet.readD();
|
||||||
_z = packet.readD();
|
_z = packet.readD();
|
||||||
_heading = packet.readD();
|
_heading = packet.readD();
|
||||||
_data = packet.readD();
|
packet.readD(); // vehicle id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,41 +64,14 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
int dy;
|
int dy;
|
||||||
int dz;
|
int dz;
|
||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInVehicle())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
client.sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInVehiclePosition()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player.isInAirShip())
|
|
||||||
{
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
// {
|
|
||||||
// dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
// dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
// diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
// if (diffSq > 250000)
|
|
||||||
// {
|
|
||||||
// sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInBoatPosition()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -111,14 +79,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Don't allow flying transformations outside gracia area!
|
// Don't allow flying transformations outside gracia area!
|
||||||
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
||||||
{
|
{
|
||||||
@@ -133,40 +93,8 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -176,15 +104,30 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -943,8 +943,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
/** Attribute System */
|
/** Attribute System */
|
||||||
public static int S_WEAPON_STONE;
|
public static int S_WEAPON_STONE;
|
||||||
@@ -2496,8 +2494,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
@@ -110,18 +110,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3039,32 +3039,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-8
@@ -12675,14 +12675,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+24
-81
@@ -16,26 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision: 1.13.4.7 $ $Date: 2005/03/27 15:29:30 $
|
|
||||||
*/
|
|
||||||
public class ValidatePosition implements IClientIncomingPacket
|
public class ValidatePosition implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _x;
|
private int _x;
|
||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
private int _data; // vehicle id
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -44,7 +39,7 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
_y = packet.readD();
|
_y = packet.readD();
|
||||||
_z = packet.readD();
|
_z = packet.readD();
|
||||||
_heading = packet.readD();
|
_heading = packet.readD();
|
||||||
_data = packet.readD();
|
packet.readD(); // vehicle id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,41 +64,14 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
int dy;
|
int dy;
|
||||||
int dz;
|
int dz;
|
||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInVehicle())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
client.sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInVehiclePosition()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player.isInAirShip())
|
|
||||||
{
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
// {
|
|
||||||
// dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
// dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
// diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
// if (diffSq > 250000)
|
|
||||||
// {
|
|
||||||
// sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInBoatPosition()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -111,14 +79,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Don't allow flying transformations outside gracia area!
|
// Don't allow flying transformations outside gracia area!
|
||||||
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
||||||
{
|
{
|
||||||
@@ -133,40 +93,8 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -176,15 +104,30 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -950,8 +950,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
/** Attribute System */
|
/** Attribute System */
|
||||||
public static int S_WEAPON_STONE;
|
public static int S_WEAPON_STONE;
|
||||||
@@ -2508,8 +2506,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
@@ -110,18 +110,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3039,32 +3039,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-8
@@ -12678,14 +12678,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+24
-81
@@ -16,26 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision: 1.13.4.7 $ $Date: 2005/03/27 15:29:30 $
|
|
||||||
*/
|
|
||||||
public class ValidatePosition implements IClientIncomingPacket
|
public class ValidatePosition implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _x;
|
private int _x;
|
||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
private int _data; // vehicle id
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -44,7 +39,7 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
_y = packet.readD();
|
_y = packet.readD();
|
||||||
_z = packet.readD();
|
_z = packet.readD();
|
||||||
_heading = packet.readD();
|
_heading = packet.readD();
|
||||||
_data = packet.readD();
|
packet.readD(); // vehicle id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,41 +64,14 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
int dy;
|
int dy;
|
||||||
int dz;
|
int dz;
|
||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInVehicle())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
client.sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInVehiclePosition()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player.isInAirShip())
|
|
||||||
{
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
// {
|
|
||||||
// dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
// dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
// diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
// if (diffSq > 250000)
|
|
||||||
// {
|
|
||||||
// sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInBoatPosition()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -111,14 +79,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Don't allow flying transformations outside gracia area!
|
// Don't allow flying transformations outside gracia area!
|
||||||
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
||||||
{
|
{
|
||||||
@@ -133,40 +93,8 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -176,15 +104,30 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -962,8 +962,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
/** Attribute System */
|
/** Attribute System */
|
||||||
public static int S_WEAPON_STONE;
|
public static int S_WEAPON_STONE;
|
||||||
@@ -2551,8 +2549,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
@@ -110,18 +110,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3039,32 +3039,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-8
@@ -12684,14 +12684,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+24
-81
@@ -16,26 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision: 1.13.4.7 $ $Date: 2005/03/27 15:29:30 $
|
|
||||||
*/
|
|
||||||
public class ValidatePosition implements IClientIncomingPacket
|
public class ValidatePosition implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _x;
|
private int _x;
|
||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
private int _data; // vehicle id
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -44,7 +39,7 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
_y = packet.readD();
|
_y = packet.readD();
|
||||||
_z = packet.readD();
|
_z = packet.readD();
|
||||||
_heading = packet.readD();
|
_heading = packet.readD();
|
||||||
_data = packet.readD();
|
packet.readD(); // vehicle id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,41 +64,14 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
int dy;
|
int dy;
|
||||||
int dz;
|
int dz;
|
||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInVehicle())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
client.sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInVehiclePosition()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player.isInAirShip())
|
|
||||||
{
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
// {
|
|
||||||
// dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
// dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
// diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
// if (diffSq > 250000)
|
|
||||||
// {
|
|
||||||
// sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInBoatPosition()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -111,14 +79,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Don't allow flying transformations outside gracia area!
|
// Don't allow flying transformations outside gracia area!
|
||||||
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
||||||
{
|
{
|
||||||
@@ -133,40 +93,8 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -176,15 +104,30 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -973,8 +973,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
/** Attribute System */
|
/** Attribute System */
|
||||||
public static int S_WEAPON_STONE;
|
public static int S_WEAPON_STONE;
|
||||||
@@ -2575,8 +2573,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
@@ -110,18 +110,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-23
@@ -3038,32 +3038,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-8
@@ -12692,14 +12692,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+24
-81
@@ -16,26 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision: 1.13.4.7 $ $Date: 2005/03/27 15:29:30 $
|
|
||||||
*/
|
|
||||||
public class ValidatePosition implements IClientIncomingPacket
|
public class ValidatePosition implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _x;
|
private int _x;
|
||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
private int _data; // vehicle id
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -44,7 +39,7 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
_y = packet.readD();
|
_y = packet.readD();
|
||||||
_z = packet.readD();
|
_z = packet.readD();
|
||||||
_heading = packet.readD();
|
_heading = packet.readD();
|
||||||
_data = packet.readD();
|
packet.readD(); // vehicle id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,41 +64,14 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
int dy;
|
int dy;
|
||||||
int dz;
|
int dz;
|
||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInVehicle())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
client.sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInVehiclePosition()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player.isInAirShip())
|
|
||||||
{
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
// {
|
|
||||||
// dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
// dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
// diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
// if (diffSq > 250000)
|
|
||||||
// {
|
|
||||||
// sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInBoatPosition()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -111,14 +79,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Don't allow flying transformations outside gracia area!
|
// Don't allow flying transformations outside gracia area!
|
||||||
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
||||||
{
|
{
|
||||||
@@ -133,40 +93,8 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -176,15 +104,30 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -973,8 +973,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
/** Attribute System */
|
/** Attribute System */
|
||||||
public static int S_WEAPON_STONE;
|
public static int S_WEAPON_STONE;
|
||||||
@@ -2575,8 +2573,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
@@ -110,18 +110,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3038,32 +3038,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-8
@@ -12733,14 +12733,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+24
-81
@@ -16,26 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision: 1.13.4.7 $ $Date: 2005/03/27 15:29:30 $
|
|
||||||
*/
|
|
||||||
public class ValidatePosition implements IClientIncomingPacket
|
public class ValidatePosition implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _x;
|
private int _x;
|
||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
private int _data; // vehicle id
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -44,7 +39,7 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
_y = packet.readD();
|
_y = packet.readD();
|
||||||
_z = packet.readD();
|
_z = packet.readD();
|
||||||
_heading = packet.readD();
|
_heading = packet.readD();
|
||||||
_data = packet.readD();
|
packet.readD(); // vehicle id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,41 +64,14 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
int dy;
|
int dy;
|
||||||
int dz;
|
int dz;
|
||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInVehicle())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
client.sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInVehiclePosition()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player.isInAirShip())
|
|
||||||
{
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
// {
|
|
||||||
// dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
// dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
// diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
// if (diffSq > 250000)
|
|
||||||
// {
|
|
||||||
// sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInBoatPosition()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -111,14 +79,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Don't allow flying transformations outside gracia area!
|
// Don't allow flying transformations outside gracia area!
|
||||||
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
||||||
{
|
{
|
||||||
@@ -133,40 +93,8 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -176,15 +104,30 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -973,8 +973,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
/** Attribute System */
|
/** Attribute System */
|
||||||
public static int S_WEAPON_STONE;
|
public static int S_WEAPON_STONE;
|
||||||
@@ -2575,8 +2573,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
+3
-11
@@ -110,18 +110,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-23
@@ -3038,32 +3038,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-8
@@ -12733,14 +12733,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+24
-81
@@ -16,26 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision: 1.13.4.7 $ $Date: 2005/03/27 15:29:30 $
|
|
||||||
*/
|
|
||||||
public class ValidatePosition implements IClientIncomingPacket
|
public class ValidatePosition implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _x;
|
private int _x;
|
||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
private int _data; // vehicle id
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -44,7 +39,7 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
_y = packet.readD();
|
_y = packet.readD();
|
||||||
_z = packet.readD();
|
_z = packet.readD();
|
||||||
_heading = packet.readD();
|
_heading = packet.readD();
|
||||||
_data = packet.readD();
|
packet.readD(); // vehicle id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,41 +64,14 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
int dy;
|
int dy;
|
||||||
int dz;
|
int dz;
|
||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInVehicle())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
client.sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInVehiclePosition()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player.isInAirShip())
|
|
||||||
{
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
// {
|
|
||||||
// dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
// dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
// diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
// if (diffSq > 250000)
|
|
||||||
// {
|
|
||||||
// sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInBoatPosition()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -111,14 +79,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Don't allow flying transformations outside gracia area!
|
// Don't allow flying transformations outside gracia area!
|
||||||
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
||||||
{
|
{
|
||||||
@@ -133,40 +93,8 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -176,15 +104,30 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -937,8 +937,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
public static boolean FALL_DAMAGE;
|
public static boolean FALL_DAMAGE;
|
||||||
public static boolean ALLOW_WATER;
|
public static boolean ALLOW_WATER;
|
||||||
|
|
||||||
@@ -2502,8 +2500,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = geoengineConfig.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = geoengineConfig.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = geoengineConfig.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = geoengineConfig.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = geoengineConfig.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = geoengineConfig.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = geoengineConfig.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = geoengineConfig.getBoolean("CorrectPlayerZ", false);
|
|
||||||
FALL_DAMAGE = geoengineConfig.getBoolean("FallDamage", false);
|
FALL_DAMAGE = geoengineConfig.getBoolean("FallDamage", false);
|
||||||
ALLOW_WATER = geoengineConfig.getBoolean("AllowWater", false);
|
ALLOW_WATER = geoengineConfig.getBoolean("AllowWater", false);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-11
@@ -108,18 +108,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-23
@@ -5078,32 +5078,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
double distFraction;
|
double distFraction;
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
// Save temporary values to avoid rounding errors.
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-14
@@ -12688,12 +12688,6 @@ public class PlayerInstance extends Playable
|
|||||||
@Override
|
@Override
|
||||||
public boolean updatePosition(int gameTicks)
|
public boolean updatePosition(int gameTicks)
|
||||||
{
|
{
|
||||||
// Disables custom movement for PlayerInstance when Old Synchronization is selected
|
|
||||||
if (Config.COORD_SYNCHRONIZE == -1)
|
|
||||||
{
|
|
||||||
return super.updatePosition(gameTicks);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get movement data
|
// Get movement data
|
||||||
final MoveData m = _move;
|
final MoveData m = _move;
|
||||||
if (_move == null)
|
if (_move == null)
|
||||||
@@ -15471,14 +15465,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+23
-61
@@ -16,12 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocationInVehicle;
|
|
||||||
|
|
||||||
public class ValidatePosition extends GameClientPacket
|
public class ValidatePosition extends GameClientPacket
|
||||||
{
|
{
|
||||||
@@ -29,8 +28,6 @@ public class ValidatePosition extends GameClientPacket
|
|||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private int _data;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void readImpl()
|
protected void readImpl()
|
||||||
@@ -39,7 +36,7 @@ public class ValidatePosition extends GameClientPacket
|
|||||||
_y = readD();
|
_y = readD();
|
||||||
_z = readD();
|
_z = readD();
|
||||||
_heading = readD();
|
_heading = readD();
|
||||||
_data = readD();
|
readD(); // vehicle id
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -65,23 +62,12 @@ public class ValidatePosition extends GameClientPacket
|
|||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInBoat())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getBoatPosition().getX();
|
|
||||||
dy = _y - player.getBoatPosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
sendPacket(new ValidateLocationInVehicle(player));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -89,13 +75,6 @@ public class ValidatePosition extends GameClientPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
|
if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
|
||||||
{
|
{
|
||||||
player.setXYZ(realX, realY, _z);
|
player.setXYZ(realX, realY, _z);
|
||||||
@@ -104,40 +83,8 @@ public class ValidatePosition extends GameClientPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -147,15 +94,30 @@ public class ValidatePosition extends GameClientPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -971,8 +971,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
public static boolean FALL_DAMAGE;
|
public static boolean FALL_DAMAGE;
|
||||||
public static boolean ALLOW_WATER;
|
public static boolean ALLOW_WATER;
|
||||||
|
|
||||||
@@ -2567,8 +2565,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = geoengineConfig.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = geoengineConfig.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = geoengineConfig.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = geoengineConfig.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = geoengineConfig.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = geoengineConfig.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = geoengineConfig.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = geoengineConfig.getBoolean("CorrectPlayerZ", false);
|
|
||||||
FALL_DAMAGE = geoengineConfig.getBoolean("FallDamage", false);
|
FALL_DAMAGE = geoengineConfig.getBoolean("FallDamage", false);
|
||||||
ALLOW_WATER = geoengineConfig.getBoolean("AllowWater", false);
|
ALLOW_WATER = geoengineConfig.getBoolean("AllowWater", false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,18 +108,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5124,32 +5124,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
double distFraction;
|
double distFraction;
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
// Save temporary values to avoid rounding errors.
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-14
@@ -12998,12 +12998,6 @@ public class PlayerInstance extends Playable
|
|||||||
@Override
|
@Override
|
||||||
public boolean updatePosition(int gameTicks)
|
public boolean updatePosition(int gameTicks)
|
||||||
{
|
{
|
||||||
// Disables custom movement for PlayerInstance when Old Synchronization is selected
|
|
||||||
if (Config.COORD_SYNCHRONIZE == -1)
|
|
||||||
{
|
|
||||||
return super.updatePosition(gameTicks);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get movement data
|
// Get movement data
|
||||||
final MoveData m = _move;
|
final MoveData m = _move;
|
||||||
if (_move == null)
|
if (_move == null)
|
||||||
@@ -15837,14 +15831,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+23
-61
@@ -16,12 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocationInVehicle;
|
|
||||||
|
|
||||||
public class ValidatePosition extends GameClientPacket
|
public class ValidatePosition extends GameClientPacket
|
||||||
{
|
{
|
||||||
@@ -29,8 +28,6 @@ public class ValidatePosition extends GameClientPacket
|
|||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private int _data;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void readImpl()
|
protected void readImpl()
|
||||||
@@ -39,7 +36,7 @@ public class ValidatePosition extends GameClientPacket
|
|||||||
_y = readD();
|
_y = readD();
|
||||||
_z = readD();
|
_z = readD();
|
||||||
_heading = readD();
|
_heading = readD();
|
||||||
_data = readD();
|
readD(); // vehicle id
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -65,23 +62,12 @@ public class ValidatePosition extends GameClientPacket
|
|||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInBoat())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getBoatPosition().getX();
|
|
||||||
dy = _y - player.getBoatPosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
sendPacket(new ValidateLocationInVehicle(player));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -89,13 +75,6 @@ public class ValidatePosition extends GameClientPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
|
if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
|
||||||
{
|
{
|
||||||
player.setXYZ(realX, realY, _z);
|
player.setXYZ(realX, realY, _z);
|
||||||
@@ -104,40 +83,8 @@ public class ValidatePosition extends GameClientPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -147,15 +94,30 @@ public class ValidatePosition extends GameClientPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -1066,8 +1066,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Custom Settings
|
// Custom Settings
|
||||||
@@ -2593,8 +2591,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
@@ -109,18 +109,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3973,32 +3973,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-8
@@ -13500,14 +13500,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+24
-81
@@ -16,26 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision: 1.13.4.7 $ $Date: 2005/03/27 15:29:30 $
|
|
||||||
*/
|
|
||||||
public class ValidatePosition implements IClientIncomingPacket
|
public class ValidatePosition implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _x;
|
private int _x;
|
||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
private int _data; // vehicle id
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -44,7 +39,7 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
_y = packet.readD();
|
_y = packet.readD();
|
||||||
_z = packet.readD();
|
_z = packet.readD();
|
||||||
_heading = packet.readD();
|
_heading = packet.readD();
|
||||||
_data = packet.readD();
|
packet.readD(); // vehicle id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,41 +64,14 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
int dy;
|
int dy;
|
||||||
int dz;
|
int dz;
|
||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInVehicle())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
client.sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInVehiclePosition()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player.isInAirShip())
|
|
||||||
{
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
// {
|
|
||||||
// dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
// dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
// diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
// if (diffSq > 250000)
|
|
||||||
// {
|
|
||||||
// sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInBoatPosition()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -111,14 +79,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Don't allow flying transformations outside gracia area!
|
// Don't allow flying transformations outside gracia area!
|
||||||
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
||||||
{
|
{
|
||||||
@@ -133,40 +93,8 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -176,15 +104,30 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -1066,8 +1066,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Custom Settings
|
// Custom Settings
|
||||||
@@ -2602,8 +2600,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
@@ -109,18 +109,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3975,32 +3975,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-8
@@ -13393,14 +13393,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+24
-81
@@ -16,26 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision: 1.13.4.7 $ $Date: 2005/03/27 15:29:30 $
|
|
||||||
*/
|
|
||||||
public class ValidatePosition implements IClientIncomingPacket
|
public class ValidatePosition implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _x;
|
private int _x;
|
||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
private int _data; // vehicle id
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -44,7 +39,7 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
_y = packet.readD();
|
_y = packet.readD();
|
||||||
_z = packet.readD();
|
_z = packet.readD();
|
||||||
_heading = packet.readD();
|
_heading = packet.readD();
|
||||||
_data = packet.readD();
|
packet.readD(); // vehicle id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,41 +64,14 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
int dy;
|
int dy;
|
||||||
int dz;
|
int dz;
|
||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInVehicle())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
client.sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInVehiclePosition()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player.isInAirShip())
|
|
||||||
{
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
// {
|
|
||||||
// dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
// dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
// diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
// if (diffSq > 250000)
|
|
||||||
// {
|
|
||||||
// sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInBoatPosition()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -111,14 +79,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Don't allow flying transformations outside gracia area!
|
// Don't allow flying transformations outside gracia area!
|
||||||
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
||||||
{
|
{
|
||||||
@@ -133,40 +93,8 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -176,15 +104,30 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -895,8 +895,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
/** Attribute System */
|
/** Attribute System */
|
||||||
public static int S_WEAPON_STONE;
|
public static int S_WEAPON_STONE;
|
||||||
@@ -2394,8 +2392,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
+3
-11
@@ -110,18 +110,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-23
@@ -3039,32 +3039,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-8
@@ -12483,14 +12483,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+24
-81
@@ -16,26 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision: 1.13.4.7 $ $Date: 2005/03/27 15:29:30 $
|
|
||||||
*/
|
|
||||||
public class ValidatePosition implements IClientIncomingPacket
|
public class ValidatePosition implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _x;
|
private int _x;
|
||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
private int _data; // vehicle id
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -44,7 +39,7 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
_y = packet.readD();
|
_y = packet.readD();
|
||||||
_z = packet.readD();
|
_z = packet.readD();
|
||||||
_heading = packet.readD();
|
_heading = packet.readD();
|
||||||
_data = packet.readD();
|
packet.readD(); // vehicle id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,41 +64,14 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
int dy;
|
int dy;
|
||||||
int dz;
|
int dz;
|
||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInVehicle())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
client.sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInVehiclePosition()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player.isInAirShip())
|
|
||||||
{
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
// {
|
|
||||||
// dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
// dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
// diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
// if (diffSq > 250000)
|
|
||||||
// {
|
|
||||||
// sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInBoatPosition()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -111,14 +79,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Don't allow flying transformations outside gracia area!
|
// Don't allow flying transformations outside gracia area!
|
||||||
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
||||||
{
|
{
|
||||||
@@ -133,40 +93,8 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -176,15 +104,30 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -899,8 +899,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
/** Attribute System */
|
/** Attribute System */
|
||||||
public static int S_WEAPON_STONE;
|
public static int S_WEAPON_STONE;
|
||||||
@@ -2400,8 +2398,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
+3
-11
@@ -110,18 +110,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-23
@@ -3039,32 +3039,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
-8
@@ -12483,14 +12483,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
if (_fallingDamageTask != null)
|
if (_fallingDamageTask != null)
|
||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
|
||||||
{
|
|
||||||
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
|
||||||
if (getZ() < nearestZ)
|
|
||||||
{
|
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_fallingDamageTask.cancel(true);
|
_fallingDamageTask.cancel(true);
|
||||||
}
|
}
|
||||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||||
|
|||||||
+24
-81
@@ -16,26 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets;
|
package org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||||
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetOnVehicle;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision: 1.13.4.7 $ $Date: 2005/03/27 15:29:30 $
|
|
||||||
*/
|
|
||||||
public class ValidatePosition implements IClientIncomingPacket
|
public class ValidatePosition implements IClientIncomingPacket
|
||||||
{
|
{
|
||||||
private int _x;
|
private int _x;
|
||||||
private int _y;
|
private int _y;
|
||||||
private int _z;
|
private int _z;
|
||||||
private int _heading;
|
private int _heading;
|
||||||
private int _data; // vehicle id
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
@@ -44,7 +39,7 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
_y = packet.readD();
|
_y = packet.readD();
|
||||||
_z = packet.readD();
|
_z = packet.readD();
|
||||||
_heading = packet.readD();
|
_heading = packet.readD();
|
||||||
_data = packet.readD();
|
packet.readD(); // vehicle id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,41 +64,14 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
int dy;
|
int dy;
|
||||||
int dz;
|
int dz;
|
||||||
double diffSq;
|
double diffSq;
|
||||||
if (player.isInBoat())
|
if (player.isInVehicle())
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
if (diffSq > 250000)
|
|
||||||
{
|
|
||||||
client.sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInVehiclePosition()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player.isInAirShip())
|
|
||||||
{
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
// {
|
|
||||||
// dx = _x - player.getInVehiclePosition().getX();
|
|
||||||
// dy = _y - player.getInVehiclePosition().getY();
|
|
||||||
// dz = _z - player.getInVehiclePosition().getZ();
|
|
||||||
// diffSq = ((dx * dx) + (dy * dy));
|
|
||||||
// if (diffSq > 250000)
|
|
||||||
// {
|
|
||||||
// sendPacket(new GetOnVehicle(player.getObjectId(), _data, player.getInBoatPosition()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isFalling(_z))
|
if (player.isFalling(_z))
|
||||||
{
|
{
|
||||||
return; // disable validations during fall to avoid "jumping"
|
return; // Disable validations during fall to avoid "jumping".
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = _x - realX;
|
dx = _x - realX;
|
||||||
@@ -111,14 +79,6 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
dz = _z - realZ;
|
dz = _z - realZ;
|
||||||
diffSq = ((dx * dx) + (dy * dy));
|
diffSq = ((dx * dx) + (dy * dy));
|
||||||
|
|
||||||
// Zoey76: TODO: Implement or cleanup.
|
|
||||||
// Party party = player.getParty();
|
|
||||||
// if ((party != null) && (player.getLastPartyPositionDistance(_x, _y, _z) > 150))
|
|
||||||
// {
|
|
||||||
// player.setLastPartyPosition(_x, _y, _z);
|
|
||||||
// party.broadcastToPartyMembers(player, new PartyMemberPosition(player));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Don't allow flying transformations outside gracia area!
|
// Don't allow flying transformations outside gracia area!
|
||||||
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
if (player.isFlyingMounted() && (_x > World.GRACIA_MAX_X))
|
||||||
{
|
{
|
||||||
@@ -133,40 +93,8 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (diffSq < 360000) // if too large, messes observation
|
else if (diffSq < 360000) // If too large, messes observation.
|
||||||
{
|
{
|
||||||
if (Config.COORD_SYNCHRONIZE == -1) // Only Z coordinate synched to server, mainly used when no geodata but can be used also with geodata
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 1) // Trusting also client x,y coordinates (should not be used with geodata)
|
|
||||||
{
|
|
||||||
if (!player.isMoving() || !player.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
|
|
||||||
{
|
|
||||||
// character is not moving, take coordinates from client
|
|
||||||
if (diffSq < 2500)
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(_x, _y, _z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setHeading(_heading);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Sync 2 (or other),
|
|
||||||
// intended for geodata. Sends a validation packet to client
|
|
||||||
// when too far from server calculated true coordinate.
|
|
||||||
// Due to geodata/zone errors, some Z axis checks are made. (maybe a temporary solution)
|
|
||||||
// Important: this code part must work together with Creature.updatePosition
|
|
||||||
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
if ((diffSq > 250000) || (Math.abs(dz) > 200))
|
||||||
{
|
{
|
||||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - player.getClientZ()) < 800))
|
||||||
@@ -176,15 +104,30 @@ public class ValidatePosition implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player.isFalling(_z))
|
|
||||||
{
|
|
||||||
player.setXYZ(realX, realY, _z);
|
|
||||||
}
|
|
||||||
player.sendPacket(new ValidateLocation(player));
|
player.sendPacket(new ValidateLocation(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check out of sync.
|
||||||
|
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
|
||||||
|
{
|
||||||
|
if (player.isFalling(_z))
|
||||||
|
{
|
||||||
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(_x, _y, _z);
|
||||||
|
if (player.getZ() < nearestZ)
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, nearestZ);
|
||||||
|
player.stopMove(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.setXYZ(_x, _y, _z);
|
||||||
|
}
|
||||||
|
player.sendPacket(new ValidateLocation(player));
|
||||||
|
}
|
||||||
|
|
||||||
player.setClientX(_x);
|
player.setClientX(_x);
|
||||||
player.setClientY(_y);
|
player.setClientY(_y);
|
||||||
player.setClientZ(_z);
|
player.setClientZ(_z);
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
# at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/
|
||||||
GeoDataPath = ./data/geodata/
|
GeoDataPath = ./data/geodata/
|
||||||
|
|
||||||
# Player coordinates synchronization, default: 2
|
|
||||||
# 1 - partial synchronization Client --> Server ; don't use it with geodata
|
|
||||||
# 2 - partial synchronization Server --> Client ; use this setting with geodata
|
|
||||||
# -1 - Old system: will synchronize Z only
|
|
||||||
CoordSynchronize = 2
|
|
||||||
|
|
||||||
# =================================================================
|
# =================================================================
|
||||||
# Path finding
|
# Path finding
|
||||||
# =================================================================
|
# =================================================================
|
||||||
|
|||||||
@@ -899,8 +899,6 @@ public class Config
|
|||||||
public static float MEDIUM_WEIGHT;
|
public static float MEDIUM_WEIGHT;
|
||||||
public static float HIGH_WEIGHT;
|
public static float HIGH_WEIGHT;
|
||||||
public static float DIAGONAL_WEIGHT;
|
public static float DIAGONAL_WEIGHT;
|
||||||
public static int COORD_SYNCHRONIZE;
|
|
||||||
public static boolean CORRECT_PLAYER_Z;
|
|
||||||
|
|
||||||
/** Attribute System */
|
/** Attribute System */
|
||||||
public static int S_WEAPON_STONE;
|
public static int S_WEAPON_STONE;
|
||||||
@@ -2400,8 +2398,6 @@ public class Config
|
|||||||
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
MEDIUM_WEIGHT = GeoEngine.getFloat("MediumWeight", 2);
|
||||||
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
HIGH_WEIGHT = GeoEngine.getFloat("HighWeight", 3);
|
||||||
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
DIAGONAL_WEIGHT = GeoEngine.getFloat("DiagonalWeight", 0.707f);
|
||||||
COORD_SYNCHRONIZE = GeoEngine.getInt("CoordSynchronize", -1);
|
|
||||||
CORRECT_PLAYER_Z = GeoEngine.getBoolean("CorrectPlayerZ", false);
|
|
||||||
|
|
||||||
// Load AllowedPlayerRaces config file (if exists)
|
// Load AllowedPlayerRaces config file (if exists)
|
||||||
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
final PropertiesParser AllowedPlayerRaces = new PropertiesParser(CUSTOM_ALLOWED_PLAYER_RACES_CONFIG_FILE);
|
||||||
|
|||||||
+3
-11
@@ -110,18 +110,10 @@ public class GeoEngine
|
|||||||
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
|
||||||
|
|
||||||
// Avoid wrong configs when no files are loaded.
|
// Avoid wrong configs when no files are loaded.
|
||||||
if (loaded == 0)
|
if ((loaded == 0) && Config.PATHFINDING)
|
||||||
{
|
{
|
||||||
if (Config.PATHFINDING)
|
Config.PATHFINDING = false;
|
||||||
{
|
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
||||||
Config.PATHFINDING = false;
|
|
||||||
LOGGER.info("GeoEngine: Forcing PathFinding setting to false.");
|
|
||||||
}
|
|
||||||
if (Config.COORD_SYNCHRONIZE == 2)
|
|
||||||
{
|
|
||||||
Config.COORD_SYNCHRONIZE = -1;
|
|
||||||
LOGGER.info("GeoEngine: Forcing CoordSynchronize setting to -1.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-23
@@ -3039,32 +3039,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
double dx;
|
double dx;
|
||||||
double dy;
|
double dy;
|
||||||
double dz;
|
double dz;
|
||||||
if (Config.COORD_SYNCHRONIZE == 1)
|
// Save temporary values to avoid rounding errors.
|
||||||
// the only method that can modify x,y while moving (otherwise _move would/should be set null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = target.getX() - m._xAccurate;
|
||||||
{
|
dy = target.getY() - m._yAccurate;
|
||||||
dx = target.getX() - xPrev;
|
|
||||||
dy = target.getY() - yPrev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - xPrev;
|
|
||||||
dy = m._yDestination - yPrev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // otherwise we need saved temporary values to avoid rounding errors
|
else
|
||||||
{
|
{
|
||||||
if (target != null)
|
dx = m._xDestination - m._xAccurate;
|
||||||
{
|
dy = m._yDestination - m._yAccurate;
|
||||||
dx = target.getX() - m._xAccurate;
|
|
||||||
dy = target.getY() - m._yAccurate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dx = m._xDestination - m._xAccurate;
|
|
||||||
dy = m._yDestination - m._yAccurate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z coordinate will follow client values
|
// Z coordinate will follow client values
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user