Scripts/StormwindCity: Implement quest "The King's Command" (29547) (#30459)

This commit is contained in:
Meji
2024-11-27 23:21:08 +01:00
committed by GitHub
parent 65265f394d
commit f1079ec271
2 changed files with 104 additions and 0 deletions

View File

@@ -27,9 +27,19 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "Spell.h"
#include "SpellScript.h"
#include "TemporarySummon.h"
namespace StormwindCity
{
namespace Spells
{
static constexpr uint32 MOPAllianceIntroMoviePlay = 130805;
static constexpr uint32 FadeToBlack = 130411;
}
}
enum TidesOfWarData
{
QUEST_TIDES_OF_WAR = 46727,
@@ -494,6 +504,56 @@ private:
EventMap _events;
};
// 130804 - The King's Command Movie Aura
class spell_the_kings_command_movie_aura : public SpellScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({
StormwindCity::Spells::FadeToBlack
});
}
void HandleHitTarget(SpellEffIndex /*effIndex*/) const
{
Unit* hitUnit = GetHitUnit();
hitUnit->CastSpell(hitUnit, StormwindCity::Spells::FadeToBlack, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
.OriginalCastId = GetSpell()->m_castId
});
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_the_kings_command_movie_aura::HandleHitTarget, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
};
class spell_the_kings_command_movie_aura_aura : public AuraScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({
StormwindCity::Spells::MOPAllianceIntroMoviePlay
});
}
void HandleAfterEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
{
Unit* target = GetTarget();
target->CastSpell(target, StormwindCity::Spells::MOPAllianceIntroMoviePlay, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR
});
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_the_kings_command_movie_aura_aura::HandleAfterEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
void AddSC_stormwind_city()
{
// Creature
@@ -515,4 +575,5 @@ void AddSC_stormwind_city()
// Spells
RegisterSpellScript(spell_despawn_sailor_memory);
RegisterSpellScript(spell_kultiras_skip_intro);
RegisterSpellAndAuraScriptPair(spell_the_kings_command_movie_aura, spell_the_kings_command_movie_aura_aura);
}