From 4c68b859164e73c228c88f139d433055eb815c60 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 29 Mar 2022 11:26:21 +0000 Subject: [PATCH] Fixed buffs display in random positions. --- .../gameserver/model/actor/Creature.java | 94 +++++++++---------- .../gameserver/model/actor/Creature.java | 94 +++++++++---------- 2 files changed, 94 insertions(+), 94 deletions(-) diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java index 49c7473347..a13fe1fe1a 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -26,6 +26,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.Future; import java.util.logging.Logger; @@ -1833,7 +1834,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder ((Player) this).reviveRequest(((Player) this), null, false); } - // Update active skills in progress (In Use and Not In Use because stacked) icones on client + // Update active skills in progress (In Use and Not In Use because stacked) icons on client updateEffectIcons(); // Custom boss announcements configuration. @@ -2934,12 +2935,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder } /** Map 32 bits (0x0000) containing all abnormal effect in progress. */ - private int _AbnormalEffects; + private int _abnormalEffects; /** - * Set containing all active skills effects in progress of a Creature. + * List containing all active skills effects in progress of a Creature. */ - private final Set _effects = ConcurrentHashMap.newKeySet(); + private final List _effects = new CopyOnWriteArrayList<>(); /** The table containing the List of all stacked effect in progress for each Stack group Identifier. */ protected Map> _stackedEffects = new HashMap<>(); @@ -2985,7 +2986,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder *
  • If this effect doesn't belong to a Stack Group, add its Funcs to the Calculator set of the Creature (remove the old one if necessary)
  • *
  • If this effect has higher priority in its Stack Group, add its Funcs to the Calculator set of the Creature (remove previous stacked effect Funcs if necessary)
  • *
  • If this effect has NOT higher priority in its Stack Group, set the effect to Not In Use
  • - *
  • Update active skills in progress icones on player client

  • + *
  • Update active skills in progress icons on player client

  • * @param newEffect the new effect */ public synchronized void addEffect(Effect newEffect) @@ -3035,30 +3036,29 @@ public abstract class Creature extends WorldObject implements ISkillsHolder } // Add the Effect to all effect in progress on the Creature - // if (!newEffect.getSkill().isToggle()) - // { - // int pos = 0; - // for (int i = 0; i < _effects.size(); i++) - // { - // if (_effects.get(i) != null) - // { - // final int skillId = _effects.get(i).getSkill().getId(); - // if (!_effects.get(i).getSkill().isToggle() && ((skillId <= 4360) || (skillId >= 4367))) - // { - // pos++; - // } - // } - // else - // { - // break; - // } - // } - // _effects.add(pos, newEffect); - // } - // else - // { - _effects.add(newEffect); - // } + if (!newEffect.getSkill().isToggle()) + { + int pos = 0; + for (Effect effect : _effects) + { + if (effect == null) + { + break; + } + + final int skillId = effect.getSkill().getId(); + if (!effect.getSkill().isToggle() && ((skillId <= 4360) || (skillId >= 4367))) + { + pos++; + } + } + + _effects.add(pos, newEffect); + } + else + { + _effects.add(newEffect); + } // Check if a stack group is defined for this effect if (newEffect.getStackType().equals("none")) @@ -3069,7 +3069,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder // Add Funcs of this effect to the Calculator set of the Creature addStatFuncs(newEffect.getStatFuncs()); - // Update active skills in progress icones on player client + // Update active skills in progress icons on player client updateEffectIcons(); return; } @@ -3111,7 +3111,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder addStatFuncs(stackQueue.get(0).getStatFuncs()); } - // Update active skills in progress (In Use and Not In Use because stacked) icones on client + // Update active skills in progress (In Use and Not In Use because stacked) icons on client updateEffectIcons(); } @@ -3168,7 +3168,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder *
  • Remove Func added by this effect from the Creature Calculator (Stop Effect)
  • *
  • If the Effect belongs to a not empty Stack Group, replace theses Funcs by next stacked effect Funcs
  • *
  • Remove the Effect from _effects of the Creature
  • - *
  • Update active skills in progress icones on player client

  • + *
  • Update active skills in progress icons on player client

  • * @param effect the effect */ public void removeEffect(Effect effect) @@ -3231,10 +3231,10 @@ public abstract class Creature extends WorldObject implements ISkillsHolder } } - // Remove the active skill L2effect from _effects of the Creature + // Remove the active skill effect from _effects of the Creature _effects.remove(effect); - // Update active skills in progress (In Use and Not In Use because stacked) icones on client + // Update active skills in progress (In Use and Not In Use because stacked) icons on client updateEffectIcons(); } @@ -3244,7 +3244,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder */ public void startAbnormalEffect(int mask) { - _AbnormalEffects |= mask; + _abnormalEffects |= mask; updateAbnormalEffect(); } @@ -3393,7 +3393,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder */ public void stopAbnormalEffect(int mask) { - _AbnormalEffects &= ~mask; + _abnormalEffects &= ~mask; updateAbnormalEffect(); } @@ -3501,7 +3501,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder * Actions:
    *
  • Remove Func added by this effect from the Creature Calculator (Stop Effect)
  • *
  • Remove the Effect from _effects of the Creature
  • - *
  • Update active skills in progress icones on player client

  • + *
  • Update active skills in progress icons on player client

  • * @param type The type of effect to stop ((ex : BUFF, DMG_OVER_TIME...) */ public void stopEffects(EffectType type) @@ -3747,7 +3747,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder public abstract void updateAbnormalEffect(); /** - * Update active skills in progress (In Use and Not In Use because stacked) icones on client.
    + * Update active skills in progress (In Use and Not In Use because stacked) icons on client.
    *
    * Concept:
    *
    @@ -3904,36 +3904,36 @@ public abstract class Creature extends WorldObject implements ISkillsHolder */ public int getAbnormalEffect() { - int ae = _AbnormalEffects; + int mask = _abnormalEffects; if (_isStunned) { - ae |= ABNORMAL_EFFECT_STUN; + mask |= ABNORMAL_EFFECT_STUN; } if (_isRooted) { - ae |= ABNORMAL_EFFECT_ROOT; + mask |= ABNORMAL_EFFECT_ROOT; } if (_isSleeping) { - ae |= ABNORMAL_EFFECT_SLEEP; + mask |= ABNORMAL_EFFECT_SLEEP; } if (_isConfused) { - ae |= ABNORMAL_EFFECT_CONFUSED; + mask |= ABNORMAL_EFFECT_CONFUSED; } if (_isMuted) { - ae |= ABNORMAL_EFFECT_MUTED; + mask |= ABNORMAL_EFFECT_MUTED; } if (_isAfraid) { - ae |= ABNORMAL_EFFECT_AFRAID; + mask |= ABNORMAL_EFFECT_AFRAID; } if (_isPhysicalMuted) { - ae |= ABNORMAL_EFFECT_MUTED; + mask |= ABNORMAL_EFFECT_MUTED; } - return ae; + return mask; } /** diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java index 717e592105..54812cf4ba 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -26,6 +26,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.Future; import java.util.logging.Logger; @@ -1876,7 +1877,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder ((Player) this).reviveRequest(((Player) this), null, false); } - // Update active skills in progress (In Use and Not In Use because stacked) icones on client + // Update active skills in progress (In Use and Not In Use because stacked) icons on client updateEffectIcons(); // Custom boss announcements configuration. @@ -2977,12 +2978,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder } /** Map 32 bits (0x0000) containing all abnormal effect in progress. */ - private int _AbnormalEffects; + private int _abnormalEffects; /** - * Set containing all active skills effects in progress of a Creature. + * List containing all active skills effects in progress of a Creature. */ - private final Set _effects = ConcurrentHashMap.newKeySet(); + private final List _effects = new CopyOnWriteArrayList<>(); /** The table containing the List of all stacked effect in progress for each Stack group Identifier. */ protected Map> _stackedEffects = new HashMap<>(); @@ -3028,7 +3029,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder *
  • If this effect doesn't belong to a Stack Group, add its Funcs to the Calculator set of the Creature (remove the old one if necessary)
  • *
  • If this effect has higher priority in its Stack Group, add its Funcs to the Calculator set of the Creature (remove previous stacked effect Funcs if necessary)
  • *
  • If this effect has NOT higher priority in its Stack Group, set the effect to Not In Use
  • - *
  • Update active skills in progress icones on player client

  • + *
  • Update active skills in progress icons on player client

  • * @param newEffect the new effect */ public synchronized void addEffect(Effect newEffect) @@ -3087,30 +3088,29 @@ public abstract class Creature extends WorldObject implements ISkillsHolder } // Add the Effect to all effect in progress on the Creature - // if (!newEffect.getSkill().isToggle()) - // { - // int pos = 0; - // for (int i = 0; i < _effects.size(); i++) - // { - // if (_effects.get(i) != null) - // { - // final int skillId = _effects.get(i).getSkill().getId(); - // if (!_effects.get(i).getSkill().isToggle() && ((skillId <= 4360) || (skillId >= 4367))) - // { - // pos++; - // } - // } - // else - // { - // break; - // } - // } - // _effects.add(pos, newEffect); - // } - // else - // { - _effects.add(newEffect); - // } + if (!newEffect.getSkill().isToggle()) + { + int pos = 0; + for (Effect effect : _effects) + { + if (effect == null) + { + break; + } + + final int skillId = effect.getSkill().getId(); + if (!effect.getSkill().isToggle() && ((skillId <= 4360) || (skillId >= 4367))) + { + pos++; + } + } + + _effects.add(pos, newEffect); + } + else + { + _effects.add(newEffect); + } // Check if a stack group is defined for this effect if (newEffect.getStackType().equals("none")) @@ -3121,7 +3121,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder // Add Funcs of this effect to the Calculator set of the Creature addStatFuncs(newEffect.getStatFuncs()); - // Update active skills in progress icones on player client + // Update active skills in progress icons on player client updateEffectIcons(); return; } @@ -3163,7 +3163,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder addStatFuncs(stackQueue.get(0).getStatFuncs()); } - // Update active skills in progress (In Use and Not In Use because stacked) icones on client + // Update active skills in progress (In Use and Not In Use because stacked) icons on client updateEffectIcons(); } @@ -3220,7 +3220,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder *
  • Remove Func added by this effect from the Creature Calculator (Stop Effect)
  • *
  • If the Effect belongs to a not empty Stack Group, replace theses Funcs by next stacked effect Funcs
  • *
  • Remove the Effect from _effects of the Creature
  • - *
  • Update active skills in progress icones on player client

  • + *
  • Update active skills in progress icons on player client

  • * @param effect the effect */ public void removeEffect(Effect effect) @@ -3283,10 +3283,10 @@ public abstract class Creature extends WorldObject implements ISkillsHolder } } - // Remove the active skill L2effect from _effects of the Creature + // Remove the active skill effect from _effects of the Creature _effects.remove(effect); - // Update active skills in progress (In Use and Not In Use because stacked) icones on client + // Update active skills in progress (In Use and Not In Use because stacked) icons on client updateEffectIcons(); } @@ -3296,7 +3296,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder */ public void startAbnormalEffect(int mask) { - _AbnormalEffects |= mask; + _abnormalEffects |= mask; updateAbnormalEffect(); } @@ -3445,7 +3445,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder */ public void stopAbnormalEffect(int mask) { - _AbnormalEffects &= ~mask; + _abnormalEffects &= ~mask; updateAbnormalEffect(); } @@ -3553,7 +3553,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder * Actions:
    *
  • Remove Func added by this effect from the Creature Calculator (Stop Effect)
  • *
  • Remove the Effect from _effects of the Creature
  • - *
  • Update active skills in progress icones on player client

  • + *
  • Update active skills in progress icons on player client

  • * @param type The type of effect to stop ((ex : BUFF, DMG_OVER_TIME...) */ public void stopEffects(EffectType type) @@ -3799,7 +3799,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder public abstract void updateAbnormalEffect(); /** - * Update active skills in progress (In Use and Not In Use because stacked) icones on client.
    + * Update active skills in progress (In Use and Not In Use because stacked) icons on client.
    *
    * Concept:
    *
    @@ -3950,36 +3950,36 @@ public abstract class Creature extends WorldObject implements ISkillsHolder */ public int getAbnormalEffect() { - int ae = _AbnormalEffects; + int mask = _abnormalEffects; if (_isStunned) { - ae |= ABNORMAL_EFFECT_STUN; + mask |= ABNORMAL_EFFECT_STUN; } if (_isRooted) { - ae |= ABNORMAL_EFFECT_ROOT; + mask |= ABNORMAL_EFFECT_ROOT; } if (_isSleeping) { - ae |= ABNORMAL_EFFECT_SLEEP; + mask |= ABNORMAL_EFFECT_SLEEP; } if (_isConfused) { - ae |= ABNORMAL_EFFECT_CONFUSED; + mask |= ABNORMAL_EFFECT_CONFUSED; } if (_isMuted) { - ae |= ABNORMAL_EFFECT_MUTED; + mask |= ABNORMAL_EFFECT_MUTED; } if (_isAfraid) { - ae |= ABNORMAL_EFFECT_AFRAID; + mask |= ABNORMAL_EFFECT_AFRAID; } if (_isPhysicalMuted) { - ae |= ABNORMAL_EFFECT_MUTED; + mask |= ABNORMAL_EFFECT_MUTED; } - return ae; + return mask; } /**