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.cpp124
1 files changed, 120 insertions, 4 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 01ea58864e8..8ddd4574525 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -3292,12 +3292,128 @@ void Spell::EffectActivateObject()
if (!gameObjTarget)
return;
- ScriptInfo activateCommand;
- activateCommand.command = SCRIPT_COMMAND_ACTIVATE_OBJECT;
+ GameObjectActions action = GameObjectActions(effectInfo->MiscValue);
- // int32 unk = effectInfo->MiscValue; // This is set for EffectActivateObject spells; needs research
+ 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;
- gameObjTarget->GetMap()->ScriptCommandStart(activateCommand, 0, m_caster, gameObjTarget);
+ 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;
+ }
}
void Spell::EffectApplyGlyph()