Core/SmartScripts: Rename SMART_ACTION_RESPAWN_TARGET -> SMART_ACTION_ENABLE_TEMP_GOBJ, since that's the only thing it still does in the dynspawn model. Adjust body accordingly to warn on misuse.

Port From (https://github.com/TrinityCore/TrinityCore/commit/32997a598992c5be7ad838b52b9e9a185d68d9fb)
This commit is contained in:
hondacrx
2021-08-09 09:57:11 -04:00
parent f2ff234456
commit 08db42917e
3 changed files with 17 additions and 10 deletions
+1 -1
View File
@@ -324,7 +324,7 @@ namespace Framework.Constants
CreateTimedEvent = 67, // Id, Initialmin, Initialmax, Repeatmin(Only If It Repeats), Repeatmax(Only If It Repeats), Chance
Playmovie = 68, // Entry
MoveToPos = 69, // PointId, transport, disablePathfinding, ContactDistance
RespawnTarget = 70, //
EnableTempGobj = 70, //
Equip = 71, // Entry, Slotmask Slot1, Slot2, Slot3 , Only Slots With Mask Set Will Be Sent To Client, Bits Are 1, 2, 4, Leaving Mask 0 Is Defaulted To Mask 7 (Send All), Slots1-3 Are Only Used If No Entry Is Set
CloseGossip = 72, // None
TriggerTimedEvent = 73, // Id(>1)
+12 -4
View File
@@ -1397,6 +1397,15 @@ namespace Game.AI
}
break;
}
case SmartActions.EnableTempGobj:
{
if (e.Action.enableTempGO.duration == 0)
{
Log.outError(LogFilter.Sql, $"Entry {e.EntryOrGuid} SourceType {e.GetScriptType()} Event {e.EventId} Action {e.GetActionType()} does not specify duration");
return false;
}
break;
}
case SmartActions.SetMovementSpeed:
{
if (e.Action.movementSpeed.movementType >= (int)MovementGeneratorType.Max)
@@ -1456,7 +1465,6 @@ namespace Game.AI
case SmartActions.RemoveUnitFlag:
case SmartActions.Playmovie:
case SmartActions.MoveToPos:
case SmartActions.RespawnTarget:
case SmartActions.CloseGossip:
case SmartActions.TriggerTimedEvent:
case SmartActions.RemoveTimedEvent:
@@ -2437,7 +2445,7 @@ namespace Game.AI
public Flee flee;
[FieldOffset(4)]
public RespawnTarget respawnTarget;
public EnableTempGO enableTempGO;
[FieldOffset(4)]
public MoveToPos moveToPos;
@@ -2899,9 +2907,9 @@ namespace Game.AI
{
public uint fleeTime;
}
public struct RespawnTarget
public struct EnableTempGO
{
public uint goRespawnTime;
public uint duration;
}
public struct MoveToPos
{
+4 -5
View File
@@ -1420,19 +1420,18 @@ namespace Game.AI
}
break;
}
case SmartActions.RespawnTarget:
case SmartActions.EnableTempGobj:
{
foreach (var target in targets)
{
if (IsCreature(target))
target.ToCreature().Respawn();
Log.outWarn(LogFilter.Sql, $"Invalid creature target '{target.GetName()}' (entry {target.GetEntry()}, spawnId {target.ToCreature().GetSpawnId()}) specified for SMART_ACTION_ENABLE_TEMP_GOBJ");
else if (IsGameObject(target))
{
// do not modify respawndelay of already spawned gameobjects
if (target.ToGameObject().IsSpawnedByDefault())
target.ToGameObject().Respawn();
Log.outWarn(LogFilter.Sql, $"Invalid gameobject target '{target.GetName()}' (entry {target.GetEntry()}, spawnId {target.ToGameObject().GetSpawnId()}) for SMART_ACTION_ENABLE_TEMP_GOBJ - the object is spawned by default");
else
target.ToGameObject().SetRespawnTime((int)e.Action.respawnTarget.goRespawnTime);
target.ToGameObject().SetRespawnTime((int)e.Action.enableTempGO.duration);
}
}
break;