Selaa lähdekoodia

BETA: Fixes to tick related skills:
* Removed useless methods from L2Effect.
* Added getTimeLeft() method to properly calculate remaining time, according to effect's abnormal time and tick count.
* Changed ticks' default value to 0.
* Removed unused ConditionForceBuff.
* '''Pre-implemented instant effects!'''
* Retail like system messages for skill dispel, toggle abort and effect end!
* Cancel related skills must be verified in retail.
* Reworked "buff display" packets.
* AbnormalStatusUpdate
* PartySpelled.
* ExOlympiadSpelledInfo
* Improved remaining time calculation.
* Fixed consume in continuous skills (toggle/ "over time").
* Reported by: LeoDetona, badboy29, MELERIX

'''Note 1:''' Signet related skills are not working, they are too custom and has to be re-implemented, will be done soon.
'''Note 2:''' Some effects in Datapack may need updates after this rework, will be done soon, please don't spam the forums.

Zoey76 12 vuotta sitten
vanhempi
sitoutus
c314043354
16 muutettua tiedostoa jossa 222 lisäystä ja 269 poistoa
  1. 0 15
      L2J_Server_BETA/java/com/l2jserver/gameserver/engines/DocumentBase.java
  2. 11 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/CharEffectList.java
  3. 6 8
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Character.java
  4. 2 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PetInstance.java
  5. 2 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2ServitorInstance.java
  6. 0 71
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionForceBuff.java
  7. 2 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/effects/EffectTemplate.java
  8. 78 57
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/effects/L2Effect.java
  9. 0 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/effects/L2EffectType.java
  10. 71 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/holders/EffectDurationHolder.java
  11. 4 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/zone/type/L2DynamicZone.java
  12. 1 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/zone/type/L2SiegeZone.java
  13. 2 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestDispel.java
  14. 17 44
      L2J_Server_BETA/java/com/l2jserver/gameserver/network/serverpackets/AbnormalStatusUpdate.java
  15. 13 27
      L2J_Server_BETA/java/com/l2jserver/gameserver/network/serverpackets/ExOlympiadSpelledInfo.java
  16. 13 30
      L2J_Server_BETA/java/com/l2jserver/gameserver/network/serverpackets/PartySpelled.java

+ 0 - 15
L2J_Server_BETA/java/com/l2jserver/gameserver/engines/DocumentBase.java

@@ -41,7 +41,6 @@ import com.l2jserver.gameserver.model.base.PlayerState;
 import com.l2jserver.gameserver.model.base.Race;
 import com.l2jserver.gameserver.model.conditions.Condition;
 import com.l2jserver.gameserver.model.conditions.ConditionChangeWeapon;
-import com.l2jserver.gameserver.model.conditions.ConditionForceBuff;
 import com.l2jserver.gameserver.model.conditions.ConditionGameChance;
 import com.l2jserver.gameserver.model.conditions.ConditionGameTime;
 import com.l2jserver.gameserver.model.conditions.ConditionGameTime.CheckGameTime;
@@ -451,7 +450,6 @@ public abstract class DocumentBase
 	protected Condition parsePlayerCondition(Node n, Object template)
 	{
 		Condition cond = null;
-		byte[] forces = new byte[2];
 		NamedNodeMap attrs = n.getAttributes();
 		for (int i = 0; i < attrs.getLength(); i++)
 		{
@@ -575,14 +573,6 @@ public abstract class DocumentBase
 				int value = Integer.decode(getValue(a.getNodeValue(), null));
 				cond = joinAnd(cond, new ConditionPlayerSiegeSide(value));
 			}
-			else if ("battle_force".equalsIgnoreCase(a.getNodeName()))
-			{
-				forces[0] = Byte.decode(getValue(a.getNodeValue(), null));
-			}
-			else if ("spell_force".equalsIgnoreCase(a.getNodeName()))
-			{
-				forces[1] = Byte.decode(getValue(a.getNodeValue(), null));
-			}
 			else if ("charges".equalsIgnoreCase(a.getNodeName()))
 			{
 				int value = Integer.decode(getValue(a.getNodeValue(), template));
@@ -775,11 +765,6 @@ public abstract class DocumentBase
 			}
 		}
 		
