TrinityCore
Loading...
Searching...
No Matches
MovementHandler.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "WorldSession.h"
20#include "Battleground.h"
21#include "Corpse.h"
22#include "DB2Stores.h"
24#include "GameTime.h"
25#include "Garrison.h"
26#include "InstanceLockMgr.h"
27#include "InstancePackets.h"
28#include "Log.h"
29#include "Map.h"
30#include "MapManager.h"
31#include "MiscPackets.h"
32#include "MotionMaster.h"
33#include "MoveSpline.h"
34#include "MovementGenerator.h"
35#include "MovementPackets.h"
36#include "Player.h"
37#include "SpellInfo.h"
38#include "SpellMgr.h"
39#include "Transport.h"
40#include "Vehicle.h"
41#include <boost/accumulators/framework/accumulator_set.hpp>
42#include <boost/accumulators/framework/features.hpp>
43#include <boost/accumulators/statistics/mean.hpp>
44#include <boost/accumulators/statistics/median.hpp>
45#include <boost/accumulators/statistics/variance.hpp>
46#include <boost/circular_buffer.hpp>
47
49{
52 #ifdef TRINITY_DEBUG
53 #define REMOVE_VIOLATING_FLAGS(check, maskToRemove) do \
54 { \
55 if (check) \
56 { \
57 TC_LOG_DEBUG("entities.unit", "Player::ValidateMovementInfo: Violation of MovementFlags found ({}). " \
58 "MovementFlags: {}, MovementFlags2: {}, MovementFlags3: {} for player {}. Mask {} will be removed.", \
59 STRINGIZE(check), mi->GetMovementFlags(), mi->GetExtraMovementFlags(), mi->GetExtraMovementFlags2(), GetPlayer()->GetGUID(), maskToRemove); \
60 mi->RemoveMovementFlag((maskToRemove)); \
61 } \
62 } while (0)
63 #else
64 #define REMOVE_VIOLATING_FLAGS(check, maskToRemove) do \
65 { \
66 if (check) \
67 mi->RemoveMovementFlag((maskToRemove)); \
68 } while (0)
69 #endif
70
71 Unit* mover = _player->GetUnitBeingMoved();
72
73 if (!mover || mi->guid != mover->GetGUID())
74 return false;
75
76 if (!mi->pos.IsPositionValid())
77 return false;
78
79 if (!GetPlayer()->GetVehicleBase() || !(GetPlayer()->GetVehicle()->GetVehicleInfo()->Flags & VEHICLE_FLAG_FIXED_POSITION))
81
88
92
96
100
104
108
112
118
122
130 !mover->HasAuraType(SPELL_AURA_FLY) &&
134
137
139
140 // Client first checks if spline elevation != 0, then verifies flag presence
141 if (G3D::fuzzyNe(mi->stepUpStartElevation, 0.0f))
143
144 #undef REMOVE_VIOLATING_FLAGS
145
146 return true;
147}
148
156
158{
159 Player* player = GetPlayer();
160 // ignore unexpected far teleports
161 bool seamlessTeleport = player->GetTeleportOptions().HasFlag(TELE_TO_SEAMLESS);
163
164 // get the teleport destination
165 TeleportLocation const& loc = player->GetTeleportDest();
166
167 // possible errors in the coordinate validity check
169 {
170 LogoutPlayer(false);
171 return;
172 }
173
174 // get the destination map entry, not the current one, this will fix homebind and reset greeting
175 MapEntry const* mEntry = sMapStore.LookupEntry(loc.Location.GetMapId());
176
177 // reset instance validity, except if going to an instance inside an instance
178 if (player->m_InstanceValid == false && !mEntry->IsDungeon())
179 player->m_InstanceValid = true;
180
181 Map* oldMap = player->GetMap();
182 Map* newMap = loc.InstanceId ?
183 sMapMgr->FindMap(loc.Location.GetMapId(), *loc.InstanceId) :
184 sMapMgr->CreateMap(loc.Location.GetMapId(), GetPlayer(), loc.LfgDungeonsId);
185
186 if (TransportBase* transport = player->GetTransport())
187 transport->RemovePassenger(player);
188
189 if (player->IsInWorld())
190 {
191 TC_LOG_ERROR("network", "{} {} is still in world when teleported from map {} ({}) to new map {} ({})", player->GetGUID().ToString(), player->GetName(), oldMap->GetMapName(), oldMap->GetId(), newMap ? newMap->GetMapName() : "Unknown", loc.Location.GetMapId());
192 oldMap->RemovePlayerFromMap(player, false);
193 }
194
195 // relocate the player to the teleport destination
196 // the CannotEnter checks are done in TeleporTo but conditions may change
197 // while the player is in transit, for example the map may get full
198 if (!newMap || newMap->CannotEnter(player))
199 {
200 TC_LOG_ERROR("network", "Map {} ({}) could not be created for player {} ({}), porting player to homebind", loc.Location.GetMapId(), newMap ? newMap->GetMapName() : "Unknown", player->GetGUID().ToString(), player->GetName());
201 player->TeleportTo(player->m_homebind);
202 return;
203 }
204
205 float z = loc.Location.GetPositionZ() + player->GetHoverOffset();
207 player->SetFallInformation(0, player->GetPositionZ());
208
209 player->ResetMap();
210 player->SetMap(newMap);
211 player->UpdatePositionData();
212
214 resumeToken.SequenceIndex = player->m_movementCounter;
215 resumeToken.Reason = seamlessTeleport ? 2 : 1;
216 SendPacket(resumeToken.Write());
217
218 if (!seamlessTeleport)
220
221 if (player->m_teleport_dest.TransportGuid)
222 {
223 if (GameObject* go = newMap->GetTransport(*player->m_teleport_dest.TransportGuid))
224 {
225 if (TransportBase* newTransport = go->ToTransportBase())
226 {
227 newTransport->AddPassenger(player, loc.Location);
228 player->Relocate(newTransport->GetPositionWithOffset(loc.Location));
229 }
230 }
231 }
232 else if (TransportBase* transport = player->GetTransport())
233 transport->RemovePassenger(player);
234
235 if (!player->GetMap()->AddPlayerToMap(player, !seamlessTeleport))
236 {
237 TC_LOG_ERROR("network", "WORLD: failed to teleport player {} {} to map {} ({}) because of unknown reason!",
238 player->GetName(), player->GetGUID().ToString(), loc.Location.GetMapId(), newMap ? newMap->GetMapName() : "Unknown");
239 player->ResetMap();
240 player->SetMap(oldMap);
241 player->TeleportTo(player->m_homebind);
242 return;
243 }
244
245 // battleground state prepare (in case join to BG), at relogin/tele player not invited
246 // only add to bg group and object, if the player was invited (else he entered through command)
247 if (player->InBattleground())
248 {
249 // cleanup setting if outdated
250 if (!mEntry->IsBattlegroundOrArena())
251 {
252 // We're not in BG
254 // reset destination bg team
255 player->SetBGTeam(TEAM_OTHER);
256 }
257 // join to bg case
258 else if (Battleground* bg = player->GetBattleground())
259 {
261 bg->AddPlayer(player, player->m_bgData.queueId);
262 }
263 }
264
265 if (!seamlessTeleport)
267 else
268 {
270 if (Garrison* garrison = player->GetGarrison())
271 garrison->SendRemoteInfo();
272 }
273
274 // flight fast teleport case
275 if (player->IsInFlight())
276 {
277 if (!player->InBattleground())
278 {
279 if (!seamlessTeleport)
280 {
281 // short preparations to continue flight
282 MovementGenerator* movementGenerator = player->GetMotionMaster()->GetCurrentMovementGenerator();
283 movementGenerator->Initialize(player);
284 }
285 return;
286 }
287
288 // battleground state prepare, stop flight
289 player->FinishTaxiFlight();
290 }
291
292 if (!player->IsAlive() && player->GetTeleportOptions().HasFlag(TELE_REVIVE_AT_TELEPORT))
293 player->ResurrectPlayer(0.5f);
294
295 // resurrect character at enter into instance where his corpse exist after add to map
296 if (mEntry->IsDungeon() && !player->IsAlive())
297 {
298 if (player->GetCorpseLocation().GetMapId() == mEntry->ID)
299 {
300 player->ResurrectPlayer(0.5f);
301 player->SpawnCorpseBones();
302 }
303 }
304
305 if (mEntry->IsDungeon())
306 {
307 // check if this instance has a reset time and send it to player if so
308 MapDb2Entries entries{ mEntry->ID, newMap->GetDifficultyID() };
309 if (entries.MapDifficulty->HasResetSchedule())
310 {
312 raidInstanceMessage.Type = RAID_INSTANCE_WELCOME;
313 raidInstanceMessage.MapID = mEntry->ID;
314 raidInstanceMessage.DifficultyID = newMap->GetDifficultyID();
315 if (InstanceLock const* playerLock = sInstanceLockMgr.FindActiveInstanceLock(GetPlayer()->GetGUID(), entries))
316 {
317 raidInstanceMessage.Locked = !playerLock->IsExpired();
318 raidInstanceMessage.Extended = playerLock->IsExtended();
319 }
320 else
321 {
322 raidInstanceMessage.Locked = false;
323 raidInstanceMessage.Extended = false;
324 }
325 SendPacket(raidInstanceMessage.Write());
326 }
327
328 // check if instance is valid
329 if (!player->CheckInstanceValidity(false))
330 player->m_InstanceValid = false;
331 }
332
333 // update zone immediately, otherwise leave channel will cause crash in mtmap
334 uint32 newzone, newarea;
335 player->GetZoneAndAreaId(newzone, newarea);
336 player->UpdateZone(newzone, newarea);
337
338 // honorless target
339 if (player->pvpInfo.IsHostile)
340 player->CastSpell(player, 2479, true);
341
342 // in friendly area
343 else if (player->IsPvP() && !player->HasPlayerFlag(PLAYER_FLAGS_IN_PVP))
344 player->UpdatePvP(false, false);
345
346 // resummon pet
349
350 //lets process all delayed operations on successful teleport
351 player->ProcessDelayedOperations();
352}
353
355{
357 return;
358
360
361 if (sMapStore.AssertEntry(loc.Location.GetMapId())->IsDungeon())
362 {
364 updateLastInstance.MapID = loc.Location.GetMapId();
365 SendPacket(updateLastInstance.Write());
366 }
367
369 packet.MapID = loc.Location.GetMapId();
370 packet.Loc.Pos = loc.Location;
373 SendPacket(packet.Write());
374
376
379}
380
382{
383 TC_LOG_DEBUG("network", "CMSG_MOVE_TELEPORT_ACK: Guid: {}, Sequence: {}, Time: {}", packet.MoverGUID.ToString(), packet.AckIndex, packet.MoveTime);
384
385 Player* plMover = _player->GetUnitBeingMoved()->ToPlayer();
386
387 if (!plMover || plMover->GetTeleportState() != TeleportState::WaitingForTeleportAck)
388 return;
389
390 if (packet.MoverGUID != plMover->GetGUID())
391 return;
392
394
395 uint32 old_zone = plMover->GetZoneId();
396
397 TeleportLocation const& dest = plMover->GetTeleportDest();
398 WorldLocation destLocation = dest.Location;
399
400 if (dest.TransportGuid)
401 {
402 if (GameObject* go = plMover->GetMap()->GetGameObject(*dest.TransportGuid))
403 {
404 if (TransportBase* transport = go->ToTransportBase())
405 {
406 transport->AddPassenger(plMover, destLocation);
407 destLocation.Relocate(transport->GetPositionWithOffset(plMover->m_movementInfo.transport.pos));
408 }
409 }
410 }
411
412 plMover->UpdatePosition(destLocation, true);
413 plMover->SetFallInformation(0, GetPlayer()->GetPositionZ());
414
415 uint32 newzone, newarea;
416 plMover->GetZoneAndAreaId(newzone, newarea);
417 plMover->UpdateZone(newzone, newarea);
418
419 // new zone
420 if (old_zone != newzone)
421 {
422 // honorless target
423 if (plMover->pvpInfo.IsHostile)
424 plMover->CastSpell(plMover, 2479, true);
425
426 // in friendly area
427 else if (plMover->IsPvP() && !plMover->HasPlayerFlag(PLAYER_FLAGS_IN_PVP))
428 plMover->UpdatePvP(false, false);
429 }
430
431 // resummon pet
433
434 //lets process all delayed operations on successful teleport
436}
437
442
444{
445 if (!ValidateMovementInfo(&movementInfo))
446 return;
447
448 Unit* mover = _player->GetUnitBeingMoved();
449 Player* plrMover = mover->ToPlayer();
450
451 TC_LOG_TRACE("opcodes.movement", "HandleMovementOpcode Name {}: opcode {} {} Flags {} Flags2 {} Flags3 {} Pos {}",
452 mover->GetName(), opcode, GetOpcodeNameForLogging(opcode),
453 movementInfo.flags, movementInfo.flags2, movementInfo.flags3, movementInfo.pos);
454
455 // ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck
456 if (plrMover && plrMover->IsBeingTeleported())
457 return;
458
459 if (!mover->movespline->Finalized())
460 return;
461
462 // stop some emotes at player move
463 if (plrMover && (plrMover->GetEmoteState() != 0))
465
466 /* handle special cases */
467 if (!movementInfo.transport.guid.IsEmpty())
468 {
469 // We were teleported, skip packets that were broadcast before teleport
470 if (movementInfo.pos.GetExactDist2d(mover) > SIZE_OF_GRIDS)
471 return;
472
473 // transports size limited
474 // (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped)
475 if (fabs(movementInfo.transport.pos.GetPositionX()) > 75.0f || fabs(movementInfo.transport.pos.GetPositionY()) > 75.0f || fabs(movementInfo.transport.pos.GetPositionZ()) > 75.0f)
476 return;
477
478 if (!Trinity::IsValidMapCoord(movementInfo.pos.GetPositionX() + movementInfo.transport.pos.GetPositionX(), movementInfo.pos.GetPositionY() + movementInfo.transport.pos.GetPositionY(),
479 movementInfo.pos.GetPositionZ() + movementInfo.transport.pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.transport.pos.GetOrientation()))
480 return;
481
482 // if we boarded a transport, add us to it
483 if (plrMover)
484 {
485 if (!plrMover->GetTransport())
486 {
487 if (GameObject* go = plrMover->GetMap()->GetGameObject(movementInfo.transport.guid))
488 if (TransportBase* transport = go->ToTransportBase())
489 transport->AddPassenger(plrMover, movementInfo.transport.pos);
490 }
491 else if (plrMover->GetTransport()->GetTransportGUID() != movementInfo.transport.guid)
492 {
493 plrMover->GetTransport()->RemovePassenger(plrMover);
494 if (GameObject* go = plrMover->GetMap()->GetGameObject(movementInfo.transport.guid))
495 {
496 if (TransportBase* transport = go->ToTransportBase())
497 transport->AddPassenger(plrMover, movementInfo.transport.pos);
498 else
499 movementInfo.ResetTransport();
500 }
501 else
502 movementInfo.ResetTransport();
503 }
504 }
505
506 if (!mover->GetTransport() && !mover->GetVehicle())
507 movementInfo.transport.Reset();
508 }
509 else if (plrMover && plrMover->GetTransport()) // if we were on a transport, leave
510 plrMover->GetTransport()->RemovePassenger(plrMover);
511
512 // fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map).
513 if (opcode == CMSG_MOVE_FALL_LAND && plrMover && !plrMover->IsInFlight())
514 plrMover->HandleFall(movementInfo);
515
516 // interrupt parachutes upon falling or landing in water
517 if (opcode == CMSG_MOVE_FALL_LAND || opcode == CMSG_MOVE_START_SWIM || opcode == CMSG_MOVE_SET_FLY)
519
520 if (opcode == CMSG_MOVE_SET_FLY || opcode == CMSG_MOVE_SET_ADV_FLY)
521 {
522 _player->UnsummonPetTemporaryIfAny(); // always do the pet removal on current client activeplayer only
524 }
525
526 /* process position-change */
527 movementInfo.guid = mover->GetGUID();
528 movementInfo.time = AdjustClientMovementTime(movementInfo.time);
529 mover->m_movementInfo = movementInfo;
530
531 // Some vehicles allow the passenger to turn by himself
532 if (Vehicle* vehicle = mover->GetVehicle())
533 {
534 if (VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(mover))
535 {
536 if (seat->Flags & VEHICLE_SEAT_FLAG_ALLOW_TURNING)
537 {
538 if (movementInfo.pos.GetOrientation() != mover->GetOrientation())
539 {
540 mover->SetOrientation(movementInfo.pos.GetOrientation());
542 }
543 }
544 }
545 return;
546 }
547
548 mover->UpdatePosition(movementInfo.pos);
549
551 moveUpdate.Status = &mover->m_movementInfo;
552 mover->SendMessageToSet(moveUpdate.Write(), _player);
553
554 if (plrMover) // nothing is charmed, or player charmed
555 {
556 if (plrMover->IsSitState() && (movementInfo.flags & (MOVEMENTFLAG_MASK_MOVING | MOVEMENTFLAG_MASK_TURNING)))
558
559 plrMover->UpdateFallInformationIfNeed(movementInfo, opcode);
560
561 if (movementInfo.pos.GetPositionZ() < plrMover->GetMap()->GetMinHeight(plrMover->GetPhaseShift(), movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY()))
562 {
563 if (!(plrMover->GetBattleground() && plrMover->GetBattleground()->HandlePlayerUnderMap(_player)))
564 {
565 // NOTE: this is actually called many times while falling
566 // even after the player has been teleported away
568 if (plrMover->IsAlive())
569 {
570 TC_LOG_DEBUG("entities.player.falldamage", "FALLDAMAGE Below map. Map min height: {} , Player debug info:\n{}", plrMover->GetMap()->GetMinHeight(plrMover->GetPhaseShift(), movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY()), plrMover->GetDebugInfo());
572 plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
573 // player can be alive if GM/etc
574 // change the death state to CORPSE to prevent the death timer from
575 // starting in the next player update
576 if (plrMover->IsAlive())
577 plrMover->KillPlayer();
578 }
579 }
580 }
581 else
583
584 if (opcode == CMSG_MOVE_JUMP)
585 {
588 }
589
590 // Whenever a player stops a movement action, several position based checks and updates are being performed
591 switch (opcode)
592 {
595 case CMSG_MOVE_STOP:
601 plrMover->UpdateZoneAndAreaId();
602 plrMover->UpdateIndoorsOutdoorsAuras();
603 plrMover->UpdateTavernRestingState();
604 break;
605 default:
606 break;
607 }
608 }
609}
610
612{
613 if (!ValidateMovementInfo(&packet.Ack.Status))
614 return;
615
616 /*----------------*/
617
618 // client ACK send one packet for mounted/run case and need skip all except last from its
619 // in other cases anti-cheat check can be fail in false case
620 UnitMoveType move_type;
621
622 static char const* const move_type_name[MAX_MOVE_TYPE] =
623 {
624 "Walk",
625 "Run",
626 "RunBack",
627 "Swim",
628 "SwimBack",
629 "TurnRate",
630 "Flight",
631 "FlightBack",
632 "PitchRate"
633 };
634
635 OpcodeClient opcode = packet.GetOpcode();
636 switch (opcode)
637 {
638
639 case CMSG_MOVE_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; break;
640 case CMSG_MOVE_FORCE_RUN_SPEED_CHANGE_ACK: move_type = MOVE_RUN; break;
642 case CMSG_MOVE_FORCE_SWIM_SPEED_CHANGE_ACK: move_type = MOVE_SWIM; break;
648
649 default:
650 TC_LOG_ERROR("network", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: {}", opcode);
651 return;
652 }
653
654 // skip all forced speed changes except last and unexpected
655 // in run/mounted case used one ACK and it must be skipped. m_forced_speed_changes[MOVE_RUN] store both.
656 if (_player->m_forced_speed_changes[move_type] > 0)
657 {
658 --_player->m_forced_speed_changes[move_type];
659 if (_player->m_forced_speed_changes[move_type] > 0)
660 return;
661 }
662
663 if (!_player->GetTransport() && std::fabs(_player->GetSpeed(move_type) - packet.Speed) > 0.01f)
664 {
665 if (_player->GetSpeed(move_type) > packet.Speed) // must be greater - just correct
666 {
667 TC_LOG_ERROR("network", "{}SpeedChange player {} is NOT correct (must be {} instead {}), force set to correct value",
668 move_type_name[move_type], _player->GetName(), _player->GetSpeed(move_type), packet.Speed);
669 _player->SetSpeedRate(move_type, _player->GetSpeedRate(move_type));
670 }
671 else // must be lesser - cheating
672 {
673 TC_LOG_DEBUG("misc", "Player {} from account id {} kicked for incorrect speed (must be {} instead {})",
674 _player->GetName(), _player->GetSession()->GetAccountId(), _player->GetSpeed(move_type), packet.Speed);
675 _player->GetSession()->KickPlayer("WorldSession::HandleForceSpeedChangeAck Incorrect speed");
676 }
677 }
678}
679
684
689
691{
692 if (GetPlayer()->IsInWorld())
693 if (_player->GetUnitBeingMoved()->GetGUID() != packet.ActiveMover)
694 TC_LOG_DEBUG("network", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is {} and should be {}" , packet.ActiveMover.ToString(), _player->GetUnitBeingMoved()->GetGUID().ToString());
695}
696
698{
699 if (!ValidateMovementInfo(&movementAck.Ack.Status))
700 return;
701
702 movementAck.Ack.Status.time = AdjustClientMovementTime(movementAck.Ack.Status.time);
703 _player->m_movementInfo = movementAck.Ack.Status;
704
706 updateKnockBack.Status = &_player->m_movementInfo;
707 _player->SendMessageToSet(updateKnockBack.Write(), false);
708}
709
714
722
727
729{
730 if (!ValidateMovementInfo(&moveApplyMovementForceAck.Ack.Status))
731 return;
732
733 Unit* mover = _player->m_unitMovedByMe;
734 moveApplyMovementForceAck.Ack.Status.time = AdjustClientMovementTime(moveApplyMovementForceAck.Ack.Status.time);
735
737 updateApplyMovementForce.Status = &moveApplyMovementForceAck.Ack.Status;
738 updateApplyMovementForce.Force = &moveApplyMovementForceAck.Force;
739 mover->SendMessageToSet(updateApplyMovementForce.Write(), false);
740}
741
743{
744 if (!ValidateMovementInfo(&moveRemoveMovementForceAck.Ack.Status))
745 return;
746
747 Unit* mover = _player->m_unitMovedByMe;
748
749 moveRemoveMovementForceAck.Ack.Status.time = AdjustClientMovementTime(moveRemoveMovementForceAck.Ack.Status.time);
750
752 updateRemoveMovementForce.Status = &moveRemoveMovementForceAck.Ack.Status;
753 updateRemoveMovementForce.TriggerGUID = moveRemoveMovementForceAck.ID;
754 mover->SendMessageToSet(updateRemoveMovementForce.Write(), false);
755}
756
758{
759 if (!ValidateMovementInfo(&setModMovementForceMagnitudeAck.Ack.Status))
760 return;
761
762 Unit* mover = _player->m_unitMovedByMe;
763
764 // skip all except last
766 {
769 {
770 float expectedModMagnitude = 1.0f;
771 if (MovementForces const* movementForces = mover->GetMovementForces())
772 expectedModMagnitude = movementForces->GetModMagnitude();
773
774 if (std::fabs(expectedModMagnitude - setModMovementForceMagnitudeAck.Speed) > 0.01f)
775 {
776 TC_LOG_DEBUG("misc", "Player {} from account id {} kicked for incorrect movement force magnitude (must be {} instead {})",
777 _player->GetName(), _player->GetSession()->GetAccountId(), expectedModMagnitude, setModMovementForceMagnitudeAck.Speed);
778 _player->GetSession()->KickPlayer("WorldSession::HandleMoveSetModMovementForceMagnitudeAck Incorrect magnitude");
779 return;
780 }
781 }
782 }
783
784 setModMovementForceMagnitudeAck.Ack.Status.time = AdjustClientMovementTime(setModMovementForceMagnitudeAck.Ack.Status.time);
785
787 updateModMovementForceMagnitude.Status = &setModMovementForceMagnitudeAck.Ack.Status;
788 updateModMovementForceMagnitude.Speed = setModMovementForceMagnitudeAck.Speed;
789 mover->SendMessageToSet(updateModMovementForceMagnitude.Write(), false);
790}
791
793{
794 if (!ValidateMovementInfo(&moveSplineDone.Status))
795 return;
796
797 // in taxi flight packet received in 2 case:
798 // 1) end taxi path in far (multi-node) flight
799 // 2) switch from one map to other in case multim-map taxi path
800 // we need process only (1)
801
803 if (curDest)
804 {
805 TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest);
806
807 // far teleport case
808 if (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
809 {
810 if (FlightPathMovementGenerator* flight = dynamic_cast<FlightPathMovementGenerator*>(GetPlayer()->GetMotionMaster()->GetCurrentMovementGenerator()))
811 {
812 bool shouldTeleport = curDestNode && curDestNode->ContinentID != GetPlayer()->GetMapId();
813 if (!shouldTeleport)
814 {
815 TaxiPathNodeEntry const* currentNode = flight->GetPath()[flight->GetCurrentNode()];
816 shouldTeleport = currentNode->Flags & TAXI_PATH_NODE_FLAG_TELEPORT;
817 }
818
819 if (shouldTeleport)
820 {
821 // short preparations to continue flight
822 flight->SetCurrentNodeAfterTeleport();
823 TaxiPathNodeEntry const* node = flight->GetPath()[flight->GetCurrentNode()];
824 flight->SkipCurrentNode();
825
826 GetPlayer()->TeleportTo(curDestNode->ContinentID, node->Loc.X, node->Loc.Y, node->Loc.Z, GetPlayer()->GetOrientation());
827 }
828 }
829 }
830
831 return;
832 }
833
834 // at this point only 1 node is expected (final destination)
835 if (GetPlayer()->m_taxi.GetPath().size() != 1)
836 return;
837
839 GetPlayer()->SetFallInformation(0, GetPlayer()->GetPositionZ());
840 if (GetPlayer()->pvpInfo.IsHostile)
841 GetPlayer()->CastSpell(GetPlayer(), 2479, true);
842}
843
845{
846 Unit* mover = GetPlayer()->m_unitMovedByMe;
847 if (!mover)
848 {
849 TC_LOG_WARN("entities.player", "WorldSession::HandleMoveTimeSkippedOpcode wrong mover state from the unit moved by {}", GetPlayer()->GetGUID().ToString());
850 return;
851 }
852
853 // prevent tampered movement data
854 if (moveTimeSkipped.MoverGUID != mover->GetGUID())
855 {
856 TC_LOG_WARN("entities.player", "WorldSession::HandleMoveTimeSkippedOpcode wrong guid from the unit moved by {}", GetPlayer()->GetGUID().ToString());
857 return;
858 }
859
860 mover->m_movementInfo.time += moveTimeSkipped.TimeSkipped;
861
863 moveSkipTime.MoverGUID = moveTimeSkipped.MoverGUID;
864 moveSkipTime.TimeSkipped = moveTimeSkipped.TimeSkipped;
865 mover->SendMessageToSet(moveSkipTime.Write(), _player);
866}
867
868void WorldSession::HandleTimeSync(uint32 counter, int64 clientTime, TimePoint responseReceiveTime)
869{
870 auto serverTimeAtSent = _pendingTimeSyncRequests.extract(counter);
871 if (!serverTimeAtSent)
872 return;
873
874 // time it took for the request to travel to the client, for the client to process it and reply and for response to travel back to the server.
875 // we are going to make 2 assumptions:
876 // 1) we assume that the request processing time equals 0.
877 // 2) we assume that the packet took as much time to travel from server to client than it took to travel from client to server.
878 uint32 roundTripDuration = getMSTimeDiff(serverTimeAtSent.mapped(), responseReceiveTime);
879 int64 lagDelay = roundTripDuration / 2;
880
881 /*
882 clockDelta = serverTime - clientTime
883 where
884 serverTime: time that was displayed on the clock of the SERVER at the moment when the client processed the SMSG_TIME_SYNC_REQUEST packet.
885 clientTime: time that was displayed on the clock of the CLIENT at the moment when the client processed the SMSG_TIME_SYNC_REQUEST packet.
886
887 Once clockDelta has been computed, we can compute the time of an event on server clock when we know the time of that same event on the client clock,
888 using the following relation:
889 serverTime = clockDelta + clientTime
890 */
891 int64 clockDelta = serverTimeAtSent.mapped() + lagDelay - clientTime;
892 _timeSyncClockDeltaQueue->push_back(std::pair<int64, uint32>(clockDelta, roundTripDuration));
894}
895
897{
898 HandleTimeSync(timeSyncResponse.SequenceIndex, timeSyncResponse.ClientTime, timeSyncResponse.GetReceivedTime());
899}
900
905
912
914{
915 // implementation of the technique described here: https://web.archive.org/web/20180430214420/http://www.mine-control.com/zack/timesync/timesync.html
916 // to reduce the skew induced by dropped TCP packets that get resent.
917
918 using namespace boost::accumulators;
919
920 accumulator_set<uint32, features<tag::mean, tag::median, tag::variance(lazy)> > latencyAccumulator;
921
922 for (auto [_, roundTripDuration] : *_timeSyncClockDeltaQueue)
923 latencyAccumulator(roundTripDuration);
924
925 uint32 latencyMedian = static_cast<uint32>(std::round(median(latencyAccumulator)));
926 uint32 latencyStandardDeviation = static_cast<uint32>(std::round(sqrt(variance(latencyAccumulator))));
927
928 accumulator_set<int64, features<tag::mean> > clockDeltasAfterFiltering;
929 uint32 sampleSizeAfterFiltering = 0;
930 for (auto [clockDelta, roundTripDuration] : *_timeSyncClockDeltaQueue)
931 {
932 if (roundTripDuration < latencyStandardDeviation + latencyMedian) {
933 clockDeltasAfterFiltering(clockDelta);
934 sampleSizeAfterFiltering++;
935 }
936 }
937
938 if (sampleSizeAfterFiltering != 0)
939 {
940 int64 meanClockDelta = static_cast<int64>(std::round(mean(clockDeltasAfterFiltering)));
941 if (std::abs(meanClockDelta - _timeSyncClockDelta) > 25)
942 _timeSyncClockDelta = meanClockDelta;
943 }
944 else if (_timeSyncClockDelta == 0)
946
947 if (_player)
948 {
951 }
952}
@ SEC_PLAYER
Definition Common.h:43
DB2Storage< MapEntry > sMapStore("Map.db2", &MapLoadInfo::Instance)
DB2Storage< TaxiNodesEntry > sTaxiNodesStore("TaxiNodes.db2", &TaxiNodesLoadInfo::Instance)
@ VEHICLE_SEAT_FLAG_ALLOW_TURNING
Definition DBCEnums.h:3102
@ TAXI_PATH_NODE_FLAG_TELEPORT
Definition DBCEnums.h:2816
int64_t int64
Definition Define.h:149
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
std::chrono::steady_clock::time_point TimePoint
time_point shorthand typedefs
Definition Duration.h:40
#define SIZE_OF_GRIDS
Definition GridDefines.h:40
#define sInstanceLockMgr
#define TC_LOG_DEBUG(filterType__, message__,...)
Definition Log.h:181
#define TC_LOG_ERROR(filterType__, message__,...)
Definition Log.h:190
#define TC_LOG_WARN(filterType__, message__,...)
Definition Log.h:187
#define TC_LOG_TRACE(filterType__, message__,...)
Definition Log.h:178
#define sMapMgr
Definition MapManager.h:186
@ FLIGHT_MOTION_TYPE
#define REMOVE_VIOLATING_FLAGS(check, maskToRemove)
@ SMSG_MOVE_UPDATE_MOD_MOVEMENT_FORCE_MAGNITUDE
Definition Opcodes.h:1968
constexpr FormattedOpcodeName< OpcodeClient > GetOpcodeNameForLogging(OpcodeClient opcode)
Lookup opcode name for human understandable logging.
Definition Opcodes.h:2603
OpcodeClient
Definition Opcodes.h:38
@ CMSG_MOVE_SET_ADV_FLY
Definition Opcodes.h:630
@ CMSG_MOVE_FORCE_SWIM_SPEED_CHANGE_ACK
Definition Opcodes.h:612
@ CMSG_MOVE_STOP_SWIM
Definition Opcodes.h:678
@ CMSG_MOVE_START_SWIM
Definition Opcodes.h:671
@ CMSG_MOVE_FORCE_TURN_RATE_CHANGE_ACK
Definition Opcodes.h:613
@ CMSG_MOVE_STOP_TURN
Definition Opcodes.h:679
@ CMSG_MOVE_FORCE_WALK_SPEED_CHANGE_ACK
Definition Opcodes.h:615
@ CMSG_MOVE_FORCE_FLIGHT_SPEED_CHANGE_ACK
Definition Opcodes.h:605
@ CMSG_MOVE_STOP_STRAFE
Definition Opcodes.h:677
@ CMSG_MOVE_STOP_ASCEND
Definition Opcodes.h:675
@ CMSG_MOVE_FORCE_RUN_SPEED_CHANGE_ACK
Definition Opcodes.h:610
@ CMSG_MOVE_FORCE_RUN_BACK_SPEED_CHANGE_ACK
Definition Opcodes.h:609
@ CMSG_MOVE_STOP
Definition Opcodes.h:674
@ CMSG_MOVE_FORCE_SWIM_BACK_SPEED_CHANGE_ACK
Definition Opcodes.h:611
@ CMSG_MOVE_FORCE_PITCH_RATE_CHANGE_ACK
Definition Opcodes.h:607
@ CMSG_MOVE_FALL_LAND
Definition Opcodes.h:601
@ CMSG_MOVE_STOP_PITCH
Definition Opcodes.h:676
@ CMSG_MOVE_JUMP
Definition Opcodes.h:625
@ CMSG_MOVE_SET_FLY
Definition Opcodes.h:653
@ CMSG_MOVE_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK
Definition Opcodes.h:604
@ DAMAGE_FALL_TO_VOID
Definition Player.h:944
@ NEW_WORLD_NORMAL
Definition Player.h:882
@ NEW_WORLD_SEAMLESS
Definition Player.h:883
@ TELE_TO_SEAMLESS
Definition Player.h:930
@ TELE_REVIVE_AT_TELEPORT
Definition Player.h:929
@ PLAYER_FLAGS_IN_PVP
Definition Player.h:529
@ PLAYER_FLAGS_IS_OUT_OF_BOUNDS
Definition Player.h:534
@ PLAYER_LOCAL_FLAG_OVERRIDE_TRANSPORT_SERVER_TIME
Definition Player.h:585
@ RAID_INSTANCE_WELCOME
Definition Player.h:888
@ WaitingForSuspendTokenResponse
@ EMOTE_ONESHOT_NONE
constexpr BattlegroundQueueTypeId BATTLEGROUND_QUEUE_NONE
@ TEAM_OTHER
@ BATTLEGROUND_TYPE_NONE
@ SPELL_AURA_FEATHER_FALL
@ SPELL_AURA_FLY
@ SPELL_AURA_GHOST
@ SPELL_AURA_WATER_WALK
@ SPELL_AURA_HOVER
@ SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
@ SPELL_AURA_ADV_FLYING
@ PROC_SPELL_PHASE_NONE
Definition SpellMgr.h:223
@ PROC_SPELL_TYPE_MASK_ALL
Definition SpellMgr.h:216
@ PROC_FLAG_JUMP
Definition SpellMgr.h:133
@ PROC_FLAG_NONE
Definition SpellMgr.h:92
@ PROC_HIT_NONE
Definition SpellMgr.h:234
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
Definition Timer.h:40
UnitMoveType
@ MOVE_FLIGHT
@ MOVE_SWIM
@ MOVE_TURN_RATE
@ MOVE_FLIGHT_BACK
@ MOVE_SWIM_BACK
@ MOVE_RUN
@ MOVE_PITCH_RATE
@ MOVE_RUN_BACK
@ MOVE_WALK
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:42
@ MOVEMENTFLAG_DESCENDING
@ MOVEMENTFLAG_PITCH_DOWN
@ MOVEMENTFLAG_PITCH_UP
@ MOVEMENTFLAG_RIGHT
@ MOVEMENTFLAG_FORWARD
@ MOVEMENTFLAG_STRAFE_LEFT
@ MOVEMENTFLAG_BACKWARD
@ MOVEMENTFLAG_WATERWALKING
@ MOVEMENTFLAG_MASK_MOVING
@ MOVEMENTFLAG_DISABLE_GRAVITY
@ MOVEMENTFLAG_FLYING
@ MOVEMENTFLAG_FALLING_SLOW
@ MOVEMENTFLAG_CAN_FLY
@ MOVEMENTFLAG_ROOT
@ MOVEMENTFLAG_MASK_TURNING
@ MOVEMENTFLAG_FALLING
@ MOVEMENTFLAG_LEFT
@ MOVEMENTFLAG_STRAFE_RIGHT
@ MOVEMENTFLAG_ASCENDING
@ MOVEMENTFLAG_HOVER
@ MOVEMENTFLAG_SPLINE_ELEVATION
#define MAX_MOVE_TYPE
@ VEHICLE_FLAG_FIXED_POSITION
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
bool IsInWorld() const
Definition BaseEntity.h:158
virtual bool HandlePlayerUnderMap(Player *)
static bool IsValidMapCoord(uint32 mapid, float x, float y)
Definition MapManager.h:83
Definition Map.h:225
virtual void RemovePlayerFromMap(Player *, bool)
Definition Map.cpp:915
virtual bool AddPlayerToMap(Player *player, bool initPlayer=true)
Definition Map.cpp:382
virtual TransferAbortParams CannotEnter(Player *)
Definition Map.h:356
float GetMinHeight(PhaseShift const &phaseShift, float x, float y)
Definition Map.cpp:1715
GameObject * GetGameObject(ObjectGuid const &guid)
Definition Map.cpp:3552
Difficulty GetDifficultyID() const
Definition Map.h:360
uint32 GetId() const
Definition Map.cpp:3257
char const * GetMapName() const
Definition Map.cpp:1844
Transport * GetTransport(ObjectGuid const &guid)
Definition Map.cpp:3562
MovementGenerator * GetCurrentMovementGenerator() const
virtual void Initialize(Unit *owner)=0
bool IsEmpty() const
Definition ObjectGuid.h:362
std::string ToString() const
Player * ToPlayer()
Definition Object.h:126
uint32 GetTaxiDestination() const
Definition PlayerTaxi.h:78
void SendInitialPacketsAfterAddToMap()
Definition Player.cpp:25074
WorldLocation const & GetCorpseLocation() const
Definition Player.h:2338
void UpdateFallInformationIfNeed(MovementInfo const &minfo, uint32 opcode)
Definition Player.cpp:27936
bool m_InstanceValid
Definition Player.h:2761
void HandleFall(MovementInfo const &movementInfo)
Definition Player.cpp:27499
void SetPlayerFlag(PlayerFlags flags)
Definition Player.h:2911
void SetBGTeam(Team team)
Definition Player.cpp:24352
void SetPlayerLocalFlag(PlayerLocalFlags flags)
Definition Player.h:3008
void RemovePlayerFlag(PlayerFlags flags)
Definition Player.h:2912
uint32 EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
Definition Player.cpp:627
void KillPlayer()
Definition Player.cpp:4460
void SetBattlegroundId(uint32 val, BattlegroundTypeId bgTypeId, BattlegroundQueueTypeId queueId)
Definition Player.cpp:25773
uint8 m_movementForceModMagnitudeChanges
Definition Player.h:2720
bool InBattleground() const
Definition Player.h:2584
void SpawnCorpseBones(bool triggerSave=true)
Definition Player.cpp:4554
void UpdateZone(uint32 newZone, uint32 newArea)
Definition Player.cpp:7602
void SetFallInformation(uint32 time, float z)
Definition Player.cpp:27493
void SendInitialPacketsBeforeAddToMap()
Definition Player.cpp:24955
void ResetMap() override
Definition Player.cpp:28446
WorldLocation m_homebind
Definition Player.h:2693
int32 GetNewWorldCounter() const
Definition Player.h:2401
WorldSession * GetSession() const
Definition Player.h:2272
bool IsInvitedForBattlegroundInstance(uint32 instanceId) const
Definition Player.cpp:25826
void UnsummonPetTemporaryIfAny()
Definition Player.cpp:27985
TeleportState GetTeleportState() const
Definition Player.h:2398
TeleportLocation m_teleport_dest
Definition Player.h:3374
void UpdateVisibilityForPlayer()
Definition Player.cpp:24837
void ResummonBattlePetTemporaryUnSummonedIfAny()
Definition Player.cpp:28034
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options=TELE_TO_NONE, Optional< uint32 > instanceId={}, uint32 teleportSpellId=0)
Definition Player.cpp:1226
void FinishTaxiFlight()
Definition Player.cpp:23356
Battleground * GetBattleground() const
Definition Player.cpp:25719
void ProcessDelayedOperations()
Definition Player.cpp:1489
void UpdateIndoorsOutdoorsAuras()
Definition Player.cpp:6430
bool UpdatePosition(float x, float y, float z, float orientation, bool teleport=false) override
Definition Player.cpp:6232
PvPInfo pvpInfo
Definition Player.h:2124
void SummonIfPossible(bool agree)
Definition Player.cpp:26109
PlayerTaxi m_taxi
Definition Player.h:1293
std::array< uint8, MAX_MOVE_TYPE > m_forced_speed_changes
Definition Player.h:2719
void SetTransportServerTime(int32 transportServerTime)
Definition Player.h:3020
bool CheckInstanceValidity(bool)
Definition Player.cpp:20180
Garrison * GetGarrison() const
Definition Player.h:2883
void UnsummonBattlePetTemporaryIfAny(bool onFlyingMount=false)
Definition Player.cpp:28019
uint32 GetBattlegroundId() const
Definition Player.h:2586
bool HasPlayerFlag(PlayerFlags flags) const
Definition Player.h:2910
TeleportLocation & GetTeleportDest()
Definition Player.h:2397
void UpdateObjectVisibility(bool forced=true) override
Definition Player.cpp:24822
void SetMap(Map *map) override
Definition Player.cpp:28458
std::string GetDebugInfo() const override
Definition Player.cpp:31462
void SendMessageToSet(WorldPacket const *data, bool self) const override
Definition Player.h:2325
void ResummonPetTemporaryUnSummonedIfAny()
Definition Player.cpp:28000
void SetTeleportState(TeleportState state)
Definition Player.h:2399
void UpdatePvP(bool state, bool override=false)
Definition Player.cpp:24109
void CleanupAfterTaxiFlight()
Definition Player.cpp:23365
void UpdateTavernRestingState()
Definition Player.cpp:6436
BGData m_bgData
Definition Player.h:3094
void UpdateZoneAndAreaId()
Definition Player.cpp:6414
bool IsBeingTeleported() const
Definition Player.h:2402
EnumFlag< TeleportToOptions > GetTeleportOptions() const
Definition Player.h:2400
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition Player.cpp:4379
virtual ObjectGuid GetTransportGUID() const =0
virtual void AddPassenger(WorldObject *passenger, Position const &offset)=0
virtual TransportBase * RemovePassenger(WorldObject *passenger)=0
Definition Unit.h:635
Vehicle * GetVehicle() const
Definition Unit.h:1784
Unit * m_unitMovedByMe
Definition Unit.h:1948
float GetSpeed(UnitMoveType mtype) const
Definition Unit.cpp:8932
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition Unit.cpp:10731
Emote GetEmoteState() const
Definition Unit.h:864
bool IsPvP() const
Definition Unit.h:886
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
MovementForces const * GetMovementForces() const
Definition Unit.h:1174
bool IsAlive() const
Definition Unit.h:1185
uint32 m_movementCounter
Incrementing counter used in movement packets.
Definition Unit.h:2006
void SetEmoteState(Emote emote)
Definition Unit.h:865
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition Unit.cpp:13027
bool IsInFlight() const
Definition Unit.h:1027
Unit * GetUnitBeingMoved() const
Definition Unit.h:1251
float GetHoverOffset() const
Definition Unit.h:1812
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:4814
void RemoveAurasWithInterruptFlags(InterruptFlags flag, SpellInfo const *source=nullptr)
Definition Unit.cpp:4241
float GetSpeedRate(UnitMoveType mtype) const
Definition Unit.h:1707
void SetSpeedRate(UnitMoveType mtype, float rate)
Definition Unit.cpp:8942
std::unique_ptr< Movement::MoveSpline > movespline
Definition Unit.h:1838
static void ProcSkillsAndAuras(Unit *actor, Unit *actionTarget, ProcFlagsInit const &typeMaskActor, ProcFlagsInit const &typeMaskActionTarget, ProcFlagsSpellType spellTypeMask, ProcFlagsSpellPhase spellPhaseMask, ProcFlagsHit hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
Definition Unit.cpp:5570
bool IsInCombat() const
Definition Unit.h:1058
bool IsSitState() const
Definition Unit.cpp:10716
constexpr uint32 GetMapId() const
Definition Position.h:216
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:1094
Map * GetMap() const
Definition Object.h:411
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
PhaseShift & GetPhaseShift()
Definition Object.h:310
TransportBase * GetTransport() const
Definition Object.h:537
std::string const & GetName() const
Definition Object.h:342
void UpdatePositionData()
Definition Object.cpp:346
uint32 GetZoneId() const
Definition Object.h:332
MovementInfo m_movementInfo
Definition Object.h:548
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition Object.h:334
TimePoint GetReceivedTime() const
Definition WorldPacket.h:88
OpcodeClient GetOpcode() const
Definition Packet.h:68
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * GetRawPacket() const
Definition Packet.h:38
void LogoutPlayer(bool save)
Log the player out
void HandleMovementOpcode(OpcodeClient opcode, MovementInfo &movementInfo)
void HandleMoveWorldportAck()
void HandleTimeSyncResponse(WorldPackets::Misc::TimeSyncResponse const &timeSyncResponse)
AccountTypes GetSecurity() const
int64 _timeSyncClockDelta
void HandleSetAdvFlyingSpeedRangeAck(WorldPackets::Movement::MovementSpeedRangeAck &speedRangeAck)
void HandleMoveApplyMovementForceAck(WorldPackets::Movement::MoveApplyMovementForceAck &moveApplyMovementForceAck)
uint32 AdjustClientMovementTime(uint32 time) const
bool ValidateMovementInfo(MovementInfo *mi) const
void HandleSetAdvFlyingSpeedAck(WorldPackets::Movement::MovementSpeedAck &speedAck)
void HandleMovementAckMessage(WorldPackets::Movement::MovementAckMessage &movementAck)
void HandleMoveWorldportAckOpcode(WorldPackets::Movement::WorldPortResponse &packet)
static constexpr uint32 SPECIAL_RESUME_COMMS_TIME_SYNC_COUNTER
void HandleTimeSync(uint32 counter, int64 clientTime, TimePoint responseReceiveTime)
static constexpr uint32 SPECIAL_INIT_ACTIVE_MOVER_TIME_SYNC_COUNTER
void HandleMoveSplineDoneOpcode(WorldPackets::Movement::MoveSplineDone &moveSplineDone)
Player * GetPlayer() const
void HandleSetCollisionHeightAck(WorldPackets::Movement::MoveSetCollisionHeightAck &setCollisionHeightAck)
void HandleMovementOpcodes(WorldPackets::Movement::ClientPlayerMovement &packet)
void HandleMoveKnockBackAck(WorldPackets::Movement::MoveKnockBackAck &movementAck)
void ComputeNewClockDelta()
void HandleSetActiveMoverOpcode(WorldPackets::Movement::SetActiveMover &packet)
void HandleMoveSetModMovementForceMagnitudeAck(WorldPackets::Movement::MovementSpeedAck &setModMovementForceMagnitudeAck)
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
uint32 GetAccountId() const
void HandleMoveTimeSkippedOpcode(WorldPackets::Movement::MoveTimeSkipped &moveTimeSkipped)
Player * _player
void HandleMoveRemoveMovementForceAck(WorldPackets::Movement::MoveRemoveMovementForceAck &moveRemoveMovementForceAck)
void HandleForceSpeedChangeAck(WorldPackets::Movement::MovementSpeedAck &packet)
void HandleQueuedMessagesEnd(WorldPackets::Auth::QueuedMessagesEnd const &queuedMessagesEnd)
void HandleMoveInitActiveMoverComplete(WorldPackets::Movement::MoveInitActiveMoverComplete const &moveInitActiveMoverComplete)
std::unique_ptr< boost::circular_buffer< std::pair< int64, uint32 > > > _timeSyncClockDeltaQueue
void HandleSuspendTokenResponse(WorldPackets::Movement::SuspendTokenResponse &suspendTokenResponse)
void HandleSummonResponseOpcode(WorldPackets::Movement::SummonResponse &packet)
void KickPlayer(std::string_view reason)
Kick a player out of the World.
void HandleMoveTeleportAck(WorldPackets::Movement::MoveTeleportAck &packet)
std::map< uint32, int64 > _pendingTimeSyncRequests
bool IsValidMapCoord(float c)
BattlegroundQueueTypeId queueId
Definition Player.h:1152
bool IsBattlegroundOrArena() const
bool IsDungeon() const
ObjectGuid guid
void ResetTransport()
float stepUpStartElevation
struct MovementInfo::TransportInfo transport
bool HasMovementFlag(uint32 flag) const
void AddMovementFlag(uint32 flag)
Position pos
constexpr void SetOrientation(float orientation)
Definition Position.h:82
constexpr float GetPositionX() const
Definition Position.h:87
constexpr float GetPositionY() const
Definition Position.h:88
float GetExactDist2d(const float x, const float y) const
Definition Position.h:117
bool IsPositionValid() const
Definition Position.cpp:42
constexpr void Relocate(float x, float y)
Definition Position.h:74
constexpr float GetOrientation() const
Definition Position.h:90
constexpr float GetPositionZ() const
Definition Position.h:89
bool IsHostile
Definition Player.h:441
DBCPosition3D Loc
Optional< uint32 > InstanceId
Definition Player.h:1228
WorldLocation Location
Definition Player.h:1226
Optional< uint32 > LfgDungeonsId
Definition Player.h:1229
Optional< ObjectGuid > TransportGuid
Definition Player.h:1227
TaggedPosition< Position::XYZO > Pos