New solution for attack movement issue.

This commit is contained in:
MobiusDev 2018-04-25 11:56:56 +00:00
parent b8b144c2ef
commit a703c138e4
16 changed files with 16 additions and 70 deletions

View File

@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI
return;
}
clientStopMoving(null);
_actor.doAutoAttack((L2Character) target);
}

View File

@ -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())

View File

@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI
return;
}
clientStopMoving(null);
_actor.doAutoAttack((L2Character) target);
}

View File

@ -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())

View File

@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI
return;
}
clientStopMoving(null);
_actor.doAutoAttack((L2Character) target);
}

View File

@ -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())

View File

@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI
return;
}
clientStopMoving(null);
_actor.doAutoAttack((L2Character) target);
}

View File

@ -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())

View File

@ -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))

View File

@ -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);
}
}
}
}

View File

@ -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);
}
}
}

View File

@ -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())

View File

@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI
return;
}
clientStopMoving(null);
_actor.doAutoAttack((L2Character) target);
}

View File

@ -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())

View File

@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI
return;
}
clientStopMoving(null);
_actor.doAutoAttack((L2Character) target);
}

View File

@ -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())