Re-addition of stopAllEffectsWithoutExclusions method.

Contributed by Sahar.
This commit is contained in:
MobiusDevelopment
2019-09-28 12:38:04 +00:00
parent 1cc5258821
commit 120c86fc2d
31 changed files with 529 additions and 81 deletions

View File

@ -344,6 +344,26 @@ public class EffectList
stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, true);
}
/**
* Exits all active, passive and option effects in this effect list without excluding anything,<br>
* like necessary toggles, irreplacable buffs or effects that last through death.<br>
* Stops all the effects, clear the effect lists and updates the effect flags and icons.
* @param update set to true to update the effect flags and icons.
* @param broadcast {@code true} to broadcast update packets, {@code false} otherwise.
*/
public void stopAllEffectsWithoutExclusions(boolean update, boolean broadcast)
{
_actives.stream().forEach(this::remove);
_passives.stream().forEach(this::remove);
_options.stream().forEach(this::remove);
// Update stats, effect flags and icons.
if (update)
{
updateEffectList(broadcast);
}
}
/**
* Stops all active toggle skills.
*/

View File

@ -74,6 +74,7 @@ import org.l2jmobius.gameserver.model.Hit;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Party;
import org.l2jmobius.gameserver.model.PlayerCondOverride;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.TeleportWhereType;
import org.l2jmobius.gameserver.model.TimeStamp;
import org.l2jmobius.gameserver.model.World;
@ -1650,7 +1651,15 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster())
{
stopAllEffects();
final Spawn spawn = ((Npc) this).getSpawn();
if ((spawn != null) && spawn.isRespawnEnabled())
{
stopAllEffects();
}
else
{
_effectList.stopAllEffectsWithoutExclusions(true, true);
}
}
else
{
@ -1701,8 +1710,8 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
_summoner.removeSummonedNpc(getObjectId());
}
// Remove all effects, do not broadcast changes.
_effectList.stopAllEffects(false);
// Remove all active, passive and option effects, do not broadcast changes.
_effectList.stopAllEffectsWithoutExclusions(false, false);
// Cancel all timers related to this Creature
TimersManager.getInstance().cancelTimers(getObjectId());