diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index fb11610b2a..ab324a26db 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -637,10 +637,6 @@ void DBCManager::LoadStores(const std::string& dataPath, uint32 defaultLocale) if (!spellInfo) continue; - SpellLevelsEntry const* levels = sSpellLevelsStore.LookupEntry(spellInfo->LevelsID); - if (spellInfo->LevelsID && (!levels || levels->SpellLevel)) - continue; - if (spellInfo && spellInfo->Attributes & SPELL_ATTR0_PASSIVE) { for (CreatureFamilyEntry const* cFamily : sCreatureFamilyStore) diff --git a/src/server/game/Entities/Creature/SummonInfo/SummonInfo.cpp b/src/server/game/Entities/Creature/SummonInfo/SummonInfo.cpp index 38015a3379..46493adfa6 100644 --- a/src/server/game/Entities/Creature/SummonInfo/SummonInfo.cpp +++ b/src/server/game/Entities/Creature/SummonInfo/SummonInfo.cpp @@ -25,6 +25,7 @@ #include "Log.h" #include "ObjectAccessor.h" #include "Player.h" +#include "SpellMgr.h" #include "SummonInfoArgs.h" #include "TotemPackets.h" @@ -130,6 +131,8 @@ void SummonInfo::HandlePreSummonActions() // Totem slot summons always send the TotemCreated packet. Some non-Shaman classes use this // to display summon icons that can be canceled (Consecration, DK ghouls, Wild Mushrooms) + // This packet must be sent before the creature is being added to the world so that the client + // does send correct GUIDs in CMSG_TOTEM_DESTROYED switch (slot) { case SummonPropertiesSlot::Totem1: @@ -187,6 +190,10 @@ void SummonInfo::HandlePostSummonActions() if (_summonedCreature->IsAIEnabled()) _summonedCreature->AI()->IsSummonedBy(summoner); } + + // Casting passive spells + if (IsControlledBySummoner()) + castPassiveSpells(); } void SummonInfo::HandlePreUnsummonActions() @@ -288,3 +295,31 @@ SummonPropertiesControl SummonInfo::GetControl() const { return _control; } + +void SummonInfo::castPassiveSpells() +{ + CreatureTemplate const* creatureInfo = _summonedCreature->GetCreatureTemplate(); + if (!creatureInfo) + return; + + CreatureFamilyEntry const* creatureFamilyEntry = sCreatureFamilyStore.LookupEntry(creatureInfo->family); + if (!creatureFamilyEntry) + return; + + auto const petSpellStore = sPetFamilySpellsStore.find(creatureFamilyEntry->ID); + if (petSpellStore == sPetFamilySpellsStore.end()) + return; + + for (uint32 spellId : petSpellStore->second) + { + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId)) + { + if (spellInfo->IsPassive()) + { + _summonedCreature->CastSpell(nullptr, spellId); + //if (spellInfo->HasAttribute(SPELL_ATTR4_OWNER_POWER_SCALING)) + // _scalingAuras.push_back(spellId); + } + } + } +} diff --git a/src/server/game/Entities/Creature/SummonInfo/SummonInfo.h b/src/server/game/Entities/Creature/SummonInfo/SummonInfo.h index c262fde577..da61b3b089 100644 --- a/src/server/game/Entities/Creature/SummonInfo/SummonInfo.h +++ b/src/server/game/Entities/Creature/SummonInfo/SummonInfo.h @@ -31,6 +31,15 @@ class Unit; struct SummonInfoArgs; +/* +The API for summoned creatures. This class contains all the functionality and features to handle summons +in a safe manner. However, do not store pointers to SummonInfo instances in scripts as they may change during runtime. +Instead resort to the accessor methods provided in the Unit class which always return intact instances +and pointers to both ends of a summon relation: +- Unit::GetSummonInSlot +- Unit::GetSummonsByCreatureId +- Unit::GetSummonsBySpellId + */ class TC_GAME_API SummonInfo { public: @@ -93,9 +102,12 @@ public: SummonPropertiesControl GetControl() const; private: + // Looks up and casts all passive spells of the creature summon. Often used for scaling auras. + void castPassiveSpells(); + Creature* _summonedCreature; ObjectGuid _summonerGUID; - Optional _remainingDuration; // NYI + Optional _remainingDuration; // Implemented in SummonInfo::UpdateRemainingDuration Optional _maxHealth; // Implemented in Creature::UpdateLevelDependantStats Optional _factionId; // Implemented in Creature::UpdateEntry Optional _creatureLevel; // Implemented in Creature::SelectLevel