Fixed buffs display in random positions.

This commit is contained in:
MobiusDevelopment
2022-03-29 11:26:21 +00:00
parent 383a190524
commit 4c68b85916
2 changed files with 94 additions and 94 deletions

View File

@@ -26,6 +26,7 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.logging.Logger; import java.util.logging.Logger;
@@ -1833,7 +1834,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
((Player) this).reviveRequest(((Player) this), null, false); ((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(); updateEffectIcons();
// Custom boss announcements configuration. // 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. */ /** 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. */ /** The table containing the List of all stacked effect in progress for each Stack group Identifier. */
protected Map<String, List<Effect>> _stackedEffects = new HashMap<>(); protected Map<String, List<Effect>> _stackedEffects = new HashMap<>();
@@ -2985,7 +2986,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
* <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 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 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>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 * @param newEffect the new effect
*/ */
public synchronized void addEffect(Effect newEffect) 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 // Add the Effect to all effect in progress on the Creature
// if (!newEffect.getSkill().isToggle()) if (!newEffect.getSkill().isToggle())
// { {
// int pos = 0; int pos = 0;
// for (int i = 0; i < _effects.size(); i++) for (Effect effect : _effects)
// { {
// if (_effects.get(i) != null) if (effect == null)
// { {
// final int skillId = _effects.get(i).getSkill().getId(); break;
// if (!_effects.get(i).getSkill().isToggle() && ((skillId <= 4360) || (skillId >= 4367))) }
// {
// pos++; final int skillId = effect.getSkill().getId();
// } if (!effect.getSkill().isToggle() && ((skillId <= 4360) || (skillId >= 4367)))
// } {
// else pos++;
// { }
// break; }
// }
// } _effects.add(pos, newEffect);
// _effects.add(pos, newEffect); }
// } else
// else {
// { _effects.add(newEffect);
_effects.add(newEffect); }
// }
// Check if a stack group is defined for this effect // Check if a stack group is defined for this effect
if (newEffect.getStackType().equals("none")) 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 // Add Funcs of this effect to the Calculator set of the Creature
addStatFuncs(newEffect.getStatFuncs()); addStatFuncs(newEffect.getStatFuncs());
// Update active skills in progress icones on player client // Update active skills in progress icons on player client
updateEffectIcons(); updateEffectIcons();
return; return;
} }
@@ -3111,7 +3111,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
addStatFuncs(stackQueue.get(0).getStatFuncs()); 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(); updateEffectIcons();
} }
@@ -3168,7 +3168,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
* <li>Remove Func added by this effect from the Creature Calculator (Stop Effect)</li> * <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>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>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 * @param effect the effect
*/ */
public void removeEffect(Effect 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); _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(); updateEffectIcons();
} }
@@ -3244,7 +3244,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
*/ */
public void startAbnormalEffect(int mask) public void startAbnormalEffect(int mask)
{ {
_AbnormalEffects |= mask; _abnormalEffects |= mask;
updateAbnormalEffect(); updateAbnormalEffect();
} }
@@ -3393,7 +3393,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
*/ */
public void stopAbnormalEffect(int mask) public void stopAbnormalEffect(int mask)
{ {
_AbnormalEffects &= ~mask; _abnormalEffects &= ~mask;
updateAbnormalEffect(); updateAbnormalEffect();
} }
@@ -3501,7 +3501,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
* <b><u>Actions</u>:</b><br> * <b><u>Actions</u>:</b><br>
* <li>Remove Func added by this effect from the Creature Calculator (Stop Effect)</li> * <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>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...) * @param type The type of effect to stop ((ex : BUFF, DMG_OVER_TIME...)
*/ */
public void stopEffects(EffectType type) public void stopEffects(EffectType type)
@@ -3747,7 +3747,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
public abstract void updateAbnormalEffect(); 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> * <br>
* <b><u>Concept</u>:</b><br> * <b><u>Concept</u>:</b><br>
* <br> * <br>
@@ -3904,36 +3904,36 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
*/ */
public int getAbnormalEffect() public int getAbnormalEffect()
{ {
int ae = _AbnormalEffects; int mask = _abnormalEffects;
if (_isStunned) if (_isStunned)
{ {
ae |= ABNORMAL_EFFECT_STUN; mask |= ABNORMAL_EFFECT_STUN;
} }
if (_isRooted) if (_isRooted)
{ {
ae |= ABNORMAL_EFFECT_ROOT; mask |= ABNORMAL_EFFECT_ROOT;
} }
if (_isSleeping) if (_isSleeping)
{ {
ae |= ABNORMAL_EFFECT_SLEEP; mask |= ABNORMAL_EFFECT_SLEEP;
} }
if (_isConfused) if (_isConfused)
{ {
ae |= ABNORMAL_EFFECT_CONFUSED; mask |= ABNORMAL_EFFECT_CONFUSED;
} }
if (_isMuted) if (_isMuted)
{ {
ae |= ABNORMAL_EFFECT_MUTED; mask |= ABNORMAL_EFFECT_MUTED;
} }
if (_isAfraid) if (_isAfraid)
{ {
ae |= ABNORMAL_EFFECT_AFRAID; mask |= ABNORMAL_EFFECT_AFRAID;
} }
if (_isPhysicalMuted) if (_isPhysicalMuted)
{ {
ae |= ABNORMAL_EFFECT_MUTED; mask |= ABNORMAL_EFFECT_MUTED;
} }
return ae; return mask;
} }
/** /**

View File

@@ -26,6 +26,7 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.logging.Logger; import java.util.logging.Logger;
@@ -1876,7 +1877,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
((Player) this).reviveRequest(((Player) this), null, false); ((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(); updateEffectIcons();
// Custom boss announcements configuration. // 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. */ /** 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. */ /** The table containing the List of all stacked effect in progress for each Stack group Identifier. */
protected Map<String, List<Effect>> _stackedEffects = new HashMap<>(); protected Map<String, List<Effect>> _stackedEffects = new HashMap<>();
@@ -3028,7 +3029,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
* <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 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 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>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 * @param newEffect the new effect
*/ */
public synchronized void addEffect(Effect newEffect) 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 // Add the Effect to all effect in progress on the Creature
// if (!newEffect.getSkill().isToggle()) if (!newEffect.getSkill().isToggle())
// { {
// int pos = 0; int pos = 0;
// for (int i = 0; i < _effects.size(); i++) for (Effect effect : _effects)
// { {
// if (_effects.get(i) != null) if (effect == null)
// { {
// final int skillId = _effects.get(i).getSkill().getId(); break;
// if (!_effects.get(i).getSkill().isToggle() && ((skillId <= 4360) || (skillId >= 4367))) }
// {
// pos++; final int skillId = effect.getSkill().getId();
// } if (!effect.getSkill().isToggle() && ((skillId <= 4360) || (skillId >= 4367)))
// } {
// else pos++;
// { }
// break; }
// }
// } _effects.add(pos, newEffect);
// _effects.add(pos, newEffect); }
// } else
// else {
// { _effects.add(newEffect);
_effects.add(newEffect); }
// }
// Check if a stack group is defined for this effect // Check if a stack group is defined for this effect
if (newEffect.getStackType().equals("none")) 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 // Add Funcs of this effect to the Calculator set of the Creature
addStatFuncs(newEffect.getStatFuncs()); addStatFuncs(newEffect.getStatFuncs());
// Update active skills in progress icones on player client // Update active skills in progress icons on player client
updateEffectIcons(); updateEffectIcons();
return; return;
} }
@@ -3163,7 +3163,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
addStatFuncs(stackQueue.get(0).getStatFuncs()); 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(); updateEffectIcons();
} }
@@ -3220,7 +3220,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
* <li>Remove Func added by this effect from the Creature Calculator (Stop Effect)</li> * <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>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>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 * @param effect the effect
*/ */
public void removeEffect(Effect 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); _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(); updateEffectIcons();
} }
@@ -3296,7 +3296,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
*/ */
public void startAbnormalEffect(int mask) public void startAbnormalEffect(int mask)
{ {
_AbnormalEffects |= mask; _abnormalEffects |= mask;
updateAbnormalEffect(); updateAbnormalEffect();
} }
@@ -3445,7 +3445,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
*/ */
public void stopAbnormalEffect(int mask) public void stopAbnormalEffect(int mask)
{ {
_AbnormalEffects &= ~mask; _abnormalEffects &= ~mask;
updateAbnormalEffect(); updateAbnormalEffect();
} }
@@ -3553,7 +3553,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
* <b><u>Actions</u>:</b><br> * <b><u>Actions</u>:</b><br>
* <li>Remove Func added by this effect from the Creature Calculator (Stop Effect)</li> * <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>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...) * @param type The type of effect to stop ((ex : BUFF, DMG_OVER_TIME...)
*/ */
public void stopEffects(EffectType type) public void stopEffects(EffectType type)
@@ -3799,7 +3799,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
public abstract void updateAbnormalEffect(); 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> * <br>
* <b><u>Concept</u>:</b><br> * <b><u>Concept</u>:</b><br>
* <br> * <br>
@@ -3950,36 +3950,36 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
*/ */
public int getAbnormalEffect() public int getAbnormalEffect()
{ {
int ae = _AbnormalEffects; int mask = _abnormalEffects;
if (_isStunned) if (_isStunned)
{ {
ae |= ABNORMAL_EFFECT_STUN; mask |= ABNORMAL_EFFECT_STUN;
} }
if (_isRooted) if (_isRooted)
{ {
ae |= ABNORMAL_EFFECT_ROOT; mask |= ABNORMAL_EFFECT_ROOT;
} }
if (_isSleeping) if (_isSleeping)
{ {
ae |= ABNORMAL_EFFECT_SLEEP; mask |= ABNORMAL_EFFECT_SLEEP;
} }
if (_isConfused) if (_isConfused)
{ {
ae |= ABNORMAL_EFFECT_CONFUSED; mask |= ABNORMAL_EFFECT_CONFUSED;
} }
if (_isMuted) if (_isMuted)
{ {
ae |= ABNORMAL_EFFECT_MUTED; mask |= ABNORMAL_EFFECT_MUTED;
} }
if (_isAfraid) if (_isAfraid)
{ {
ae |= ABNORMAL_EFFECT_AFRAID; mask |= ABNORMAL_EFFECT_AFRAID;
} }
if (_isPhysicalMuted) if (_isPhysicalMuted)
{ {
ae |= ABNORMAL_EFFECT_MUTED; mask |= ABNORMAL_EFFECT_MUTED;
} }
return ae; return mask;
} }
/** /**