mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 01:15:35 +01:00
Scripts/Spells: Handle player talk in spell scripts pt 2 (#27640)
This commit is contained in:
@@ -188,8 +188,6 @@ class spell_q12688_detonate_2 : public SpellScript
|
||||
## npc_jungle_punch_target
|
||||
#####*/
|
||||
|
||||
#define SAY_OFFER "Care to try Grimbooze Thunderbrew's new jungle punch?"
|
||||
|
||||
enum JunglePunch
|
||||
{
|
||||
SPELL_OFFER = 51962,
|
||||
@@ -358,7 +356,6 @@ public:
|
||||
continue;
|
||||
|
||||
player->KilledMonsterCredit(me->GetEntry());
|
||||
player->Say(SAY_OFFER, LANG_UNIVERSAL);
|
||||
sayStep = 1;
|
||||
break;
|
||||
}
|
||||
@@ -627,59 +624,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/*######
|
||||
## Quest Dreadsaber Mastery: Stalking the Prey (12550)
|
||||
######*/
|
||||
|
||||
enum ShangoTracks
|
||||
{
|
||||
SPELL_CORRECT_TRACKS = 52160,
|
||||
SPELL_INCORRECT_TRACKS = 52163,
|
||||
SAY_CORRECT_TRACKS = 28634,
|
||||
SAY_INCORRECT_TRACKS = 28635
|
||||
};
|
||||
|
||||
// 52160 - Correct Tracks
|
||||
// 52163 - Incorrect Tracks
|
||||
class spell_shango_tracks : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_shango_tracks() : SpellScriptLoader("spell_shango_tracks") { }
|
||||
|
||||
class spell_shango_tracks_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_shango_tracks_SpellScript);
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
switch (GetSpellInfo()->Id)
|
||||
{
|
||||
case SPELL_CORRECT_TRACKS:
|
||||
target->Say(SAY_CORRECT_TRACKS, target);
|
||||
break;
|
||||
case SPELL_INCORRECT_TRACKS:
|
||||
target->Say(SAY_INCORRECT_TRACKS, target);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_shango_tracks_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
{
|
||||
return new spell_shango_tracks_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum ReturnedSevenfold
|
||||
{
|
||||
SPELL_FREYAS_WARD = 51845,
|
||||
@@ -728,6 +672,5 @@ void AddSC_sholazar_basin()
|
||||
new spell_q12620_the_lifewarden_wrath();
|
||||
new spell_q12589_shoot_rjr();
|
||||
new npc_haiphoon();
|
||||
new spell_shango_tracks();
|
||||
RegisterSpellScript(spell_q12611_deathbolt);
|
||||
}
|
||||
|
||||
@@ -2726,6 +2726,28 @@ class spell_gen_prevent_emotes : public AuraScript
|
||||
}
|
||||
};
|
||||
|
||||
class spell_gen_player_say : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_player_say);
|
||||
|
||||
bool Validate(SpellInfo const* spellInfo) override
|
||||
{
|
||||
return sObjectMgr->GetBroadcastText(uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()));
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
// Note: target here is always player; caster here is gameobject, creature or player (self cast)
|
||||
if (Unit* target = GetHitUnit())
|
||||
target->Unit::Say(uint32(GetEffectValue()), target);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_player_say::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_gen_proc_below_pct_damaged : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_proc_below_pct_damaged);
|
||||
@@ -4553,6 +4575,7 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterSpellScript(spell_gen_orc_disguise);
|
||||
RegisterSpellScript(spell_gen_paralytic_poison);
|
||||
RegisterSpellScript(spell_gen_prevent_emotes);
|
||||
RegisterSpellScript(spell_gen_player_say);
|
||||
RegisterSpellScriptWithArgs(spell_gen_proc_below_pct_damaged, "spell_item_soul_harvesters_charm");
|
||||
RegisterSpellScriptWithArgs(spell_gen_proc_below_pct_damaged, "spell_item_commendation_of_kaelthas");
|
||||
RegisterSpellScriptWithArgs(spell_gen_proc_below_pct_damaged, "spell_item_corpse_tongue_coin");
|
||||
|
||||
Reference in New Issue
Block a user