diff options
| author | Giacomo Pozzoni <giacomopoz@gmail.com> | 2021-11-07 19:17:12 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-03-21 22:59:21 +0100 |
| commit | 791b759332b784211031571d3ca68cf0080897cb (patch) | |
| tree | bda8469726e232e8a4d51688e5a69da3e650193d /src/server/game/Spells/SpellEffects.cpp | |
| parent | 4c1b9d7455625c10af11a34d0f282db3aaff3c73 (diff) | |
Core/SAI: Add SMART_ACTION_ACTIVATE_GAMEOBJECT action (#27216)
Closes #27196
(cherry picked from commit 0817be8f76dead48e2c0eeb7d5a7434a452f0dcf)
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
| -rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 121 |
1 files changed, 1 insertions, 120 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 21ea77c8122..b4db1a2a4f1 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3317,126 +3317,7 @@ void Spell::EffectActivateObject() GameObjectActions action = GameObjectActions(effectInfo->MiscValue); - switch (action) - { - case GameObjectActions::AnimateCustom0: - case GameObjectActions::AnimateCustom1: - case GameObjectActions::AnimateCustom2: - case GameObjectActions::AnimateCustom3: - gameObjTarget->SendCustomAnim(uint32(action) - uint32(GameObjectActions::AnimateCustom0)); - break; - case GameObjectActions::Disturb: // What's the difference with Open? - case GameObjectActions::Open: - if (Unit* unitCaster = m_caster->ToUnit()) - gameObjTarget->Use(unitCaster); - break; - case GameObjectActions::OpenAndUnlock: - if (Unit* unitCaster = m_caster->ToUnit()) - gameObjTarget->UseDoorOrButton(0, false, unitCaster); - [[fallthrough]]; - case GameObjectActions::Unlock: - gameObjTarget->RemoveFlag(GO_FLAG_LOCKED); - break; - case GameObjectActions::Lock: - gameObjTarget->AddFlag(GO_FLAG_LOCKED); - break; - case GameObjectActions::Close: - case GameObjectActions::Rebuild: - gameObjTarget->ResetDoorOrButton(); - break; - case GameObjectActions::Despawn: - gameObjTarget->DespawnOrUnsummon(); - break; - case GameObjectActions::MakeInert: - gameObjTarget->AddFlag(GO_FLAG_NOT_SELECTABLE); - break; - case GameObjectActions::MakeActive: - gameObjTarget->RemoveFlag(GO_FLAG_NOT_SELECTABLE); - break; - case GameObjectActions::CloseAndLock: - gameObjTarget->ResetDoorOrButton(); - gameObjTarget->AddFlag(GO_FLAG_LOCKED); - break; - case GameObjectActions::Destroy: - if (Unit* unitCaster = m_caster->ToUnit()) - gameObjTarget->UseDoorOrButton(0, true, unitCaster); - break; - case GameObjectActions::UseArtKit0: - case GameObjectActions::UseArtKit1: - case GameObjectActions::UseArtKit2: - case GameObjectActions::UseArtKit3: - case GameObjectActions::UseArtKit4: - { - GameObjectTemplateAddon const* templateAddon = gameObjTarget->GetTemplateAddon(); - - uint32 artKitIndex = action != GameObjectActions::UseArtKit4 ? uint32(action) - uint32(GameObjectActions::UseArtKit0) : 4; - - uint32 artKitValue = 0; - if (templateAddon != nullptr) - artKitValue = templateAddon->ArtKits[artKitIndex]; - - if (artKitValue == 0) - TC_LOG_ERROR("sql.sql", "GameObject %d hit by spell %d needs `artkit%d` in `gameobject_template_addon`", gameObjTarget->GetEntry(), m_spellInfo->Id, artKitIndex); - else - gameObjTarget->SetGoArtKit(artKitValue); - - break; - } - case GameObjectActions::GoTo1stFloor: - case GameObjectActions::GoTo2ndFloor: - case GameObjectActions::GoTo3rdFloor: - case GameObjectActions::GoTo4thFloor: - case GameObjectActions::GoTo5thFloor: - case GameObjectActions::GoTo6thFloor: - case GameObjectActions::GoTo7thFloor: - case GameObjectActions::GoTo8thFloor: - case GameObjectActions::GoTo9thFloor: - case GameObjectActions::GoTo10thFloor: - if (gameObjTarget->GetGoType() == GAMEOBJECT_TYPE_TRANSPORT) - gameObjTarget->SetTransportState(GO_STATE_TRANSPORT_STOPPED, uint32(action) - uint32(GameObjectActions::GoTo1stFloor)); - else - TC_LOG_ERROR("spell", "Spell %d targeted non-transport gameobject for transport only action \"Go to Floor\" %d in effect %d", m_spellInfo->Id, int32(action), int32(effectInfo->EffectIndex)); - break; - case GameObjectActions::PlayAnimKit: - gameObjTarget->SetAnimKitId(effectInfo->MiscValueB, false); - break; - case GameObjectActions::OpenAndPlayAnimKit: - if (Unit* unitCaster = m_caster->ToUnit()) - gameObjTarget->UseDoorOrButton(0, false, unitCaster); - gameObjTarget->SetAnimKitId(effectInfo->MiscValueB, false); - break; - case GameObjectActions::CloseAndPlayAnimKit: - gameObjTarget->ResetDoorOrButton(); - gameObjTarget->SetAnimKitId(effectInfo->MiscValueB, false); - break; - case GameObjectActions::PlayOneShotAnimKit: - gameObjTarget->SetAnimKitId(effectInfo->MiscValueB, true); - break; - case GameObjectActions::StopAnimKit: - gameObjTarget->SetAnimKitId(0, false); - break; - case GameObjectActions::OpenAndStopAnimKit: - if (Unit* unitCaster = m_caster->ToUnit()) - gameObjTarget->UseDoorOrButton(0, false, unitCaster); - gameObjTarget->SetAnimKitId(0, false); - break; - case GameObjectActions::CloseAndStopAnimKit: - gameObjTarget->ResetDoorOrButton(); - gameObjTarget->SetAnimKitId(0, false); - break; - case GameObjectActions::PlaySpellVisual: - gameObjTarget->SetSpellVisualId(effectInfo->MiscValueB, m_originalCasterGUID); - break; - case GameObjectActions::StopSpellVisual: - gameObjTarget->SetSpellVisualId(0); - break; - case GameObjectActions::None: - TC_LOG_FATAL("spell", "Spell %d has action type NONE in effect %d", m_spellInfo->Id, int32(effectInfo->EffectIndex)); - break; - default: - TC_LOG_ERROR("spell", "Spell %d has unhandled action %d in effect %d", m_spellInfo->Id, int32(action), int32(effectInfo->EffectIndex)); - break; - } + gameObjTarget->ActivateObject(action, effectInfo->MiscValueB, m_caster, m_spellInfo->Id, int32(effectInfo->EffectIndex)); } void Spell::EffectApplyGlyph() |
