mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 02:50:29 +00:00
fix(Core/GameObject): Spawn linked traps when gameobjects are created (#8572)
This commit is contained in:
@@ -3787,28 +3787,11 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
|
||||
if (Battleground* bg = player->GetBattleground())
|
||||
bg->SetDroppedFlagGUID(pGameObj->GetGUID(), player->GetTeamId() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE);
|
||||
|
||||
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
|
||||
if (GameObject* linkedTrap = pGameObj->GetLinkedTrap())
|
||||
{
|
||||
GameObject* linkedGO = sObjectMgr->IsGameObjectStaticTransport(linkedEntry) ? new StaticTransport() : new GameObject();
|
||||
if (linkedGO->Create(map->GenerateLowGuid<HighGuid::GameObject>(), linkedEntry, map, m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), G3D::Quat(), 100, GO_STATE_READY))
|
||||
{
|
||||
linkedGO->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
|
||||
linkedGO->SetSpellId(m_spellInfo->Id);
|
||||
|
||||
// xinef: this is wrong
|
||||
//ExecuteLogEffectSummonObject(effIndex, linkedGO);
|
||||
|
||||
pGameObj->SetLinkedTrap(linkedGO);
|
||||
|
||||
// Wild object not have owner and check clickable by players
|
||||
map->AddToMap(linkedGO, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete linkedGO;
|
||||
linkedGO = nullptr;
|
||||
return;
|
||||
}
|
||||
linkedTrap->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS :0);
|
||||
linkedTrap->SetSpellId(m_spellInfo->Id);
|
||||
ExecuteLogEffectSummonObject(effIndex, linkedTrap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5685,27 +5668,13 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
|
||||
|
||||
cMap->AddToMap(pGameObj, true);
|
||||
|
||||
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
|
||||
if (GameObject* linkedTrap = pGameObj->GetLinkedTrap())
|
||||
{
|
||||
GameObject* linkedGO = sObjectMgr->IsGameObjectStaticTransport(linkedEntry) ? new StaticTransport() : new GameObject();
|
||||
if (linkedGO->Create(cMap->GenerateLowGuid<HighGuid::GameObject>(), linkedEntry, cMap, m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), G3D::Quat(), 100, GO_STATE_READY))
|
||||
{
|
||||
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);
|
||||
linkedTrap->SetOwnerGUID(m_caster->GetGUID());
|
||||
|
||||
// xinef: this is wrong
|
||||
//linkedGO->SetOwnerGUID(m_caster->GetGUID());
|
||||
//ExecuteLogEffectSummonObject(effIndex, linkedGO);
|
||||
pGameObj->SetLinkedTrap(linkedGO);
|
||||
|
||||
cMap->AddToMap(linkedGO, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete linkedGO;
|
||||
linkedGO = nullptr;
|
||||
return;
|
||||
}
|
||||
ExecuteLogEffectSummonObject(effIndex, linkedTrap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user