diff options
author | offl <11556157+offl@users.noreply.github.com> | 2021-12-25 18:20:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-25 18:20:48 +0200 |
commit | 87cb0a4212535731749aebb2d3fe8f5c3000be92 (patch) | |
tree | e3fa2789ae078225bde5257c9efc21377217f50a | |
parent | accf27cb7b6662e65d8e854cc1746a3ea1163e5c (diff) |
Core/SAI: Use GetBaseObject as second param of SMART_ACTION_ACTIVATE_GAMEOBJECT & reorder GameObjectActions (#27461)
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 37 |
2 files changed, 28 insertions, 11 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index e44735bbe92..33ad020febc 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2309,7 +2309,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (GameObject* targetGo = target->ToGameObject()) { - targetGo->ActivateObject(GameObjectActions(e.action.activateGameObject.gameObjectAction)); + targetGo->ActivateObject(GameObjectActions(e.action.activateGameObject.gameObjectAction), GetBaseObject()); } } break; diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 2df3f55d7fa..c955e5d102b 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1438,6 +1438,9 @@ void GameObject::ActivateObject(GameObjectActions action, WorldObject* spellCast 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: @@ -1445,22 +1448,40 @@ void GameObject::ActivateObject(GameObjectActions action, WorldObject* spellCast SendCustomAnim(uint32(action) - uint32(GameObjectActions::AnimateCustom0)); break; case GameObjectActions::Disturb: // What's the difference with Open? + if (unitCaster) + Use(unitCaster); + break; + case GameObjectActions::Unlock: + case GameObjectActions::Lock: + ApplyModFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED, action == GameObjectActions::Lock); + break; case GameObjectActions::Open: if (unitCaster) Use(unitCaster); break; case GameObjectActions::OpenAndUnlock: if (unitCaster) + { UseDoorOrButton(0, false, unitCaster); - [[fallthrough]]; - case GameObjectActions::Unlock: - case GameObjectActions::Lock: - ApplyModFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED, action == GameObjectActions::Lock); + RemoveFlag(GAMEOBJECT_FLAGS, 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; @@ -1472,10 +1493,6 @@ void GameObject::ActivateObject(GameObjectActions action, WorldObject* spellCast ResetDoorOrButton(); SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); break; - case GameObjectActions::Destroy: - if (unitCaster) - UseDoorOrButton(0, true, unitCaster); - break; case GameObjectActions::UseArtKit0: case GameObjectActions::UseArtKit1: case GameObjectActions::UseArtKit2: @@ -1496,8 +1513,8 @@ void GameObject::ActivateObject(GameObjectActions action, WorldObject* spellCast break; } - case GameObjectActions::None: - TC_LOG_FATAL("spell", "Spell %d has action type NONE in effect %d", spellId, effectIndex); + case GameObjectActions::SetTapList: + // No use cases, implementation unknown break; default: TC_LOG_ERROR("spell", "Spell %d has unhandled action %d in effect %d", spellId, int32(action), effectIndex); |