mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-18 22:19:54 -04:00
Set proper orientation after being teleported by spell, by Spp. Closes #100
--HG-- branch : trunk
This commit is contained in:
+7
-7
@@ -159,9 +159,9 @@ void SpellCastTargets::setSrc(Position *pos)
|
||||
}
|
||||
}
|
||||
|
||||
void SpellCastTargets::setDst(float x, float y, float z, uint32 mapId)
|
||||
void SpellCastTargets::setDst(float x, float y, float z, float orientation, uint32 mapId)
|
||||
{
|
||||
m_dstPos.Relocate(x, y, z);
|
||||
m_dstPos.Relocate(x, y, z, orientation);
|
||||
m_targetMask |= TARGET_FLAG_DEST_LOCATION;
|
||||
if(mapId != MAPID_INVALID)
|
||||
m_dstPos.m_mapId = mapId;
|
||||
@@ -1831,7 +1831,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
float dis = rand_norm() * (max_dis - min_dis) + min_dis;
|
||||
float x, y, z;
|
||||
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dis);
|
||||
m_targets.setDst(x, y, z);
|
||||
m_targets.setDst(x, y, z, m_caster->GetOrientation());
|
||||
break;
|
||||
}
|
||||
case TARGET_UNIT_MASTER:
|
||||
@@ -2095,9 +2095,9 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
if(m_spellInfo->Effect[0] == SPELL_EFFECT_TELEPORT_UNITS
|
||||
|| m_spellInfo->Effect[1] == SPELL_EFFECT_TELEPORT_UNITS
|
||||
|| m_spellInfo->Effect[2] == SPELL_EFFECT_TELEPORT_UNITS)
|
||||
m_targets.setDst(st->target_X, st->target_Y, st->target_Z, (int32)st->target_mapId);
|
||||
m_targets.setDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation, (int32)st->target_mapId);
|
||||
else if(st->target_mapId == m_caster->GetMapId())
|
||||
m_targets.setDst(st->target_X, st->target_Y, st->target_Z);
|
||||
m_targets.setDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2110,7 +2110,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
break;
|
||||
case TARGET_DST_HOME:
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
m_targets.setDst(((Player*)m_caster)->m_homebindX,((Player*)m_caster)->m_homebindY,((Player*)m_caster)->m_homebindZ, ((Player*)m_caster)->m_homebindMapId);
|
||||
m_targets.setDst(((Player*)m_caster)->m_homebindX,((Player*)m_caster)->m_homebindY,((Player*)m_caster)->m_homebindZ, ((Player*)m_caster)->GetOrientation(), ((Player*)m_caster)->m_homebindMapId);
|
||||
break;
|
||||
case TARGET_DST_NEARBY_ENTRY:
|
||||
{
|
||||
@@ -6717,7 +6717,7 @@ void Spell::SelectTrajTargets()
|
||||
}
|
||||
}
|
||||
|
||||
m_targets.setDst(x, y, z);
|
||||
m_targets.setDst(x, y, z, m_caster->GetOrientation());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ class SpellCastTargets
|
||||
void setUnitTarget(Unit *target);
|
||||
void setSrc(float x, float y, float z);
|
||||
void setSrc(Position *pos);
|
||||
void setDst(float x, float y, float z, uint32 mapId = MAPID_INVALID);
|
||||
void setDst(float x, float y, float z, float orientation, uint32 mapId = MAPID_INVALID);
|
||||
void setDst(Position *pos);
|
||||
|
||||
uint64 getGOTargetGUID() const { return m_GOTargetGUID; }
|
||||
|
||||
@@ -2493,14 +2493,15 @@ void Spell::EffectTeleportUnits(uint32 i)
|
||||
|
||||
// Init dest coordinates
|
||||
uint32 mapid = m_targets.m_dstPos.GetMapId();
|
||||
if(mapid == MAPID_INVALID)
|
||||
if (mapid == MAPID_INVALID)
|
||||
mapid = unitTarget->GetMapId();
|
||||
float x, y, z;
|
||||
m_targets.m_dstPos.GetPosition(x, y, z);
|
||||
float orientation = m_targets.getUnitTarget() ? m_targets.getUnitTarget()->GetOrientation() : unitTarget->GetOrientation();
|
||||
sLog.outDebug("Spell::EffectTeleportUnits - teleport unit to %u %f %f %f\n", mapid, x, y, z);
|
||||
float x, y, z, orientation;
|
||||
m_targets.m_dstPos.GetPosition(x, y, z, orientation);
|
||||
if (!orientation && m_targets.getUnitTarget())
|
||||
orientation = m_targets.getUnitTarget()->GetOrientation();
|
||||
sLog.outDebug("Spell::EffectTeleportUnits - teleport unit to %u %f %f %f %f\n", mapid, x, y, z, orientation);
|
||||
|
||||
if(mapid == unitTarget->GetMapId())
|
||||
if (mapid == unitTarget->GetMapId())
|
||||
unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster);
|
||||
else if(unitTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)unitTarget)->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0);
|
||||
|
||||
+1
-1
@@ -1070,7 +1070,7 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered,
|
||||
Spell *spell = new Spell(this, spellInfo, triggered, originalCaster );
|
||||
|
||||
SpellCastTargets targets;
|
||||
targets.setDst(x, y, z);
|
||||
targets.setDst(x, y, z, GetOrientation());
|
||||
if(OriginalVictim)
|
||||
targets.setUnitTarget(OriginalVictim);
|
||||
spell->m_CastItem = castItem;
|
||||
|
||||
Reference in New Issue
Block a user