I do not like this, but whatever...
Index: java/org/l2jmobius/gameserver/model/actor/Creature.java
===================================================================
--- java/org/l2jmobius/gameserver/model/actor/Creature.java (revision 9990)
+++ java/org/l2jmobius/gameserver/model/actor/Creature.java (working copy)
@@ -26,6 +26,7 @@
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 @@
((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 @@
}
/** 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<Effect> _effects = ConcurrentHashMap.newKeySet();
+ private final List<Effect> _effects = new CopyOnWriteArrayList<>();
/** The table containing the List of all stacked effect in progress for each Stack group Identifier. */
protected Map<String, List<Effect>> _stackedEffects = new HashMap<>();
@@ -3028,7 +3029,7 @@
* <li>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)</li>
* <li>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)</li>
* <li>If this effect has NOT higher priority in its Stack Group, set the effect to Not In Use</li>
- * <li>Update active skills in progress icones on player client</li><br>
+ * <li>Update active skills in progress icons on player client</li><br>
* @param newEffect the new effect
*/
public synchronized void addEffect(Effect newEffect)
@@ -3087,30 +3088,29 @@
}
// 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 @@
// 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 @@
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 @@
* <li>Remove Func added by this effect from the Creature Calculator (Stop Effect)</li>
* <li>If the Effect belongs to a not empty Stack Group, replace theses Funcs by next stacked effect Funcs</li>
* <li>Remove the Effect from _effects of the Creature</li>
- * <li>Update active skills in progress icones on player client</li><br>
+ * <li>Update active skills in progress icons on player client</li><br>
* @param effect the effect
*/
public void removeEffect(Effect effect)
@@ -3283,10 +3283,10 @@
}
}
- // 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 void startAbnormalEffect(int mask)
{
- _AbnormalEffects |= mask;
+ _abnormalEffects |= mask;
updateAbnormalEffect();
}
@@ -3445,7 +3445,7 @@
*/
public void stopAbnormalEffect(int mask)
{
- _AbnormalEffects &= ~mask;
+ _abnormalEffects &= ~mask;
updateAbnormalEffect();
}
@@ -3553,7 +3553,7 @@
* <b><u>Actions</u>:</b><br>
* <li>Remove Func added by this effect from the Creature Calculator (Stop Effect)</li>
* <li>Remove the Effect from _effects of the Creature</li>
- * <li>Update active skills in progress icones on player client</li><br>
+ * <li>Update active skills in progress icons on player client</li><br>
* @param type The type of effect to stop ((ex : BUFF, DMG_OVER_TIME...)
*/
public void stopEffects(EffectType type)
@@ -3799,7 +3799,7 @@
public abstract void updateAbnormalEffect();
/**
- * Update active skills in progress (In Use and Not In Use because stacked) icones on client.<br>
+ * Update active skills in progress (In Use and Not In Use because stacked) icons on client.<br>
* <br>
* <b><u>Concept</u>:</b><br>
* <br>
@@ -3950,36 +3950,36 @@
*/
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;
}
/**