mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Spells: Fix infinite loop
Fix an infinite loop caused by a mix of item 25498 and liquid damage
This commit is contained in:
@@ -3136,9 +3136,12 @@ void Unit::ProcessTerrainStatusUpdate(ZLiquidStatus status, Optional<LiquidData>
|
||||
if (_lastLiquid && _lastLiquid->SpellId)
|
||||
RemoveAurasDueToSpell(_lastLiquid->SpellId);
|
||||
Player* player = GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
|
||||
// Set _lastLiquid before casting liquid spell to avoid infinite loops
|
||||
_lastLiquid = curLiquid;
|
||||
|
||||
if (curLiquid && curLiquid->SpellId && (!player || !player->IsGameMaster()))
|
||||
CastSpell(this, curLiquid->SpellId, true);
|
||||
_lastLiquid = curLiquid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3816,7 +3816,10 @@ void Spell::finish(bool ok)
|
||||
if (spellInfo && spellInfo->SpellIconID == 2056)
|
||||
{
|
||||
TC_LOG_DEBUG("spells", "Statue %d is unsummoned in spell %d finish", unitCaster->GetGUID().GetCounter(), m_spellInfo->Id);
|
||||
unitCaster->setDeathState(JUST_DIED);
|
||||
// Avoid infinite loops with setDeathState(JUST_DIED) being called over and over
|
||||
// It might make sense to do this check in Unit::setDeathState() and all overloaded functions
|
||||
if(unitCaster->getDeathState() != JUST_DIED)
|
||||
unitCaster->setDeathState(JUST_DIED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user