-		if ((forces[0] + forces[1]) > 0)
-		{
-			cond = joinAnd(cond, new ConditionForceBuff(forces));
-		}
-		
 		if (cond == null)
 		{
 			_log.severe("Unrecognized <player> condition in " + _file);

+ 11 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/CharEffectList.java

@@ -508,9 +508,10 @@ public final class CharEffectList
 	
 	/**
 	 * Exits all effects created by a specific skill Id.
+	 * @param removed {@code true} if the effect is removed, {@code false} otherwise
 	 * @param skillId the skill Id
 	 */
-	public final void stopSkillEffects(int skillId)
+	public final void stopSkillEffects(boolean removed, int skillId)
 	{
 		if (hasBuffs())
 		{
@@ -518,6 +519,7 @@ public final class CharEffectList
 			{
 				if ((e != null) && (e.getSkill().getId() == skillId))
 				{
+					e.setRemoved(removed);
 					e.exit();
 				}
 			}
@@ -528,6 +530,7 @@ public final class CharEffectList
 			{
 				if ((e != null) && (e.getSkill().getId() == skillId))
 				{
+					e.setRemoved(removed);
 					e.exit();
 				}
 			}
@@ -676,9 +679,13 @@ public final class CharEffectList
 			
 			if (_owner.isPlayer() && effect.isIconDisplay())
 			{
-				final SystemMessage sm = SystemMessage.getSystemMessage(skill.isToggle() ? SystemMessageId.S1_HAS_BEEN_ABORTED : SystemMessageId.EFFECT_S1_DISAPPEARED);
-				sm.addSkillName(effect);
-				_owner.sendPacket(sm);
+				final SystemMessageId smId = skill.isToggle() ? SystemMessageId.S1_HAS_BEEN_ABORTED : effect.isRemoved() ? SystemMessageId.EFFECT_S1_DISAPPEARED : null;
+				if (smId != null)
+				{
+					final SystemMessage sm = SystemMessage.getSystemMessage(smId);
+					sm.addSkillName(effect);
+					_owner.sendPacket(sm);
+				}
 			}
 		}
 		// Update effect flags.

+ 6 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Character.java

@@ -3280,15 +3280,13 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
 	}
 	
 	/**
-	 * Stop and remove the L2Effects corresponding to the L2Skill Identifier and update client magic icon.<br>
-	 * <B><U>Concept</U>:</B><br>
-	 * All active skills effects in progress on the L2Character are identified in ConcurrentHashMap(Integer,L2Effect) <B>_effects</B>.<br>
-	 * The Integer key of _effects is the L2Skill Identifier that has created the L2Effect.
-	 * @param skillId the L2Skill Identifier of the L2Effect to remove from _effects
+	 * Stop and remove the effects corresponding to the skill Id.
+	 * @param removed if {@code true} the effect will be set as removed, and a system message will be sent
+	 * @param skillId the skill Id
 	 */
-	public void stopSkillEffects(int skillId)
+	public void stopSkillEffects(boolean removed, int skillId)
 	{
-		_effectList.stopSkillEffects(skillId);
+		_effectList.stopSkillEffects(removed, skillId);
 	}
 	
 	/**
@@ -5848,7 +5846,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
 				if ((e == null) || (e.getEffectType() != L2EffectType.TRANSFORMATION))
 				{
 					removeStatsOwner(oldSkill);
-					stopSkillEffects(oldSkill.getId());
+					stopSkillEffects(true, oldSkill.getId());
 				}
 			}
 			if (isPlayer())

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PetInstance.java

@@ -970,9 +970,9 @@ public class L2PetInstance extends L2Summon
 	}
 	
 	@Override
-	public final void stopSkillEffects(int skillId)
+	public final void stopSkillEffects(boolean removed, int skillId)
 	{
-		super.stopSkillEffects(skillId);
+		super.stopSkillEffects(removed, skillId);
 		List<SummonEffect> effects = SummonEffectsTable.getInstance().getPetEffects().get(getControlObjectId());
 		if ((effects != null) && !effects.isEmpty())
 		{

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2ServitorInstance.java

@@ -301,9 +301,9 @@ public class L2ServitorInstance extends L2Summon
 	}
 	
 	@Override
-	public final void stopSkillEffects(int skillId)
+	public final void stopSkillEffects(boolean removed, int skillId)
 	{
-		super.stopSkillEffects(skillId);
+		super.stopSkillEffects(removed, skillId);
 		final TIntObjectHashMap<List<SummonEffect>> servitorEffects = SummonEffectsTable.getInstance().getServitorEffects(getOwner());
 		if (servitorEffects != null)
 		{

+ 0 - 71
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionForceBuff.java

@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2004-2013 L2J Server
- * 
- * This file is part of L2J Server.
- * 
- * L2J Server is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * 
- * L2J Server is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.l2jserver.gameserver.model.conditions;
-
-import com.l2jserver.gameserver.model.effects.L2Effect;
-import com.l2jserver.gameserver.model.stats.Env;
-
-/**
- * The Class ConditionForceBuff.
- * @author kombat, Forsaiken
- */
-public final class ConditionForceBuff extends Condition
-{
-	private static final short BATTLE_FORCE = 5104;
-	private static final short SPELL_FORCE = 5105;
-	
-	private final byte[] _forces;
-	
-	/**
-	 * Instantiates a new condition force buff.
-	 * @param forces the forces
-	 */
-	public ConditionForceBuff(byte[] forces)
-	{
-		_forces = forces;
-	}
-	
-	/**
-	 * Test impl.
-	 * @param env the env
-	 * @return true, if successful
-	 */
-	@Override
-	public boolean testImpl(Env env)
-	{
-		if (_forces[0] > 0)
-		{
-			L2Effect force = env.getCharacter().getFirstEffect(BATTLE_FORCE);
-			if ((force == null) || (force.getForceEffect() < _forces[0]))
-			{
-				return false;
-			}
-		}
-		
-		if (_forces[1] > 0)
-		{
-			L2Effect force = env.getCharacter().getFirstEffect(SPELL_FORCE);
-			if ((force == null) || (force.getForceEffect() < _forces[1]))
-			{
-				return false;
-			}
-		}
-		return true;
-	}
-}

+ 2 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/effects/EffectTemplate.java

@@ -46,6 +46,7 @@ public class EffectTemplate
 	private final Condition _attachCond;
 	// private final Condition _applyCond; // TODO: Use or cleanup.
 	private final Lambda _lambda;
+	/** Effect's total tick count. */
 	private final int _totalTickCount;
 	/** Effect specific abnormal time. */
 	private final int _abnormalTime;
@@ -67,7 +68,7 @@ public class EffectTemplate
 		// _applyCond = applyCond;
 		_lambda = lambda;
 		_name = set.getString("name");
-		_totalTickCount = set.getInteger("ticks", 1);
+		_totalTickCount = set.getInteger("ticks", 0);
 		_abnormalTime = set.getInteger("abnormalTime", 0);
 		_abnormalEffect = AbnormalEffect.getByName(set.getString("abnormalVisualEffect", ""));
 		final String[] specialEffects = set.getString("special", "").split(",");

+ 78 - 57
L2J_Server_BETA/java/com/l2jserver/gameserver/model/effects/L2Effect.java

@@ -81,6 +81,8 @@ public abstract class L2Effect implements IChanceSkillTrigger
 	private boolean _inUse = false;
 	/** If {@code true} then this effect's start condition are meet. */
 	private boolean _startConditionsCorrect = true;
+	/** If {@code true} then this effect has been cancelled. */
+	private boolean _isRemoved = false;
 	
 	protected final class EffectTask implements Runnable
 	{
@@ -112,7 +114,7 @@ public abstract class L2Effect implements IChanceSkillTrigger
 		_effected = env.getTarget();
 		_effector = env.getCharacter();
 		_lambda = template.getLambda();
-		_tickCount = 1;
+		_tickCount = 0;
 		_abnormalTime = Formulas.calcEffectAbnormalTime(env, template);
 		_periodStartTicks = GameTimeController.getInstance().getGameTicks();
 		_periodFirstTime = 0;
@@ -138,16 +140,15 @@ public abstract class L2Effect implements IChanceSkillTrigger
 		_periodFirstTime = effect.getTime();
 	}
 	
+	/**
+	 * Get the corrent tick count.
+	 * @return the tic count
+	 */
 	public int getTickCount()
 	{
 		return _tickCount;
 	}
 	
-	public int getTotalTickCount()
-	{
-		return _template.getTotalTickCount();
-	}
-	
 	public void setCount(int newTickCount)
 	{
 		_tickCount = Math.min(newTickCount, _template.getTotalTickCount());
@@ -168,7 +169,8 @@ public abstract class L2Effect implements IChanceSkillTrigger
 	}
 	
 	/**
-	 * @return this effect's calculated abnormal time
+	 * Get this effect's calculated abnormal time.
+	 * @return the abnormal time
 	 */
 	public int getAbnormalTime()
 	{
@@ -181,15 +183,20 @@ public abstract class L2Effect implements IChanceSkillTrigger
 	}
 	
 	/**
-	 * Get the elapsed time.
-	 * @return the elapsed time of the task in seconds
+	 * Get the remaining time.
+	 * @return the remaining time
 	 */
-	public int getTaskTime()
+	public int getTimeLeft()
 	{
-		return (_tickCount * _abnormalTime) + getTime();
+		if (_template.getTotalTickCount() > 0)
+		{
+			return (((_template.getTotalTickCount() - _tickCount) + 1) * (_abnormalTime / _template.getTotalTickCount())) - getTime();
+		}
+		return _abnormalTime - getTime();
 	}
 	
 	/**
+	 * Verify if the effect is in use.
 	 * @return {@code true} if the effect is in use, {@code false} otherwise
 	 */
 	public boolean isInUse()
@@ -197,6 +204,12 @@ public abstract class L2Effect implements IChanceSkillTrigger
 		return _inUse;
 	}
 	
