Core/GameObject: spawn linked traps at gameobject creation instead of…

… using DB spawns.
This commit is contained in:
Aokromes
2016-11-02 04:01:09 +01:00
parent 695b3df525
commit 1659ea03cf
3 changed files with 26 additions and 41 deletions

View File

@@ -3229,28 +3229,12 @@ 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(map->GenerateLowGuid<HighGuid::GameObject>(), linkedEntry, map,
m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), G3D::Quat(), 255, GO_STATE_READY))
{
linkedGO->CopyPhaseFrom(m_caster);
pGameObj->SetLinkedTrap(linkedGO);
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;
linkedGO = NULL;
return;
}
ExecuteLogEffectSummonObject(effIndex, linkedTrap);
}
}
@@ -4872,29 +4856,14 @@ 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(cMap->GenerateLowGuid<HighGuid::GameObject>(), linkedEntry, cMap, 0, Position(fx, fy, fz, m_caster->GetOrientation()), G3D::Quat(), 255, GO_STATE_READY))
{
linkedGO->CopyPhaseFrom(m_caster);
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());
pGameObj->SetLinkedTrap(linkedGO);
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());
ExecuteLogEffectSummonObject(effIndex, linkedGO);
linkedGO->GetMap()->AddToMap(linkedGO);
}
else
{
delete linkedGO;
linkedGO = NULL;
return;
}
ExecuteLogEffectSummonObject(effIndex, linkedTrap);
}
}