Core/SAI: Use GetBaseObject as second param of SMART_ACTION_ACTIVATE_GAMEOBJECT & reorder GameObjectActions

Port From (https://github.com/TrinityCore/TrinityCore/commit/52bb230e4c83c814658b77f6d277da77e0b47be7)
This commit is contained in:
hondacrx
2022-05-30 14:46:24 -04:00
parent eedbf145d1
commit 1040f80181
2 changed files with 25 additions and 13 deletions
+1 -1
View File
@@ -2409,7 +2409,7 @@ namespace Game.AI
{ {
GameObject targetGo = target.ToGameObject(); GameObject targetGo = target.ToGameObject();
if (targetGo != null) if (targetGo != null)
targetGo.ActivateObject((GameObjectActions)e.Action.activateGameObject.gameObjectAction, (int)e.Action.activateGameObject.param); targetGo.ActivateObject((GameObjectActions)e.Action.activateGameObject.gameObjectAction, (int)e.Action.activateGameObject.param, GetBaseObject());
} }
break; break;
} }
+24 -12
View File
@@ -1490,6 +1490,9 @@ namespace Game.Entities
switch (action) switch (action)
{ {
case GameObjectActions.None:
Log.outFatal(LogFilter.Spells, $"Spell {spellId} has action type NONE in effect {effectIndex}");
break;
case GameObjectActions.AnimateCustom0: case GameObjectActions.AnimateCustom0:
case GameObjectActions.AnimateCustom1: case GameObjectActions.AnimateCustom1:
case GameObjectActions.AnimateCustom2: case GameObjectActions.AnimateCustom2:
@@ -1497,6 +1500,15 @@ namespace Game.Entities
SendCustomAnim((uint)(action - GameObjectActions.AnimateCustom0)); SendCustomAnim((uint)(action - GameObjectActions.AnimateCustom0));
break; break;
case GameObjectActions.Disturb: // What's the difference with Open? case GameObjectActions.Disturb: // What's the difference with Open?
if (unitCaster)
Use(unitCaster);
break;
case GameObjectActions.Unlock:
RemoveFlag(GameObjectFlags.Locked);
break;
case GameObjectActions.Lock:
AddFlag(GameObjectFlags.Locked);
break;
case GameObjectActions.Open: case GameObjectActions.Open:
if (unitCaster) if (unitCaster)
Use(unitCaster); Use(unitCaster);
@@ -1504,17 +1516,24 @@ namespace Game.Entities
case GameObjectActions.OpenAndUnlock: case GameObjectActions.OpenAndUnlock:
if (unitCaster) if (unitCaster)
UseDoorOrButton(0, false, unitCaster); UseDoorOrButton(0, false, unitCaster);
goto case GameObjectActions.Unlock;
case GameObjectActions.Unlock:
RemoveFlag(GameObjectFlags.Locked); RemoveFlag(GameObjectFlags.Locked);
break; break;
case GameObjectActions.Lock:
AddFlag(GameObjectFlags.Locked);
break;
case GameObjectActions.Close: case GameObjectActions.Close:
ResetDoorOrButton();
break;
case GameObjectActions.ToggleOpen:
// No use cases, implementation unknown
break;
case GameObjectActions.Destroy:
if (unitCaster)
UseDoorOrButton(0, true, unitCaster);
break;
case GameObjectActions.Rebuild: case GameObjectActions.Rebuild:
ResetDoorOrButton(); ResetDoorOrButton();
break; break;
case GameObjectActions.Creation:
// No use cases, implementation unknown
break;
case GameObjectActions.Despawn: case GameObjectActions.Despawn:
DespawnOrUnsummon(); DespawnOrUnsummon();
break; break;
@@ -1528,10 +1547,6 @@ namespace Game.Entities
ResetDoorOrButton(); ResetDoorOrButton();
AddFlag(GameObjectFlags.Locked); AddFlag(GameObjectFlags.Locked);
break; break;
case GameObjectActions.Destroy:
if (unitCaster)
UseDoorOrButton(0, true, unitCaster);
break;
case GameObjectActions.UseArtKit0: case GameObjectActions.UseArtKit0:
case GameObjectActions.UseArtKit1: case GameObjectActions.UseArtKit1:
case GameObjectActions.UseArtKit2: case GameObjectActions.UseArtKit2:
@@ -1601,9 +1616,6 @@ namespace Game.Entities
case GameObjectActions.StopSpellVisual: case GameObjectActions.StopSpellVisual:
SetSpellVisualId(0); SetSpellVisualId(0);
break; break;
case GameObjectActions.None:
Log.outFatal(LogFilter.Spells, $"Spell {spellId} has action type NONE in effect {effectIndex}");
break;
default: default:
Log.outError(LogFilter.Spells, $"Spell {spellId} has unhandled action {action} in effect {effectIndex}"); Log.outError(LogFilter.Spells, $"Spell {spellId} has unhandled action {action} in effect {effectIndex}");
break; break;