All pastes #2079194 Raw Edit

Mine

public diff v1 · immutable
#2079194 ·published 2011-08-31 01:47 UTC
rendered paste body
Index: com/l2jserver/gameserver/model/CharEffectList.java===================================================================--- com/l2jserver/gameserver/model/CharEffectList.java	(revision 4888)+++ com/l2jserver/gameserver/model/CharEffectList.java	(working copy)@@ -37,6 +37,7 @@ import com.l2jserver.gameserver.network.serverpackets.ExOlympiadSpelledInfo; import com.l2jserver.gameserver.network.serverpackets.PartySpelled; import com.l2jserver.gameserver.network.serverpackets.SystemMessage;+import com.l2jserver.gameserver.skills.StackType; import com.l2jserver.gameserver.templates.skills.L2EffectType; import com.l2jserver.gameserver.templates.skills.L2SkillType; @@ -72,7 +73,7 @@ 	private FastList<L2Effect> _passives; // They bypass most of the actions, keep in mind that those arent included in getAllEffects() 	 	// The table containing the List of all stacked effect in progress for each Stack group Identifier-	private Map<String, List<L2Effect>> _stackedEffects;+	private Map<StackType, List<L2Effect>> _stackedEffects; 	 	private volatile boolean _hasBuffsRemovedOnAnyAction = false; 	private volatile boolean _hasBuffsRemovedOnDamage = false;@@ -287,11 +288,11 @@ 			return false; 		} 		-		String stackType = checkSkill._effectTemplates[0].abnormalType;+		StackType stackType = checkSkill._effectTemplates[0].abnormalType; 		 		for (L2Effect e : _buffs) 		{-			if (e.getAbnormalType() != null && e.getAbnormalType().equals(stackType))+			if (e.getAbnormalType() != null && e.getAbnormalType() == stackType) 			{ 				return true; 			}@@ -616,7 +617,7 @@ 			effectList = _buffs; 		} 		-		if ("none".equals(effect.getAbnormalType()))+		if (StackType.STACKTYPE_NONE == effect.getAbnormalType()) 		{ 			// Remove Func added by this effect from the L2Character Calculator 			_owner.removeStatsOwner(effect);@@ -696,7 +697,7 @@ 				_passives = new FastList<L2Effect>().shared(); 			 			// Passive effects dont need stack type-			if ("none".equals(newEffect.getAbnormalType()))+			if (StackType.STACKTYPE_NONE == newEffect.getAbnormalType()) 			{ 				// Set this L2Effect to In Use 				if (newEffect.setInUse(true))@@ -730,7 +731,7 @@ 				_debuffs = new FastList<L2Effect>().shared(); 			for (L2Effect e : _debuffs) 			{-				if (e != null && e.getSkill().getId() == newEffect.getSkill().getId() && e.getEffectType() == newEffect.getEffectType() && e.getAbnormalLvl() == newEffect.getAbnormalLvl() && e.getAbnormalType().equals(newEffect.getAbnormalType()))+				if (e != null && e.getSkill().getId() == newEffect.getSkill().getId() && e.getEffectType() == newEffect.getEffectType() && e.getAbnormalLvl() == newEffect.getAbnormalLvl() && e.getAbnormalType() == newEffect.getAbnormalType()) 				{ 					// Started scheduled timer needs to be canceled. 					newEffect.stopEffectTask();@@ -746,7 +747,7 @@ 			 			for (L2Effect e : _buffs) 			{-				if (e != null && e.getSkill().getId() == newEffect.getSkill().getId() && e.getEffectType() == newEffect.getEffectType() && e.getAbnormalLvl() == newEffect.getAbnormalLvl() && e.getAbnormalType().equals(newEffect.getAbnormalType()))+				if (e != null && e.getSkill().getId() == newEffect.getSkill().getId() && e.getEffectType() == newEffect.getEffectType() && e.getAbnormalLvl() == newEffect.getAbnormalLvl() && e.getAbnormalType() == newEffect.getAbnormalType()) 				{ 					e.exit(); // exit this 				}@@ -850,7 +851,7 @@ 		} 		 		// Check if a stack group is defined for this effect-		if ("none".equals(newEffect.getAbnormalType()))+		if (StackType.STACKTYPE_NONE == newEffect.getAbnormalType()) 		{ 			// Set this L2Effect to In Use 			if (newEffect.setInUse(true))@@ -864,7 +865,7 @@ 		L2Effect effectToAdd = null; 		L2Effect effectToRemove = null; 		if (_stackedEffects == null)-			_stackedEffects = new FastMap<String, List<L2Effect>>();+			_stackedEffects = new FastMap<StackType, List<L2Effect>>(); 		 		// Get the list of all stacked effects corresponding to the stack type of the L2Effect to add 		stackQueue = _stackedEffects.get(newEffect.getAbnormalType());Index: com/l2jserver/gameserver/model/L2Effect.java===================================================================--- com/l2jserver/gameserver/model/L2Effect.java	(revision 4888)+++ com/l2jserver/gameserver/model/L2Effect.java	(working copy)@@ -35,6 +35,7 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.skills.AbnormalEffect; import com.l2jserver.gameserver.skills.Env;+import com.l2jserver.gameserver.skills.StackType; import com.l2jserver.gameserver.skills.funcs.Func; import com.l2jserver.gameserver.skills.funcs.FuncTemplate; import com.l2jserver.gameserver.skills.funcs.Lambda;@@ -134,7 +135,7 @@ 	private ScheduledFuture<?> _currentFuture; 	 	/** The Identifier of the stack group */-	private final String _abnormalType;+	private final StackType _abnormalType; 	 	/** The position of the effect in the stack group */ 	private final byte _abnormalLvl;@@ -305,7 +306,7 @@ 		return _startConditionsCorrect; 	} 	-	public String getAbnormalType()+	public StackType getAbnormalType() 	{ 		return _abnormalType; 	}Index: com/l2jserver/gameserver/model/L2Skill.java===================================================================--- com/l2jserver/gameserver/model/L2Skill.java	(revision 4888)+++ com/l2jserver/gameserver/model/L2Skill.java	(working copy)@@ -49,6 +49,7 @@ import com.l2jserver.gameserver.skills.BaseStats; import com.l2jserver.gameserver.skills.Env; import com.l2jserver.gameserver.skills.Formulas;+import com.l2jserver.gameserver.skills.StackType; import com.l2jserver.gameserver.skills.Stats; import com.l2jserver.gameserver.skills.conditions.Condition; import com.l2jserver.gameserver.skills.funcs.Func;@@ -173,7 +174,7 @@ 	private final int _negateLvl;   // abnormalLvl is negated with negateLvl 	private final int[] _negateId; 			// cancels the effect of skill ID 	private final L2SkillType[] _negateStats; 	// lists the effect types that are canceled-	private final Map<String, Byte> _negateAbnormals; // lists the effect abnormal types with order below the presented that are canceled+	private final Map<StackType, Byte> _negateAbnormals; // lists the effect abnormal types with order below the presented that are canceled 	private final int _maxNegatedEffects; 	// maximum number of effects to negate 	 	private final boolean _stayAfterDeath; // skill should stay after death@@ -358,19 +359,19 @@ 		String negateAbnormals = set.getString("negateAbnormals", null); 		if (negateAbnormals != null && negateAbnormals != "") 		{-			_negateAbnormals = new FastMap<String, Byte>();+			_negateAbnormals = new FastMap<StackType, Byte>(); 			for (String ngtStack : negateAbnormals.split(";")) 			{ 				String[] ngt = ngtStack.split(","); 				if (ngt.length == 1) // Only abnormalType is present, without abnormalLvl 				{-					_negateAbnormals.put(ngt[0], Byte.MAX_VALUE);+					_negateAbnormals.put(StackType.getStackType(ngt[0]), Byte.MAX_VALUE); 				} 				else if (ngt.length == 2) // Both abnormalType and abnormalLvl are present 				{ 					try 					{-						_negateAbnormals.put(ngt[0], Byte.parseByte(ngt[1]));+						_negateAbnormals.put(StackType.getStackType(ngt[0]), Byte.parseByte(ngt[1])); 					} 					catch (Exception e) 					{@@ -680,7 +681,7 @@ 		return _negateStats; 	} 	-	public final Map<String, Byte> getNegateAbnormals()+	public final Map<StackType, Byte> getNegateAbnormals() 	{ 		return _negateAbnormals; 	}Index: com/l2jserver/gameserver/model/actor/instance/L2BabyPetInstance.java===================================================================--- com/l2jserver/gameserver/model/actor/instance/L2BabyPetInstance.java	(revision 4888)+++ com/l2jserver/gameserver/model/actor/instance/L2BabyPetInstance.java	(working copy)@@ -317,7 +317,7 @@ 									// effect with same stacktype and greater or equal stackorder 									if (skill.hasEffects() 											&& !"none".equals(skill.getEffectTemplates()[0].abnormalType)-											&& e.getAbnormalType().equals(skill.getEffectTemplates()[0].abnormalType)+											&& e.getAbnormalType() == skill.getEffectTemplates()[0].abnormalType 											&& e.getAbnormalLvl() >= skill.getEffectTemplates()[0].abnormalLvl) 									{ 										iter.remove();Index: com/l2jserver/gameserver/skills/DocumentBase.java===================================================================--- com/l2jserver/gameserver/skills/DocumentBase.java	(revision 4888)+++ com/l2jserver/gameserver/skills/DocumentBase.java	(working copy)@@ -320,10 +320,10 @@ 			event = AbnormalEffect.getByName(spc); 		} 		byte abnormalLvl = 0;-		String abnormalType = "none";+		StackType abnormalType = StackType.STACKTYPE_NONE; 		if (attrs.getNamedItem("abnormalType") != null) 		{-			abnormalType = attrs.getNamedItem("abnormalType").getNodeValue();+			abnormalType = StackType.getStackType(attrs.getNamedItem("abnormalType").getNodeValue()); 		} 		if (attrs.getNamedItem("abnormalLvl") != null) 		{Index: com/l2jserver/gameserver/skills/StackType.java===================================================================--- com/l2jserver/gameserver/skills/StackType.java	(revision 0)+++ com/l2jserver/gameserver/skills/StackType.java	(revision 0)@@ -0,0 +1,50 @@+/*+ * This program 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.+ * + * This program 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.skills;++import javolution.util.FastMap;++/**+ * + * @author DrHouse+ *+ */+public class StackType+{+	private static final FastMap<String, StackType> _table = new FastMap<String, StackType>();+	public static final StackType STACKTYPE_NONE = new StackType();+	+	static+	{+		_table.put("none", STACKTYPE_NONE);+	}+	+	private StackType()+	{+		super();+	}+	+	/**+	 * Make sure no concurrent access is done to this map. Usage is only meant while server is booting up+	 * +	 */+	public static StackType getStackType(String stacktype)+	{+		if (_table.containsKey(stacktype))+			return _table.get(stacktype);+		+		return _table.put(stacktype, new StackType());+	}+}\ No newline at end of fileIndex: com/l2jserver/gameserver/skills/effects/EffectCancel.java===================================================================--- com/l2jserver/gameserver/skills/effects/EffectCancel.java	(revision 4888)+++ com/l2jserver/gameserver/skills/effects/EffectCancel.java	(working copy)@@ -22,6 +22,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.skills.Env; import com.l2jserver.gameserver.skills.Formulas;+import com.l2jserver.gameserver.skills.StackType; import com.l2jserver.gameserver.templates.effects.EffectTemplate; import com.l2jserver.gameserver.templates.skills.L2EffectType; import com.l2jserver.util.Rnd;@@ -125,9 +126,9 @@ 				if (eff == null) 					continue; 				-				for (String negateAbnormalType : effect.getSkill().getNegateAbnormals().keySet())+				for (StackType negateAbnormalType : effect.getSkill().getNegateAbnormals().keySet()) 				{-					if (negateAbnormalType.equalsIgnoreCase(eff.getAbnormalType()) && effect.getSkill().getNegateAbnormals().get(negateAbnormalType) >= eff.getAbnormalLvl())+					if (negateAbnormalType == eff.getAbnormalType() && effect.getSkill().getNegateAbnormals().get(negateAbnormalType) >= eff.getAbnormalLvl()) 					{ 						if (calcCancelSuccess(eff, cancelLvl, (int)rate)) 							eff.exit();Index: com/l2jserver/gameserver/skills/effects/EffectNegate.java===================================================================--- com/l2jserver/gameserver/skills/effects/EffectNegate.java	(revision 4888)+++ com/l2jserver/gameserver/skills/effects/EffectNegate.java	(working copy)@@ -17,6 +17,7 @@ import com.l2jserver.gameserver.model.L2Effect; import com.l2jserver.gameserver.model.L2Skill; import com.l2jserver.gameserver.skills.Env;+import com.l2jserver.gameserver.skills.StackType; import com.l2jserver.gameserver.templates.effects.EffectTemplate; import com.l2jserver.gameserver.templates.skills.L2EffectType; import com.l2jserver.gameserver.templates.skills.L2SkillType;@@ -59,9 +60,9 @@ 				if (effect == null) 					continue; 				-				for (String negateAbnormalType : skill.getNegateAbnormals().keySet())+				for (StackType negateAbnormalType : skill.getNegateAbnormals().keySet()) 				{-					if (negateAbnormalType.equalsIgnoreCase(effect.getAbnormalType()) && skill.getNegateAbnormals().get(negateAbnormalType) >= effect.getAbnormalLvl())+					if (negateAbnormalType == effect.getAbnormalType() && skill.getNegateAbnormals().get(negateAbnormalType) >= effect.getAbnormalLvl()) 						effect.exit(); 				} 			}Index: com/l2jserver/gameserver/templates/effects/EffectTemplate.java===================================================================--- com/l2jserver/gameserver/templates/effects/EffectTemplate.java	(revision 4888)+++ com/l2jserver/gameserver/templates/effects/EffectTemplate.java	(working copy)@@ -23,6 +23,7 @@ import com.l2jserver.gameserver.model.L2Effect; import com.l2jserver.gameserver.skills.AbnormalEffect; import com.l2jserver.gameserver.skills.Env;+import com.l2jserver.gameserver.skills.StackType; import com.l2jserver.gameserver.skills.conditions.Condition; import com.l2jserver.gameserver.skills.funcs.FuncTemplate; import com.l2jserver.gameserver.skills.funcs.Lambda;@@ -49,7 +50,7 @@ 	public final AbnormalEffect[] specialEffect; 	public final AbnormalEffect eventEffect; 	public FuncTemplate[] funcTemplates;-	public final String abnormalType;+	public final StackType abnormalType; 	public final byte abnormalLvl; 	public final boolean icon; 	public final String funcName;@@ -64,7 +65,7 @@ 	 	public EffectTemplate(Condition pAttachCond, Condition pApplayCond, String func, Lambda pLambda, 			int pCounter, int pAbnormalTime, AbnormalEffect pAbnormalEffect, AbnormalEffect[] pSpecialEffect,-			AbnormalEffect pEventEffect, String pAbnormalType, byte pAbnormalLvl, boolean showicon,+			AbnormalEffect pEventEffect, StackType pAbnormalType, byte pAbnormalLvl, boolean showicon, 			double ePower, L2SkillType eType, int trigId, int trigLvl, ChanceCondition chanceCond, boolean passiveEff) 	{ 		attachCond = pAttachCond;