Browse Source

BETA:
* Rename getAttackStanceTask() method to hasAttackStanceTask()
* Epsilon approach for "TODO: (Zoey76) This is mathematically wrong." in L2Character
* Comment corrections in SystemMessage

Ahmed 12 years ago
parent
commit
08c236286c

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/AbstractAI.java

@@ -796,7 +796,7 @@ public abstract class AbstractAI implements Ctrl
 		}
 		if (_actor instanceof L2PcInstance)
 		{
-			if (!AttackStanceTaskManager.getInstance().getAttackStanceTask(_actor) && isAutoAttacking())
+			if (!AttackStanceTaskManager.getInstance().hasAttackStanceTask(_actor) && isAutoAttacking())
 				AttackStanceTaskManager.getInstance().addAttackStanceTask(_actor);
 		}
 		else if (isAutoAttacking())

+ 5 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2CharacterAI.java

@@ -528,7 +528,7 @@ public class L2CharacterAI extends AbstractAI
 	{
 		// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
 		_actor.broadcastPacket(new AutoAttackStop(_actor.getObjectId()));
-		if (AttackStanceTaskManager.getInstance().getAttackStanceTask(_actor))
+		if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(_actor))
 			AttackStanceTaskManager.getInstance().removeAttackStanceTask(_actor);
 		
 		// Stop Server AutoAttack also
@@ -546,7 +546,7 @@ public class L2CharacterAI extends AbstractAI
 	{
 		// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
 		_actor.broadcastPacket(new AutoAttackStop(_actor.getObjectId()));
-		if (AttackStanceTaskManager.getInstance().getAttackStanceTask(_actor))
+		if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(_actor))
 			AttackStanceTaskManager.getInstance().removeAttackStanceTask(_actor);
 		
 		// Stop Server AutoAttack also
@@ -574,7 +574,7 @@ public class L2CharacterAI extends AbstractAI
 	{
 		// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
 		_actor.broadcastPacket(new AutoAttackStop(_actor.getObjectId()));
-		if (AttackStanceTaskManager.getInstance().getAttackStanceTask(_actor))
+		if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(_actor))
 			AttackStanceTaskManager.getInstance().removeAttackStanceTask(_actor);
 		
 		// stop Server AutoAttack also
