浏览代码

BETA: Reworks:
* Env OOP rework.
* Conditions cleanup and format.
* Formulas cleanup and format, more to come, lots of unused methods.
* Funcs cleanup and format.
* Deleting more empty folders.

'''Note:''' Apologies to the forks and contributors for huge latest change sets, at some point this changes had to be done.

Zoey76 13 年之前
父节点
当前提交
2a2ceccd3f
共有 98 个文件被更改,包括 1267 次插入911 次删除
  1. 4 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  2. 3 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PetInstance.java
  3. 3 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2ServitorInstance.java
  4. 8 20
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/stat/CharStat.java
  5. 3 11
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/Condition.java
  6. 12 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionChangeWeapon.java
  7. 8 9
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionForceBuff.java
  8. 0 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionGameChance.java
  9. 0 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionGameTime.java
  10. 0 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionInventory.java
  11. 1 7
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionItemId.java
  12. 1 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionListener.java
  13. 10 5
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionLogicAnd.java
  14. 7 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionLogicNot.java
  15. 10 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionLogicOr.java
  16. 2 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionMinDistance.java
  17. 27 14
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPetType.java
  18. 2 7
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerActiveEffectId.java
  19. 6 7
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerActiveSkillId.java
  20. 2 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerAgathionId.java
  21. 4 5
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerBaseStats.java
  22. 9 8
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerCanSweep.java
  23. 2 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerCharges.java
  24. 1 5
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerClassIdRestriction.java
  25. 2 7
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerCloakStatus.java
  26. 2 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerCp.java
  27. 6 8
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerFlyMounted.java
  28. 2 9
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerGrade.java
  29. 11 9
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerHasCastle.java
  30. 12 11
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerHasClanHall.java
  31. 10 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerHasFort.java
  32. 13 13
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerHasPet.java
  33. 1 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerHp.java
  34. 7 5
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerInsideZoneId.java
  35. 11 8
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerInstanceId.java
  36. 6 8
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerInvSize.java
  37. 4 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerIsClanLeader.java
  38. 5 5
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerIsHero.java
  39. 6 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerLandingZone.java
  40. 1 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerLevel.java
  41. 3 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerLevelRange.java
  42. 5 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerMp.java
  43. 5 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerPkCount.java
  44. 5 14
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerPledgeClass.java
  45. 4 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerRace.java
  46. 8 5
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerRangeFromNpc.java
  47. 10 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerServitorNpcId.java
  48. 6 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerSex.java
  49. 5 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerSiegeSide.java
  50. 6 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerSouls.java
  51. 2 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerState.java
  52. 8 5
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerSubclass.java
  53. 4 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerTransformationId.java
  54. 4 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerTvTEvent.java
  55. 6 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerVehicleMounted.java
  56. 7 12
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerWeight.java
  57. 47 29
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionSiegeZone.java
  58. 1 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionSkillStats.java
  59. 8 8
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionSlotItemId.java
  60. 7 7
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionSlotItemType.java
  61. 2 5
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetAbnormal.java
  62. 4 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetActiveEffectId.java
  63. 4 5
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetActiveSkillId.java
  64. 1 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetAggro.java
  65. 5 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetBodyPart.java
  66. 4 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetClassIdRestriction.java
  67. 4 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetLevel.java
  68. 2 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetNone.java
  69. 8 8
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetNpcId.java
  70. 8 8
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetNpcType.java
  71. 1 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetPlayable.java
  72. 4 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetRace.java
  73. 4 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetRaceId.java
  74. 6 7
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetUsesWeaponKind.java
  75. 19 12
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionUsingItemType.java
  76. 4 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionUsingSkill.java
  77. 2 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionWithSkill.java
  78. 19 16
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/effects/L2Effect.java
  79. 5 7
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/items/L2Armor.java
  80. 14 15
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/items/L2Item.java
  81. 13 14
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/items/L2Weapon.java
  82. 22 22
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/L2Skill.java
  83. 29 35
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/Func.java
  84. 10 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncAdd.java
  85. 10 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncBaseMul.java
  86. 10 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncDiv.java
  87. 29 29
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncEnchant.java
  88. 7 4
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncEnchantHp.java
  89. 10 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncMul.java
  90. 10 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncSet.java
  91. 10 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncSub.java
  92. 0 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncTemplate.java
  93. 18 10
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/LambdaCalc.java
  94. 2 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/LambdaConst.java
  95. 5 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/LambdaRnd.java
  96. 23 13
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/LambdaStats.java
  97. 259 21
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/stats/Env.java
  98. 305 181
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/stats/Formulas.java

+ 4 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -8307,9 +8307,10 @@ public final class L2PcInstance extends L2Playable
 				if (skill.hasEffects())
 				{
 					Env env = new Env();
-					env.player = this;
-					env.target = this;
-					env.skill = skill;
+					env.setCharacter(this);
+					env.setTarget(this);
+					env.setSkill(skill);
+					
 					L2Effect ef;
 					for (EffectTemplate et : skill.getEffectTemplates())
 					{

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

@@ -1099,9 +1099,9 @@ public class L2PetInstance extends L2Summon
 			for (SummonEffect se : SummonEffectsTable.getInstance().getPetEffects().get(getControlObjectId()))
 			{
 				Env env = new Env();
-				env.player = this;
-				env.target = this;
-				env.skill = se.getSkill();
+				env.setCharacter(this);
+				env.setTarget(this);
+				env.setSkill(se.getSkill());
 				L2Effect ef;
 				for (EffectTemplate et : se.getSkill().getEffectTemplates())
 				{

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

@@ -481,9 +481,9 @@ public class L2ServitorInstance extends L2Summon
 				if (se == null)
 					continue;
 				Env env = new Env();
-				env.player = this;
-				env.target = this;
-				env.skill = se.getSkill();
+				env.setCharacter(this);
+				env.setTarget(this);
+				env.setSkill(se.getSkill());
 				L2Effect ef;
 				for (EffectTemplate et : se.getSkill().getEffectTemplates())
 				{

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

@@ -27,22 +27,16 @@ import com.l2jserver.gameserver.model.stats.Stats;
 
 public class CharStat
 {
-	// =========================================================
-	// Data Field
 	private L2Character _activeChar;
 	private long _exp = 0;
 	private int _sp = 0;
 	private byte _level = 1;
 	
-	// =========================================================
-	// Constructor
 	public CharStat(L2Character activeChar)
 	{
 		_activeChar = activeChar;
 	}
 	
-	// =========================================================
-	// Method - Public
 	/**
 	 * Calculate the new value of the state with modifiers that will be applied
 	 * on the targeted L2Character.<BR>
@@ -93,14 +87,15 @@ public class CharStat
 		
 		// Create and init an Env object to pass parameters to the Calculator
 		Env env = new Env();
-		env.player = _activeChar;
-		env.target = target;
-		env.skill = skill;
-		env.value = init;
+		env.setCharacter(_activeChar);
+		env.setTarget(target);
+		env.setSkill(skill);
+		env.setValue(init);
+		
 		// Launch the calculation
 		c.calc(env);
 		// avoid some troubles with negative stats (some stats should never be negative)
-		if (env.value <= 0)
+		if (env.getValue() <= 0)
 		{
 			switch(stat)
 			{
@@ -120,19 +115,12 @@ public class CharStat
 				case STAT_MEN:
 				case STAT_STR:
 				case STAT_WIT:
-					env.value = 1;
+					env.setValue(1);
 			}
 		}
-		
-		return env.value;
+		return env.getValue();
 	}
 	
-	// =========================================================
-	// Method - Private
-	
-	// =========================================================
-	// Property - Public
-	
 	/**
 	 * @return the Accuracy (base+modifier) of the L2Character in function of the Weapon Expertise Penalty.
 	 */

+ 3 - 11
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/Condition.java

@@ -18,7 +18,6 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class Condition.
- *
  * @author mkizub
  */
 public abstract class Condition implements ConditionListener
@@ -31,7 +30,6 @@ public abstract class Condition implements ConditionListener
 	
 	/**
 	 * Sets the message.
-	 *
 	 * @param msg the new message
 	 */
 	public final void setMessage(String msg)
@@ -41,7 +39,6 @@ public abstract class Condition implements ConditionListener
 	
 	/**
 	 * Gets the message.
-	 *
 	 * @return the message
 	 */
 	public final String getMessage()
@@ -51,7 +48,6 @@ public abstract class Condition implements ConditionListener
 	
 	/**
 	 * Sets the message id.
-	 *
 	 * @param msgId the new message id
 	 */
 	public final void setMessageId(int msgId)
@@ -61,7 +57,6 @@ public abstract class Condition implements ConditionListener
 	
 	/**
 	 * Gets the message id.
-	 *
 	 * @return the message id
 	 */
 	public final int getMessageId()
@@ -79,7 +74,6 @@ public abstract class Condition implements ConditionListener
 	
 	/**
 	 * Checks if is adds the name.
-	 *
 	 * @return true, if is adds the name
 	 */
 	public final boolean isAddName()
@@ -89,7 +83,6 @@ public abstract class Condition implements ConditionListener
 	
 	/**
 	 * Sets the listener.
-	 *
 	 * @param listener the new listener
 	 */
 	void setListener(ConditionListener listener)
@@ -100,7 +93,6 @@ public abstract class Condition implements ConditionListener
 	
 	/**
 	 * Gets the listener.
-	 *
 	 * @return the listener
 	 */
 	final ConditionListener getListener()
@@ -110,14 +102,13 @@ public abstract class Condition implements ConditionListener
 	
 	/**
 	 * Test.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 */
 	public final boolean test(Env env)
 	{
 		boolean res = testImpl(env);
-		if (_listener != null && res != _result)
+		if ((_listener != null) && (res != _result))
 		{
 			_result = res;
 			notifyChanged();
@@ -127,7 +118,6 @@ public abstract class Condition implements ConditionListener
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 */
@@ -137,6 +127,8 @@ public abstract class Condition implements ConditionListener
 	public void notifyChanged()
 	{
 		if (_listener != null)
+		{
 			_listener.notifyChanged();
+		}
 	}
 }

+ 12 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionChangeWeapon.java

@@ -14,13 +14,11 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.items.L2Weapon;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionChangeWeapon.
- *
  * @author nBd
  */
 public class ConditionChangeWeapon extends Condition
@@ -29,7 +27,6 @@ public class ConditionChangeWeapon extends Condition
 	
 	/**
 	 * Instantiates a new condition change weapon.
-	 *
 	 * @param required the required
 	 */
 	public ConditionChangeWeapon(boolean required)
@@ -39,7 +36,6 @@ public class ConditionChangeWeapon extends Condition
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#testImpl(com.l2jserver.gameserver.model.stats.Env)
@@ -47,23 +43,29 @@ public class ConditionChangeWeapon extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
+		{
 			return false;
+		}
 		
 		if (_required)
 		{
-			L2Weapon weaponItem = env.player.getActiveWeaponItem();
-			
+			final L2Weapon weaponItem = env.getPlayer().getActiveWeaponItem();
 			if (weaponItem == null)
+			{
 				return false;
+			}
 			
 			if (weaponItem.getChangeWeaponId() == 0)
+			{
 				return false;
+			}
 			
-			if (((L2PcInstance)env.player).isEnchanting())
+			if (env.getPlayer().isEnchanting())
+			{
 				return false;
+			}
 		}
 		return true;
 	}
-	
-}
+}

+ 8 - 9
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionForceBuff.java

@@ -19,10 +19,8 @@ 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;
@@ -32,7 +30,6 @@ public final class ConditionForceBuff extends Condition
 	
 	/**
 	 * Instantiates a new condition force buff.
-	 *
 	 * @param forces the forces
 	 */
 	public ConditionForceBuff(byte[] forces)
@@ -42,7 +39,6 @@ public final class ConditionForceBuff extends Condition
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#testImpl(com.l2jserver.gameserver.model.stats.Env)
@@ -52,18 +48,21 @@ public final class ConditionForceBuff extends Condition
 	{
 		if (_forces[0] > 0)
 		{
-			L2Effect force = env.player.getFirstEffect(BATTLE_FORCE);
-			if (force == null || force.getForceEffect() < _forces[0])
+			L2Effect force = env.getCharacter().getFirstEffect(BATTLE_FORCE);
+			if ((force == null) || (force.getForceEffect() < _forces[0]))
+			{
 				return false;
+			}
 		}
 		
 		if (_forces[1] > 0)
 		{
-			L2Effect force = env.player.getFirstEffect(SPELL_FORCE);
-			if (force == null || force.getForceEffect() < _forces[1])
+			L2Effect force = env.getCharacter().getFirstEffect(SPELL_FORCE);
+			if ((force == null) || (force.getForceEffect() < _forces[1]))
+			{
 				return false;
+			}
 		}
-		
 		return true;
 	}
 }

+ 0 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionGameChance.java

@@ -19,7 +19,6 @@ import com.l2jserver.util.Rnd;
 
 /**
  * The Class ConditionGameChance.
- *
  * @author Advi
  */
 public class ConditionGameChance extends Condition
@@ -28,7 +27,6 @@ public class ConditionGameChance extends Condition
 	
 	/**
 	 * Instantiates a new condition game chance.
-	 *
 	 * @param chance the chance
 	 */
 	public ConditionGameChance(int chance)
@@ -38,7 +36,6 @@ public class ConditionGameChance extends Condition
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#testImpl(com.l2jserver.gameserver.model.stats.Env)

+ 0 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionGameTime.java

@@ -19,12 +19,10 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionGameTime.
- *
  * @author mkizub
  */
 public class ConditionGameTime extends Condition
 {
-	
 	/**
 	 * The Enum CheckGameTime.
 	 */
@@ -38,7 +36,6 @@ public class ConditionGameTime extends Condition
 	
 	/**
 	 * Instantiates a new condition game time.
-	 *
 	 * @param check the check
 	 * @param required the required
 	 */
@@ -50,7 +47,6 @@ public class ConditionGameTime extends Condition
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#testImpl(com.l2jserver.gameserver.model.stats.Env)

+ 0 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionInventory.java

@@ -18,7 +18,6 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionInventory.
- *
  * @author mkizub
  */
 public abstract class ConditionInventory extends Condition
@@ -28,7 +27,6 @@ public abstract class ConditionInventory extends Condition
 	
 	/**
 	 * Instantiates a new condition inventory.
-	 *
 	 * @param slot the slot
 	 */
 	public ConditionInventory(int slot)
@@ -38,7 +36,6 @@ public abstract class ConditionInventory extends Condition
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#testImpl(com.l2jserver.gameserver.model.stats.Env)

+ 1 - 7
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionItemId.java

@@ -18,17 +18,14 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionItemId.
- *
  * @author mkizub
  */
 public final class ConditionItemId extends Condition
 {
-	
 	private final int _itemId;
 	
 	/**
 	 * Instantiates a new condition item id.
-	 *
 	 * @param itemId the item id
 	 */
 	public ConditionItemId(int itemId)
@@ -38,7 +35,6 @@ public final class ConditionItemId extends Condition
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#testImpl(com.l2jserver.gameserver.model.stats.Env)
@@ -46,8 +42,6 @@ public final class ConditionItemId extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (env.item == null)
-			return false;
-		return env.item.getItemId() == _itemId;
+		return (env.getItem() != null) && (env.getItem().getItemId() == _itemId);
 	}
 }

+ 1 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionListener.java

@@ -15,14 +15,9 @@
 package com.l2jserver.gameserver.model.conditions;
 
 /**
- * The listener interface for receiving condition events.
- * The class that is interested in processing a condition
- * event implements this interface, and the object created
- * with that class is registered with a component using the
- * component's <code>addConditionListener<code> method. When
+ * The listener interface for receiving condition events. The class that is interested in processing a condition event implements this interface, and the object created with that class is registered with a component using the component's <code>addConditionListener<code> method. When
  * the condition event occurs, that object's appropriate
  * method is invoked.
- *
  * @author mkizub
  */
 public interface ConditionListener

+ 10 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionLogicAnd.java

@@ -18,12 +18,10 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionLogicAnd.
- *
  * @author mkizub
  */
 public class ConditionLogicAnd extends Condition
 {
-	
 	private static Condition[] _emptyConditions = new Condition[0];
 	public Condition[] conditions = _emptyConditions;
 	
@@ -37,15 +35,18 @@ public class ConditionLogicAnd extends Condition
 	
 	/**
 	 * Adds the.
-	 *
 	 * @param condition the condition
 	 */
 	public void add(Condition condition)
 	{
 		if (condition == null)
+		{
 			return;
+		}
 		if (getListener() != null)
+		{
 			condition.setListener(this);
+		}
 		final int len = conditions.length;
 		final Condition[] tmp = new Condition[len + 1];
 		System.arraycopy(conditions, 0, tmp, 0, len);
@@ -55,7 +56,6 @@ public class ConditionLogicAnd extends Condition
 	
 	/**
 	 * Sets the listener.
-	 *
 	 * @param listener the new listener
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#setListener(com.l2jserver.gameserver.model.conditions.ConditionListener)
 	 */
@@ -65,19 +65,22 @@ public class ConditionLogicAnd extends Condition
 		if (listener != null)
 		{
 			for (Condition c : conditions)
+			{
 				c.setListener(this);
+			}
 		}
 		else
 		{
 			for (Condition c : conditions)
+			{
 				c.setListener(null);
+			}
 		}
 		super.setListener(listener);
 	}
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#testImpl(com.l2jserver.gameserver.model.stats.Env)
@@ -88,7 +91,9 @@ public class ConditionLogicAnd extends Condition
 		for (Condition c : conditions)
 		{
 			if (!c.test(env))
+			{
 				return false;
+			}
 		}
 		return true;
 	}

+ 7 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionLogicNot.java

@@ -18,29 +18,27 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionLogicNot.
- *
  * @author mkizub
  */
 public class ConditionLogicNot extends Condition
 {
-	
-	private Condition _condition;
+	private final Condition _condition;
 	
 	/**
 	 * Instantiates a new condition logic not.
-	 *
 	 * @param condition the condition
 	 */
 	public ConditionLogicNot(Condition condition)
 	{
 		_condition = condition;
 		if (getListener() != null)
+		{
 			_condition.setListener(this);
+		}
 	}
 	
 	/**
 	 * Sets the listener.
-	 *
 	 * @param listener the new listener
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#setListener(com.l2jserver.gameserver.model.conditions.ConditionListener)
 	 */
@@ -48,15 +46,18 @@ public class ConditionLogicNot extends Condition
 	void setListener(ConditionListener listener)
 	{
 		if (listener != null)
+		{
 			_condition.setListener(this);
+		}
 		else
+		{
 			_condition.setListener(null);
+		}
 		super.setListener(listener);
 	}
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#testImpl(com.l2jserver.gameserver.model.stats.Env)

+ 10 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionLogicOr.java

@@ -18,26 +18,27 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionLogicOr.
- *
  * @author mkizub
  */
 public class ConditionLogicOr extends Condition
 {
-	
 	private static Condition[] _emptyConditions = new Condition[0];
 	public Condition[] conditions = _emptyConditions;
 	
 	/**
 	 * Adds the.
-	 *
 	 * @param condition the condition
 	 */
 	public void add(Condition condition)
 	{
 		if (condition == null)
+		{
 			return;
+		}
 		if (getListener() != null)
+		{
 			condition.setListener(this);
+		}
 		final int len = conditions.length;
 		final Condition[] tmp = new Condition[len + 1];
 		System.arraycopy(conditions, 0, tmp, 0, len);
@@ -47,7 +48,6 @@ public class ConditionLogicOr extends Condition
 	
 	/**
 	 * Sets the listener.
-	 *
 	 * @param listener the new listener
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#setListener(com.l2jserver.gameserver.model.conditions.ConditionListener)
 	 */
@@ -57,19 +57,22 @@ public class ConditionLogicOr extends Condition
 		if (listener != null)
 		{
 			for (Condition c : conditions)
+			{
 				c.setListener(this);
+			}
 		}
 		else
 		{
 			for (Condition c : conditions)
+			{
 				c.setListener(null);
+			}
 		}
 		super.setListener(listener);
 	}
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#testImpl(com.l2jserver.gameserver.model.stats.Env)
@@ -80,9 +83,10 @@ public class ConditionLogicOr extends Condition
 		for (Condition c : conditions)
 		{
 			if (c.test(env))
+			{
 				return true;
+			}
 		}
 		return false;
 	}
-	
 }

+ 2 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionMinDistance.java

@@ -18,8 +18,7 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionMinDistance.
- *
- * @author  Didldak
+ * @author Didldak
  */
 public class ConditionMinDistance extends Condition
 {
@@ -27,7 +26,6 @@ public class ConditionMinDistance extends Condition
 	
 	/**
 	 * Instantiates a new condition min distance.
-	 *
 	 * @param sqDistance the sq distance
 	 */
 	public ConditionMinDistance(int sqDistance)
@@ -38,8 +36,6 @@ public class ConditionMinDistance extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (env.target == null)
-			return false;
-		return env.player.getDistanceSq(env.target) >= _sqDistance;
+		return (env.getTarget() != null) && (env.getCharacter().getDistanceSq(env.getTarget()) >= _sqDistance);
 	}
 }

+ 27 - 14
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPetType.java

@@ -22,41 +22,54 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * @author JIV
- *
  */
 public class ConditionPetType extends Condition
 {
-	private int petType;
+	private final int petType;
 	
 	public ConditionPetType(int petType)
 	{
 		this.petType = petType;
 	}
-
+	
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PetInstance))
+		if (!(env.getCharacter() instanceof L2PetInstance))
+		{
 			return false;
+		}
 		
-		/*if ((petType & L2Item.ANY_PET) == L2Item.ANY_PET)
-			return true;*/
+		/*
+		 * if ((petType & L2Item.ANY_PET) == L2Item.ANY_PET) return true;
+		 */
 		
-		int npcid = ((L2Summon) env.player).getNpcId();
+		int npcid = ((L2Summon) env.getCharacter()).getNpcId();
 		
-		if (PetDataTable.isHatchling(npcid) && (petType & L2Item.HATCHLING) == L2Item.HATCHLING)
+		if (PetDataTable.isHatchling(npcid) && ((petType & L2Item.HATCHLING) == L2Item.HATCHLING))
+		{
 			return true;
-		else if (PetDataTable.isWolf(npcid) && (petType & L2Item.WOLF) == L2Item.WOLF)
+		}
+		else if (PetDataTable.isWolf(npcid) && ((petType & L2Item.WOLF) == L2Item.WOLF))
+		{
 			return true;
-		else if (PetDataTable.isEvolvedWolf(npcid) && (petType & L2Item.GROWN_WOLF) == L2Item.GROWN_WOLF)
+		}
+		else if (PetDataTable.isEvolvedWolf(npcid) && ((petType & L2Item.GROWN_WOLF) == L2Item.GROWN_WOLF))
+		{
 			return true;
-		else if (PetDataTable.isStrider(npcid) && (petType & L2Item.STRIDER) == L2Item.STRIDER)
+		}
+		else if (PetDataTable.isStrider(npcid) && ((petType & L2Item.STRIDER) == L2Item.STRIDER))
+		{
 			return true;
-		else if (PetDataTable.isBaby(npcid) && (petType & L2Item.BABY) == L2Item.BABY)
+		}
+		else if (PetDataTable.isBaby(npcid) && ((petType & L2Item.BABY) == L2Item.BABY))
+		{
 			return true;
-		else if (PetDataTable.isImprovedBaby(npcid) && (petType & L2Item.IMPROVED_BABY) == L2Item.IMPROVED_BABY)
+		}
+		else if (PetDataTable.isImprovedBaby(npcid) && ((petType & L2Item.IMPROVED_BABY) == L2Item.IMPROVED_BABY))
+		{
 			return true;
-		
+		}
 		return false;
 	}
 	