+	/**
+	 * Set the effect in use.<br>
+	 * If is set to {@code true}, {@link #onStart()} is invoked, otherwise {@link #onExit()} is invoked.
+	 * @param inUse the value to set
+	 * @return {@link #_startConditionsCorrect}
+	 */
 	public boolean setInUse(boolean inUse)
 	{
 		_inUse = inUse;
@@ -282,17 +295,23 @@ public abstract class L2Effect implements IChanceSkillTrigger
 	 */
 	private final void startEffectTask()
 	{
+		if (isInstant())
+		{
+			_currentFuture = ThreadPoolManager.getInstance().scheduleEffect(new EffectTask(), 0);
+			return;
+		}
+		
 		stopEffectTask();
-		final int initialDelay = Math.max((_abnormalTime - _periodFirstTime) * 1000, 5); // Sanity check
-		if (_template.getTotalTickCount() > 1)
+		final int delay = Math.max((_abnormalTime - _periodFirstTime) * 1000, 5); // Sanity check
+		if (_template.getTotalTickCount() > 0)
 		{
 			// TODO: If default abnormal time is changed to 0, the first check below must be updated as well.
 			final int period = ((_abnormalTime > 1) ? (_abnormalTime / _template.getTotalTickCount()) : _template.getTotalTickCount()) * 1000;
-			_currentFuture = ThreadPoolManager.getInstance().scheduleEffectAtFixedRate(new EffectTask(), initialDelay, period);
+			_currentFuture = ThreadPoolManager.getInstance().scheduleEffectAtFixedRate(new EffectTask(), delay / period, period);
 		}
 		else
 		{
-			_currentFuture = ThreadPoolManager.getInstance().scheduleEffect(new EffectTask(), initialDelay);
+			_currentFuture = ThreadPoolManager.getInstance().scheduleEffect(new EffectTask(), delay);
 		}
 	}
 	
@@ -393,7 +412,7 @@ public abstract class L2Effect implements IChanceSkillTrigger
 		{
 			case CREATED:
 			{
-				_state = EffectState.ACTING;
+				_state = isInstant() ? EffectState.FINISHING : EffectState.ACTING;
 				
 				if (_skill.isPVP() && isIconDisplay() && getEffected().isPlayer())
 				{
@@ -413,26 +432,26 @@ public abstract class L2Effect implements IChanceSkillTrigger
 			{
 				if (isInUse())
 				{
-					if (onActionTime() && _startConditionsCorrect && (_tickCount <= _template.getTotalTickCount()))
+					_tickCount++; // Increase tick count.
+					if (onActionTime() && _startConditionsCorrect)
 					{
-						return; // false causes effect to finish right away
+						return; // Do not finish.
 					}
-					
-					_tickCount++; // Increase tick count.
 				}
 				
 				if (_tickCount <= _template.getTotalTickCount())
 				{
 					return; // Do not finish it yet, has remaining ticks.
 				}
+				
 				_state = EffectState.FINISHING;
 			}
 			case FINISHING:
 			{
 				// If the time left is equal to zero, send the message
-				if ((_tickCount >= _template.getTotalTickCount()) && isIconDisplay() && getEffected().isPlayer())
+				if (!getSkill().isToggle() && (_tickCount > _template.getTotalTickCount()) && isIconDisplay() && getEffected().isPlayer())
 				{
-					SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_WORN_OFF);
+					final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_WORN_OFF);
 					sm.addSkillName(_skill);
 					getEffected().sendPacket(sm);
 				}
@@ -457,7 +476,7 @@ public abstract class L2Effect implements IChanceSkillTrigger
 				
 				if (_skill.getAfterEffectId() > 0)
 				{
-					L2Skill skill = SkillTable.getInstance().getInfo(_skill.getAfterEffectId(), _skill.getAfterEffectLvl());
+					final L2Skill skill = SkillTable.getInstance().getInfo(_skill.getAfterEffectId(), _skill.getAfterEffectLvl());
 					if (skill != null)
 					{
 						getEffected().broadcastPacket(new MagicSkillUse(_effected, skill.getId(), skill.getLevel(), 0, 0));
@@ -499,26 +518,13 @@ public abstract class L2Effect implements IChanceSkillTrigger
 			return;
 		}
 		
-		final ScheduledFuture<?> future = _currentFuture;
-		final L2Skill sk = getSkill();
-		if (_template.getTotalTickCount() > 1)
-		{
-			if (sk.isStatic())
-			{
-				mi.addEffect(sk.getDisplayId(), sk.getDisplayLevel(), (_abnormalTime - getTaskTime()) * 1000);
-			}
-			else
-			{
-				mi.addEffect(sk.getDisplayId(), sk.getDisplayLevel(), -1);
-			}
-		}
-		else if (future != null)
+		if (_abnormalTime == -1)
 		{
-			mi.addEffect(sk.getDisplayId(), getLevel(), (int) future.getDelay(TimeUnit.MILLISECONDS));
+			mi.addEffect(getSkill(), -1);
 		}
-		else if (_abnormalTime == -1)
+		else
 		{
-			mi.addEffect(sk.getDisplayId(), getLevel(), _abnormalTime);
+			mi.addEffect(getSkill(), getTimeLeft());
 		}
 	}
 	
@@ -530,14 +536,13 @@ public abstract class L2Effect implements IChanceSkillTrigger
 		}
 		
 		final ScheduledFuture<?> future = _currentFuture;
-		final L2Skill sk = getSkill();
 		if (future != null)
 		{
-			ps.addPartySpelledEffect(sk.getDisplayId(), getLevel(), (int) future.getDelay(TimeUnit.MILLISECONDS));
+			ps.addPartySpelledEffect(getSkill(), (int) future.getDelay(TimeUnit.SECONDS));
 		}
 		else if (_abnormalTime == -1)
 		{
-			ps.addPartySpelledEffect(sk.getDisplayId(), getLevel(), _abnormalTime);
+			ps.addPartySpelledEffect(getSkill(), -1);
 		}
 	}
 	
@@ -549,22 +554,16 @@ public abstract class L2Effect implements IChanceSkillTrigger
 		}
 		
 		final ScheduledFuture<?> future = _currentFuture;
