mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
Spell/GameObject: Fix flying upon teleport between map initiated from GO (#23390)
This commit is contained in:
@@ -1466,7 +1466,7 @@ void GameObject::Use(Unit* user)
|
|||||||
// by default spell caster is user
|
// by default spell caster is user
|
||||||
Unit* spellCaster = user;
|
Unit* spellCaster = user;
|
||||||
uint32 spellId = 0;
|
uint32 spellId = 0;
|
||||||
bool triggered = false;
|
uint32 triggeredFlags = TRIGGERED_NONE;
|
||||||
|
|
||||||
if (Player* playerUser = user->ToPlayer())
|
if (Player* playerUser = user->ToPlayer())
|
||||||
{
|
{
|
||||||
@@ -1486,6 +1486,10 @@ void GameObject::Use(Unit* user)
|
|||||||
m_cooldownTime = GameTime::GetGameTimeMS().count() + cooldown * IN_MILLISECONDS;
|
m_cooldownTime = GameTime::GetGameTimeMS().count() + cooldown * IN_MILLISECONDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user->IsPlayer() && GetGoType() != GAMEOBJECT_TYPE_TRAP) // workaround for GO casting
|
||||||
|
if (!m_goInfo->IsUsableMounted())
|
||||||
|
user->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||||
|
|
||||||
switch (GetGoType())
|
switch (GetGoType())
|
||||||
{
|
{
|
||||||
case GAMEOBJECT_TYPE_DOOR: //0
|
case GAMEOBJECT_TYPE_DOOR: //0
|
||||||
@@ -1886,7 +1890,6 @@ void GameObject::Use(Unit* user)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
user->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
|
||||||
spellId = info->spellcaster.spellId;
|
spellId = info->spellcaster.spellId;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2056,12 +2059,15 @@ void GameObject::Use(Unit* user)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_goInfo->IsUsableMounted())
|
||||||
|
triggeredFlags |= TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE;
|
||||||
|
|
||||||
if (Player* player = user->ToPlayer())
|
if (Player* player = user->ToPlayer())
|
||||||
sOutdoorPvPMgr->HandleCustomSpell(player, spellId, this);
|
sOutdoorPvPMgr->HandleCustomSpell(player, spellId, this);
|
||||||
|
|
||||||
if (spellCaster)
|
if (spellCaster)
|
||||||
{
|
{
|
||||||
if ((spellCaster->CastSpell(user, spellInfo, triggered) == SPELL_CAST_OK) && GetGoType() == GAMEOBJECT_TYPE_SPELLCASTER)
|
if ((spellCaster->CastSpell(user, spellInfo, TriggerCastFlags(triggeredFlags)) == SPELL_CAST_OK) && GetGoType() == GAMEOBJECT_TYPE_SPELLCASTER)
|
||||||
AddUse();
|
AddUse();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1573,17 +1573,6 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||||||
if (oldmap)
|
if (oldmap)
|
||||||
oldmap->RemovePlayerFromMap(this, false);
|
oldmap->RemovePlayerFromMap(this, false);
|
||||||
|
|
||||||
// xinef: do this before setting fall information!
|
|
||||||
if (IsMounted() && (!GetMap()->GetEntry()->IsDungeon() && !GetMap()->GetEntry()->IsBattlegroundOrArena()) && !m_transport)
|
|
||||||
{
|
|
||||||
AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_MOUNTED);
|
|
||||||
if (!auras.empty())
|
|
||||||
{
|
|
||||||
SetMountBlockId((*auras.begin())->GetId());
|
|
||||||
RemoveAurasByType(SPELL_AURA_MOUNTED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
|
teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
|
||||||
SetFallInformation(GameTime::GetGameTime().count(), z);
|
SetFallInformation(GameTime::GetGameTime().count(), z);
|
||||||
// if the player is saved before worldportack (at logout for example)
|
// if the player is saved before worldportack (at logout for example)
|
||||||
|
|||||||
Reference in New Issue
Block a user