aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Pet
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts/Pet')
-rw-r--r--src/server/scripts/Pet/pet_hunter.cpp160
-rw-r--r--src/server/scripts/Pet/pet_priest.cpp10
2 files changed, 164 insertions, 6 deletions
diff --git a/src/server/scripts/Pet/pet_hunter.cpp b/src/server/scripts/Pet/pet_hunter.cpp
index 321e44c8603..e31969bf597 100644
--- a/src/server/scripts/Pet/pet_hunter.cpp
+++ b/src/server/scripts/Pet/pet_hunter.cpp
@@ -35,6 +35,17 @@ enum HunterCreatures
NPC_HUNTER_VIPER = 19921
};
+enum PetSpellsMisc
+{
+ SPELL_PET_GUARD_DOG_HAPPINESS = 54445,
+ SPELL_PET_SILVERBACK_RANK_1 = 62800,
+ SPELL_PET_SILVERBACK_RANK_2 = 62801,
+ PET_ICON_ID_GROWL = 201,
+ PET_ICON_ID_CLAW = 262,
+ PET_ICON_ID_BITE = 1680,
+ PET_ICON_ID_SMACK = 473
+};
+
class npc_pet_hunter_snake_trap : public CreatureScript
{
public:
@@ -139,7 +150,156 @@ class npc_pet_hunter_snake_trap : public CreatureScript
}
};
+// -53178 - Guard Dog
+class spell_pet_guard_dog : public SpellScriptLoader
+{
+ public:
+ spell_pet_guard_dog() : SpellScriptLoader("spell_pet_guard_dog") { }
+
+ class spell_pet_guard_dog_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_pet_guard_dog_AuraScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_PET_GUARD_DOG_HAPPINESS))
+ return false;
+ return true;
+ }
+
+ bool CheckProc(ProcEventInfo& eventInfo)
+ {
+ // Growl shares family flags with other spells
+ // filter by spellIcon instead
+ SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
+ if (!spellInfo || spellInfo->SpellIconID != PET_ICON_ID_GROWL)
+ return false;
+
+ return true;
+ }
+
+ void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
+ {
+ PreventDefaultAction();
+
+ Unit* caster = eventInfo.GetActor();
+ caster->CastSpell((Unit*)nullptr, SPELL_PET_GUARD_DOG_HAPPINESS, true);
+
+ float addThreat = CalculatePct(eventInfo.GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster), aurEff->GetAmount());
+ eventInfo.GetProcTarget()->AddThreat(caster, addThreat);
+ }
+
+ void Register() override
+ {
+ DoCheckProc += AuraCheckProcFn(spell_pet_guard_dog_AuraScript::CheckProc);
+ OnEffectProc += AuraEffectProcFn(spell_pet_guard_dog_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const override
+ {
+ return new spell_pet_guard_dog_AuraScript();
+ }
+};
+
+// -62764 - Silverback
+class spell_pet_silverback : public SpellScriptLoader
+{
+ public:
+ spell_pet_silverback() : SpellScriptLoader("spell_pet_silverback") { }
+
+ class spell_pet_silverback_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_pet_silverback_AuraScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_PET_GUARD_DOG_HAPPINESS))
+ return false;
+ return true;
+ }
+
+ bool CheckProc(ProcEventInfo& eventInfo)
+ {
+ // Growl shares family flags with other spells
+ // filter by spellIcon instead
+ SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
+ if (!spellInfo || spellInfo->SpellIconID != PET_ICON_ID_GROWL)
+ return false;
+
+ return true;
+ }
+
+ void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
+ {
+ static uint32 const triggerSpell[2] = { SPELL_PET_SILVERBACK_RANK_1, SPELL_PET_SILVERBACK_RANK_2 };
+
+ PreventDefaultAction();
+
+ uint32 spellId = triggerSpell[GetSpellInfo()->GetRank() - 1];
+ eventInfo.GetActor()->CastSpell((Unit*)nullptr, spellId, true);
+ }
+
+ void Register() override
+ {
+ DoCheckProc += AuraCheckProcFn(spell_pet_silverback_AuraScript::CheckProc);
+ OnEffectProc += AuraEffectProcFn(spell_pet_silverback_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const override
+ {
+ return new spell_pet_silverback_AuraScript();
+ }
+};
+
+// -61680 - Culling the Herd
+class spell_pet_culling_the_herd : public SpellScriptLoader
+{
+ public:
+ spell_pet_culling_the_herd() : SpellScriptLoader("spell_pet_culling_the_herd") { }
+
+ class spell_pet_culling_the_herd_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_pet_culling_the_herd_AuraScript);
+
+ bool CheckProc(ProcEventInfo& eventInfo)
+ {
+ // Claw, Bite and Smack share FamilyFlags with other spells
+ // filter by spellIcon instead
+ SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
+ if (!spellInfo)
+ return false;
+
+ switch (spellInfo->SpellIconID)
+ {
+ case PET_ICON_ID_CLAW:
+ case PET_ICON_ID_BITE:
+ case PET_ICON_ID_SMACK:
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+ }
+
+ void Register() override
+ {
+ DoCheckProc += AuraCheckProcFn(spell_pet_culling_the_herd_AuraScript::CheckProc);
+ }
+ };
+
+ AuraScript* GetAuraScript() const override
+ {
+ return new spell_pet_culling_the_herd_AuraScript();
+ }
+};
+
void AddSC_hunter_pet_scripts()
{
new npc_pet_hunter_snake_trap();
+ new spell_pet_guard_dog();
+ new spell_pet_silverback();
+ new spell_pet_culling_the_herd();
}
diff --git a/src/server/scripts/Pet/pet_priest.cpp b/src/server/scripts/Pet/pet_priest.cpp
index a3110ce8f8b..a15b3bd7ffd 100644
--- a/src/server/scripts/Pet/pet_priest.cpp
+++ b/src/server/scripts/Pet/pet_priest.cpp
@@ -28,7 +28,7 @@
enum PriestSpells
{
SPELL_PRIEST_GLYPH_OF_SHADOWFIEND = 58228,
- SPELL_PRIEST_GLYPH_OF_SHADOWFIEND_MANA = 58227,
+ SPELL_PRIEST_SHADOWFIEND_DEATH = 57989,
SPELL_PRIEST_LIGHTWELL_CHARGES = 59907
};
@@ -70,12 +70,10 @@ class npc_pet_pri_shadowfiend : public CreatureScript
{
npc_pet_pri_shadowfiendAI(Creature* creature) : PetAI(creature) { }
- void JustDied(Unit* /*killer*/) override
+ void IsSummonedBy(Unit* summoner) override
{
- if (me->IsSummon())
- if (Unit* owner = me->ToTempSummon()->GetSummoner())
- if (owner->HasAura(SPELL_PRIEST_GLYPH_OF_SHADOWFIEND))
- owner->CastSpell(owner, SPELL_PRIEST_GLYPH_OF_SHADOWFIEND_MANA, true);
+ if (summoner->HasAura(SPELL_PRIEST_GLYPH_OF_SHADOWFIEND))
+ DoCastAOE(SPELL_PRIEST_SHADOWFIEND_DEATH);
}
};