Browse Source

Little vehicle rework, still not perfect.
Added VehicleStat instead of old speed set method, both knownlist merged into one.
Movement in vehicle removed from AI because it totally virtual.
Multiple packets update, including validation. Now sync mode 2 fully compartible with vehicles.
Players can be teleported from vehicle and correctly removed from passengers.

_DS_ 15 years ago
parent
commit
686a19ed11
31 changed files with 675 additions and 803 deletions
  1. 0 66
      L2_GameServer/java/com/l2jserver/gameserver/ai/AbstractAI.java
  2. 1 5
      L2_GameServer/java/com/l2jserver/gameserver/ai/CtrlIntention.java
  3. 0 68
      L2_GameServer/java/com/l2jserver/gameserver/ai/L2CharacterAI.java
  4. 45 51
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Character.java
  5. 17 3
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2AirShipControllerInstance.java
  6. 64 47
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2AirShipInstance.java
  7. 118 155
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2BoatInstance.java
  8. 30 83
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  9. 0 49
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/knownlist/AirShipKnownList.java
  10. 9 3
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/knownlist/PcKnownList.java
  11. 4 8
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/knownlist/VehicleKnownList.java
  12. 1 1
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/stat/CharStat.java
  13. 55 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/stat/VehicleStat.java
  14. 1 1
      L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/CannotMoveAnymoreInVehicle.java
  15. 1 5
      L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/MoveBackwardToLocation.java
  16. 34 12
      L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/MoveToLocationInAirShip.java
  17. 24 12
      L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/RequestGetOffVehicle.java
  18. 52 28
      L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/RequestGetOnVehicle.java
  19. 52 14
      L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/RequestMoveToLocationInVehicle.java
  20. 45 28
      L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/ValidatePosition.java
  21. 2 2
      L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/ExAirShipInfo.java
  22. 2 6
      L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/ExGetOffAirShip.java
  23. 9 12
      L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/ExGetOnAirShip.java
  24. 12 18
      L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/ExMoveToLocationInAirShip.java
  25. 6 23
      L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/GetOffVehicle.java
  26. 14 22
      L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/GetOnVehicle.java
  27. 10 21
      L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/MoveToLocationInVehicle.java
  28. 15 15
      L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/StopMoveInVehicle.java
  29. 9 1
      L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/UserInfo.java
  30. 34 33
      L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/ValidateLocationInVehicle.java
  31. 9 11
      L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/VehicleDeparture.java

+ 0 - 66
L2_GameServer/java/com/l2jserver/gameserver/ai/AbstractAI.java

@@ -34,9 +34,7 @@ import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
 import com.l2jserver.gameserver.network.serverpackets.AutoAttackStart;
 import com.l2jserver.gameserver.network.serverpackets.AutoAttackStart;
 import com.l2jserver.gameserver.network.serverpackets.AutoAttackStop;
 import com.l2jserver.gameserver.network.serverpackets.AutoAttackStop;
 import com.l2jserver.gameserver.network.serverpackets.Die;
 import com.l2jserver.gameserver.network.serverpackets.Die;
-import com.l2jserver.gameserver.network.serverpackets.ExMoveToLocationInAirShip;
 import com.l2jserver.gameserver.network.serverpackets.MoveToLocation;
 import com.l2jserver.gameserver.network.serverpackets.MoveToLocation;
-import com.l2jserver.gameserver.network.serverpackets.MoveToLocationInVehicle;
 import com.l2jserver.gameserver.network.serverpackets.MoveToPawn;
 import com.l2jserver.gameserver.network.serverpackets.MoveToPawn;
 import com.l2jserver.gameserver.network.serverpackets.StopMove;
 import com.l2jserver.gameserver.network.serverpackets.StopMove;
 import com.l2jserver.gameserver.network.serverpackets.StopRotation;
 import com.l2jserver.gameserver.network.serverpackets.StopRotation;
@@ -315,12 +313,6 @@ abstract class AbstractAI implements Ctrl
 			case AI_INTENTION_MOVE_TO:
 			case AI_INTENTION_MOVE_TO:
 				onIntentionMoveTo((L2CharPosition) arg0);
 				onIntentionMoveTo((L2CharPosition) arg0);
 				break;
 				break;
-			case AI_INTENTION_MOVE_TO_IN_A_BOAT:
-				onIntentionMoveToInABoat((L2CharPosition) arg0, (L2CharPosition) arg1);
-				break;
-			case AI_INTENTION_MOVE_TO_IN_AIR_SHIP:
-				onIntentionMoveToInAirShip((L2CharPosition) arg0, (L2CharPosition) arg1);
-				break;
 			case AI_INTENTION_FOLLOW:
 			case AI_INTENTION_FOLLOW:
 				onIntentionFollow((L2Character) arg0);
 				onIntentionFollow((L2Character) arg0);
 				break;
 				break;
@@ -494,10 +486,6 @@ abstract class AbstractAI implements Ctrl
 	
 	
 	protected abstract void onIntentionMoveTo(L2CharPosition destination);
 	protected abstract void onIntentionMoveTo(L2CharPosition destination);
 	
 	
-	protected abstract void onIntentionMoveToInABoat(L2CharPosition destination, L2CharPosition origin);
-	
-	protected abstract void onIntentionMoveToInAirShip(L2CharPosition destination, L2CharPosition origin);
-	
 	protected abstract void onIntentionFollow(L2Character target);
 	protected abstract void onIntentionFollow(L2Character target);
 	
 	
 	protected abstract void onIntentionPickUp(L2Object item);
 	protected abstract void onIntentionPickUp(L2Object item);
@@ -655,60 +643,6 @@ abstract class AbstractAI implements Ctrl
 		}
 		}
 	}
 	}
 	
 	
-	protected void moveToInABoat(L2CharPosition destination, L2CharPosition origin)
-	{
-		// Check if actor can move
-		if (!_actor.isMovementDisabled())
-		{
-			/*	// Set AI movement data
-			 _client_moving = true;
-			 _client_moving_to_pawn_offset = 0;
-
-			 // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
-			 _accessor.moveTo(((L2PcInstance)_actor).getBoat().getX() - destination.x,((L2PcInstance)_actor).getBoat().getY()- destination.y,((L2PcInstance)_actor).getBoat().getZ() - destination.z);
-			 */
-			// Send a Server->Client packet CharMoveToLocation to the actor and all L2PcInstance in its _knownPlayers
-			//CharMoveToLocation msg = new CharMoveToLocation(_actor);
-			if (((L2PcInstance) _actor).getBoat() != null)
-			{
-				MoveToLocationInVehicle msg = new MoveToLocationInVehicle(_actor, destination, origin);
-				_actor.broadcastPacket(msg);
-			}
-			
-		}
-		else
-		{
-			_actor.sendPacket(ActionFailed.STATIC_PACKET);
-		}
-	}
-
-	protected void moveToInAirShip(L2CharPosition destination, L2CharPosition origin)
-	{
-		// Check if actor can move
-		if (!_actor.isMovementDisabled())
-		{
-			/*	// Set AI movement data
-			 _client_moving = true;
-			 _client_moving_to_pawn_offset = 0;
-
-			 // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
-			 _accessor.moveTo(((L2PcInstance)_actor).getBoat().getX() - destination.x,((L2PcInstance)_actor).getBoat().getY()- destination.y,((L2PcInstance)_actor).getBoat().getZ() - destination.z);
-			 */
-			// Send a Server->Client packet CharMoveToLocation to the actor and all L2PcInstance in its _knownPlayers
-			//CharMoveToLocation msg = new CharMoveToLocation(_actor);
-			if (((L2PcInstance) _actor).getAirShip() != null)
-			{
-				ExMoveToLocationInAirShip msg = new ExMoveToLocationInAirShip(_actor, destination);
-				_actor.broadcastPacket(msg);
-			}
-			
-		}
-		else
-		{
-			_actor.sendPacket(ActionFailed.STATIC_PACKET);
-		}
-	}
-	
 	/**
 	/**
 	 * Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation <I>(broadcast)</I>.<BR><BR>
 	 * Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation <I>(broadcast)</I>.<BR><BR>
 	 *
 	 *

+ 1 - 5
L2_GameServer/java/com/l2jserver/gameserver/ai/CtrlIntention.java

@@ -37,9 +37,5 @@ public enum CtrlIntention
 	/** PickUp and item, (got to item, pickup it, become idle */
 	/** PickUp and item, (got to item, pickup it, become idle */
 	AI_INTENTION_PICK_UP,
 	AI_INTENTION_PICK_UP,
 	/** Move to target, then interact */
 	/** Move to target, then interact */
-	AI_INTENTION_INTERACT,
-	/** Move to another location in a boat */
-	AI_INTENTION_MOVE_TO_IN_A_BOAT,
-	/** Move to another location in an air ship */
-	AI_INTENTION_MOVE_TO_IN_AIR_SHIP;
+	AI_INTENTION_INTERACT;
 }
 }

+ 0 - 68
L2_GameServer/java/com/l2jserver/gameserver/ai/L2CharacterAI.java

@@ -346,74 +346,6 @@ public class L2CharacterAI extends AbstractAI
 		moveTo(pos.x, pos.y, pos.z);
 		moveTo(pos.x, pos.y, pos.z);
 	}
 	}
 	
 	