-		final L2Skill sk = getSkill();
 		if (future != null)
 		{
-			os.addEffect(sk.getDisplayId(), sk.getDisplayLevel(), (int) future.getDelay(TimeUnit.MILLISECONDS));
+			os.addEffect(getSkill(), (int) future.getDelay(TimeUnit.SECONDS));
 		}
 		else if (_abnormalTime == -1)
 		{
-			os.addEffect(sk.getDisplayId(), sk.getDisplayLevel(), _abnormalTime);
+			os.addEffect(getSkill(), -1);
 		}
 	}
 	
-	public int getLevel()
-	{
-		return getSkill().getLevel();
-	}
-	
 	public int getPeriodStartTicks()
 	{
 		return _periodStartTicks;
@@ -600,7 +599,7 @@ public abstract class L2Effect implements IChanceSkillTrigger
 	@Override
 	public String toString()
 	{
-		return "Effect " + getClass().getSimpleName() + ", " + _skill + ", State: " + _state + ", Abnormal time: " + _abnormalTime;
+		return "Effect " + getClass().getSimpleName() + ", " + _skill + ", State: " + _state + ", Time: " + _abnormalTime + ", Remaining: " + getTimeLeft();
 	}
 	
 	public void decreaseForce()
@@ -613,11 +612,6 @@ public abstract class L2Effect implements IChanceSkillTrigger
 		
 	}
 	
