mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-30 21:57:01 +01:00
Core/BattlePets: Misc fixes (#27446)
* Added script for "Summon Battle Pet" spell (118301). * Set the saved display of the battle pet when summoning it. * If a summon has SummonPropertiesFlags::SummonFromBattlePetJournal it will remove NpcFlag UNIT_NPC_FLAG_WILD_BATTLE_PET (Wild battle pets). * When a creature is summoned with SummonTitle::Companion, it will check to see if it has SummonPropertiesFlags::SummonFromBattlePetJournal before updating the battle pet's update fields. (If you have a summoned battle pet and summon a creature with that SummonTitle, it will incorrectly update the battle pet's update fields with the summoned battle pet's data). * Implemented SummonPropertiesFlags::UseCreatureLevel. If a summon has this flag, it will use the owner's level (If the summon doesn't have SummonProperties it will always use the selected level).
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include "LFGMgr.h"
|
||||
#include "Log.h"
|
||||
#include "NPCPackets.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Pet.h"
|
||||
#include "ReputationMgr.h"
|
||||
#include "SkillDiscovery.h"
|
||||
@@ -4586,6 +4587,34 @@ class spell_defender_of_azeroth_speak_with_mograine : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
// 118301 - Summon Battle Pet
|
||||
class spell_summon_battle_pet : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_summon_battle_pet);
|
||||
|
||||
void HandleSummon(SpellEffIndex effIndex)
|
||||
{
|
||||
uint32 creatureId = uint32(GetSpellValue()->EffectBasePoints[effIndex]);
|
||||
if (sObjectMgr->GetCreatureTemplate(creatureId))
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetEffectInfo().MiscValueB));
|
||||
uint32 duration = uint32(GetSpellInfo()->CalcDuration(caster));
|
||||
Position pos = GetHitDest()->GetPosition();
|
||||
|
||||
if (Creature* summon = caster->GetMap()->SummonCreature(creatureId, pos, properties, duration, caster, GetSpellInfo()->Id))
|
||||
summon->SetImmuneToAll(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_summon_battle_pet::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_generic_spell_scripts()
|
||||
{
|
||||
RegisterAuraScript(spell_gen_absorb0_hitlimit1);
|
||||
@@ -4722,4 +4751,5 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterAuraScript(spell_gen_impatient_mind);
|
||||
RegisterSpellScript(spell_defender_of_azeroth_death_gate_selector);
|
||||
RegisterSpellScript(spell_defender_of_azeroth_speak_with_mograine);
|
||||
RegisterSpellScript(spell_summon_battle_pet);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user