Skip to content

Commit c77ed42

Browse files
committed
Core/Creatures: mark summons with an expiration timer as active so they will continue to expire while no player is nearby
1 parent 373aad9 commit c77ed42

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/server/game/Entities/Creature/SummonInfo/SummonInfo.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,12 @@ void SummonInfo::HandlePreSummonActions()
160160

161161
void SummonInfo::HandlePostSummonActions()
162162
{
163-
Unit* summoner = GetUnitSummoner();
164163

165-
if (summoner)
164+
// If it's a summon with an expiration timer, mark it as active so its time won't stop ticking if no player is nearby
165+
if (_remainingDuration.has_value())
166+
_summonedCreature->setActive(true);
167+
168+
if (Unit* summoner = GetUnitSummoner())
166169
{
167170
// Register Pet and enable its control
168171
if (_control == SummonPropertiesControl::Pet)
@@ -299,18 +302,18 @@ SummonPropertiesControl SummonInfo::GetControl() const
299302
void SummonInfo::castPassiveSpells()
300303
{
301304
CreatureTemplate const* creatureInfo = _summonedCreature->GetCreatureTemplate();
302-
if (!creatureInfo)
305+
if (!creatureInfo || !creatureInfo->family)
303306
return;
304307

305308
CreatureFamilyEntry const* creatureFamilyEntry = sCreatureFamilyStore.LookupEntry(creatureInfo->family);
306309
if (!creatureFamilyEntry)
307310
return;
308311

309-
auto const petSpellStore = sPetFamilySpellsStore.find(creatureFamilyEntry->ID);
310-
if (petSpellStore == sPetFamilySpellsStore.end())
312+
PetFamilySpellsStore::const_iterator itr = sPetFamilySpellsStore.find(creatureFamilyEntry->ID);
313+
if (itr == sPetFamilySpellsStore.end())
311314
return;
312315

313-
for (uint32 spellId : petSpellStore->second)
316+
for (uint32 spellId : itr->second)
314317
{
315318
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId))
316319
{

0 commit comments

Comments
 (0)