Explorar o código

BETA: Moved maximum buff count and maximum cubic count to stats.
* Removed iterations every time the maximum buff count is needed.
* Removed `CUBIC_MASTERY` effect type.
* Removed `CUBIC_MASTERY` common skill.
* Removed `_val` from `AbstractEffect`.

Suggested by: Nos
Reviewed by: UnAfraid

Zoey76 %!s(int64=11) %!d(string=hai) anos
pai
achega
2314fc80ad

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/CharEffectList.java

@@ -1491,7 +1491,7 @@ public final class CharEffectList
 			}
 			else if (!skill.isHealingPotionSkill())
 			{
-				buffsToRemove = getBuffCount() - _owner.getMaxBuffCount();
+				buffsToRemove = getBuffCount() - _owner.getStat().getMaxBuffCount();
 			}
 			
 			for (Entry<Integer, BuffInfo> entry : effects.entrySet())

+ 1 - 21
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Character.java

@@ -85,7 +85,6 @@ import com.l2jserver.gameserver.model.actor.tasks.character.UsePotionTask;
 import com.l2jserver.gameserver.model.actor.templates.L2CharTemplate;
 import com.l2jserver.gameserver.model.actor.transform.Transform;
 import com.l2jserver.gameserver.model.actor.transform.TransformTemplate;
-import com.l2jserver.gameserver.model.effects.AbstractEffect;
 import com.l2jserver.gameserver.model.effects.EffectFlag;
 import com.l2jserver.gameserver.model.effects.L2EffectType;
 import com.l2jserver.gameserver.model.entity.Instance;
@@ -231,9 +230,8 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
 	private volatile Map<Integer, OptionsSkillHolder> _triggerSkills;
 	
 	private volatile Map<Integer, InvulSkillHolder> _invulAgainst;
-	
+	/** Creatures effect list. */
 	private final CharEffectList _effectList = new CharEffectList(this);
-	
 	/** The character that summons this character. */
 	private L2Character _summoner = null;
 	
@@ -6664,24 +6662,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
 		return false;
 	}
 	
-	/**
-	 * Check player max buff count
-	 * @return max buff count
-	 */
-	public int getMaxBuffCount()
-	{
-		int count = Config.BUFFS_MAX_AMOUNT;
-		if (isAffectedBySkill(CommonSkill.DIVINE_INSPIRATION.getId()))
-		{
-			final BuffInfo info = getEffectList().getBuffInfoBySkillId(CommonSkill.DIVINE_INSPIRATION.getId());
-			for (AbstractEffect effect : info.getEffects())
-			{
-				count += (int) effect.getValue();
-			}
-		}
-		return count;
-	}
-	
 	/**
 	 * Send system message about damage.
 	 * @param target

+ 1 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -746,9 +746,8 @@ public final class L2PcInstance extends L2Playable
 	private long _activeEnchantTimestamp = 0;
 	
 	protected boolean _inventoryDisable = false;
-	
+	/** Player's cubics. */
 	private final Map<Integer, L2CubicInstance> _cubics = new ConcurrentSkipListMap<>();
-	
 	/** Active shots. */
 	protected FastSet<Integer> _activeSoulShots = new FastSet<Integer>().shared();
 	
