diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 19 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.h | 9 | ||||
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 8 |
3 files changed, 23 insertions, 13 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 3021111b303..61ce645ba9d 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -215,6 +215,7 @@ Player::Player(WorldSession* session) : Unit(true), m_sceneMgr(this) m_bCanDelayTeleport = false; m_bHasDelayedTeleport = false; m_teleport_options = TELE_TO_NONE; + m_teleportSpellId = 0; m_newWorldCounter = 0; m_trade = nullptr; @@ -1123,7 +1124,7 @@ void Player::Update(uint32 p_time) //we should execute delayed teleports only for alive(!) players //because we don't want player's ghost teleported from graveyard if (IsHasDelayedTeleport() && IsAlive()) - TeleportTo(m_teleport_dest, m_teleport_options); + TeleportTo(m_teleport_dest, m_teleport_options, m_teleportSpellId); } void Player::Heartbeat() @@ -1224,17 +1225,17 @@ uint16 Player::GetChatFlags() const return tag; } -bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options /*= TELE_TO_NONE*/, Optional<uint32> instanceId /*= {}*/) +bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options /*= TELE_TO_NONE*/, Optional<uint32> instanceId /*= {}*/, uint32 teleportSpellId /*= 0*/) { - return TeleportTo({ .Location = WorldLocation(mapid, x, y, z, orientation), .InstanceId = instanceId }, options); + return TeleportTo({ .Location = WorldLocation(mapid, x, y, z, orientation), .InstanceId = instanceId }, options, teleportSpellId); } -bool Player::TeleportTo(WorldLocation const& loc, TeleportToOptions options, Optional<uint32> instanceId) +bool Player::TeleportTo(WorldLocation const& loc, TeleportToOptions options, Optional<uint32> instanceId, uint32 teleportSpellId) { - return TeleportTo({ .Location = loc, .InstanceId = instanceId }, options); + return TeleportTo({ .Location = loc, .InstanceId = instanceId }, options, teleportSpellId); } -bool Player::TeleportTo(TeleportLocation const& teleportLocation, TeleportToOptions options /*= TELE_TO_NONE*/) +bool Player::TeleportTo(TeleportLocation const& teleportLocation, TeleportToOptions options /*= TELE_TO_NONE*/, uint32 teleportSpellId) { if (!MapManager::IsValidMapCoord(teleportLocation.Location)) { @@ -1313,6 +1314,7 @@ bool Player::TeleportTo(TeleportLocation const& teleportLocation, TeleportToOpti //lets save teleport destination for player m_teleport_dest = teleportLocation; m_teleport_options = options; + m_teleportSpellId = teleportSpellId; return true; } @@ -1332,6 +1334,7 @@ bool Player::TeleportTo(TeleportLocation const& teleportLocation, TeleportToOpti // this will be used instead of the current location in SaveToDB m_teleport_dest = teleportLocation; m_teleport_options = options; + m_teleportSpellId = teleportSpellId; SetFallInformation(0, GetPositionZ()); // code for finish transfer called in WorldSession::HandleMovementOpcodes() @@ -1379,6 +1382,7 @@ bool Player::TeleportTo(TeleportLocation const& teleportLocation, TeleportToOpti //lets save teleport destination for player m_teleport_dest = teleportLocation; m_teleport_options = options; + m_teleportSpellId = teleportSpellId; return true; } @@ -1432,6 +1436,8 @@ bool Player::TeleportTo(TeleportLocation const& teleportLocation, TeleportToOpti WorldPackets::Movement::TransferPending transferPending; transferPending.MapID = teleportLocation.Location.GetMapId(); transferPending.OldMapPosition = teleportLocation.Location.GetPosition(); + if (teleportSpellId) + transferPending.TransferSpellID = teleportSpellId; if (teleportLocation.TransportGuid.has_value()) { transferPending.Ship.emplace(); @@ -1457,6 +1463,7 @@ bool Player::TeleportTo(TeleportLocation const& teleportLocation, TeleportToOpti m_teleport_dest = teleportLocation; m_teleport_options = options; + m_teleportSpellId = teleportSpellId; SetFallInformation(0, GetPositionZ()); // if the player is saved before worldportack (at logout for example) // this will be used instead of the current location in SaveToDB diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 20e92b6b217..5d30370d10a 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1155,6 +1155,8 @@ enum class ZonePVPTypeOverride : uint32 Combat = 4 }; +float constexpr TELEPORT_MIN_LOAD_SCREEN_DISTANCE = 200.0f; + struct TeleportLocation { WorldLocation Location; @@ -1183,9 +1185,9 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player> void SetObjectScale(float scale) override; - bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options = TELE_TO_NONE, Optional<uint32> instanceId = {}); - bool TeleportTo(WorldLocation const& loc, TeleportToOptions options = TELE_TO_NONE, Optional<uint32> instanceId = {}); - bool TeleportTo(TeleportLocation const& teleportLocation, TeleportToOptions options = TELE_TO_NONE); + bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options = TELE_TO_NONE, Optional<uint32> instanceId = {}, uint32 teleportSpellId = 0); + bool TeleportTo(WorldLocation const& loc, TeleportToOptions options = TELE_TO_NONE, Optional<uint32> instanceId = {}, uint32 teleportSpellId = 0); + bool TeleportTo(TeleportLocation const& teleportLocation, TeleportToOptions options = TELE_TO_NONE, uint32 teleportSpellId = 0); bool TeleportToBGEntryPoint(); bool HasSummonPending() const; @@ -3263,6 +3265,7 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player> // Current teleport data TeleportLocation m_teleport_dest; TeleportToOptions m_teleport_options; + uint32 m_teleportSpellId; int32 m_newWorldCounter; bool mSemaphoreTeleport_Near; bool mSemaphoreTeleport_Far; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 97b11625380..45481f9ee6a 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -997,15 +997,15 @@ void Spell::EffectTeleportUnits() Player* player = unitTarget->ToPlayer(); - // Custom loading screen if (player) { + // Custom loading screen if (uint32 customLoadingScreenId = effectInfo->MiscValue) - player->SendDirectMessage(WorldPackets::Spells::CustomLoadScreen(m_spellInfo->Id, customLoadingScreenId).Write()); + if (targetDest.GetMapId() != unitTarget->GetMapId() || !unitTarget->IsInDist2d(targetDest, TELEPORT_MIN_LOAD_SCREEN_DISTANCE)) + player->SendDirectMessage(WorldPackets::Spells::CustomLoadScreen(m_spellInfo->Id, customLoadingScreenId).Write()); TeleportToOptions options = GetTeleportOptions(m_caster, unitTarget, m_destTargets[effectInfo->EffectIndex]); - - player->TeleportTo(targetDest, options); + player->TeleportTo(targetDest, options, {}, m_spellInfo->Id); } else if (targetDest.GetMapId() == unitTarget->GetMapId()) |