Core/SAI: implement SMART_EVENT_SUMMONED_UNIT_DIES (82), useable by creatures and gameobjects
Port From (https://github.com/TrinityCore/TrinityCore/commit/d4a1a7a040be0ca0d6428669135bcc64d92be1c2)
This commit is contained in:
@@ -244,12 +244,9 @@ namespace Framework.Constants
|
||||
SceneTrigger = 79, // param_string : triggerName
|
||||
SceneCancel = 80, // none
|
||||
SceneComplete = 81, // none
|
||||
SummonedUnitDies = 82, // CreatureId(0 all), CooldownMin, CooldownMax
|
||||
|
||||
//New
|
||||
SpellEffectHit = 82,
|
||||
SpellEffectHitTarget = 83,
|
||||
|
||||
End = 84
|
||||
End = 83
|
||||
}
|
||||
|
||||
public enum SmartActions
|
||||
|
||||
@@ -641,6 +641,11 @@ namespace Game.AI
|
||||
GetScript().ProcessEventsFor(SmartEvents.SummonedUnit, summon);
|
||||
}
|
||||
|
||||
public override void SummonedCreatureDies(Creature summon, Unit killer)
|
||||
{
|
||||
GetScript().ProcessEventsFor(SmartEvents.SummonedUnitDies, summon);
|
||||
}
|
||||
|
||||
public override void AttackStart(Unit who)
|
||||
{
|
||||
// dont allow charmed npcs to act on their own
|
||||
@@ -1199,6 +1204,11 @@ namespace Game.AI
|
||||
GetScript().ProcessEventsFor(SmartEvents.SummonedUnit, creature);
|
||||
}
|
||||
|
||||
public override void SummonedCreatureDies(Creature summon, Unit killer)
|
||||
{
|
||||
GetScript().ProcessEventsFor(SmartEvents.SummonedUnitDies, summon);
|
||||
}
|
||||
|
||||
public override void SummonedCreatureDespawn(Creature unit)
|
||||
{
|
||||
GetScript().ProcessEventsFor(SmartEvents.SummonDespawned, unit, unit.GetEntry());
|
||||
|
||||
@@ -383,6 +383,7 @@ namespace Game.AI
|
||||
case SmartEvents.Death:
|
||||
case SmartEvents.Kill:
|
||||
case SmartEvents.SummonedUnit:
|
||||
case SmartEvents.SummonedUnitDies:
|
||||
case SmartEvents.SpellHit:
|
||||
case SmartEvents.SpellHitTarget:
|
||||
case SmartEvents.Damaged:
|
||||
@@ -679,6 +680,7 @@ namespace Game.AI
|
||||
break;
|
||||
case SmartEvents.SummonDespawned:
|
||||
case SmartEvents.SummonedUnit:
|
||||
case SmartEvents.SummonedUnitDies:
|
||||
if (e.Event.summoned.creature != 0 && !IsCreatureValid(e, e.Event.summoned.creature))
|
||||
return false;
|
||||
|
||||
@@ -932,7 +934,6 @@ namespace Game.AI
|
||||
case SmartEvents.SceneCancel:
|
||||
case SmartEvents.SceneComplete:
|
||||
case SmartEvents.SceneTrigger:
|
||||
case SmartEvents.SpellEffectHit:
|
||||
break;
|
||||
default:
|
||||
Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Not handled event_type({0}), Entry {1} SourceType {2} Event {3} Action {4}, skipped.", e.GetEventType(), e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType());
|
||||
@@ -1892,8 +1893,7 @@ namespace Game.AI
|
||||
SmartEvents.SceneTrigger => SmartScriptTypeMaskId.Scene,
|
||||
SmartEvents.SceneCancel => SmartScriptTypeMaskId.Scene,
|
||||
SmartEvents.SceneComplete => SmartScriptTypeMaskId.Scene,
|
||||
SmartEvents.SpellEffectHit => SmartScriptTypeMaskId.Spell,
|
||||
SmartEvents.SpellEffectHitTarget => SmartScriptTypeMaskId.Spell,
|
||||
SmartEvents.SummonedUnitDies => SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject,
|
||||
_ => 0,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3423,6 +3423,7 @@ namespace Game.AI
|
||||
break;
|
||||
}
|
||||
case SmartEvents.SummonedUnit:
|
||||
case SmartEvents.SummonedUnitDies:
|
||||
{
|
||||
if (!IsCreature(unit))
|
||||
return;
|
||||
@@ -3711,9 +3712,6 @@ namespace Game.AI
|
||||
ProcessAction(e, unit, var0, 0, false, null, null, varString);
|
||||
break;
|
||||
}
|
||||
case SmartEvents.SpellEffectHit:
|
||||
ProcessAction(e, unit, var0);
|
||||
break;
|
||||
default:
|
||||
Log.outError(LogFilter.Sql, "SmartScript.ProcessEvent: Unhandled Event type {0}", e.GetEventType());
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user