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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -524,26 +524,28 @@ public class EffectList
*/ */
protected void stopAndRemove(BuffInfo info) 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. * 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 info the buff info
* @param effects the effect list * @param effects the effect list
*/ */
protected void stopAndRemove(BuffInfo info, Queue<BuffInfo> effects) protected void stopAndRemove(boolean broadcast, BuffInfo info, Queue<BuffInfo> 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. * 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 removed {@code true} if the effect is removed, {@code false} otherwise
* @param info the buff info * @param info the buff info
* @param buffs the buff list * @param buffs the buff list
*/ */
private void stopAndRemove(boolean removed, BuffInfo info, Queue<BuffInfo> buffs) private void stopAndRemove(boolean broadcast, boolean removed, BuffInfo info, Queue<BuffInfo> buffs)
{ {
if (info == null) if (info == null)
{ {
@ -553,7 +555,7 @@ public class EffectList
// Removes the buff from the given effect list. // Removes the buff from the given effect list.
buffs.remove(info); buffs.remove(info);
// Stop the buff effects. // 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 it's a hidden buff that ends, then decrease hidden buff count.
if (!info.isInUse()) if (!info.isInUse())
{ {
@ -614,8 +616,9 @@ public class EffectList
_stackedEffects.clear(); _stackedEffects.clear();
} }
// Update effect flags and icons. // Update effect flags, icons and ave.
updateEffectList(true); updateEffectList(true);
_owner.updateAbnormalEffect();
} }
/** /**
@ -626,31 +629,31 @@ public class EffectList
boolean update = false; boolean update = false;
if (hasBuffs()) 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; update = true;
} }
if (hasTriggered()) 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; update = true;
} }
if (hasDebuffs()) 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; update = true;
} }
if (hasDances()) 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; update = true;
} }
if (hasToggles()) 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; update = true;
} }
@ -658,6 +661,28 @@ public class EffectList
updateEffectList(update); updateEffectList(update);
} }
/**
* Exits all effects in this effect list without excluding anything.<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)
{
_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. * Stop all effects that doesn't stay on sub-class change.
*/ */
@ -666,31 +691,31 @@ public class EffectList
boolean update = false; boolean update = false;
if (hasBuffs()) 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; update = true;
} }
if (hasTriggered()) 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; update = true;
} }
if (hasDebuffs()) 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; update = true;
} }
if (hasDances()) 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; update = true;
} }
if (hasToggles()) 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; update = true;
} }
@ -707,12 +732,12 @@ public class EffectList
{ {
if (hasBuffs()) if (hasBuffs())
{ {
_buffs.forEach(b -> stopAndRemove(b, _buffs)); _buffs.forEach(b -> stopAndRemove(update, b, _buffs));
} }
if (triggered && hasTriggered()) if (triggered && hasTriggered())
{ {
_triggered.forEach(b -> stopAndRemove(b, _triggered)); _triggered.forEach(b -> stopAndRemove(update, b, _triggered));
} }
// Update effect flags and icons. // Update effect flags and icons.
@ -738,7 +763,7 @@ public class EffectList
{ {
return; return;
} }
_toggles.forEach(b -> stopAndRemove(b, _toggles)); _toggles.forEach(b -> stopAndRemove(update, b, _toggles));
// Update effect flags and icons. // Update effect flags and icons.
updateEffectList(update); updateEffectList(update);
} }
@ -753,7 +778,7 @@ public class EffectList
{ {
return; return;
} }
_dances.forEach(b -> stopAndRemove(b, _dances)); _dances.forEach(b -> stopAndRemove(update, b, _dances));
// Update effect flags and icons. // Update effect flags and icons.
updateEffectList(update); updateEffectList(update);
} }
@ -768,7 +793,7 @@ public class EffectList
{ {
return; return;
} }
_debuffs.forEach(b -> stopAndRemove(b, _debuffs)); _debuffs.forEach(b -> stopAndRemove(update, b, _debuffs));
// Update effect flags and icons. // Update effect flags and icons.
updateEffectList(update); updateEffectList(update);
} }
@ -900,31 +925,31 @@ public class EffectList
boolean update = false; boolean update = false;
if (hasBuffs()) 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; update = true;
} }
if (hasTriggered()) 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; update = true;
} }
if (hasDebuffs()) 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; update = true;
} }
if (hasDances()) 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; update = true;
} }
if (hasToggles()) 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; update = true;
} }
@ -944,32 +969,32 @@ public class EffectList
{ {
if (hasBuffs()) 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; update = true;
} }
if (hasTriggered()) 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; update = true;
} }
if (hasDances()) 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; update = true;
} }
if (hasToggles()) 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; update = true;
} }
} }
if (_hasDebuffsRemovedOnDamage && hasDebuffs()) 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 = true;
} }
// Update effect flags and icons. // Update effect flags and icons.
@ -1270,7 +1295,7 @@ public class EffectList
continue; continue;
} }
stopAndRemove(bi, effects); stopAndRemove(true, bi, effects);
buffsToRemove--; buffsToRemove--;
} }
} }

