Adry_85 13 年之前
父节点
当前提交
8f0a4a7479

+ 37 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Character.java

@@ -91,6 +91,7 @@ import com.l2jserver.gameserver.model.skills.l2skills.L2SkillAgathion;
 import com.l2jserver.gameserver.model.skills.l2skills.L2SkillMount;
 import com.l2jserver.gameserver.model.skills.l2skills.L2SkillMount;
 import com.l2jserver.gameserver.model.skills.l2skills.L2SkillSummon;
 import com.l2jserver.gameserver.model.skills.l2skills.L2SkillSummon;
 import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
 import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
+import com.l2jserver.gameserver.model.stats.BaseStats;
 import com.l2jserver.gameserver.model.stats.Calculator;
 import com.l2jserver.gameserver.model.stats.Calculator;
 import com.l2jserver.gameserver.model.stats.Formulas;
 import com.l2jserver.gameserver.model.stats.Formulas;
 import com.l2jserver.gameserver.model.stats.Stats;
 import com.l2jserver.gameserver.model.stats.Stats;
@@ -7485,6 +7486,42 @@ public abstract class L2Character extends L2Object
 		getStatus().setCurrentMp(newMp);
 		getStatus().setCurrentMp(newMp);
 	}
 	}
 	
 	
+	/**
+	 * @return the max weight that the L2Character can load.
+	 */
+	public int getMaxLoad()
+	{
+		if (isPlayer() || isPet())
+		{
+			// Weight Limit = (CON Modifier*69000) * Skills
+			// Source http://l2p.bravehost.com/weightlimit.html (May 2007)
+			double baseLoad = Math.floor(BaseStats.CON.calcBonus(this) * 69000 * Config.ALT_WEIGHT_LIMIT);
+			return (int) calcStat(Stats.WEIGHT_LIMIT, baseLoad, this, null);
+		}
+		return 0;
+	}
+	
+	public int getBonusWeightPenalty()
+	{
+		if (isPlayer() || isPet())
+		{
+			return (int) calcStat(Stats.WEIGHT_PENALTY, 1, this, null);
+		}
+		return 0;
+	}
+	
+	/**
+	 * @return the current weight of the L2Character.
+	 */
+	public int getCurrentLoad()
+	{
+		if (isPlayer() || isPet())
+		{
+			return getInventory().getTotalWeight();
+		}
+		return 0;
+	}
+	
 	public boolean isChampion()
 	public boolean isChampion()
 	{
 	{
 		return false;
 		return false;

+ 0 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Summon.java

@@ -276,11 +276,6 @@ public abstract class L2Summon extends L2Playable
 		return getTemplate().getNpcId();
 		return getTemplate().getNpcId();
 	}
 	}
 	
 	
-	public int getMaxLoad()
-	{
-		return 0;
-	}
-	
 	public short getSoulShotsPerHit()
 	public short getSoulShotsPerHit()
 	{
 	{
 		if (getTemplate().getAIDataStatic().getSoulShot() > 0)
 		if (getTemplate().getAIDataStatic().getSoulShot() > 0)

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

@@ -194,7 +194,6 @@ import com.l2jserver.gameserver.model.skills.l2skills.L2SkillSiegeFlag;
 import com.l2jserver.gameserver.model.skills.l2skills.L2SkillSummon;
 import com.l2jserver.gameserver.model.skills.l2skills.L2SkillSummon;
 import com.l2jserver.gameserver.model.skills.l2skills.L2SkillTrap;
 import com.l2jserver.gameserver.model.skills.l2skills.L2SkillTrap;
 import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
 import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
-import com.l2jserver.gameserver.model.stats.BaseStats;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Formulas;
 import com.l2jserver.gameserver.model.stats.Formulas;
 import com.l2jserver.gameserver.model.stats.Stats;
 import com.l2jserver.gameserver.model.stats.Stats;
@@ -2182,14 +2181,6 @@ public final class L2PcInstance extends L2Playable
 		_deleteTimer = deleteTimer;
 		_deleteTimer = deleteTimer;
 	}
 	}
 	
 	
-	/**
-	 * @return the current weight of the L2PcInstance.
-	 */
-	public int getCurrentLoad()
-	{
-		return _inventory.getTotalWeight();
-	}
-
 	/**
 	/**
 	 * @return the number of recommendation obtained by the L2PcInstance.
 	 * @return the number of recommendation obtained by the L2PcInstance.
 	 */
 	 */
@@ -2311,17 +2302,6 @@ public final class L2PcInstance extends L2Playable
 		broadcastKarma();
 		broadcastKarma();
 	}
 	}
 	
 	
