本文整理汇总了C++中MovementInfo::ReadFromPacket方法的典型用法代码示例。如果您正苦于以下问题:C++ MovementInfo::ReadFromPacket方法的具体用法?C++ MovementInfo::ReadFromPacket怎么用?C++ MovementInfo::ReadFromPacket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MovementInfo
的用法示例。
在下文中一共展示了MovementInfo::ReadFromPacket方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleMovementOpcodes
void WorldSession::HandleMovementOpcodes(WorldPacket& recvPacket)
{
MovementInfo info;
info.ReadFromPacket(recvPacket);
//Stop Emote
if (GetPlayer()->GetUInt32Value(UNIT_NPC_EMOTESTATE))
GetPlayer()->HandleEmoteCommand(0);
HandleMovementInfo(info, recvPacket.GetOpcode(), recvPacket.size(), _player->m_mover);
}
示例2: HandleMoveWaterWalkAck
void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recvPacket)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_WATER_WALK_ACK");
MovementInfo info;
info.ReadFromPacket(recvPacket);
recvPacket.read_skip<uint32>(); // unk
MovementInfo movementInfo;
GetPlayer()->ReadMovementInfo(recvPacket, &movementInfo);
recvPacket.read_skip<uint32>(); // unk2
}
示例3: HandleMovementUnrootAck
void WorldSession::HandleMovementUnrootAck(WorldPacket& recvPacket)
{
MovementInfo info;
info.ReadFromPacket(recvPacket);
// skip old result
if (_player->m_movement_ack[ACK_UNROOT] != info.ackCount)
{
recvPacket.rfinish();
return;
}
HandleMovementInfo(info, recvPacket.GetOpcode(), recvPacket.size()-4, _player->m_mover);
}
示例4: HandleDismissControlledVehicle
void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE");
uint64 vehicleGUID = _player->GetCharmGUID();
if (!vehicleGUID) // something wrong here...
{
recvData.rfinish(); // prevent warnings spam
return;
}
MovementInfo mi;
mi.ReadFromPacket(recvData);
mi.Sanitize(_player);
_player->m_movementInfo = mi;
_player->ExitVehicle();
}
示例5: HandleMovementSpeedChangeAck
void WorldSession::HandleMovementSpeedChangeAck(WorldPacket& recvPacket)
{
UnitMoveType moveType;
bool updatePacketNotKnown = false;
switch (recvPacket.GetOpcode())
{
case CMSG_MOVE_FORCE_WALK_SPEED_CHANGE_ACK: moveType = MOVE_WALK; break;
case CMSG_MOVE_FORCE_RUN_SPEED_CHANGE_ACK: moveType = MOVE_RUN; break;
case CMSG_MOVE_FORCE_RUN_BACK_SPEED_CHANGE_ACK: moveType = MOVE_RUN_BACK; break;
case CMSG_MOVE_FORCE_SWIM_SPEED_CHANGE_ACK: moveType = MOVE_SWIM; break;
case CMSG_MOVE_FORCE_SWIM_BACK_SPEED_CHANGE_ACK: moveType = MOVE_SWIM_BACK; break;
case CMSG_MOVE_FORCE_TURN_RATE_CHANGE_ACK: moveType = MOVE_TURN_RATE; updatePacketNotKnown = true; break;
case CMSG_MOVE_FORCE_FLIGHT_SPEED_CHANGE_ACK: moveType = MOVE_FLIGHT; break;
case CMSG_MOVE_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: moveType = MOVE_FLIGHT_BACK; updatePacketNotKnown = true; break;
case CMSG_MOVE_FORCE_PITCH_RATE_CHANGE_ACK: moveType = MOVE_PITCH_RATE; updatePacketNotKnown = true; break;
default:
sLog->outInfo(LOG_FILTER_BAD_OPCODE_HANDLER, "WorldSession::HandleMovementSpeedChangeAck for unknown opcode: %s", GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str());
return;
}
MovementInfo info;
info.ReadFromPacket(recvPacket);
// skip old result
if (_player->m_forced_speed_changes[moveType] != info.ackCount)
{
recvPacket.rfinish();
return;
}
if (!_player->GetTransport() && fabs(_player->GetSpeed(moveType) - info.ackSpeed) > 0.01f)
{
if (_player->GetSpeed(moveType) > info.ackSpeed)
_player->SetSpeed(moveType, _player->GetSpeedRate(moveType), true);
recvPacket.rfinish();
return;
}
// TODO: Find all structure (remove me)
if (updatePacketNotKnown)
{
WorldPacket data;
switch (moveType)
{
case MOVE_TURN_RATE:
data.Initialize(SMSG_MOVE_SET_TURN_RATE, 1 + 8 + 4 + 4);
info.WriteToPacket(data);
_player->SendMessageToSet(&data, _player);
break;
case MOVE_FLIGHT_BACK:
data.Initialize(SMSG_MOVE_SET_FLIGHT_BACK_SPEED, 1 + 8 + 4 + 4);
info.WriteToPacket(data);
_player->SendMessageToSet(&data, _player);
break;
case MOVE_PITCH_RATE:
data.Initialize(SMSG_MOVE_SET_PITCH_RATE, 1 + 8 + 4 + 4);
info.WriteToPacket(data);
_player->SendMessageToSet(&data, _player);
break;
default:
break;
}
}
HandleMovementInfo(info, recvPacket.GetOpcode(), recvPacket.size()-4, _player->m_mover);
}