-	public int getForceEffect()
-	{
-		return 0;
-	}
-	
 	@Override
 	public boolean triggersChanceSkill()
 	{
@@ -651,4 +645,31 @@ public abstract class L2Effect implements IChanceSkillTrigger
 	{
 		_preventExitUpdate = val;
 	}
+	
+	/**
+	 * Verify if this effect is an instant effect.
+	 * @return {@code true} if this effect is instant, {@code false} otherwise
+	 */
+	public boolean isInstant()
+	{
+		return false;
+	}
+	
+	/**
+	 * Verify if this effect has been cancelled.
+	 * @return {@code true} if this effect has been cancelled, {@code false} otherwise
+	 */
+	public boolean isRemoved()
+	{
+		return _isRemoved;
+	}
+	
+	/**
+	 * Set the effect to removed.
+	 * @param val the value to set
+	 */
+	public void setRemoved(boolean val)
+	{
+		_isRemoved = val;
+	}
 }

+ 0 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/effects/L2EffectType.java

@@ -87,7 +87,6 @@ public enum L2EffectType
 	ROOT,
 	SIGNET_EFFECT,
 	SIGNET_GROUND,
-	SILENT_MOVE,
 	SLEEP,
 	SPOIL,
 	STATIC_DAMAGE,

+ 71 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/holders/EffectDurationHolder.java