-	/**
-	 * @return the max weight that the L2PcInstance can load.
-	 */
-	public int getMaxLoad()
-	{
-		// Weight Limit = (CON Modifier*69000) * Skills
-		// Source http://l2p.bravehost.com/weightlimit.html (May 2007)
-		double baseLoad = Math.floor(BaseStats.CON.calcBonus(this) * 69000 * Config.ALT_WEIGHT_LIMIT);
-		return (int)calcStat(Stats.WEIGHT_LIMIT, baseLoad, this, null);
-	}
-	
 	public int getExpertiseArmorPenalty()
 	public int getExpertiseArmorPenalty()
 	{
 	{
 		return _expertiseArmorPenalty;
 		return _expertiseArmorPenalty;
@@ -2347,7 +2327,7 @@ public final class L2PcInstance extends L2Playable
 		int maxLoad = getMaxLoad();
 		int maxLoad = getMaxLoad();
 		if (maxLoad > 0)
 		if (maxLoad > 0)
 		{
 		{
-			long weightproc = (long) ((getCurrentLoad() - calcStat(Stats.WEIGHT_PENALTY, 1, this, null)) * 1000 / maxLoad);
+			long weightproc = (((getCurrentLoad() - getBonusWeightPenalty()) * 1000) / getMaxLoad());
 			int newWeightPenalty;
 			int newWeightPenalty;
 			if (weightproc < 500 || _dietMode)
 			if (weightproc < 500 || _dietMode)
 			{
 			{

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

@@ -1274,17 +1274,6 @@ public class L2PetInstance extends L2Summon
 		L2World.getInstance().addPet(oldOwnerId, this);
 		L2World.getInstance().addPet(oldOwnerId, this);
 	}
 	}
 	
 	
-	public int getCurrentLoad()
-	{
-		return _inventory.getTotalWeight();
-	}
-	
-	@Override
-	public final int getMaxLoad()
-	{
-		return getPetData().getLoad();
-	}
-	
 	public int getInventoryLimit()
 	public int getInventoryLimit()
 	{
 	{
 		return Config.INVENTORY_MAXIMUM_PET;
 		return Config.INVENTORY_MAXIMUM_PET;
@@ -1295,7 +1284,7 @@ public class L2PetInstance extends L2Summon
 		int maxLoad = getMaxLoad();
 		int maxLoad = getMaxLoad();
 		if (maxLoad > 0)
 		if (maxLoad > 0)
 		{
 		{
-			long weightproc = (long) ((getCurrentLoad() - calcStat(Stats.WEIGHT_PENALTY, 1, this, null)) * 1000 / maxLoad);
+			long weightproc = (((getCurrentLoad() - getBonusWeightPenalty()) * 1000) / maxLoad);
 			int newWeightPenalty;
 			int newWeightPenalty;
 			if (weightproc < 500 || getOwner().getDietMode())
 			if (weightproc < 500 || getOwner().getDietMode())
 			{
 			{

+ 1 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerWeight.java

@@ -16,7 +16,6 @@ package com.l2jserver.gameserver.model.conditions;
 
 
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Env;
-import com.l2jserver.gameserver.model.stats.Stats;
 
 
 /**
 /**
  * The Class ConditionPlayerWeight.
  * The Class ConditionPlayerWeight.
@@ -42,7 +41,7 @@ public class ConditionPlayerWeight extends Condition
 		final L2PcInstance player = env.getPlayer();
 		final L2PcInstance player = env.getPlayer();
 		if ((player != null) && (player.getMaxLoad() > 0))
 		if ((player != null) && (player.getMaxLoad() > 0))
 		{
 		{
-			int weightproc = (int) (((player.getCurrentLoad() - player.calcStat(Stats.WEIGHT_PENALTY, 1, player, null)) * 100) / player.getMaxLoad());
+			int weightproc = (((player.getCurrentLoad() - player.getBonusWeightPenalty()) * 100) / player.getMaxLoad());
 			return (weightproc < _weight) || player.getDietMode();
 			return (weightproc < _weight) || player.getDietMode();
 		}
 		}
 		return true;
 		return true;

+ 1 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetWeight.java

@@ -17,7 +17,6 @@ package com.l2jserver.gameserver.model.conditions;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Env;
-import com.l2jserver.gameserver.model.stats.Stats;
 
 
 /**
 /**
  * The Class ConditionTargetWeight.
  * The Class ConditionTargetWeight.
@@ -45,7 +44,7 @@ public class ConditionTargetWeight extends Condition
 			final L2PcInstance target = targetObj.getActingPlayer();
 			final L2PcInstance target = targetObj.getActingPlayer();
 			if (!target.getDietMode() && (target.getMaxLoad() > 0))
 			if (!target.getDietMode() && (target.getMaxLoad() > 0))
 			{
 			{
-				int weightproc = (int) (((target.getCurrentLoad() - target.calcStat(Stats.WEIGHT_PENALTY, 1, target, null)) * 100) / target.getMaxLoad());
+				int weightproc = (((target.getCurrentLoad() - target.getBonusWeightPenalty()) * 100) / target.getMaxLoad());
 				return (weightproc < _weight);
 				return (weightproc < _weight);
 			}
 			}
 		}
 		}