aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellEffects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp69
1 files changed, 1 insertions, 68 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 1a910fc16d1..720aadbb2d0 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -3762,74 +3762,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:
- case GameObjectActions::Lock:
- gameObjTarget->ApplyModFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED, action == GameObjectActions::Lock);
- break;
- case GameObjectActions::Close:
- case GameObjectActions::Rebuild:
- gameObjTarget->ResetDoorOrButton();
- break;
- case GameObjectActions::Despawn:
- gameObjTarget->DespawnOrUnsummon();
- break;
- case GameObjectActions::MakeInert:
- case GameObjectActions::MakeActive:
- gameObjTarget->ApplyModFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE, action == GameObjectActions::MakeInert);
- break;
- case GameObjectActions::CloseAndLock:
- gameObjTarget->ResetDoorOrButton();
- gameObjTarget->SetFlag(GAMEOBJECT_FLAGS, 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:
- {
- GameObjectTemplateAddon const* templateAddon = gameObjTarget->GetTemplateAddon();
-
- uint32 artKitIndex = uint32(action) - uint32(GameObjectActions::UseArtKit0);
-
- 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::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, m_caster, m_spellInfo->Id, int32(effectInfo->EffectIndex));
}
void Spell::EffectApplyGlyph()