Removed fall validation.

This commit is contained in:
MobiusDevelopment
2021-04-23 00:11:46 +00:00
parent 784f009190
commit 4585b1ce1c
65 changed files with 693 additions and 418 deletions
@@ -39,6 +39,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -541,6 +542,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10468,6 +10471,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -39,6 +39,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -543,6 +544,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10475,6 +10478,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -39,6 +39,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -545,6 +546,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10477,6 +10480,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -38,6 +38,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -549,6 +550,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10468,6 +10471,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -38,6 +38,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -547,6 +548,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10455,6 +10458,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -38,6 +38,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -547,6 +548,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10458,6 +10461,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -38,6 +38,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -547,6 +548,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10464,6 +10467,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -39,6 +39,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -559,6 +560,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10473,6 +10476,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -39,6 +39,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -555,6 +556,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10551,6 +10554,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -39,6 +39,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -555,6 +556,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10551,6 +10554,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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.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;
@@ -59,10 +58,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInBoat()) if (player.isInBoat())
{ {
return; return;
@@ -73,11 +68,10 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX; final int dx = _x - realX;
dy = _y - realY; final int dy = _y - realY;
dz = _z - realZ; final int dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy)); final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -105,16 +99,7 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) player.setXYZ(_x, _y, _z);
{
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z);
if (player.getZ() < nearestZ)
{
player.setXYZ(_x, _y, nearestZ);
player.stopMove(null);
}
}
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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.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;
@@ -59,10 +58,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInBoat()) if (player.isInBoat())
{ {
return; return;
@@ -73,11 +68,10 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX; final int dx = _x - realX;
dy = _y - realY; final int dy = _y - realY;
dz = _z - realZ; final int dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy)); final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -105,16 +99,7 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) player.setXYZ(_x, _y, _z);
{
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z);
if (player.getZ() < nearestZ)
{
player.setXYZ(_x, _y, nearestZ);
player.stopMove(null);
}
}
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -38,6 +38,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level; import java.util.logging.Level;
@@ -527,6 +528,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10884,6 +10887,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -53,6 +53,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -39,6 +39,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
@@ -546,6 +547,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10767,6 +10770,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -53,6 +53,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -39,6 +39,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -539,6 +540,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10351,6 +10354,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -39,6 +39,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -539,6 +540,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10351,6 +10354,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -39,6 +39,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -537,6 +538,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10337,6 +10340,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -39,6 +39,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -544,6 +545,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10367,6 +10370,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -39,6 +39,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -544,6 +545,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10367,6 +10370,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -40,6 +40,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -557,6 +558,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10307,6 +10310,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -39,6 +39,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -539,6 +540,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10372,6 +10375,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -40,6 +40,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -567,6 +568,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10446,6 +10449,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)
@@ -40,6 +40,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -567,6 +568,8 @@ public class PlayerInstance extends Playable
/** Stored from last ValidatePosition **/ /** Stored from last ValidatePosition **/
private final Location _lastServerPosition = new Location(0, 0, 0); private final Location _lastServerPosition = new Location(0, 0, 0);
private final AtomicBoolean _blinkActive = new AtomicBoolean();
/** The number of recommendation obtained by the PlayerInstance */ /** The number of recommendation obtained by the PlayerInstance */
private int _recomHave; // how much I was recommended by others private int _recomHave; // how much I was recommended by others
/** The number of recommendation that the PlayerInstance can give */ /** The number of recommendation that the PlayerInstance can give */
@@ -10450,6 +10453,16 @@ public class PlayerInstance extends Playable
return _lastServerPosition; return _lastServerPosition;
} }
public void setBlinkActive(boolean value)
{
_blinkActive.set(value);
}
public boolean isBlinkActive()
{
return _blinkActive.get();
}
@Override @Override
public void addExpAndSp(double addToExp, double addToSp) public void addExpAndSp(double addToExp, double addToSp)
{ {
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
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;
@@ -60,10 +59,6 @@ public class ValidatePosition implements IClientIncomingPacket
return; return;
} }
int dx;
int dy;
int dz;
double diffSq;
if (player.isInVehicle()) if (player.isInVehicle())
{ {
return; return;
@@ -74,17 +69,16 @@ public class ValidatePosition implements IClientIncomingPacket
return; // Disable validations during fall to avoid "jumping". return; // Disable validations during fall to avoid "jumping".
} }
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
// 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))
{ {
player.untransform(); player.untransform();
} }
final int dx = _x - realX;
final int dy = _y - realY;
final int dz = _z - realZ;
final double diffSq = ((dx * dx) + (dy * dy));
if (player.isFlying() || player.isInsideZone(ZoneId.WATER)) if (player.isFlying() || player.isInsideZone(ZoneId.WATER))
{ {
player.setXYZ(realX, realY, _z); player.setXYZ(realX, realY, _z);
@@ -112,16 +106,14 @@ public class ValidatePosition implements IClientIncomingPacket
// Check out of sync. // Check out of sync.
if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed()) if (player.calculateDistance3D(_x, _y, _z) > player.getStat().getMoveSpeed())
{ {
if (player.isFalling(_z)) if (player.isBlinkActive())
{ {
final int nearestZ = GeoEngine.getInstance().getHeight(_x, _y, _z); player.setBlinkActive(false);
if (player.getZ() < nearestZ) }
{ else
player.setXYZ(_x, _y, nearestZ); {
player.stopMove(null); player.setXYZ(_x, _y, _z);
}
} }
player.sendPacket(new ValidateLocation(player));
} }
player.setClientX(_x); player.setClientX(_x);
@@ -62,6 +62,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_destY = destY; _destY = destY;
_destZ = destZ; _destZ = destZ;
_type = type; _type = type;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed) public FlyToLocation(Creature creature, int destX, int destY, int destZ, FlyType type, int flySpeed, int flyDelay, int animationSpeed)
@@ -77,6 +82,11 @@ public class FlyToLocation implements IClientOutgoingPacket
_flySpeed = flySpeed; _flySpeed = flySpeed;
_flyDelay = flyDelay; _flyDelay = flyDelay;
_animationSpeed = animationSpeed; _animationSpeed = animationSpeed;
if (creature.isPlayer())
{
creature.getActingPlayer().setBlinkActive(true);
}
} }
public FlyToLocation(Creature creature, ILocational dest, FlyType type) public FlyToLocation(Creature creature, ILocational dest, FlyType type)