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:
@@ -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
|
||||
|
||||
@@ -675,7 +675,7 @@ enum MovementFlags2
|
||||
MOVEMENTFLAG2_NONE = 0x00000000,
|
||||
MOVEMENTFLAG2_NO_STRAFE = 0x00000001,
|
||||
MOVEMENTFLAG2_NO_JUMPING = 0x00000002,
|
||||
MOVEMENTFLAG2_UNK3 = 0x00000004,
|
||||
MOVEMENTFLAG2_UNK3 = 0x00000004, // Overrides various clientside checks
|
||||
MOVEMENTFLAG2_FULL_SPEED_TURNING = 0x00000008,
|
||||
MOVEMENTFLAG2_FULL_SPEED_PITCHING = 0x00000010,
|
||||
MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING = 0x00000020,
|
||||
@@ -1949,6 +1949,12 @@ class Unit : public WorldObject
|
||||
uint32 GetUnitMovementFlags() const { return m_movementInfo.flags; }
|
||||
void SetUnitMovementFlags(uint32 f) { m_movementInfo.flags = f; }
|
||||
|
||||
void AddExtraUnitMovementFlag(uint16 f) { m_movementInfo.flags2 |= f; }
|
||||
void RemoveExtraUnitMovementFlag(uint16 f) { m_movementInfo.flags2 &= ~f; }
|
||||
uint16 HasExtraUnitMovementFlag(uint16 f) const { return m_movementInfo.flags2 & f; }
|
||||
uint16 GetExtraUnitMovementFlags() const { return m_movementInfo.flags2; }
|
||||
void SetExtraUnitMovementFlags(uint16 f) { m_movementInfo.flags2 = f; }
|
||||
|
||||
void SetControlled(bool apply, UnitState state);
|
||||
|
||||
void AddComboPointHolder(uint32 lowguid) { m_ComboPointHolders.insert(lowguid); }
|
||||
|
||||
Reference in New Issue
Block a user