Core/Spells: rework part 5: GameObject casting
Port From (https://github.com/TrinityCore/TrinityCore/commit/962f6d7988b9003e550f6745be7cff812e9d8efa)
This commit is contained in:
@@ -399,10 +399,12 @@ namespace Game.AI
|
||||
public virtual void JustUnregisteredAreaTrigger(AreaTrigger areaTrigger) { }
|
||||
|
||||
// Called when hit by a spell
|
||||
public virtual void SpellHit(Unit caster, SpellInfo spell) { }
|
||||
public virtual void SpellHit(Unit caster, SpellInfo spellInfo) { }
|
||||
public virtual void SpellHit(GameObject caster, SpellInfo spellInfo) { }
|
||||
|
||||
// Called when spell hits a target
|
||||
public virtual void SpellHitTarget(Unit target, SpellInfo spell) { }
|
||||
public virtual void SpellHitTarget(Unit target, SpellInfo spellInfo) { }
|
||||
public virtual void SpellHitTarget(GameObject target, SpellInfo spellInfo) { }
|
||||
|
||||
public virtual bool IsEscorted() { return false; }
|
||||
|
||||
@@ -459,7 +461,7 @@ namespace Game.AI
|
||||
public virtual void QuestReward(Player player, Quest quest, LootItemType type, uint opt) { }
|
||||
|
||||
/// == Waypoints system =============================
|
||||
|
||||
///
|
||||
public virtual void WaypointPathStarted(uint pathId) { }
|
||||
|
||||
public virtual void WaypointStarted(uint nodeId, uint pathId) { }
|
||||
@@ -479,7 +481,6 @@ namespace Game.AI
|
||||
// Object destruction is handled by Unit::RemoveCharmedBy
|
||||
public virtual PlayerAI GetAIForCharmedPlayer(Player who) { return null; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Should return true if the NPC is target of an escort quest
|
||||
/// If onlyIfActive is set, should return true only if the escort quest is currently active
|
||||
|
||||
@@ -81,8 +81,8 @@ namespace Game.AI
|
||||
// prevents achievement tracking if returning true
|
||||
public virtual bool OnReportUse(Player player) { return false; }
|
||||
|
||||
public virtual void Destroyed(Player player, uint eventId) { }
|
||||
public virtual void Damaged(Player player, uint eventId) { }
|
||||
public virtual void Destroyed(WorldObject attacker, uint eventId) { }
|
||||
public virtual void Damaged(WorldObject attacker, uint eventId) { }
|
||||
|
||||
public virtual void SetData64(uint id, ulong value) { }
|
||||
public virtual ulong GetData64(uint id) { return 0; }
|
||||
@@ -93,6 +93,13 @@ namespace Game.AI
|
||||
public virtual void OnLootStateChanged(uint state, Unit unit) { }
|
||||
public virtual void OnStateChanged(GameObjectState state) { }
|
||||
public virtual void EventInform(uint eventId) { }
|
||||
public virtual void SpellHit(Unit unit, SpellInfo spellInfo) { }
|
||||
|
||||
// Called when hit by a spell
|
||||
public virtual void SpellHit(Unit caster, SpellInfo spellInfo) { }
|
||||
public virtual void SpellHit(GameObject caster, SpellInfo spellInfo) { }
|
||||
|
||||
// Called when spell hits a target
|
||||
public virtual void SpellHitTarget(Unit target, SpellInfo spellInfo) { }
|
||||
public virtual void SpellHitTarget(GameObject target, SpellInfo spellInfo) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,30 +373,6 @@ namespace Game.AI
|
||||
_isCombatMovementAllowed = allowMovement;
|
||||
}
|
||||
|
||||
// Called at any Damage from any attacker (before damage apply)
|
||||
public override void DamageTaken(Unit attacker, ref uint damage) { }
|
||||
|
||||
//Called at creature death
|
||||
public override void JustDied(Unit killer) { }
|
||||
|
||||
//Called at creature killing another unit
|
||||
public override void KilledUnit(Unit victim) { }
|
||||
|
||||
// Called when the creature summon successfully other creature
|
||||
public override void JustSummoned(Creature summon) { }
|
||||
|
||||
// Called when a summoned creature is despawned
|
||||
public override void SummonedCreatureDespawn(Creature summon) { }
|
||||
|
||||
// Called when hit by a spell
|
||||
public override void SpellHit(Unit caster, SpellInfo spell) { }
|
||||
|
||||
// Called when spell hits a target
|
||||
public override void SpellHitTarget(Unit target, SpellInfo spell) { }
|
||||
|
||||
// Called when AI is temporarily replaced or put back when possess is applied or removed
|
||||
public virtual void OnPossess(bool apply) { }
|
||||
|
||||
public static Creature GetClosestCreatureWithEntry(WorldObject source, uint entry, float maxSearchRange, bool alive = true)
|
||||
{
|
||||
return source.FindNearestCreature(entry, maxSearchRange, alive);
|
||||
@@ -407,12 +383,6 @@ namespace Game.AI
|
||||
return source.FindNearestGameObject(entry, maxSearchRange);
|
||||
}
|
||||
|
||||
//Called at creature reset either by death or evade
|
||||
public override void Reset() { }
|
||||
|
||||
//Called at creature aggro either by MoveInLOS or Attack Start
|
||||
public override void JustEngagedWith(Unit victim) { }
|
||||
|
||||
public bool HealthBelowPct(int pct) { return me.HealthBelowPct(pct); }
|
||||
public bool HealthAbovePct(int pct) { return me.HealthAbovePct(pct); }
|
||||
|
||||
|
||||
@@ -1118,9 +1118,9 @@ namespace Game.AI
|
||||
GetScript().ProcessEventsFor(SmartEvents.RewardQuest, player, quest.Id, opt, false, null, me);
|
||||
}
|
||||
|
||||
public override void Destroyed(Player player, uint eventId)
|
||||
public override void Destroyed(WorldObject attacker, uint eventId)
|
||||
{
|
||||
GetScript().ProcessEventsFor(SmartEvents.Death, player, eventId, 0, false, null, me);
|
||||
GetScript().ProcessEventsFor(SmartEvents.Death, attacker != null ? attacker.ToUnit() : null, eventId, 0, false, null, me);
|
||||
}
|
||||
|
||||
public override void SetData(uint id, uint value) { SetData(id, value, null); }
|
||||
|
||||
@@ -490,7 +490,7 @@ namespace Game.AI
|
||||
_me.CastSpell(target.ToUnit(), e.Action.cast.spell, new CastSpellExtraArgs(triggerFlag));
|
||||
}
|
||||
else if (_go)
|
||||
_go.CastSpell(target.ToUnit(), e.Action.cast.spell, triggerFlag);
|
||||
_go.CastSpell(target.ToUnit(), e.Action.cast.spell, new CastSpellExtraArgs(triggerFlag));
|
||||
}
|
||||
else
|
||||
Log.outDebug(LogFilter.ScriptsAi, "Spell {0} not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: {1} Entry: {2} Type: {3}) already has the aura",
|
||||
|
||||
Reference in New Issue
Block a user