25#define MOVEMENT_PACKET_TIME_DELAY 0
29struct MoveTeleportAckRequest
36struct ActiveMoverRequest
41struct ForceSpeedChangeAckRequest
48struct SummonResponseRequest
54MoveTeleportAckRequest ReadMoveTeleportAckRequest(
WorldPacket& recvPacket)
56 MoveTeleportAckRequest request;
57 recvPacket >> request.time >> request.flags;
59 request.guid[0] = recvPacket.
ReadBit();
60 request.guid[7] = recvPacket.
ReadBit();
61 request.guid[3] = recvPacket.
ReadBit();
62 request.guid[5] = recvPacket.
ReadBit();
63 request.guid[4] = recvPacket.
ReadBit();
64 request.guid[6] = recvPacket.
ReadBit();
65 request.guid[1] = recvPacket.
ReadBit();
66 request.guid[2] = recvPacket.
ReadBit();
87ForceSpeedChangeAckRequest ReadForceSpeedChangeAckRequest(
Player* player,
WorldPacket& recvData)
89 ForceSpeedChangeAckRequest request;
100ActiveMoverRequest ReadActiveMoverRequest(
WorldPacket& recvPacket)
102 ActiveMoverRequest request;
106 request.guid[3] = recvPacket.
ReadBit();
107 request.guid[0] = recvPacket.
ReadBit();
108 request.guid[2] = recvPacket.
ReadBit();
109 request.guid[1] = recvPacket.
ReadBit();
110 request.guid[5] = recvPacket.
ReadBit();
111 request.guid[4] = recvPacket.
ReadBit();
112 request.guid[7] = recvPacket.
ReadBit();
113 request.guid[6] = recvPacket.
ReadBit();
142SummonResponseRequest ReadSummonResponseRequest(
WorldPacket& recvData)
144 SummonResponseRequest request;
146 request.summonerGuid[1] = recvData.
ReadBit();
147 request.summonerGuid[3] = recvData.
ReadBit();
148 request.summonerGuid[5] = recvData.
ReadBit();
149 request.summonerGuid[2] = recvData.
ReadBit();
150 request.accept = recvData.
ReadBit();
151 request.summonerGuid[7] = recvData.
ReadBit();
152 request.summonerGuid[0] = recvData.
ReadBit();
153 request.summonerGuid[4] = recvData.
ReadBit();
154 request.summonerGuid[6] = recvData.
ReadBit();
170 return ReadMovementInfoRequest(player, recvData);
191 ReadMovementInfoRequest(player, recvPacket);
212 SF_LOG_ERROR(
"network",
"HandleMovementOpcodes: guid error");
218 SF_LOG_ERROR(
"network",
"HandleMovementOpcodes: Invalid Position");
275 SF_LOG_DEBUG(
"network",
"WORLD: got MSG_MOVE_WORLDPORT_ACK.");
282 if (!
GetPlayer()->IsBeingTeleportedFar())
303 if (
GetPlayer()->m_InstanceValid ==
false && !mInstance)
333 SF_LOG_ERROR(
"network",
"WORLD: failed to teleport player %s (%d) to map %d (%s) because of unknown reason!",
356 if (
_player->IsInvitedForBattlegroundInstance(
_player->GetBattlegroundId()))
366 if (!
_player->InBattleground())
396 if (mapDiff->resetTime)
439 MoveTeleportAckRequest request = ReadMoveTeleportAckRequest(recvPacket);
441 uint32 flags = request.flags;
442 uint32 time = request.time;
449 if (!ValidateMoveTeleportAck(plMover, guid))
465 if (old_zone != newzone)
500 if (ShouldIgnoreMovementWhileTeleporting(plrMover, recvPacket))
507 if (!ValidateMovementInfo(mover, movementInfo))
510 Transport* pendingPetTransportRemoval = NULL;
515 if (!ValidateTransportMovementInfo(recvPacket, movementInfo))
531 bool foundNewTransport =
false;
536 foundNewTransport =
true;
541 if (!foundNewTransport)
545 pendingPetTransportRemoval = oldTransport;
559 pendingPetTransportRemoval = plrMover->
m_transport;
601 transport->CalculatePassengerPosition(
610 if (plrMover && pendingPetTransportRemoval)
655 ForceSpeedChangeAckRequest request = ReadForceSpeedChangeAckRequest(
GetPlayer(), recvData);
656 MovementInfo const& movementInfo = request.movementInfo;
657 uint32 opcode = request.opcode;
660 if (!ValidateSpeedChangeAck(recvData,
_player, movementInfo))
663 float newspeed = request.newSpeed;
695 SF_LOG_ERROR(
"network",
"WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode);
701 if (
_player->m_forced_speed_changes[move_type] > 0)
703 --
_player->m_forced_speed_changes[move_type];
704 if (
_player->m_forced_speed_changes[move_type] > 0)
708 if (!
_player->GetTransport() && fabs(
_player->GetSpeed(move_type) - newspeed) > 0.01f)
710 if (
_player->GetSpeed(move_type) > newspeed)
712 SF_LOG_ERROR(
"network",
"%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value",
713 move_type_name[move_type],
_player->GetName().c_str(),
_player->GetSpeed(move_type), newspeed);
714 _player->SetSpeed(move_type,
_player->GetSpeedRate(move_type),
true);
718 SF_LOG_DEBUG(
"misc",
"Player %s from account id %u kicked for incorrect speed (must be %f instead %f)",
719 _player->GetName().c_str(),
_player->GetSession()->GetAccountId(),
_player->GetSpeed(move_type), newspeed);
720 _player->GetSession()->KickPlayer();
727 SF_LOG_DEBUG(
"network",
"WORLD: Recvd CMSG_SET_ACTIVE_MOVER");
729 ActiveMoverRequest request = ReadActiveMoverRequest(recvPacket);
732 ValidateActiveMoverGuid(
_player, guid);
737 SF_LOG_DEBUG(
"network",
"WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER");
761 if (!ValidateKnockBackAck(
_player->m_mover, movementInfo))
764 _player->m_movementInfo = movementInfo;
767 _player->WriteMovementInfo(data);
768 _player->SendMessageToSet(&data,
false);
775 ReadMoveHoverAckRequest(
GetPlayer(), recvData);
782 ReadMovementInfoRequest(
GetPlayer(), recvData);
802 SummonResponseRequest request = ReadSummonResponseRequest(recvData);
804 _player->SummonIfPossible(request.accept);
811 SF_LOG_DEBUG(
"network",
"WORLD: CMSG_MOVE_SET_CAN_FLY_ACK");
820 SF_LOG_DEBUG(
"network",
"CMSG_MOVE_SET_COLLISION_HEIGHT_ACK");
822 ReadSetCollisionHeightAckRequest(
GetPlayer(), recvPacket);
829 ReadMovementForceAckRequest(
GetPlayer(), recvPacket);
834 SF_LOG_DEBUG(
"network",
"WORLD: CMSG_MOVE_SET_CAN_TURN_WHILE_FALLING_ACK");
MapDifficulty const * GetMapDifficultyData(uint32 mapId, DifficultyID difficulty)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
AreaTableEntry const * GetAreaEntryByAreaID(uint32 area_id)
#define SF_LOG_DEBUG(filterType__,...)
#define SF_LOG_ERROR(filterType__,...)
#define MOVEMENT_PACKET_TIME_DELAY
uint32 GUID_LOPART(uint64 x)
char const * GetLogNameForGuid(uint64 guid)
uint32 GUID_ENPART(uint64 x)
@ GAMEOBJECT_TYPE_TRANSPORT
@ UNIT_FIELD_NPC_EMOTESTATE
@ PLAYER_FIELD_PLAYER_FLAGS
void ResummonLastBattlePet()
virtual bool HandlePlayerUnderMap(Player *)
void WriteGuidBytes(const ObjectGuid &guid, Offsets... offsets)
void WriteGuidMask(const ObjectGuid &guid, Offsets... offsets)
void ReadByteSeq(uint8 &b)
void readPackGUID(uint64 &guid)
CorpseType GetType() const
GameobjectTypes GetGoType() const
virtual void RemovePlayerFromMap(Player *, bool)
Transport * GetTransport(uint64 guid)
GameObject * GetGameObject(uint64 guid)
bool IsUnderWater(float x, float y, float z) const
virtual bool CanEnter(Player *)
const char * GetMapName() const
static bool IsValidMapCoord(uint32 mapid, float x, float y)
void MovementExpired(bool reset=true)
uint32 GetUInt32Value(uint16 index) const
bool HasFlag(uint16 index, uint32 flag) const
void SetUInt32Value(uint16 index, uint32 value)
void SetSemaphoreTeleportNear(bool semphsetting)
void SendInitialPacketsAfterAddToMap()
WorldLocation & GetTeleportDest()
void HandleFall(MovementInfo const &movementInfo)
uint32 EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
void SetInWater(bool apply)
void ReadMovementInfo(WorldPacket &data, MovementInfo *mi, Movement::ExtraMovementStatusElement *extras=NULL)
BattlePetMgr * GetBattlePetMgr()
bool IsInWater() const override
void UpdateZone(uint32 newZone, uint32 newArea)
void SendInitialPacketsBeforeAddToMap()
DifficultyID GetDifficulty(MapEntry const *mapEntry) const
void UpdateFallInformationIfNeed(MovementInfo const &minfo, uint16 opcode)
void SetSemaphoreTeleportFar(bool semphsetting)
Corpse * GetCorpse() const
Battleground * GetBattleground() const
void ProcessDelayedOperations()
bool UpdatePosition(float x, float y, float z, float orientation, bool teleport=false) override
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
bool IsBeingTeleportedNear() const
void SetSemaphoreTeleportForcedFar(bool semphsetting)
void SendMessageToSet(WorldPacket *data, bool self) override
void SetMap(Map *map) override
bool IsInCinematic() const
void ResummonPetTemporaryUnSummonedIfAny()
void UpdatePvP(bool state, bool override=false)
void CleanupAfterTaxiFlight()
void SendInstanceResetWarning(uint32 mapid, DifficultyID difficulty, uint32 time)
bool IsBeingTeleported() const
void ResurrectPlayer(float restore_percent, bool applySickness=false)
void RemovePassenger(WorldObject *passenger)
void AddPassenger(WorldObject *passenger)
Vehicle * GetVehicle() const
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
void WriteMovementInfo(WorldPacket &data, Movement::ExtraMovementStatusElement *extras=NULL)
MotionMaster * GetMotionMaster()
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Transport * GetTransport() const
Map const * GetBaseMap() const
MovementInfo m_movementInfo
virtual void SendMessageToSet(WorldPacket *data, bool self)
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Opcodes GetOpcode() const
void HandleMountSpecialAnimOpcode(WorldPacket &recvdata)
void LogoutPlayer(bool save)
Log the player out
void HandleMoveTeleportAck(WorldPacket &recvPacket)
void HandleMovementForceAck(WorldPacket &recvPacket)
void HandleMoveHoverAck(WorldPacket &recvData)
void HandleSetCollisionHeightAck(WorldPacket &recvPacket)
void HandleSummonResponseOpcode(WorldPacket &recvData)
void HandleMovementOpcodes(WorldPacket &recvPacket)
Player * GetPlayer() const
void HandleForceSpeedChangeAck(WorldPacket &recvData)
void HandleMoveWorldportAckOpcode()
void HandleMoveSetCanTurnWhileFallingAck(WorldPacket &recvData)
void HandleMoveWaterWalkAck(WorldPacket &recvPacket)
void HandleMoveSetCanFlyAckOpcode(WorldPacket &recvData)
void HandleMoveNotActiveMover(WorldPacket &recvData)
void HandleSetActiveMoverOpcode(WorldPacket &recvData)
void HandleMoveKnockBackAck(WorldPacket &recvPacket)
@ CMSG_MOVE_FORCE_SWIM_SPEED_CHANGE_ACK
@ CMSG_MOVE_APPLY_MOVEMENT_FORCE_ACK
@ CMSG_MOVE_FORCE_TURN_RATE_CHANGE_ACK
@ CMSG_MOVE_FORCE_WALK_SPEED_CHANGE_ACK
@ CMSG_MOVE_FORCE_FLIGHT_SPEED_CHANGE_ACK
@ CMSG_MOVE_FORCE_RUN_SPEED_CHANGE_ACK
@ CMSG_MOVE_FORCE_RUN_BACK_SPEED_CHANGE_ACK
@ CMSG_MOVE_FORCE_SWIM_BACK_SPEED_CHANGE_ACK
@ CMSG_MOVE_FORCE_PITCH_RATE_CHANGE_ACK
@ SMSG_MOVE_UPDATE_KNOCK_BACK
@ CMSG_MOVE_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK
bool BoardOwnerHunterPet(Player *owner, Transport *transport)
void RemoveOwnerHunterPet(Player *owner, Transport *transport)
bool IsPassengerOffsetWithinLimit(float x, float y, float z, float limit)
bool IsValidMapCoord(float c)
bool IsBattlegroundOrArena() const
struct MovementInfo::TransportInfo transport
uint32 GetMovementFlags() const
float GetPositionZ() const
float GetOrientation() const
bool IsPositionValid() const
void SetOrientation(float orientation)
float GetPositionX() const
float GetPositionY() const
void Relocate(float x, float y)