Addition of ranged attack enable task.
This commit is contained in:
		| @@ -258,6 +258,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe | ||||
| 	// set by the start of attack, in game ticks | ||||
| 	private volatile long _attackEndTime; | ||||
| 	private volatile long _disableRangedAttackEndTime; | ||||
| 	private volatile ScheduledFuture<?> _enableRangedAttackTask; | ||||
| 	 | ||||
| 	private CreatureAI _ai = null; | ||||
| 	 | ||||
| @@ -1015,7 +1016,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe | ||||
| 					{ | ||||
| 						if (isPlayer()) | ||||
| 						{ | ||||
| 							ThreadPool.schedule(new NotifyAITask(this, CtrlEvent.EVT_READY_TO_ACT), 1000); | ||||
| 							if ((_enableRangedAttackTask == null) || _enableRangedAttackTask.isDone() || _enableRangedAttackTask.isCancelled()) | ||||
| 							{ | ||||
| 								_enableRangedAttackTask = ThreadPool.schedule(() -> | ||||
| 								{ | ||||
| 									new NotifyAITask(this, CtrlEvent.EVT_READY_TO_ACT); | ||||
| 									_enableRangedAttackTask = null; | ||||
| 								}, 300); | ||||
| 							} | ||||
| 							sendPacket(ActionFailed.STATIC_PACKET); | ||||
| 						} | ||||
| 						return; | ||||
| @@ -1054,7 +1062,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe | ||||
| 						if (_status.getCurrentMp() < mpConsume) | ||||
| 						{ | ||||
| 							// If PlayerInstance doesn't have enough MP, stop the attack | ||||
| 							ThreadPool.schedule(new NotifyAITask(this, CtrlEvent.EVT_READY_TO_ACT), 1000); | ||||
| 							if ((_enableRangedAttackTask == null) || _enableRangedAttackTask.isDone() || _enableRangedAttackTask.isCancelled()) | ||||
| 							{ | ||||
| 								_enableRangedAttackTask = ThreadPool.schedule(() -> | ||||
| 								{ | ||||
| 									new NotifyAITask(this, CtrlEvent.EVT_READY_TO_ACT); | ||||
| 									_enableRangedAttackTask = null; | ||||
| 								}, 1000); | ||||
| 							} | ||||
| 							sendPacket(SystemMessageId.NOT_ENOUGH_MP); | ||||
| 							sendPacket(ActionFailed.STATIC_PACKET); | ||||
| 							return; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment