mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/Pets: Update Lil' K.T. (#28071)
This commit is contained in:
55
sql/updates/world/3.3.5/2022_06_30_00_world.sql
Normal file
55
sql/updates/world/3.3.5/2022_06_30_00_world.sql
Normal file
@@ -0,0 +1,55 @@
|
||||
--
|
||||
UPDATE `spell_script_names` SET `ScriptName` = 'spell_pet_gen_lich_pet_onsummon' WHERE `ScriptName` = 'spell_gen_lich_pet_onsummon';
|
||||
UPDATE `spell_script_names` SET `ScriptName` = 'spell_pet_gen_lich_pet_aura_remove' WHERE `ScriptName` = 'spell_gen_lich_pet_aura_remove';
|
||||
UPDATE `spell_script_names` SET `ScriptName` = 'spell_pet_gen_lich_pet_aura' WHERE `ScriptName` = 'spell_gen_lich_pet_aura';
|
||||
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName` IN (
|
||||
'spell_pet_gen_lich_pet_periodic_emote',
|
||||
'spell_pet_gen_lich_pet_emote',
|
||||
'spell_pet_gen_lich_pet_focus');
|
||||
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
|
||||
(70050,'spell_pet_gen_lich_pet_periodic_emote'),
|
||||
(70049,'spell_pet_gen_lich_pet_emote'),
|
||||
(69682,'spell_pet_gen_lich_pet_focus');
|
||||
|
||||
DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = 70049;
|
||||
DELETE FROM `spell_scripts` WHERE `id` IN (69731,69682);
|
||||
|
||||
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = 36979;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid` = 36979 AND `source_type` = 0;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid` IN (3697900,3697901) AND `source_type` = 9;
|
||||
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`event_param5`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_param4`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
|
||||
(36979,0,0,0,11,0,100,0,0,0,0,0,0,11,69735,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"Lil' K.T. - On Spawn - Cast 'Lich Pet OnSummon'"),
|
||||
(36979,0,1,0,86,0,100,0,0,0,0,0,0,11,69736,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"Lil' K.T. - On Despawn - Cast 'Lich Pet Aura Remove'"),
|
||||
(36979,0,2,0,8,0,100,0,69731,0,0,0,0,80,3697900,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"Lil' K.T. - On Spellhit 'Lich Pet Aura OnKill' - Run Script"),
|
||||
(36979,0,3,0,83,0,100,0,69681,0,0,0,0,80,3697901,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"Lil' K.T. - On Spell Cast 'Lil' Frost Blast' - Run Script"),
|
||||
|
||||
-- Movement is definitely paused in both cases.
|
||||
-- If we root creature, and if both emote event and critter event will be executed at once, root will be cleared on aura remove, in other
|
||||
-- words before we clean it manually in script. That will screw up entire critter event. And doesn't really look like it should be rooted,
|
||||
-- more like movement is stopped. But packets are different.
|
||||
|
||||
-- The only way they can temporarily stop movement here is replace one action list by another.
|
||||
-- But that would mean they somehow overwrited default pet follow by scripted follow, would be weird.
|
||||
-- Actually we have a bunch of guardians and their default follow movement is somehow completely ignored by creature: Khadgar's Servant,
|
||||
-- Ancestral Spirit Wolf. Both actually are scripted on retail using only one action list which handles everything from spawn to despawn.
|
||||
-- At the same time Fel Guard Hound follows owner after spawn by default but has again one action list which interrupts default follow
|
||||
-- movement and resumes it after action list is finished. Kindal Moonweaver is a bit different because follow movement is launched from
|
||||
-- very first action list and is paused by another she executes(https://youtu.be/GV64q-i420o?t=115).
|
||||
-- So it looks like execution of any action list pauses follow movement no matter is it scripted or is default. Will such global mechanic
|
||||
-- work always without any problems? No idea. Something to think of.
|
||||
|
||||
(3697900,9,0,0,0,0,100,0,0,0,0,0,0,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Lil' K.T. - On Script - Stop Follow"),
|
||||
(3697900,9,1,0,0,0,100,0,0,0,0,0,0,4,16493,0,1,0,0,0,1,0,0,0,0,0,0,0,0,"Lil' K.T. - On Script - Play Sound 16493"),
|
||||
(3697900,9,2,0,0,0,100,0,0,0,0,0,0,17,451,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"Lil' K.T. - On Script - Set Emote State 451"),
|
||||
(3697900,9,3,0,0,0,100,0,1000,1000,0,0,0,17,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"Lil' K.T. - On Script - Set Emote State 0"),
|
||||
(3697900,9,4,0,0,0,100,0,3000,3000,0,0,0,29,0,0,0,0,0,0,23,0,0,0,0,0,0,0,0,"Lil' K.T. - On Script - Start Follow Owner"),
|
||||
|
||||
(3697901,9,0,0,0,0,100,0,0,0,0,0,0,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Lil' K.T. - On Script - Stop Follow"),
|
||||
(3697901,9,1,0,0,0,100,0,2000,2000,0,0,0,4,16493,0,1,0,0,0,1,0,0,0,0,0,0,0,0,"Lil' K.T. - On Script - Play Sound 16493"),
|
||||
(3697901,9,2,0,0,0,100,0,0,0,0,0,0,17,451,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"Lil' K.T. - On Script - Set Emote State 451"),
|
||||
(3697901,9,3,0,0,0,100,0,1000,1000,0,0,0,17,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,"Lil' K.T. - On Script - Set Emote State 0"),
|
||||
(3697901,9,4,0,0,0,100,0,3000,3000,0,0,0,29,0,0,0,0,0,0,23,0,0,0,0,0,0,0,0,"Lil' K.T. - On Script - Start Follow Owner");
|
||||
|
||||
-- Never was needed, never will work the way author expected
|
||||
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 17 AND `SourceEntry` IN (71849,69683);
|
||||
@@ -3081,12 +3081,6 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
{
|
||||
spellInfo->_GetEffect(EFFECT_1).TriggerSpell = 46737;
|
||||
});
|
||||
|
||||
// Lich Pet
|
||||
ApplySpellFix({ 70050 }, [](SpellInfo* spellInfo)
|
||||
{
|
||||
spellInfo->_GetEffect(EFFECT_0).TriggerSpell = 70049;
|
||||
});
|
||||
}
|
||||
|
||||
// Allows those to crit
|
||||
|
||||
@@ -16,19 +16,17 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ordered alphabetically using scriptname.
|
||||
* Scriptnames of files in this file should be prefixed with "npc_pet_gen_".
|
||||
* Spell and creature scripts in this file are not ordered but grouped(all scripts related to same creature in same place).
|
||||
* Scriptnames of spells and creatures in this file should be prefixed with "spell_pet_gen_" and "npc_pet_gen_" respectively.
|
||||
*/
|
||||
|
||||
/* ContentData
|
||||
npc_pet_gen_pandaren_monk 100% Pandaren Monk drinks and bows with you
|
||||
EndContentData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "PassiveAI.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellScript.h"
|
||||
|
||||
enum PandarenMonkMisc
|
||||
{
|
||||
@@ -141,26 +139,153 @@ struct npc_pet_gen_soul_trader : public ScriptedAI
|
||||
|
||||
enum LichPet
|
||||
{
|
||||
SPELL_LICH_ONSUMMON = 69735,
|
||||
SPELL_LICH_REMOVE_AURA = 69736
|
||||
SPELL_LICH_PET_AURA = 69732,
|
||||
SPELL_LICH_PET_AURA_ONKILL = 69731,
|
||||
SPELL_LICH_PET_EMOTE = 70049,
|
||||
|
||||
NPC_LICH_PET = 36979
|
||||
};
|
||||
|
||||
struct npc_pet_lich : public ScriptedAI
|
||||
// 69735 - Lich Pet OnSummon
|
||||
class spell_pet_gen_lich_pet_onsummon : public SpellScript
|
||||
{
|
||||
npc_pet_lich(Creature* creature) : ScriptedAI(creature) { }
|
||||
PrepareSpellScript(spell_pet_gen_lich_pet_onsummon);
|
||||
|
||||
void OnDespawn() override
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
if (Unit* owner = me->GetOwner())
|
||||
DoCast(owner, SPELL_LICH_REMOVE_AURA);
|
||||
return ValidateSpellInfo({ SPELL_LICH_PET_AURA });
|
||||
}
|
||||
|
||||
void JustAppeared() override
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* owner = me->GetOwner())
|
||||
DoCast(owner, SPELL_LICH_ONSUMMON);
|
||||
Unit* target = GetHitUnit();
|
||||
target->CastSpell(target, SPELL_LICH_PET_AURA, true);
|
||||
}
|
||||
|
||||
CreatureAI::JustAppeared();
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pet_gen_lich_pet_onsummon::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 69736 - Lich Pet Aura Remove
|
||||
class spell_pet_gen_lich_pet_aura_remove : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pet_gen_lich_pet_aura_remove);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_LICH_PET_AURA });
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
GetHitUnit()->RemoveAurasDueToSpell(SPELL_LICH_PET_AURA);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pet_gen_lich_pet_aura_remove::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 69732 - Lich Pet Aura
|
||||
class spell_pet_gen_lich_pet_aura : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_pet_gen_lich_pet_aura);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_LICH_PET_AURA_ONKILL });
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
return (eventInfo.GetProcTarget()->GetTypeId() == TYPEID_PLAYER);
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
Unit* owner = GetUnitOwner();
|
||||
|
||||
std::list<Creature*> minionList;
|
||||
owner->GetAllMinionsByEntry(minionList, NPC_LICH_PET);
|
||||
for (Creature* minion : minionList)
|
||||
owner->CastSpell(minion, SPELL_LICH_PET_AURA_ONKILL, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(spell_pet_gen_lich_pet_aura::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(spell_pet_gen_lich_pet_aura::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
|
||||
}
|
||||
};
|
||||
|
||||
// 70050 - [DND] Lich Pet
|
||||
class spell_pet_gen_lich_pet_periodic_emote : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_pet_gen_lich_pet_periodic_emote);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_LICH_PET_EMOTE });
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
// The chance to cast this spell is not 100%.
|
||||
// Triggered spell roots creature for 3 sec and plays anim and sound (doesn't require any script).
|
||||
// Emote and sound never shows up in sniffs because both comes from spell visual directly.
|
||||
// Both 69683 and 70050 can trigger spells at once and are not linked together in any way.
|
||||
// Effect of 70050 is overlapped by effect of 69683 but not instantly (69683 is a series of spell casts, takes longer to execute).
|
||||
// However, for some reason emote is not played if creature is idle and only if creature is moving or is already rooted.
|
||||
// For now it's scripted manually in script below to play emote always.
|
||||
if (roll_chance_i(50))
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_LICH_PET_EMOTE, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pet_gen_lich_pet_periodic_emote::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
||||
}
|
||||
};
|
||||
|
||||
// 70049 - [DND] Lich Pet
|
||||
class spell_pet_gen_lich_pet_emote : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_pet_gen_lich_pet_emote);
|
||||
|
||||
void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
GetTarget()->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_01);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_pet_gen_lich_pet_emote::AfterApply, EFFECT_0, SPELL_AURA_MOD_ROOT, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
// 69682 - Lil' K.T. Focus
|
||||
class spell_pet_gen_lich_pet_focus : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pet_gen_lich_pet_focus);
|
||||
|
||||
bool Validate(SpellInfo const* spellInfo) override
|
||||
{
|
||||
return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) });
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()));
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pet_gen_lich_pet_focus::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -168,5 +293,10 @@ void AddSC_generic_pet_scripts()
|
||||
{
|
||||
RegisterCreatureAI(npc_pet_gen_pandaren_monk);
|
||||
RegisterCreatureAI(npc_pet_gen_soul_trader);
|
||||
RegisterCreatureAI(npc_pet_lich);
|
||||
RegisterSpellScript(spell_pet_gen_lich_pet_onsummon);
|
||||
RegisterSpellScript(spell_pet_gen_lich_pet_aura_remove);
|
||||
RegisterSpellScript(spell_pet_gen_lich_pet_aura);
|
||||
RegisterSpellScript(spell_pet_gen_lich_pet_periodic_emote);
|
||||
RegisterSpellScript(spell_pet_gen_lich_pet_emote);
|
||||
RegisterSpellScript(spell_pet_gen_lich_pet_focus);
|
||||
}
|
||||
|
||||
@@ -1965,80 +1965,6 @@ class spell_gen_injured : 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);
|
||||
@@ -4578,9 +4504,6 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterSpellScript(spell_gen_gnomish_transporter);
|
||||
RegisterSpellScript(spell_gen_gryphon_wyvern_mount_check);
|
||||
RegisterSpellScript(spell_gen_injured);
|
||||
RegisterSpellScript(spell_gen_lich_pet_aura);
|
||||
RegisterSpellScript(spell_gen_lich_pet_onsummon);
|
||||
RegisterSpellScript(spell_gen_lich_pet_aura_remove);
|
||||
RegisterSpellScript(spell_gen_lifeblood);
|
||||
RegisterSpellScriptWithArgs(spell_gen_lifebloom, "spell_hexlord_lifebloom", SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL);
|
||||
RegisterSpellScriptWithArgs(spell_gen_lifebloom, "spell_tur_ragepaw_lifebloom", SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL);
|
||||
|
||||
Reference in New Issue
Block a user