diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 14 | ||||
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 49 |
2 files changed, 25 insertions, 38 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 74ca9b1225d..6c736f66bf7 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -197,7 +197,7 @@ void GameObject::RemoveFromWorld() } } -bool GameObject::Create(uint32 name_id, Map* map, uint32 /*phaseMask*/, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState go_state, uint32 artKit /*= 0*/) +bool GameObject::Create(uint32 name_id, Map* map, uint32 phaseMask, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState go_state, uint32 artKit /*= 0*/) { ASSERT(map); SetMap(map); @@ -378,6 +378,18 @@ bool GameObject::Create(uint32 name_id, Map* map, uint32 /*phaseMask*/, Position if (map->Is25ManRaid()) loot.maxDuplicates = 3; + if (uint32 linkedEntry = GetGOInfo()->GetLinkedGameObjectEntry()) + { + GameObject* linkedGO = new GameObject(); + if (linkedGO->Create(linkedEntry, map, phaseMask, pos, rotation, 255, GO_STATE_READY)) + { + SetLinkedTrap(linkedGO); + map->AddToMap(linkedGO); + } + else + delete linkedGO; + } + return true; } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 5a9ecfdf79d..65b9d668999 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3134,25 +3134,14 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex) if (Battleground* bg = player->GetBattleground()) bg->SetDroppedFlagGUID(pGameObj->GetGUID(), player->GetTeam() == ALLIANCE ? TEAM_HORDE: TEAM_ALLIANCE); - if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry()) + if (GameObject* linkedTrap = pGameObj->GetLinkedTrap()) { - GameObject* linkedGO = new GameObject(); - if (linkedGO->Create(linkedEntry, map, m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), rot, 255, GO_STATE_READY)) - { - pGameObj->SetLinkedTrap(linkedGO); - - linkedGO->CopyPhaseFrom(m_caster); + linkedTrap->CopyPhaseFrom(m_caster); - linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0); - linkedGO->SetSpellId(m_spellInfo->Id); + linkedTrap->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0); + linkedTrap->SetSpellId(m_spellInfo->Id); - ExecuteLogEffectSummonObject(effIndex, linkedGO); - - // Wild object not have owner and check clickable by players - map->AddToMap(linkedGO); - } - else - delete linkedGO; + ExecuteLogEffectSummonObject(effIndex, linkedTrap); } } @@ -4774,30 +4763,16 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) cMap->AddToMap(pGameObj); - if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry()) + if (GameObject* linkedTrap = pGameObj->GetLinkedTrap()) { - GameObject* linkedGO = new GameObject; - if (linkedGO->Create(linkedEntry, cMap, m_caster->GetPhaseMask(), pos, rot, 255, GO_STATE_READY)) - { - pGameObj->SetLinkedTrap(linkedGO); - - linkedGO->CopyPhaseFrom(m_caster); + linkedTrap->CopyPhaseFrom(m_caster); - linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0); - //linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()); - linkedGO->SetSpellId(m_spellInfo->Id); - linkedGO->SetOwnerGUID(m_caster->GetGUID()); + linkedTrap->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0); + //linkedTrap->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()); + linkedTrap->SetSpellId(m_spellInfo->Id); + linkedTrap->SetOwnerGUID(m_caster->GetGUID()); - ExecuteLogEffectSummonObject(effIndex, linkedGO); - - linkedGO->GetMap()->AddToMap(linkedGO); - } - else - { - delete linkedGO; - linkedGO = NULL; - return; - } + ExecuteLogEffectSummonObject(effIndex, linkedTrap); } } |