Addition of stopAllEffectsWithoutExclusions method.

This commit is contained in:
MobiusDevelopment
2019-06-06 05:15:05 +00:00
parent 16c80a88d6
commit 8b34c14e88
26 changed files with 309 additions and 37 deletions

View File

@@ -344,6 +344,26 @@ public final 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

@@ -1650,7 +1650,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); _effectList.stopAllEffectsWithoutExclusions(true, true);
} }
else else
{ {
@@ -1691,8 +1691,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 final 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

@@ -1650,7 +1650,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); _effectList.stopAllEffectsWithoutExclusions(true, true);
} }
else else
{ {
@@ -1691,8 +1691,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 final 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

@@ -1650,7 +1650,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); _effectList.stopAllEffectsWithoutExclusions(true, true);
} }
else else
{ {
@@ -1691,8 +1691,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 final 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

@@ -1650,7 +1650,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); _effectList.stopAllEffectsWithoutExclusions(true, true);
} }
else else
{ {
@@ -1691,8 +1691,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 final 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

@@ -1650,7 +1650,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); _effectList.stopAllEffectsWithoutExclusions(true, true);
} }
else else
{ {
@@ -1691,8 +1691,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 final 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

@@ -1650,7 +1650,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); _effectList.stopAllEffectsWithoutExclusions(true, true);
} }
else else
{ {
@@ -1691,8 +1691,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 final 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

@@ -1650,7 +1650,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); _effectList.stopAllEffectsWithoutExclusions(true, true);
} }
else else
{ {
@@ -1691,8 +1691,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

@@ -658,6 +658,28 @@ public final 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(this::stopAndRemove);
_triggered.stream().forEach(this::stopAndRemove);
_dances.stream().forEach(this::stopAndRemove);
_toggles.stream().forEach(this::stopAndRemove);
_debuffs.stream().forEach(this::stopAndRemove);
_passives.stream().forEach(this::stopAndRemove);
// 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.
*/ */

View File

@@ -2401,7 +2401,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
// Stop HP/MP/CP Regeneration task // Stop HP/MP/CP Regeneration task
_status.stopHpMpRegeneration(); _status.stopHpMpRegeneration();
stopAllEffectsExceptThoseThatLastThroughDeath(); if (isMonster())
{
_effectList.stopAllEffectsWithoutExclusions(true, true);
}
else
{
stopAllEffectsExceptThoseThatLastThroughDeath();
}
calculateRewards(killer); calculateRewards(killer);
@@ -2443,6 +2450,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

@@ -344,6 +344,26 @@ public final 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

@@ -1650,7 +1650,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); _effectList.stopAllEffectsWithoutExclusions(true, true);
} }
else else
{ {
@@ -1691,8 +1691,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 final 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

@@ -1650,7 +1650,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); _effectList.stopAllEffectsWithoutExclusions(true, true);
} }
else else
{ {
@@ -1691,8 +1691,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 final 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

@@ -1650,7 +1650,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); _effectList.stopAllEffectsWithoutExclusions(true, true);
} }
else else
{ {
@@ -1691,8 +1691,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 final 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

@@ -1650,7 +1650,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); _effectList.stopAllEffectsWithoutExclusions(true, true);
} }
else else
{ {
@@ -1691,8 +1691,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 final 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

@@ -1650,7 +1650,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (isMonster()) if (isMonster())
{ {
stopAllEffects(); _effectList.stopAllEffectsWithoutExclusions(true, true);
} }
else else
{ {
@@ -1691,8 +1691,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());