diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index eccc62a95a..88219c7a5c 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3308,14 +3308,16 @@ void Unit::ProcessTerrainStatusUpdate(ZLiquidStatus status, Optional 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); // Update mount capabilities when changing liquidstatus (enabling / disabling flight auras for example) if (player) player->UpdateMountCapabilities(); - - _lastLiquid = curLiquid; } } void Unit::DeMorph() diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index f76b6cb700..fe9d29b23f 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3871,7 +3871,10 @@ void Spell::finish(bool ok) if (spellInfo && spellInfo->SpellIconID == 2056) { TC_LOG_DEBUG("spells", "Statue %d is unsummoned in spell %d finish", m_caster->GetGUID().GetCounter(), m_spellInfo->Id); - m_caster->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 (m_caster->getDeathState() != JUST_DIED) + m_caster->setDeathState(JUST_DIED); return; } }