All pastes #751834 Raw Edit

Miscellany

public text v1 · immutable
#751834 ·published 2007-10-27 19:34 UTC
rendered paste body
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 1273)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -2312,6 +2313,13 @@
 	}
 
 	/**
+	 * Set _waitTypeSitting to given value
+	 */
+	public void setIsSitting(boolean state)
+	{
+		_waitTypeSitting = state;
+	}
+	/**
 	 * Sit down the L2PcInstance, set the AI Intention to AI_INTENTION_REST and send a Server->Client ChangeWaitType packet (broadcast)<BR><BR>
 	 */
 	public void sitDown()
@@ -2326,13 +2334,46 @@
 		{
 			breakAttack();
 
-			_waitTypeSitting = true;
-			getAI().setIntention(CtrlIntention.AI_INTENTION_REST);
 			broadcastPacket(new ChangeWaitType (this, ChangeWaitType.WT_SITTING));
+			// Schedule a sit down task to wait for the animation to finish
+			ThreadPoolManager.getInstance().scheduleGeneral(new SitDownTask(this), 2500);
+			setIsParalyzed(true);
 		}
 	}
-
 	/**
+	 * Sit down Task
+	 */
+	class SitDownTask implements Runnable
+	{
+		L2PcInstance _player;
+		SitDownTask(L2PcInstance player)
+		{
+			_player = player;
+		}
+		public void run()
+		{	
+			setIsSitting(true);
+			_player.setIsParalyzed(false);
+			_player.getAI().setIntention(CtrlIntention.AI_INTENTION_REST);
+		}
+	}
+	/**
+	 * Stand up Task
+	 */
+	class StandUpTask implements Runnable
+	{
+		L2PcInstance _player;
+		StandUpTask(L2PcInstance player)
+		{
+			_player = player;
+		}
+		public void run()
+		{
+			_player.setIsSitting(false);
+			_player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+		}
+	}
+	/**
 	 * Stand up the L2PcInstance, set the AI Intention to AI_INTENTION_IDLE and send a Server->Client ChangeWaitType packet (broadcast)<BR><BR>
 	 */
 	public void standUp()
@@ -2349,9 +2390,9 @@
 				stopEffects(L2Effect.EffectType.RELAXING);
 			}
 
-			_waitTypeSitting = false;
-			getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
 			broadcastPacket(new ChangeWaitType (this, ChangeWaitType.WT_STANDING));
+			// Schedule a stand up task to wait for the animation to finish
+			ThreadPoolManager.getInstance().scheduleGeneral(new StandUpTask(this), 2500);
 		}
 	}
 

Index: java/net/sf/l2j/gameserver/clientpackets/RequestActionUse.java
===================================================================
--- java/net/sf/l2j/gameserver/clientpackets/RequestActionUse.java	(revision 1273)
+++ java/net/sf/l2j/gameserver/clientpackets/RequestActionUse.java	(working copy)
@@ -122,7 +122,7 @@
 				activeChar.sitDown();
 
 			if (Config.DEBUG) 
-				_log.fine("new wait type: "+(activeChar.isSitting() ? "STANDING" : "SITTING"));
+				_log.fine("new wait type: "+(activeChar.isSitting() ? "SITTING" : "STANDING"));
 
 			break;
 		case 1: