fix(Scripts/Spell): Improve Inoculation quest (#15759)

* fix(Core/Quest): Improve Inoculation

* update fix

* .

* ..
This commit is contained in:
Grimgravy
2023-08-11 19:17:06 -03:00
committed by GitHub
parent 211ceecc32
commit c256d8da55
2 changed files with 61 additions and 0 deletions

View File

@@ -39,6 +39,8 @@ EndContentData */
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
#include "SpellAuras.h"
#include "SpellScript.h"
/*######
## npc_draenei_survivor
@@ -522,6 +524,55 @@ public:
}
};
enum NestlewoodOwlkin
{
NPC_NESTLEWOOD_OWLKIN_ENTRY = 16518,
NPC_INOCULATED_OWLKIN_ENTRY = 16534,
TALK_OWLKIN = 0
};
class spell_inoculate_nestlewood_owlkin : public AuraScript
{
public:
PrepareAuraScript(spell_inoculate_nestlewood_owlkin)
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* owlkin = GetTarget()->ToCreature())
if (owlkin->GetEntry() == NPC_NESTLEWOOD_OWLKIN_ENTRY)
owlkin->SetFacingToObject(GetCaster());
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
if (Creature* owlkin = GetTarget()->ToCreature())
{
if (owlkin->GetEntry() == NPC_NESTLEWOOD_OWLKIN_ENTRY)
{
Player* caster = GetCaster()->ToPlayer();
if (owlkin->UpdateEntry(NPC_INOCULATED_OWLKIN_ENTRY))
{
owlkin->AI()->Talk(TALK_OWLKIN);
owlkin->GetMotionMaster()->MoveRandom(15.0f);
owlkin->SetUnitFlag(UnitFlags(UNIT_FLAG_IMMUNE_TO_PC));
owlkin->DespawnOrUnsummon(15s, 0s);
caster->RewardPlayerAndGroupAtEvent(NPC_INOCULATED_OWLKIN_ENTRY, caster);
}
}
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_inoculate_nestlewood_owlkin::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_inoculate_nestlewood_owlkin::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
void AddSC_azuremyst_isle()
{
new npc_draenei_survivor();
@@ -531,4 +582,5 @@ void AddSC_azuremyst_isle()
new go_ravager_cage();
new npc_stillpine_capitive();
new go_bristlelimb_cage();
RegisterSpellScript(spell_inoculate_nestlewood_owlkin);
}