@@ -597,7 +597,7 @@ public class L2CharacterAI extends AbstractAI
 	{
 		// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
 		//_actor.broadcastPacket(new AutoAttackStop(_actor.getObjectId()));
-		//if (AttackStanceTaskManager.getInstance().getAttackStanceTask(_actor))
+		//if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(_actor))
 		//    AttackStanceTaskManager.getInstance().removeAttackStanceTask(_actor);
 		
 		// Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)
@@ -844,7 +844,7 @@ public class L2CharacterAI extends AbstractAI
 		// Stop an AI Follow Task
 		stopFollow();
 		
-		if (!AttackStanceTaskManager.getInstance().getAttackStanceTask(_actor))
+		if (!AttackStanceTaskManager.getInstance().hasAttackStanceTask(_actor))
 			_actor.broadcastPacket(new AutoAttackStop(_actor.getObjectId()));
 		
 		// Launch actions corresponding to the Event Think

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

@@ -581,13 +581,10 @@ public abstract class L2Character extends L2Object
 		if (currentHp <= 1.0 || maxHp < barPixels)
 			return true;
 		
-		if (currentHp <= _hpUpdateDecCheck || currentHp >= _hpUpdateIncCheck)
+		if ((currentHp < _hpUpdateDecCheck) || (Math.abs(currentHp - _hpUpdateDecCheck) <= 1e-6) ||
+			(currentHp > _hpUpdateIncCheck) || (Math.abs(currentHp - _hpUpdateIncCheck) <= 1e-6))
 		{
-			// TODO: (Zoey76) This is mathematically wrong.
-			// for example 2.2d + 1.1d == 3.3d will return false
-			// Also Double.compare(2.2d + 1.1d, 3.3d) will return 1,
-			// meaning the second parameter is greater than the first.
-			if (currentHp == maxHp)
+			if (Math.abs(currentHp - maxHp) <= 1e-6)
 			{
 				_hpUpdateIncCheck = currentHp + 1;
 				_hpUpdateDecCheck = currentHp - _hpUpdateInterval;

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

@@ -488,11 +488,11 @@ public final class L2CubicInstance
 					cancelDisappear();
 					return;
 				}
-				if (!AttackStanceTaskManager.getInstance().getAttackStanceTask(_owner))
+				if (!AttackStanceTaskManager.getInstance().hasAttackStanceTask(_owner))
 				{
 					if (_owner.getPet() != null)
 					{
-						if (!AttackStanceTaskManager.getInstance().getAttackStanceTask(_owner.getPet()))
+						if (!AttackStanceTaskManager.getInstance().hasAttackStanceTask(_owner.getPet()))
 						{
 							stopAction();
 							return;

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

@@ -175,7 +175,7 @@ public class L2NpcBufferInstance extends L2Npc
 		}
 		else if (command.startsWith("Heal") || command.startsWith("PetHeal"))
 		{
-			if (!target.isInCombat() && !AttackStanceTaskManager.getInstance().getAttackStanceTask(target))
+			if (!target.isInCombat() && !AttackStanceTaskManager.getInstance().hasAttackStanceTask(target))
 			{
 				String[] healArray = command.substring(command.indexOf("Heal") + 5).split(" ");
 				

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

@@ -14389,7 +14389,7 @@ public final class L2PcInstance extends L2Playable
 			return false;
 		if (isTransformed() || isInStance())
 			return false;
-		if (AttackStanceTaskManager.getInstance().getAttackStanceTask(this))
+		if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(this))
 			return false;
 		if (isCastingNow() || isCastingSimultaneouslyNow())
 			return false;
@@ -14866,7 +14866,7 @@ public final class L2PcInstance extends L2Playable
 				&& !isAlikeDead() && (!isAllSkillsDisabled() || isInDuel())
 				&& !isCastingNow() && !isCastingSimultaneouslyNow()
 				&& getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE
-				&& !AttackStanceTaskManager.getInstance().getAttackStanceTask(this)
+				&& !AttackStanceTaskManager.getInstance().hasAttackStanceTask(this)
 				&& !isInOlympiadMode())
 		{
 			return true;

+ 82 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/network/SystemMessageId.java

@@ -241,7 +241,7 @@ public final class SystemMessageId
 	public static final SystemMessageId UNABLE_COMBAT_PLEASE_GO_RESTART;
 	
 	/**
-	 * ID: 32<br>
+	 * ID: 33<br>
 	 * Message: You cannot move while casting.
 	 */
 	public static final SystemMessageId CANT_MOVE_CASTING;
@@ -1272,6 +1272,26 @@ public final class SystemMessageId
 	 */
 	public static final SystemMessageId S2_OF_THE_CLAN_S1_REQUESTS_WAR;
 	
+	/**
+	 * ID: 208<br>
+	 * Message: Please include file type when entering file path.
+	 */
+	
+	/**
+	 * ID: 209<br>
+	 * Message: The size of the image file is inappropriate. Please adjust to 16x12 pixels.
+	 */
+	
+	/**
+	 * ID: 210<br>
+	 * Message: Cannot find file. Please enter precise path.
+	 */
+	
+	/**
+	 * ID: 211<br>
+	 * Message: You can only register 16x12 pixel 256 color bmp files.
+	 */
+	
 	/**
 	 * ID: 212<br>
 	 * Message: You are not a clan member and cannot perform this action.
@@ -2635,7 +2655,7 @@ public final class SystemMessageId
 	public static final SystemMessageId ACCESS_FAILED;
 	
 	/**
-	 * ID: 461<br>
+	 * ID: 462<br>
 	 * Message: Please try again later.
 	 */
 	public static final SystemMessageId PLEASE_TRY_AGAIN_LATER;
@@ -3048,6 +3068,11 @@ public final class SystemMessageId
 	 */
 	public static final SystemMessageId DISABLED_SPIRITSHOT;
 	
+	/**
+	 * ID: 535<br>
+	 * Message: Enter a name for your pet.
+	 */
+	
 	/**
 	 * ID: 536<br>
 	 * Message: How much adena do you wish to transfer to your Inventory?
@@ -3246,6 +3271,17 @@ public final class SystemMessageId
 	 */
 	public static final SystemMessageId CUBIC_SUMMONING_FAILED;
 	
+	/**
+	 * ID: 569<br>
+	 * Message: Caution -- this item's price greatly differs from non-player run shops. Do you wish to continue? 
+	 */
+	
+	/**
+	 * ID: 570<br>
+	 * ID: 571<br>
+	 * Message: How many  $s1(s) do you want to purchase?
+	 */
+	
 	/**
 	 * ID: 572<br>
 	 * Message: Do you accept $c1's party invitation? (Item Distribution: Finders Keepers.)
@@ -3769,7 +3805,7 @@ public final class SystemMessageId
 	public static final SystemMessageId NOT_SIEGE_REGISTRATION_TIME1;
 	
 	/**
-	 * ID: 659<br>
+	 * ID: 660<br>
 	 * Message: This is not the time for siege registration and so registration and cancellation cannot be done.
 	 */
 	public static final SystemMessageId NOT_SIEGE_REGISTRATION_TIME2;
@@ -8762,7 +8798,7 @@ public final class SystemMessageId
 	
 	/**
 	 * ID: 1504<br>
-	 * Message: You have registered on the waiting list for the non-class-limited individual match event.
+	 * Message: You are currently registered for a 1v1 class irrelevant match.
 	 */
 	public static final SystemMessageId YOU_HAVE_BEEN_REGISTERED_IN_A_WAITING_LIST_OF_NO_CLASS_GAMES;
 	
@@ -11517,7 +11553,7 @@ public final class SystemMessageId
 	public static final SystemMessageId S1_OWNER;
 	
 	/**
-	 * ID: 1968<br>
+	 * ID: 1969<br>
 	 * Message: Area where $s1 appears.
 	 */
 	public static final SystemMessageId AREA_S1_APPEARS;
@@ -11757,7 +11793,7 @@ public final class SystemMessageId
 	public static final SystemMessageId CANT_EXCEED_1500_CHARACTERS;
 	
 	/**
-	 * ID: 2009<br>
+	 * ID: 2010<br>
 	 * Message: $s2 $s1
 	 */
 	public static final SystemMessageId S2_S1;
@@ -13340,12 +13376,52 @@ public final class SystemMessageId
 	 */
 	public static final SystemMessageId SKILL_NOT_FOR_SUBCLASS;
 	
+	/**
+	 * ID: 2274<br>
+	 * Message: You entered an area where you cannot throw away items.
+	 */
+	
+	/**
+	 * ID: 2275<br>
+	 * Message: You are in an area where you cannot cancel pet summoning.
+	 */
+	
 	/**
 	 * ID: 2276<br>
 	 * Message: The rebel army recaptured the fortress.
 	 */
 	public static final SystemMessageId NPCS_RECAPTURED_FORTRESS;
 	
+	/** 
+	 * ID: 2277<br>
+	 * Message: Party of $s1
+	 */
+	
+	/**
+	 * ID: 2278<br>
+	 * Message: Remaining Time $s1:$s2
+	 */
+	
+	/**
+	 * ID: 2279<br>
+	 * Message: You can no longer add a quest to the Quest Alterts.
+	 */
+	
+	/**
+	 * ID: 2280
+	 * Message: Damage is decreased because $c1 resisted $c2's magic.
+	 */
+	
+	/**
+	 * ID: 2281
+	 * Message: $c1 hit you for $s3 damage and hit your servitor for $s4.
+	 */
+	
+	/**
+	 * ID: 2282
+	 * Message: Leave Fantasy Isle.
+	 */
+	
 	/**
 	 * ID: 2283<br>
 	 * Message: You cannot transform while sitting.

+ 4 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/Logout.java

@@ -66,8 +66,11 @@ public final class Logout extends L2GameClientPacket
 			return;
 		}
 		
-		if(AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && !(player.isGM() && Config.GM_RESTART_FIGHTING))
+		if(AttackStanceTaskManager.getInstance().hasAttackStanceTask(player))
 		{
+			if (player.isGM() && Config.GM_RESTART_FIGHTING)
+				return;
+			
 			if (Config.DEBUG) _log.fine("Player " + player.getName() + " tried to logout while fighting");
 			
 			player.sendPacket(SystemMessageId.CANT_LOGOUT_WHILE_FIGHTING);

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestActionUse.java

@@ -1197,7 +1197,7 @@ public final class RequestActionUse extends L2GameClientPacket
 			return;
 		}
 		
-		if (AttackStanceTaskManager.getInstance().getAttackStanceTask(activeChar) || AttackStanceTaskManager.getInstance().getAttackStanceTask(player))
+		if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(activeChar) || AttackStanceTaskManager.getInstance().hasAttackStanceTask(player))
 		{
 			activeChar.sendPacket(SystemMessageId.COUPLE_ACTION_CANCELED);
 			return;

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestRecipeShopListSet.java

@@ -84,7 +84,7 @@ public final class RequestRecipeShopListSet extends L2GameClientPacket
 			return;
 		}
 		
-		if (AttackStanceTaskManager.getInstance().getAttackStanceTask(player) || player.isInDuel())
+		if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player) || player.isInDuel())
 		{
 			player.sendPacket(SystemMessageId.CANT_OPERATE_PRIVATE_STORE_DURING_COMBAT);
 			player.sendPacket(ActionFailed.STATIC_PACKET);

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java

@@ -79,7 +79,7 @@ public final class RequestRestart extends L2GameClientPacket
 			return;
 		}
 		
-		if (AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && !(player.isGM() && Config.GM_RESTART_FIGHTING))
+		if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player) && !(player.isGM() && Config.GM_RESTART_FIGHTING))
 		{
 			if (Config.DEBUG)
 				_log.fine("Player " + player.getName() + " tried to logout while fighting.");

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestStopPledgeWar.java

@@ -92,7 +92,7 @@ public final class RequestStopPledgeWar extends L2GameClientPacket
 		{
 			if (member == null || member.getPlayerInstance() == null)
 				continue;
-			if (AttackStanceTaskManager.getInstance().getAttackStanceTask(member.getPlayerInstance()))
+			if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(member.getPlayerInstance()))
 			{
 				player.sendPacket(SystemMessageId.CANT_STOP_CLAN_WAR_WHILE_IN_COMBAT);
 				return;

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/SetPrivateStoreListBuy.java

@@ -95,7 +95,7 @@ public final class SetPrivateStoreListBuy extends L2GameClientPacket
 			return;
 		}
 		
-		if (AttackStanceTaskManager.getInstance().getAttackStanceTask(player) || player.isInDuel())
+		if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player) || player.isInDuel())
 		{
 			player.sendPacket(SystemMessageId.CANT_OPERATE_PRIVATE_STORE_DURING_COMBAT);
 			player.sendPacket(new PrivateStoreManageListBuy(player));

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/SetPrivateStoreListSell.java

@@ -89,7 +89,7 @@ public class SetPrivateStoreListSell extends L2GameClientPacket
 			return;
 		}
 		
-		if (AttackStanceTaskManager.getInstance().getAttackStanceTask(player) || player.isInDuel())
+		if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player) || player.isInDuel())
 		{
 			player.sendPacket(SystemMessageId.CANT_OPERATE_PRIVATE_STORE_DURING_COMBAT);
 			player.sendPacket(new PrivateStoreManageListSell(player, _packageSale));

+ 1 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/taskmanager/AttackStanceTaskManager.java

@@ -80,11 +80,10 @@ public class AttackStanceTaskManager
 	
 	/**
 	 * Checks for attack stance task.<br>
-	 * TODO: Rename this method to hasAttackStanceTask.
 	 * @param actor the actor
 	 * @return {@code true} if the character has an attack stance task, {@code false} otherwise
 	 */
-	public boolean getAttackStanceTask(L2Character actor)
+	public boolean hasAttackStanceTask(L2Character actor)
 	{
 		if ((actor != null) && actor.isSummon())
 		{