fix(Core/GameObject): Spawn linked traps when gameobjects are created (#8572)
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,5 @@
|
|||||||
|
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1635297022271998800');
|
||||||
|
|
||||||
|
DELETE FROM `gameobject_template` WHERE `entry` = 195641;
|
||||||
|
INSERT INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `IconName`, `castBarCaption`, `unk1`, `size`, `Data0`, `Data1`, `Data2`, `Data3`, `Data4`, `Data5`, `Data6`, `Data7`, `Data8`, `Data9`, `Data10`, `Data11`, `Data12`, `Data13`, `Data14`, `Data15`, `Data16`, `Data17`, `Data18`, `Data19`, `Data20`, `Data21`, `Data22`, `Data23`, `AIName`, `ScriptName`, `VerifiedBuild`) VALUES
|
||||||
|
(195641, 6, 0, 'Brazier', '', '', '', 1, 0, 1, 1, 7897, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', -18019);
|
||||||
@@ -384,6 +384,20 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u
|
|||||||
LastUsedScriptID = GetGOInfo()->ScriptId;
|
LastUsedScriptID = GetGOInfo()->ScriptId;
|
||||||
AIM_Initialize();
|
AIM_Initialize();
|
||||||
|
|
||||||
|
if (uint32 linkedEntry = GetGOInfo()->GetLinkedGameObjectEntry())
|
||||||
|
{
|
||||||
|
GameObject* linkedGO = new GameObject();
|
||||||
|
if (linkedGO->Create(map->GenerateLowGuid<HighGuid::GameObject>(), linkedEntry, map, phaseMask, x, y, z, ang, rotation, 255, GO_STATE_READY))
|
||||||
|
{
|
||||||
|
SetLinkedTrap(linkedGO);
|
||||||
|
map->AddToMap(linkedGO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete linkedGO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check if GameObject is Large
|
// Check if GameObject is Large
|
||||||
if (goinfo->IsLargeGameObject())
|
if (goinfo->IsLargeGameObject())
|
||||||
SetVisibilityDistanceOverride(true);
|
SetVisibilityDistanceOverride(true);
|
||||||
@@ -735,7 +749,7 @@ void GameObject::Update(uint32 diff)
|
|||||||
// If nearby linked trap exists, despawn it
|
// If nearby linked trap exists, despawn it
|
||||||
if (GameObject* linkedTrap = GetLinkedTrap())
|
if (GameObject* linkedTrap = GetLinkedTrap())
|
||||||
{
|
{
|
||||||
linkedTrap->Delete();
|
linkedTrap->DespawnOrUnsummon();
|
||||||
}
|
}
|
||||||
|
|
||||||
//if Gameobject should cast spell, then this, but some GOs (type = 10) should be destroyed
|
//if Gameobject should cast spell, then this, but some GOs (type = 10) should be destroyed
|
||||||
@@ -853,6 +867,11 @@ void GameObject::DespawnOrUnsummon(Milliseconds delay, Seconds forceRespawnTime)
|
|||||||
SendObjectDeSpawnAnim(GetGUID());
|
SendObjectDeSpawnAnim(GetGUID());
|
||||||
SetGoState(GO_STATE_READY);
|
SetGoState(GO_STATE_READY);
|
||||||
|
|
||||||
|
if (GameObject* trap = GetLinkedTrap())
|
||||||
|
{
|
||||||
|
trap->DespawnOrUnsummon();
|
||||||
|
}
|
||||||
|
|
||||||
if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
|
if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
|
||||||
{
|
{
|
||||||
SetUInt32Value(GAMEOBJECT_FLAGS, addon->flags);
|
SetUInt32Value(GAMEOBJECT_FLAGS, addon->flags);
|
||||||
|
|||||||
@@ -3787,28 +3787,11 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
|
|||||||
if (Battleground* bg = player->GetBattleground())
|
if (Battleground* bg = player->GetBattleground())
|
||||||
bg->SetDroppedFlagGUID(pGameObj->GetGUID(), player->GetTeamId() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE);
|
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();
|
linkedTrap->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS :0);
|
||||||
if (linkedGO->Create(map->GenerateLowGuid<HighGuid::GameObject>(), linkedEntry, map, m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), G3D::Quat(), 100, GO_STATE_READY))
|
linkedTrap->SetSpellId(m_spellInfo->Id);
|
||||||
{
|
ExecuteLogEffectSummonObject(effIndex, linkedTrap);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5685,27 +5668,13 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
|
|||||||
|
|
||||||
cMap->AddToMap(pGameObj, true);
|
cMap->AddToMap(pGameObj, true);
|
||||||
|
|
||||||
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
|
if (GameObject* linkedTrap = pGameObj->GetLinkedTrap())
|
||||||
{
|
{
|
||||||
GameObject* linkedGO = sObjectMgr->IsGameObjectStaticTransport(linkedEntry) ? new StaticTransport() : new GameObject();
|
linkedTrap->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
|
||||||
if (linkedGO->Create(cMap->GenerateLowGuid<HighGuid::GameObject>(), linkedEntry, cMap, m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), G3D::Quat(), 100, GO_STATE_READY))
|
linkedTrap->SetSpellId(m_spellInfo->Id);
|
||||||
{
|
linkedTrap->SetOwnerGUID(m_caster->GetGUID());
|
||||||
linkedGO->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
|
|
||||||
linkedGO->SetSpellId(m_spellInfo->Id);
|
|
||||||
|
|
||||||
// xinef: this is wrong
|
ExecuteLogEffectSummonObject(effIndex, linkedTrap);
|
||||||
//linkedGO->SetOwnerGUID(m_caster->GetGUID());
|
|
||||||
//ExecuteLogEffectSummonObject(effIndex, linkedGO);
|
|
||||||
pGameObj->SetLinkedTrap(linkedGO);
|
|
||||||
|
|
||||||
cMap->AddToMap(linkedGO, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delete linkedGO;
|
|
||||||
linkedGO = nullptr;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user