aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Unit
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2025-10-16 19:06:19 +0200
committerShauren <shauren.trinity@gmail.com>2025-10-16 19:06:19 +0200
commita0c8e0255c41b3f91a712acc5327234bad7bb2ed (patch)
tree58ac2555ae0a3e172fc8c8b6aac298aef37e7aa3 /src/server/game/Entities/Unit
parent73a32a5757d8eb4ea640c5c53b68cb04646f7639 (diff)
Core/Spells: Fix teleports within transports (like Blink)
Diffstat (limited to 'src/server/game/Entities/Unit')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp13
-rw-r--r--src/server/game/Entities/Unit/Unit.h1
2 files changed, 11 insertions, 3 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 03205c45f78..153d1136dd7 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -12801,20 +12801,24 @@ bool Unit::CanSwim() const
return HasUnitFlag(UNIT_FLAG_RENAME | UNIT_FLAG_CAN_SWIM);
}
-void Unit::NearTeleportTo(Position const& pos, bool casting /*= false*/)
+void Unit::NearTeleportTo(TeleportLocation const& target, bool casting)
{
DisableSpline();
- TeleportLocation target{ .Location = { GetMapId(), pos } };
if (GetTypeId() == TYPEID_PLAYER)
ToPlayer()->TeleportTo(target, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : TELE_TO_NONE));
else
{
SendTeleportPacket(target);
- UpdatePosition(pos, true);
+ UpdatePosition(target.Location, true);
UpdateObjectVisibility();
}
}
+void Unit::NearTeleportTo(Position const& pos, bool casting /*= false*/)
+{
+ NearTeleportTo(TeleportLocation{ .Location = { GetMapId(), pos } }, casting);
+}
+
void Unit::SendTeleportPacket(TeleportLocation const& teleportLocation)
{
// SMSG_MOVE_UPDATE_TELEPORT is sent to nearby players to signal the teleport
@@ -12856,7 +12860,10 @@ void Unit::SendTeleportPacket(TeleportLocation const& teleportLocation)
moveUpdateTeleport.Status->transport.pos.Relocate(teleportLocation.Location);
}
else
+ {
moveUpdateTeleport.Status->pos.Relocate(teleportLocation.Location);
+ moveUpdateTeleport.Status->transport.Reset();
+ }
}
// Broadcast the packet to everyone except self.
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 22a872a7020..8973b439717 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1122,6 +1122,7 @@ class TC_GAME_API Unit : public WorldObject
void SendSpellDamageResist(Unit* target, uint32 spellId);
void SendSpellDamageImmune(Unit* target, uint32 spellId, bool isPeriodic);
+ void NearTeleportTo(TeleportLocation const& target, bool casting = false);
void NearTeleportTo(Position const& pos, bool casting = false);
void NearTeleportTo(float x, float y, float z, float orientation, bool casting = false) { NearTeleportTo(Position(x, y, z, orientation), casting); }
void SendTeleportPacket(TeleportLocation const& teleportLocation);