diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/EffectList.java index dc0ed5b182..0f0c04ae68 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/EffectList.java @@ -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,
+ * like necessary toggles, irreplacable buffs or effects that last through death.
+ * 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. */ diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java index 524e00e4ba..c50a086a26 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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()); diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/EffectList.java index dc0ed5b182..0f0c04ae68 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/EffectList.java @@ -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,
+ * like necessary toggles, irreplacable buffs or effects that last through death.
+ * 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. */ diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java index 524e00e4ba..c50a086a26 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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()); diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/EffectList.java index dc0ed5b182..0f0c04ae68 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/EffectList.java @@ -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,
+ * like necessary toggles, irreplacable buffs or effects that last through death.
+ * 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. */ diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java index 5a2b059d96..45cb122680 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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()); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/EffectList.java index dc0ed5b182..0f0c04ae68 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/EffectList.java @@ -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,
+ * like necessary toggles, irreplacable buffs or effects that last through death.
+ * 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. */ diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java index 5a2b059d96..45cb122680 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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()); diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/EffectList.java index dc0ed5b182..0f0c04ae68 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/EffectList.java @@ -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,
+ * like necessary toggles, irreplacable buffs or effects that last through death.
+ * 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. */ diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java index 5a2b059d96..45cb122680 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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()); diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/EffectList.java index dc0ed5b182..0f0c04ae68 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/EffectList.java @@ -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,
+ * like necessary toggles, irreplacable buffs or effects that last through death.
+ * 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. */ diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java index 5a2b059d96..45cb122680 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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()); diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/EffectList.java index dc0ed5b182..0f0c04ae68 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/EffectList.java @@ -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,
+ * like necessary toggles, irreplacable buffs or effects that last through death.
+ * 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. */ diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java index 5a2b059d96..45cb122680 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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()); diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/EffectList.java index dc0ed5b182..0f0c04ae68 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/EffectList.java @@ -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,
+ * like necessary toggles, irreplacable buffs or effects that last through death.
+ * 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. */ diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java index e3d841e005..43372a52f8 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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()); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/EffectList.java index 343959d231..bc83e3ecc1 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/EffectList.java @@ -524,26 +524,28 @@ public class EffectList */ protected void stopAndRemove(BuffInfo info) { - stopAndRemove(true, info, getEffectList(info.getSkill())); + stopAndRemove(true, true, info, getEffectList(info.getSkill())); } /** * Auxiliary method to stop all effects from a buff info and remove it from an effect list and stacked effects. + * @param broadcast if {@code true} broadcast abnormal visual effects * @param info the buff info * @param effects the effect list */ - protected void stopAndRemove(BuffInfo info, Queue effects) + protected void stopAndRemove(boolean broadcast, BuffInfo info, Queue effects) { - stopAndRemove(true, info, effects); + stopAndRemove(broadcast, true, info, effects); } /** * Auxiliary method to stop all effects from a buff info and remove it from an effect list and stacked effects. + * @param broadcast if {@code true} broadcast abnormal visual effects * @param removed {@code true} if the effect is removed, {@code false} otherwise * @param info the buff info * @param buffs the buff list */ - private void stopAndRemove(boolean removed, BuffInfo info, Queue buffs) + private void stopAndRemove(boolean broadcast, boolean removed, BuffInfo info, Queue buffs) { if (info == null) { @@ -553,7 +555,7 @@ public class EffectList // Removes the buff from the given effect list. buffs.remove(info); // Stop the buff effects. - info.stopAllEffects(removed); + info.stopAllEffects(broadcast, removed); // If it's a hidden buff that ends, then decrease hidden buff count. if (!info.isInUse()) { @@ -614,8 +616,9 @@ public class EffectList _stackedEffects.clear(); } - // Update effect flags and icons. + // Update effect flags, icons and ave. updateEffectList(true); + _owner.updateAbnormalEffect(); } /** @@ -626,31 +629,31 @@ public class EffectList boolean update = false; if (hasBuffs()) { - _buffs.stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, _buffs)); + _buffs.stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(true, info, _buffs)); update = true; } if (hasTriggered()) { - _triggered.stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, _triggered)); + _triggered.stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(true, info, _triggered)); update = true; } if (hasDebuffs()) { - _debuffs.stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, _debuffs)); + _debuffs.stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(true, info, _debuffs)); update = true; } if (hasDances()) { - _dances.stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, _dances)); + _dances.stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(true, info, _dances)); update = true; } if (hasToggles()) { - _toggles.stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, _toggles)); + _toggles.stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(true, info, _toggles)); update = true; } @@ -658,6 +661,28 @@ public class EffectList updateEffectList(update); } + /** + * Exits all effects in this effect list without excluding anything.
+ * 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) + { + _buffs.stream().forEach(info -> stopAndRemove(broadcast, info, _buffs)); + _triggered.stream().forEach(info -> stopAndRemove(broadcast, info, _triggered)); + _dances.stream().forEach(info -> stopAndRemove(broadcast, info, _dances)); + _toggles.stream().forEach(info -> stopAndRemove(broadcast, info, _toggles)); + _debuffs.stream().forEach(info -> stopAndRemove(broadcast, info, _debuffs)); + _passives.stream().forEach(info -> stopAndRemove(broadcast, info, _passives)); + + // Update stats, effect flags and icons. + if (update) + { + updateEffectList(broadcast); + } + } + /** * Stop all effects that doesn't stay on sub-class change. */ @@ -666,31 +691,31 @@ public class EffectList boolean update = false; if (hasBuffs()) { - _buffs.stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, _buffs)); + _buffs.stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(true, info, _buffs)); update = true; } if (hasTriggered()) { - _triggered.stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, _triggered)); + _triggered.stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(true, info, _triggered)); update = true; } if (hasDebuffs()) { - _debuffs.stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, _debuffs)); + _debuffs.stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(true, info, _debuffs)); update = true; } if (hasDances()) { - _dances.stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, _dances)); + _dances.stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(true, info, _dances)); update = true; } if (hasToggles()) { - _toggles.stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, _toggles)); + _toggles.stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(true, info, _toggles)); update = true; } @@ -707,12 +732,12 @@ public class EffectList { if (hasBuffs()) { - _buffs.forEach(b -> stopAndRemove(b, _buffs)); + _buffs.forEach(b -> stopAndRemove(update, b, _buffs)); } if (triggered && hasTriggered()) { - _triggered.forEach(b -> stopAndRemove(b, _triggered)); + _triggered.forEach(b -> stopAndRemove(update, b, _triggered)); } // Update effect flags and icons. @@ -738,7 +763,7 @@ public class EffectList { return; } - _toggles.forEach(b -> stopAndRemove(b, _toggles)); + _toggles.forEach(b -> stopAndRemove(update, b, _toggles)); // Update effect flags and icons. updateEffectList(update); } @@ -753,7 +778,7 @@ public class EffectList { return; } - _dances.forEach(b -> stopAndRemove(b, _dances)); + _dances.forEach(b -> stopAndRemove(update, b, _dances)); // Update effect flags and icons. updateEffectList(update); } @@ -768,7 +793,7 @@ public class EffectList { return; } - _debuffs.forEach(b -> stopAndRemove(b, _debuffs)); + _debuffs.forEach(b -> stopAndRemove(update, b, _debuffs)); // Update effect flags and icons. updateEffectList(update); } @@ -900,31 +925,31 @@ public class EffectList boolean update = false; if (hasBuffs()) { - _buffs.stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, _buffs)); + _buffs.stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(true, info, _buffs)); update = true; } if (hasTriggered()) { - _triggered.stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, _triggered)); + _triggered.stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(true, info, _triggered)); update = true; } if (hasDebuffs()) { - _debuffs.stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, _debuffs)); + _debuffs.stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(true, info, _debuffs)); update = true; } if (hasDances()) { - _dances.stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, _dances)); + _dances.stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(true, info, _dances)); update = true; } if (hasToggles()) { - _toggles.stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, _toggles)); + _toggles.stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(true, info, _toggles)); update = true; } @@ -944,32 +969,32 @@ public class EffectList { if (hasBuffs()) { - _buffs.stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, _buffs)); + _buffs.stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(true, info, _buffs)); update = true; } if (hasTriggered()) { - _triggered.stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, _triggered)); + _triggered.stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(true, info, _triggered)); update = true; } if (hasDances()) { - _dances.stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, _dances)); + _dances.stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(true, info, _dances)); update = true; } if (hasToggles()) { - _toggles.stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, _toggles)); + _toggles.stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(true, info, _toggles)); update = true; } } if (_hasDebuffsRemovedOnDamage && hasDebuffs()) { - _debuffs.stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, _debuffs)); + _debuffs.stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(true, info, _debuffs)); update = true; } // Update effect flags and icons. @@ -1270,7 +1295,7 @@ public class EffectList continue; } - stopAndRemove(bi, effects); + stopAndRemove(true, bi, effects); buffsToRemove--; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java index ee1733eb96..e876f3aad5 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -64,6 +64,7 @@ import org.l2jmobius.gameserver.model.EffectList; 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; @@ -2404,7 +2405,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 { @@ -2451,6 +2460,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe getAI().stopAITask(); } + // Remove all effects, do not broadcast changes. + _effectList.stopAllEffectsWithoutExclusions(false, false); + // Cancel the BuffFinishTask related to this creature. cancelBuffFinishTask(); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/skills/BuffInfo.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/skills/BuffInfo.java index be60ed534b..41e1f4d362 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/skills/BuffInfo.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/skills/BuffInfo.java @@ -220,14 +220,15 @@ public class BuffInfo * Removes effects stats.
* It will not remove the buff info from the effect list.
* Instead call {@link EffectList#stopSkillEffects(boolean, Skill)} + * @param broadcast if {@code true} broadcast abnormal visual effects * @param removed if {@code true} the skill will be handled as removed */ - public void stopAllEffects(boolean removed) + public void stopAllEffects(boolean broadcast, boolean removed) { setRemoved(removed); // Remove this buff info from BuffFinishTask. _effected.removeBuffInfoTime(this); - finishEffects(); + finishEffects(broadcast); } public void initializeEffects() @@ -314,7 +315,7 @@ public class BuffInfo } } - public void finishEffects() + public void finishEffects(boolean broadcast) { // Cancels the ticking task. for (EffectTaskInfo effectTask : _tasks.values()) @@ -337,7 +338,7 @@ public class BuffInfo } } // Remove abnormal visual effects. - removeAbnormalVisualEffects(); + removeAbnormalVisualEffects(broadcast); // Set the proper system message. if (!(_effected.isSummon() && !((Summon) _effected).getOwner().hasSummon())) { @@ -397,8 +398,9 @@ public class BuffInfo /** * Removes all the abnormal visual effects from the effected.
* Prevents multiple updates. + * @param broadcast if {@code true} broadcast abnormal visual effects */ - private void removeAbnormalVisualEffects() + private void removeAbnormalVisualEffects(boolean broadcast) { if ((_effected == null) || (_skill == null)) { @@ -420,7 +422,10 @@ public class BuffInfo _effected.stopAbnormalVisualEffect(false, _skill.getAbnormalVisualEffectsSpecial()); } - _effected.updateAbnormalEffect(); + if (broadcast) + { + _effected.updateAbnormalEffect(); + } } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/EffectList.java index dc0ed5b182..0f0c04ae68 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/EffectList.java @@ -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,
+ * like necessary toggles, irreplacable buffs or effects that last through death.
+ * 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. */ diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java index 5da289451c..38ff78f500 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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; @@ -1649,7 +1650,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 { @@ -1700,8 +1709,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()); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/EffectList.java index dc0ed5b182..0f0c04ae68 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/EffectList.java @@ -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,
+ * like necessary toggles, irreplacable buffs or effects that last through death.
+ * 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. */ diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java index 5da289451c..38ff78f500 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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; @@ -1649,7 +1650,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 { @@ -1700,8 +1709,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()); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/EffectList.java index dc0ed5b182..0f0c04ae68 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/EffectList.java @@ -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,
+ * like necessary toggles, irreplacable buffs or effects that last through death.
+ * 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. */ diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java index 5da289451c..38ff78f500 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -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; @@ -1649,7 +1650,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 { @@ -1700,8 +1709,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()); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/EffectList.java index dc0ed5b182..0f0c04ae68 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/EffectList.java @@ -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,
+ * like necessary toggles, irreplacable buffs or effects that last through death.
+ * 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. */ diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java index 93fd17e10e..3facf4b8c0 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -75,6 +75,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()); diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/EffectList.java index dc0ed5b182..0f0c04ae68 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/EffectList.java @@ -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,
+ * like necessary toggles, irreplacable buffs or effects that last through death.
+ * 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. */ diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java index 93fd17e10e..3facf4b8c0 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -75,6 +75,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()); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/EffectList.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/EffectList.java index dc0ed5b182..0f0c04ae68 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/EffectList.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/EffectList.java @@ -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,
+ * like necessary toggles, irreplacable buffs or effects that last through death.
+ * 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. */ diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java index c25599f7dd..8c066bbdba 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -75,6 +75,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());