@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * L2J Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.holders;
+
+import com.l2jserver.gameserver.model.skills.L2Skill;
+
+/**
+ * Effect duration holder.
+ * @author Zoey76
+ */
+public class EffectDurationHolder
+{
+	private final int _skillId;
+	private final int _skillLvl;
+	private final int _duration;
+	
+	/**
+	 * Effect duration holder constructor.
+	 * @param skill the skill to get the data
+	 * @param duration the effect duration
+	 */
+	public EffectDurationHolder(L2Skill skill, int duration)
+	{
+		_skillId = skill.getDisplayId();
+		_skillLvl = skill.getDisplayLevel();
+		_duration = duration;
+	}
+	
+	/**
+	 * Get the effect's skill Id.
+	 * @return the skill Id
+	 */
+	public int getSkillId()
+	{
+		return _skillId;
+	}
+	
+	/**
+	 * Get the effect's skill level.
+	 * @return the skill level
+	 */
+	public int getSkillLvl()
+	{
+		return _skillLvl;
+	}
+	
+	/**
+	 * Get the effect's duration.
+	 * @return the duration in <b>seconds</b>
+	 */
+	public int getDuration()
+	{
+		return _duration;
+	}
+}

+ 4 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/zone/type/L2DynamicZone.java

@@ -93,7 +93,7 @@ public class L2DynamicZone extends L2ZoneType
 			return;
 		}
 		
-		character.stopSkillEffects(_skill.getId());
+		character.stopSkillEffects(true, _skill.getId());
 	}
 	
 	protected void remove()
@@ -108,9 +108,9 @@ public class L2DynamicZone extends L2ZoneType
 		_region.removeZone(this);
 		for (L2Character member : getCharactersInside())
 		{
-			member.stopSkillEffects(_skill.getId());
+			member.stopSkillEffects(true, _skill.getId());
 		}
-		_owner.stopSkillEffects(_skill.getId());
+		_owner.stopSkillEffects(true, _skill.getId());
 		
 	}
 	
