Core/Vehicles:
- Set MovementFlagsExtra (2) correctly depending on vehicle 'template' flags. This makes certain vehicles such as demolishers unable to jump/strafe (as intended) - Fix SMSG_MONSTER_MOVE_TRANSPORT stucture, prevents a client crash when entering certain vehicles, as well as *properly* broadcast position relative to the vehicle. - Send SMSG_BREAK_TARGET to player when entering vehicle. - Set MOVEMENTFLAG_ROOT on passenger when entering vehicle - Cleanup in affected code
This commit is contained in:
1 parent
13e85f861f
commit
68c6189201
5 files changed
+67
-24
No files matched your search
@@ -417,22 +417,24 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 M
|
||||
|
||||
void Unit::SendMonsterMoveTransport(Unit *vehicleOwner)
|
||||
{
|
||||
// TODO: Turn into BuildMonsterMoveTransport packet and allow certain variables (for npc movement aboard vehicles)
|
||||
WorldPacket data(SMSG_MONSTER_MOVE_TRANSPORT, GetPackGUID().size()+vehicleOwner->GetPackGUID().size());
|
||||
data.append(GetPackGUID());
|
||||
data.append(vehicleOwner->GetPackGUID());
|
||||
data << int8(GetTransSeat());
|
||||
data << uint8(0);
|
||||
data << uint8(0); // unk boolean
|
||||
data << GetPositionX() - vehicleOwner->GetPositionX();
|
||||
data << GetPositionY() - vehicleOwner->GetPositionY();
|
||||
data << GetPositionZ() - vehicleOwner->GetPositionZ();
|
||||
data << uint32(getMSTime());
|
||||
data << uint8(4);
|
||||
data << GetTransOffsetO();
|
||||
data << uint32(100); // should be an increasing constant that indicates movement packet count
|
||||
data << uint8(SPLINETYPE_FACING_ANGLE);
|
||||
data << GetTransOffsetO(); // facing angle?
|
||||
data << uint32(SPLINEFLAG_TRANSPORT);
|
||||
data << uint32(0);// move time
|
||||
data << uint32(0);//GetTransOffsetX();
|
||||
data << uint32(0);//GetTransOffsetY();
|
||||
data << uint32(0);//GetTransOffsetZ();
|
||||
data << uint32(0); // move time
|
||||
data << uint32(1);
|
||||
data << uint32(GetTransOffsetX());
|
||||
data << uint32(GetTransOffsetY());
|
||||
data << uint32(GetTransOffsetZ());
|
||||
SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
@@ -16610,16 +16612,20 @@ void Unit::EnterVehicle(Vehicle *vehicle, int8 seatId, bool byAura)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Player* thisPlr = this->ToPlayer())
|
||||
{
|
||||
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
|
||||
thisPlr->GetSession()->SendPacket(&data);
|
||||
|
||||
data.Initialize(SMSG_BREAK_TARGET, 7);
|
||||
data.append(vehicle->GetBase()->GetPackGUID());
|
||||
thisPlr->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
SetControlled(true, UNIT_STAT_ROOT);
|
||||
//movementInfo is set in AddPassenger
|
||||
//packets are sent in AddPassenger
|
||||
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
//this->ToPlayer()->SetClientControl(vehicle, 1);
|
||||
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
|
||||
this->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::ChangeSeat(int8 seatId, bool next, bool byAura)
|
||||
@@ -16700,6 +16706,8 @@ void Unit::BuildMovementPacket(ByteBuffer *data) const
|
||||
case TYPEID_UNIT:
|
||||
if (canFly())
|
||||
const_cast<Unit*>(this)->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
|
||||
if (IsVehicle())
|
||||
const_cast<Unit*>(this)->AddExtraUnitMovementFlag(GetVehicleKit()->GetExtraMovementFlagsForBase());
|
||||
break;
|
||||
case TYPEID_PLAYER:
|
||||
// remove unknown, unused etc flags for now
|
||||
@@ -16714,6 +16722,10 @@ void Unit::BuildMovementPacket(ByteBuffer *data) const
|
||||
break;
|
||||
}
|
||||
|
||||
if (GetVehicle())
|
||||
if (!this->HasUnitMovementFlag(MOVEMENTFLAG_ROOT))
|
||||
sLog->outError("Unit does not have MOVEMENTFLAG_ROOT but is in vehicle!");
|
||||
|
||||
*data << uint32(GetUnitMovementFlags()); // movement flags
|
||||
*data << uint16(m_movementInfo.flags2); // 2.3.0
|
||||
*data << uint32(getMSTime()); // time
|
||||
|
||||
Reference in new issue
Block a user