View File

@ -64,6 +64,7 @@ import org.l2jmobius.gameserver.model.EffectList;
import org.l2jmobius.gameserver.model.Location; import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Party; import org.l2jmobius.gameserver.model.Party;
import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.PlayerCondOverride;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.TeleportWhereType; import org.l2jmobius.gameserver.model.TeleportWhereType;
import org.l2jmobius.gameserver.model.TimeStamp; import org.l2jmobius.gameserver.model.TimeStamp;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
@ -2404,7 +2405,15 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); final Spawn spawn = ((Npc) this).getSpawn();
if ((spawn != null) && spawn.isRespawnEnabled())
{
stopAllEffects();
}
else
{
_effectList.stopAllEffectsWithoutExclusions(true, true);
}
} }
else else
{ {
@ -2451,6 +2460,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
getAI().stopAITask(); getAI().stopAITask();
} }
// Remove all effects, do not broadcast changes.
_effectList.stopAllEffectsWithoutExclusions(false, false);
// Cancel the BuffFinishTask related to this creature. // Cancel the BuffFinishTask related to this creature.
cancelBuffFinishTask(); cancelBuffFinishTask();

View File

@ -220,14 +220,15 @@ public class BuffInfo
* Removes effects stats.<br> * Removes effects stats.<br>
* <b>It will not remove the buff info from the effect list</b>.<br> * <b>It will not remove the buff info from the effect list</b>.<br>
* Instead call {@link EffectList#stopSkillEffects(boolean, Skill)} * 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 * @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); setRemoved(removed);
// Remove this buff info from BuffFinishTask. // Remove this buff info from BuffFinishTask.
_effected.removeBuffInfoTime(this); _effected.removeBuffInfoTime(this);
finishEffects(); finishEffects(broadcast);
} }
public void initializeEffects() public void initializeEffects()
@ -314,7 +315,7 @@ public class BuffInfo
} }
} }
public void finishEffects() public void finishEffects(boolean broadcast)
{ {
// Cancels the ticking task. // Cancels the ticking task.
for (EffectTaskInfo effectTask : _tasks.values()) for (EffectTaskInfo effectTask : _tasks.values())
@ -337,7 +338,7 @@ public class BuffInfo
} }
} }
// Remove abnormal visual effects. // Remove abnormal visual effects.
removeAbnormalVisualEffects(); removeAbnormalVisualEffects(broadcast);
// Set the proper system message. // Set the proper system message.
if (!(_effected.isSummon() && !((Summon) _effected).getOwner().hasSummon())) if (!(_effected.isSummon() && !((Summon) _effected).getOwner().hasSummon()))
{ {
@ -397,8 +398,9 @@ public class BuffInfo
/** /**
* Removes all the abnormal visual effects from the effected.<br> * Removes all the abnormal visual effects from the effected.<br>
* Prevents multiple updates. * 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)) if ((_effected == null) || (_skill == null))
{ {
@ -420,7 +422,10 @@ public class BuffInfo
_effected.stopAbnormalVisualEffect(false, _skill.getAbnormalVisualEffectsSpecial()); _effected.stopAbnormalVisualEffect(false, _skill.getAbnormalVisualEffectsSpecial());
} }
_effected.updateAbnormalEffect(); if (broadcast)
{
_effected.updateAbnormalEffect();
}
} }
/** /**

View File

@ -344,6 +344,26 @@ public class EffectList
stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, true); 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. * 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.Location;
import org.l2jmobius.gameserver.model.Party; import org.l2jmobius.gameserver.model.Party;
import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.PlayerCondOverride;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.TeleportWhereType; import org.l2jmobius.gameserver.model.TeleportWhereType;
import org.l2jmobius.gameserver.model.TimeStamp; import org.l2jmobius.gameserver.model.TimeStamp;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
@ -1649,7 +1650,15 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); final Spawn spawn = ((Npc) this).getSpawn();
if ((spawn != null) && spawn.isRespawnEnabled())
{
stopAllEffects();
}
else
{
_effectList.stopAllEffectsWithoutExclusions(true, true);
}
} }
else else
{ {
@ -1700,8 +1709,8 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
_summoner.removeSummonedNpc(getObjectId()); _summoner.removeSummonedNpc(getObjectId());
} }
// Remove all effects, do not broadcast changes. // Remove all active, passive and option effects, do not broadcast changes.
_effectList.stopAllEffects(false); _effectList.stopAllEffectsWithoutExclusions(false, false);
// Cancel all timers related to this Creature // Cancel all timers related to this Creature
TimersManager.getInstance().cancelTimers(getObjectId()); TimersManager.getInstance().cancelTimers(getObjectId());

View File

@ -344,6 +344,26 @@ public class EffectList
stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, true); 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. * 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.Location;
import org.l2jmobius.gameserver.model.Party; import org.l2jmobius.gameserver.model.Party;
import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.PlayerCondOverride;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.TeleportWhereType; import org.l2jmobius.gameserver.model.TeleportWhereType;
import org.l2jmobius.gameserver.model.TimeStamp; import org.l2jmobius.gameserver.model.TimeStamp;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
@ -1649,7 +1650,15 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); final Spawn spawn = ((Npc) this).getSpawn();
if ((spawn != null) && spawn.isRespawnEnabled())
{
stopAllEffects();
}
else
{
_effectList.stopAllEffectsWithoutExclusions(true, true);
}
} }
else else
{ {
@ -1700,8 +1709,8 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
_summoner.removeSummonedNpc(getObjectId()); _summoner.removeSummonedNpc(getObjectId());
} }
// Remove all effects, do not broadcast changes. // Remove all active, passive and option effects, do not broadcast changes.
_effectList.stopAllEffects(false); _effectList.stopAllEffectsWithoutExclusions(false, false);
// Cancel all timers related to this Creature // Cancel all timers related to this Creature
TimersManager.getInstance().cancelTimers(getObjectId()); TimersManager.getInstance().cancelTimers(getObjectId());

View File

@ -344,6 +344,26 @@ public class EffectList
stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, true); 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. * 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.Location;
import org.l2jmobius.gameserver.model.Party; import org.l2jmobius.gameserver.model.Party;
import org.l2jmobius.gameserver.model.PlayerCondOverride; import org.l2jmobius.gameserver.model.PlayerCondOverride;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.TeleportWhereType; import org.l2jmobius.gameserver.model.TeleportWhereType;
import org.l2jmobius.gameserver.model.TimeStamp; import org.l2jmobius.gameserver.model.TimeStamp;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
@ -1649,7 +1650,15 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); final Spawn spawn = ((Npc) this).getSpawn();
if ((spawn != null) && spawn.isRespawnEnabled())
{
stopAllEffects();
}
else
{
_effectList.stopAllEffectsWithoutExclusions(true, true);
}
} }
else else
{ {
@ -1700,8 +1709,8 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
_summoner.removeSummonedNpc(getObjectId()); _summoner.removeSummonedNpc(getObjectId());
} }
// Remove all effects, do not broadcast changes. // Remove all active, passive and option effects, do not broadcast changes.
_effectList.stopAllEffects(false); _effectList.stopAllEffectsWithoutExclusions(false, false);
// Cancel all timers related to this Creature // Cancel all timers related to this Creature
TimersManager.getInstance().cancelTimers(getObjectId()); TimersManager.getInstance().cancelTimers(getObjectId());

View File

@ -344,6 +344,26 @@ public class EffectList
stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, true); 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. * Stops all active toggle skills.
*/ */

View File

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

View File

@ -344,6 +344,26 @@ public class EffectList
stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, true); 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. * Stops all active toggle skills.
*/ */

View File

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

View File

@ -344,6 +344,26 @@ public class EffectList
stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, true); 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. * Stops all active toggle skills.
*/ */

View File

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