aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellEffects.cpp
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2016-09-03 17:30:51 -0300
committerariel- <ariel-@users.noreply.github.com>2016-09-03 17:31:29 -0300
commit14445d2202de1b58dcb04c5457be682b8e7075ca (patch)
tree36ea2a96f62bc01450769890812d64a12ceb9e80 /src/server/game/Spells/SpellEffects.cpp
parent7026c7ed7a39ae258eb0ba01f6946c8bc1594ce0 (diff)
Core/Misc: calculate rotation fields from orientation in some places it's impossible to get:
- SmartScripts: SMART_ACTION_SUMMON_GO - Spell Effects: * SPELL_EFFECT_DUEL * SPELL_EFFECT_SUMMON_OBJECT_WILD * SPELL_EFFECT_SUMMON_OBJECT_SLOT1 * SPELL_EFFECT_SUMMON_OBJECT_SLOT2 * SPELL_EFFECT_SUMMON_OBJECT_SLOT3 * SPELL_EFFECT_SUMMON_OBJECT_SLOT4 - Command Scripts: .gobject add Closes #17891
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index ddad1a49f15..d7793df36e0 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -3494,7 +3494,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
uint32 gameobject_id = m_spellInfo->Effects[effIndex].MiscValue;
- GameObject* pGameObj = new GameObject;
+ GameObject* pGameObj = new GameObject();
WorldObject* target = focusObject;
if (!target)
@@ -3508,8 +3508,8 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
Map* map = target->GetMap();
- if (!pGameObj->Create(map->GenerateLowGuid<HighGuid::GameObject>(), gameobject_id, map,
- m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), G3D::Quat(), 255, GO_STATE_READY))
+ G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(target->GetOrientation(), 0.f, 0.f);
+ if (!pGameObj->Create(map->GenerateLowGuid<HighGuid::GameObject>(), gameobject_id, map, m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), rot, 255, GO_STATE_READY))
{
delete pGameObj;
return;
@@ -3532,9 +3532,8 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
{
- GameObject* linkedGO = new GameObject;
- if (linkedGO->Create(map->GenerateLowGuid<HighGuid::GameObject>(), linkedEntry, map,
- m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), G3D::Quat(), 255, GO_STATE_READY))
+ GameObject* linkedGO = new GameObject();
+ if (linkedGO->Create(map->GenerateLowGuid<HighGuid::GameObject>(), linkedEntry, map, m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), rot, 255, GO_STATE_READY))
{
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
linkedGO->SetSpellId(m_spellInfo->Id);
@@ -3545,11 +3544,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
map->AddToMap(linkedGO);
}
else
- {
delete linkedGO;
- linkedGO = NULL;
- return;
- }
}
}
@@ -4132,7 +4127,8 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
};
Map* map = m_caster->GetMap();
- if (!pGameObj->Create(map->GenerateLowGuid<HighGuid::GameObject>(), gameobject_id, map, m_caster->GetPhaseMask(), pos, G3D::Quat(), 0, GO_STATE_READY))
+ G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(pos.GetOrientation(), 0.f, 0.f);
+ if (!pGameObj->Create(map->GenerateLowGuid<HighGuid::GameObject>(), gameobject_id, map, m_caster->GetPhaseMask(), pos, rot, 0, GO_STATE_READY))
{
delete pGameObj;
return;
@@ -4464,8 +4460,8 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
Map* map = m_caster->GetMap();
- if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), go_id, map,
- m_caster->GetPhaseMask(), Position(x, y, z, m_caster->GetOrientation()), G3D::Quat(), 255, GO_STATE_READY))
+ G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(m_caster->GetOrientation(), 0.f, 0.f);
+ if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), go_id, map, m_caster->GetPhaseMask(), Position(x, y, z, m_caster->GetOrientation()), rot, 255, GO_STATE_READY))
{
delete go;
return;