From 72204369301cd8c2881b130b64cfee11ec6903b0 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sat, 12 Jan 2019 01:18:01 +0000 Subject: [PATCH] Check for queued skill before next action. --- .../gameserver/model/skills/SkillCaster.java | 39 ++++++++----------- .../gameserver/model/skills/SkillCaster.java | 39 ++++++++----------- .../gameserver/model/skills/SkillCaster.java | 39 ++++++++----------- .../gameserver/model/skills/SkillCaster.java | 39 ++++++++----------- .../gameserver/model/skills/SkillCaster.java | 39 ++++++++----------- .../gameserver/model/skills/SkillCaster.java | 39 ++++++++----------- .../gameserver/model/skills/SkillCaster.java | 39 ++++++++----------- .../gameserver/model/skills/SkillCaster.java | 39 ++++++++----------- .../gameserver/model/skills/SkillCaster.java | 39 ++++++++----------- .../gameserver/model/skills/SkillCaster.java | 39 ++++++++----------- 10 files changed, 170 insertions(+), 220 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 6cdd30f74b..a40096636d 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -740,8 +740,23 @@ public class SkillCaster implements Runnable caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster } - // Attack target after skill use - // TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though. + // If there is a queued skill, launch it and wipe the queue. + if (caster.isPlayer()) + { + final L2PcInstance currPlayer = caster.getActingPlayer(); + final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); + if (queuedSkill != null) + { + ThreadPool.execute(() -> + { + currPlayer.setQueuedSkill(null, null, false, false); + currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + }); + return; + } + } + + // Attack target after skill use. if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) { if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) @@ -761,26 +776,6 @@ public class SkillCaster implements Runnable { caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); } - - // Notify the AI of the L2Character with EVT_FINISH_CASTING - - // If there is a queued skill, launch it and wipe the queue. - if (caster.isPlayer()) - { - final L2PcInstance currPlayer = caster.getActingPlayer(); - final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); - - if (queuedSkill != null) - { - ThreadPool.execute(() -> - { - currPlayer.setQueuedSkill(null, null, false, false); - currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); - }); - - return; - } - } } private void calcSkillTiming(L2Character creature, Skill skill) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 6cdd30f74b..a40096636d 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -740,8 +740,23 @@ public class SkillCaster implements Runnable caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster } - // Attack target after skill use - // TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though. + // If there is a queued skill, launch it and wipe the queue. + if (caster.isPlayer()) + { + final L2PcInstance currPlayer = caster.getActingPlayer(); + final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); + if (queuedSkill != null) + { + ThreadPool.execute(() -> + { + currPlayer.setQueuedSkill(null, null, false, false); + currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + }); + return; + } + } + + // Attack target after skill use. if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) { if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) @@ -761,26 +776,6 @@ public class SkillCaster implements Runnable { caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); } - - // Notify the AI of the L2Character with EVT_FINISH_CASTING - - // If there is a queued skill, launch it and wipe the queue. - if (caster.isPlayer()) - { - final L2PcInstance currPlayer = caster.getActingPlayer(); - final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); - - if (queuedSkill != null) - { - ThreadPool.execute(() -> - { - currPlayer.setQueuedSkill(null, null, false, false); - currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); - }); - - return; - } - } } private void calcSkillTiming(L2Character creature, Skill skill) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 6cdd30f74b..a40096636d 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -740,8 +740,23 @@ public class SkillCaster implements Runnable caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster } - // Attack target after skill use - // TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though. + // If there is a queued skill, launch it and wipe the queue. + if (caster.isPlayer()) + { + final L2PcInstance currPlayer = caster.getActingPlayer(); + final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); + if (queuedSkill != null) + { + ThreadPool.execute(() -> + { + currPlayer.setQueuedSkill(null, null, false, false); + currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + }); + return; + } + } + + // Attack target after skill use. if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) { if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) @@ -761,26 +776,6 @@ public class SkillCaster implements Runnable { caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); } - - // Notify the AI of the L2Character with EVT_FINISH_CASTING - - // If there is a queued skill, launch it and wipe the queue. - if (caster.isPlayer()) - { - final L2PcInstance currPlayer = caster.getActingPlayer(); - final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); - - if (queuedSkill != null) - { - ThreadPool.execute(() -> - { - currPlayer.setQueuedSkill(null, null, false, false); - currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); - }); - - return; - } - } } private void calcSkillTiming(L2Character creature, Skill skill) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 6cdd30f74b..a40096636d 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -740,8 +740,23 @@ public class SkillCaster implements Runnable caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster } - // Attack target after skill use - // TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though. + // If there is a queued skill, launch it and wipe the queue. + if (caster.isPlayer()) + { + final L2PcInstance currPlayer = caster.getActingPlayer(); + final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); + if (queuedSkill != null) + { + ThreadPool.execute(() -> + { + currPlayer.setQueuedSkill(null, null, false, false); + currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + }); + return; + } + } + + // Attack target after skill use. if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) { if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) @@ -761,26 +776,6 @@ public class SkillCaster implements Runnable { caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); } - - // Notify the AI of the L2Character with EVT_FINISH_CASTING - - // If there is a queued skill, launch it and wipe the queue. - if (caster.isPlayer()) - { - final L2PcInstance currPlayer = caster.getActingPlayer(); - final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); - - if (queuedSkill != null) - { - ThreadPool.execute(() -> - { - currPlayer.setQueuedSkill(null, null, false, false); - currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); - }); - - return; - } - } } private void calcSkillTiming(L2Character creature, Skill skill) diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 835370f217..8aa1107982 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -740,8 +740,23 @@ public class SkillCaster implements Runnable caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster } - // Attack target after skill use - // TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though. + // If there is a queued skill, launch it and wipe the queue. + if (caster.isPlayer()) + { + final L2PcInstance currPlayer = caster.getActingPlayer(); + final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); + if (queuedSkill != null) + { + ThreadPool.execute(() -> + { + currPlayer.setQueuedSkill(null, null, false, false); + currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + }); + return; + } + } + + // Attack target after skill use. if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) { if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) @@ -761,26 +776,6 @@ public class SkillCaster implements Runnable { caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); } - - // Notify the AI of the L2Character with EVT_FINISH_CASTING - - // If there is a queued skill, launch it and wipe the queue. - if (caster.isPlayer()) - { - final L2PcInstance currPlayer = caster.getActingPlayer(); - final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); - - if (queuedSkill != null) - { - ThreadPool.execute(() -> - { - currPlayer.setQueuedSkill(null, null, false, false); - currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); - }); - - return; - } - } } private void calcSkillTiming(L2Character creature, Skill skill) diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 835370f217..8aa1107982 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -740,8 +740,23 @@ public class SkillCaster implements Runnable caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster } - // Attack target after skill use - // TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though. + // If there is a queued skill, launch it and wipe the queue. + if (caster.isPlayer()) + { + final L2PcInstance currPlayer = caster.getActingPlayer(); + final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); + if (queuedSkill != null) + { + ThreadPool.execute(() -> + { + currPlayer.setQueuedSkill(null, null, false, false); + currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + }); + return; + } + } + + // Attack target after skill use. if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) { if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) @@ -761,26 +776,6 @@ public class SkillCaster implements Runnable { caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); } - - // Notify the AI of the L2Character with EVT_FINISH_CASTING - - // If there is a queued skill, launch it and wipe the queue. - if (caster.isPlayer()) - { - final L2PcInstance currPlayer = caster.getActingPlayer(); - final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); - - if (queuedSkill != null) - { - ThreadPool.execute(() -> - { - currPlayer.setQueuedSkill(null, null, false, false); - currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); - }); - - return; - } - } } private void calcSkillTiming(L2Character creature, Skill skill) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index b64ec7772d..f500b7e6ed 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -740,8 +740,23 @@ public class SkillCaster implements Runnable caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster } - // Attack target after skill use - // TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though. + // If there is a queued skill, launch it and wipe the queue. + if (caster.isPlayer()) + { + final L2PcInstance currPlayer = caster.getActingPlayer(); + final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); + if (queuedSkill != null) + { + ThreadPool.execute(() -> + { + currPlayer.setQueuedSkill(null, null, false, false); + currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + }); + return; + } + } + + // Attack target after skill use. if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) { if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) @@ -761,26 +776,6 @@ public class SkillCaster implements Runnable { caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); } - - // Notify the AI of the L2Character with EVT_FINISH_CASTING - - // If there is a queued skill, launch it and wipe the queue. - if (caster.isPlayer()) - { - final L2PcInstance currPlayer = caster.getActingPlayer(); - final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); - - if (queuedSkill != null) - { - ThreadPool.execute(() -> - { - currPlayer.setQueuedSkill(null, null, false, false); - currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); - }); - - return; - } - } } private void calcSkillTiming(L2Character creature, Skill skill) diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index b64ec7772d..f500b7e6ed 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -740,8 +740,23 @@ public class SkillCaster implements Runnable caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster } - // Attack target after skill use - // TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though. + // If there is a queued skill, launch it and wipe the queue. + if (caster.isPlayer()) + { + final L2PcInstance currPlayer = caster.getActingPlayer(); + final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); + if (queuedSkill != null) + { + ThreadPool.execute(() -> + { + currPlayer.setQueuedSkill(null, null, false, false); + currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + }); + return; + } + } + + // Attack target after skill use. if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) { if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) @@ -761,26 +776,6 @@ public class SkillCaster implements Runnable { caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); } - - // Notify the AI of the L2Character with EVT_FINISH_CASTING - - // If there is a queued skill, launch it and wipe the queue. - if (caster.isPlayer()) - { - final L2PcInstance currPlayer = caster.getActingPlayer(); - final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); - - if (queuedSkill != null) - { - ThreadPool.execute(() -> - { - currPlayer.setQueuedSkill(null, null, false, false); - currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); - }); - - return; - } - } } private void calcSkillTiming(L2Character creature, Skill skill) diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index b64ec7772d..f500b7e6ed 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -740,8 +740,23 @@ public class SkillCaster implements Runnable caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster } - // Attack target after skill use - // TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though. + // If there is a queued skill, launch it and wipe the queue. + if (caster.isPlayer()) + { + final L2PcInstance currPlayer = caster.getActingPlayer(); + final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); + if (queuedSkill != null) + { + ThreadPool.execute(() -> + { + currPlayer.setQueuedSkill(null, null, false, false); + currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + }); + return; + } + } + + // Attack target after skill use. if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) { if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) @@ -761,26 +776,6 @@ public class SkillCaster implements Runnable { caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); } - - // Notify the AI of the L2Character with EVT_FINISH_CASTING - - // If there is a queued skill, launch it and wipe the queue. - if (caster.isPlayer()) - { - final L2PcInstance currPlayer = caster.getActingPlayer(); - final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); - - if (queuedSkill != null) - { - ThreadPool.execute(() -> - { - currPlayer.setQueuedSkill(null, null, false, false); - currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); - }); - - return; - } - } } private void calcSkillTiming(L2Character creature, Skill skill) diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index b64ec7772d..f500b7e6ed 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -740,8 +740,23 @@ public class SkillCaster implements Runnable caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster } - // Attack target after skill use - // TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though. + // If there is a queued skill, launch it and wipe the queue. + if (caster.isPlayer()) + { + final L2PcInstance currPlayer = caster.getActingPlayer(); + final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); + if (queuedSkill != null) + { + ThreadPool.execute(() -> + { + currPlayer.setQueuedSkill(null, null, false, false); + currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + }); + return; + } + } + + // Attack target after skill use. if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) { if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) @@ -761,26 +776,6 @@ public class SkillCaster implements Runnable { caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); } - - // Notify the AI of the L2Character with EVT_FINISH_CASTING - - // If there is a queued skill, launch it and wipe the queue. - if (caster.isPlayer()) - { - final L2PcInstance currPlayer = caster.getActingPlayer(); - final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill(); - - if (queuedSkill != null) - { - ThreadPool.execute(() -> - { - currPlayer.setQueuedSkill(null, null, false, false); - currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); - }); - - return; - } - } } private void calcSkillTiming(L2Character creature, Skill skill)