Spawn linked traps at gameobject creation instead of using DB spawns.

This commit is contained in:
hondacrx
2017-11-29 17:54:55 -05:00
parent 32619fa6b5
commit b97c21be44
2 changed files with 28 additions and 40 deletions
+14 -1
View File
@@ -337,6 +337,19 @@ namespace Game.Entities
if (map.Is25ManRaid())
loot.maxDuplicates = 3;
uint linkedEntry = GetGoInfo().GetLinkedGameObjectEntry();
if (linkedEntry != 0)
{
GameObject linkedGO = new GameObject();
if (linkedGO.Create(linkedEntry, map, phaseMask, pos, rotation, 255, GameObjectState.Ready))
{
SetLinkedTrap(linkedGO);
map.AddToMap(linkedGO);
}
else
linkedGO.Dispose();
}
return true;
}
@@ -2347,7 +2360,7 @@ namespace Game.Entities
}
public void SetLinkedTrap(GameObject linkedTrap) { m_linkedTrap = linkedTrap.GetGUID(); }
GameObject GetLinkedTrap()
public GameObject GetLinkedTrap()
{
return ObjectAccessor.GetGameObject(this, m_linkedTrap);
}
+14 -39
View File
@@ -2904,30 +2904,18 @@ namespace Game.Spells
{
Battleground bg = player.GetBattleground();
if (bg)
bg.SetDroppedFlagGUID(pGameObj.GetGUID(), (int)(player.GetTeam() == Team.Alliance ? TeamId.Horde : TeamId.Alliance));
bg.SetDroppedFlagGUID(pGameObj.GetGUID(), (player.GetTeam() == Team.Alliance ? TeamId.Horde : TeamId.Alliance));
}
}
uint linkedEntry = pGameObj.GetGoInfo().GetLinkedGameObjectEntry();
if (linkedEntry != 0)
GameObject linkedTrap = pGameObj.GetLinkedTrap();
if (linkedTrap)
{
GameObject linkedGO = new GameObject();
if (linkedGO.Create(linkedEntry, map, m_caster.GetPhaseMask(), new Position(x, y, z, target.GetOrientation()), rotation, 255, GameObjectState.Ready))
{
pGameObj.SetLinkedTrap(linkedGO);
linkedTrap.CopyPhaseFrom(m_caster);
linkedTrap.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
linkedTrap.SetSpellId(m_spellInfo.Id);
linkedGO.CopyPhaseFrom(m_caster);
linkedGO.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
linkedGO.SetSpellId(m_spellInfo.Id);
ExecuteLogEffectSummonObject(effIndex, linkedGO);
// Wild object not have owner and check clickable by players
map.AddToMap(linkedGO);
}
else
linkedGO.Dispose();
ExecuteLogEffectSummonObject(effIndex, linkedTrap);
}
}
@@ -4652,28 +4640,15 @@ namespace Game.Spells
Log.outDebug(LogFilter.Spells, "AddObject at SpellEfects.cpp EffectTransmitted");
cMap.AddToMap(pGameObj);
uint linkedEntry = pGameObj.GetGoInfo().GetLinkedGameObjectEntry();
if (linkedEntry != 0)
GameObject linkedTrap = pGameObj.GetLinkedTrap();
if (linkedTrap != null)
{
GameObject linkedGO = new GameObject();
if (linkedGO.Create(linkedEntry, cMap, m_caster.GetPhaseMask(), pos, rotation, 255, GameObjectState.Ready))
{
pGameObj.SetLinkedTrap(linkedGO);
linkedTrap.CopyPhaseFrom(m_caster);
linkedTrap.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
linkedTrap.SetSpellId(m_spellInfo.Id);
linkedTrap.SetOwnerGUID(m_caster.GetGUID());
linkedGO.CopyPhaseFrom(m_caster);
linkedGO.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
linkedGO.SetSpellId(m_spellInfo.Id);
linkedGO.SetOwnerGUID(m_caster.GetGUID());
ExecuteLogEffectSummonObject(effIndex, linkedGO);
linkedGO.GetMap().AddToMap(linkedGO);
}
else
{
linkedGO = null;
return;
}
ExecuteLogEffectSummonObject(effIndex, linkedTrap);
}
}