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()) if (map.Is25ManRaid())
loot.maxDuplicates = 3; 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; return true;
} }
@@ -2347,7 +2360,7 @@ namespace Game.Entities
} }
public void SetLinkedTrap(GameObject linkedTrap) { m_linkedTrap = linkedTrap.GetGUID(); } public void SetLinkedTrap(GameObject linkedTrap) { m_linkedTrap = linkedTrap.GetGUID(); }
GameObject GetLinkedTrap() public GameObject GetLinkedTrap()
{ {
return ObjectAccessor.GetGameObject(this, m_linkedTrap); return ObjectAccessor.GetGameObject(this, m_linkedTrap);
} }
+14 -39
View File
@@ -2904,30 +2904,18 @@ namespace Game.Spells
{ {
Battleground bg = player.GetBattleground(); Battleground bg = player.GetBattleground();
if (bg) 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(); GameObject linkedTrap = pGameObj.GetLinkedTrap();
if (linkedEntry != 0) if (linkedTrap)
{ {
GameObject linkedGO = new GameObject(); linkedTrap.CopyPhaseFrom(m_caster);
if (linkedGO.Create(linkedEntry, map, m_caster.GetPhaseMask(), new Position(x, y, z, target.GetOrientation()), rotation, 255, GameObjectState.Ready)) linkedTrap.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
{ linkedTrap.SetSpellId(m_spellInfo.Id);
pGameObj.SetLinkedTrap(linkedGO);
linkedGO.CopyPhaseFrom(m_caster); ExecuteLogEffectSummonObject(effIndex, linkedTrap);
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();
} }
} }
@@ -4652,28 +4640,15 @@ namespace Game.Spells
Log.outDebug(LogFilter.Spells, "AddObject at SpellEfects.cpp EffectTransmitted"); Log.outDebug(LogFilter.Spells, "AddObject at SpellEfects.cpp EffectTransmitted");
cMap.AddToMap(pGameObj); cMap.AddToMap(pGameObj);
uint linkedEntry = pGameObj.GetGoInfo().GetLinkedGameObjectEntry(); GameObject linkedTrap = pGameObj.GetLinkedTrap();
if (linkedEntry != 0) if (linkedTrap != null)
{ {
GameObject linkedGO = new GameObject(); linkedTrap.CopyPhaseFrom(m_caster);
if (linkedGO.Create(linkedEntry, cMap, m_caster.GetPhaseMask(), pos, rotation, 255, GameObjectState.Ready)) linkedTrap.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
{ linkedTrap.SetSpellId(m_spellInfo.Id);
pGameObj.SetLinkedTrap(linkedGO); linkedTrap.SetOwnerGUID(m_caster.GetGUID());
linkedGO.CopyPhaseFrom(m_caster); ExecuteLogEffectSummonObject(effIndex, linkedTrap);
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;
}
} }
} }