gameobject summoner
Port From (https://github.com/TrinityCore/TrinityCore/commit/5f545f540216d3b94c26e4aeda50c8bb8d5c3d74)
This commit is contained in:
@@ -28,7 +28,7 @@ namespace Game.AI
|
||||
{
|
||||
public class CreatureAI : UnitAI
|
||||
{
|
||||
bool _moveInLineOfSightLocked;
|
||||
bool _moveInLOSLocked;
|
||||
List<AreaBoundary> _boundary = new();
|
||||
bool _negateBoundary;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Game.AI
|
||||
public CreatureAI(Creature _creature) : base(_creature)
|
||||
{
|
||||
me = _creature;
|
||||
_moveInLineOfSightLocked = false;
|
||||
_moveInLOSLocked = false;
|
||||
}
|
||||
|
||||
public override void OnCharmed(bool isNew)
|
||||
@@ -101,12 +101,12 @@ namespace Game.AI
|
||||
|
||||
public virtual void MoveInLineOfSight_Safe(Unit who)
|
||||
{
|
||||
if (_moveInLineOfSightLocked)
|
||||
if (_moveInLOSLocked)
|
||||
return;
|
||||
|
||||
_moveInLineOfSightLocked = true;
|
||||
_moveInLOSLocked = true;
|
||||
MoveInLineOfSight(who);
|
||||
_moveInLineOfSightLocked = false;
|
||||
_moveInLOSLocked = false;
|
||||
}
|
||||
|
||||
public virtual void MoveInLineOfSight(Unit who)
|
||||
@@ -366,7 +366,7 @@ namespace Game.AI
|
||||
|
||||
// Called when the creature summon successfully other creature
|
||||
public virtual void JustSummoned(Creature summon) { }
|
||||
public virtual void IsSummonedBy(Unit summoner) { }
|
||||
public virtual void IsSummonedBy(WorldObject summoner) { }
|
||||
|
||||
public virtual void SummonedCreatureDespawn(Creature summon) { }
|
||||
public virtual void SummonedCreatureDies(Creature summon, Unit killer) { }
|
||||
|
||||
@@ -101,5 +101,11 @@ namespace Game.AI
|
||||
// Called when spell hits a target
|
||||
public virtual void SpellHitTarget(Unit target, SpellInfo spellInfo) { }
|
||||
public virtual void SpellHitTargetGameObject(GameObject target, SpellInfo spellInfo) { }
|
||||
|
||||
// Called when the gameobject summon successfully other creature
|
||||
public virtual void JustSummoned(Creature summon) { }
|
||||
|
||||
public virtual void SummonedCreatureDespawn(Creature summon) { }
|
||||
public virtual void SummonedCreatureDies(Creature summon, Unit killer) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Game.AI
|
||||
{
|
||||
public TriggerAI(Creature c) : base(c) { }
|
||||
|
||||
public override void IsSummonedBy(Unit summoner)
|
||||
public override void IsSummonedBy(WorldObject summoner)
|
||||
{
|
||||
if (me.m_spells[0] != 0)
|
||||
{
|
||||
|
||||
@@ -689,9 +689,9 @@ namespace Game.AI
|
||||
GetScript().ProcessEventsFor(SmartEvents.ReceiveEmote, player, (uint)emoteId);
|
||||
}
|
||||
|
||||
public override void IsSummonedBy(Unit summoner)
|
||||
public override void IsSummonedBy(WorldObject summoner)
|
||||
{
|
||||
GetScript().ProcessEventsFor(SmartEvents.JustSummoned, summoner);
|
||||
GetScript().ProcessEventsFor(SmartEvents.JustSummoned, summoner.ToUnit(), 0, 0, false, null, summoner.ToGameObject());
|
||||
}
|
||||
|
||||
public override void DamageDealt(Unit victim, ref uint damage, DamageEffectType damageType)
|
||||
|
||||
@@ -2944,7 +2944,7 @@ namespace Game.AI
|
||||
TempSummon tempSummon = _me.ToTempSummon();
|
||||
if (tempSummon)
|
||||
{
|
||||
Unit summoner = tempSummon.GetSummoner();
|
||||
WorldObject summoner = tempSummon.GetSummoner();
|
||||
if (summoner)
|
||||
charmerOrOwnerGuid = summoner.GetGUID();
|
||||
}
|
||||
@@ -2953,7 +2953,7 @@ namespace Game.AI
|
||||
if (charmerOrOwnerGuid.IsEmpty())
|
||||
charmerOrOwnerGuid = _me.GetCreatorGUID();
|
||||
|
||||
Unit owner = Global.ObjAccessor.GetUnit(_me, charmerOrOwnerGuid);
|
||||
WorldObject owner = Global.ObjAccessor.GetWorldObject(_me, charmerOrOwnerGuid);
|
||||
if (owner != null)
|
||||
targets.Add(owner);
|
||||
}
|
||||
@@ -2967,7 +2967,7 @@ namespace Game.AI
|
||||
// Get owner of owner
|
||||
if (e.Target.owner.useCharmerOrOwner != 0 && !targets.Empty())
|
||||
{
|
||||
Unit owner = targets.First().ToUnit();
|
||||
WorldObject owner = targets.First();
|
||||
targets.Clear();
|
||||
|
||||
Unit unitBase = Global.ObjAccessor.GetUnit(owner, owner.GetCharmerOrOwnerGUID());
|
||||
|
||||
Reference in New Issue
Block a user