mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/SAI: Use GetBaseObject as second param of SMART_ACTION_ACTIVATE_GAMEOBJECT & reorder GameObjectActions (#27461)
(cherry picked from commit 87cb0a4212)
This commit is contained in:
@@ -2445,7 +2445,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
if (GameObject* targetGo = target->ToGameObject())
|
||||
{
|
||||
targetGo->ActivateObject(GameObjectActions(e.action.activateGameObject.gameObjectAction), e.action.activateGameObject.param);
|
||||
targetGo->ActivateObject(GameObjectActions(e.action.activateGameObject.gameObjectAction), e.action.activateGameObject.param, GetBaseObject());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1643,6 +1643,9 @@ void GameObject::ActivateObject(GameObjectActions action, int32 param, WorldObje
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case GameObjectActions::None:
|
||||
TC_LOG_FATAL("spell", "Spell %d has action type NONE in effect %d", spellId, effectIndex);
|
||||
break;
|
||||
case GameObjectActions::AnimateCustom0:
|
||||
case GameObjectActions::AnimateCustom1:
|
||||
case GameObjectActions::AnimateCustom2:
|
||||
@@ -1650,6 +1653,15 @@ void GameObject::ActivateObject(GameObjectActions action, int32 param, WorldObje
|
||||
SendCustomAnim(uint32(action) - uint32(GameObjectActions::AnimateCustom0));
|
||||
break;
|
||||
case GameObjectActions::Disturb: // What's the difference with Open?
|
||||
if (unitCaster)
|
||||
Use(unitCaster);
|
||||
break;
|
||||
case GameObjectActions::Unlock:
|
||||
RemoveFlag(GO_FLAG_LOCKED);
|
||||
break;
|
||||
case GameObjectActions::Lock:
|
||||
AddFlag(GO_FLAG_LOCKED);
|
||||
break;
|
||||
case GameObjectActions::Open:
|
||||
if (unitCaster)
|
||||
Use(unitCaster);
|
||||
@@ -1657,17 +1669,24 @@ void GameObject::ActivateObject(GameObjectActions action, int32 param, WorldObje
|
||||
case GameObjectActions::OpenAndUnlock:
|
||||
if (unitCaster)
|
||||
UseDoorOrButton(0, false, unitCaster);
|
||||
[[fallthrough]];
|
||||
case GameObjectActions::Unlock:
|
||||
RemoveFlag(GO_FLAG_LOCKED);
|
||||
break;
|
||||
case GameObjectActions::Lock:
|
||||
AddFlag(GO_FLAG_LOCKED);
|
||||
break;
|
||||
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:
|
||||
ResetDoorOrButton();
|
||||
break;
|
||||
case GameObjectActions::Creation:
|
||||
// No use cases, implementation unknown
|
||||
break;
|
||||
case GameObjectActions::Despawn:
|
||||
DespawnOrUnsummon();
|
||||
break;
|
||||
@@ -1681,10 +1700,6 @@ void GameObject::ActivateObject(GameObjectActions action, int32 param, WorldObje
|
||||
ResetDoorOrButton();
|
||||
AddFlag(GO_FLAG_LOCKED);
|
||||
break;
|
||||
case GameObjectActions::Destroy:
|
||||
if (unitCaster)
|
||||
UseDoorOrButton(0, true, unitCaster);
|
||||
break;
|
||||
case GameObjectActions::UseArtKit0:
|
||||
case GameObjectActions::UseArtKit1:
|
||||
case GameObjectActions::UseArtKit2:
|
||||
@@ -1754,9 +1769,6 @@ void GameObject::ActivateObject(GameObjectActions action, int32 param, WorldObje
|
||||
case GameObjectActions::StopSpellVisual:
|
||||
SetSpellVisualId(0);
|
||||
break;
|
||||
case GameObjectActions::None:
|
||||
TC_LOG_FATAL("spell", "Spell %d has action type NONE in effect %d", spellId, effectIndex);
|
||||
break;
|
||||
default:
|
||||
TC_LOG_ERROR("spell", "Spell %d has unhandled action %d in effect %d", spellId, int32(action), effectIndex);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user