Fixes for several broadcasting position related problems.

This commit is contained in:
MobiusDev
2018-05-09 17:53:53 +00:00
parent 74a1ffdf73
commit 8f144da03a
29 changed files with 351 additions and 341 deletions

View File

@ -87,18 +87,7 @@ public class AdminRideWyvern implements IAdminCommandHandler
}
else if (command.startsWith("admin_unride"))
{
if (activeChar.isFlying())
{
// Remove skill Wyvern Breath
activeChar.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
activeChar.sendSkillList();
}
if (activeChar.setMountType(0))
{
Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
activeChar.broadcastPacket(dismount);
}
activeChar.dismount();
}
return true;
}

View File

@ -16,11 +16,8 @@
*/
package com.l2jmobius.gameserver.handler.usercommandhandlers;
import com.l2jmobius.gameserver.datatables.SkillTable;
import com.l2jmobius.gameserver.handler.IUserCommandHandler;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.serverpackets.Ride;
import com.l2jmobius.gameserver.util.Broadcast;
/**
* Support for /dismount command.
@ -51,17 +48,7 @@ public class DisMount implements IUserCommandHandler
}
else if (activeChar.isMounted())
{
if (activeChar.setMountType(0))
{
if (activeChar.isFlying())
{
activeChar.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
}
Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
Broadcast.toSelfAndKnownPlayersInRadius(activeChar, dismount, 810000/* 900 */);
activeChar.setMountObjectID(0);
}
activeChar.dismount();
}
return true;

View File

@ -16,7 +16,6 @@
*/
package com.l2jmobius.gameserver.handler.usercommandhandlers;
import com.l2jmobius.gameserver.datatables.SkillTable;
import com.l2jmobius.gameserver.geodata.GeoData;
import com.l2jmobius.gameserver.handler.IUserCommandHandler;
import com.l2jmobius.gameserver.model.Inventory;
@ -110,17 +109,7 @@ public class Mount implements IUserCommandHandler
if ((activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null) || (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND) != null))
{
if (activeChar.setMountType(0))
{
if (activeChar.isFlying())
{
activeChar.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
}
Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
Broadcast.toSelfAndKnownPlayers(activeChar, dismount);
activeChar.setMountObjectID(0);
}
activeChar.dismount();
}
}
}
@ -130,18 +119,7 @@ public class Mount implements IUserCommandHandler
}
else if (activeChar.isMounted())
{
// Dismount
if (activeChar.setMountType(0))
{
if (activeChar.isFlying())
{
activeChar.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
}
Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
Broadcast.toSelfAndKnownPlayers(activeChar, dismount);
activeChar.setMountObjectID(0);
}
activeChar.dismount();
}
return true;

View File

@ -5999,28 +5999,8 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
dy = m._yDestination - m._yAccurate;
}
final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER);
// Z coordinate will follow geodata or client values
if ((Config.PATHFINDING > 0) && (Config.COORD_SYNCHRONIZE == 2) && !isFloating && !m.disregardingGeodata && !(this instanceof L2BoatInstance) && ((GameTimeController.getGameTicks() % 10) == 0 // once a second to reduce possible cpu load
) && GeoData.getInstance().hasGeo(xPrev, yPrev))
{
final int geoHeight = GeoData.getInstance().getSpawnHeight(xPrev, yPrev, zPrev - 30);
dz = m._zDestination - geoHeight;
// quite a big difference, compare to validatePosition packet
if ((this instanceof L2PcInstance) && (Math.abs(((L2PcInstance) this).getClientZ() - geoHeight) > 200) && (Math.abs(((L2PcInstance) this).getClientZ() - geoHeight) < 1500))
{
dz = m._zDestination - zPrev; // allow diff
}
else if (isInCombat() && (Math.abs(dz) > 200) && (((dx * dx) + (dy * dy)) < 40000))
{
dz = m._zDestination - zPrev; // climbing
}
}
else
{
dz = m._zDestination - zPrev;
}
// Z coordinate will follow client values
dz = m._zDestination - zPrev;
float speed;
if (this instanceof L2BoatInstance)
@ -6682,8 +6662,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
// to destination by GameTimeController
// Send a Server->Client packet CharMoveToLocation to the actor and all L2PcInstance in its _knownPlayers
final CharMoveToLocation msg = new CharMoveToLocation(this);
broadcastPacket(msg);
broadcastPacket(new CharMoveToLocation(this));
return true;
}

