mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
Scripts/Pet: Lil' K.T (#24528)
* Lil' K.T. * Rename 9999_99_99_99_world_335.sql to 2020_05_10_00_world.sql Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com>
This commit is contained in:
6
sql/updates/world/3.3.5/2020_05_10_00_world.sql
Normal file
6
sql/updates/world/3.3.5/2020_05_10_00_world.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
UPDATE creature_template SET `AIName`='',`ScriptName`='npc_pet_lich' WHERE entry=36979;
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_gen_lich_pet_aura', 'spell_gen_lich_pet_onsummon', 'spell_gen_lich_pet_aura_remove');
|
||||
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
|
||||
(69732,'spell_gen_lich_pet_aura'),
|
||||
(69735,'spell_gen_lich_pet_onsummon'),
|
||||
(69736,'spell_gen_lich_pet_aura_remove');
|
||||
@@ -150,8 +150,34 @@ struct npc_pet_gen_soul_trader : public ScriptedAI
|
||||
}
|
||||
};
|
||||
|
||||
enum LichPet
|
||||
{
|
||||
SPELL_LICH_ONSUMMON = 69735,
|
||||
SPELL_LICH_REMOVE_AURA = 69736
|
||||
};
|
||||
|
||||
struct npc_pet_lich : public ScriptedAI
|
||||
{
|
||||
npc_pet_lich(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void LeavingWorld() override
|
||||
{
|
||||
if (Unit* owner = me->GetOwner())
|
||||
DoCast(owner, SPELL_LICH_REMOVE_AURA);
|
||||
}
|
||||
|
||||
void JustAppeared() override
|
||||
{
|
||||
if (Unit* owner = me->GetOwner())
|
||||
DoCast(owner, SPELL_LICH_ONSUMMON);
|
||||
|
||||
CreatureAI::JustAppeared();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_generic_pet_scripts()
|
||||
{
|
||||
new npc_pet_gen_pandaren_monk();
|
||||
RegisterCreatureAI(npc_pet_gen_soul_trader);
|
||||
RegisterCreatureAI(npc_pet_lich);
|
||||
}
|
||||
|
||||
@@ -1934,6 +1934,80 @@ class spell_gen_gnomish_transporter : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
enum LichPet
|
||||
{
|
||||
NPC_LICH_PET = 36979,
|
||||
|
||||
SPELL_LICH_PET_AURA = 69732,
|
||||
SPELL_LICH_PET_AURA_ONKILL = 69731
|
||||
};
|
||||
|
||||
// 69732 - Lich Pet Aura
|
||||
class spell_gen_lich_pet_aura : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_lich_pet_aura);
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
return (eventInfo.GetProcTarget()->GetTypeId() == TYPEID_PLAYER);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* /* aurEff */, ProcEventInfo& /* eventInfo */)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
std::list<Creature*> minionList;
|
||||
GetUnitOwner()->GetAllMinionsByEntry(minionList, NPC_LICH_PET);
|
||||
for (Creature* minion : minionList)
|
||||
if (minion->IsAIEnabled())
|
||||
minion->AI()->DoCastSelf(SPELL_LICH_PET_AURA_ONKILL);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(spell_gen_lich_pet_aura::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(spell_gen_lich_pet_aura::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
|
||||
}
|
||||
};
|
||||
|
||||
// 69735 - Lich Pet OnSummon
|
||||
class spell_gen_lich_pet_onsummon : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_lich_pet_onsummon);
|
||||
|
||||
bool Validate(SpellInfo const* /* spellInfo */) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_LICH_PET_AURA });
|
||||
}
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
Unit* target = GetHitUnit();
|
||||
target->CastSpell(target, SPELL_LICH_PET_AURA, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_lich_pet_onsummon::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 69736 - Lich Pet Aura Remove
|
||||
class spell_gen_lich_pet_aura_remove : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_lich_pet_aura_remove);
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
GetHitUnit()->RemoveAurasDueToSpell(SPELL_LICH_PET_AURA);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_lich_pet_aura_remove::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_gen_lifeblood : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_lifeblood);
|
||||
@@ -4450,6 +4524,9 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterSpellScript(spell_gen_gadgetzan_transporter_backfire);
|
||||
RegisterAuraScript(spell_gen_gift_of_naaru);
|
||||
RegisterSpellScript(spell_gen_gnomish_transporter);
|
||||
RegisterAuraScript(spell_gen_lich_pet_aura);
|
||||
RegisterSpellScript(spell_gen_lich_pet_onsummon);
|
||||
RegisterSpellScript(spell_gen_lich_pet_aura_remove);
|
||||
RegisterAuraScript(spell_gen_lifeblood);
|
||||
new spell_gen_lifebloom("spell_hexlord_lifebloom", SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL);
|
||||
new spell_gen_lifebloom("spell_tur_ragepaw_lifebloom", SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL);
|
||||
|
||||
Reference in New Issue
Block a user