-	/* (non-Javadoc)
-	 * @see com.l2jserver.gameserver.ai.AbstractAI#onIntentionMoveToInABoat(com.l2jserver.gameserver.model.L2CharPosition, com.l2jserver.gameserver.model.L2CharPosition)
-	 */
-	@Override
-	protected void onIntentionMoveToInABoat(L2CharPosition destination, L2CharPosition origin)
-	{
-		if (getIntention() == AI_INTENTION_REST)
-		{
-			// Cancel action client side by sending Server->Client packet ActionFailed to the L2PcInstance actor
-			clientActionFailed();
-			return;
-		}
-		
-		if (_actor.isAllSkillsDisabled() || _actor.isCastingNow())
-		{
-			// Cancel action client side by sending Server->Client packet ActionFailed to the L2PcInstance actor
-			clientActionFailed();
-			return;
-		}
-		
-		// Set the Intention of this AbstractAI to AI_INTENTION_MOVE_TO
-		//
-		//changeIntention(AI_INTENTION_MOVE_TO, new L2CharPosition(((L2PcInstance)_actor).getBoat().getX() - destination.x, ((L2PcInstance)_actor).getBoat().getY() - destination.y, ((L2PcInstance)_actor).getBoat().getZ() - destination.z, 0)  , null);
-		
-		// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
-		clientStopAutoAttack();
-		
-		// Abort the attack of the L2Character and send Server->Client ActionFailed packet
-		_actor.abortAttack();
-		
-		// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
-		moveToInABoat(destination, origin);
-	}
-
-	/* (non-Javadoc)
-	 * @see com.l2jserver.gameserver.ai.AbstractAI#onIntentionMoveToInAirShip(com.l2jserver.gameserver.model.L2CharPosition, com.l2jserver.gameserver.model.L2CharPosition)
-	 */
-	@Override
-	protected void onIntentionMoveToInAirShip(L2CharPosition destination, L2CharPosition origin)
-	{
-		if (getIntention() == AI_INTENTION_REST)
-		{
-			// Cancel action client side by sending Server->Client packet ActionFailed to the L2PcInstance actor
-			clientActionFailed();
-			return;
-		}
-		
-		if (_actor.isAllSkillsDisabled() || _actor.isCastingNow())
-		{
-			// Cancel action client side by sending Server->Client packet ActionFailed to the L2PcInstance actor
-			clientActionFailed();
-			return;
-		}
-		
-		// Set the Intention of this AbstractAI to AI_INTENTION_MOVE_TO
-		//
-		//changeIntention(AI_INTENTION_MOVE_TO, new L2CharPosition(((L2PcInstance)_actor).getBoat().getX() - destination.x, ((L2PcInstance)_actor).getBoat().getY() - destination.y, ((L2PcInstance)_actor).getBoat().getZ() - destination.z, 0)  , null);
-		
-		// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
-		clientStopAutoAttack();
-		
-		// Abort the attack of the L2Character and send Server->Client ActionFailed packet
-		_actor.abortAttack();
-		
-		// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
-		moveToInAirShip(destination, origin);
-	}
-	
 	/**
 	/**
 	 * Manage the Follow Intention : Stop current Attack and Launch a Follow Task.<BR><BR>
 	 * Manage the Follow Intention : Stop current Attack and Launch a Follow Task.<BR><BR>
 	 *
 	 *

+ 45 - 51
L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Character.java

@@ -63,8 +63,11 @@ import com.l2jserver.gameserver.model.L2Skill.SkillTargetType;
 import com.l2jserver.gameserver.model.actor.instance.L2AirShipInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2AirShipInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2BoatInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2BoatInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
+import com.l2jserver.gameserver.model.actor.instance.L2MinionInstance;
+import com.l2jserver.gameserver.model.actor.instance.L2NpcWalkerInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
+import com.l2jserver.gameserver.model.actor.instance.L2RiftInvaderInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance.SkillDat;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance.SkillDat;
 import com.l2jserver.gameserver.model.actor.knownlist.CharKnownList;
 import com.l2jserver.gameserver.model.actor.knownlist.CharKnownList;
 import com.l2jserver.gameserver.model.actor.position.CharPosition;
 import com.l2jserver.gameserver.model.actor.position.CharPosition;
@@ -587,6 +590,8 @@ public abstract class L2Character extends L2Object
 	 * <li>Send a Server->Client packet TeleportToLocationt to the L2Character AND to all L2PcInstance in its _KnownPlayers</li>
 	 * <li>Send a Server->Client packet TeleportToLocationt to the L2Character AND to all L2PcInstance in its _KnownPlayers</li>
 	 * <li>Modify the position of the pet if necessary</li><BR><BR>
 	 * <li>Modify the position of the pet if necessary</li><BR><BR>
 	 *
 	 *
+	 * <B><U> Overridden in </U> :</B><BR><BR>
+	 * <li> L2PcInstance</li><BR><BR>
 	 */
 	 */
 	public void teleToLocation(int x, int y, int z, int heading, boolean allowRandomOffset)
 	public void teleToLocation(int x, int y, int z, int heading, boolean allowRandomOffset)
 	{
 	{
@@ -611,12 +616,12 @@ public abstract class L2Character extends L2Object
 		if (Config.DEBUG)
 		if (Config.DEBUG)
             _log.fine("Teleporting to: " + x + ", " + y + ", " + z);
             _log.fine("Teleporting to: " + x + ", " + y + ", " + z);
 
 
-		// remove the object from its old location
-        decayMe();
-		
 		// Send a Server->Client packet TeleportToLocationt to the L2Character AND to all L2PcInstance in the _KnownPlayers of the L2Character
 		// Send a Server->Client packet TeleportToLocationt to the L2Character AND to all L2PcInstance in the _KnownPlayers of the L2Character
 		broadcastPacket(new TeleportToLocation(this, x, y, z, heading));
 		broadcastPacket(new TeleportToLocation(this, x, y, z, heading));
 
 
+		// remove the object from its old location
+        decayMe();
+		
 		// Set the x,y,z position of the L2Object and if necessary modify its _worldRegion
 		// Set the x,y,z position of the L2Object and if necessary modify its _worldRegion
 		getPosition().setXYZ(x, y, z);
 		getPosition().setXYZ(x, y, z);
 		
 		
@@ -4134,7 +4139,7 @@ public abstract class L2Character extends L2Object
 		int yPrev = getY();
 		int yPrev = getY();
 		int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations
 		int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations
 		
 		
-		double dx, dy, dz, distFraction;
+		double dx, dy, dz;
 		if (Config.COORD_SYNCHRONIZE == 1) 
 		if (Config.COORD_SYNCHRONIZE == 1) 
 		// the only method that can modify x,y while moving (otherwise _move would/should be set null)
 		// the only method that can modify x,y while moving (otherwise _move would/should be set null)
 		{
 		{
@@ -4152,14 +4157,16 @@ public abstract class L2Character extends L2Object
 			&& !isInsideZone(L2Character.ZONE_WATER)
 			&& !isInsideZone(L2Character.ZONE_WATER)
 			&& !m.disregardingGeodata
 			&& !m.disregardingGeodata
 			&& GameTimeController.getGameTicks() % 10 == 0 // once a second to reduce possible cpu load
 			&& GameTimeController.getGameTicks() % 10 == 0 // once a second to reduce possible cpu load
-			&& GeoData.getInstance().hasGeo(xPrev, yPrev)
-			&& !(this instanceof L2BoatInstance)
-			&& !(this instanceof L2AirShipInstance))
+			&& GeoData.getInstance().hasGeo(xPrev, yPrev))
+//			&& !(this instanceof L2BoatInstance)
+//			&& !(this instanceof L2AirShipInstance))
 		{
 		{
 			short geoHeight = GeoData.getInstance().getSpawnHeight(xPrev, yPrev, zPrev-30, zPrev+30, this.getObjectId());
 			short geoHeight = GeoData.getInstance().getSpawnHeight(xPrev, yPrev, zPrev-30, zPrev+30, this.getObjectId());
 			dz = m._zDestination - geoHeight;
 			dz = m._zDestination - geoHeight;
 			// quite a big difference, compare to validatePosition packet
 			// 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)
+			if (this instanceof L2PcInstance
+					&& Math.abs(((L2PcInstance)this).getClientZ()-geoHeight) > 200
+					&& Math.abs(((L2PcInstance)this).getClientZ()-geoHeight) < 1500)
 			{	
 			{	
 				dz = m._zDestination - zPrev; // allow diff 
 				dz = m._zDestination - zPrev; // allow diff 
 			}
 			}
@@ -4175,27 +4182,18 @@ public abstract class L2Character extends L2Object
 		else
 		else
 			dz = m._zDestination - zPrev;
 			dz = m._zDestination - zPrev;
 
 
-		float speed;
-		if (this instanceof L2BoatInstance)
-		{
-			speed = ((L2BoatInstance)this).boatSpeed;
-		}
-		else if (this instanceof L2AirShipInstance)
-		{
-			speed = ((L2AirShipInstance)this).boatSpeed;
-		}
-		else
-		{
-			speed = getStat().getMoveSpeed();
-		}
-		
-		double distPassed = speed * (gameTicks - m._moveTimestamp) / GameTimeController.TICKS_PER_SECOND;
+		final double delta;
 		if ((dx*dx + dy*dy) < 10000 && (dz*dz > 2500)) // close enough, allows error between client and server geodata if it cannot be avoided
 		if ((dx*dx + dy*dy) < 10000 && (dz*dz > 2500)) // close enough, allows error between client and server geodata if it cannot be avoided
+			delta = Math.sqrt(dx*dx + dy*dy);
+		else
+			delta = Math.sqrt(dx*dx + dy*dy + dz*dz);
+
+		double distFraction = Double.MAX_VALUE;
+		if (delta > 1)
 		{
 		{
-			distFraction = distPassed / Math.sqrt(dx*dx + dy*dy);
+			final double distPassed = getStat().getMoveSpeed() * (gameTicks - m._moveTimestamp) / GameTimeController.TICKS_PER_SECOND;
+			distFraction = distPassed / delta;
 		}
 		}
-		else
-			distFraction = distPassed / Math.sqrt(dx*dx + dy*dy + dz*dz);
 
 
 		// if (Config.DEVELOPER) _log.warning("Move Ticks:" + (gameTicks - m._moveTimestamp) + ", distPassed:" + distPassed + ", distFraction:" + distFraction);
 		// if (Config.DEVELOPER) _log.warning("Move Ticks:" + (gameTicks - m._moveTimestamp) + ", distPassed:" + distPassed + ", distFraction:" + distFraction);
 		
 		
@@ -4204,17 +4202,11 @@ public abstract class L2Character extends L2Object
 			// Set the position of the L2Character to the destination
 			// Set the position of the L2Character to the destination
 			super.getPosition().setXYZ(m._xDestination, m._yDestination, m._zDestination);
 			super.getPosition().setXYZ(m._xDestination, m._yDestination, m._zDestination);
 			if (this instanceof L2BoatInstance)
 			if (this instanceof L2BoatInstance)
-			{
 				((L2BoatInstance)this).updatePeopleInTheBoat(m._xDestination, m._yDestination, m._zDestination);
 				((L2BoatInstance)this).updatePeopleInTheBoat(m._xDestination, m._yDestination, m._zDestination);
-			}
 			else if (this instanceof L2AirShipInstance)
 			else if (this instanceof L2AirShipInstance)
-			{
 				((L2AirShipInstance)this).updatePeopleInTheAirShip(m._xDestination, m._yDestination, m._zDestination);
 				((L2AirShipInstance)this).updatePeopleInTheAirShip(m._xDestination, m._yDestination, m._zDestination);
-			}
 			else
 			else
-			{
 				revalidateZone(false);
 				revalidateZone(false);
-			}
 		}
 		}
 		else
 		else
 		{
 		{
@@ -4224,17 +4216,11 @@ public abstract class L2Character extends L2Object
 			// Set the position of the L2Character to estimated after parcial move
 			// Set the position of the L2Character to estimated after parcial move
 			super.getPosition().setXYZ((int)(m._xAccurate), (int)(m._yAccurate), zPrev + (int)(dz * distFraction + 0.5));
 			super.getPosition().setXYZ((int)(m._xAccurate), (int)(m._yAccurate), zPrev + (int)(dz * distFraction + 0.5));
 			if(this instanceof L2BoatInstance )
 			if(this instanceof L2BoatInstance )
-			{
 				((L2BoatInstance)this).updatePeopleInTheBoat((int)(m._xAccurate), (int)(m._yAccurate), zPrev + (int)(dz * distFraction + 0.5));
 				((L2BoatInstance)this).updatePeopleInTheBoat((int)(m._xAccurate), (int)(m._yAccurate), zPrev + (int)(dz * distFraction + 0.5));
-			}
 			else if (this instanceof L2AirShipInstance)
 			else if (this instanceof L2AirShipInstance)
-			{
 				((L2AirShipInstance)this).updatePeopleInTheAirShip(m._xDestination, m._yDestination, m._zDestination);
 				((L2AirShipInstance)this).updatePeopleInTheAirShip(m._xDestination, m._yDestination, m._zDestination);
-			}
 			else
 			else
-			{
 				revalidateZone(false);
 				revalidateZone(false);
-			}
 		}
 		}
 
 
 		// Set the timer of last position update to now
 		// Set the timer of last position update to now
@@ -4481,12 +4467,16 @@ public abstract class L2Character extends L2Object
 		// GEODATA MOVEMENT CHECKS AND PATHFINDING
 		// GEODATA MOVEMENT CHECKS AND PATHFINDING
 		m.onGeodataPathIndex = -1; // Initialize not on geodata path
 		m.onGeodataPathIndex = -1; // Initialize not on geodata path
 		m.disregardingGeodata = false;
 		m.disregardingGeodata = false;
-		
+
 		if (Config.GEODATA > 0 
 		if (Config.GEODATA > 0 
 			&& !isFlying() // flying chars not checked - even canSeeTarget doesn't work yet
 			&& !isFlying() // flying chars not checked - even canSeeTarget doesn't work yet
 			&& (!isInsideZone(ZONE_WATER) || isInsideZone(ZONE_SIEGE)) // swimming also not checked unless in siege zone - but distance is limited
 			&& (!isInsideZone(ZONE_WATER) || isInsideZone(ZONE_SIEGE)) // swimming also not checked unless in siege zone - but distance is limited
-			&& !isInstanceType(InstanceType.L2NpcWalkerInstance)) // npc walkers not checked
+			&& !(this instanceof L2NpcWalkerInstance)) // npc walkers not checked
 		{
 		{
+			final boolean isInBoat = this instanceof L2PcInstance && ((L2PcInstance)this).isInBoat();
+			if (isInBoat)
+				m.disregardingGeodata = true;
+
 			double originalDistance = distance;
 			double originalDistance = distance;
 			int originalX = x;
 			int originalX = x;
 			int originalY = y;
 			int originalY = y;
@@ -4497,10 +4487,11 @@ public abstract class L2Character extends L2Object
 			// Movement checks:
 			// Movement checks:
 			// when geodata == 2, for all characters except mobs returning home (could be changed later to teleport if pathfinding fails)
 			// when geodata == 2, for all characters except mobs returning home (could be changed later to teleport if pathfinding fails)
 			// when geodata == 1, for l2playableinstance and l2riftinstance only
 			// when geodata == 1, for l2playableinstance and l2riftinstance only
-			if ((Config.GEODATA == 2 &&	!(isInstanceType(InstanceType.L2Attackable) && ((L2Attackable)this).isReturningToSpawnPoint())) 
-					|| isInstanceTypes(InstanceType.L2Playable, InstanceType.L2RiftInvaderInstance) 
-					|| (isInstanceType(InstanceType.L2Summon) && !(this.getAI().getIntention() == AI_INTENTION_FOLLOW)) // assuming intention_follow only when following owner
-					|| isAfraid())
+			if ((Config.GEODATA == 2 &&	!(this instanceof L2Attackable && ((L2Attackable)this).isReturningToSpawnPoint())) 
+					|| (this instanceof L2PcInstance && !(isInBoat && distance > 1500))
+					|| (this instanceof L2Summon && !(this.getAI().getIntention() == AI_INTENTION_FOLLOW)) // assuming intention_follow only when following owner
+					|| isAfraid()
+					|| this instanceof L2RiftInvaderInstance)
 			{
 			{
 				if (isOnGeodataPath())
 				if (isOnGeodataPath())
 				{
 				{
@@ -4540,9 +4531,10 @@ public abstract class L2Character extends L2Object
 			{
 			{
 				// Path calculation
 				// Path calculation
 				// Overrides previous movement check
 				// Overrides previous movement check
-				if(isInstanceTypes(InstanceType.L2Playable, InstanceType.L2MinionInstance) || this.isInCombat())
+				if((this instanceof L2Playable && !isInBoat)
+						|| this instanceof L2MinionInstance
+						|| this.isInCombat())
 				{
 				{
-		
 					m.geoPath = PathFinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId(), isInstanceType(InstanceType.L2Playable));
 					m.geoPath = PathFinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId(), isInstanceType(InstanceType.L2Playable));
                 	if (m.geoPath == null || m.geoPath.size() < 2) // No path found
                 	if (m.geoPath == null || m.geoPath.size() < 2) // No path found
                 	{
                 	{
@@ -4554,10 +4546,11 @@ public abstract class L2Character extends L2Object
                 		// * Summons will follow their masters no matter what.
                 		// * Summons will follow their masters no matter what.
                 		// * Currently minions also must move freely since L2AttackableAI commands
                 		// * Currently minions also must move freely since L2AttackableAI commands
                 		// them to move along with their leader
                 		// them to move along with their leader
-                		if (isInstanceType(InstanceType.L2PcInstance) 
-                				|| (!isInstanceTypes(InstanceType.L2Playable, InstanceType.L2MinionInstance) 
+                		if (this instanceof L2PcInstance
+                				|| (!(this instanceof L2Playable)
+                						&& !(this instanceof L2MinionInstance) 
                 						&& Math.abs(z - curZ) > 140)
                 						&& Math.abs(z - curZ) > 140)
-                				|| (isInstanceType(InstanceType.L2Summon) && !((L2Summon)this).getFollowStatus())) 
+                				|| (this instanceof L2Summon && !((L2Summon)this).getFollowStatus())) 
                 		{
                 		{
                 			getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
                 			getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
                 			return;
                 			return;
@@ -4610,10 +4603,11 @@ public abstract class L2Character extends L2Object
 			}
 			}
 			// If no distance to go through, the movement is canceled
 			// If no distance to go through, the movement is canceled
 			if (distance < 1 && (Config.GEODATA == 2 
 			if (distance < 1 && (Config.GEODATA == 2 
-					|| isInstanceTypes(InstanceType.L2Playable, InstanceType.L2RiftInvaderInstance) 
+					|| this instanceof L2Playable
+					|| this instanceof L2RiftInvaderInstance 
 					|| this.isAfraid()))
 					|| this.isAfraid()))
 			{
 			{
-				if(isInstanceType(InstanceType.L2Summon)) ((L2Summon)this).setFollowStatus(false);
+				if(this instanceof L2Summon) ((L2Summon)this).setFollowStatus(false);
 				getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
 				getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
 				return;
 				return;
 			}
 			}

+ 17 - 3
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2AirShipControllerInstance.java

@@ -45,11 +45,25 @@ public class L2AirShipControllerInstance extends L2NpcInstance
 	{
 	{
 		if (command.equalsIgnoreCase("board"))
 		if (command.equalsIgnoreCase("board"))
 		{
 		{
-			L2AirShipInstance ship = AirShipManager.getInstance().getAirShip();
-
+			if (player.getPet() != null)
+			{
+				player.sendPacket(new SystemMessage(SystemMessageId.RELEASE_PET_ON_BOAT));
+				return;
+			}
+			if (player.isTransformed())
+			{
+				player.sendPacket(new SystemMessage(SystemMessageId.CANT_POLYMORPH_ON_BOAT));
+				return;
+			}
 			if (player.isFlyingMounted())
 			if (player.isFlyingMounted())
+			{
 				player.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_MOUNT_NOT_MEET_REQUEIREMENTS));
 				player.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_MOUNT_NOT_MEET_REQUEIREMENTS));
-			else if (ship.isInDock() && _isBoardAllowed)
+				return;
+			}
+
+			L2AirShipInstance ship = AirShipManager.getInstance().getAirShip();
+
+			if (ship.isInDock() && _isBoardAllowed)
 			{
 			{
 				ship.onPlayerBoarding(player);
 				ship.onPlayerBoarding(player);
 				return;
 				return;

+ 64 - 47
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2AirShipInstance.java

@@ -19,7 +19,6 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.FileReader;
 import java.io.LineNumberReader;
 import java.io.LineNumberReader;
-import java.util.Collection;
 import java.util.Map;
 import java.util.Map;
 import java.util.StringTokenizer;
 import java.util.StringTokenizer;
 import java.util.logging.Level;
 import java.util.logging.Level;
@@ -32,7 +31,8 @@ import com.l2jserver.gameserver.ai.L2CharacterAI;
 import com.l2jserver.gameserver.instancemanager.AirShipManager;
 import com.l2jserver.gameserver.instancemanager.AirShipManager;
 import com.l2jserver.gameserver.model.L2ItemInstance;
 import com.l2jserver.gameserver.model.L2ItemInstance;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Character;
-import com.l2jserver.gameserver.model.actor.knownlist.AirShipKnownList;
+import com.l2jserver.gameserver.model.actor.knownlist.VehicleKnownList;
+import com.l2jserver.gameserver.model.actor.stat.VehicleStat;
 import com.l2jserver.gameserver.network.serverpackets.ExAirShipInfo;
 import com.l2jserver.gameserver.network.serverpackets.ExAirShipInfo;
 import com.l2jserver.gameserver.network.serverpackets.ExGetOffAirShip;
 import com.l2jserver.gameserver.network.serverpackets.ExGetOffAirShip;
 import com.l2jserver.gameserver.network.serverpackets.ExGetOnAirShip;
 import com.l2jserver.gameserver.network.serverpackets.ExGetOnAirShip;
@@ -40,6 +40,7 @@ import com.l2jserver.gameserver.network.serverpackets.ExMoveToLocationAirShip;
 import com.l2jserver.gameserver.network.serverpackets.ExStopMoveAirShip;
 import com.l2jserver.gameserver.network.serverpackets.ExStopMoveAirShip;
 import com.l2jserver.gameserver.templates.chars.L2CharTemplate;
 import com.l2jserver.gameserver.templates.chars.L2CharTemplate;
 import com.l2jserver.gameserver.templates.item.L2Weapon;
 import com.l2jserver.gameserver.templates.item.L2Weapon;
+import com.l2jserver.util.Point3D;
 
 
 import javolution.util.FastList;
 import javolution.util.FastList;
 import javolution.util.FastMap;
 import javolution.util.FastMap;
@@ -51,7 +52,6 @@ import javolution.util.FastMap;
  */
  */
 public class L2AirShipInstance extends L2Character
 public class L2AirShipInstance extends L2Character
 {
 {
-	public float boatSpeed;
 	protected final FastList<L2PcInstance> _passengers = new FastList<L2PcInstance>();
 	protected final FastList<L2PcInstance> _passengers = new FastList<L2PcInstance>();
 	protected static final Logger _airShiplog = Logger.getLogger(L2AirShipInstance.class.getName());
 	protected static final Logger _airShiplog = Logger.getLogger(L2AirShipInstance.class.getName());
 	
 	
@@ -151,24 +151,13 @@ public class L2AirShipInstance extends L2Character
 			{
 			{
 				L2AirShipPoint bp = _path.get(state);
 				L2AirShipPoint bp = _path.get(state);
 				
 				
+				getStat().setMoveSpeed(bp.speed1);
+				getStat().setRotationSpeed(4000); // hardcoded for now
 				_boat._easi = new ExMoveToLocationAirShip(L2AirShipInstance.this,bp.x, bp.y, bp.z);
 				_boat._easi = new ExMoveToLocationAirShip(L2AirShipInstance.this,bp.x, bp.y, bp.z);
-				// _boat.getTemplate().baseRunSpd = bp.speed1;
-				boatSpeed = bp.speed1;
 				_boat.moveAirShipToLocation(bp.x, bp.y, bp.z, bp.speed1);
 				_boat.moveAirShipToLocation(bp.x, bp.y, bp.z, bp.speed1);
-				Collection<L2PcInstance> knownPlayers = _boat.getKnownList().getKnownPlayers().values();
 				if (bp.time == 0)
 				if (bp.time == 0)
-				{
 					bp.time = 1;
 					bp.time = 1;
-				}
-				if (knownPlayers == null || knownPlayers.isEmpty())
-					return bp.time;
-				//synchronized (_boat.getKnownList().getKnownPlayers())
-				{
-					for (L2PcInstance player : knownPlayers)
-					{
-						player.sendPacket(_boat._easi);
-					}
-				}
+				_boat.broadcastPacket(_boat._easi);
 				return bp.time;
 				return bp.time;
 			}
 			}
 			else
 			else
@@ -195,9 +184,21 @@ public class L2AirShipInstance extends L2Character
 	@Override
 	@Override
     public void initKnownList()
     public void initKnownList()
     {
     {
-		setKnownList(new AirShipKnownList(this));
+		setKnownList(new VehicleKnownList(this));
     }
     }
-	
+
+	@Override
+	public VehicleStat getStat()
+	{
+		return (VehicleStat)super.getStat();
+	}
+
+	@Override
+	public void initCharStat()
+	{
+		setStat(new VehicleStat(this));
+	}
+
 	/**
 	/**
 	 * @param x
 	 * @param x
 	 * @param y
 	 * @param y
@@ -251,6 +252,7 @@ public class L2AirShipInstance extends L2Character
 		m._zDestination = z; // this is what was requested from client
 		m._zDestination = z; // this is what was requested from client
 		m._heading = 0; // initial value for coordinate sync
 		m._heading = 0; // initial value for coordinate sync
 		m.onGeodataPathIndex = -1; // Initialize not on geodata path
 		m.onGeodataPathIndex = -1; // Initialize not on geodata path
+		m.disregardingGeodata = true;
 		m._moveStartTime = GameTimeController.getGameTicks();
 		m._moveStartTime = GameTimeController.getGameTicks();
 		
 		
 		if (Config.DEBUG)
 		if (Config.DEBUG)
@@ -427,7 +429,7 @@ public class L2AirShipInstance extends L2Character
 	public void updatePeopleInTheAirShip(int x, int y, int z)
 	public void updatePeopleInTheAirShip(int x, int y, int z)
 	{
 	{
 		
 		
-		if (_passengers != null && !_passengers.isEmpty())
+		if (!_passengers.isEmpty())
 		{
 		{
 			if ((lastx == -1) || (lasty == -1))
 			if ((lastx == -1) || (lasty == -1))
 			{
 			{
@@ -479,14 +481,9 @@ public class L2AirShipInstance extends L2Character
 	
 	
 	public void spawn()
 	public void spawn()
 	{
 	{
-		Collection<L2PcInstance> knownPlayers = getKnownList().getKnownPlayers().values();
 		_cycle = 0;
 		_cycle = 0;
 		beginCycle();
 		beginCycle();
-		if (knownPlayers == null || knownPlayers.isEmpty())
-			return;
-		ExAirShipInfo easi = new ExAirShipInfo(this);
-		for (L2PcInstance player : knownPlayers)
-			player.sendPacket(easi);
+		broadcastPacket(new ExAirShipInfo(this));
 	}
 	}
 	
 	
 	/**
 	/**
@@ -527,13 +524,16 @@ public class L2AirShipInstance extends L2Character
 			
 			
 		_passengers.add(player);
 		_passengers.add(player);
 		player.setAirShip(this);
 		player.setAirShip(this);
+		player.setInVehiclePosition(new Point3D(0,0,0));
 		player.broadcastPacket(new ExGetOnAirShip(player, this));
 		player.broadcastPacket(new ExGetOnAirShip(player, this));
-		//player.sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.GENERALZONE));
+		player.getKnownList().removeAllKnownObjects();
+		player.setXYZ(getX(), getY(), getZ());
+		player.revalidateZone(true);
 	}
 	}
 
 
 	public void oustPlayer(L2PcInstance player)
 	public void oustPlayer(L2PcInstance player)
 	{
 	{
-		int x,y,z;
+		final int x,y,z;
 		if (_cycle == 1 || _cycle == 4)
 		if (_cycle == 1 || _cycle == 4)
 		{
 		{
 			x = -149379;
 			x = -149379;
@@ -546,22 +546,49 @@ public class L2AirShipInstance extends L2Character
 			y = 243590;
 			y = 243590;
 			z = 2608;			
 			z = 2608;			
 		}
 		}
-		_passengers.remove(player);
+		removePassenger(player);
 		player.setAirShip(null);
 		player.setAirShip(null);
-		player.broadcastPacket(new ExGetOffAirShip(player, this, x ,y ,z));
-		player.teleToLocation(x, y, z);
+		player.setInVehiclePosition(null);
+		if (player.isOnline() > 0)
+		{
+			player.broadcastPacket(new ExGetOffAirShip(player, this, x ,y ,z));
+			player.getKnownList().removeAllKnownObjects();
+			player.setXYZ(x, y, z);
+			player.revalidateZone(true);
+		}
+		else
+			player.setXYZInvisible(x, y, z); // disconnects handling
 	}
 	}
-	
+
+	public void removePassenger(L2PcInstance player)
+	{
+		try
+		{
+			_passengers.remove(player);
+		}
+		catch (Exception e)
+		{}
+	}
+
 	public void teleportAirShip(int x, int y, int z,int heading)
 	public void teleportAirShip(int x, int y, int z,int heading)
 	{
 	{
 		teleToLocation(x, y, z, heading, false);
 		teleToLocation(x, y, z, heading, false);
+		final ExStopMoveAirShip as = new ExStopMoveAirShip(this);
+		final ExAirShipInfo ai = new ExAirShipInfo(this);
+		final ExGetOnAirShip[] gas = new ExGetOnAirShip[_passengers.size()];
+		int i = 0;
+		for (L2PcInstance player : _passengers)
+			gas[i++] = (new ExGetOnAirShip(player, this));
+
 		for (L2PcInstance player : _passengers)
 		for (L2PcInstance player : _passengers)
 		{
 		{
-			if (player == null)
-				continue;
-			player.sendPacket(new ExStopMoveAirShip(this));
-			player.teleToLocation(x,y,z, heading,false);
-			player.sendPacket(new ExAirShipInfo(this));
+			player.sendPacket(as);
+			player.setXYZ(x, y, z);
+			player.sendPacket(ai);
+			for (ExGetOnAirShip packet : gas)
+				player.sendPacket(packet);
+
+			player.revalidateZone(true);
 		}
 		}
 	}
 	}
 	
 	
@@ -620,16 +647,6 @@ public class L2AirShipInstance extends L2Character
 		{}
 		{}
 	}
 	}
 	
 	
-	public int getSpeed1()
-	{
-		return (int)boatSpeed;
-	}
-	
-	public int getSpeed2()
-	{
-		return 4000;
-	}
-    
 	@Override
 	@Override
 	public void sendInfo(L2PcInstance activeChar)
 	public void sendInfo(L2PcInstance activeChar)
 	{
 	{

+ 118 - 155
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2BoatInstance.java

@@ -31,7 +31,8 @@ import com.l2jserver.gameserver.ThreadPoolManager;
 import com.l2jserver.gameserver.ai.L2CharacterAI;
 import com.l2jserver.gameserver.ai.L2CharacterAI;
 import com.l2jserver.gameserver.model.L2ItemInstance;
 import com.l2jserver.gameserver.model.L2ItemInstance;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Character;
-import com.l2jserver.gameserver.model.actor.knownlist.BoatKnownList;
+import com.l2jserver.gameserver.model.actor.knownlist.VehicleKnownList;
+import com.l2jserver.gameserver.model.actor.stat.VehicleStat;
 import com.l2jserver.gameserver.network.clientpackets.Say2;
 import com.l2jserver.gameserver.network.clientpackets.Say2;
 import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
 import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
 import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
 import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
@@ -44,6 +45,7 @@ import com.l2jserver.gameserver.templates.chars.L2CharTemplate;
 import com.l2jserver.gameserver.templates.item.L2Weapon;
 import com.l2jserver.gameserver.templates.item.L2Weapon;
 import com.l2jserver.gameserver.util.Util;
 import com.l2jserver.gameserver.util.Util;
 
 
+import javolution.util.FastList;
 import javolution.util.FastMap;
 import javolution.util.FastMap;
 
 
 /**
 /**
@@ -53,8 +55,7 @@ import javolution.util.FastMap;
 public class L2BoatInstance extends L2Character
 public class L2BoatInstance extends L2Character
 {
 {
 	protected static final Logger _logBoat = Logger.getLogger(L2BoatInstance.class.getName());
 	protected static final Logger _logBoat = Logger.getLogger(L2BoatInstance.class.getName());
-	
-	public float boatSpeed;
+	protected final FastList<L2PcInstance> _passengers = new FastList<L2PcInstance>();
 	
 	
 	private class L2BoatTrajet
 	private class L2BoatTrajet
 	{
 	{
@@ -215,24 +216,14 @@ public class L2BoatInstance extends L2Character
 				
 				
 				_boat.getPosition().setHeading(Util.calculateHeadingFrom(cos, sin));
 				_boat.getPosition().setHeading(Util.calculateHeadingFrom(cos, sin));
 				
 				
-				_boat._vd = new VehicleDeparture(_boat, bp.speed1, bp.speed2, bp.x, bp.y, bp.z);
-				// _boat.getTemplate().baseRunSpd = bp.speed1;
-				boatSpeed = bp.speed1;
+				getStat().setMoveSpeed(bp.speed1);
+				getStat().setRotationSpeed(bp.speed2);
 				_boat.moveToLocation(bp.x, bp.y, bp.z, (float) bp.speed1);
 				_boat.moveToLocation(bp.x, bp.y, bp.z, (float) bp.speed1);
-				Collection<L2PcInstance> knownPlayers = _boat.getKnownList().getKnownPlayers().values();
 				if (bp.time == 0)
 				if (bp.time == 0)
-				{
 					bp.time = 1;
 					bp.time = 1;
-				}
-				if (knownPlayers == null || knownPlayers.isEmpty())
-					return bp.time;
-				//synchronized (_boat.getKnownList().getKnownPlayers())
-				{
-					for (L2PcInstance player : knownPlayers)
-					{
-						player.sendPacket(_boat._vd);
-					}
-				}
+
+//				_boat.broadcastPacket(new VehicleInfo(_boat));
+				_boat.broadcastPacket(new VehicleDeparture(_boat));
 				return bp.time;
 				return bp.time;
 			}
 			}
 			else
 			else
@@ -251,10 +242,6 @@ public class L2BoatInstance extends L2Character
 	
 	
 	protected int _cycle = 0;
 	protected int _cycle = 0;
 	
 	
-	protected VehicleDeparture _vd = null;
-	
-	private Map<Integer, L2PcInstance> _inboat;
-	
 	public L2BoatInstance(int objectId, L2CharTemplate template, String name)
 	public L2BoatInstance(int objectId, L2CharTemplate template, String name)
 	{
 	{
 		super(objectId, template);
 		super(objectId, template);
@@ -270,9 +257,21 @@ public class L2BoatInstance extends L2Character
 	@Override
 	@Override
     public void initKnownList()
     public void initKnownList()
     {
     {
-		setKnownList(new BoatKnownList(this));
+		setKnownList(new VehicleKnownList(this));
     }
     }
 	
 	
+	@Override
+	public VehicleStat getStat()
+	{
+		return (VehicleStat)super.getStat();
+	}
+
+	@Override
+	public void initCharStat()
+	{
+		setStat(new VehicleStat(this));
+	}
+
 	/**
 	/**
 	 * @param x
 	 * @param x
 	 * @param y
 	 * @param y
@@ -325,6 +324,7 @@ public class L2BoatInstance extends L2Character
 		m._zDestination = z; // this is what was requested from client
 		m._zDestination = z; // this is what was requested from client
 		m._heading = 0; // initial value for coordinate sync
 		m._heading = 0; // initial value for coordinate sync
 		m.onGeodataPathIndex = -1; // Initialize not on geodata path
 		m.onGeodataPathIndex = -1; // Initialize not on geodata path
+		m.disregardingGeodata = true;
 		m._moveStartTime = GameTimeController.getGameTicks();
 		m._moveStartTime = GameTimeController.getGameTicks();
 		
 		
 		if (Config.DEBUG)
 		if (Config.DEBUG)
@@ -413,7 +413,6 @@ public class L2BoatInstance extends L2Character
 		
 		
 		public void run()
 		public void run()
 		{
 		{
-			_boat._vd = null;
 			_boat.needOnVehicleCheckLocation = false;
 			_boat.needOnVehicleCheckLocation = false;
 			if (_boat._cycle == 1)
 			if (_boat._cycle == 1)
 			{
 			{
@@ -430,7 +429,10 @@ public class L2BoatInstance extends L2Character
 					_boat._cycle = 2;
 					_boat._cycle = 2;
 					_boat.say(10);
 					_boat.say(10);
 					BoatCaptain bc = new BoatCaptain(1, _boat);
 					BoatCaptain bc = new BoatCaptain(1, _boat);
-					ThreadPoolManager.getInstance().scheduleGeneral(bc, 300000);
+					if (getId() == 5)
+						ThreadPoolManager.getInstance().scheduleGeneral(bc, 180000);
+					else
+						ThreadPoolManager.getInstance().scheduleGeneral(bc, 300000);
 				}
 				}
 				else
 				else
 				{
 				{
@@ -453,7 +455,10 @@ public class L2BoatInstance extends L2Character
 					_boat._cycle = 1;
 					_boat._cycle = 1;
 					_boat.say(10);
 					_boat.say(10);
 					BoatCaptain bc = new BoatCaptain(1, _boat);
 					BoatCaptain bc = new BoatCaptain(1, _boat);
-					ThreadPoolManager.getInstance().scheduleGeneral(bc, 300000);
+					if (getId() == 5)
+						ThreadPoolManager.getInstance().scheduleGeneral(bc, 180000);
+					else
+						ThreadPoolManager.getInstance().scheduleGeneral(bc, 300000);
 				}
 				}
 				else
 				else
 				{
 				{
@@ -490,22 +495,6 @@ public class L2BoatInstance extends L2Character
 		return _id;
 		return _id;
 	}
 	}
 	
 	
-	/**
-	 * @param activeChar
-	 */
-	public void sendVehicleDeparture(L2PcInstance activeChar)
-	{
-		if (_vd != null)
-		{
-			activeChar.sendPacket(_vd);
-		}
-	}
-	
-	public VehicleDeparture getVehicleDeparture()
-	{
-		return _vd;
-	}
-	
 	public void beginCycle()
 	public void beginCycle()
 	{
 	{
 		say(10);
 		say(10);
@@ -532,7 +521,7 @@ public class L2BoatInstance extends L2Character
 	public void updatePeopleInTheBoat(int x, int y, int z)
 	public void updatePeopleInTheBoat(int x, int y, int z)
 	{
 	{
 		
 		
-		if (_inboat != null)
+		if (!_passengers.isEmpty())
 		{
 		{
 			boolean check = false;
 			boolean check = false;
 			if ((lastx == -1) || (lasty == -1))
 			if ((lastx == -1) || (lasty == -1))
@@ -551,26 +540,22 @@ public class L2BoatInstance extends L2Character
 				lastx = x;
 				lastx = x;
 				lasty = y;
 				lasty = y;
 			}
 			}
-			for (int i = 0; i < _inboat.size(); i++)
+			VehicleCheckLocation vcl = null;
+			if (needOnVehicleCheckLocation == true)
+				vcl = new VehicleCheckLocation(this, x, y, z);
+
+			for (L2PcInstance player : _passengers)
 			{
 			{
-				L2PcInstance player = _inboat.get(i);
 				if (player != null && player.isInBoat())
 				if (player != null && player.isInBoat())
 				{
 				{
 					if (player.getBoat() == this)
 					if (player.getBoat() == this)
 					{
 					{
-						// player.getKnownList().addKnownObject(this);
 						player.getPosition().setXYZ(x, y, z);
 						player.getPosition().setXYZ(x, y, z);
 						player.revalidateZone(false);
 						player.revalidateZone(false);
 					}
 					}
 				}
 				}
-				if (check == true)
-				{
-					if (needOnVehicleCheckLocation == true)
-					{
-						VehicleCheckLocation vcl = new VehicleCheckLocation(this, x, y, z);
-						player.sendPacket(vcl);
-					}
-				}
+				if (check == true && vcl != null)
+					player.sendPacket(vcl);
 			}
 			}
 		}
 		}
 		
 		
@@ -581,101 +566,93 @@ public class L2BoatInstance extends L2Character
 	 */
 	 */
 	public void begin()
 	public void begin()
 	{
 	{
-		if (_cycle == 1)
+		_passengers.clear();
+		final Collection<L2PcInstance> knownPlayers = getKnownList().getKnownPlayersInRadius(1000);
+		if (knownPlayers != null && !knownPlayers.isEmpty())
 		{
 		{
-			Collection<L2PcInstance> knownPlayers = getKnownList().getKnownPlayers().values();
-			if (knownPlayers != null && !knownPlayers.isEmpty())
+			//synchronized (getKnownList().getKnownPlayers())
 			{
 			{
-				_inboat = new FastMap<Integer, L2PcInstance>();
-				int i = 0;
-				//synchronized (getKnownList().getKnownPlayers())
+				for (L2PcInstance player : knownPlayers)
 				{
 				{
-					for (L2PcInstance player : knownPlayers)
-					{
-						if (player.isInBoat() && player.getBoat() == this)
-						{
-							L2ItemInstance it;
-							it = player.getInventory().getItemByItemId(_t1.idWTicket1);
-							if ((it != null) && (it.getCount() >= 1))
-							{
-								player.getInventory().destroyItem("Boat", it.getObjectId(), 1, player, this);
-								InventoryUpdate iu = new InventoryUpdate();
-								iu.addModifiedItem(it);
-								player.sendPacket(iu);
-								player.sendPacket(new VehicleStarted(this, 1));
-								_inboat.put(i, player);
-								i++;
-							}
-							else if (it == null && _t1.idWTicket1 == 0)
-							{
-								_inboat.put(i, player);
-								player.sendPacket(new VehicleStarted(this, 1));
-								i++;
-							}
-							else
-							{
-								player.teleToLocation(_t1.ntx1, _t1.nty1, _t1.ntz1, false);
-							}
-						}
-					}
+					if (player.isInBoat() && player.getBoat() == this)
+						addPassenger(player);
 				}
 				}
 			}
 			}
-			Boatrun bc = new Boatrun(0, this);
-			ThreadPoolManager.getInstance().scheduleGeneral(bc, 0);
 		}
 		}
-		else if (_cycle == 2)
+		ThreadPoolManager.getInstance().scheduleGeneral(new Boatrun(0, this), 0);
+		broadcastPacket(new VehicleStarted(this, 1));
+	}
+
+	private void addPassenger(L2PcInstance player)
+	{
+		final int itemId;
+		if (_cycle == 1)
+			itemId = _t1.idWTicket1;
+		else
+			itemId = _t2.idWTicket1;
+
+		if (itemId != 0)
 		{
 		{
-			Collection<L2PcInstance> knownPlayers = getKnownList().getKnownPlayers().values();
-			if (knownPlayers != null && !knownPlayers.isEmpty())
+			final L2ItemInstance it = player.getInventory().getItemByItemId(itemId);
+			if ((it != null) && (it.getCount() >= 1))
 			{
 			{
-				_inboat = new FastMap<Integer, L2PcInstance>();
-				int i = 0;
-				//synchronized (getKnownList().getKnownPlayers())
-				{
-					for (L2PcInstance player : knownPlayers)
-					{
-						if (player.isInBoat() && player.getBoat() == this)
-						{
-							L2ItemInstance it;
-							it = player.getInventory().getItemByItemId(_t2.idWTicket1);
-							if ((it != null) && (it.getCount() >= 1))
-							{
-								
-								player.getInventory().destroyItem("Boat", it.getObjectId(), 1, player, this);
-								InventoryUpdate iu = new InventoryUpdate();
-								iu.addModifiedItem(it);
-								player.sendPacket(iu);
-								player.sendPacket(new VehicleStarted(this, 1));
-								_inboat.put(i, player);
-								i++;
-							}
-							else if (it == null && _t2.idWTicket1 == 0)
-							{
-								_inboat.put(i, player);
-								player.sendPacket(new VehicleStarted(this, 1));
-								i++;
-							}
-							else
-							{
-								player.teleToLocation(_t2.ntx1, _t2.nty1, _t2.ntz1, false);
-							}
-						}
-					}
-				}
-				
+				player.getInventory().destroyItem("Boat", it, 1, player, this);
+				InventoryUpdate iu = new InventoryUpdate();
+				iu.addModifiedItem(it);
+				player.sendPacket(iu);
+			}
+			else
+			{
+				oustPlayer(player);
+				return;
 			}
 			}
-			Boatrun bc = new Boatrun(0, this);
-			ThreadPoolManager.getInstance().scheduleGeneral(bc, 0);
 		}
 		}
+		_passengers.add(player);
 	}
 	}
-	
+
+	public void oustPlayer(L2PcInstance player)
+	{
+		final int x, y, z;
+		if (_cycle == 1)
+		{
+			x = _t1.ntx1;
+			y = _t1.nty1;
+			z = _t1.ntz1;
+		}
+		else
+		{
+			x = _t2.ntx1;
+			y = _t2.nty1;
+			z = _t2.ntz1;
+		}
+
+		removePassenger(player);
+
+		if (player.isOnline() > 0)
+			player.teleToLocation(x, y, z);
+		else
+			player.setXYZInvisible(x, y, z); // disconnects handling
+	}
+
+	public void removePassenger(L2PcInstance player)
+	{
+		try
+		{
+			_passengers.remove(player);
+		}
+		catch (Exception e)
+		{}
+	}
+
 	/**
 	/**
 	 * @param i
 	 * @param i
 	 */
 	 */
 	public void say(int i)
 	public void say(int i)
 	{
 	{
-		
-		Collection<L2PcInstance> knownPlayers = getKnownList().getKnownPlayers().values();
+		final Collection<L2PcInstance> knownPlayers = getKnownList().getKnownPlayers().values();
+		if (knownPlayers == null || knownPlayers.isEmpty())
+			return;
+
 		CreatureSay sm;
 		CreatureSay sm;
 		CreatureSay sm2 = null;
 		CreatureSay sm2 = null;
 		PlaySound ps;
 		PlaySound ps;
@@ -695,13 +672,14 @@ public class L2BoatInstance extends L2Character
 						sm2 = new CreatureSay(0, Say2.SHOUT, _t2.npc1, _t2.sysmess5_1);
 						sm2 = new CreatureSay(0, Say2.SHOUT, _t2.npc1, _t2.sysmess5_1);
 				}
 				}
 				ps = new PlaySound(0, "itemsound.ship_arrival_departure", 1, getObjectId(), getX(), getY(), getZ());
 				ps = new PlaySound(0, "itemsound.ship_arrival_departure", 1, getObjectId(), getX(), getY(), getZ());
-				if (knownPlayers == null || knownPlayers.isEmpty())
-					return;
+				VehicleStarted vs = new VehicleStarted(this, 0);
+				VehicleInfo vi = new VehicleInfo(this);
 				for (L2PcInstance player : knownPlayers)
 				for (L2PcInstance player : knownPlayers)
 				{
 				{
 					player.sendPacket(sm);
 					player.sendPacket(sm);
 					player.sendPacket(ps);
 					player.sendPacket(ps);
-					player.sendPacket(new VehicleStarted(this, 0));
+					player.sendPacket(vs);
+					player.sendPacket(vi);
 					if (sm2 != null)
 					if (sm2 != null)
 						player.sendPacket(sm2);
 						player.sendPacket(sm2);
 				}
 				}
@@ -716,8 +694,6 @@ public class L2BoatInstance extends L2Character
 					sm = new CreatureSay(0, Say2.SHOUT, _t2.npc1, _t2.sysmess5_1);
 					sm = new CreatureSay(0, Say2.SHOUT, _t2.npc1, _t2.sysmess5_1);
 				}
 				}
 				ps = new PlaySound(0, "itemsound.ship_5min", 1, getObjectId(), getX(), getY(), getZ());
 				ps = new PlaySound(0, "itemsound.ship_5min", 1, getObjectId(), getX(), getY(), getZ());
-				if (knownPlayers == null || knownPlayers.isEmpty())
-					return;
 				for (L2PcInstance player : knownPlayers)
 				for (L2PcInstance player : knownPlayers)
 				{
 				{
 					player.sendPacket(sm);
 					player.sendPacket(sm);
@@ -735,8 +711,6 @@ public class L2BoatInstance extends L2Character
 					sm = new CreatureSay(0, Say2.SHOUT, _t2.npc1, _t2.sysmess1_1);
 					sm = new CreatureSay(0, Say2.SHOUT, _t2.npc1, _t2.sysmess1_1);
 				}
 				}
 				ps = new PlaySound(0, "itemsound.ship_1min", 1, getObjectId(), getX(), getY(), getZ());
 				ps = new PlaySound(0, "itemsound.ship_1min", 1, getObjectId(), getX(), getY(), getZ());
-				if (knownPlayers == null || knownPlayers.isEmpty())
-					return;
 				for (L2PcInstance player : knownPlayers)
 				for (L2PcInstance player : knownPlayers)
 				{
 				{
 					player.sendPacket(sm);
 					player.sendPacket(sm);
@@ -753,12 +727,9 @@ public class L2BoatInstance extends L2Character
 				{
 				{
 					sm = new CreatureSay(0, Say2.SHOUT, _t2.npc1, _t2.sysmess0_1);
 					sm = new CreatureSay(0, Say2.SHOUT, _t2.npc1, _t2.sysmess0_1);
 				}
 				}
-				if (knownPlayers == null || knownPlayers.isEmpty())
-					return;
 				for (L2PcInstance player : knownPlayers)
 				for (L2PcInstance player : knownPlayers)
 				{
 				{
 					player.sendPacket(sm);
 					player.sendPacket(sm);
-					// player.sendPacket(ps);
 				}
 				}
 				break;
 				break;
 			case -1:
 			case -1:
@@ -785,14 +756,9 @@ public class L2BoatInstance extends L2Character
 	 */
 	 */
 	public void spawn()
 	public void spawn()
 	{
 	{
-		Collection<L2PcInstance> knownPlayers = getKnownList().getKnownPlayers().values();
 		_cycle = 1;
 		_cycle = 1;
 		beginCycle();
 		beginCycle();
-		if (knownPlayers == null || knownPlayers.isEmpty())
-			return;
-		VehicleInfo vi = new VehicleInfo(this);
-		for (L2PcInstance player : knownPlayers)
-			player.sendPacket(vi);
+		broadcastPacket(new VehicleInfo(this));
 	}
 	}
 	
 	
 	/**
 	/**
@@ -892,11 +858,8 @@ public class L2BoatInstance extends L2Character
     @Override
     @Override
     public void sendInfo(L2PcInstance activeChar)
     public void sendInfo(L2PcInstance activeChar)
     {
     {
-    	if(!activeChar.isInBoat())
-        if(this != activeChar.getBoat())
-        {
-        	activeChar.sendPacket(new VehicleInfo(this));
-        	this.sendVehicleDeparture(activeChar);
-        }
+    	activeChar.sendPacket(new VehicleInfo(this));
+    	if (isMoving())
+    		sendPacket(new VehicleDeparture(this));
     }
     }
 }
 }

+ 30 - 83
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -492,15 +492,10 @@ public final class L2PcInstance extends L2Playable
     private int _duelId = 0;
     private int _duelId = 0;
     private SystemMessageId _noDuelReason = SystemMessageId.THERE_IS_NO_OPPONENT_TO_RECEIVE_YOUR_CHALLENGE_FOR_A_DUEL;
     private SystemMessageId _noDuelReason = SystemMessageId.THERE_IS_NO_OPPONENT_TO_RECEIVE_YOUR_CHALLENGE_FOR_A_DUEL;
 
 
-	/** Boat */
-	private boolean _inBoat;
-    private L2BoatInstance _boat;
-    private Point3D _inBoatPosition;
-    
-    /** AirShip */
-    private L2AirShipInstance _airShip;
-	private boolean _inAirShip;
-	private Point3D _inAirShipPosition;
+	/** Boat and AirShip */
+    private L2BoatInstance _boat = null;
+    private L2AirShipInstance _airShip = null;
+    private Point3D _inVehiclePosition;
 
 
 	public ScheduledFuture<?> _taskforfish;
 	public ScheduledFuture<?> _taskforfish;
 	private int _mountType;
 	private int _mountType;
@@ -11173,6 +11168,17 @@ public final class L2PcInstance extends L2Playable
 		return _expertiseIndex;
 		return _expertiseIndex;
 	}
 	}
 
 
+	@Override
+	public void teleToLocation(int x, int y, int z, int heading, boolean allowRandomOffset)
+	{
+		if (isInBoat())
+			setBoat(null);
+		if (isInAirShip())
+			setAirShip(null);
+
+		super.teleToLocation(x, y, z, heading, allowRandomOffset);
+	}
+
 	@Override
 	@Override
 	public final void onTeleported()
 	public final void onTeleported()
 	{
 	{
@@ -11493,15 +11499,7 @@ public final class L2PcInstance extends L2Playable
 	 */
 	 */
 	public boolean isInBoat()
 	public boolean isInBoat()
 	{
 	{
-		return _inBoat;
-	}
-
-	/**
-	 * @param inBoat The inBoat to set.
-	 */
-	public void setInBoat(boolean inBoat)
-	{
-		_inBoat = inBoat;
+		return _boat != null;
 	}
 	}
 
 
 	/**
 	/**
@@ -11517,6 +11515,9 @@ public final class L2PcInstance extends L2Playable
 	 */
 	 */
 	public void setBoat(L2BoatInstance boat)
 	public void setBoat(L2BoatInstance boat)
 	{
 	{
+		if (boat == null && _boat != null)
+			_boat.removePassenger(this);
+
 		_boat = boat;
 		_boat = boat;
 	}
 	}
 
 
@@ -11525,15 +11526,7 @@ public final class L2PcInstance extends L2Playable
 	 */
 	 */
 	public boolean isInAirShip()
 	public boolean isInAirShip()
 	{
 	{
-		return _inAirShip;
-	}
-
-	/**
-	 * @param inAirShip The inAirShip to set.
-	 */
-	public void setInAirShip(boolean inAirShip)
-	{
-		_inAirShip = inAirShip;
+		return _airShip != null;
 	}
 	}
 
 
 	/**
 	/**
@@ -11549,10 +11542,9 @@ public final class L2PcInstance extends L2Playable
 	 */
 	 */
 	public void setAirShip(L2AirShipInstance airShip)
 	public void setAirShip(L2AirShipInstance airShip)
 	{
 	{
-		if (airShip != null)
-			setInAirShip(true);
-		else
-			setInAirShip(false);
+		if (airShip == null && _airShip != null)
+			_airShip.removePassenger(this);
+
 		_airShip = airShip;
 		_airShip = airShip;
 	}
 	}
 	
 	
@@ -11569,27 +11561,14 @@ public final class L2PcInstance extends L2Playable
 	/**
 	/**
 	 * @return
 	 * @return
 	 */
 	 */
-	public Point3D getInBoatPosition()
-	{
-		return _inBoatPosition;
-	}
-
-	public void setInBoatPosition(Point3D pt)
-	{
-		_inBoatPosition = pt;
-	}
-
-	/**
-	 * @return
-	 */
-	public Point3D getInAirShipPosition()
+	public Point3D getInVehiclePosition()
 	{
 	{
-		return _inAirShipPosition;
+		return _inVehiclePosition;
 	}
 	}
 
 
-	public void setInAirShipPosition(Point3D pt)
+	public void setInVehiclePosition(Point3D pt)
 	{
 	{
-		_inAirShipPosition = pt;
+		_inVehiclePosition = pt;
 	}
 	}
 
 
 	/**
 	/**
@@ -11870,6 +11849,8 @@ public final class L2PcInstance extends L2Playable
 				setXYZInvisible(_obsX, _obsY, _obsZ);
 				setXYZInvisible(_obsX, _obsY, _obsZ);
 			else if (isInAirShip())
 			else if (isInAirShip())
 				getAirShip().oustPlayer(this);
 				getAirShip().oustPlayer(this);
+			else if (isInBoat())
+				getBoat().oustPlayer(this);
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
@@ -14367,41 +14348,7 @@ public final class L2PcInstance extends L2Playable
         		if (activeChar.getPet() != null)
         		if (activeChar.getPet() != null)
         			sendPacket(new RelationChanged(activeChar.getPet(), relation2, isAutoAttackable(activeChar)));
         			sendPacket(new RelationChanged(activeChar.getPet(), relation2, isAutoAttackable(activeChar)));
         	}
         	}
-        	activeChar.sendPacket(new GetOnVehicle(this, getBoat(), getInBoatPosition().getX(), getInBoatPosition().getY(), getInBoatPosition().getZ()));
-        	/*if(getBoat().GetVehicleDeparture() == null)
-        	{
-
-        		int xboat = getBoat().getX();
-        		int yboat= getBoat().getY();
-        		double modifier = Math.PI/2;
-        		if (yboat == 0)
-        		{
-        			yboat = 1;
-        		}
-        		if(yboat < 0)
-        		{
-        			modifier = -modifier;
-        		}
-        		double angleboat = modifier - Math.atan(xboat/yboat);
-        		int xp = getX();
-        		int yp = getY();
-        		modifier = Math.PI/2;
-        		if (yp == 0)
-        		{
-        			yboat = 1;
-        		}
-        		if(yboat < 0)
-        		{
-        			modifier = -modifier;
-        		}
-        		double anglep = modifier - Math.atan(yp/xp);
-
-        		double finx = Math.cos(anglep - angleboat)*Math.sqrt(xp *xp +yp*yp ) + Math.cos(angleboat)*Math.sqrt(xboat *xboat +yboat*yboat );
-        		double finy = Math.sin(anglep - angleboat)*Math.sqrt(xp *xp +yp*yp ) + Math.sin(angleboat)*Math.sqrt(xboat *xboat +yboat*yboat );
-        		//getPosition().setWorldPosition(getBoat().getX() - getInBoatPosition().x,getBoat().getY() - getInBoatPosition().y,getBoat().getZ()- getInBoatPosition().z);
-        		getPosition().setWorldPosition((int)finx,(int)finy,getBoat().getZ()- getInBoatPosition().z);
-
-        	}*/
+        	activeChar.sendPacket(new GetOnVehicle(getObjectId(), getBoat().getObjectId(), getInVehiclePosition()));
         }
         }
         else if(isInAirShip())
         else if(isInAirShip())
         {
         {

+ 0 - 49
L2_GameServer/java/com/l2jserver/gameserver/model/actor/knownlist/AirShipKnownList.java

@@ -1,49 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- * 
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.l2jserver.gameserver.model.actor.knownlist;
-
-import com.l2jserver.gameserver.model.L2Object;
-import com.l2jserver.gameserver.model.actor.L2Character;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-
-/**
- * @author Kerberos
- *
- */
-public class AirShipKnownList extends CharKnownList
-{
-	public AirShipKnownList(L2Character activeChar)
-	{
-		super(activeChar);
-	}
-
-	@Override
-	public int getDistanceToForgetObject(L2Object object)
-    {
-        if (!(object instanceof L2PcInstance))
-            return 0;
-
-        return 8000;
-    }
-
-    @Override
-	public int getDistanceToWatchObject(L2Object object)
-    {
-        if (!(object instanceof L2PcInstance))
-            return 0;
-
-        return 4000;
-    }
-}

+ 9 - 3
L2_GameServer/java/com/l2jserver/gameserver/model/actor/knownlist/PcKnownList.java

@@ -121,8 +121,11 @@ public class PcKnownList extends PlayableKnownList
     @Override
     @Override
 	public int getDistanceToForgetObject(L2Object object)
 	public int getDistanceToForgetObject(L2Object object)
     {
     {
-    	if (object instanceof L2BoatInstance || object instanceof L2AirShipInstance)
-    		return 8000;
+    	if (object instanceof L2BoatInstance)
+    		return 5000;
+
+    	if (object instanceof L2AirShipInstance)
+    		return 12000;
 
 
     	// when knownlist grows, the distance to forget should be at least
     	// when knownlist grows, the distance to forget should be at least
     	// the same as the previous watch range, or it becomes possible that
     	// the same as the previous watch range, or it becomes possible that
@@ -137,9 +140,12 @@ public class PcKnownList extends PlayableKnownList
     @Override
     @Override
 	public int getDistanceToWatchObject(L2Object object)
 	public int getDistanceToWatchObject(L2Object object)
     {
     {
-    	if (object instanceof L2BoatInstance || object instanceof L2AirShipInstance)
+    	if (object instanceof L2BoatInstance)
     		return 4000;
     		return 4000;
 
 
+    	if (object instanceof L2AirShipInstance)
+    		return 10000;
+
     	final int knownlistSize = getKnownObjects().size();
     	final int knownlistSize = getKnownObjects().size();
         if (knownlistSize <= 25) return 3400; // empty field
         if (knownlistSize <= 25) return 3400; // empty field
         if (knownlistSize <= 35) return 2900;
         if (knownlistSize <= 35) return 2900;

+ 4 - 8
L2_GameServer/java/com/l2jserver/gameserver/model/actor/knownlist/BoatKnownList.java → L2_GameServer/java/com/l2jserver/gameserver/model/actor/knownlist/VehicleKnownList.java

@@ -18,13 +18,9 @@ import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 
 
-/**
- * @author Maktakien
- *
- */
-public class BoatKnownList extends CharKnownList
+public class VehicleKnownList extends CharKnownList
 {
 {
-	public BoatKnownList(L2Character activeChar)
+	public VehicleKnownList(L2Character activeChar)
 	{
 	{
 		super(activeChar);
 		super(activeChar);
 	}
 	}
@@ -35,7 +31,7 @@ public class BoatKnownList extends CharKnownList
         if (!(object instanceof L2PcInstance))
         if (!(object instanceof L2PcInstance))
             return 0;
             return 0;
 
 
-        return 8000;
+        return object.getKnownList().getDistanceToForgetObject(getActiveObject());
     }
     }
 
 
     @Override
     @Override
@@ -44,6 +40,6 @@ public class BoatKnownList extends CharKnownList
         if (!(object instanceof L2PcInstance))
         if (!(object instanceof L2PcInstance))
             return 0;
             return 0;
 
 
-        return 4000;
+        return object.getKnownList().getDistanceToWatchObject(getActiveObject());
     }
     }
 }
 }

+ 1 - 1
L2_GameServer/java/com/l2jserver/gameserver/model/actor/stat/CharStat.java

@@ -428,7 +428,7 @@ public class CharStat
 	 * Return the RunSpeed (base+modifier) or WalkSpeed (base+modifier) of the
 	 * Return the RunSpeed (base+modifier) or WalkSpeed (base+modifier) of the
 	 * L2Character in function of the movement type.
 	 * L2Character in function of the movement type.
 	 */
 	 */
-	public final float getMoveSpeed()
+	public float getMoveSpeed()
 	{
 	{
     	if (_activeChar == null)
     	if (_activeChar == null)
     		return 1;
     		return 1;

+ 55 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/stat/VehicleStat.java

@@ -0,0 +1,55 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.actor.stat;
+
+import com.l2jserver.gameserver.model.actor.instance.L2AirShipInstance;
+import com.l2jserver.gameserver.model.actor.instance.L2BoatInstance;
+
+public class VehicleStat extends CharStat
+{
+	private float _moveSpeed = 0;
+	private int _rotationSpeed = 0;
+
+	public VehicleStat(L2BoatInstance activeChar)
+	{
+		super(activeChar);
+	}
+
+	public VehicleStat(L2AirShipInstance activeChar)
+	{
+		super(activeChar);
+	}
+
+	@Override
+	public final float getMoveSpeed()
+	{
+		return _moveSpeed;
+	}
+
+	public final void setMoveSpeed(float speed)
+	{
+		_moveSpeed = speed;
+	}
+
+	public final int getRotationSpeed()
+	{
+		return _rotationSpeed;
+	}
+
+	public final void setRotationSpeed(int speed)
+	{
+		_rotationSpeed = speed;
+	}
+}

+ 1 - 1
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/CannotMoveAnymoreInVehicle.java

@@ -52,7 +52,7 @@ public final class CannotMoveAnymoreInVehicle extends L2GameClientPacket
 		{
 		{
 			if(player.getBoat().getObjectId() == _boatId)
 			if(player.getBoat().getObjectId() == _boatId)
 			{
 			{
-				player.setInBoatPosition(new Point3D(_x,_y,_z));
+				player.setInVehiclePosition(new Point3D(_x,_y,_z));
 				player.getPosition().setHeading(_heading);
 				player.getPosition().setHeading(_heading);
 				StopMoveInVehicle msg = new StopMoveInVehicle(player,_boatId);
 				StopMoveInVehicle msg = new StopMoveInVehicle(player,_boatId);
 				player.broadcastPacket(msg);
 				player.broadcastPacket(msg);

+ 1 - 5
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/MoveBackwardToLocation.java

@@ -98,11 +98,7 @@ public class MoveBackwardToLocation extends L2GameClientPacket
 		_curX = activeChar.getX();
 		_curX = activeChar.getX();
 		_curY = activeChar.getY();
 		_curY = activeChar.getY();
 		_curZ = activeChar.getZ();
 		_curZ = activeChar.getZ();
-		
-		if (activeChar.isInBoat())
-		{
-			activeChar.setInBoat(false);
-		}
+
 		if (activeChar.getTeleMode() > 0)
 		if (activeChar.getTeleMode() > 0)
 		{
 		{
 			if (activeChar.getTeleMode() == 1)
 			if (activeChar.getTeleMode() == 1)

+ 34 - 12
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/MoveToLocationInAirShip.java

@@ -15,16 +15,14 @@
 package com.l2jserver.gameserver.network.clientpackets;
 package com.l2jserver.gameserver.network.clientpackets;
 
 
 import com.l2jserver.gameserver.TaskPriority;
 import com.l2jserver.gameserver.TaskPriority;
-import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.instancemanager.AirShipManager;
 import com.l2jserver.gameserver.instancemanager.AirShipManager;
-import com.l2jserver.gameserver.model.L2CharPosition;
 import com.l2jserver.gameserver.model.actor.instance.L2AirShipInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2AirShipInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
 import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
+import com.l2jserver.gameserver.network.serverpackets.ExMoveToLocationInAirShip;
 import com.l2jserver.gameserver.templates.item.L2WeaponType;
 import com.l2jserver.gameserver.templates.item.L2WeaponType;
 import com.l2jserver.util.Point3D;
 import com.l2jserver.util.Point3D;
 
 
-
 /**
 /**
  * format: ddddddd
  * format: ddddddd
  * X:%d Y:%d Z:%d OriginX:%d OriginY:%d OriginZ:%d
  * X:%d Y:%d Z:%d OriginX:%d OriginY:%d OriginZ:%d
@@ -37,7 +35,7 @@ public class MoveToLocationInAirShip extends L2GameClientPacket
 	private int _shipId;
 	private int _shipId;
 	private final Point3D _pos = new Point3D(0,0,0);
 	private final Point3D _pos = new Point3D(0,0,0);
 	private final Point3D _origin_pos = new Point3D(0,0,0);
 	private final Point3D _origin_pos = new Point3D(0,0,0);
-	
+
 	public TaskPriority getPriority() { return TaskPriority.PR_HIGH; }
 	public TaskPriority getPriority() { return TaskPriority.PR_HIGH; }
 
 
 	@Override
 	@Override
@@ -59,23 +57,47 @@ public class MoveToLocationInAirShip extends L2GameClientPacket
 	@Override
 	@Override
 	protected void runImpl()
 	protected void runImpl()
 	{
 	{
-		L2PcInstance activeChar = getClient().getActiveChar();
+		final L2PcInstance activeChar = getClient().getActiveChar();
 		if (activeChar == null)
 		if (activeChar == null)
 			return;
 			return;
-		else if (activeChar.isAttackingNow() && activeChar.getActiveWeaponItem() != null && (activeChar.getActiveWeaponItem().getItemType() == L2WeaponType.BOW))
+
+		if (activeChar.isAttackingNow()
+				&& activeChar.getActiveWeaponItem() != null
+				&& (activeChar.getActiveWeaponItem().getItemType() == L2WeaponType.BOW))
+		{
+			activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+			return;
+		}
+
+		if (activeChar.isSitting() || activeChar.isMovementDisabled())
 		{
 		{
 			activeChar.sendPacket(ActionFailed.STATIC_PACKET);
 			activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+			return;
+		}
+
+		final L2AirShipInstance airShip;
+		if (activeChar.isInAirShip())
+		{
+			airShip = activeChar.getAirShip();
+			if (airShip.getObjectId() != _shipId)
+			{
+				activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+				return;
+			}
 		}
 		}
 		else
 		else
 		{
 		{
-			L2AirShipInstance airShip = AirShipManager.getInstance().getAirShip();
-			if (airShip == null || airShip.getObjectId() != _shipId)
+			airShip = AirShipManager.getInstance().getAirShip();
+			if (airShip == null)
+			{
+				activeChar.sendPacket(ActionFailed.STATIC_PACKET);
 				return;
 				return;
-			activeChar.setAirShip(airShip);
-			activeChar.setInAirShip(true);
-			activeChar.setInAirShipPosition(_pos);
-			activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO_IN_AIR_SHIP, new L2CharPosition(_pos.getX(),_pos.getY(), _pos.getZ(), 0), new L2CharPosition(_origin_pos.getX(),_origin_pos.getY(),_origin_pos.getZ(), 0));
+			}
 		}
 		}
+
+		activeChar.setAirShip(airShip);
+		activeChar.setInVehiclePosition(_pos);
+		activeChar.broadcastPacket(new ExMoveToLocationInAirShip(activeChar));
 	}
 	}
 
 
 	/* (non-Javadoc)
 	/* (non-Javadoc)

+ 24 - 12
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/RequestGetOffVehicle.java

@@ -14,42 +14,54 @@
  */
  */
 package com.l2jserver.gameserver.network.clientpackets;
 package com.l2jserver.gameserver.network.clientpackets;
 
 
-import com.l2jserver.gameserver.instancemanager.BoatManager;
-import com.l2jserver.gameserver.model.actor.instance.L2BoatInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
 import com.l2jserver.gameserver.network.serverpackets.GetOffVehicle;
 import com.l2jserver.gameserver.network.serverpackets.GetOffVehicle;
+import com.l2jserver.gameserver.network.serverpackets.StopMoveInVehicle;
 
 
 /**
 /**
  * @author Maktakien
  * @author Maktakien
  */
  */
 public final class RequestGetOffVehicle extends L2GameClientPacket
 public final class RequestGetOffVehicle extends L2GameClientPacket
 {
 {
-	private int _id, _x, _y, _z;
-	
+	private int _boatId, _x, _y, _z;
+
 	@Override
 	@Override
 	protected void readImpl()
 	protected void readImpl()
 	{
 	{
-		_id = readD();
+		_boatId = readD();
 		_x = readD();
 		_x = readD();
 		_y = readD();
 		_y = readD();
 		_z = readD();
 		_z = readD();
 	}
 	}
-	
+
 	@Override
 	@Override
 	protected void runImpl()
 	protected void runImpl()
 	{
 	{
-		L2PcInstance activeChar = getClient().getActiveChar();
+		final L2PcInstance activeChar = getClient().getActiveChar();
 		if (activeChar == null)
 		if (activeChar == null)
 			return;
 			return;
-		L2BoatInstance boat = BoatManager.getInstance().getBoat(_id);
-		GetOffVehicle Gon = new GetOffVehicle(activeChar, boat, _x, _y, _z);
-		activeChar.broadcastPacket(Gon);
+		if (!activeChar.isInBoat()
+				|| activeChar.getBoat().getObjectId() != _boatId
+				|| activeChar.getBoat().isMoving()
+				|| !activeChar.isInsideRadius(_x, _y, _z, 1000, true, false))
+		{
+			sendPacket(ActionFailed.STATIC_PACKET);	
+			return;
+		}
+
+		activeChar.broadcastPacket(new StopMoveInVehicle(activeChar, _boatId));
+		activeChar.setBoat(null);
+		activeChar.setInVehiclePosition(null);
+		sendPacket(ActionFailed.STATIC_PACKET);	
+		activeChar.broadcastPacket(new GetOffVehicle(activeChar.getObjectId(), _boatId, _x, _y, _z));
+		activeChar.setXYZ(_x, _y, _z + 50);
+		activeChar.revalidateZone(true);
 	}
 	}
-	
+
 	@Override
 	@Override
 	public String getType()
 	public String getType()
 	{
 	{
 		return "[S] 5d GetOffVehicle";
 		return "[S] 5d GetOffVehicle";
 	}
 	}
-	
 }
 }

+ 52 - 28
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/RequestGetOnVehicle.java

@@ -17,6 +17,7 @@ package com.l2jserver.gameserver.network.clientpackets;
 import com.l2jserver.gameserver.instancemanager.BoatManager;
 import com.l2jserver.gameserver.instancemanager.BoatManager;
 import com.l2jserver.gameserver.model.actor.instance.L2BoatInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2BoatInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
 import com.l2jserver.gameserver.network.serverpackets.GetOnVehicle;
 import com.l2jserver.gameserver.network.serverpackets.GetOnVehicle;
 import com.l2jserver.util.Point3D;
 import com.l2jserver.util.Point3D;
 
 
@@ -27,43 +28,66 @@ import com.l2jserver.util.Point3D;
  */
  */
 public final class RequestGetOnVehicle extends L2GameClientPacket
 public final class RequestGetOnVehicle extends L2GameClientPacket
 {
 {
-    private static final String _C__5C_GETONVEHICLE = "[C] 5C GetOnVehicle";
+	private static final String _C__5C_GETONVEHICLE = "[C] 5C GetOnVehicle";
 
 
-    private int _id, _x, _y, _z;
+	private int _boatId;
+	private Point3D _pos;
 
 
-    @Override
+	@Override
 	protected void readImpl()
 	protected void readImpl()
-    {
-        _id = readD();
-        _x = readD();
-        _y = readD();
-        _z = readD();
-    }
+	{
+		int x, y, z;
+		_boatId = readD();
+		x = readD();
+		y = readD();
+		z = readD();
+		_pos = new Point3D(x, y, z);
+	}
 
 
-    @Override
+	@Override
 	protected void runImpl()
 	protected void runImpl()
-    {
-        L2PcInstance activeChar = getClient().getActiveChar();
-        if (activeChar == null) return;
+	{
+		final L2PcInstance activeChar = getClient().getActiveChar();
+		if (activeChar == null)
+			return;
 
 
-        L2BoatInstance boat = BoatManager.getInstance().getBoat(_id);
-        if (boat == null) return;
+		L2BoatInstance boat;
+		if (activeChar.isInBoat())
+		{
+			boat = activeChar.getBoat();
+			if (boat.getObjectId() != _boatId)
+			{
+				sendPacket(ActionFailed.STATIC_PACKET);
+				return;
+			}
+		}
+		else
+		{
+			boat = BoatManager.getInstance().getBoat(_boatId);
+			if (boat == null
+					|| boat.isMoving()
+					|| !activeChar.isInsideRadius(boat, 1000, true, false))
+			{
+				sendPacket(ActionFailed.STATIC_PACKET);
+				return;
+			}
+		}
 
 
-        GetOnVehicle Gon = new GetOnVehicle(activeChar,boat,_x,_y,_z);
-        activeChar.setInBoatPosition(new Point3D(_x,_y,_z));
-        activeChar.getPosition().setXYZ(boat.getPosition().getX(),boat.getPosition().getY(),boat.getPosition().getZ());
-        activeChar.broadcastPacket(Gon);
-        activeChar.revalidateZone(true);
 
 
+		activeChar.setInVehiclePosition(_pos);
+		activeChar.setBoat(boat);
+		activeChar.broadcastPacket(new GetOnVehicle(activeChar.getObjectId(), boat.getObjectId(), _pos));
 
 
-    }
+		activeChar.setXYZ(boat.getX(), boat.getY(), boat.getZ());
+		activeChar.revalidateZone(true);
+	}
 
 
-    /* (non-Javadoc)
-     * @see com.l2jserver.gameserver.clientpackets.ClientBasePacket#getType()
-     */
-    @Override
+	/* (non-Javadoc)
+	 * @see com.l2jserver.gameserver.clientpackets.ClientBasePacket#getType()
+	 */
+	@Override
 	public String getType()
 	public String getType()
-    {
-        return _C__5C_GETONVEHICLE;
-    }
+	{
+		return _C__5C_GETONVEHICLE;
+	}
 }
 }

+ 52 - 14
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/RequestMoveToLocationInVehicle.java

@@ -15,12 +15,13 @@
 package com.l2jserver.gameserver.network.clientpackets;
 package com.l2jserver.gameserver.network.clientpackets;
 
 
 import com.l2jserver.gameserver.TaskPriority;
 import com.l2jserver.gameserver.TaskPriority;
-import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.instancemanager.BoatManager;
 import com.l2jserver.gameserver.instancemanager.BoatManager;
-import com.l2jserver.gameserver.model.L2CharPosition;
 import com.l2jserver.gameserver.model.actor.instance.L2BoatInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2BoatInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
 import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
+import com.l2jserver.gameserver.network.serverpackets.MoveToLocationInVehicle;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.templates.item.L2WeaponType;
 import com.l2jserver.gameserver.templates.item.L2WeaponType;
 import com.l2jserver.util.Point3D;
 import com.l2jserver.util.Point3D;
 
 
@@ -29,9 +30,9 @@ public final class RequestMoveToLocationInVehicle extends L2GameClientPacket
 {
 {
 	private static final String _C__75_MOVETOLOCATIONINVEHICLE = "[C] 75 RequestMoveToLocationInVehicle";
 	private static final String _C__75_MOVETOLOCATIONINVEHICLE = "[C] 75 RequestMoveToLocationInVehicle";
 
 
-	private final Point3D _pos = new Point3D(0,0,0);
-	private final Point3D _origin_pos = new Point3D(0,0,0);
 	private int _boatId;
 	private int _boatId;
+	private Point3D _pos;
+	private Point3D _origin_pos;
 
 
 	public TaskPriority getPriority() { return TaskPriority.PR_HIGH; }
 	public TaskPriority getPriority() { return TaskPriority.PR_HIGH; }
 
 
@@ -43,11 +44,11 @@ public final class RequestMoveToLocationInVehicle extends L2GameClientPacket
 		_x = readD();
 		_x = readD();
 		_y = readD();
 		_y = readD();
 		_z = readD();
 		_z = readD();
-		_pos.setXYZ(_x, _y, _z);
+		_pos = new Point3D(_x, _y, _z);
 		_x = readD();
 		_x = readD();
 		_y = readD();
 		_y = readD();
 		_z = readD();
 		_z = readD();
-		_origin_pos.setXYZ(_x, _y, _z);
+		_origin_pos = new Point3D(_x, _y, _z);
 	}
 	}
 
 
 	/* (non-Javadoc)
 	/* (non-Javadoc)
@@ -57,23 +58,61 @@ public final class RequestMoveToLocationInVehicle extends L2GameClientPacket
 	protected
 	protected
 	void runImpl()
 	void runImpl()
 	{
 	{
-		L2PcInstance activeChar = getClient().getActiveChar();
+		final L2PcInstance activeChar = getClient().getActiveChar();
 		if (activeChar == null)
 		if (activeChar == null)
 			return;
 			return;
-		else if (activeChar.isAttackingNow() && activeChar.getActiveWeaponItem() != null && (activeChar.getActiveWeaponItem().getItemType() == L2WeaponType.BOW))
+
+		if (activeChar.isAttackingNow()
+				&& activeChar.getActiveWeaponItem() != null
+				&& (activeChar.getActiveWeaponItem().getItemType() == L2WeaponType.BOW))
 		{
 		{
 			activeChar.sendPacket(ActionFailed.STATIC_PACKET);
 			activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+			return;
+		}
+
+		if (activeChar.isSitting() || activeChar.isMovementDisabled())
+		{
+			activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+			return;
+		}
+
+		if (activeChar.getPet() != null)
+		{
+			activeChar.sendPacket(new SystemMessage(SystemMessageId.RELEASE_PET_ON_BOAT));
+			activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+			return;
+		}
+
+		if (activeChar.isTransformed())
+		{
+			activeChar.sendPacket(new SystemMessage(SystemMessageId.CANT_POLYMORPH_ON_BOAT));
+			activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+			return;
+		}
+
+		final L2BoatInstance boat;
+		if (activeChar.isInBoat())
+		{
+			boat = activeChar.getBoat();
+			if (boat.getObjectId() != _boatId)
+			{
+				activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+				return;
+			}
 		}
 		}
 		else
 		else
 		{
 		{
-			L2BoatInstance boat = BoatManager.getInstance().getBoat(_boatId);
-			if (boat == null) return;
+			boat = BoatManager.getInstance().getBoat(_boatId);
+			if (boat == null)
+			{
+				activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+				return;
+			}
 			activeChar.setBoat(boat);
 			activeChar.setBoat(boat);
-			activeChar.setInBoat(true);
-			activeChar.setInBoatPosition(_pos);
-			activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO_IN_A_BOAT, new L2CharPosition(_pos.getX(),_pos.getY(), _pos.getZ(), 0), new L2CharPosition(_origin_pos.getX(),_origin_pos.getY(),_origin_pos.getZ(), 0));
 		}
 		}
 
 
+		activeChar.setInVehiclePosition(_pos);
+		activeChar.broadcastPacket(new MoveToLocationInVehicle(activeChar, _pos, _origin_pos));
 	}
 	}
 
 
 	/* (non-Javadoc)
 	/* (non-Javadoc)
@@ -84,5 +123,4 @@ public final class RequestMoveToLocationInVehicle extends L2GameClientPacket
 	{
 	{
 		return _C__75_MOVETOLOCATIONINVEHICLE;
 		return _C__75_MOVETOLOCATIONINVEHICLE;
 	}
 	}
-
 }
 }

+ 45 - 28
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/ValidatePosition.java

@@ -21,10 +21,9 @@ import com.l2jserver.gameserver.TaskPriority;
 import com.l2jserver.gameserver.geoeditorcon.GeoEditorListener;
 import com.l2jserver.gameserver.geoeditorcon.GeoEditorListener;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.network.serverpackets.ExValidateLocationInAirShip;
+import com.l2jserver.gameserver.network.serverpackets.GetOnVehicle;
 import com.l2jserver.gameserver.network.serverpackets.PartyMemberPosition;
 import com.l2jserver.gameserver.network.serverpackets.PartyMemberPosition;
 import com.l2jserver.gameserver.network.serverpackets.ValidateLocation;
 import com.l2jserver.gameserver.network.serverpackets.ValidateLocation;
-import com.l2jserver.gameserver.network.serverpackets.ValidateLocationInVehicle;
 
 
 
 
 /**
 /**
@@ -44,8 +43,7 @@ public class ValidatePosition extends L2GameClientPacket
 	private int _y;
 	private int _y;
 	private int _z;
 	private int _z;
 	private int _heading;
 	private int _heading;
-	@SuppressWarnings("unused")
-	private int _data;
+	private int _data; // vehicle id
 
 
 	@Override
 	@Override
 	protected void readImpl()
 	protected void readImpl()
@@ -70,28 +68,59 @@ public class ValidatePosition extends L2GameClientPacket
 		final int realY = activeChar.getY();
 		final int realY = activeChar.getY();
 		int realZ = activeChar.getZ();
 		int realZ = activeChar.getZ();
 
 
+		if (Config.DEVELOPER)
+		{
+			_log.fine("client pos: "+ _x + " "+ _y + " "+ _z +" head "+ _heading);
+			_log.fine("server pos: "+ realX + " "+realY+ " "+realZ +" head "+activeChar.getHeading());
+		}
+
 		if (_x == 0 && _y == 0) 
 		if (_x == 0 && _y == 0) 
 		{
 		{
 			if (realX != 0) // in this case this seems like a client error
 			if (realX != 0) // in this case this seems like a client error
 				return;
 				return;
 		}
 		}
 
 
+		int dx, dy, dz;
+		double diffSq;
+
+		if (activeChar.isInBoat())
+		{
+			if (Config.COORD_SYNCHRONIZE == 2)
+			{
+				dx = _x - activeChar.getInVehiclePosition().getX();
+				dy = _y - activeChar.getInVehiclePosition().getY();
+				dz = _z - activeChar.getInVehiclePosition().getZ();
+				diffSq = (dx*dx + dy*dy);
+				if (diffSq > 250000)
+					sendPacket(new GetOnVehicle(activeChar.getObjectId(), _data, activeChar.getInVehiclePosition()));
+			}
+			return;
+		}
+		if (activeChar.isInAirShip())
+		{
+			/*if (Config.COORD_SYNCHRONIZE == 2)
+			{
+				dx = _x - activeChar.getInVehiclePosition().getX();
+				dy = _y - activeChar.getInVehiclePosition().getY();
+				dz = _z - activeChar.getInVehiclePosition().getZ();
+				diffSq = (dx*dx + dy*dy);
+				if (diffSq > 250000)
+					sendPacket(new GetOnVehicle(activeChar.getObjectId(), _data, activeChar.getInBoatPosition()));
+			}*/
+			return;
+		}
+
+		dx = _x - realX;
+		dy = _y - realY;
+		dz = _z - realZ;
+		diffSq = (dx*dx + dy*dy);
+			
 		if(activeChar.getParty() != null && activeChar.getLastPartyPositionDistance(_x, _y, _z) > 150)
 		if(activeChar.getParty() != null && activeChar.getLastPartyPositionDistance(_x, _y, _z) > 150)
 		{
 		{
 			activeChar.setLastPartyPosition(_x, _y, _z);
 			activeChar.setLastPartyPosition(_x, _y, _z);
 			activeChar.getParty().broadcastToPartyMembers(activeChar,new PartyMemberPosition(activeChar));
 			activeChar.getParty().broadcastToPartyMembers(activeChar,new PartyMemberPosition(activeChar));
 		}
 		}
 
 
-		final int dx = _x - realX;
-		final int dy = _y - realY;
-		final int dz = _z - realZ;
-		double diffSq = (dx*dx + dy*dy);
-
-		if (Config.DEVELOPER)
-		{
-			_log.fine("client pos: "+ _x + " "+ _y + " "+ _z +" head "+ _heading);
-			_log.fine("server pos: "+ realX + " "+realY+ " "+realZ +" head "+activeChar.getHeading());
-		}
 
 
 		if (Config.ACCEPT_GEOEDITOR_CONN)
 		if (Config.ACCEPT_GEOEDITOR_CONN)
 			if (GeoEditorListener.getInstance().getThread() != null  
 			if (GeoEditorListener.getInstance().getThread() != null  
@@ -103,14 +132,7 @@ public class ValidatePosition extends L2GameClientPacket
 		{
 		{
 			activeChar.setXYZ(realX, realY, _z);
 			activeChar.setXYZ(realX, realY, _z);
 			if (diffSq > 90000) // validate packet, may also cause z bounce if close to land
 			if (diffSq > 90000) // validate packet, may also cause z bounce if close to land
-			{
-				if (activeChar.isInBoat())
-					sendPacket(new ValidateLocationInVehicle(activeChar));
-				else if (activeChar.isInAirShip())
-					sendPacket(new ExValidateLocationInAirShip(activeChar));
-				else
-					activeChar.sendPacket(new ValidateLocation(activeChar));
-			}
+				activeChar.sendPacket(new ValidateLocation(activeChar));
 		}
 		}
 		else if (diffSq < 360000) // if too large, messes observation
 		else if (diffSq < 360000) // if too large, messes observation
 		{
 		{
@@ -158,12 +180,7 @@ public class ValidatePosition extends L2GameClientPacket
 					if (Config.DEVELOPER)
 					if (Config.DEVELOPER)
 						_log.info(activeChar.getName() + ": Synchronizing position Server --> Client");
 						_log.info(activeChar.getName() + ": Synchronizing position Server --> Client");
 
 
-					if (activeChar.isInBoat())
-						sendPacket(new ValidateLocationInVehicle(activeChar));
-					else if (activeChar.isInAirShip())
-						sendPacket(new ExValidateLocationInAirShip(activeChar));
-					else
-						activeChar.sendPacket(new ValidateLocation(activeChar));
+					activeChar.sendPacket(new ValidateLocation(activeChar));
 				}
 				}
 			}
 			}
 		}
 		}

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/ExAirShipInfo.java

@@ -31,8 +31,8 @@ public class ExAirShipInfo extends L2GameServerPacket
 		_z = ship.getZ();
 		_z = ship.getZ();
 		_heading = ship.getPosition().getHeading();
 		_heading = ship.getPosition().getHeading();
 		_objectId = ship.getObjectId();
 		_objectId = ship.getObjectId();
-		_speed1 = ship.getSpeed1();
-		_speed2 = ship.getSpeed2();
+		_speed1 = (int)ship.getStat().getMoveSpeed();
+		_speed2 = ship.getStat().getRotationSpeed();
 	}
 	}
 
 
 	@Override
 	@Override

+ 2 - 6
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/ExGetOffAirShip.java

@@ -14,8 +14,7 @@
  */
  */
 package com.l2jserver.gameserver.network.serverpackets;
 package com.l2jserver.gameserver.network.serverpackets;
 
 
-import com.l2jserver.gameserver.model.actor.instance.L2AirShipInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.actor.L2Character;
 
 
 public class ExGetOffAirShip extends L2GameServerPacket
 public class ExGetOffAirShip extends L2GameServerPacket
 {
 {
@@ -23,16 +22,13 @@ public class ExGetOffAirShip extends L2GameServerPacket
 
 
 	private final int _playerId, _airShipId, _x, _y, _z;
 	private final int _playerId, _airShipId, _x, _y, _z;
 
 
-	public ExGetOffAirShip(L2PcInstance player, L2AirShipInstance ship, int x, int y, int z)
+	public ExGetOffAirShip(L2Character player, L2Character ship, int x, int y, int z)
 	{
 	{
 		_playerId = player.getObjectId();
 		_playerId = player.getObjectId();
 		_airShipId = ship.getObjectId();
 		_airShipId = ship.getObjectId();
 		_x = x;
 		_x = x;
 		_y = y;
 		_y = y;
 		_z = z;
 		_z = z;
-		player.setXYZ(_x, _y, _z);
-		if (player.getPet() != null)
-			player.getPet().teleToLocation(_x, _y, _z);
 	}
 	}
 
 
 	@Override
 	@Override

+ 9 - 12
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/ExGetOnAirShip.java

@@ -14,25 +14,22 @@
  */
  */
 package com.l2jserver.gameserver.network.serverpackets;
 package com.l2jserver.gameserver.network.serverpackets;
 
 
-import com.l2jserver.gameserver.model.actor.instance.L2AirShipInstance;
+import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.util.Point3D;
 
 
 public class ExGetOnAirShip extends L2GameServerPacket
 public class ExGetOnAirShip extends L2GameServerPacket
 {
 {
 	private static final String _S__FE_63_EXGETONAIRSHIP = "[S] FE:63 ExGetOnAirShip";
 	private static final String _S__FE_63_EXGETONAIRSHIP = "[S] FE:63 ExGetOnAirShip";
 
 
-	private final int _playerId, _airShipId, _x, _y, _z;
+	private final int _playerId, _airShipId;
+	private final Point3D _pos;
 
 
-	public ExGetOnAirShip(L2PcInstance player, L2AirShipInstance ship)
+	public ExGetOnAirShip(L2PcInstance player, L2Character ship)
 	{
 	{
 		_playerId = player.getObjectId();
 		_playerId = player.getObjectId();
 		_airShipId = ship.getObjectId();
 		_airShipId = ship.getObjectId();
-		_x = ship.getX();
-		_y = ship.getY();
-		_z = ship.getZ();
-		player.setXYZ(_x, _y, _z);
-		if (player.getPet() != null)
-			player.getPet().teleToLocation(_x, _y, _z);
+		_pos = player.getInVehiclePosition();
 	}
 	}
 
 
 	@Override
 	@Override
@@ -43,9 +40,9 @@ public class ExGetOnAirShip extends L2GameServerPacket
 
 
 		writeD(_playerId);
 		writeD(_playerId);
 		writeD(_airShipId);
 		writeD(_airShipId);
-		writeD(_x);
-		writeD(_y);
-		writeD(_z);
+		writeD(_pos.getX());
+		writeD(_pos.getY());
+		writeD(_pos.getZ());
 	}
 	}
 
 
 	@Override
 	@Override

+ 12 - 18
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/ExMoveToLocationInAirShip.java

@@ -14,33 +14,27 @@
  */
  */
 package com.l2jserver.gameserver.network.serverpackets;
 package com.l2jserver.gameserver.network.serverpackets;
 
 
-import com.l2jserver.gameserver.model.L2CharPosition;
-import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.util.Point3D;
 
 
 public class ExMoveToLocationInAirShip extends L2GameServerPacket
 public class ExMoveToLocationInAirShip extends L2GameServerPacket
 {
 {
 	private int _charObjId;
 	private int _charObjId;
 	private int _airShipId;
 	private int _airShipId;
-	private L2CharPosition _destination;
-	//private L2CharPosition _origin;
+	private Point3D _destination;
+	private int _heading;
+
 	/**
 	/**
 	 * @param actor
 	 * @param actor
 	 * @param destination
 	 * @param destination
 	 * @param origin
 	 * @param origin
 	 */
 	 */
-	public ExMoveToLocationInAirShip(L2Character actor, L2CharPosition destination)
+	public ExMoveToLocationInAirShip(L2PcInstance player)
 	{
 	{
-		if (!(actor instanceof L2PcInstance)) return;
-
-		L2PcInstance player = (L2PcInstance)actor;
-
-		if (player.getAirShip() == null) return;
-		
-		_charObjId = actor.getObjectId();
+		_charObjId = player.getObjectId();
 		_airShipId = player.getAirShip().getObjectId();
 		_airShipId = player.getAirShip().getObjectId();
-		_destination = destination;
-		//_origin = origin;
+		_destination = player.getInVehiclePosition();
+		_heading = player.getHeading();
 	}
 	}
 
 
 	/* (non-Javadoc)
 	/* (non-Javadoc)
@@ -53,10 +47,10 @@ public class ExMoveToLocationInAirShip extends L2GameServerPacket
 		writeH(0x6D);
 		writeH(0x6D);
         writeD(_charObjId);
         writeD(_charObjId);
         writeD(_airShipId);
         writeD(_airShipId);
-		writeD(_destination.x);
-		writeD(_destination.y);
-		writeD(_destination.z);
-		writeD(_destination.heading);
+		writeD(_destination.getX());
+		writeD(_destination.getY());
+		writeD(_destination.getZ());
+		writeD(_heading);
 	}
 	}
 
 
 	/* (non-Javadoc)
 	/* (non-Javadoc)

+ 6 - 23
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/GetOffVehicle.java

@@ -14,20 +14,13 @@
  */
  */
 package com.l2jserver.gameserver.network.serverpackets;
 package com.l2jserver.gameserver.network.serverpackets;
 
 
-import com.l2jserver.gameserver.model.actor.instance.L2BoatInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-
 /**
 /**
  * @author Maktakien
  * @author Maktakien
  *
  *
  */
  */
 public class GetOffVehicle extends L2GameServerPacket
 public class GetOffVehicle extends L2GameServerPacket
 {
 {
-	private int _x;
-	private int _y;
-	private int _z;
-	private L2PcInstance _activeChar;
-	private L2BoatInstance _boat;
+	private int _charObjId, _boatObjId, _x, _y, _z;
 
 
 	/**
 	/**
 	 * @param activeChar
 	 * @param activeChar
@@ -36,33 +29,24 @@ public class GetOffVehicle extends L2GameServerPacket
 	 * @param y
 	 * @param y
 	 * @param z
 	 * @param z
 	 */
 	 */
-	public GetOffVehicle(L2PcInstance activeChar, L2BoatInstance boat, int x, int y, int z)
+	public GetOffVehicle(int charObjId, int boatObjId, int x, int y, int z)
 	{
 	{
-		_activeChar = activeChar;
-		_boat = boat;
+		_charObjId = charObjId;
+		_boatObjId = boatObjId;
 		_x = x;
 		_x = x;
 		_y = y;
 		_y = y;
 		_z = z;
 		_z = z;
-
-		if (_activeChar != null)
-		{
-			_activeChar.setInBoat(false);
-			_activeChar.setBoat(null);
-		}
 	}
 	}
 
 
 	@Override
 	@Override
 	protected void writeImpl()
 	protected void writeImpl()
 	{
 	{
-		if (_boat == null || _activeChar == null) return;
-
 		writeC(0x6f);
 		writeC(0x6f);
-		writeD(_activeChar.getObjectId());
-		writeD(_boat.getObjectId());
+		writeD(_charObjId);
+		writeD(_boatObjId);
 		writeD(_x);
 		writeD(_x);
 		writeD(_y);
 		writeD(_y);
 		writeD(_z);
 		writeD(_z);
-
 	}
 	}
 
 
 	@Override
 	@Override
@@ -70,5 +54,4 @@ public class GetOffVehicle extends L2GameServerPacket
 	{
 	{
 		return "[S] 6f GetOffVehicle";
 		return "[S] 6f GetOffVehicle";
 	}
 	}
-
 }
 }

+ 14 - 22
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/GetOnVehicle.java

@@ -14,8 +14,7 @@
  */
  */
 package com.l2jserver.gameserver.network.serverpackets;
 package com.l2jserver.gameserver.network.serverpackets;
 
 
-import com.l2jserver.gameserver.model.actor.instance.L2BoatInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.util.Point3D;
 
 
 /**
 /**
  * @author Maktakien
  * @author Maktakien
@@ -23,11 +22,10 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  */
  */
 public class GetOnVehicle extends L2GameServerPacket
 public class GetOnVehicle extends L2GameServerPacket
 {
 {
-	private int _x;
-	private int _y;
-	private int _z;
-	private L2PcInstance _activeChar;
-	private L2BoatInstance _boat;
+	private int _charObjId;
+	private int _boatObjId;
+	private Point3D _pos;
+
 	/**
 	/**
 	 * @param activeChar
 	 * @param activeChar
 	 * @param boat
 	 * @param boat
@@ -35,16 +33,11 @@ public class GetOnVehicle extends L2GameServerPacket
 	 * @param y
 	 * @param y
 	 * @param z
 	 * @param z
 	 */
 	 */
-	public GetOnVehicle(L2PcInstance activeChar, L2BoatInstance boat, int x, int y, int z)
+	public GetOnVehicle(int charObjId, int boatObjId, Point3D pos)
 	{
 	{
-		_activeChar = activeChar;
-		_boat = boat;
-		_x = x;
-		_y = y;
-		_z = z;
-
-		_activeChar.setBoat(_boat);
-		_activeChar.setInBoat(true);
+		_charObjId = charObjId;
+		_boatObjId = boatObjId;
+		_pos = pos;
 	}
 	}
 
 
 	/* (non-Javadoc)
 	/* (non-Javadoc)
@@ -54,11 +47,11 @@ public class GetOnVehicle extends L2GameServerPacket
 	protected void writeImpl()
 	protected void writeImpl()
 	{
 	{
 		writeC(0x6e);
 		writeC(0x6e);
-		writeD(_activeChar.getObjectId());
-		writeD(_boat.getObjectId());
-        writeD(_x);
-        writeD(_y);
-        writeD(_z);
+		writeD(_charObjId);
+		writeD(_boatObjId);
+        writeD(_pos.getX());
+        writeD(_pos.getY());
+        writeD(_pos.getZ());
 
 
 	}
 	}
 
 
@@ -70,5 +63,4 @@ public class GetOnVehicle extends L2GameServerPacket
 	{
 	{
 		return "[S] 6e GetOnVehicle";
 		return "[S] 6e GetOnVehicle";
 	}
 	}
-
 }
 }

+ 10 - 21
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/MoveToLocationInVehicle.java

@@ -14,9 +14,8 @@
  */
  */
 package com.l2jserver.gameserver.network.serverpackets;
 package com.l2jserver.gameserver.network.serverpackets;
 
 
-import com.l2jserver.gameserver.model.L2CharPosition;
-import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.util.Point3D;
 
 
 /**
 /**
  * @author Maktakien
  * @author Maktakien
@@ -26,28 +25,19 @@ public class MoveToLocationInVehicle extends L2GameServerPacket
 {
 {
 	private int _charObjId;
 	private int _charObjId;
 	private int _boatId;
 	private int _boatId;
-	private L2CharPosition _destination;
-	private L2CharPosition _origin;
+	private Point3D _destination;
+	private Point3D _origin;
 	/**
 	/**
 	 * @param actor
 	 * @param actor
 	 * @param destination
 	 * @param destination
 	 * @param origin
 	 * @param origin
 	 */
 	 */
-	public MoveToLocationInVehicle(L2Character actor, L2CharPosition destination, L2CharPosition origin)
+	public MoveToLocationInVehicle(L2PcInstance player, Point3D destination, Point3D origin)
 	{
 	{
-		if (!(actor instanceof L2PcInstance)) return;
-
-		L2PcInstance player = (L2PcInstance)actor;
-
-		if (player.getBoat() == null) return;
-
 		_charObjId = player.getObjectId();
 		_charObjId = player.getObjectId();
 		_boatId = player.getBoat().getObjectId();
 		_boatId = player.getBoat().getObjectId();
 		_destination = destination;
 		_destination = destination;
 		_origin = origin;
 		_origin = origin;
-	/*	_pci.sendMessage("_destination : x " + x +" y " + y + " z " + z);
-		_pci.sendMessage("_boat : x " + _pci.getBoat().getX() +" y " + _pci.getBoat().getY() + " z " + _pci.getBoat().getZ());
-		_pci.sendMessage("-----------");*/
 	}
 	}
 
 
 	/* (non-Javadoc)
 	/* (non-Javadoc)
@@ -59,12 +49,12 @@ public class MoveToLocationInVehicle extends L2GameServerPacket
 		writeC(0x7e);
 		writeC(0x7e);
         writeD(_charObjId);
         writeD(_charObjId);
         writeD(_boatId);
         writeD(_boatId);
-		writeD(_destination.x);
-		writeD(_destination.y);
-		writeD(_destination.z);
-		writeD(_origin.x);
-		writeD(_origin.y);
-		writeD(_origin.z);
+		writeD(_destination.getX());
+		writeD(_destination.getY());
+		writeD(_destination.getZ());
+		writeD(_origin.getX());
+		writeD(_origin.getY());
+		writeD(_origin.getZ());
 	}
 	}
 
 
 	/* (non-Javadoc)
 	/* (non-Javadoc)
@@ -75,5 +65,4 @@ public class MoveToLocationInVehicle extends L2GameServerPacket
 	{
 	{
 		return "[S] 7e MoveToLocationInVehicle";
 		return "[S] 7e MoveToLocationInVehicle";
 	}
 	}
-
 }
 }

+ 15 - 15
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/StopMoveInVehicle.java

@@ -15,6 +15,7 @@
 package com.l2jserver.gameserver.network.serverpackets;
 package com.l2jserver.gameserver.network.serverpackets;
 
 
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.util.Point3D;
 
 
 /**
 /**
  * @author Maktakien
  * @author Maktakien
@@ -22,17 +23,17 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  */
  */
 public class StopMoveInVehicle  extends L2GameServerPacket
 public class StopMoveInVehicle  extends L2GameServerPacket
 {
 {
-
-	private L2PcInstance _activeChar;
+	private int _charObjId;
 	private int _boatId;
 	private int _boatId;
-	/**
-	 * @param player
-	 * @param boatid
-	 */
-	public StopMoveInVehicle(L2PcInstance player, int boatid)
+	private Point3D _pos;
+	private int _heading;
+
+	public StopMoveInVehicle(L2PcInstance player, int boatId)
 	{
 	{
-		_activeChar = player;
-		_boatId = boatid;
+		_charObjId = player.getObjectId();
+		_boatId = boatId;
+		_pos = player.getInVehiclePosition();
+		_heading = player.getHeading();
 	}
 	}
 
 
 	/* (non-Javadoc)
 	/* (non-Javadoc)
@@ -42,12 +43,12 @@ public class StopMoveInVehicle  extends L2GameServerPacket
 	protected void writeImpl()
 	protected void writeImpl()
 	{
 	{
 		writeC(0x7f);
 		writeC(0x7f);
-		writeD(_activeChar.getObjectId());
+		writeD(_charObjId);
 		writeD(_boatId);
 		writeD(_boatId);
-		writeD(_activeChar.getInBoatPosition().getX());
-		writeD(_activeChar.getInBoatPosition().getY());
-		writeD(_activeChar.getInBoatPosition().getZ());
-		writeD(_activeChar.getPosition().getHeading());
+		writeD(_pos.getX());
+		writeD(_pos.getY());
+		writeD(_pos.getZ());
+		writeD(_heading);
 	}
 	}
 
 
 	/* (non-Javadoc)
 	/* (non-Javadoc)
@@ -58,5 +59,4 @@ public class StopMoveInVehicle  extends L2GameServerPacket
 	{
 	{
 		return "[S] 7f StopMoveInVehicle";
 		return "[S] 7f StopMoveInVehicle";
 	}
 	}
-
 }
 }

+ 9 - 1
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/UserInfo.java

@@ -82,6 +82,7 @@ public final class UserInfo extends L2GameServerPacket
     private float _moveMultiplier;
     private float _moveMultiplier;
     private int _territoryId;
     private int _territoryId;
     private boolean _isDisguised;
     private boolean _isDisguised;
+    private int _vehicleObjectId;
 
 
     /**
     /**
      * @param _characters
      * @param _characters
@@ -104,6 +105,13 @@ public final class UserInfo extends L2GameServerPacket
         }
         }
         if (_activeChar.getSiegeState() == 2) _relation |= 0x80;
         if (_activeChar.getSiegeState() == 2) _relation |= 0x80;
         _isDisguised = TerritoryWarManager.getInstance().isDisguised(character.getObjectId());
         _isDisguised = TerritoryWarManager.getInstance().isDisguised(character.getObjectId());
+        if (_activeChar.isInBoat())
+        	_vehicleObjectId = _activeChar.getBoat().getObjectId();
+        else if (_activeChar.isInAirShip())
+        	_vehicleObjectId = _activeChar.getAirShip().getObjectId();
+        else
+        	_vehicleObjectId = 0;
+        	
     }
     }
 
 
     @Override
     @Override
@@ -114,7 +122,7 @@ public final class UserInfo extends L2GameServerPacket
         writeD(_activeChar.getX());
         writeD(_activeChar.getX());
         writeD(_activeChar.getY());
         writeD(_activeChar.getY());
         writeD(_activeChar.getZ());
         writeD(_activeChar.getZ());
-        writeD(_activeChar.isInAirShip() ? _activeChar.getAirShip().getObjectId() : 0x00); // heading from CT2.3 no longer used inside userinfo, here is now vehicle id (boat,airship)
+        writeD(_vehicleObjectId); // heading from CT2.3 no longer used inside userinfo, here is now vehicle id (boat,airship)
         writeD(_activeChar.getObjectId());
         writeD(_activeChar.getObjectId());
         writeS(_activeChar.getName());
         writeS(_activeChar.getName());
         writeD(_activeChar.getRace().ordinal());
         writeD(_activeChar.getRace().ordinal());

+ 34 - 33
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/ValidateLocationInVehicle.java

@@ -14,8 +14,8 @@
  */
  */
 package com.l2jserver.gameserver.network.serverpackets;
 package com.l2jserver.gameserver.network.serverpackets;
 
 
-import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.util.Point3D;
 /**
 /**
  * This class ...
  * This class ...
  *
  *
@@ -23,42 +23,43 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  */
  */
 public class ValidateLocationInVehicle extends L2GameServerPacket
 public class ValidateLocationInVehicle extends L2GameServerPacket
 {
 {
-    private static final String _S__73_ValidateLocationInVehicle = "[S] 80 ValidateLocationInVehicle";
-    private L2PcInstance _activeChar;
+	private static final String _S__80_ValidateLocationInVehicle = "[S] 80 ValidateLocationInVehicle";
 
 
+	private int _charObjId;
+	private int _boatObjId;
+	private int _heading;
+	private Point3D _pos;
 
 
-    /**
-     * 0x73 ValidateLocationInVehicle         hdd
-     * @param _characters
-     */
-    public ValidateLocationInVehicle(L2Character player)
-    {
-    	if (!(player instanceof L2PcInstance)) return;
+	/**
+	 * 0x80 ValidateLocationInVehicle         hdd
+	 * @param _characters
+	 */
+	public ValidateLocationInVehicle(L2PcInstance player)
+	{
+		_charObjId = player.getObjectId();
+		_boatObjId = player.getBoat().getObjectId();
+		_heading = player.getHeading();
+		_pos = player.getInVehiclePosition();
+	}
 
 
-		_activeChar = (L2PcInstance)player;
-
-		if (_activeChar.getBoat() == null) return;
-    }
-
-    @Override
+	@Override
 	protected final void writeImpl()
 	protected final void writeImpl()
-    {
-    	
-        writeC(0x80);
-        writeD(_activeChar.getObjectId());
-        writeD(_activeChar.getBoat().getObjectId());
-        writeD(_activeChar.getX());
-        writeD(_activeChar.getY());
-        writeD(_activeChar.getZ());
-        writeD(_activeChar.getHeading());
-    }
+	{
+		writeC(0x80);
+		writeD(_charObjId);
+		writeD(_boatObjId);
+		writeD(_pos.getX());
+		writeD(_pos.getY());
+		writeD(_pos.getZ());
+		writeD(_heading);
+	}
 
 
-    /* (non-Javadoc)
-     * @see com.l2jserver.gameserver.serverpackets.ServerBasePacket#getType()
-     */
-    @Override
+	/* (non-Javadoc)
+	 * @see com.l2jserver.gameserver.serverpackets.ServerBasePacket#getType()
+	 */
+	@Override
 	public String getType()
 	public String getType()
-    {
-        return _S__73_ValidateLocationInVehicle;
-    }
+	{
+		return _S__80_ValidateLocationInVehicle;
+	}
 }
 }

+ 9 - 11
L2_GameServer/java/com/l2jserver/gameserver/network/serverpackets/VehicleDeparture.java

@@ -22,8 +22,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2BoatInstance;
  */
  */
 public class VehicleDeparture extends L2GameServerPacket
 public class VehicleDeparture extends L2GameServerPacket
 {
 {
-
-	private L2BoatInstance _boat;
+	private int _boatObjId;
 	private int _speed1;
 	private int _speed1;
 	private int _speed2;//rotation
 	private int _speed2;//rotation
 	private int _x;
 	private int _x;
@@ -37,14 +36,14 @@ public class VehicleDeparture extends L2GameServerPacket
 	 * @param y
 	 * @param y
 	 * @param z
 	 * @param z
 	 */
 	 */
-	public VehicleDeparture(L2BoatInstance boat, int speed1, int speed2, int x, int y, int z)
+	public VehicleDeparture(L2BoatInstance boat)
 	{
 	{
-		_boat = boat;
-		_speed1 = speed1;
-		_speed2 = speed2;
-		_x = x;
-		_y = y;
-		_z = z;
+		_boatObjId = boat.getObjectId();
+		_speed1 = (int)boat.getStat().getMoveSpeed();
+		_speed2 = boat.getStat().getRotationSpeed();
+		_x = boat.getXdestination();
+		_y = boat.getYdestination();
+		_z = boat.getZdestination();
 	}
 	}
 
 
 	@Override
 	@Override
@@ -52,7 +51,7 @@ public class VehicleDeparture extends L2GameServerPacket
 	void writeImpl()
 	void writeImpl()
 	{
 	{
 		writeC(0x6c);
 		writeC(0x6c);
-		writeD(_boat.getObjectId());
+		writeD(_boatObjId);
 		writeD(_speed1);
 		writeD(_speed1);
 		writeD(_speed2);
 		writeD(_speed2);
 		writeD(_x);
 		writeD(_x);
@@ -66,5 +65,4 @@ public class VehicleDeparture extends L2GameServerPacket
 	{
 	{
 		return "[S] 5A VehicleDeparture";
 		return "[S] 5A VehicleDeparture";
 	}
 	}
-
 }
 }