Skip to content

Commit

Permalink
Movement: Implement unit based SMSG_MOVE_SET_COLLISION_HGT and MSG_MO…
Browse files Browse the repository at this point in the history
…VE_SET_COLLISION_HGT sending
  • Loading branch information
killerwife committed Aug 17, 2021
1 parent 7af726c commit 4700175
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
15 changes: 9 additions & 6 deletions src/game/Entities/Unit.cpp
Expand Up @@ -12834,13 +12834,16 @@ void Unit::DisableSpline()

void Unit::SendCollisionHeightUpdate(float height)
{
if (GetTypeId() == TYPEID_PLAYER)
if (IsClientControlled())
{
WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
data << GetPackGUID();
data << uint32(sWorld.GetGameTime());
data << height;
((Player*)this)->GetSession()->SendPacket(data);
if (Player const* player = GetControllingPlayer())
{
WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
data << GetPackGUID();
data << uint32(sWorld.GetGameTime());
data << height;
player->GetSession()->SendPacket(data);
}
}
}

Expand Down
16 changes: 10 additions & 6 deletions src/game/MotionGenerators/MovementHandler.cpp
Expand Up @@ -348,9 +348,18 @@ void WorldSession::HandleForceSpeedChangeAckOpcodes(WorldPacket& recv_data)
return;
}

Unit* mover = _player->GetMover();

if (!ProcessMovementInfo(movementInfo, mover, _player, recv_data))
return;

if (opcode == CMSG_MOVE_SET_COLLISION_HGT_ACK)
{
// TODO: Send MSG_MOVE_SET_COLLISION_HGT
WorldPacket data(MSG_MOVE_SET_COLLISION_HGT, 18);
data << guid.WriteAsPacked();
data << movementInfo;
data << newspeed; // new collision height
mover->SendMessageToSetExcept(data, _player);
return;
}

Expand Down Expand Up @@ -379,11 +388,6 @@ void WorldSession::HandleForceSpeedChangeAckOpcodes(WorldPacket& recv_data)
return;
}

Unit* mover = _player->GetMover();

if (!ProcessMovementInfo(movementInfo, mover, _player, recv_data))
return;

const SpeedOpcodePair& speedOpcodes = SetSpeed2Opc_table[move_type];
WorldPacket data(speedOpcodes[2], 18);
data << guid.WriteAsPacked();
Expand Down

0 comments on commit 4700175

Please sign in to comment.