AI/SmartAI: New SMART_ACTION_RESPAWN_BY_SPAWNID
Port From (https://github.com/TrinityCore/TrinityCore/commit/61baf6704cf4f31b8b5f24d627d315659336c992)
This commit is contained in:
@@ -387,7 +387,8 @@ namespace Framework.Constants
|
|||||||
SceneCancel = 130, // sceneId
|
SceneCancel = 130, // sceneId
|
||||||
SpawnSpawngroup = 131, // Group ID, min secs, max secs, spawnflags
|
SpawnSpawngroup = 131, // Group ID, min secs, max secs, spawnflags
|
||||||
DespawnSpawngroup = 132, // Group ID, min secs, max secs, spawnflags
|
DespawnSpawngroup = 132, // Group ID, min secs, max secs, spawnflags
|
||||||
// 131 - 134 : 3.3.5 reserved
|
RespawnBySpawnId = 133, // spawnType, spawnId
|
||||||
|
// 134 : 3.3.5 reserved
|
||||||
PlayCinematic = 135, // reserved for future uses
|
PlayCinematic = 135, // reserved for future uses
|
||||||
SetMovementSpeed = 136, // movementType, speedInteger, speedFraction
|
SetMovementSpeed = 136, // movementType, speedInteger, speedFraction
|
||||||
PlaySpellVisualKit = 137, // spellVisualKitId, kitType (unknown values, copypaste from packet dumps), duration
|
PlaySpellVisualKit = 137, // spellVisualKitId, kitType (unknown values, copypaste from packet dumps), duration
|
||||||
|
|||||||
@@ -1388,6 +1388,15 @@ namespace Game.AI
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SmartActions.RespawnBySpawnId:
|
||||||
|
{
|
||||||
|
if (Global.ObjectMgr.GetSpawnData((SpawnObjectType)e.Action.respawnData.spawnType, e.Action.respawnData.spawnId) == null)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Entry {e.EntryOrGuid} SourceType {e.GetScriptType()} Event {e.EventId} Action {e.GetActionType()} specifies invalid spawn data ({e.Action.respawnData.spawnType},{e.Action.respawnData.spawnId})");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SmartActions.SetMovementSpeed:
|
case SmartActions.SetMovementSpeed:
|
||||||
{
|
{
|
||||||
if (e.Action.movementSpeed.movementType >= (int)MovementGeneratorType.Max)
|
if (e.Action.movementSpeed.movementType >= (int)MovementGeneratorType.Max)
|
||||||
@@ -1493,6 +1502,7 @@ namespace Game.AI
|
|||||||
case SmartActions.RemoveAllGameobjects:
|
case SmartActions.RemoveAllGameobjects:
|
||||||
case SmartActions.SpawnSpawngroup:
|
case SmartActions.SpawnSpawngroup:
|
||||||
case SmartActions.DespawnSpawngroup:
|
case SmartActions.DespawnSpawngroup:
|
||||||
|
case SmartActions.StopMotion:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Not handled action_type({0}), event_type({1}), Entry {2} SourceType {3} Event {4}, skipped.", e.GetActionType(), e.GetEventType(), e.EntryOrGuid, e.GetScriptType(), e.EventId);
|
Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Not handled action_type({0}), event_type({1}), Entry {2} SourceType {3} Event {4}, skipped.", e.GetActionType(), e.GetEventType(), e.EntryOrGuid, e.GetScriptType(), e.EventId);
|
||||||
@@ -2498,6 +2508,9 @@ namespace Game.AI
|
|||||||
[FieldOffset(4)]
|
[FieldOffset(4)]
|
||||||
public StopMotion stopMotion;
|
public StopMotion stopMotion;
|
||||||
|
|
||||||
|
[FieldOffset(4)]
|
||||||
|
public RespawnData respawnData;
|
||||||
|
|
||||||
[FieldOffset(4)]
|
[FieldOffset(4)]
|
||||||
public AnimKit animKit;
|
public AnimKit animKit;
|
||||||
|
|
||||||
@@ -3005,6 +3018,11 @@ namespace Game.AI
|
|||||||
public uint stopMovement;
|
public uint stopMovement;
|
||||||
public uint movementExpired;
|
public uint movementExpired;
|
||||||
}
|
}
|
||||||
|
public struct RespawnData
|
||||||
|
{
|
||||||
|
public uint spawnType;
|
||||||
|
public uint spawnId;
|
||||||
|
}
|
||||||
public struct AnimKit
|
public struct AnimKit
|
||||||
{
|
{
|
||||||
public uint animKit;
|
public uint animKit;
|
||||||
|
|||||||
@@ -2309,6 +2309,21 @@ namespace Game.AI
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SmartActions.RespawnBySpawnId:
|
||||||
|
{
|
||||||
|
Map map = null;
|
||||||
|
WorldObject obj = GetBaseObject();
|
||||||
|
if (obj != null)
|
||||||
|
map = obj.GetMap();
|
||||||
|
else if (!targets.Empty())
|
||||||
|
map = targets.First().GetMap();
|
||||||
|
|
||||||
|
if (map)
|
||||||
|
map.RemoveRespawnTime((SpawnObjectType)e.Action.respawnData.spawnType, e.Action.respawnData.spawnId, true);
|
||||||
|
else
|
||||||
|
Log.outError(LogFilter.Sql, $"SmartScript.ProcessAction: Entry {e.EntryOrGuid} SourceType {e.GetScriptType()}, Event {e.EventId} - tries to respawn by spawnId but does not provide a map");
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SmartActions.PlayAnimkit:
|
case SmartActions.PlayAnimkit:
|
||||||
{
|
{
|
||||||
foreach (var target in targets)
|
foreach (var target in targets)
|
||||||
|
|||||||
Reference in New Issue
Block a user