From 80bb7051578e3690ee4aa79aedae2b693c42046f Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sat, 6 Feb 2021 21:19:03 +0000 Subject: [PATCH] Fixed probable NPE in useMagic. Contributed by Sahar. --- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- .../model/actor/instance/PlayerInstance.java | 19 ++++++++++++------- 17 files changed, 204 insertions(+), 119 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index e43bb1cde7..73855cdba9 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -53,6 +53,7 @@ import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.RecipeController; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8478,15 +8479,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 57ab3a0dc1..d23fe2ccea 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -53,6 +53,7 @@ import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.RecipeController; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8485,15 +8486,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index f3fcfe2fdb..7e609b0425 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -53,6 +53,7 @@ import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.RecipeController; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8487,15 +8488,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 5d3889fd48..3e501645d8 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -51,6 +51,7 @@ import org.l2jmobius.gameserver.GameTimeController; import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8482,15 +8483,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 7718d1b94a..13ad7bbe9c 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -51,6 +51,7 @@ import org.l2jmobius.gameserver.GameTimeController; import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8465,15 +8466,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index b8b196ef02..fa43a94182 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -51,6 +51,7 @@ import org.l2jmobius.gameserver.GameTimeController; import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8465,15 +8466,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index faa11e3243..40294c5c2c 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -51,6 +51,7 @@ import org.l2jmobius.gameserver.GameTimeController; import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8466,15 +8467,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 6f9f9a3e1a..c3f115c065 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -52,6 +52,7 @@ import org.l2jmobius.gameserver.GameTimeController; import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8474,15 +8475,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 0f88d4b2ac..496d434fc7 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -52,6 +52,7 @@ import org.l2jmobius.gameserver.GameTimeController; import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8502,15 +8503,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 93bca978d7..fe168964ed 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -52,6 +52,7 @@ import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.RecipeController; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8365,15 +8366,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 3964eb6a82..173075c8ed 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -52,6 +52,7 @@ import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.RecipeController; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8365,15 +8366,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 49c387063a..13100dbdec 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -52,6 +52,7 @@ import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.RecipeController; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8351,15 +8352,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 181e135d37..bdc4d156c7 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -53,6 +53,7 @@ import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.RecipeController; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8378,15 +8379,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 40d8a67906..2cef52490a 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -53,6 +53,7 @@ import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.RecipeController; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8378,15 +8379,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index e886cbb686..0add727e56 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -54,6 +54,7 @@ import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.RecipeController; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8322,15 +8323,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 8571bc1571..ebb8436d7d 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -52,6 +52,7 @@ import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.RecipeController; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8367,15 +8368,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index b681823d4a..8e24ce0392 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -54,6 +54,7 @@ import org.l2jmobius.gameserver.ItemsAutoDestroy; import org.l2jmobius.gameserver.LoginServerThread; import org.l2jmobius.gameserver.RecipeController; import org.l2jmobius.gameserver.ai.CreatureAI; +import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand; import org.l2jmobius.gameserver.ai.CtrlIntention; import org.l2jmobius.gameserver.ai.PlayerAI; import org.l2jmobius.gameserver.ai.SummonAI; @@ -8401,15 +8402,19 @@ public class PlayerInstance extends Playable sendPacket(ActionFailed.STATIC_PACKET); // Upon failed conditions, next action is called. - if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))) + if ((usedSkill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this)) { - if (usedSkill.getNextAction() == NextActionType.ATTACK) + final IntentionCommand nextIntention = getAI().getNextIntention(); + if ((nextIntention == null) || (nextIntention.getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) { - getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (usedSkill.getNextAction() == NextActionType.CAST) - { - getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + if (usedSkill.getNextAction() == NextActionType.ATTACK) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if (usedSkill.getNextAction() == NextActionType.CAST) + { + getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, usedSkill, target, item, false, false); + } } }