+ 2 - 7
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerActiveEffectId.java

@@ -28,7 +28,6 @@ public class ConditionPlayerActiveEffectId extends Condition
 	
 	/**
 	 * Instantiates a new condition player active effect id.
-	 *
 	 * @param effectId the effect id
 	 */
 	public ConditionPlayerActiveEffectId(int effectId)
@@ -39,7 +38,6 @@ public class ConditionPlayerActiveEffectId extends Condition
 	
 	/**
 	 * Instantiates a new condition player active effect id.
-	 *
 	 * @param effectId the effect id
 	 * @param effectLevel the effect level
 	 */
@@ -52,10 +50,7 @@ public class ConditionPlayerActiveEffectId extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		final L2Effect e = env.player.getFirstEffect(_effectId);
-		if (e != null && (_effectLvl == -1 || _effectLvl <= e.getSkill().getLevel()))
-			return true;
-		
-		return false;
+		final L2Effect e = env.getCharacter().getFirstEffect(_effectId);
+		return ((e != null) && ((_effectLvl == -1) || (_effectLvl <= e.getSkill().getLevel())));
 	}
 }

+ 6 - 7
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerActiveSkillId.java

@@ -19,8 +19,7 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionPlayerActiveSkillId.
- *
- * @author  DrHouse
+ * @author DrHouse
  */
 public class ConditionPlayerActiveSkillId extends Condition
 {
@@ -29,7 +28,6 @@ public class ConditionPlayerActiveSkillId extends Condition
 	
 	/**
 	 * Instantiates a new condition player active skill id.
-	 *
 	 * @param skillId the skill id
 	 */
 	public ConditionPlayerActiveSkillId(int skillId)
@@ -40,7 +38,6 @@ public class ConditionPlayerActiveSkillId extends Condition
 	
 	/**
 	 * Instantiates a new condition player active skill id.
-	 *
 	 * @param skillId the skill id
 	 * @param skillLevel the skill level
 	 */
@@ -53,17 +50,19 @@ public class ConditionPlayerActiveSkillId extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		for (L2Skill sk : env.player.getAllSkills())
+		for (L2Skill sk : env.getCharacter().getAllSkills())
 		{
 			if (sk != null)
 			{
 				if (sk.getId() == _skillId)
 				{
-					if (_skillLevel == -1 || _skillLevel <= sk.getLevel())
+					if ((_skillLevel == -1) || (_skillLevel <= sk.getLevel()))
+					{
 						return true;
+					}
 				}
 			}
 		}
 		return false;
 	}
-}
+}

+ 2 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerAgathionId.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -26,7 +25,6 @@ public class ConditionPlayerAgathionId extends Condition
 	
 	/**
 	 * Instantiates a new condition player agathion id.
-	 *
 	 * @param agathionId the agathion id
 	 */
 	public ConditionPlayerAgathionId(int agathionId)
@@ -37,6 +35,6 @@ public class ConditionPlayerAgathionId extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		return ((L2PcInstance)env.player).getAgathionId() == _agathionId;
+		return (env.getPlayer() != null) && (env.getPlayer().getAgathionId() == _agathionId);
 	}
-}
+}

+ 4 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerBaseStats.java

@@ -20,7 +20,6 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionPlayerBaseStats.
- *
  * @author mkizub
  */
 public class ConditionPlayerBaseStats extends Condition
@@ -31,7 +30,6 @@ public class ConditionPlayerBaseStats extends Condition
 	
 	/**
 	 * Instantiates a new condition player base stats.
-	 *
 	 * @param player the player
 	 * @param stat the stat
 	 * @param value the value
@@ -45,7 +43,6 @@ public class ConditionPlayerBaseStats extends Condition
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#testImpl(com.l2jserver.gameserver.model.stats.Env)
@@ -53,9 +50,11 @@ public class ConditionPlayerBaseStats extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
+		{
 			return false;
-		L2PcInstance player = (L2PcInstance) env.player;
+		}
+		final L2PcInstance player = env.getPlayer();
 		switch (_stat)
 		{
 			case Int:

+ 9 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerCanSweep.java

@@ -24,11 +24,11 @@ import com.l2jserver.gameserver.network.SystemMessageId;
 /**
  * Checks Sweeper conditions:
  * <ul>
- * 	<li>Minimum checks, player not null, skill not null.</li>
- * 	<li>Checks if the target isn't null, is dead and spoiled.</li>
- * 	<li>Checks if the sweeper player is the target spoiler, or is in the spoiler party.</li>
- * 	<li>Checks if the corpse is too old.</li>
- * 	<li>Checks inventory limit and weight max load won't be exceed after sweep.</li>
+ * <li>Minimum checks, player not null, skill not null.</li>
+ * <li>Checks if the target isn't null, is dead and spoiled.</li>
+ * <li>Checks if the sweeper player is the target spoiler, or is in the spoiler party.</li>
+ * <li>Checks if the corpse is too old.</li>
+ * <li>Checks inventory limit and weight max load won't be exceed after sweep.</li>
  * </ul>
  * If two or more conditions aren't meet at the same time, one message per condition will be shown.
  * @author Zoey76
@@ -37,6 +37,7 @@ public class ConditionPlayerCanSweep extends Condition
 {
 	private final boolean _val;
 	private static final int maxSweepTime = 15000;
+	
 	public ConditionPlayerCanSweep(boolean val)
 	{
 		_val = val;
@@ -45,11 +46,11 @@ public class ConditionPlayerCanSweep extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		boolean canSweep = (env.player != null) && (env.player instanceof L2PcInstance);
+		boolean canSweep = env.getPlayer() != null;
 		if (canSweep)
 		{
-			final L2PcInstance sweeper = env.player.getActingPlayer();
-			final L2Skill sweep = env.skill;
+			final L2PcInstance sweeper = env.getPlayer();
+			final L2Skill sweep = env.getSkill();
 			canSweep &= (sweep != null);
 			if (canSweep)
 			{

+ 2 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerCharges.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -27,7 +26,6 @@ public class ConditionPlayerCharges extends Condition
 	
 	/**
 	 * Instantiates a new condition player charges.
-	 *
 	 * @param charges the charges
 	 */
 	public ConditionPlayerCharges(int charges)
@@ -38,6 +36,6 @@ public class ConditionPlayerCharges extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		return ((L2PcInstance)env.player).getCharges() >= _charges;
+		return (env.getPlayer() != null) && (env.getPlayer().getCharges() >= _charges);
 	}
-}
+}

+ 1 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerClassIdRestriction.java

@@ -16,7 +16,6 @@ package com.l2jserver.gameserver.model.conditions;
 
 import java.util.ArrayList;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -28,7 +27,6 @@ public class ConditionPlayerClassIdRestriction extends Condition
 	
 	/**
 	 * Instantiates a new condition player class id restriction.
-	 *
 	 * @param classId the class id
 	 */
 	public ConditionPlayerClassIdRestriction(ArrayList<Integer> classId)
@@ -39,8 +37,6 @@ public class ConditionPlayerClassIdRestriction extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
-			return false;
-		return (_classIds.contains(((L2PcInstance)env.player).getClassId().getId()));
+		return (env.getPlayer() != null) && (_classIds.contains(env.getPlayer().getClassId().getId()));
 	}
 }

+ 2 - 7
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerCloakStatus.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -26,7 +25,6 @@ public class ConditionPlayerCloakStatus extends Condition
 	
 	/**
 	 * Instantiates a new condition player cloak status.
-	 *
 	 * @param val the val
 	 */
 	public ConditionPlayerCloakStatus(int val)
@@ -37,9 +35,6 @@ public class ConditionPlayerCloakStatus extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
-			return false;
-		
-		return ((L2PcInstance)env.player).getInventory().getCloakStatus() >= _val;
+		return (env.getPlayer() != null) && (env.getPlayer().getInventory().getCloakStatus() >= _val);
 	}
