Fixes for several broadcasting position related problems.
This commit is contained in:
@@ -2921,27 +2921,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
dy = m._yDestination - m._yAccurate;
|
||||
}
|
||||
|
||||
// Z coordinate will follow client values
|
||||
dz = m._zDestination - zPrev;
|
||||
|
||||
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
|
||||
// Z coordinate will follow geodata or client values
|
||||
if ((Config.COORD_SYNCHRONIZE == 2) && !isFloating && !m.disregardingGeodata && ((GameTimeController.getInstance().getGameTicks() % 10) == 0) // once a second to reduce possible cpu load
|
||||
&& GeoEngine.getInstance().hasGeo(xPrev, yPrev))
|
||||
{
|
||||
final int geoHeight = GeoEngine.getInstance().getHeight(xPrev, yPrev, zPrev);
|
||||
dz = m._zDestination - geoHeight;
|
||||
// quite a big difference, compare to validatePosition packet
|
||||
if (isPlayer() && (Math.abs(getActingPlayer().getClientZ() - geoHeight) > 200) && (Math.abs(getActingPlayer().getClientZ() - geoHeight) < 1500))
|
||||
{
|
||||
dz = m._zDestination - zPrev; // allow diff
|
||||
}
|
||||
else if (isInCombat() && (Math.abs(dz) > 200) && (((dx * dx) + (dy * dy)) < 40000)) // allow mob to climb up to pcinstance
|
||||
{
|
||||
dz = m._zDestination - zPrev; // climbing
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dz = m._zDestination - zPrev;
|
||||
}
|
||||
|
||||
double delta = (dx * dx) + (dy * dy);
|
||||
if ((delta < 10000) && ((dz * dz) > 2500) // close enough, allows error between client and server geodata if it cannot be avoided
|
||||
@@ -3515,8 +3498,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
// to destination by GameTimeController
|
||||
|
||||
// Send a Server->Client packet CharMoveToLocation to the actor and all L2PcInstance in its _knownPlayers
|
||||
final MoveToLocation msg = new MoveToLocation(this);
|
||||
broadcastPacket(msg);
|
||||
broadcastPacket(new MoveToLocation(this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -502,6 +502,8 @@ public final class L2PcInstance extends L2Playable
|
||||
private int _mountLevel;
|
||||
/** Store object used to summon the strider you are mounting **/
|
||||
private int _mountObjectID = 0;
|
||||
/** Remember if dismounted from Wyvern **/
|
||||
private boolean _hasDismountedWyvern = false;
|
||||
|
||||
private AdminTeleportType _teleportType = AdminTeleportType.NORMAL;
|
||||
|
||||
@@ -762,9 +764,11 @@ public final class L2PcInstance extends L2Playable
|
||||
private int _clientZ;
|
||||
private int _clientHeading;
|
||||
|
||||
// during fall validations will be disabled for 10 ms.
|
||||
private static final int FALLING_VALIDATION_DELAY = 10000;
|
||||
// during fall validations will be disabled for 1000 ms.
|
||||
private static final int FALLING_VALIDATION_DELAY = 1000;
|
||||
private volatile long _fallingTimestamp = 0;
|
||||
private volatile int _fallingDamageSum = 0;
|
||||
private Future<?> _fallingDamageTask = null;
|
||||
|
||||
private int _multiSocialTarget = 0;
|
||||
private int _multiSociaAction = 0;
|
||||
@@ -6145,6 +6149,7 @@ public final class L2PcInstance extends L2Playable
|
||||
clearPetData();
|
||||
if (wasFlying)
|
||||
{
|
||||
_hasDismountedWyvern = true;
|
||||
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
|
||||
}
|
||||
broadcastPacket(new Ride(this));
|
||||
@@ -6155,6 +6160,11 @@ public final class L2PcInstance extends L2Playable
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasDismountedWyvern()
|
||||
{
|
||||
return _hasDismountedWyvern;
|
||||
}
|
||||
|
||||
public void setUptime(long time)
|
||||
{
|
||||
_uptime = time;
|
||||
@@ -12668,13 +12678,28 @@ public final class L2PcInstance extends L2Playable
|
||||
return false;
|
||||
}
|
||||
|
||||
final int damage = (int) Formulas.calcFallDam(this, deltaZ);
|
||||
if (damage > 0)
|
||||
// TODO: Test on retail. Add or set damage?
|
||||
_fallingDamageSum += (int) Formulas.calcFallDam(this, deltaZ);
|
||||
if (_fallingDamageTask != null)
|
||||
{
|
||||
reduceCurrentHp(Math.min(damage, getCurrentHp() - 1), this, null, false, true, false, false);
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_RECEIVED_S1_FALLING_DAMAGE);
|
||||
sm.addInt(damage);
|
||||
sendPacket(sm);
|
||||
_fallingDamageTask.cancel(true);
|
||||
}
|
||||
_fallingDamageTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
if ((_fallingDamageSum > 0) && !isInvul())
|
||||
{
|
||||
reduceCurrentHp(Math.min(_fallingDamageSum, getCurrentHp() - 1), this, null, false, true, false, false);
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_RECEIVED_S1_FALLING_DAMAGE);
|
||||
sm.addInt(_fallingDamageSum);
|
||||
sendPacket(sm);
|
||||
}
|
||||
_hasDismountedWyvern = false;
|
||||
_fallingDamageSum = 0;
|
||||
_fallingDamageTask = null;
|
||||
}, 1500);
|
||||
if (!_hasDismountedWyvern)
|
||||
{
|
||||
sendPacket(new ValidateLocation(this));
|
||||
}
|
||||
|
||||
setFalling();
|
||||
|
@@ -182,7 +182,11 @@ public class ValidatePosition implements IClientIncomingPacket
|
||||
{
|
||||
// if ((_z - activeChar.getClientZ()) < 200 && Math.abs(activeChar.getLastServerPosition().getZ()-realZ) > 70)
|
||||
|
||||
if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - activeChar.getClientZ()) < 800))
|
||||
if (activeChar.hasDismountedWyvern())
|
||||
{
|
||||
activeChar.setXYZ(_x, _y, _z);
|
||||
}
|
||||
else if ((Math.abs(dz) > 200) && (Math.abs(dz) < 1500) && (Math.abs(_z - activeChar.getClientZ()) < 800))
|
||||
{
|
||||
activeChar.setXYZ(realX, realY, _z);
|
||||
realZ = _z;
|
||||
|
Reference in New Issue
Block a user