Boat related packet improvements.

This commit is contained in:
MobiusDevelopment 2020-01-29 12:50:50 +00:00
parent 3f33e53666
commit f66dbc577c
33 changed files with 107 additions and 247 deletions

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -634,8 +634,7 @@ abstract class AbstractAI implements Ctrl
// CharMoveToLocation msg = new CharMoveToLocation(_actor);
if (((PlayerInstance) _actor).getBoat() != null)
{
final MoveToLocationInVehicle msg = new MoveToLocationInVehicle(_actor, destination, origin);
_actor.broadcastPacket(msg);
_actor.broadcastPacket(new MoveToLocationInVehicle(_actor, destination, origin));
}
}
else

View File

@ -5541,7 +5541,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
if (distFraction > 1)
{
// Set the position of the Creature to the destination
super.getPosition().setXYZ(m._xDestination, m._yDestination, m._zDestination);
super.setXYZ(m._xDestination, m._yDestination, m._zDestination);
if (this instanceof BoatInstance)
{
((BoatInstance) this).updatePeopleInTheBoat(m._xDestination, m._yDestination, m._zDestination);
@ -5557,7 +5557,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
m._yAccurate += dy * distFraction;
// Set the position of the Creature to estimated after parcial move
super.getPosition().setXYZ((int) m._xAccurate, (int) m._yAccurate, zPrev + (int) ((dz * distFraction) + 0.5));
super.setXYZ((int) m._xAccurate, (int) m._yAccurate, zPrev + (int) ((dz * distFraction) + 0.5));
if (this instanceof BoatInstance)
{
((BoatInstance) this).updatePeopleInTheBoat((int) m._xAccurate, (int) m._yAccurate, zPrev + (int) ((dz * distFraction) + 0.5));

View File

@ -147,7 +147,7 @@ public class BoatInstance extends Creature
final PlayerInstance player = inboat.get(i);
if ((player != null) && player.isInBoat() && (player.getBoat() == this))
{
player.getPosition().setXYZ(x, y, z);
player.setXYZ(x, y, z);
player.revalidateZone(false);
}

View File

@ -366,7 +366,6 @@ public class PlayerInstance extends Playable
private int _duelState = Duel.DUELSTATE_NODUEL;
private int _duelId = 0;
private SystemMessageId _noDuelReason = SystemMessageId.THERE_IS_NO_OPPONENT_TO_RECEIVE_YOUR_CHALLENGE_FOR_A_DUEL;
private boolean _inBoat;
private BoatInstance _boat;
private Location _inBoatPosition;
private int _mountType;
@ -14384,16 +14383,7 @@ public class PlayerInstance extends Playable
*/
public boolean isInBoat()
{
return _inBoat;
}
/**
* Sets the in boat.
* @param inBoat The inBoat to set.
*/
public void setInBoat(boolean inBoat)
{
_inBoat = inBoat;
return _boat != null;
}
/**
@ -14414,6 +14404,24 @@ public class PlayerInstance extends Playable
_boat = boat;
}
/**
* Gets the in boat position.
* @return the in boat position
*/
public Location getBoatPosition()
{
return _inBoatPosition;
}
/**
* Sets the in boat position.
* @param location the new in boat location
*/
public void setBoatPosition(Location location)
{
_inBoatPosition = location;
}
/**
* Sets the in crystallize.
* @param inCrystallize the new in crystallize
@ -14432,24 +14440,6 @@ public class PlayerInstance extends Playable
return _inCrystallize;
}
/**
* Gets the in boat position.
* @return the in boat position
*/
public Location getInBoatPosition()
{
return _inBoatPosition;
}
/**
* Sets the in boat position.
* @param location the new in boat location
*/
public void setInBoatPosition(Location location)
{
_inBoatPosition = location;
}
/**
* Manage the delete task of a PlayerInstance (Leave Party, Unsummon pet, Save its inventory in the database, Remove it from the world...).<BR>
* <BR>

View File

@ -182,13 +182,12 @@ public class PlayerKnownList extends PlayableKnownList
activeChar.sendPacket(new CharInfo(otherPlayer));
final int relation = otherPlayer.getRelation(activeChar);
if ((otherPlayer.getKnownList().getKnownRelations().get(activeChar.getObjectId()) != null) && (otherPlayer.getKnownList().getKnownRelations().get(activeChar.getObjectId()) != relation))
{
activeChar.sendPacket(new RelationChanged(otherPlayer, relation, activeChar.isAutoAttackable(otherPlayer)));
}
activeChar.sendPacket(new GetOnVehicle(otherPlayer, otherPlayer.getBoat(), otherPlayer.getInBoatPosition().getX(), otherPlayer.getInBoatPosition().getY(), otherPlayer.getInBoatPosition().getZ()));
activeChar.sendPacket(new GetOnVehicle(otherPlayer, otherPlayer.getBoat(), otherPlayer.getBoatPosition().getX(), otherPlayer.getBoatPosition().getY(), otherPlayer.getBoatPosition().getZ()));
}
else
@ -196,7 +195,6 @@ public class PlayerKnownList extends PlayableKnownList
activeChar.sendPacket(new CharInfo(otherPlayer));
final int relation = otherPlayer.getRelation(activeChar);
if ((otherPlayer.getKnownList().getKnownRelations().get(activeChar.getObjectId()) != null) && (otherPlayer.getKnownList().getKnownRelations().get(activeChar.getObjectId()) != relation))
{
activeChar.sendPacket(new RelationChanged(otherPlayer, relation, activeChar.isAutoAttackable(otherPlayer)));

View File

@ -52,7 +52,7 @@ public class CannotMoveAnymoreInVehicle extends GameClientPacket
if (player.isInBoat() && (player.getBoat().getObjectId() == _boatId))
{
player.setInBoatPosition(new Location(_x, _y, _z));
player.setBoatPosition(new Location(_x, _y, _z));
player.getPosition().setHeading(_heading);
player.broadcastPacket(new StopMoveInVehicle(player, _boatId));
}

View File

@ -70,7 +70,6 @@ public class MoveBackwardToLocation extends GameClientPacket
protected void runImpl()
{
final PlayerInstance player = getClient().getPlayer();
if (player == null)
{
return;

View File

@ -16,8 +16,6 @@
*/
package org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.gameserver.datatables.xml.BoatData;
import org.l2jmobius.gameserver.model.actor.instance.BoatInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.GetOffVehicle;
@ -49,7 +47,6 @@ public class RequestGetOffVehicle extends GameClientPacket
return;
}
final BoatInstance boat = BoatData.getInstance().getBoat(_boatId);
player.broadcastPacket(new GetOffVehicle(player, boat, _x, _y, _z));
player.broadcastPacket(new GetOffVehicle(player, _boatId, _x, _y, _z));
}
}