-}
+}

+ 2 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerCp.java

@@ -26,7 +26,6 @@ public class ConditionPlayerCp extends Condition
 	
 	/**
 	 * Instantiates a new condition player cp.
-	 *
 	 * @param cp the cp
 	 */
 	public ConditionPlayerCp(int cp)
@@ -37,6 +36,6 @@ public class ConditionPlayerCp extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		return env.player.getCurrentCp()*100/env.player.getMaxCp() >= _cp;
+		return (env.getCharacter() != null) && (((env.getCharacter().getCurrentCp() * 100) / env.getCharacter().getMaxCp()) >= _cp);
 	}
-}
+}

+ 6 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerFlyMounted.java

@@ -14,21 +14,18 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionPlayerFlyMounted.
- *
  * @author kerberos
  */
-public class ConditionPlayerFlyMounted extends Condition {
-	
-	private boolean _val;
+public class ConditionPlayerFlyMounted extends Condition
+{
+	private final boolean _val;
 	
 	/**
 	 * Instantiates a new condition player fly mounted.
-	 *
 	 * @param val the val
 	 */
 	public ConditionPlayerFlyMounted(boolean val)
@@ -37,7 +34,8 @@ public class ConditionPlayerFlyMounted extends Condition {
 	}
 	
 	@Override
-	public boolean testImpl(Env env) {
-		return (env.player instanceof L2PcInstance) ? ((L2PcInstance) env.player).isFlyingMounted() == _val : true;
+	public boolean testImpl(Env env)
+	{
+		return (env.getPlayer() != null) ? env.getPlayer().isFlyingMounted() == _val : true;
 	}
 }

+ 2 - 9
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerGrade.java

@@ -16,7 +16,6 @@ package com.l2jserver.gameserver.model.conditions;
 
 import java.util.logging.Logger;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -26,7 +25,7 @@ import com.l2jserver.gameserver.model.stats.Env;
 public final class ConditionPlayerGrade extends Condition
 {
 	protected static final Logger _log = Logger.getLogger(ConditionPlayerGrade.class.getName());
-	//	conditional values
+	// conditional values
 	public final static int COND_NO_GRADE = 0x0001;
 	public final static int COND_D_GRADE = 0x0002;
 	public final static int COND_C_GRADE = 0x0004;
@@ -53,12 +52,6 @@ public final class ConditionPlayerGrade extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (env.player instanceof L2PcInstance)
-		{
-			final byte expIndex = (byte) ((L2PcInstance) env.player).getExpertiseLevel();
-			
-			return _value == expIndex;
-		}
-		return false;
+		return (env.getPlayer() != null) && (_value == (byte) env.getPlayer().getExpertiseLevel());
 	}
 }

+ 11 - 9
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerHasCastle.java

@@ -15,12 +15,10 @@
 package com.l2jserver.gameserver.model.conditions;
 
 import com.l2jserver.gameserver.model.L2Clan;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionPlayerHasCastle.
- *
  * @author MrPoke
  */
 public final class ConditionPlayerHasCastle extends Condition
@@ -30,7 +28,6 @@ public final class ConditionPlayerHasCastle extends Condition
 	
 	/**
 	 * Instantiates a new condition player has castle.
-	 *
 	 * @param castle the castle
 	 */
 	public ConditionPlayerHasCastle(int castle)
@@ -40,7 +37,6 @@ public final class ConditionPlayerHasCastle extends Condition
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#testImpl(com.l2jserver.gameserver.model.stats.Env)
@@ -48,16 +44,22 @@ public final class ConditionPlayerHasCastle extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
+		{
 			return false;
+		}
 		
-		L2Clan clan = ((L2PcInstance)env.player).getClan();
+		final L2Clan clan = env.getPlayer().getClan();
 		if (clan == null)
+		{
 			return _castle == 0;
+		}
 		
 		// Any castle
-		if (_castle == -1) return clan.getHasCastle() > 0;
-		
+		if (_castle == -1)
+		{
+			return clan.getHasCastle() > 0;
+		}
 		return clan.getHasCastle() == _castle;
 	}
-}
+}

+ 12 - 11
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerHasClanHall.java

@@ -17,12 +17,10 @@ package com.l2jserver.gameserver.model.conditions;
 import java.util.ArrayList;
 
 import com.l2jserver.gameserver.model.L2Clan;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionPlayerHasClanHall.
- *
  * @author MrPoke
  */
 public final class ConditionPlayerHasClanHall extends Condition
@@ -31,7 +29,6 @@ public final class ConditionPlayerHasClanHall extends Condition
 	
 	/**
 	 * Instantiates a new condition player has clan hall.
-	 *
 	 * @param clanHall the clan hall
 	 */
 	public ConditionPlayerHasClanHall(ArrayList<Integer> clanHall)
@@ -41,7 +38,6 @@ public final class ConditionPlayerHasClanHall extends Condition
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#testImpl(com.l2jserver.gameserver.model.stats.Env)
@@ -49,17 +45,22 @@ public final class ConditionPlayerHasClanHall extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
+		{
 			return false;
+		}
 		
-		L2Clan clan = ((L2PcInstance)env.player).getClan();
+		final L2Clan clan = env.getPlayer().getClan();
 		if (clan == null)
-			return (_clanHall.size() == 1 && _clanHall.get(0) == 0);
+		{
+			return ((_clanHall.size() == 1) && (_clanHall.get(0) == 0));
+		}
 		
 		// All Clan Hall
-		if (_clanHall.size() == 1 && _clanHall.get(0) == -1)
+		if ((_clanHall.size() == 1) && (_clanHall.get(0) == -1))
+		{
 			return clan.getHasHideout() > 0;
-			
-			return _clanHall.contains(clan.getHasHideout());
+		}
+		return _clanHall.contains(clan.getHasHideout());
 	}
-}
+}

+ 10 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerHasFort.java

@@ -15,22 +15,18 @@
 package com.l2jserver.gameserver.model.conditions;
 
 import com.l2jserver.gameserver.model.L2Clan;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionPlayerHasFort.
- *
  * @author MrPoke
  */
 public final class ConditionPlayerHasFort extends Condition
 {
-	
 	private final int _fort;
 	
 	/**
 	 * Instantiates a new condition player has fort.
-	 *
 	 * @param fort the fort
 	 */
 	public ConditionPlayerHasFort(int fort)
@@ -40,7 +36,6 @@ public final class ConditionPlayerHasFort extends Condition
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#testImpl(com.l2jserver.gameserver.model.stats.Env)
@@ -48,17 +43,22 @@ public final class ConditionPlayerHasFort extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
+		{
 			return false;
+		}
 		
-		L2Clan clan = ((L2PcInstance)env.player).getClan();
+		final L2Clan clan = env.getPlayer().getClan();
 		if (clan == null)
+		{
 			return _fort == 0;
+		}
 		
 		// Any fortress
 		if (_fort == -1)
+		{
 			return clan.getHasFort() > 0;
-			
-			return clan.getHasFort() == _fort;
+		}
+		return clan.getHasFort() == _fort;
 	}
-}
+}

+ 13 - 13
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerHasPet.java

@@ -16,7 +16,6 @@ package com.l2jserver.gameserver.model.conditions;
 
 import java.util.ArrayList;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
 import com.l2jserver.gameserver.model.stats.Env;
@@ -30,33 +29,34 @@ public class ConditionPlayerHasPet extends Condition
 	
 	/**
 	 * Instantiates a new condition player has pet.
-	 *
 	 * @param itemIds the item ids
 	 */
 	public ConditionPlayerHasPet(ArrayList<Integer> itemIds)
 	{
-		if (itemIds.size() == 1 && itemIds.get(0) == 0)
+		if ((itemIds.size() == 1) && (itemIds.get(0) == 0))
+		{
 			_controlItemIds = null;
+		}
 		else
+		{
 			_controlItemIds = itemIds;
+		}
 	}
 	
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
-			return false;
-		
-		if (!(env.player.getPet() instanceof L2PetInstance))
+		if ((env.getPlayer() == null) || (!(env.getPlayer().getPet() instanceof L2PetInstance)))
+		{
 			return false;
+		}
 		
 		if (_controlItemIds == null)
+		{
 			return true;
+		}
 		
-		final L2ItemInstance controlItem = ((L2PetInstance)env.player.getPet()).getControlItem();
-		if (controlItem == null)
-			return false;
-		
-		return _controlItemIds.contains(controlItem.getItemId());
+		final L2ItemInstance controlItem = ((L2PetInstance) env.getPlayer().getPet()).getControlItem();
+		return controlItem == null ? false : _controlItemIds.contains(controlItem.getItemId());
 	}
-}
+}

+ 1 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerHp.java

@@ -18,7 +18,6 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionPlayerHp.
- *
  * @author mr
  */
 public class ConditionPlayerHp extends Condition
@@ -27,7 +26,6 @@ public class ConditionPlayerHp extends Condition
 	
 	/**
 	 * Instantiates a new condition player hp.
-	 *
 	 * @param hp the hp
 	 */
 	public ConditionPlayerHp(int hp)
@@ -38,6 +36,6 @@ public class ConditionPlayerHp extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		return env.player.getCurrentHp() * 100 / env.player.getMaxVisibleHp() <= _hp;
+		return (env.getCharacter() != null) && (((env.getCharacter().getCurrentHp() * 100) / env.getCharacter().getMaxVisibleHp()) <= _hp);
 	}
 }

+ 7 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerInsideZoneId.java

@@ -17,13 +17,11 @@ package com.l2jserver.gameserver.model.conditions;
 import java.util.ArrayList;
 
 import com.l2jserver.gameserver.instancemanager.ZoneManager;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.zone.L2ZoneType;
 
 /**
  * @author UnAfraid
- *
  */
 public class ConditionPlayerInsideZoneId extends Condition
 {
@@ -37,14 +35,18 @@ public class ConditionPlayerInsideZoneId extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
+		{
 			return false;
+		}
 		
-		for (L2ZoneType zone : ZoneManager.getInstance().getZones(env.player))
+		for (L2ZoneType zone : ZoneManager.getInstance().getZones(env.getCharacter()))
 		{
 			if (_zones.contains(zone.getId()))
+			{
 				return true;
+			}
 		}
 		return false;
 	}
-}
+}

+ 11 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerInstanceId.java

@@ -18,7 +18,6 @@ import java.util.ArrayList;
 
 import com.l2jserver.gameserver.instancemanager.InstanceManager;
 import com.l2jserver.gameserver.instancemanager.InstanceManager.InstanceWorld;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -30,7 +29,6 @@ public class ConditionPlayerInstanceId extends Condition
 	
 	/**
 	 * Instantiates a new condition player instance id.
-	 *
 	 * @param instanceIds the instance ids
 	 */
 	public ConditionPlayerInstanceId(ArrayList<Integer> instanceIds)
@@ -41,17 +39,22 @@ public class ConditionPlayerInstanceId extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
+		{
 			return false;
+		}
 		
-		final int instanceId = env.player.getInstanceId();
+		final int instanceId = env.getCharacter().getInstanceId();
 		if (instanceId <= 0)
+		{
 			return false; // player not in instance
+		}
 		
-		final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld((L2PcInstance)env.player);
-		if (world == null || world.instanceId != instanceId)
+		final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(env.getPlayer());
+		if ((world == null) || (world.instanceId != instanceId))
+		{
 			return false; // player in the different instance
-		
+		}
 		return _instanceIds.contains(world.templateId);
 	}
-}
+}

+ 6 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerInvSize.java

@@ -14,23 +14,19 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
-
-
 /**
  * The Class ConditionPlayerInvSize.
- *
  * @author Kerberos
  */
-public class ConditionPlayerInvSize extends Condition {
+public class ConditionPlayerInvSize extends Condition
+{
 	
 	private final int _size;
 	
 	/**
 	 * Instantiates a new condition player inv size.
-	 *
 	 * @param size the size
 	 */
 	public ConditionPlayerInvSize(int size)
@@ -41,8 +37,10 @@ public class ConditionPlayerInvSize extends Condition {
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (env.player instanceof L2PcInstance)
-			return ((L2PcInstance)env.player).getInventory().getSize(false) <= (((L2PcInstance) env.player).getInventoryLimit()-_size);
+		if (env.getPlayer() != null)
+		{
+			return env.getPlayer().getInventory().getSize(false) <= (env.getPlayer().getInventoryLimit() - _size);
+		}
 		return true;
 	}
 }

+ 4 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerIsClanLeader.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -26,7 +25,6 @@ public class ConditionPlayerIsClanLeader extends Condition
 	
 	/**
 	 * Instantiates a new condition player is clan leader.
-	 *
 	 * @param val the val
 	 */
 	public ConditionPlayerIsClanLeader(boolean val)
@@ -37,8 +35,10 @@ public class ConditionPlayerIsClanLeader extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
+		{
 			return false;
-		return (((L2PcInstance)env.player).isClanLeader() == _val);
+		}
+		return (env.getPlayer().isClanLeader() == _val);
 	}
 }

+ 5 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerIsHero.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -26,7 +25,6 @@ public class ConditionPlayerIsHero extends Condition
 	
 	/**
 	 * Instantiates a new condition player is hero.
-	 *
 	 * @param val the val
 	 */
 	public ConditionPlayerIsHero(boolean val)
@@ -37,8 +35,10 @@ public class ConditionPlayerIsHero extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
+		{
 			return false;
-		return (((L2PcInstance)env.player).isHero() == _val);
+		}
+		return (env.getPlayer().isHero() == _val);
 	}
-}
+}

+ 6 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerLandingZone.java

@@ -19,16 +19,15 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionPlayerLandingZone.
- *
  * @author kerberos
  */
-public class ConditionPlayerLandingZone extends Condition {
+public class ConditionPlayerLandingZone extends Condition
+{
 	
-	private boolean _val;
+	private final boolean _val;
 	
 	/**
 	 * Instantiates a new condition player landing zone.
-	 *
 	 * @param val the val
 	 */
 	public ConditionPlayerLandingZone(boolean val)
@@ -37,7 +36,8 @@ public class ConditionPlayerLandingZone extends Condition {
 	}
 	
 	@Override
-	public boolean testImpl(Env env) {
-		return env.player.isInsideZone(L2Character.ZONE_LANDING) == _val;
+	public boolean testImpl(Env env)
+	{
+		return env.getCharacter().isInsideZone(L2Character.ZONE_LANDING) == _val;
 	}
 }

+ 1 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerLevel.java

@@ -18,7 +18,6 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionPlayerLevel.
- *
  * @author mkizub
  */
 public class ConditionPlayerLevel extends Condition
@@ -27,7 +26,6 @@ public class ConditionPlayerLevel extends Condition
 	
 	/**
 	 * Instantiates a new condition player level.
-	 *
 	 * @param level the level
 	 */
 	public ConditionPlayerLevel(int level)
@@ -38,6 +36,6 @@ public class ConditionPlayerLevel extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		return env.player.getLevel() >= _level;
+		return env.getCharacter().getLevel() >= _level;
 	}
 }

+ 3 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerLevelRange.java

@@ -35,6 +35,7 @@ public class ConditionPlayerLevelRange extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		return ((env.player.getLevel() >= _levels[0]) && (env.player.getLevel() <= _levels[1]));
+		final int level = env.getCharacter().getLevel();
+		return ((level >= _levels[0]) && (level <= _levels[1]));
 	}
-}
+}

+ 5 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerMp.java

@@ -19,13 +19,13 @@ import com.l2jserver.gameserver.model.stats.Env;
 /**
  * The Class ConditionPlayerMp.
  */