@@ -123,7 +123,7 @@ public class L2DynamicZone extends L2ZoneType
 		}
 		else
 		{
-			character.stopSkillEffects(_skill.getId());
+			character.stopSkillEffects(true, _skill.getId());
 		}
 	}
 	

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/zone/type/L2SiegeZone.java

@@ -250,7 +250,7 @@ public class L2SiegeZone extends L2ZoneType
 				final L2Effect e = character.getFirstEffect(5660);
 				if (e != null)
 				{
-					lvl = Math.min(lvl + e.getLevel(), 5);
+					lvl = Math.min(lvl + e.getSkill().getLevel(), 5);
 				}
 				
 				final L2Skill skill = SkillTable.getInstance().getInfo(5660, lvl);

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestDispel.java

@@ -74,13 +74,13 @@ public class RequestDispel extends L2GameClientPacket
 		}
 		if (activeChar.getObjectId() == _objectId)
 		{
-			activeChar.stopSkillEffects(_skillId);
+			activeChar.stopSkillEffects(true, _skillId);
 		}
 		else
 		{
 			if (activeChar.hasSummon() && (activeChar.getSummon().getObjectId() == _objectId))
 			{
-				activeChar.getSummon().stopSkillEffects(_skillId);
+				activeChar.getSummon().stopSkillEffects(true, _skillId);
 			}
 		}
 	}

+ 17 - 44
L2J_Server_BETA/java/com/l2jserver/gameserver/network/serverpackets/AbnormalStatusUpdate.java

@@ -18,67 +18,40 @@
  */
 package com.l2jserver.gameserver.network.serverpackets;
 
+import java.util.ArrayList;
 import java.util.List;
 
-import javolution.util.FastList;
+import com.l2jserver.gameserver.model.holders.EffectDurationHolder;
+import com.l2jserver.gameserver.model.skills.L2Skill;
 
 public class AbnormalStatusUpdate extends L2GameServerPacket
 {
-	private final List<Effect> _effects;
+	private final List<EffectDurationHolder> _effects = new ArrayList<>();
 	
-	private static class Effect
+	public void addEffect(L2Skill skill, int duration)
 	{
-		protected int _skillId;
-		protected int _level;
-		protected int _duration;
-		
-		public Effect(int pSkillId, int pLevel, int pDuration)
+		switch (skill.getId())
 		{
-			_skillId = pSkillId;
-			_level = pLevel;
-			_duration = pDuration;
+			case 2031:
+			case 2032:
+			case 2037:
+			case 26025:
+			case 26026:
+				return;
 		}
-	}
-	
-	public AbnormalStatusUpdate()
-	{
-		_effects = new FastList<>();
-	}
-	
-	/**
-	 * @param skillId
-	 * @param level
-	 * @param duration
-	 */
-	public void addEffect(int skillId, int level, int duration)
-	{
-		if ((skillId == 2031) || (skillId == 2032) || (skillId == 2037) || (skillId == 26025) || (skillId == 26026))
-		{
-			return;
-		}
-		_effects.add(new Effect(skillId, level, duration));
+		_effects.add(new EffectDurationHolder(skill, duration));
 	}
 	
 	@Override
 	protected final void writeImpl()
 	{
 		writeC(0x85);
-		
 		writeH(_effects.size());
-		
-		for (Effect temp : _effects)
+		for (EffectDurationHolder edh : _effects)
 		{
-			writeD(temp._skillId);
-			writeH(temp._level);
-			
-			if (temp._duration == -1)
-			{
-				writeD(-1);
-			}
-			else
-			{
-				writeD(temp._duration / 1000);
-			}
+			writeD(edh.getSkillId());
+			writeH(edh.getSkillLvl());
+			writeD(edh.getDuration());
 		}
 	}
 }

+ 13 - 27
L2J_Server_BETA/java/com/l2jserver/gameserver/network/serverpackets/ExOlympiadSpelledInfo.java

@@ -18,43 +18,29 @@
  */
 package com.l2jserver.gameserver.network.serverpackets;
 
+import java.util.ArrayList;
 import java.util.List;
 
