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:
offl
2021-12-25 18:20:48 +02:00
committed by Shauren
parent 9ea8cdb457
commit 52bb230e4c
2 changed files with 25 additions and 13 deletions

View File

@@ -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;

View File

@@ -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;