-public class ConditionPlayerMp extends Condition {
+public class ConditionPlayerMp extends Condition
+{
 	
 	private final int _mp;
 	
 	/**
 	 * Instantiates a new condition player mp.
-	 *
 	 * @param mp the mp
 	 */
 	public ConditionPlayerMp(int mp)
@@ -34,7 +34,8 @@ public class ConditionPlayerMp extends Condition {
 	}
 	
 	@Override
-	public boolean testImpl(Env env) {
-		return env.player.getCurrentMp()*100/env.player.getMaxMp() <= _mp;
+	public boolean testImpl(Env env)
+	{
+		return ((env.getCharacter().getCurrentMp() * 100) / env.getCharacter().getMaxMp()) <= _mp;
 	}
 }

+ 5 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerPkCount.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -26,7 +25,6 @@ public class ConditionPlayerPkCount extends Condition
 	
 	/**
 	 * Instantiates a new condition player pk count.
-	 *
 	 * @param pk the pk
 	 */
 	public ConditionPlayerPkCount(int pk)
@@ -37,9 +35,10 @@ public class ConditionPlayerPkCount extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
+		{
 			return false;
-		
-		return ((L2PcInstance)env.player).getPkKills() <= _pk;
+		}
+		return env.getPlayer().getPkKills() <= _pk;
 	}
-}
+}

+ 5 - 14
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerPledgeClass.java

@@ -14,12 +14,10 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionPlayerPledgeClass.
- *
  * @author MrPoke
  */
 public final class ConditionPlayerPledgeClass extends Condition
@@ -29,7 +27,6 @@ public final class ConditionPlayerPledgeClass extends Condition
 	
 	/**
 	 * Instantiates a new condition player pledge class.
-	 *
 	 * @param pledgeClass the pledge class
 	 */
 	public ConditionPlayerPledgeClass(int pledgeClass)
@@ -39,7 +36,6 @@ public final class ConditionPlayerPledgeClass extends Condition
 	
 	/**
 	 * Test impl.
-	 *
 	 * @param env the env
 	 * @return true, if successful
 	 * @see com.l2jserver.gameserver.model.conditions.Condition#testImpl(com.l2jserver.gameserver.model.stats.Env)
@@ -47,15 +43,10 @@ public final class ConditionPlayerPledgeClass extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if ((env.getPlayer() == null) || (env.getPlayer().getClan() == null))
+		{
 			return false;
-		
-		if (((L2PcInstance)env.player).getClan() == null)
-			return false;
-		
-		if (_pledgeClass == -1)
-			return ((L2PcInstance)env.player).isClanLeader();
-		
-		return (((L2PcInstance)env.player).getPledgeClass() >= _pledgeClass);
+		}
+		return (_pledgeClass == -1) ? env.getPlayer().isClanLeader() : (env.getPlayer().getPledgeClass() >= _pledgeClass);
 	}
-}
+}

+ 4 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerRace.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.base.Race;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.util.Util;
@@ -39,8 +38,10 @@ public class ConditionPlayerRace extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
+		{
 			return false;
-		return Util.contains(_races, env.player.getActingPlayer().getRace());
+		}
+		return Util.contains(_races, env.getPlayer().getRace());
 	}
 }

+ 8 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerRangeFromNpc.java

@@ -20,12 +20,12 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * @author UnAfraid
- *
  */
 public class ConditionPlayerRangeFromNpc extends Condition
 {
 	private final int _npcId;
 	private final int _radius;
+	
 	public ConditionPlayerRangeFromNpc(int npcId, int radius)
 	{
 		_npcId = npcId;
@@ -35,18 +35,21 @@ public class ConditionPlayerRangeFromNpc extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (_npcId == 0 || _radius == 0)
+		if ((_npcId == 0) || (_radius == 0))
+		{
 			return false;
+		}
 		
-		for (L2Character target : env.player.getKnownList().getKnownCharactersInRadius(_radius))
+		for (L2Character target : env.getCharacter().getKnownList().getKnownCharactersInRadius(_radius))
 		{
 			if (target instanceof L2Npc)
 			{
 				if (((L2Npc) target).getNpcId() == _npcId)
+				{
 					return true;
+				}
 			}
 		}
-		
 		return false;
 	}
-}
+}

+ 10 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerServitorNpcId.java

@@ -16,7 +16,6 @@ package com.l2jserver.gameserver.model.conditions;
 
 import java.util.ArrayList;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -28,26 +27,27 @@ public class ConditionPlayerServitorNpcId extends Condition
 	
 	/**
 	 * Instantiates a new condition player servitor npc id.
-	 *
 	 * @param npcIds the npc ids
 	 */
 	public ConditionPlayerServitorNpcId(ArrayList<Integer> npcIds)
 	{
-		if (npcIds.size() == 1 && npcIds.get(0) == 0)
+		if ((npcIds.size() == 1) && (npcIds.get(0) == 0))
+		{
 			_npcIds = null;
+		}
 		else
+		{
 			_npcIds = npcIds;
+		}
 	}
 	
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if ((env.getPlayer() == null) || (env.getCharacter().getPet() == null))
+		{
 			return false;
-		
-		if ((env.player.getPet() == null))
-			return false;
-		
-		return _npcIds == null || _npcIds.contains(env.player.getPet().getNpcId());
+		}
+		return (_npcIds == null) || _npcIds.contains(env.getPlayer().getPet().getNpcId());
 	}
-}
+}

+ 6 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerSex.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -22,12 +21,11 @@ import com.l2jserver.gameserver.model.stats.Env;
  */
 public class ConditionPlayerSex extends Condition
 {
-	//male 0 fmale 1
+	// male 0 female 1
 	private final int _sex;
 	
 	/**
 	 * Instantiates a new condition player sex.
-	 *
 	 * @param sex the sex
 	 */
 	public ConditionPlayerSex(int sex)
@@ -38,6 +36,10 @@ public class ConditionPlayerSex extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		return (((L2PcInstance)env.player).getAppearance().getSex()? 1:0) == _sex;
+		if (env.getPlayer() == null)
+		{
+			return false;
+		}
+		return (env.getPlayer().getAppearance().getSex() ? 1 : 0) == _sex;
 	}
 }

+ 5 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerSiegeSide.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -22,12 +21,10 @@ import com.l2jserver.gameserver.model.stats.Env;
  */
 public class ConditionPlayerSiegeSide extends Condition
 {
-	
 	private final int _siegeSide;
 	
 	/**
 	 * Instantiates a new condition player siege side.
-	 *
 	 * @param side the side
 	 */
 	public ConditionPlayerSiegeSide(int side)
@@ -38,6 +35,10 @@ public class ConditionPlayerSiegeSide extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		return ((L2PcInstance)env.player).getSiegeSide() == _siegeSide;
+		if (env.getPlayer() == null)
+		{
+			return false;
+		}
+		return env.getPlayer().getSiegeSide() == _siegeSide;
 	}
 }

+ 6 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerSouls.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -27,7 +26,6 @@ public class ConditionPlayerSouls extends Condition
 	
 	/**
 	 * Instantiates a new condition player souls.
-	 *
 	 * @param souls the souls
 	 */
 	public ConditionPlayerSouls(int souls)
@@ -38,6 +36,10 @@ public class ConditionPlayerSouls extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		return ((L2PcInstance)env.player).getSouls() >= _souls;
+		if (env.getPlayer() == null)
+		{
+			return false;
+		}
+		return env.getPlayer().getSouls() >= _souls;
 	}
-}
+}

+ 2 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerState.java