-import javolution.util.FastList;
-
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.holders.EffectDurationHolder;
+import com.l2jserver.gameserver.model.skills.L2Skill;
 
 /**
  * @author godson
  */
 public class ExOlympiadSpelledInfo extends L2GameServerPacket
 {
-	private final int _playerID;
-	private final List<Effect> _effects;
-	
-	private static class Effect
-	{
-		protected int _skillId;
-		protected int _level;
-		protected int _duration;
-		
-		public Effect(int pSkillId, int pLevel, int pDuration)
-		{
-			_skillId = pSkillId;
-			_level = pLevel;
-			_duration = pDuration;
-		}
-	}
+	private final int _playerId;
+	private final List<EffectDurationHolder> _effects = new ArrayList<>();
 	
 	public ExOlympiadSpelledInfo(L2PcInstance player)
 	{
-		_effects = new FastList<>();
-		_playerID = player.getObjectId();
+		_playerId = player.getObjectId();
 	}
 	
-	public void addEffect(int skillId, int level, int duration)
+	public void addEffect(L2Skill skill, int duration)
 	{
-		_effects.add(new Effect(skillId, level, duration));
+		_effects.add(new EffectDurationHolder(skill, duration));
 	}
 	
 	@Override
@@ -62,13 +48,13 @@ public class ExOlympiadSpelledInfo extends L2GameServerPacket
 	{
 		writeC(0xFE);
 		writeH(0x7B);
-		writeD(_playerID);
+		writeD(_playerId);
 		writeD(_effects.size());
-		for (Effect temp : _effects)
+		for (EffectDurationHolder edh : _effects)
 		{
-			writeD(temp._skillId);
-			writeH(temp._level);
-			writeD(temp._duration / 1000);
+			writeD(edh.getSkillId());
+			writeH(edh.getSkillLvl());
+			writeD(edh.getDuration());
 		}
 	}
 }

+ 13 - 30
L2J_Server_BETA/java/com/l2jserver/gameserver/network/serverpackets/PartySpelled.java

@@ -18,57 +18,40 @@
  */
 package com.l2jserver.gameserver.network.serverpackets;
 
+import java.util.ArrayList;
 import java.util.List;
 
-import javolution.util.FastList;
-
 import com.l2jserver.gameserver.model.actor.L2Character;
-import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2ServitorInstance;
+import com.l2jserver.gameserver.model.holders.EffectDurationHolder;
+import com.l2jserver.gameserver.model.skills.L2Skill;
 
 public class PartySpelled extends L2GameServerPacket
 {
-	private final List<Effect> _effects;
+	private final List<EffectDurationHolder> _effects = new ArrayList<>();
 	private final L2Character _activeChar;
 	
-	private static class Effect
+	public PartySpelled(L2Character cha)
 	{
-		protected int _skillId;
-		protected int _dat;
-		protected int _duration;
-		
-		public Effect(int pSkillId, int pDat, int pDuration)
-		{
-			_skillId = pSkillId;
-			_dat = pDat;
-			_duration = pDuration;
-		}
+		_activeChar = cha;
 	}
 	
-	public PartySpelled(L2Character cha)
+	public void addPartySpelledEffect(L2Skill skill, int duration)
 	{
-		_effects = new FastList<>();
-		_activeChar = cha;
+		_effects.add(new EffectDurationHolder(skill, duration));
 	}
 	
 	@Override
 	protected final void writeImpl()
 	{
 		writeC(0xF4);
-		writeD(_activeChar instanceof L2ServitorInstance ? 2 : _activeChar instanceof L2PetInstance ? 1 : 0);
+		writeD(_activeChar.isServitor() ? 2 : _activeChar.isPet() ? 1 : 0);
 		writeD(_activeChar.getObjectId());
 		writeD(_effects.size());
-		for (Effect temp : _effects)
+		for (EffectDurationHolder edh : _effects)
 		{
-			writeD(temp._skillId);
-			writeH(temp._dat);
-			writeD(temp._duration / 1000);
+			writeD(edh.getSkillId());
+			writeH(edh.getSkillLvl());
+			writeD(edh.getDuration());
 		}
-		
-	}
-	
-	public void addPartySpelledEffect(int skillId, int dat, int duration)
-	{
-		_effects.add(new Effect(skillId, dat, duration));
 	}
 }