Scripts/Spells: Handle player talk in spell scripts pt 3 (#27657)

(cherry picked from commit e3409e277d)
This commit is contained in:
offl
2022-01-22 19:04:25 +02:00
committed by Shauren
parent 8be723788d
commit 3de50c52fd
2 changed files with 93 additions and 0 deletions

View File

@@ -17,6 +17,7 @@
#include "ScriptMgr.h"
#include "CreatureAIImpl.h"
#include "DB2Stores.h"
#include "GameObject.h"
#include "MotionMaster.h"
#include "ObjectAccessor.h"
@@ -1893,6 +1894,69 @@ class spell_dispel_freed_soldier_debuff : public SpellScript
}
};
/*######
## Quest 11690: Bring 'Em Back Alive
######*/
enum BringEmBackAlive
{
SPELL_KODO_DELIVERED = 48203,
TEXT_DELIVERED_1 = 24881,
TEXT_DELIVERED_2 = 24882,
TEXT_DELIVERED_3 = 26284,
TEXT_DELIVERED_4 = 26285,
TEXT_DELIVERED_5 = 26286
};
// 45877 - Deliver Kodo
class spell_deliver_kodo : public SpellScript
{
PrepareSpellScript(spell_deliver_kodo);
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_KODO_DELIVERED });
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_KODO_DELIVERED, true);
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_deliver_kodo::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
// 48204 - Kodo Delivered
class spell_kodo_delivered : public SpellScript
{
PrepareSpellScript(spell_kodo_delivered);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return sBroadcastTextStore.HasRecord(TEXT_DELIVERED_1) &&
sBroadcastTextStore.HasRecord(TEXT_DELIVERED_2) &&
sBroadcastTextStore.HasRecord(TEXT_DELIVERED_3) &&
sBroadcastTextStore.HasRecord(TEXT_DELIVERED_4) &&
sBroadcastTextStore.HasRecord(TEXT_DELIVERED_5);
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
caster->Unit::Say(RAND(TEXT_DELIVERED_1, TEXT_DELIVERED_2, TEXT_DELIVERED_3, TEXT_DELIVERED_4, TEXT_DELIVERED_5), caster);
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_kodo_delivered::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
void AddSC_borean_tundra()
{
new npc_corastrasza();
@@ -1917,4 +1981,6 @@ void AddSC_borean_tundra()
RegisterSpellScript(spell_nerubar_web_random_unit_not_on_quest_dummy);
RegisterSpellScript(spell_nerubar_web_random_unit_on_quest_dummy);
RegisterSpellScript(spell_dispel_freed_soldier_debuff);
RegisterSpellScript(spell_deliver_kodo);
RegisterSpellScript(spell_kodo_delivered);
}