@@ -45,12 +45,11 @@ public class ConditionPlayerState extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		final L2Character character = env.player;
-		L2PcInstance player = null;
+		final L2Character character = env.getCharacter();
+		final L2PcInstance player = env.getPlayer();
 		switch (_check)
 		{
 			case RESTING:
-				player = character.getActingPlayer();
 				if (player != null)
 				{
 					return (player.isSitting() == _required);
@@ -61,7 +60,6 @@ public class ConditionPlayerState extends Condition
 			case RUNNING:
 				return character.isRunning() == _required;
 			case STANDING:
-				player = character.getActingPlayer();
 				if (player != null)
 				{
 					return (_required != (player.isSitting() || player.isMoving()));
@@ -74,14 +72,12 @@ public class ConditionPlayerState extends Condition
 			case FRONT:
 				return (character.isInFrontOfTarget() == _required);
 			case CHAOTIC:
-				player = character.getActingPlayer();
 				if (player != null)
 				{
 					return ((player.getKarma() > 0) == _required);
 				}
 				return !_required;
 			case OLYMPIAD:
-				player = character.getActingPlayer();
 				if (player != null)
 				{
 					return (player.isInOlympiadMode() == _required);

+ 8 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerSubclass.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -26,7 +25,6 @@ public class ConditionPlayerSubclass extends Condition
 	
 	/**
 	 * Instantiates a new condition player subclass.
-	 *
 	 * @param val the val
 	 */
 	public ConditionPlayerSubclass(boolean val)
@@ -35,7 +33,12 @@ public class ConditionPlayerSubclass extends Condition
 	}
 	
 	@Override
-	public boolean testImpl(Env env) {
-		return (env.player instanceof L2PcInstance) ? ((L2PcInstance) env.player).isSubClassActive() == _val : true;
+	public boolean testImpl(Env env)
+	{
+		if (env.getPlayer() == null)
+		{
+			return true;
+		}
+		return env.getPlayer().isSubClassActive() == _val;
 	}
-}
+}

+ 4 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerTransformationId.java

@@ -18,8 +18,8 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
- * This condition becomes true whether the player is transformed
- * and the transformation Id match the parameter or the parameter is -1
+ * This condition becomes true whether the player is transformed<br>
+ * and the transformation Id match the parameter or the parameter is -1<br>
  * which returns true if player is transformed regardless the transformation Id.
  * @author Zoey76
  */
@@ -39,11 +39,11 @@ public class ConditionPlayerTransformationId extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
 		{
 			return false;
 		}
-		final L2PcInstance player = env.player.getActingPlayer();
+		final L2PcInstance player = env.getPlayer();
 		if (_id == -1)
 		{
 			return player.isTransformed();

+ 4 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerTvTEvent.java

@@ -27,7 +27,6 @@ public class ConditionPlayerTvTEvent extends Condition
 	
 	/**
 	 * Instantiates a new condition player tv t event.
-	 *
 	 * @param val the val
 	 */
 	public ConditionPlayerTvTEvent(boolean val)
@@ -38,10 +37,11 @@ public class ConditionPlayerTvTEvent extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		final L2PcInstance player = env.player.getActingPlayer();
-		if (player == null || !TvTEvent.isStarted())
+		final L2PcInstance player = env.getPlayer();
+		if ((player == null) || !TvTEvent.isStarted())
+		{
 			return !_val;
-		
+		}
 		return (TvTEvent.isPlayerParticipant(player.getObjectId()) == _val);
 	}
 }

+ 6 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerVehicleMounted.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
@@ -22,7 +21,7 @@ import com.l2jserver.gameserver.model.stats.Env;
  */
 public class ConditionPlayerVehicleMounted extends Condition
 {
-	private boolean _val;
+	private final boolean _val;
 	
 	/**
 	 * @param val the val
@@ -35,6 +34,10 @@ public class ConditionPlayerVehicleMounted extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		return (env.player instanceof L2PcInstance) ? ((L2PcInstance) env.player).isInVehicle() == _val : true;
+		if (env.getPlayer() == null)
+		{
+			return true;
+		}
+		return (env.getPlayer().isInVehicle() == _val);
 	}
 }

+ 7 - 12
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerWeight.java

@@ -18,20 +18,17 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Stats;
 
-
-
 /**
  * The Class ConditionPlayerWeight.
- *
  * @author Kerberos
  */
-public class ConditionPlayerWeight extends Condition {
+public class ConditionPlayerWeight extends Condition
+{
 	
 	private final int _weight;
 	
 	/**
 	 * Instantiates a new condition player weight.
-	 *
 	 * @param weight the weight
 	 */
 	public ConditionPlayerWeight(int weight)
@@ -42,14 +39,12 @@ public class ConditionPlayerWeight extends Condition {
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (env.player instanceof L2PcInstance)
+		final L2PcInstance player = env.getPlayer();
+		if ((player != null) && (player.getMaxLoad() > 0))
 		{
-			if (((L2PcInstance) env.player).getMaxLoad() > 0)
-			{
-				int weightproc = ((L2PcInstance) env.player).getCurrentLoad() * 100 / ((L2PcInstance) env.player).getMaxLoad();
-				weightproc*=(int)((L2PcInstance) env.player).calcStat(Stats.WEIGHT_LIMIT, 1, env.player, null);
-				return weightproc < _weight || ((L2PcInstance) env.player).getDietMode();
-			}
+			int weightproc = (player.getCurrentLoad() * 100) / player.getMaxLoad();
+			weightproc *= (int) player.calcStat(Stats.WEIGHT_LIMIT, 1, player, null);
+			return (weightproc < _weight) || player.getDietMode();
 		}
 		return true;
 	}

+ 47 - 29
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionSiegeZone.java

@@ -25,13 +25,11 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionSiegeZone.
- *
  * @author Gigiikun
  */
-
 public final class ConditionSiegeZone extends Condition
 {
-	//	conditional values
+	// conditional values
 	public final static int COND_NOT_ZONE = 0x0001;
 	public final static int COND_CAST_ATTACK = 0x0002;
 	public final static int COND_CAST_DEFEND = 0x0004;
@@ -47,11 +45,9 @@ public final class ConditionSiegeZone extends Condition
 	
 	/**
 	 * Instantiates a new condition siege zone.
-	 *
 	 * @param value the value
 	 * @param self the self
 	 */
-	
 	public ConditionSiegeZone(int value, boolean self)
 	{
 		_value = value;
@@ -61,28 +57,31 @@ public final class ConditionSiegeZone extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		L2Character target = _self ? env.player : env.target;
+		L2Character target = _self ? env.getCharacter() : env.getTarget();
 		Castle castle = CastleManager.getInstance().getCastle(target);
 		Fort fort = FortManager.getInstance().getFort(target);
 		
-		if ((_value & COND_TW_PROGRESS) != 0 && !TerritoryWarManager.getInstance().isTWInProgress())
+		if (((_value & COND_TW_PROGRESS) != 0) && !TerritoryWarManager.getInstance().isTWInProgress())
+		{
 			return false;
-		else if ((_value & COND_TW_CHANNEL) != 0 && !TerritoryWarManager.getInstance().isTWChannelOpen())
+		}
+		else if (((_value & COND_TW_CHANNEL) != 0) && !TerritoryWarManager.getInstance().isTWChannelOpen())
+		{
 			return false;
+		}
 		else if ((castle == null) && (fort == null))
 		{
-			if ((_value & COND_NOT_ZONE) != 0)
-				return true;
-			return false;
+			return (_value & COND_NOT_ZONE) != 0;
 		}
 		if (castle != null)
+		{
 			return checkIfOk(target, castle, _value);
+		}
 		return checkIfOk(target, fort, _value);
 	}
 	
 	/**
 	 * Check if ok.
-	 *
 	 * @param activeChar the active char
 	 * @param castle the castle
 	 * @param value the value
@@ -90,36 +89,45 @@ public final class ConditionSiegeZone extends Condition
 	 */
 	public static boolean checkIfOk(L2Character activeChar, Castle castle, int value)
 	{
-		if (activeChar == null || !(activeChar instanceof L2PcInstance))
+		if ((activeChar == null) || !(activeChar instanceof L2PcInstance))
+		{
 			return false;
+		}
 		
-		L2PcInstance player = (L2PcInstance)activeChar;
+		L2PcInstance player = (L2PcInstance) activeChar;
 		
-		if ((castle == null || castle.getCastleId() <= 0))
+		if (((castle == null) || (castle.getCastleId() <= 0)))
 		{
 			if ((value & COND_NOT_ZONE) != 0)
+			{
 				return true;
+			}
 		}
 		else if (!castle.getZone().isActive())
 		{
 			if ((value & COND_NOT_ZONE) != 0)
+			{
 				return true;
+			}
 		}
-		else if ((value & COND_CAST_ATTACK) != 0 && player.isRegisteredOnThisSiegeField(castle.getCastleId())
-				&& player.getSiegeState() == 1)
+		else if (((value & COND_CAST_ATTACK) != 0) && player.isRegisteredOnThisSiegeField(castle.getCastleId()) && (player.getSiegeState() == 1))
+		{
 			return true;
-		else if ((value & COND_CAST_DEFEND) != 0 && player.isRegisteredOnThisSiegeField(castle.getCastleId())
-				&& player.getSiegeState() == 2)
+		}
+		else if (((value & COND_CAST_DEFEND) != 0) && player.isRegisteredOnThisSiegeField(castle.getCastleId()) && (player.getSiegeState() == 2))
+		{
 			return true;
-		else if ((value & COND_CAST_NEUTRAL) != 0 && player.getSiegeState() == 0)
+		}
+		else if (((value & COND_CAST_NEUTRAL) != 0) && (player.getSiegeState() == 0))
+		{
 			return true;
+		}
 		
 		return false;
 	}
 	
 	/**
 	 * Check if ok.
-	 *
 	 * @param activeChar the active char
 	 * @param fort the fort
 	 * @param value the value
@@ -127,29 +135,39 @@ public final class ConditionSiegeZone extends Condition
 	 */
 	public static boolean checkIfOk(L2Character activeChar, Fort fort, int value)
 	{
-		if (activeChar == null || !(activeChar instanceof L2PcInstance))
+		if ((activeChar == null) || !(activeChar instanceof L2PcInstance))
+		{
 			return false;
+		}
 		
-		L2PcInstance player = (L2PcInstance)activeChar;
+		L2PcInstance player = (L2PcInstance) activeChar;
 		
-		if ((fort == null || fort.getFortId() <= 0))
+		if (((fort == null) || (fort.getFortId() <= 0)))
 		{
 			if ((value & COND_NOT_ZONE) != 0)
+			{
 				return true;
+			}
 		}
 		else if (!fort.getZone().isActive())
 		{
 			if ((value & COND_NOT_ZONE) != 0)
+			{
 				return true;
+			}
 		}
-		else if ((value & COND_FORT_ATTACK) != 0 && player.isRegisteredOnThisSiegeField(fort.getFortId())
-				&& player.getSiegeState() == 1)
+		else if (((value & COND_FORT_ATTACK) != 0) && player.isRegisteredOnThisSiegeField(fort.getFortId()) && (player.getSiegeState() == 1))
+		{
 			return true;
-		else if ((value & COND_FORT_DEFEND) != 0 && player.isRegisteredOnThisSiegeField(fort.getFortId())
-				&& player.getSiegeState() == 2)
+		}
+		else if (((value & COND_FORT_DEFEND) != 0) && player.isRegisteredOnThisSiegeField(fort.getFortId()) && (player.getSiegeState() == 2))
+		{
 			return true;
-		else if ((value & COND_FORT_NEUTRAL) != 0 && player.getSiegeState() == 0)
+		}
+		else if (((value & COND_FORT_NEUTRAL) != 0) && (player.getSiegeState() == 0))
+		{
 			return true;
+		}
 		
 		return false;
 	}

+ 1 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionSkillStats.java

@@ -19,17 +19,14 @@ import com.l2jserver.gameserver.model.stats.Stats;
 
 /**
  * The Class ConditionSkillStats.
- *
  * @author mkizub
  */
 public class ConditionSkillStats extends Condition
 {
-	
 	private final Stats _stat;
 	
 	/**
 	 * Instantiates a new condition skill stats.
-	 *
 	 * @param stat the stat
 	 */
 	public ConditionSkillStats(Stats stat)
@@ -41,8 +38,6 @@ public class ConditionSkillStats extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (env.skill == null)
-			return false;
-		return env.skill.getStat() == _stat;
+		return (env.getSkill() != null) && (env.getSkill().getStat() == _stat);
 	}
 }

+ 8 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionSlotItemId.java

@@ -14,25 +14,21 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.itemcontainer.Inventory;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionSlotItemId.
- *
  * @author mkizub
  */
 public final class ConditionSlotItemId extends ConditionInventory
 {
-	
 	private final int _itemId;
 	private final int _enchantLevel;
 	
 	/**
 	 * Instantiates a new condition slot item id.
-	 *
 	 * @param slot the slot
 	 * @param itemId the item id
 	 * @param enchantLevel the enchant level
@@ -47,12 +43,16 @@ public final class ConditionSlotItemId extends ConditionInventory
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
+		{
 			return false;
-		Inventory inv = ((L2PcInstance) env.player).getInventory();
-		L2ItemInstance item = inv.getPaperdollItem(_slot);
+		}
+		final Inventory inv = env.getPlayer().getInventory();
+		final L2ItemInstance item = inv.getPaperdollItem(_slot);
 		if (item == null)
+		{
 			return _itemId == 0;
-		return item.getItemId() == _itemId && item.getEnchantLevel() >= _enchantLevel;
+		}
+		return (item.getItemId() == _itemId) && (item.getEnchantLevel() >= _enchantLevel);
 	}
 }

+ 7 - 7
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionSlotItemType.java

@@ -14,24 +14,20 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.itemcontainer.Inventory;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionSlotItemType.
- *
  * @author mkizub
  */
 public final class ConditionSlotItemType extends ConditionInventory
 {
-	
 	private final int _mask;
 	
 	/**
 	 * Instantiates a new condition slot item type.
-	 *
 	 * @param slot the slot
 	 * @param mask the mask
 	 */
@@ -44,12 +40,16 @@ public final class ConditionSlotItemType extends ConditionInventory
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
+		{
 			return false;
-		Inventory inv = ((L2PcInstance) env.player).getInventory();
-		L2ItemInstance item = inv.getPaperdollItem(_slot);
+		}
+		final Inventory inv = env.getPlayer().getInventory();
+		final L2ItemInstance item = inv.getPaperdollItem(_slot);
 		if (item == null)
+		{
 			return false;
+		}
 		return (item.getItem().getItemMask() & _mask) != 0;
 	}
 }

+ 2 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetAbnormal.java

@@ -18,8 +18,7 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionTargetAbnormal.
- *
- * @author  janiii
+ * @author janiii
  */
 public class ConditionTargetAbnormal extends Condition
 {
@@ -27,7 +26,6 @@ public class ConditionTargetAbnormal extends Condition
 	
 	/**
 	 * Instantiates a new condition target abnormal.
-	 *
 	 * @param abnormalId the abnormal id
 	 */
 	public ConditionTargetAbnormal(int abnormalId)
@@ -38,7 +36,6 @@ public class ConditionTargetAbnormal extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		return (env.target.getAbnormalEffect() & _abnormalId) != 0;
+		return (env.getTarget().getAbnormalEffect() & _abnormalId) != 0;
 	}
-	
 }

+ 4 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetActiveEffectId.java

@@ -22,13 +22,11 @@ import com.l2jserver.gameserver.model.stats.Env;
  */
 public class ConditionTargetActiveEffectId extends Condition
 {
-	
 	private final int _effectId;
 	private final int _effectLvl;
 	
 	/**
 	 * Instantiates a new condition target active effect id.
-	 *
 	 * @param effectId the effect id
 	 */
 	public ConditionTargetActiveEffectId(int effectId)
@@ -39,7 +37,6 @@ public class ConditionTargetActiveEffectId extends Condition
 	
 	/**
 	 * Instantiates a new condition target active effect id.
-	 *
 	 * @param effectId the effect id
 	 * @param effectLevel the effect level
 	 */
@@ -52,10 +49,11 @@ public class ConditionTargetActiveEffectId extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		final L2Effect e = env.target.getFirstEffect(_effectId);
-		if (e != null && (_effectLvl == -1 || _effectLvl <= e.getSkill().getLevel()))
+		final L2Effect e = env.getTarget().getFirstEffect(_effectId);
+		if ((e != null) && ((_effectLvl == -1) || (_effectLvl <= e.getSkill().getLevel())))
+		{
 			return true;
-		
+		}
 		return false;
 	}
 }

+ 4 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetActiveSkillId.java

@@ -22,13 +22,11 @@ import com.l2jserver.gameserver.model.stats.Env;
  */
 public class ConditionTargetActiveSkillId extends Condition
 {
-	
 	private final int _skillId;
 	private final int _skillLevel;
 	
 	/**
 	 * Instantiates a new condition target active skill id.
-	 *
 	 * @param skillId the skill id
 	 */
 	public ConditionTargetActiveSkillId(int skillId)
@@ -39,7 +37,6 @@ public class ConditionTargetActiveSkillId extends Condition
 	
 	/**
 	 * Instantiates a new condition target active skill id.
-	 *
 	 * @param skillId the skill id
 	 * @param skillLevel the skill level
 	 */
@@ -52,14 +49,16 @@ public class ConditionTargetActiveSkillId extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		for (L2Skill sk : env.target.getAllSkills())
+		for (L2Skill sk : env.getTarget().getAllSkills())
 		{
 			if (sk != null)
 			{
 				if (sk.getId() == _skillId)
 				{
-					if (_skillLevel == -1 || _skillLevel <= sk.getLevel())
+					if ((_skillLevel == -1) || (_skillLevel <= sk.getLevel()))
+					{
 						return true;
+					}
 				}
 			}
 		}

+ 1 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetAggro.java

@@ -21,7 +21,6 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionTargetAggro.
- *
  * @author mkizub
  */
 public class ConditionTargetAggro extends Condition
@@ -31,7 +30,6 @@ public class ConditionTargetAggro extends Condition
 	
 	/**
 	 * Instantiates a new condition target aggro.
-	 *
 	 * @param isAggro the is aggro
 	 */
 	public ConditionTargetAggro(boolean isAggro)
@@ -42,7 +40,7 @@ public class ConditionTargetAggro extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		L2Character target = env.target;
+		final L2Character target = env.getTarget();
 		if (target instanceof L2MonsterInstance)
 		{
 			return ((L2MonsterInstance) target).isAggressive() == _isAggro;

+ 5 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetBodyPart.java

@@ -21,17 +21,14 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionTargetBodyPart.
- *
  * @author mkizub
  */
 public class ConditionTargetBodyPart extends Condition
 {
-	
-	private L2Armor _armor;
+	private final L2Armor _armor;
 	
 	/**
 	 * Instantiates a new condition target body part.
-	 *
 	 * @param armor the armor
 	 */
 	public ConditionTargetBodyPart(L2Armor armor)
@@ -43,9 +40,11 @@ public class ConditionTargetBodyPart extends Condition
 	public boolean testImpl(Env env)
 	{
 		// target is attacker
-		if (env.target == null)
+		if (env.getTarget() == null)
+		{
 			return true;
-		int bodypart = env.target.getAttackingBodyPart();
+		}
+		int bodypart = env.getTarget().getAttackingBodyPart();
 		int armor_part = _armor.getBodyPart();
 		switch (bodypart)
 		{

+ 4 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetClassIdRestriction.java

@@ -28,7 +28,6 @@ public class ConditionTargetClassIdRestriction extends Condition
 	
 	/**
 	 * Instantiates a new condition target class id restriction.
-	 *
 	 * @param classId the class id
 	 */
 	public ConditionTargetClassIdRestriction(ArrayList<Integer> classId)
@@ -39,8 +38,10 @@ public class ConditionTargetClassIdRestriction extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.target instanceof L2PcInstance))
+		if (!(env.getTarget() instanceof L2PcInstance))
+		{
 			return false;
-		return (_classIds.contains(((L2PcInstance)env.target).getClassId().getId()));
+		}
+		return (_classIds.contains(((L2PcInstance) env.getTarget()).getClassId().getId()));
 	}
 }

+ 4 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetLevel.java

@@ -18,7 +18,6 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionTargetLevel.
- *
  * @author mkizub
  */
 public class ConditionTargetLevel extends Condition
@@ -28,7 +27,6 @@ public class ConditionTargetLevel extends Condition
 	
 	/**
 	 * Instantiates a new condition target level.
-	 *
 	 * @param level the level
 	 */
 	public ConditionTargetLevel(int level)
@@ -39,8 +37,10 @@ public class ConditionTargetLevel extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (env.target == null)
+		if (env.getTarget() == null)
+		{
 			return false;
-		return env.target.getLevel() >= _level;
+		}
+		return env.getTarget().getLevel() >= _level;
 	}
 }

+ 2 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetNone.java

@@ -18,22 +18,21 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionTargetNone.
- *
  * @author mkizub
  */
 public class ConditionTargetNone extends Condition
 {
-	
 	/**
 	 * Instantiates a new condition target none.
 	 */
 	public ConditionTargetNone()
 	{
+		//
 	}
 	
 	@Override
 	public boolean testImpl(Env env)
 	{
-		return (env.target == null);
+		return (env.getTarget() == null);
 	}
 }

+ 8 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetNpcId.java

@@ -20,7 +20,6 @@ import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
 import com.l2jserver.gameserver.model.stats.Env;
 
-
 /**
  * The Class ConditionTargetNpcId.
  */
@@ -30,7 +29,6 @@ public class ConditionTargetNpcId extends Condition
 	
 	/**
 	 * Instantiates a new condition target npc id.
-	 *
 	 * @param npcIds the npc ids
 	 */
 	public ConditionTargetNpcId(ArrayList<Integer> npcIds)
@@ -41,12 +39,14 @@ public class ConditionTargetNpcId extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (env.target instanceof L2Npc)
-			return _npcIds.contains(((L2Npc)env.target).getNpcId());
-		
-		if (env.target instanceof L2DoorInstance)
-			return _npcIds.contains(((L2DoorInstance)env.target).getDoorId());
-		
+		if (env.getTarget() instanceof L2Npc)
+		{
+			return _npcIds.contains(((L2Npc) env.getTarget()).getNpcId());
+		}
+		if (env.getTarget() instanceof L2DoorInstance)
+		{
+			return _npcIds.contains(((L2DoorInstance) env.getTarget()).getDoorId());
+		}
 		return false;
 	}
 }

+ 8 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetNpcType.java

@@ -17,17 +17,15 @@ package com.l2jserver.gameserver.model.conditions;
 import com.l2jserver.gameserver.model.L2Object.InstanceType;
 import com.l2jserver.gameserver.model.stats.Env;
 
-
 /**
  * The Class ConditionTargetNpcType.
  */
-public class ConditionTargetNpcType extends Condition {
-	
+public class ConditionTargetNpcType extends Condition
+{
 	private final InstanceType[] _npcType;
 	
 	/**
 	 * Instantiates a new condition target npc type.
-	 *
 	 * @param type the type
 	 */
 	public ConditionTargetNpcType(InstanceType[] type)
@@ -36,10 +34,12 @@ public class ConditionTargetNpcType extends Condition {
 	}
 	
 	@Override
-	public boolean testImpl(Env env) {
-		if (env.target == null)
+	public boolean testImpl(Env env)
+	{
+		if (env.getTarget() == null)
+		{
 			return false;
-		
-		return env.target.getInstanceType().isTypes(_npcType);
+		}
+		return env.getTarget().getInstanceType().isTypes(_npcType);
 	}
 }

+ 1 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetPlayable.java

@@ -18,15 +18,13 @@ import com.l2jserver.gameserver.model.actor.L2Playable;
 import com.l2jserver.gameserver.model.stats.Env;
 
 /**
- * 
  * @author DS
- *
  */
 public class ConditionTargetPlayable extends Condition
 {
 	@Override
 	public boolean testImpl(Env env)
 	{
-		return (env.target instanceof L2Playable);
+		return (env.getTarget() instanceof L2Playable);
 	}
 }

+ 4 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetRace.java

@@ -39,8 +39,10 @@ public class ConditionTargetRace extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.target instanceof L2PcInstance))
+		if (!(env.getTarget() instanceof L2PcInstance))
+		{
 			return false;
-		return Util.contains(_races, env.target.getActingPlayer().getRace());
+		}
+		return Util.contains(_races, env.getTarget().getActingPlayer().getRace());
 	}
 }

