Core/SmartAI: implemented SMART_EVENT_EVENT_PHASE_CHANGE
Port From (https://github.com/TrinityCore/TrinityCore/commit/593d3243d4b8301fe03634d279b51a68b5d9effd)
This commit is contained in:
@@ -459,7 +459,7 @@ namespace Game.AI
|
||||
Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: EntryOrGuid {0} using event({1}) has invalid action type ({2}), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());
|
||||
return false;
|
||||
}
|
||||
if (e.Event.event_phase_mask > (uint)PhaseBits.All)
|
||||
if (e.Event.event_phase_mask > (uint)SmartEventPhaseBits.All)
|
||||
{
|
||||
Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: EntryOrGuid {0} using event({1}) has invalid phase mask ({2}), skipped.", e.entryOrGuid, e.event_id, e.Event.event_phase_mask);
|
||||
return false;
|
||||
@@ -650,6 +650,27 @@ namespace Game.AI
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case SmartEvents.PhaseChange:
|
||||
{
|
||||
if (e.Event.eventPhaseChange.phasemask == 0)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} has no param set, event won't be executed!.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (e.Event.eventPhaseChange.phasemask > (uint)SmartEventPhaseBits.All)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} uses invalid phasemask {e.Event.eventPhaseChange.phasemask}, skipped.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (e.Event.event_phase_mask != 0 && (e.Event.event_phase_mask & e.Event.eventPhaseChange.phasemask) == 0)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} uses event phasemask {e.Event.event_phase_mask} and incompatible event_param1 {e.Event.eventPhaseChange.phasemask}, skipped.");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SmartEvents.IsBehindTarget:
|
||||
{
|
||||
if (!IsMinMaxValid(e, e.Event.behindTarget.cooldownMin, e.Event.behindTarget.cooldownMax))
|
||||
@@ -1644,7 +1665,7 @@ namespace Game.AI
|
||||
{ SmartEvents.JustCreated, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject },
|
||||
{ SmartEvents.GossipHello, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject },
|
||||
{ SmartEvents.FollowCompleted, SmartScriptTypeMaskId.Creature },
|
||||
{ SmartEvents.Unused66, SmartScriptTypeMaskId.None },
|
||||
{ SmartEvents.PhaseChange, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject },
|
||||
{ SmartEvents.IsBehindTarget, SmartScriptTypeMaskId.Creature },
|
||||
{ SmartEvents.GameEventStart, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject },
|
||||
{ SmartEvents.GameEventEnd, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject },
|
||||
@@ -1704,6 +1725,11 @@ namespace Game.AI
|
||||
public SmartActions GetActionType() { return Action.type; }
|
||||
public SmartTargets GetTargetType() { return Target.type; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Entry {entryOrGuid} SourceType {GetScriptType()} Event {event_id} Action {GetActionType()}";
|
||||
}
|
||||
|
||||
public int entryOrGuid;
|
||||
public SmartScriptType source_type;
|
||||
public uint event_id;
|
||||
@@ -1816,6 +1842,9 @@ namespace Game.AI
|
||||
[FieldOffset(16)]
|
||||
public Dummy dummy;
|
||||
|
||||
[FieldOffset(16)]
|
||||
public EventPhaseChange eventPhaseChange;
|
||||
|
||||
[FieldOffset(16)]
|
||||
public BehindTarget behindTarget;
|
||||
|
||||
@@ -2010,6 +2039,10 @@ namespace Game.AI
|
||||
public uint spell;
|
||||
public uint effIndex;
|
||||
}
|
||||
public struct EventPhaseChange
|
||||
{
|
||||
public uint phasemask;
|
||||
}
|
||||
public struct BehindTarget
|
||||
{
|
||||
public uint cooldownMin;
|
||||
|
||||
Reference in New Issue
Block a user