aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp8
-rw-r--r--src/server/game/Entities/Player/Player.cpp10
-rw-r--r--src/server/game/Entities/Player/Player.h11
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp2
-rw-r--r--src/server/game/Spells/SpellEffects.cpp45
-rw-r--r--src/server/game/Support/SupportMgr.cpp2
-rw-r--r--src/server/scripts/Commands/cs_group.cpp2
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp2
8 files changed, 52 insertions, 30 deletions
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index 38d02a36cd3..d513230439f 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -485,15 +485,15 @@ void BattlegroundSA::TeleportToEntrancePosition(Player* player)
// player->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
if (urand(0, 1))
- player->TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f, 0);
+ player->TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f);
else
- player->TeleportTo(607, 2577.003f, 980.261f, 15.0f, 0.807f, 0);
+ player->TeleportTo(607, 2577.003f, 980.261f, 15.0f, 0.807f);
}
else
- player->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0);
+ player->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f);
}
else
- player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
+ player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f);
}
void BattlegroundSA::ProcessEvent(WorldObject* obj, uint32 eventId, WorldObject* invoker /*= nullptr*/)
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index d5fe54af1a4..67fcd09e365 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -203,7 +203,7 @@ Player::Player(WorldSession* session) : Unit(true), m_sceneMgr(this)
m_DelayedOperations = 0;
m_bCanDelayTeleport = false;
m_bHasDelayedTeleport = false;
- m_teleport_options = 0;
+ m_teleport_options = TELE_TO_NONE;
m_trade = nullptr;
@@ -1315,7 +1315,7 @@ uint16 Player::GetChatFlags() const
return tag;
}
-bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options /*= 0*/, Optional<uint32> instanceId /*= {}*/)
+bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options /*= TELE_TO_NONE*/, Optional<uint32> instanceId /*= {}*/)
{
if (!MapManager::IsValidMapCoord(mapid, x, y, z, orientation))
{
@@ -1553,7 +1553,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
return true;
}
-bool Player::TeleportTo(WorldLocation const& loc, uint32 options /*= 0*/, Optional<uint32> instanceId /*= {}*/)
+bool Player::TeleportTo(WorldLocation const& loc, TeleportToOptions options /*= TELE_TO_NONE*/, Optional<uint32> instanceId /*= {}*/)
{
return TeleportTo(loc.GetMapId(), loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ(), loc.GetOrientation(), options, instanceId);
}
@@ -4858,7 +4858,7 @@ void Player::RepopAtGraveyard()
// and don't show spirit healer location
if (ClosestGrave)
{
- TeleportTo(ClosestGrave->Loc, shouldResurrect ? TELE_REVIVE_AT_TELEPORT : 0);
+ TeleportTo(ClosestGrave->Loc, shouldResurrect ? TELE_REVIVE_AT_TELEPORT : TELE_TO_NONE);
if (isDead()) // not send if alive, because it used in TeleportTo()
{
WorldPackets::Misc::DeathReleaseLoc packet;
@@ -24834,7 +24834,7 @@ void Player::SummonIfPossible(bool agree)
UpdateCriteria(CriteriaType::AcceptSummon, 1);
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::Summon);
- TeleportTo(m_summon_location, 0, m_summon_instanceId);
+ TeleportTo(m_summon_location, TELE_TO_NONE, m_summon_instanceId);
broadcastSummonResponse(true);
}
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 20fd7b2f4d6..e52f4d4bd29 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -829,6 +829,7 @@ enum ArenaTeamInfoType
enum TeleportToOptions
{
+ TELE_TO_NONE = 0x00,
TELE_TO_GM_MODE = 0x01,
TELE_TO_NOT_LEAVE_TRANSPORT = 0x02,
TELE_TO_NOT_LEAVE_COMBAT = 0x04,
@@ -839,6 +840,8 @@ enum TeleportToOptions
TELE_TO_SEAMLESS = 0x80
};
+DEFINE_ENUM_FLAG(TeleportToOptions);
+
/// Type of environmental damages
enum EnviromentalDamage : uint8
{
@@ -1152,8 +1155,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void SetObjectScale(float scale) override;
- bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0, Optional<uint32> instanceId = {});
- bool TeleportTo(WorldLocation const& loc, uint32 options = 0, Optional<uint32> instanceId = {});
+ 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 TeleportToBGEntryPoint();
bool HasSummonPending() const;
@@ -2508,7 +2511,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
m_recall_location.WorldRelocate(*this);
m_recall_instanceId = GetInstanceId();
}
- void Recall() { TeleportTo(m_recall_location, 0, m_recall_instanceId); }
+ void Recall() { TeleportTo(m_recall_location, TELE_TO_NONE, m_recall_instanceId); }
void SetHomebind(WorldLocation const& loc, uint32 areaId);
void SendBindPointUpdate() const;
@@ -3180,7 +3183,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
// Current teleport data
WorldLocation m_teleport_dest;
Optional<uint32> m_teleport_instanceId;
- uint32 m_teleport_options;
+ TeleportToOptions m_teleport_options;
bool mSemaphoreTeleport_Near;
bool mSemaphoreTeleport_Far;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 98435a60d47..9085adbd570 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -12413,7 +12413,7 @@ void Unit::NearTeleportTo(Position const& pos, bool casting /*= false*/)
if (GetTypeId() == TYPEID_PLAYER)
{
WorldLocation target(GetMapId(), pos);
- ToPlayer()->TeleportTo(target, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0));
+ 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
{
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 1e548610341..cbe99c23608 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -897,6 +897,23 @@ void Spell::EffectJumpDest()
unitCaster->GetMotionMaster()->MoveJump(*destTarget, speedXY, speedZ, EVENT_JUMP, !m_targets.GetObjectTargetGUID().IsEmpty(), &arrivalCast);
}
+TeleportToOptions GetTeleportOptions(WorldObject const* caster, Unit const* unitTarget, SpellDestination const& targetDest)
+{
+ TeleportToOptions options = TELE_TO_NONE;
+ if (caster == unitTarget)
+ options |= TELE_TO_SPELL;
+
+ if (targetDest._position.GetMapId() == unitTarget->GetMapId())
+ {
+ options |= TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET;
+
+ if (unitTarget->GetTransGUID() == targetDest._transportGUID)
+ options |= TELE_TO_NOT_LEAVE_TRANSPORT;
+ }
+
+ return options;
+}
+
void Spell::EffectTeleportUnits()
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
@@ -924,32 +941,33 @@ void Spell::EffectTeleportUnits()
// Custom loading screen
if (player)
+ {
if (uint32 customLoadingScreenId = effectInfo->MiscValue)
player->SendDirectMessage(WorldPackets::Spells::CustomLoadScreen(m_spellInfo->Id, customLoadingScreenId).Write());
- if (targetDest.GetMapId() == unitTarget->GetMapId())
+ TeleportToOptions options = GetTeleportOptions(m_caster, unitTarget, m_destTargets[effectInfo->EffectIndex]);
+
+ player->TeleportTo(targetDest, options);
+
+ }
+ else if (targetDest.GetMapId() == unitTarget->GetMapId())
unitTarget->NearTeleportTo(targetDest, unitTarget == m_caster);
- else if (player)
- player->TeleportTo(targetDest, unitTarget == m_caster ? TELE_TO_SPELL : 0);
else
- {
TC_LOG_ERROR("spells", "Spell::EffectTeleportUnits - spellId {} attempted to teleport creature to a different map.", m_spellInfo->Id);
- return;
- }
}
class DelayedSpellTeleportEvent : public BasicEvent
{
public:
- explicit DelayedSpellTeleportEvent(Unit* target, WorldLocation const& targetDest, uint32 options, uint32 spellId)
+ explicit DelayedSpellTeleportEvent(Unit* target, WorldLocation const& targetDest, TeleportToOptions options, uint32 spellId)
: _target(target), _targetDest(targetDest), _options(options), _spellId(spellId){ }
bool Execute(uint64 /*e_time*/, uint32 /*p_time*/) override
{
- if (_targetDest.GetMapId() == _target->GetMapId())
- _target->NearTeleportTo(_targetDest, (_options & TELE_TO_SPELL) != 0);
- else if (Player* player = _target->ToPlayer())
+ if (Player* player = _target->ToPlayer())
player->TeleportTo(_targetDest, _options);
+ else if (_targetDest.GetMapId() == _target->GetMapId())
+ _target->NearTeleportTo(_targetDest, (_options & TELE_TO_SPELL) != TELE_TO_NONE);
else
TC_LOG_ERROR("spells", "Spell::EffectTeleportUnitsWithVisualLoadingScreen - spellId {} attempted to teleport creature to a different map.", _spellId);
@@ -959,7 +977,7 @@ public:
private:
Unit* _target;
WorldLocation _targetDest;
- uint32 _options;
+ TeleportToOptions _options;
uint32 _spellId;
};
@@ -990,7 +1008,8 @@ void Spell::EffectTeleportUnitsWithVisualLoadingScreen()
if (Player* playerTarget = unitTarget->ToPlayer())
playerTarget->SendDirectMessage(WorldPackets::Spells::SpellVisualLoadScreen(effectInfo->MiscValueB, effectInfo->MiscValue).Write());
- unitTarget->m_Events.AddEventAtOffset(new DelayedSpellTeleportEvent(unitTarget, targetDest, unitTarget == m_caster ? TELE_TO_SPELL : 0, m_spellInfo->Id),
+ TeleportToOptions options = GetTeleportOptions(m_caster, unitTarget, m_destTargets[effectInfo->EffectIndex]);
+ unitTarget->m_Events.AddEventAtOffset(new DelayedSpellTeleportEvent(unitTarget, targetDest, options, m_spellInfo->Id),
Milliseconds(effectInfo->MiscValue));
}
@@ -5102,7 +5121,7 @@ void Spell::EffectTeleportToReturnPoint()
if (Player* player = unitTarget->ToPlayer())
if (WorldLocation const* dest = player->GetStoredAuraTeleportLocation(effectInfo->MiscValue))
- player->TeleportTo(*dest, unitTarget == m_caster ? TELE_TO_SPELL | TELE_TO_NOT_LEAVE_COMBAT : 0);
+ player->TeleportTo(*dest, unitTarget == m_caster ? TELE_TO_SPELL | TELE_TO_NOT_LEAVE_COMBAT : TELE_TO_NONE);
}
void Spell::EffectIncreaseCurrencyCap()
diff --git a/src/server/game/Support/SupportMgr.cpp b/src/server/game/Support/SupportMgr.cpp
index 2ccf58131b8..9d2e57f12fd 100644
--- a/src/server/game/Support/SupportMgr.cpp
+++ b/src/server/game/Support/SupportMgr.cpp
@@ -69,7 +69,7 @@ std::string Ticket::GetAssignedToName() const
void Ticket::TeleportTo(Player* player) const
{
- player->TeleportTo(_mapId, _pos.GetPositionX(), _pos.GetPositionY(), _pos.GetPositionZ(), 0.0f, 0);
+ player->TeleportTo(_mapId, _pos.GetPositionX(), _pos.GetPositionY(), _pos.GetPositionZ(), 0.0f);
}
std::string Ticket::FormatViewMessageString(ChatHandler& handler, char const* closedName, char const* assignedToName, char const* unassignedName, char const* deletedName) const
diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp
index d97672aa091..6ddaa03c675 100644
--- a/src/server/scripts/Commands/cs_group.cpp
+++ b/src/server/scripts/Commands/cs_group.cpp
@@ -251,7 +251,7 @@ public:
// before GM
float x, y, z;
gmPlayer->GetClosePoint(x, y, z, player->GetCombatReach());
- player->TeleportTo(gmPlayer->GetMapId(), x, y, z, player->GetOrientation(), 0, gmPlayer->GetInstanceId());
+ player->TeleportTo(gmPlayer->GetMapId(), x, y, z, player->GetOrientation(), TELE_TO_NONE, gmPlayer->GetInstanceId());
}
return true;
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index e3722ad370d..14cba07953b 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -564,7 +564,7 @@ public:
// before GM
float x, y, z;
_player->GetClosePoint(x, y, z, target->GetCombatReach());
- target->TeleportTo(_player->GetMapId(), x, y, z, target->GetOrientation(), 0, map->GetInstanceId());
+ target->TeleportTo(_player->GetMapId(), x, y, z, target->GetOrientation(), TELE_TO_NONE, map->GetInstanceId());
PhasingHandler::InheritPhaseShift(target, _player);
target->UpdateObjectVisibility();
}