+ 4 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetRaceId.java

@@ -19,20 +19,16 @@ import java.util.ArrayList;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.stats.Env;
 
-
 /**
  * The Class ConditionTargetRaceId.
- *
  * @author nBd
  */
-
 public class ConditionTargetRaceId extends Condition
 {
 	private final ArrayList<Integer> _raceIds;
 	
 	/**
 	 * Instantiates a new condition target race id.
-	 *
 	 * @param raceId the race id
 	 */
 	public ConditionTargetRaceId(ArrayList<Integer> raceId)
@@ -43,8 +39,10 @@ public class ConditionTargetRaceId extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.target instanceof L2Npc))
+		if (!(env.getTarget() instanceof L2Npc))
+		{
 			return false;
-		return (_raceIds.contains(((L2Npc)env.target).getTemplate().getRace().ordinal()+1));
+		}
+		return (_raceIds.contains(((L2Npc) env.getTarget()).getTemplate().getRace().ordinal() + 1));
 	}
 }

+ 6 - 7
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionTargetUsesWeaponKind.java

@@ -19,17 +19,14 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionTargetUsesWeaponKind.
- *
  * @author mkizub
  */
 public class ConditionTargetUsesWeaponKind extends Condition
 {
-	
 	private final int _weaponMask;
 	
 	/**
 	 * Instantiates a new condition target uses weapon kind.
-	 *
 	 * @param weaponMask the weapon mask
 	 */
 	public ConditionTargetUsesWeaponKind(int weaponMask)
@@ -40,14 +37,16 @@ public class ConditionTargetUsesWeaponKind extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		
-		if (env.target == null)
+		if (env.getTarget() == null)
+		{
 			return false;
+		}
 		
-		L2Weapon item = env.target.getActiveWeaponItem();
-		
+		L2Weapon item = env.getTarget().getActiveWeaponItem();
 		if (item == null)
+		{
 			return false;
+		}
 		
 		return (item.getItemType().mask() & _weaponMask) != 0;
 	}

+ 19 - 12
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionUsingItemType.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.model.conditions;
 
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.itemcontainer.Inventory;
 import com.l2jserver.gameserver.model.items.L2Item;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
@@ -23,7 +22,6 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionUsingItemType.
- *
  * @author mkizub
  */
 public final class ConditionUsingItemType extends Condition
@@ -33,7 +31,6 @@ public final class ConditionUsingItemType extends Condition
 	
 	/**
 	 * Instantiates a new condition using item type.
-	 *
 	 * @param mask the mask
 	 */
 	public ConditionUsingItemType(int mask)
@@ -45,35 +42,45 @@ public final class ConditionUsingItemType extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!(env.player instanceof L2PcInstance))
+		if (env.getPlayer() == null)
+		{
 			return false;
-		Inventory inv = ((L2PcInstance) env.player).getInventory();
+		}
 		
-		//If ConditionUsingItemType is one between Light, Heavy or Magic
+		final Inventory inv = env.getPlayer().getInventory();
+		// If ConditionUsingItemType is one between Light, Heavy or Magic
 		if (_armor)
 		{
-			//Get the itemMask of the weared chest (if exists)
+			// Get the itemMask of the weared chest (if exists)
 			L2ItemInstance chest = inv.getPaperdollItem(Inventory.PAPERDOLL_CHEST);
 			if (chest == null)
+			{
 				return false;
+			}
 			int chestMask = chest.getItem().getItemMask();
 			
-			//If chest armor is different from the condition one return false
+			// If chest armor is different from the condition one return false
 			if ((_mask & chestMask) == 0)
+			{
 				return false;
+			}
 			
-			//So from here, chest armor matches conditions
+			// So from here, chest armor matches conditions
 			
 			int chestBodyPart = chest.getItem().getBodyPart();
-			//return True if chest armor is a Full Armor
+			// return True if chest armor is a Full Armor
 			if (chestBodyPart == L2Item.SLOT_FULL_ARMOR)
+			{
 				return true;
-			//check legs armor
+			}
+			// check legs armor
 			L2ItemInstance legs = inv.getPaperdollItem(Inventory.PAPERDOLL_LEGS);
 			if (legs == null)
+			{
 				return false;
+			}
 			int legMask = legs.getItem().getItemMask();
-			//return true if legs armor matches too
+			// return true if legs armor matches too
 			return (_mask & legMask) != 0;
 		}
 		return (_mask & inv.getWearedMask()) != 0;

+ 4 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionUsingSkill.java

@@ -18,7 +18,6 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionUsingSkill.
- *
  * @author mkizub
  */
 public final class ConditionUsingSkill extends Condition
@@ -27,7 +26,6 @@ public final class ConditionUsingSkill extends Condition
 	
 	/**
 	 * Instantiates a new condition using skill.
-	 *
 	 * @param skillId the skill id
 	 */
 	public ConditionUsingSkill(int skillId)
@@ -38,8 +36,10 @@ public final class ConditionUsingSkill extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (env.skill == null)
+		if (env.getSkill() == null)
+		{
 			return false;
-		return env.skill.getId() == _skillId;
+		}
+		return env.getSkill().getId() == _skillId;
 	}
 }

+ 2 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionWithSkill.java

@@ -18,8 +18,7 @@ import com.l2jserver.gameserver.model.stats.Env;
 
 /**
  * The Class ConditionWithSkill.
- *
- * @author  Steuf
+ * @author Steuf
  */
 public class ConditionWithSkill extends Condition
 {
@@ -27,7 +26,6 @@ public class ConditionWithSkill extends Condition
 	
 	/**
 	 * Instantiates a new condition with skill.
-	 *
 	 * @param skill the skill
 	 */
 	public ConditionWithSkill(boolean skill)
@@ -38,8 +36,6 @@ public class ConditionWithSkill extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		if (!_skill && env.skill != null)
-			return false;
-		return true;
+		return (env.getSkill() != null) == _skill;
 	}
 }

+ 19 - 16
L2J_Server_BETA/java/com/l2jserver/gameserver/model/effects/L2Effect.java

@@ -151,11 +151,11 @@ public abstract class L2Effect implements IChanceSkillTrigger
 	protected L2Effect(Env env, EffectTemplate template)
 	{
 		_state = EffectState.CREATED;
-		_skill = env.skill;
+		_skill = env.getSkill();
 		//_item = env._item == null ? null : env._item.getItem();
 		_template = template;
-		_effected = env.target;
-		_effector = env.player;
+		_effected = env.getTarget();
+		_effector = env.getCharacter();
 		_lambda = template.lambda;
 		_funcTemplates = template.funcTemplates;
 		_count = template.counter;
@@ -173,7 +173,7 @@ public abstract class L2Effect implements IChanceSkillTrigger
 			}
 		}
 		
-		if (env.skillMastery)
+		if (env.isSkillMastery())
 			temp *= 2;
 		
 		_abnormalTime = temp;
@@ -211,9 +211,9 @@ public abstract class L2Effect implements IChanceSkillTrigger
 	{
 		_template = effect._template;
 		_state = EffectState.CREATED;
-		_skill = env.skill;
-		_effected = env.target;
-		_effector = env.player;
+		_skill = env.getSkill();
+		_effected = env.getTarget();
+		_effector = env.getCharacter();
 		_lambda = _template.lambda;
 		_funcTemplates = _template.funcTemplates;
 		_count = effect.getCount();
@@ -354,9 +354,9 @@ public abstract class L2Effect implements IChanceSkillTrigger
 	public final double calc()
 	{
 		Env env = new Env();
-		env.player = _effector;
-		env.target = _effected;
-		env.skill = _skill;
+		env.setCharacter(_effector);
+		env.setTarget(_effected);
+		env.setSkill(_skill);
 		return _lambda.calc(env);
 	}
 	
@@ -543,23 +543,26 @@ public abstract class L2Effect implements IChanceSkillTrigger
 	{
 		if (_funcTemplates == null)
 			return _emptyFunctionSet;
-		ArrayList<Func> funcs = new ArrayList<Func>(_funcTemplates.length);
+		
+		final ArrayList<Func> funcs = new ArrayList<Func>(_funcTemplates.length);
 		
 		Env env = new Env();
-		env.player = getEffector();
-		env.target = getEffected();
-		env.skill = getSkill();
-		Func f;
+		env.setCharacter(_effector);
+		env.setTarget(_effected);
+		env.setSkill(_skill);
 		
+		Func f;
 		for (FuncTemplate t : _funcTemplates)
 		{
 			f = t.getFunc(env, this); // effect is owner
 			if (f != null)
 				funcs.add(f);
 		}
+		
 		if (funcs.isEmpty())
+		{
 			return _emptyFunctionSet;
-		
+		}
 		return funcs.toArray(new Func[funcs.size()]);
 	}
 	

+ 5 - 7
L2J_Server_BETA/java/com/l2jserver/gameserver/model/items/L2Armor.java

@@ -122,12 +122,12 @@ public final class L2Armor extends L2Item
 	}
 	
 	/**
-	 * @param instance : L2ItemInstance pointing out the armor
+	 * @param item : L2ItemInstance pointing out the armor
 	 * @param player : L2Character pointing out the player
 	 * @return array of Func objects containing the list of functions used by the armor
 	 */
 	@Override
-	public Func[] getStatFuncs(L2ItemInstance instance, L2Character player)
+	public Func[] getStatFuncs(L2ItemInstance item, L2Character player)
 	{
 		if ((_funcTemplates == null) || (_funcTemplates.length == 0))
 		{
@@ -137,21 +137,19 @@ public final class L2Armor extends L2Item
 		ArrayList<Func> funcs = new ArrayList<Func>(_funcTemplates.length);
 		
 		Env env = new Env();
-		env.player = player;
-		env.item = instance;
+		env.setCharacter(player);
+		env.setItem(item);
 		
 		Func f;
-		
 		for (FuncTemplate t : _funcTemplates)
 		{
 			
-			f = t.getFunc(env, instance);
+			f = t.getFunc(env, item);
 			if (f != null)
 			{
 				funcs.add(f);
 			}
 		}
-		
 		return funcs.toArray(new Func[funcs.size()]);
 	}
 }

+ 14 - 15
L2J_Server_BETA/java/com/l2jserver/gameserver/model/items/L2Item.java

@@ -692,11 +692,11 @@ public abstract class L2Item
 
 	/**
 	 * Returns array of Func objects containing the list of functions used by the item
-	 * @param instance : L2ItemInstance pointing out the item
+	 * @param item : L2ItemInstance pointing out the item
 	 * @param player : L2Character pointing out the player
 	 * @return Func[] : array of functions
 	 */
-	public Func[] getStatFuncs(L2ItemInstance instance, L2Character player)
+	public Func[] getStatFuncs(L2ItemInstance item, L2Character player)
 	{
 		if (_funcTemplates == null || _funcTemplates.length == 0)
 			return _emptyFunctionSet;
@@ -704,12 +704,11 @@ public abstract class L2Item
 		ArrayList<Func> funcs = new ArrayList<Func>(_funcTemplates.length);
 		
 		Env env = new Env();
-		env.player = player;
-		env.target = player;
-		env.item = instance;
+		env.setCharacter(player);
+		env.setTarget(player);
+		env.setItem(item);
 		
 		Func f;
-		
 		for (FuncTemplate t : _funcTemplates)
 		{
 			f = t.getFunc(env, this); // skill is owner
@@ -718,18 +717,19 @@ public abstract class L2Item
 		}
 		
 		if (funcs.isEmpty())
+		{
 			return _emptyFunctionSet;
-		
+		}
 		return funcs.toArray(new Func[funcs.size()]);
 	}
 	
 	/**
 	 * Returns the effects associated with the item.
-	 * @param instance : L2ItemInstance pointing out the item
+	 * @param item : L2ItemInstance pointing out the item
 	 * @param player : L2Character pointing out the player
 	 * @return L2Effect[] : array of effects generated by the item
 	 */