@@ -7551,10 +7550,6 @@ public final class L2PcInstance extends L2Playable
 	 */
 	public synchronized void store(boolean storeActiveEffects)
 	{
-		// update client coords, if these look like true
-		// if (isInsideRadius(getClientX(), getClientY(), 1000, true))
-		// setXYZ(getClientX(), getClientY(), getClientZ());
-		
 		storeCharBase();
 		storeCharSub();
 		storeEffect(storeActiveEffects);

+ 20 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/stat/CharStat.java

@@ -45,6 +45,8 @@ public class CharStat
 	private final float[] _defenceTraits = new float[TraitType.values().length];
 	private final int[] _defenceTraitsCount = new int[TraitType.values().length];
 	private final int[] _traitsInvul = new int[TraitType.values().length];
+	/** Creature's maximum buff count. */
+	private int _maxBuffCount = Config.BUFFS_MAX_AMOUNT;
 	
 	public CharStat(L2Character activeChar)
 	{
@@ -796,4 +798,22 @@ public class CharStat
 	{
 		return _traitsInvul;
 	}
+	
+	/**
+	 * Gets the maximum buff count.
+	 * @return the maximum buff count
+	 */
+	public int getMaxBuffCount()
+	{
+		return _maxBuffCount;
+	}
+	
+	/**
+	 * Sets the maximum buff count.
+	 * @param buffCount the buff count
+	 */
+	public void setMaxBuffCount(int buffCount)
+	{
+		_maxBuffCount = buffCount;
+	}
 }

+ 20 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/stat/PcStat.java

@@ -52,6 +52,8 @@ public class PcStat extends PlayableStat
 	private float _vitalityPoints = 1;
 	private byte _vitalityLevel = 0;
 	private long _startingXp;
+	/** Player's maximum cubic count. */
+	private int _maxCubicCount = 1;
 	
 	public static final int VITALITY_LEVELS[] =
 	{
@@ -396,6 +398,24 @@ public class PcStat extends PlayableStat
 		return _startingXp;
 	}
 	
+	/**
+	 * Gets the maximum cubic count.
+	 * @return the maximum cubic count
+	 */
+	public int getMaxCubicCount()
+	{
+		return _maxCubicCount;
+	}
+	
+	/**
+	 * Sets the maximum cubic count.
+	 * @param cubicCount the maximum cubic count
+	 */
+	public void setMaxCubicCount(int cubicCount)
+	{
+		_maxCubicCount = cubicCount;
+	}
+	
 	@Override
 	public final byte getLevel()
 	{

+ 1 - 12
L2J_Server_BETA/java/com/l2jserver/gameserver/model/effects/AbstractEffect.java

@@ -54,9 +54,8 @@ public abstract class AbstractEffect implements IChanceSkillTrigger
 	// Apply condition
 	// private final Condition _applyCond; // TODO: Use or cleanup.
 	private List<FuncTemplate> _funcTemplates;
-	/** Effect class name. */
+	/** Effect name. */
 	private final String _name;
-	private final double _val;
 	/** Ticks. */
 	private final int _ticks;
 	private final int _triggeredId;
@@ -75,7 +74,6 @@ public abstract class AbstractEffect implements IChanceSkillTrigger
 		_attachCond = attachCond;
 		// _applyCond = applyCond;
 		_name = set.getString("name");
-		_val = set.getDouble("val", 0);
 		_ticks = set.getInt("ticks", 0);
 		_triggeredId = set.getInt("triggeredId", 0);
 		_triggeredLevel = set.getInt("triggeredLevel", 1);
@@ -154,15 +152,6 @@ public abstract class AbstractEffect implements IChanceSkillTrigger
 		return _name;
 	}
 	
-	/**
-	 * Gets the generic value.
-	 * @return the value
-	 */
-	public double getValue()
-	{
-		return _val;
-	}
-	
 	/**
 	 * Gets the effect ticks
 	 * @return the ticks

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

@@ -35,7 +35,6 @@ public enum L2EffectType
 	CPHEAL,
 	CPHEAL_OVER_TIME,
 	CPHEAL_PERCENT,
-	CUBIC_MASTERY,
 	DAMAGE_TRANSFER,
 	DEBUFF,
 	DISPEL,

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

@@ -42,7 +42,6 @@ public enum CommonSkill
 	SPECIAL_TREE_RECOVERY_BONUS(2139, 1),
 	WEAPON_GRADE_PENALTY(6209, 1),
 	ARMOR_GRADE_PENALTY(6213, 1),
-	CUBIC_MASTERY(143, 1),
 	CREATE_DWARVEN(172, 1),
 	LUCKY(194, 1),
 	EXPERTISE(239, 1),