View File

@ -53,8 +53,8 @@ public class RequestGetOnVehicle extends GameClientPacket
return;
}
player.setInBoatPosition(new Location(_x, _y, _z));
player.getPosition().setXYZ(boat.getPosition().getX(), boat.getPosition().getY(), boat.getPosition().getZ());
player.setBoatPosition(new Location(_x, _y, _z));
player.setXYZ(boat.getPosition().getX(), boat.getPosition().getY(), boat.getPosition().getZ());
player.broadcastPacket(new GetOnVehicle(player, boat, _x, _y, _z));
player.revalidateZone(true);
}

View File

@ -50,18 +50,26 @@ public class RequestMoveToLocationInVehicle extends GameClientPacket
if (player.isAttackingNow() && (player.getActiveWeaponItem() != null) && (player.getActiveWeaponItem().getItemType() == WeaponType.BOW))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
boat = BoatData.getInstance().getBoat(_boatId);
player.setBoat(boat);
}
}
else
{
final BoatInstance boat = BoatData.getInstance().getBoat(_boatId);
if (boat == null)
{
return;
}
boat = BoatData.getInstance().getBoat(_boatId);
player.setBoat(boat);
player.setInBoat(true);
player.setInBoatPosition(_targetPos);
player.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO_IN_A_BOAT, _targetPos, _originPos);
}
player.setBoatPosition(_targetPos);
player.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO_IN_A_BOAT, _targetPos, _originPos);
}
}

View File