-	public L2Effect[] getEffects(L2ItemInstance instance, L2Character player)
+	public L2Effect[] getEffects(L2ItemInstance item, L2Character player)
 	{
 		if (_effectTemplates == null || _effectTemplates.length == 0)
 			return _emptyEffectSet;
@@ -737,12 +737,11 @@ public abstract class L2Item
 		FastList<L2Effect> effects = FastList.newInstance();
 		
 		Env env = new Env();
-		env.player = player;
-		env.target = player;
-		env.item = instance;
+		env.setCharacter(player);
+		env.setTarget(player);
+		env.setItem(item);
 		
 		L2Effect e;
-		
 		for (EffectTemplate et : _effectTemplates)
 		{
 			
@@ -907,9 +906,9 @@ public abstract class L2Item
 			return true;
 		
 		Env env = new Env();
-		env.player = activeChar;
+		env.setCharacter(activeChar);
 		if (target instanceof L2Character)
-			env.target = (L2Character)target;
+			env.setTarget((L2Character) target);
 		
 		for (Condition preCondition : _preConditions)
 		{

+ 13 - 14
L2J_Server_BETA/java/com/l2jserver/gameserver/model/items/L2Weapon.java

@@ -302,12 +302,12 @@ public final class L2Weapon extends L2Item
 	}
 	
 	/**
-	 * @param instance the L2ItemInstance pointing out the weapon.
+	 * @param item the L2ItemInstance pointing out the weapon.
 	 * @param player the L2Character pointing out the player.
 	 * @return an array of Func objects containing the list of functions used by the weapon.
 	 */
 	@Override
-	public Func[] getStatFuncs(L2ItemInstance instance, L2Character player)
+	public Func[] getStatFuncs(L2ItemInstance item, L2Character player)
 	{
 		if ((_funcTemplates == null) || (_funcTemplates.length == 0))
 		{
@@ -317,19 +317,18 @@ public final class L2Weapon extends L2Item
 		ArrayList<Func> funcs = new ArrayList<Func>(_funcTemplates.length);
 		
 		Env env = new Env();
-		env.player = player;
-		env.item = instance;
-		Func f;
+		env.setCharacter(player);
+		env.setItem(item);
 		
+		Func f;
 		for (FuncTemplate t : _funcTemplates)
 		{
-			f = t.getFunc(env, instance);
+			f = t.getFunc(env, item);
 			if (f != null)
 			{
 				funcs.add(f);
 			}
 		}
-		
 		return funcs.toArray(new Func[funcs.size()]);
 	}
 	
@@ -345,14 +344,14 @@ public final class L2Weapon extends L2Item
 		{
 			return _emptyEffectSet;
 		}
-		List<L2Effect> effects = new FastList<L2Effect>();
 		
+		final List<L2Effect> effects = new FastList<L2Effect>();
 		if (_skillsOnCritCondition != null)
 		{
 			Env env = new Env();
-			env.player = caster;
-			env.target = target;
-			env.skill = _skillsOnCrit.getSkill();
+			env.setCharacter(caster);
+			env.setTarget(target);
+			env.setSkill(_skillsOnCrit.getSkill());
 			if (!_skillsOnCritCondition.test(env))
 			{
 				return _emptyEffectSet; // Skill condition not met
@@ -407,9 +406,9 @@ public final class L2Weapon extends L2Item
 		if (_skillsOnCastCondition != null)
 		{
 			Env env = new Env();
-			env.player = caster;
-			env.target = target;
-			env.skill = _skillsOnCast.getSkill();
+			env.setCharacter(caster);
+			env.setTarget(target);
+			env.setSkill(_skillsOnCast.getSkill());
 			if (!_skillsOnCastCondition.test(env))
 			{
 				return _emptyEffectSet;

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

@@ -1347,10 +1347,10 @@ public abstract class L2Skill implements IChanceSkillTrigger
 		for(Condition cond : preCondition)
 		{
 			Env env = new Env();
-			env.player = activeChar;
-			if (target instanceof L2Character) // TODO: object or char?
-				env.target = (L2Character)target;
-			env.skill = this;
+			env.setCharacter(activeChar);
+			if (target instanceof L2Character)
+				env.setTarget((L2Character) target);
+			env.setSkill(this);
 			
 			if (!cond.test(env))
 			{
@@ -1567,8 +1567,8 @@ public abstract class L2Skill implements IChanceSkillTrigger
 		ArrayList<Func> funcs = new ArrayList<Func>(_funcTemplates.length);
 		
 		Env env = new Env();
-		env.player = player;
-		env.skill = this;
+		env.setCharacter(player);
+		env.setSkill(this);
 		
 		Func f;
 		
@@ -1646,17 +1646,17 @@ public abstract class L2Skill implements IChanceSkillTrigger
 		if (env == null)
 			env = new Env();
 		
-		env.skillMastery = Formulas.calcSkillMastery(effector, this);
-		env.player = effector;
-		env.target = effected;
-		env.skill = this;
+		env.setSkillMastery(Formulas.calcSkillMastery(effector, this));
+		env.setCharacter(effector);
+		env.setTarget(effected);
+		env.setSkill(this);
 		
 		for (EffectTemplate et : _effectTemplates)
 		{
 			boolean success = true;
 			
 			if (et.effectPower > -1)
-				success = Formulas.calcEffectSuccess(effector, effected, et, this, env.shld, env.ss, env.sps, env.bss);
+				success = Formulas.calcEffectSuccess(effector, effected, et, this, env.getShield(), env.isSoulShot(), env.isSpiritShot(), env.isBlessedSpiritShot());
 			
 			if (success)
 			{
@@ -1733,16 +1733,16 @@ public abstract class L2Skill implements IChanceSkillTrigger
 		if (env == null)
 			env = new Env();
 		
-		env.player = effector.getOwner();
-		env.cubic = effector;
-		env.target = effected;
-		env.skill = this;
+		env.setCharacter(effector.getOwner());
+		env.setCubic(effector);
+		env.setTarget(effected);
+		env.setSkill(this);
 		
 		for (EffectTemplate et : _effectTemplates)
 		{
 			boolean success = true;
 			if (et.effectPower > -1)
-				success = Formulas.calcEffectSuccess(effector.getOwner(), effected, et, this, env.shld, env.ss, env.sps, env.bss);
+				success = Formulas.calcEffectSuccess(effector.getOwner(), effected, et, this, env.getShield(), env.isSoulShot(), env.isSpiritShot(), env.isBlessedSpiritShot());
 			
 			if (success)
 			{
@@ -1770,9 +1770,9 @@ public abstract class L2Skill implements IChanceSkillTrigger
 		for (EffectTemplate et : _effectTemplatesSelf)
 		{
 			Env env = new Env();
-			env.player = effector;
-			env.target = effector;
-			env.skill = this;
+			env.setCharacter(effector);
+			env.setTarget(effector);
+			env.setSkill(this);
 			L2Effect e = et.getEffect(env);
 			if (e != null)
 			{
@@ -1796,9 +1796,9 @@ public abstract class L2Skill implements IChanceSkillTrigger
 		for (EffectTemplate et : _effectTemplatesPassive)
 		{
 			Env env = new Env();
-			env.player = effector;
-			env.target = effector;
-			env.skill = this;
+			env.setCharacter(effector);
+			env.setTarget(effector);
+			env.setSkill(this);
 			L2Effect e = et.getEffect(env);
 			if (e != null)
 			{

+ 29 - 35
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/Func.java

@@ -19,48 +19,45 @@ import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Stats;
 
 /**
- * A Func object is a component of a Calculator created to manage and dynamically calculate the effect of a character property (ex : MAX_HP, REGENERATE_HP_RATE...).
- * In fact, each calculator is a table of Func object in which each Func represents a mathematic function : <BR><BR>
- *
- * FuncAtkAccuracy -> Math.sqrt(_player.getDEX())*6+_player.getLevel()<BR><BR>
- *
- * When the calc method of a calculator is launched, each mathematic function is called according to its priority <B>_order</B>.
- * Indeed, Func with lowest priority order is executed firsta and Funcs with the same order are executed in unspecified order.
- * The result of the calculation is stored in the value property of an Env class instance.<BR><BR>
- *
+ * A Func object is a component of a Calculator created to manage and dynamically calculate the effect of a character property (ex : MAX_HP, REGENERATE_HP_RATE...). In fact, each calculator is a table of Func object in which each Func represents a mathematics function:<br>
+ * FuncAtkAccuracy -> Math.sqrt(_player.getDEX())*6+_player.getLevel()<br>
+ * When the calc method of a calculator is launched, each mathematics function is called according to its priority <B>_order</B>.<br>
+ * Indeed, Func with lowest priority order is executed first and Funcs with the same order are executed in unspecified order. The result of the calculation is stored in the<br>
+ * value property of an Env class instance.
  */
-
-public abstract class Func {
-	
-	/** Statistics, that is affected by this function (See L2Character.CALCULATOR_XXX constants) */
+public abstract class Func
+{
+	/**
+	 * Statistics, that is affected by this function (See L2Character.CALCULATOR_XXX constants)
+	 */
 	public final Stats stat;
 	
 	/**
-	 * Order of functions calculation.
-	 * Functions with lower order are executed first.
-	 * Functions with the same order are executed in unspecified order.
-	 * Usually add/substruct functions has lowest order,
-	 * then bonus/penalty functions (multiplay/divide) are
-	 * applied, then functions that do more complex calculations
-	 * (non-linear functions).
+	 * Order of functions calculation.<br>
+	 * Functions with lower order are executed first.<br>
+	 * Functions with the same order are executed in unspecified order.<br>
+	 * Usually add/subtract functions has lowest order,<br>
+	 * then bonus/penalty functions (multiply/divide) are applied, then functions that do more complex<br>
+	 * calculations (non-linear functions).
 	 */
 	public final int order;
 	
 	/**
-	 *  Owner can be an armor, weapon, skill, system event, quest, etc
-	 *  Used to remove all functions added by this owner.
+	 * Owner can be an armor, weapon, skill, system event, quest, etc.<br>
+	 * Used to remove all functions added by this owner.
 	 */
 	public final Object funcOwner;
 	
-	/** Function may be disabled by attached condition. */
+	/**
+	 * Function may be disabled by attached condition.
+	 */
 	public Condition cond;
 	
-	
 	/**
-	 * Constructor of Func.<BR><BR>
-	 * @param pStat 
-	 * @param pOrder 
-	 * @param owner 
+	 * Constructor of Func.
+	 * @param pStat
+	 * @param pOrder
+	 * @param owner
 	 */
 	public Func(Stats pStat, int pOrder, Object owner)
 	{
@@ -69,21 +66,18 @@ public abstract class Func {
 		funcOwner = owner;
 	}
 	
-	
 	/**
-	 * Add a condition to the Func.<BR><BR>
-	 * @param pCond 
+	 * Add a condition to the Func.
+	 * @param pCond
 	 */
 	public void setCondition(Condition pCond)
 	{
 		cond = pCond;
 	}
 	
-	
 	/**
-	 * Run the mathematic function of the Func.<BR><BR>
-	 * @param env 
+	 * Run the mathematics function of the Func.
+	 * @param env
 	 */
 	public abstract void calc(Env env);
-	
 }

+ 10 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncAdd.java

@@ -17,18 +17,22 @@ package com.l2jserver.gameserver.model.skills.funcs;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Stats;
 
-
-
-public class FuncAdd extends Func {
+public class FuncAdd extends Func
+{
 	private final Lambda _lambda;
-	public FuncAdd(Stats pStat, int pOrder, Object owner, Lambda lambda) {
+	
+	public FuncAdd(Stats pStat, int pOrder, Object owner, Lambda lambda)
+	{
 		super(pStat, pOrder, owner);
 		_lambda = lambda;
 	}
+	
 	@Override
 	public void calc(Env env)
 	{
-		if (cond == null || cond.test(env))
-			env.value += _lambda.calc(env);
+		if ((cond == null) || cond.test(env))
+		{
+			env.addValue(_lambda.calc(env));
+		}
 	}
 }

+ 10 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncBaseMul.java

@@ -17,18 +17,22 @@ package com.l2jserver.gameserver.model.skills.funcs;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Stats;
 
-
-
-public class FuncBaseMul extends Func {
+public class FuncBaseMul extends Func
+{
 	private final Lambda _lambda;
-	public FuncBaseMul(Stats pStat, int pOrder, Object owner, Lambda lambda) {
+	
+	public FuncBaseMul(Stats pStat, int pOrder, Object owner, Lambda lambda)
+	{
 		super(pStat, pOrder, owner);
 		_lambda = lambda;
 	}
+	
 	@Override
 	public void calc(Env env)
 	{
-		if (cond == null || cond.test(env))
-			env.value += env.baseValue * _lambda.calc(env);
+		if ((cond == null) || cond.test(env))
+		{
+			env.addValue(env.getBaseValue() * _lambda.calc(env));
+		}
 	}
 }

+ 10 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncDiv.java

@@ -17,18 +17,22 @@ package com.l2jserver.gameserver.model.skills.funcs;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Stats;
 
-
-
-public class FuncDiv extends Func {
+public class FuncDiv extends Func
+{
 	private final Lambda _lambda;
-	public FuncDiv(Stats pStat, int pOrder, Object owner, Lambda lambda) {
+	
+	public FuncDiv(Stats pStat, int pOrder, Object owner, Lambda lambda)
+	{
 		super(pStat, pOrder, owner);
 		_lambda = lambda;
 	}
+	
 	@Override
 	public void calc(Env env)
 	{
-		if (cond == null || cond.test(env))
-			env.value /= _lambda.calc(env);
+		if ((cond == null) || cond.test(env))
+		{
+			env.divValue(_lambda.calc(env));
+		}
 	}
 }

+ 29 - 29
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncEnchant.java

@@ -24,7 +24,6 @@ import com.l2jserver.gameserver.model.stats.Stats;
 
 public class FuncEnchant extends Func
 {
-	
 	public FuncEnchant(Stats pStat, int pOrder, Object owner, Lambda lambda)
 	{
 		super(pStat, pOrder, owner);
@@ -33,14 +32,18 @@ public class FuncEnchant extends Func
 	@Override
 	public void calc(Env env)
 	{
-		if (cond != null && !cond.test(env))
+		if ((cond != null) && !cond.test(env))
+		{
 			return;
+		}
 		L2ItemInstance item = (L2ItemInstance) funcOwner;
 		
 		int enchant = item.getEnchantLevel();
 		
 		if (enchant <= 0)
+		{
 			return;
+		}
 		
 		int overenchant = 0;
 		
@@ -50,11 +53,10 @@ public class FuncEnchant extends Func
 			enchant = 3;
 		}
 		
-		if (env.player != null && env.player instanceof L2PcInstance)
+		if (env.getPlayer() != null)
 		{
-			L2PcInstance player = (L2PcInstance)env.player;
-			if (player.isInOlympiadMode() && Config.ALT_OLY_ENCHANT_LIMIT >= 0 &&
-					(enchant + overenchant) > Config.ALT_OLY_ENCHANT_LIMIT)
+			L2PcInstance player = env.getPlayer();
+			if (player.isInOlympiadMode() && (Config.ALT_OLY_ENCHANT_LIMIT >= 0) && ((enchant + overenchant) > Config.ALT_OLY_ENCHANT_LIMIT))
 			{
 				if (Config.ALT_OLY_ENCHANT_LIMIT > 3)
 				{
@@ -68,9 +70,9 @@ public class FuncEnchant extends Func
 			}
 		}
 		
-		if (stat == Stats.MAGIC_DEFENCE || stat == Stats.POWER_DEFENCE)
+		if ((stat == Stats.MAGIC_DEFENCE) || (stat == Stats.POWER_DEFENCE))
 		{
-			env.value += enchant + 3 * overenchant;
+			env.addValue(enchant + (3 * overenchant));
 			return;
 		}
 		
@@ -81,40 +83,38 @@ public class FuncEnchant extends Func
 				case L2Item.CRYSTAL_S:
 					// M. Atk. increases by 4 for all weapons.
 					// Starting at +4, M. Atk. bonus double.
-					env.value += 4 * enchant + 8 * overenchant;
+					env.addValue((4 * enchant) + (8 * overenchant));
 					break;
 				case L2Item.CRYSTAL_A:
 				case L2Item.CRYSTAL_B:
 				case L2Item.CRYSTAL_C:
 					// M. Atk. increases by 3 for all weapons.
 					// Starting at +4, M. Atk. bonus double.
-					env.value += 3 * enchant + 6 * overenchant;
+					env.addValue((3 * enchant) + (6 * overenchant));
 					break;
 				case L2Item.CRYSTAL_D:
 				case L2Item.CRYSTAL_NONE:
 					// M. Atk. increases by 2 for all weapons. Starting at +4, M. Atk. bonus double.
 					// Starting at +4, M. Atk. bonus double.
-					env.value += 2 * enchant + 4 * overenchant;
+					env.addValue((2 * enchant) + (4 * overenchant));
 					break;
 			}
 			return;
 		}
 		
-		
 		if (item.isWeapon())
 		{
-			L2WeaponType type = (L2WeaponType) item.getItemType();
-			
+			final L2WeaponType type = (L2WeaponType) item.getItemType();
 			switch (item.getItem().getItemGradeSPlus())
 			{
 				case L2Item.CRYSTAL_S:
-					switch(type)
+					switch (type)
 					{
 						case BOW:
 						case CROSSBOW:
 							// P. Atk. increases by 10 for bows.
 							// Starting at +4, P. Atk. bonus double.
-							env.value += 10 * enchant + 20 * overenchant;
+							env.addValue((10 * enchant) + (20 * overenchant));
 							break;
 						case BIGSWORD:
 						case BIGBLUNT:
@@ -124,23 +124,23 @@ public class FuncEnchant extends Func
 						case DUALDAGGER:
 							// P. Atk. increases by 6 for two-handed swords, two-handed blunts, dualswords, and two-handed combat weapons.
 							// Starting at +4, P. Atk. bonus double.
-							env.value += 6 * enchant + 12 * overenchant;
+							env.addValue((6 * enchant) + (12 * overenchant));
 							break;
 						default:
 							// P. Atk. increases by 5 for one-handed swords, one-handed blunts, daggers, spears, and other weapons.
 							// Starting at +4, P. Atk. bonus double.
-							env.value += 5 * enchant + 10 * overenchant;
+							env.addValue((5 * enchant) + (10 * overenchant));
 							break;
 					}
 					break;
 				case L2Item.CRYSTAL_A:
-					switch(type)
+					switch (type)
 					{
 						case BOW:
 						case CROSSBOW:
 							// P. Atk. increases by 8 for bows.
 							// Starting at +4, P. Atk. bonus double.
-							env.value += 8 * enchant + 16 * overenchant;
+							env.addValue((8 * enchant) + (16 * overenchant));
 							break;
 						case BIGSWORD:
 						case BIGBLUNT:
@@ -150,24 +150,24 @@ public class FuncEnchant extends Func
 						case DUALDAGGER:
 							// P. Atk. increases by 5 for two-handed swords, two-handed blunts, dualswords, and two-handed combat weapons.
 							// Starting at +4, P. Atk. bonus double.
-							env.value += 5 * enchant + 10 * overenchant;
+							env.addValue((5 * enchant) + (10 * overenchant));
 							break;
 						default:
 							// P. Atk. increases by 4 for one-handed swords, one-handed blunts, daggers, spears, and other weapons.
 							// Starting at +4, P. Atk. bonus double.
-							env.value += 4 * enchant + 8 * overenchant;
+							env.addValue((4 * enchant) + (8 * overenchant));
 							break;
 					}
 					break;
 				case L2Item.CRYSTAL_B:
 				case L2Item.CRYSTAL_C:
-					switch(type)
+					switch (type)
 					{
 						case BOW:
 						case CROSSBOW:
 							// P. Atk. increases by 6 for bows.
 							// Starting at +4, P. Atk. bonus double.
-							env.value += 6 * enchant + 12 * overenchant;
+							env.addValue((6 * enchant) + (12 * overenchant));
 							break;
 						case BIGSWORD:
 						case BIGBLUNT:
@@ -177,31 +177,31 @@ public class FuncEnchant extends Func
 						case DUALDAGGER:
 							// P. Atk. increases by 4 for two-handed swords, two-handed blunts, dualswords, and two-handed combat weapons.
 							// Starting at +4, P. Atk. bonus double.
-							env.value += 4 * enchant + 8 * overenchant;
+							env.addValue((4 * enchant) + (8 * overenchant));
 							break;
 						default:
 							// P. Atk. increases by 3 for one-handed swords, one-handed blunts, daggers, spears, and other weapons.
 							// Starting at +4, P. Atk. bonus double.
-							env.value += 3 * enchant + 6 * overenchant;
+							env.addValue((3 * enchant) + (6 * overenchant));
 							break;
 					}
 					break;
 				case L2Item.CRYSTAL_D:
 				case L2Item.CRYSTAL_NONE:
-					switch(type)
+					switch (type)
 					{
 						case BOW:
 						case CROSSBOW:
 						{
 							// Bows increase by 4.
 							// Starting at +4, P. Atk. bonus double.
-							env.value += 4 * enchant + 8 * overenchant;
+							env.addValue((4 * enchant) + (8 * overenchant));
 							break;
 						}
 						default:
 							// P. Atk. increases by 2 for all weapons with the exception of bows.
 							// Starting at +4, P. Atk. bonus double.
-							env.value += 2 * enchant + 4 * overenchant;
+							env.addValue((2 * enchant) + (4 * overenchant));
 							break;
 					}
 					break;

+ 7 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncEnchantHp.java

@@ -20,8 +20,7 @@ import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Stats;
 
 /**
- *
- * @author  Yamaneko
+ * @author Yamaneko
  */
 public class FuncEnchantHp extends Func
 {
@@ -33,11 +32,15 @@ public class FuncEnchantHp extends Func
 	@Override
 	public void calc(Env env)
 	{
-		if (cond != null && !cond.test(env))
+		if ((cond != null) && !cond.test(env))
+		{
 			return;
+		}
 		
 		final L2ItemInstance item = (L2ItemInstance) funcOwner;
 		if (item.getEnchantLevel() > 0)
-			env.value += EnchantHPBonusData.getInstance().getHPBonus(item);
+		{
+			env.addValue(EnchantHPBonusData.getInstance().getHPBonus(item));
+		}
 	}
 }

+ 10 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncMul.java

@@ -17,18 +17,22 @@ package com.l2jserver.gameserver.model.skills.funcs;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Stats;
 
-
-
-public class FuncMul extends Func {
+public class FuncMul extends Func
+{
 	private final Lambda _lambda;
-	public FuncMul(Stats pStat, int pOrder, Object owner, Lambda lambda) {
+	
+	public FuncMul(Stats pStat, int pOrder, Object owner, Lambda lambda)
+	{
 		super(pStat, pOrder, owner);
 		_lambda = lambda;
 	}
+	
 	@Override
 	public void calc(Env env)
 	{
-		if (cond == null || cond.test(env))
-			env.value *= _lambda.calc(env);
+		if ((cond == null) || cond.test(env))
+		{
+			env.mulValue(_lambda.calc(env));
+		}
 	}
 }

+ 10 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncSet.java

@@ -17,18 +17,22 @@ package com.l2jserver.gameserver.model.skills.funcs;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Stats;
 
-
-
-public class FuncSet extends Func {
+public class FuncSet extends Func
+{
 	private final Lambda _lambda;
-	public FuncSet(Stats pStat, int pOrder, Object owner, Lambda lambda) {
+	
+	public FuncSet(Stats pStat, int pOrder, Object owner, Lambda lambda)
+	{
 		super(pStat, pOrder, owner);
 		_lambda = lambda;
 	}
+	
 	@Override
 	public void calc(Env env)
 	{
-		if (cond == null || cond.test(env))
-			env.value = _lambda.calc(env);
+		if ((cond == null) || cond.test(env))
+		{
+			env.setValue(_lambda.calc(env));
+		}
 	}
 }

+ 10 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncSub.java

@@ -17,18 +17,22 @@ package com.l2jserver.gameserver.model.skills.funcs;
 import com.l2jserver.gameserver.model.stats.Env;
 import com.l2jserver.gameserver.model.stats.Stats;
 
-
-
-public class FuncSub extends Func {
+public class FuncSub extends Func
+{
 	private final Lambda _lambda;
-	public FuncSub(Stats pStat, int pOrder, Object owner, Lambda lambda) {
+	
+	public FuncSub(Stats pStat, int pOrder, Object owner, Lambda lambda)
+	{
 		super(pStat, pOrder, owner);
 		_lambda = lambda;
 	}
+	
 	@Override
 	public void calc(Env env)
 	{
-		if (cond == null || cond.test(env))
-			env.value -= _lambda.calc(env);
+		if ((cond == null) || cond.test(env))
+		{
+			env.subValue(_lambda.calc(env));
+		}
 	}
 }

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

@@ -103,6 +103,5 @@ public final class FuncTemplate
 			_log.log(Level.WARNING, "", e);
 			return null;
 		}
-		
 	}
 }

+ 18 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/LambdaCalc.java

@@ -21,33 +21,41 @@ import com.l2jserver.gameserver.model.stats.Env;
  */
 public final class LambdaCalc extends Lambda
 {
-	
 	public Func[] funcs;
+	
 	public LambdaCalc()
 	{
 		funcs = new Func[0];
 	}
+	
 	@Override
-	public double calc(Env env) {
-		double saveValue = env.value;
+	public double calc(Env env)
+	{
+		double saveValue = env.getValue();
 		try
 		{
-			env.value = 0;
+			env.setValue(0);
 			for (Func f : funcs)
+			{
 				f.calc(env);
-			return env.value;
-		} finally {
-			env.value = saveValue;
+			}
+			return env.getValue();
+		}
+		finally
+		{
+			env.setValue(saveValue);
 		}
 	}
+	
 	public void addFunc(Func f)
 	{
 		int len = funcs.length;
-		Func[] tmp = new Func[len+1];
-		for (int i=0; i < len; i++)
+		Func[] tmp = new Func[len + 1];
+		for (int i = 0; i < len; i++)
+		{
 			tmp[i] = funcs[i];
+		}
 		tmp[len] = f;
 		funcs = tmp;
 	}
-	
 }

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/LambdaConst.java

@@ -21,16 +21,16 @@ import com.l2jserver.gameserver.model.stats.Env;
  */
 public final class LambdaConst extends Lambda
 {
-	
 	private final double _value;
+	
 	public LambdaConst(double value)
 	{
 		_value = value;
 	}
+	
 	@Override
 	public double calc(Env env)
 	{
 		return _value;
 	}
-	
 }

+ 5 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/LambdaRnd.java

@@ -22,7 +22,6 @@ import com.l2jserver.util.Rnd;
  */
 public final class LambdaRnd extends Lambda
 {
-	
 	private final Lambda _max;
 	private final boolean _linear;
 	
@@ -31,11 +30,14 @@ public final class LambdaRnd extends Lambda
 		_max = max;
 		_linear = linear;
 	}
+	
 	@Override
-	public double calc(Env env) {
+	public double calc(Env env)
+	{
 		if (_linear)
+		{
 			return _max.calc(env) * Rnd.nextDouble();
+		}
 		return _max.calc(env) * Rnd.nextGaussian();
 	}
-	
 }

+ 23 - 13
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/LambdaStats.java

@@ -21,7 +21,6 @@ import com.l2jserver.gameserver.model.stats.Env;
  */
 public final class LambdaStats extends Lambda
 {
-	
 	public enum StatsType
 	{
 		PLAYER_LEVEL,
@@ -37,32 +36,43 @@ public final class LambdaStats extends Lambda
 	{
 		_stat = stat;
 	}
+	
 	@Override
-	public double calc(Env env) {
+	public double calc(Env env)
+	{
 		switch (_stat)
 		{
 			case PLAYER_LEVEL:
-				if (env.player == null)
+				if (env.getCharacter() == null)
+				{
 					return 1;
-				return env.player.getLevel();
+				}
+				return env.getCharacter().getLevel();
 			case CUBIC_LEVEL:
-				if(env.cubic == null)
+				if (env.getCubic() == null)
+				{
 					return 1;
-				return env.cubic.getOwner().getLevel();
+				}
+				return env.getCubic().getOwner().getLevel();
 			case TARGET_LEVEL:
-				if (env.target == null)
+				if (env.getTarget() == null)
+				{
 					return 1;
-				return env.target.getLevel();
+				}
+				return env.getTarget().getLevel();
 			case PLAYER_MAX_HP:
-				if (env.player == null)
+				if (env.getCharacter() == null)
+				{
 					return 1;
-				return env.player.getMaxHp();
+				}
+				return env.getCharacter().getMaxHp();
 			case PLAYER_MAX_MP:
-				if (env.player == null)
+				if (env.getCharacter() == null)
+				{
 					return 1;
-				return env.player.getMaxMp();
+				}
+				return env.getCharacter().getMaxMp();
 		}
 		return 0;
 	}
-	
 }

+ 259 - 21
L2J_Server_BETA/java/com/l2jserver/gameserver/model/stats/Env.java

@@ -16,39 +16,277 @@ package com.l2jserver.gameserver.model.stats;
 
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2CubicInstance;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.effects.L2Effect;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 
 /**
  * An Env object is just a class to pass parameters to a calculator such as L2PcInstance, L2ItemInstance, Initial value.
+ * @author Zoey76
  */
-public final class Env {
-	
-	public L2Character    player;
-	public L2CubicInstance cubic;
-	public L2Character    target;
-	public L2ItemInstance item;
-	public L2Skill        skill;
-	public L2Effect       effect;
-	public double value;
-	public double baseValue;
-	public boolean skillMastery = false;
-	public byte shld = 0;
-	public boolean ss = false;
-	public boolean sps = false;
-	public boolean bss = false;
+public final class Env
+{
+	private double _baseValue;
+	private boolean _blessedSpiritShot = false;
+	private L2Character _character;
+	private L2CubicInstance _cubic;
+	private L2Effect _effect;
+	private L2ItemInstance _item;
+	private byte _shield = 0;
+	private L2Skill _skill;
+	private boolean _skillMastery = false;
+	private boolean _soulShot = false;
+	private boolean _spiritShot = false;
+	private L2Character _target;
+	private double _value;
 	
 	public Env()
 	{
-		
+		//
 	}
 	
-	public Env(byte shd, boolean s, boolean ps, boolean bs)
+	public Env(byte shield, boolean soulShot, boolean spiritShot, boolean blessedSpiritShot)
 	{
-		shld = shd;
-		ss = s;
-		sps = ps;
-		bss = bs;
+		_shield = shield;
+		_soulShot = soulShot;
+		_spiritShot = spiritShot;
+		_blessedSpiritShot = blessedSpiritShot;
+	}
+	
+	/**
+	 * @return the _baseValue
+	 */
+	public double getBaseValue()
+	{
+		return _baseValue;
+	}
+	
+	/**
+	 * @return the _character
+	 */
+	public L2Character getCharacter()
+	{
+		return _character;
+	}
+	
+	/**
+	 * @return the _cubic
+	 */
+	public L2CubicInstance getCubic()
+	{
+		return _cubic;
+	}
+	
+	/**
+	 * @return the _effect
+	 */
+	public L2Effect getEffect()
+	{
+		return _effect;
+	}
+	
+	/**
+	 * @return the _item
+	 */
+	public L2ItemInstance getItem()
+	{
+		return _item;
+	}
+	
+	/**
+	 * @return the acting player.
+	 */
+	public L2PcInstance getPlayer()
+	{
+		return _character == null ? null : _character.getActingPlayer();
+	}
+	
+	/**
+	 * @return the _shield
+	 */
+	public byte getShield()
+	{
+		return _shield;
+	}
+	
+	/**
+	 * @return the _skill
+	 */
+	public L2Skill getSkill()
+	{
+		return _skill;
+	}
+	
+	/**
+	 * @return the _target
+	 */
+	public L2Character getTarget()
+	{
+		return _target;
+	}
+	
+	/**
+	 * @return the _value
+	 */
+	public double getValue()
+	{
+		return _value;
+	}
+	
+	/**
+	 * @return the _blessedSpiritShot
+	 */
+	public boolean isBlessedSpiritShot()
+	{
+		return _blessedSpiritShot;
+	}
+	
+	/**
+	 * @return the _skillMastery
+	 */
+	public boolean isSkillMastery()
+	{
+		return _skillMastery;
+	}
+	
+	/**
+	 * @return the _soulShot
+	 */
+	public boolean isSoulShot()
+	{
+		return _soulShot;
+	}
+	
+	/**
+	 * @return the _spiritShot
+	 */
+	public boolean isSpiritShot()
+	{
+		return _spiritShot;
+	}
+	
+	/**
+	 * @param baseValue the _baseValue to set
+	 */
+	public void setBaseValue(double baseValue)
+	{
+		_baseValue = baseValue;
+	}
+	
+	/**
+	 * @param blessedSpiritShot the _blessedSpiritShot to set
+	 */
+	public void setBlessedSpiritShot(boolean blessedSpiritShot)
+	{
+		_blessedSpiritShot = blessedSpiritShot;
+	}
+	
+	/**
+	 * @param character the _character to set
+	 */
+	public void setCharacter(L2Character character)
+	{
+		_character = character;
+	}
+	
+	/**
+	 * @param cubic the _cubic to set
+	 */
+	public void setCubic(L2CubicInstance cubic)
+	{
+		_cubic = cubic;
+	}
+	
+	/**
+	 * @param effect the _effect to set
+	 */
+	public void setEffect(L2Effect effect)
+	{
+		_effect = effect;
+	}
+	
+	/**
+	 * @param item the _item to set
+	 */
+	public void setItem(L2ItemInstance item)
+	{
+		_item = item;
+	}
+	
+	/**
+	 * @param shield the _shield to set
+	 */
+	public void setShield(byte shield)
+	{
+		_shield = shield;
+	}
+	
+	/**
+	 * @param skill the _skill to set
+	 */
+	public void setSkill(L2Skill skill)
+	{
+		_skill = skill;
+	}
+	
+	/**
+	 * @param skillMastery the _skillMastery to set
+	 */
+	public void setSkillMastery(boolean skillMastery)
+	{
+		_skillMastery = skillMastery;
+	}
+	
+	/**
+	 * @param soulShot the _soulShot to set
+	 */
+	public void setSoulShot(boolean soulShot)
+	{
+		_soulShot = soulShot;
+	}
+	
+	/**
+	 * @param spiritShot the _spiritShot to set
+	 */
+	public void setSpiritShot(boolean spiritShot)
+	{
+		_spiritShot = spiritShot;
+	}
+	
+	/**
+	 * @param target the _target to set
+	 */
+	public void setTarget(L2Character target)
+	{
+		_target = target;
+	}
+	
+	/**
+	 * @param value the _value to set
+	 */
+	public void setValue(double value)
+	{
+		_value = value;
+	}
+	
+	public void addValue(double value)
+	{
+		_value += value;
+	}
+	
+	public void subValue(double value)
+	{
+		_value -= value;
+	}
+	
+	public void mulValue(double value)
+	{
+		_value *= value;
+	}
+	
+	public void divValue(double value)
+	{
+		_value /= value;
 	}
 }

文件差异内容过多而无法显示
+ 305 - 181
L2J_Server_BETA/java/com/l2jserver/gameserver/model/stats/Formulas.java


部分文件因为文件数量过多而无法显示