From a703c138e447ac569f354e7d5e0e6dd649b204c5 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 25 Apr 2018 11:56:56 +0000 Subject: [PATCH] New solution for attack movement issue. --- .../com/l2jmobius/gameserver/ai/L2PlayerAI.java | 1 + .../gameserver/model/actor/L2Character.java | 7 ------- .../com/l2jmobius/gameserver/ai/L2PlayerAI.java | 1 + .../gameserver/model/actor/L2Character.java | 7 ------- .../com/l2jmobius/gameserver/ai/L2PlayerAI.java | 1 + .../gameserver/model/actor/L2Character.java | 7 ------- .../com/l2jmobius/gameserver/ai/L2PlayerAI.java | 1 + .../gameserver/model/actor/L2Character.java | 7 ------- .../handlers/actionhandlers/L2NpcAction.java | 11 +++++++---- .../handlers/actionhandlers/L2PcInstanceAction.java | 13 +------------ .../handlers/actionhandlers/L2SummonAction.java | 7 ++----- .../gameserver/model/actor/L2Character.java | 7 ------- .../com/l2jmobius/gameserver/ai/L2PlayerAI.java | 1 + .../gameserver/model/actor/L2Character.java | 7 ------- .../com/l2jmobius/gameserver/ai/L2PlayerAI.java | 1 + .../gameserver/model/actor/L2Character.java | 7 ------- 16 files changed, 16 insertions(+), 70 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java index 74f117ed00..0d7b8146bd 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java @@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI return; } + clientStopMoving(null); _actor.doAutoAttack((L2Character) target); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java index e6b65b094f..c9ad1dcf42 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3167,13 +3167,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe */ public void moveToLocation(int x, int y, int z, int offset) { - // Do not move while character is attacking or casting. - // Fixes player attack glitch while target is moving. - if (isAttackingNow() || isCastingNow()) - { - return; - } - // Get the Move Speed of the L2Charcater final double speed = getMoveSpeed(); if ((speed <= 0) || isMovementDisabled()) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java index 74f117ed00..0d7b8146bd 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java @@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI return; } + clientStopMoving(null); _actor.doAutoAttack((L2Character) target); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java index e6b65b094f..c9ad1dcf42 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3167,13 +3167,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe */ public void moveToLocation(int x, int y, int z, int offset) { - // Do not move while character is attacking or casting. - // Fixes player attack glitch while target is moving. - if (isAttackingNow() || isCastingNow()) - { - return; - } - // Get the Move Speed of the L2Charcater final double speed = getMoveSpeed(); if ((speed <= 0) || isMovementDisabled()) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java index 74f117ed00..0d7b8146bd 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java @@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI return; } + clientStopMoving(null); _actor.doAutoAttack((L2Character) target); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java index e6b65b094f..c9ad1dcf42 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3167,13 +3167,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe */ public void moveToLocation(int x, int y, int z, int offset) { - // Do not move while character is attacking or casting. - // Fixes player attack glitch while target is moving. - if (isAttackingNow() || isCastingNow()) - { - return; - } - // Get the Move Speed of the L2Charcater final double speed = getMoveSpeed(); if ((speed <= 0) || isMovementDisabled()) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java index 74f117ed00..0d7b8146bd 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java @@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI return; } + clientStopMoving(null); _actor.doAutoAttack((L2Character) target); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Character.java index e6b65b094f..c9ad1dcf42 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3167,13 +3167,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe */ public void moveToLocation(int x, int y, int z, int offset) { - // Do not move while character is attacking or casting. - // Fixes player attack glitch while target is moving. - if (isAttackingNow() || isCastingNow()) - { - return; - } - // Get the Move Speed of the L2Charcater final double speed = getMoveSpeed(); if ((speed <= 0) || isMovementDisabled()) diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/L2NpcAction.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/L2NpcAction.java index e783ea8ac1..a99fc06998 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/L2NpcAction.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/L2NpcAction.java @@ -23,13 +23,14 @@ import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IActionHandler; import com.l2jmobius.gameserver.model.L2Object; -import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.entity.L2Event; import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcFirstTalk; +import com.l2jmobius.gameserver.network.serverpackets.ActionFailed; import com.l2jmobius.gameserver.network.serverpackets.MoveToPawn; public class L2NpcAction implements IActionHandler @@ -80,16 +81,18 @@ public class L2NpcAction implements IActionHandler else if (interact) { // Check if the activeChar is attackable (without a forced attack) and isn't dead - if (target.isAutoAttackable(activeChar) && !((L2Npc) target).isAlikeDead()) + if (target.isAutoAttackable(activeChar) && !((L2Character) target).isAlikeDead()) { + // Check if target is in LoS if (GeoEngine.getInstance().canSeeTarget(activeChar, target)) { + // Set the L2PcInstance Intention to AI_INTENTION_ATTACK activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); } else { - final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), target.getX(), target.getY(), target.getZ(), activeChar.getInstanceId()); - activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination); + // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet + activeChar.sendPacket(ActionFailed.STATIC_PACKET); } } else if (!target.isAutoAttackable(activeChar)) diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/L2PcInstanceAction.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/L2PcInstanceAction.java index 5ee9cd39a4..12791f6dd1 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/L2PcInstanceAction.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/L2PcInstanceAction.java @@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.enums.PrivateStoreType; import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IActionHandler; import com.l2jmobius.gameserver.model.L2Object; -import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.entity.TvTEvent; import com.l2jmobius.gameserver.network.SystemMessageId; @@ -105,13 +104,8 @@ public class L2PcInstanceAction implements IActionHandler if (GeoEngine.getInstance().canSeeTarget(activeChar, player)) { activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); + activeChar.onActionRequest(); } - else - { - final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), player.getX(), player.getY(), player.getZ(), activeChar.getInstanceId()); - activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination); - } - activeChar.onActionRequest(); } } else @@ -122,11 +116,6 @@ public class L2PcInstanceAction implements IActionHandler { activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); } - else - { - final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), player.getX(), player.getY(), player.getZ(), activeChar.getInstanceId()); - activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination); - } } } } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/L2SummonAction.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/L2SummonAction.java index 486ac079e7..f50149560d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/L2SummonAction.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionhandlers/L2SummonAction.java @@ -72,12 +72,9 @@ public class L2SummonAction implements IActionHandler { activeChar.updateNotMoveUntil(); } - else + else if (GeoEngine.getInstance().canSeeTarget(activeChar, target)) { - if (GeoEngine.getInstance().canSeeTarget(activeChar, target)) - { - activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, target); - } + activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, target); } } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java index 6156917404..fdf135394f 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -4185,13 +4185,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe */ public void moveToLocation(int x, int y, int z, int offset) { - // Do not move while character is attacking or casting. - // Fixes player attack glitch while target is moving. - if (isAttackingNow() || isCastingNow()) - { - return; - } - // Get the Move Speed of the L2Charcater final double speed = getMoveSpeed(); if ((speed <= 0) || isMovementDisabled()) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java index 74f117ed00..0d7b8146bd 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java @@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI return; } + clientStopMoving(null); _actor.doAutoAttack((L2Character) target); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java index e6b65b094f..c9ad1dcf42 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3167,13 +3167,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe */ public void moveToLocation(int x, int y, int z, int offset) { - // Do not move while character is attacking or casting. - // Fixes player attack glitch while target is moving. - if (isAttackingNow() || isCastingNow()) - { - return; - } - // Get the Move Speed of the L2Charcater final double speed = getMoveSpeed(); if ((speed <= 0) || isMovementDisabled()) diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java index 74f117ed00..0d7b8146bd 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java @@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI return; } + clientStopMoving(null); _actor.doAutoAttack((L2Character) target); } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Character.java index e6b65b094f..c9ad1dcf42 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3167,13 +3167,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe */ public void moveToLocation(int x, int y, int z, int offset) { - // Do not move while character is attacking or casting. - // Fixes player attack glitch while target is moving. - if (isAttackingNow() || isCastingNow()) - { - return; - } - // Get the Move Speed of the L2Charcater final double speed = getMoveSpeed(); if ((speed <= 0) || isMovementDisabled())