@ -136,19 +136,16 @@ public class RequestRecordInfo extends GameClientPacket
otherPlayer.getPosition().setWorldPosition(otherPlayer.getBoat().getLocation());
player.sendPacket(new CharInfo(otherPlayer));
final int relation = otherPlayer.getRelation(player);
if ((otherPlayer.getKnownList().getKnownRelations().get(player.getObjectId()) != null) && (otherPlayer.getKnownList().getKnownRelations().get(player.getObjectId()) != relation))
{
player.sendPacket(new RelationChanged(otherPlayer, relation, player.isAutoAttackable(otherPlayer)));
}
player.sendPacket(new GetOnVehicle(otherPlayer, otherPlayer.getBoat(), otherPlayer.getInBoatPosition().getX(), otherPlayer.getInBoatPosition().getY(), otherPlayer.getInBoatPosition().getZ()));
player.sendPacket(new GetOnVehicle(otherPlayer, otherPlayer.getBoat(), otherPlayer.getBoatPosition().getX(), otherPlayer.getBoatPosition().getY(), otherPlayer.getBoatPosition().getZ()));
}
else
{
player.sendPacket(new CharInfo(otherPlayer));
final int relation = otherPlayer.getRelation(player);
if ((otherPlayer.getKnownList().getKnownRelations().get(player.getObjectId()) != null) && (otherPlayer.getKnownList().getKnownRelations().get(player.getObjectId()) != relation))
{
player.sendPacket(new RelationChanged(otherPlayer, relation, player.isAutoAttackable(otherPlayer)));

View File

@ -69,8 +69,8 @@ public class ValidatePosition extends GameClientPacket
{
if (Config.COORD_SYNCHRONIZE == 2)
{
dx = _x - player.getInBoatPosition().getX();
dy = _y - player.getInBoatPosition().getY();
dx = _x - player.getBoatPosition().getX();
dy = _y - player.getBoatPosition().getY();
// dz = _z - player.getInVehiclePosition().getZ();
diffSq = ((dx * dx) + (dy * dy));
if (diffSq > 250000)

View File

@ -16,7 +16,6 @@
*/
package org.l2jmobius.gameserver.network.serverpackets;
import org.l2jmobius.gameserver.model.actor.instance.BoatInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
/**
@ -24,49 +23,29 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
*/
public class GetOffVehicle extends GameServerPacket
{
private final PlayerInstance _player;
private final int _boatId;
private final int _x;
private final int _y;
private final int _z;
private final PlayerInstance _player;
private final BoatInstance _boat;
/**
* @param player
* @param boat
* @param x
* @param y
* @param z
*/
public GetOffVehicle(PlayerInstance player, BoatInstance boat, int x, int y, int z)
public GetOffVehicle(PlayerInstance player, int boatId, int x, int y, int z)
{
_player = player;
_boat = boat;
_boatId = boatId;
_x = x;
_y = y;
_z = z;
if (_player != null)
{
_player.setInBoat(false);
_player.setBoat(null);
}
_player.setBoat(null);
}
/*
* (non-Javadoc)
* @see org.l2jmobius.gameserver.serverpackets.ServerBasePacket#writeImpl()
*/
@Override
protected void writeImpl()
{
if ((_boat == null) || (_player == null))
{
return;
}
writeC(0x5d);
writeD(_player.getObjectId());
writeD(_boat.getObjectId());
writeD(_boatId);
writeD(_x);
writeD(_y);
writeD(_z);

View File

@ -30,13 +30,6 @@ public class GetOnVehicle extends GameServerPacket
private final PlayerInstance _player;
private final BoatInstance _boat;
/**
* @param player
* @param boat
* @param x
* @param y
* @param z
*/
public GetOnVehicle(PlayerInstance player, BoatInstance boat, int x, int y, int z)
{
_player = player;
@ -46,13 +39,8 @@ public class GetOnVehicle extends GameServerPacket
_z = z;
_player.setBoat(_boat);
_player.setInBoat(true);
}
/*
* (non-Javadoc)
* @see org.l2jmobius.gameserver.serverpackets.ServerBasePacket#writeImpl()
*/
@Override
protected void writeImpl()
{

View File

@ -30,11 +30,6 @@ public class MoveToLocationInVehicle extends GameServerPacket
private Location _destination;
private Location _origin;
/**
* @param actor
* @param destination
* @param origin
*/
public MoveToLocationInVehicle(Creature actor, Location destination, Location origin)
{
if (!(actor instanceof PlayerInstance))
@ -43,7 +38,6 @@ public class MoveToLocationInVehicle extends GameServerPacket
}
final PlayerInstance player = (PlayerInstance) actor;
if (player.getBoat() == null)
{
return;
@ -55,10 +49,6 @@ public class MoveToLocationInVehicle extends GameServerPacket
_origin = origin;
}
/*
* (non-Javadoc)
* @see org.l2jmobius.gameserver.serverpackets.ServerBasePacket#writeImpl()
*/
@Override
protected void writeImpl()
{

View File

@ -46,9 +46,9 @@ public class StopMoveInVehicle extends GameServerPacket
writeC(0x72);
writeD(_player.getObjectId());
writeD(_boatId);
writeD(_player.getInBoatPosition().getX());
writeD(_player.getInBoatPosition().getY());
writeD(_player.getInBoatPosition().getZ());
writeD(_player.getBoatPosition().getX());
writeD(_player.getBoatPosition().getY());
writeD(_player.getBoatPosition().getZ());
writeD(_player.getPosition().getHeading());
}
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}

View File

@ -100,24 +100,19 @@ public class RequestMoveToLocationInVehicle implements IClientIncomingPacket
return;
}
final BoatInstance boat;
BoatInstance boat;
if (player.isInBoat())
{
boat = player.getBoat();
if (boat.getObjectId() != _boatId)
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
boat = BoatManager.getInstance().getBoat(_boatId);
player.setVehicle(boat);
}
}
else
{
boat = BoatManager.getInstance().getBoat(_boatId);
if ((boat == null) || !boat.isInsideRadius3D(player, 300))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.setVehicle(boat);
}