Core/AreaTriggers: Refactor
* Moved IsServerside to custom flags * Flags moved from areatrigger_template to areatrigger_create_properties * New field to create custom CreateProperties (IsCustom) * New field to reference custom areatriggers (IsAreatriggerCustom) * Moved fields for shape data to areatrigger_create_properties Port From (https://github.com/TrinityCore/TrinityCore/commit/37eb2e64a6ad075e9866af6feb72bb4fbccb2adc)
This commit is contained in:
@@ -127,11 +127,11 @@ namespace Game.AI
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SmartScriptType.AreaTriggerEntityServerside:
|
||||
case SmartScriptType.AreaTriggerEntityCustom:
|
||||
{
|
||||
if (Global.AreaTriggerDataStorage.GetAreaTriggerTemplate(new AreaTriggerId((uint)temp.EntryOrGuid, true)) == null)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadFromDB: AreaTrigger entry ({temp.EntryOrGuid} IsServerSide true) does not exist, skipped loading.");
|
||||
Log.outError(LogFilter.Sql, $"SmartAIMgr.LoadFromDB: AreaTrigger entry ({temp.EntryOrGuid} IsCustom true) does not exist, skipped loading.");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
@@ -1123,9 +1123,9 @@ namespace Game.AI
|
||||
}
|
||||
case SmartEvents.AreatriggerOntrigger:
|
||||
{
|
||||
if (e.Event.areatrigger.id != 0 && (e.GetScriptType() == SmartScriptType.AreaTriggerEntity || e.GetScriptType() == SmartScriptType.AreaTriggerEntityServerside))
|
||||
if (e.Event.areatrigger.id != 0 && (e.GetScriptType() == SmartScriptType.AreaTriggerEntity || e.GetScriptType() == SmartScriptType.AreaTriggerEntityCustom))
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.EntryOrGuid} SourceType {e.GetScriptType()} Event {e.EventId} Action {e.GetActionType()} areatrigger param not supported for SMART_SCRIPT_TYPE_AREATRIGGER_ENTITY and SMART_SCRIPT_TYPE_AREATRIGGER_ENTITY_SERVERSIDE, skipped.");
|
||||
Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.EntryOrGuid} SourceType {e.GetScriptType()} Event {e.EventId} Action {e.GetActionType()} areatrigger param not supported for SMART_SCRIPT_TYPE_AREATRIGGER_ENTITY and SMART_SCRIPT_TYPE_AREATRIGGER_ENTITY_CUSTOM, skipped.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2351,7 +2351,7 @@ namespace Game.AI
|
||||
SmartScriptType.TimedActionlist => SmartScriptTypeMaskId.TimedActionlist,
|
||||
SmartScriptType.Scene => SmartScriptTypeMaskId.Scene,
|
||||
SmartScriptType.AreaTriggerEntity => SmartScriptTypeMaskId.AreatrigggerEntity,
|
||||
SmartScriptType.AreaTriggerEntityServerside => SmartScriptTypeMaskId.AreatrigggerEntity,
|
||||
SmartScriptType.AreaTriggerEntityCustom => SmartScriptTypeMaskId.AreatrigggerEntity,
|
||||
_ => 0,
|
||||
};
|
||||
|
||||
|
||||
@@ -2240,7 +2240,7 @@ namespace Game.AI
|
||||
|
||||
Log.outDebug(LogFilter.ScriptsAi, $"SmartScript::ProcessAction:: SMART_ACTION_PLAY_ANIMKIT: target: {target.GetName()} ({target.GetGUID()}), AnimKit: {e.Action.animKit.animKit}, Type: {e.Action.animKit.type}");
|
||||
}
|
||||
else if(IsGameObject(target))
|
||||
else if (IsGameObject(target))
|
||||
{
|
||||
switch (e.Action.animKit.type)
|
||||
{
|
||||
@@ -3764,9 +3764,7 @@ namespace Game.AI
|
||||
|
||||
public void OnUpdate(uint diff)
|
||||
{
|
||||
if ((_scriptType == SmartScriptType.Creature || _scriptType == SmartScriptType.GameObject
|
||||
|| _scriptType == SmartScriptType.AreaTriggerEntity || _scriptType == SmartScriptType.AreaTriggerEntityServerside)
|
||||
&& GetBaseObject() == null)
|
||||
if ((_scriptType == SmartScriptType.Creature || _scriptType == SmartScriptType.GameObject || _scriptType == SmartScriptType.AreaTriggerEntity || _scriptType == SmartScriptType.AreaTriggerEntityCustom) && GetBaseObject() == null)
|
||||
return;
|
||||
|
||||
if (_me != null && _me.IsInEvadeMode())
|
||||
@@ -3930,7 +3928,7 @@ namespace Game.AI
|
||||
FillScript(e, _go, null, null, null, 0);
|
||||
break;
|
||||
case SmartScriptType.AreaTriggerEntity:
|
||||
case SmartScriptType.AreaTriggerEntityServerside:
|
||||
case SmartScriptType.AreaTriggerEntityCustom:
|
||||
e = Global.SmartAIMgr.GetScript((int)_areaTrigger.GetEntry(), _scriptType);
|
||||
FillScript(e, _areaTrigger, null, null, null, 0);
|
||||
break;
|
||||
@@ -4041,8 +4039,8 @@ namespace Game.AI
|
||||
break;
|
||||
case TypeId.AreaTrigger:
|
||||
_areaTrigger = obj.ToAreaTrigger();
|
||||
_scriptType = _areaTrigger.IsServerSide() ? SmartScriptType.AreaTriggerEntityServerside : SmartScriptType.AreaTriggerEntity;
|
||||
Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.OnInitialize: source is AreaTrigger {_areaTrigger.GetEntry()}, IsServerSide {_areaTrigger.IsServerSide()}");
|
||||
_scriptType = _areaTrigger.IsCustom() ? SmartScriptType.AreaTriggerEntityCustom : SmartScriptType.AreaTriggerEntity;
|
||||
Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.OnInitialize: source is AreaTrigger {_areaTrigger.GetEntry()}, IsCustom {_areaTrigger.IsCustom()}");
|
||||
break;
|
||||
default:
|
||||
Log.outError(LogFilter.Scripts, "SmartScript.OnInitialize: Unhandled TypeID !WARNING!");
|
||||
@@ -4104,7 +4102,7 @@ namespace Game.AI
|
||||
Cell.VisitGridObjects(_me, searcher, range);
|
||||
return searcher.GetTarget();
|
||||
}
|
||||
|
||||
|
||||
void DoFindFriendlyCC(List<Creature> creatures, float range)
|
||||
{
|
||||
if (_me == null)
|
||||
@@ -4204,7 +4202,7 @@ namespace Game.AI
|
||||
}
|
||||
|
||||
public bool HasAnyEventWithFlag(SmartEventFlags flag) { return _allEventFlags.HasAnyFlag(flag); }
|
||||
|
||||
|
||||
public bool IsUnit(WorldObject obj) { return obj != null && (obj.IsTypeId(TypeId.Unit) || obj.IsTypeId(TypeId.Player)); }
|
||||
|
||||
public bool IsPlayer(WorldObject obj) { return obj != null && obj.IsTypeId(TypeId.Player); }
|
||||
|
||||
Reference in New Issue
Block a user