Browse Source

BETA: Fixed buff/debuff remove message now it displays '''The effect of ''buff/debuff name'' has been removed.''' when its removed and ''' ''buff/debuff name'' has worn off.''' when time ends.
* '''endEffects''' will now be called only when buff time ends.
* Reported by: facheme

Tested by: St3et
Reviewed by: St3et

Nos 11 years ago
parent
commit
8a0df618b4

+ 21 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/CharEffectList.java

@@ -601,13 +601,14 @@ public final class CharEffectList
 	
 	/**
 	 * Auxiliary method to stop all effects from a buff info and remove it from an effect list and stacked effects.
+	 * @param removed {@code true} if the effect is removed, {@code false} otherwise
 	 * @param info the buff info
 	 * @param effects the effect list
 	 */
-	private void stopAndRemove(BuffInfo info, Map<Integer, BuffInfo> effects)
+	private void stopAndRemove(boolean removed, BuffInfo info, Map<Integer, BuffInfo> effects)
 	{
 		// Stop the buff effects.
-		info.stopAllEffects(false);
+		info.stopAllEffects(removed);
 		
 		// If it's a hidden buff that ends, then decrease hidden buff count.
 		if (!info.isInUse())
@@ -646,7 +647,20 @@ public final class CharEffectList
 			}
 		}
 		
-		info.getSkill().applyEffectScope(EffectScope.END, info, true, false);
+		if (!removed)
+		{
+			info.getSkill().applyEffectScope(EffectScope.END, info, true, false);
+		}
+	}
+	
+	/**
+	 * Auxiliary method to stop all effects from a buff info and remove it from an effect list and stacked effects.
+	 * @param info the buff info
+	 * @param effects the effect list
+	 */
+	private void stopAndRemove(BuffInfo info, Map<Integer, BuffInfo> effects)
+	{
+		stopAndRemove(true, info, effects);
 	}
 	
 	/**
@@ -1033,7 +1047,7 @@ public final class CharEffectList
 		final Map<Integer, BuffInfo> effects = getEffectList(skill);
 		if (effects != null)
 		{
-			remove(effects.get(skill.getId()));
+			remove(removed, effects.get(skill.getId()));
 		}
 	}
 	
@@ -1338,9 +1352,10 @@ public final class CharEffectList
 	
 	/**
 	 * Removes a set of effects from this effect list.
+	 * @param removed {@code true} if the effect is removed, {@code false} otherwise
 	 * @param info the effects to remove
 	 */
-	public void remove(BuffInfo info)
+	public void remove(boolean removed, BuffInfo info)
 	{
 		if ((info == null) || !isAffectedBySkill(info.getSkill().getId()))
 		{
@@ -1348,7 +1363,7 @@ public final class CharEffectList
 		}
 		
 		// Remove the effect from character effects.
-		stopAndRemove(info, getEffectList(info.getSkill()));
+		stopAndRemove(removed, info, getEffectList(info.getSkill()));
 		// Update effect flags and icons.
 		updateEffectList(true);
 	}

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/status/PcStatus.java

@@ -171,7 +171,7 @@ public class PcStatus extends PlayableStatus
 				if (mpDam > getActiveChar().getCurrentMp())
 				{
 					getActiveChar().sendPacket(SystemMessageId.MP_BECAME_0_ARCANE_SHIELD_DISAPPEARING);
-					getActiveChar().stopSkillEffects(false, 1556);
+					getActiveChar().stopSkillEffects(true, 1556);
 					value = mpDam - getActiveChar().getCurrentMp();
 					getActiveChar().setCurrentMp(0);
 				}

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/BuffInfo.java

@@ -320,7 +320,7 @@ public final class BuffInfo
 			if (task != null)
 			{
 				task.getScheduledFuture().cancel(true); // Allow to finish current run.
-				_env.getTarget().getEffectList().remove(this); // Remove the buff from the effect list.
+				_env.getTarget().getEffectList().remove(true, this); // Remove the buff from the effect list.
 			}
 		}
 	}