View File

@ -541,6 +541,9 @@ public final class L2PcInstance extends L2Playable
/** Store object used to summon the strider you are mounting *. */
private int _mountObjectID = 0;
/** Remember if dismounted from Wyvern **/
private boolean _hasDismountedWyvern = false;
/** The _telemode. */
public int _telemode = 0;
@ -1050,12 +1053,11 @@ public final class L2PcInstance extends L2Playable
/** The isintwtown. */
private boolean isintwtown = false;
// during fall validations will be disabled for 10 ms.
/** The Constant FALLING_VALIDATION_DELAY. */
private static final int FALLING_VALIDATION_DELAY = 10000;
/** The _falling timestamp. */
// during fall validations will be disabled for 1000 ms.
private static final int FALLING_VALIDATION_DELAY = 1000;
private long _fallingTimestamp = 0;
private volatile int _fallingDamageSum = 0;
private Future<?> _fallingDamageTask = null;
/** Previous coordinate sent to party in ValidatePosition *. */
private final Point3D _lastPartyPosition = new Point3D(0, 0, 0);
@ -17729,22 +17731,23 @@ public final class L2PcInstance extends L2Playable
*/
public boolean dismount()
{
if (setMountType(0))
final boolean wasFlying = isFlying();
setMountType(0);
if (wasFlying)
{
if (isFlying())
{
removeSkill(SkillTable.getInstance().getInfo(4289, 1));
}
Ride dismount = new Ride(getObjectId(), Ride.ACTION_DISMOUNT, 0);
broadcastPacket(dismount);
setMountObjectID(0);
// Notify self and others about speed change
broadcastUserInfo();
return true;
_hasDismountedWyvern = true;
removeSkill(SkillTable.getInstance().getInfo(4289, 1));
}
return false;
Ride dismount = new Ride(getObjectId(), Ride.ACTION_DISMOUNT, 0);
broadcastPacket(dismount);
setMountObjectID(0);
broadcastUserInfo();
return true;
}
public boolean hasDismountedWyvern()
{
return _hasDismountedWyvern;
}
/**
@ -18454,15 +18457,27 @@ public final class L2PcInstance extends L2Playable
return false;
}
final int damage = (int) Formulas.calcFallDam(this, deltaZ);
if ((damage > 0) && !isInvul())
// TODO: Test on retail. Add or set damage?
_fallingDamageSum += (int) Formulas.calcFallDam(this, deltaZ);
if (_fallingDamageTask != null)
{
reduceCurrentHp(Math.min(damage, getCurrentHp() - 1), null, false);
sendPacket(new SystemMessage(SystemMessageId.FALL_DAMAGE_S1).addNumber(damage));
_fallingDamageTask.cancel(true);
}
_fallingDamageTask = ThreadPool.schedule(() ->
{
if ((_fallingDamageSum > 0) && !isInvul())
{
reduceCurrentHp(Math.min(_fallingDamageSum, getCurrentHp() - 1), null, false);
sendPacket(new SystemMessage(SystemMessageId.FALL_DAMAGE_S1).addNumber(_fallingDamageSum));
}
_hasDismountedWyvern = false;
_fallingDamageSum = 0;
_fallingDamageTask = null;
}, 1500);
if (!_hasDismountedWyvern)
{
sendPacket(new ValidateLocation(this));
}
// Mobius: Prevent falling in game graphics.
sendPacket(new ValidateLocation(this));
_fallingTimestamp = System.currentTimeMillis() + FALLING_VALIDATION_DELAY;

View File

@ -365,21 +365,7 @@ public final class RequestActionUse extends L2GameClientPacket
}
else if (activeChar.isMounted())
{
if (activeChar.isFlying())
{
// Remove skill Wyvern Breath
activeChar.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
activeChar.sendSkillList();
}
if (activeChar.setMountType(0))
{
final Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
activeChar.broadcastPacket(dismount);
activeChar.setMountObjectID(0);
// Update status after unmount to avoid visual bug
activeChar.broadcastStatusUpdate();
activeChar.broadcastUserInfo();
}
activeChar.dismount();
}
break;
}

View File

@ -147,7 +147,11 @@ public final class ValidatePosition extends L2GameClientPacket
{
// 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;