Browse Source

BETA: Core part for [DP8712]:
* Using abnormal time and abnormal count to calculate buff icon display time.
* Fix for #5286
* Thanks JMD for report and test.

'''Note:''' A slightly different approach will be used after skill rework.

Zoey76 13 years ago
parent
commit
ce155628f5

+ 1 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/engines/DocumentBase.java

@@ -261,6 +261,7 @@ public abstract class DocumentBase
 		{
 		{
 			count = Integer.decode(getValue(attrs.getNamedItem("count").getNodeValue(), template));
 			count = Integer.decode(getValue(attrs.getNamedItem("count").getNodeValue(), template));
 		}
 		}
+		
 		if (attrs.getNamedItem("abnormalTime") != null)
 		if (attrs.getNamedItem("abnormalTime") != null)
 		{
 		{
 			abnormalTime = Integer.decode(getValue(attrs.getNamedItem("abnormalTime").getNodeValue(),template));
 			abnormalTime = Integer.decode(getValue(attrs.getNamedItem("abnormalTime").getNodeValue(),template));
@@ -279,8 +280,6 @@ public abstract class DocumentBase
 				}
 				}
 			}
 			}
 		}
 		}
-		else if (((L2Skill) template).getBuffDuration() > 0)
-			abnormalTime = ((L2Skill) template).getBuffDuration() / 1000 / count;
 		
 		
 		boolean passiveEffect = false;
 		boolean passiveEffect = false;
 		if (attrs.getNamedItem("passive") != null)
 		if (attrs.getNamedItem("passive") != null)

+ 13 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/L2Skill.java

@@ -150,7 +150,6 @@ public abstract class L2Skill implements IChanceSkillTrigger
 	private final int _coolTime;
 	private final int _coolTime;
 	private final int _reuseHashCode;
 	private final int _reuseHashCode;
 	private final int _reuseDelay;
 	private final int _reuseDelay;
-	private final int _buffDuration;
 	// for item skills delay on equip
 	// for item skills delay on equip
 	private final int _equipDelay;
 	private final int _equipDelay;
 	
 	
@@ -406,8 +405,6 @@ public abstract class L2Skill implements IChanceSkillTrigger
 			_reuseDelay = set.getInteger("reuseDelay", 0);
 			_reuseDelay = set.getInteger("reuseDelay", 0);
 		}
 		}
 		
 		
-		_buffDuration = set.getInteger("buffDuration", 0);
-		
 		_equipDelay = set.getInteger("equipDelay", 0);
 		_equipDelay = set.getInteger("equipDelay", 0);
 		
 		
 		_skillRadius = set.getInteger("skillRadius", 80);
 		_skillRadius = set.getInteger("skillRadius", 80);
@@ -769,11 +766,22 @@ public abstract class L2Skill implements IChanceSkillTrigger
 	}
 	}
 	
 	
 	/**
 	/**
-	 * @return Returns the buffDuration.
+	 * TODO: Zoey76, temp fix until skill reworks is done.
+	 * @return the calculated buff duration used to display buff icons.
 	 */
 	 */
 	public final int getBuffDuration()
 	public final int getBuffDuration()
 	{
 	{
-		return _buffDuration;
+		int duration = 0;
+		final EffectTemplate firstEffect = hasEffects() ? getEffectTemplates()[0] : null;
+		if (firstEffect != null)
+		{
+			duration = firstEffect.abnormalTime * 1000;
+			if (firstEffect.counter > 1)
+			{
+				duration *= firstEffect.counter;
+			}
+		}
+		return duration;
 	}
 	}
 	
 	
 	/**
 	/**