New solution for attack movement issue.
This commit is contained in:
parent
b8b144c2ef
commit
a703c138e4
@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clientStopMoving(null);
|
||||||
_actor.doAutoAttack((L2Character) target);
|
_actor.doAutoAttack((L2Character) target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3167,13 +3167,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
*/
|
*/
|
||||||
public void moveToLocation(int x, int y, int z, int offset)
|
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
|
// Get the Move Speed of the L2Charcater
|
||||||
final double speed = getMoveSpeed();
|
final double speed = getMoveSpeed();
|
||||||
if ((speed <= 0) || isMovementDisabled())
|
if ((speed <= 0) || isMovementDisabled())
|
||||||
|
@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clientStopMoving(null);
|
||||||
_actor.doAutoAttack((L2Character) target);
|
_actor.doAutoAttack((L2Character) target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3167,13 +3167,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
*/
|
*/
|
||||||
public void moveToLocation(int x, int y, int z, int offset)
|
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
|
// Get the Move Speed of the L2Charcater
|
||||||
final double speed = getMoveSpeed();
|
final double speed = getMoveSpeed();
|
||||||
if ((speed <= 0) || isMovementDisabled())
|
if ((speed <= 0) || isMovementDisabled())
|
||||||
|
@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clientStopMoving(null);
|
||||||
_actor.doAutoAttack((L2Character) target);
|
_actor.doAutoAttack((L2Character) target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3167,13 +3167,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
*/
|
*/
|
||||||
public void moveToLocation(int x, int y, int z, int offset)
|
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
|
// Get the Move Speed of the L2Charcater
|
||||||
final double speed = getMoveSpeed();
|
final double speed = getMoveSpeed();
|
||||||
if ((speed <= 0) || isMovementDisabled())
|
if ((speed <= 0) || isMovementDisabled())
|
||||||
|
@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clientStopMoving(null);
|
||||||
_actor.doAutoAttack((L2Character) target);
|
_actor.doAutoAttack((L2Character) target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3167,13 +3167,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
*/
|
*/
|
||||||
public void moveToLocation(int x, int y, int z, int offset)
|
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
|
// Get the Move Speed of the L2Charcater
|
||||||
final double speed = getMoveSpeed();
|
final double speed = getMoveSpeed();
|
||||||
if ((speed <= 0) || isMovementDisabled())
|
if ((speed <= 0) || isMovementDisabled())
|
||||||
|
@ -23,13 +23,14 @@ import com.l2jmobius.gameserver.enums.InstanceType;
|
|||||||
import com.l2jmobius.gameserver.geoengine.GeoEngine;
|
import com.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import com.l2jmobius.gameserver.handler.IActionHandler;
|
import com.l2jmobius.gameserver.handler.IActionHandler;
|
||||||
import com.l2jmobius.gameserver.model.L2Object;
|
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.L2Npc;
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.entity.L2Event;
|
import com.l2jmobius.gameserver.model.entity.L2Event;
|
||||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
import com.l2jmobius.gameserver.model.events.EventType;
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcFirstTalk;
|
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcFirstTalk;
|
||||||
|
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.MoveToPawn;
|
import com.l2jmobius.gameserver.network.serverpackets.MoveToPawn;
|
||||||
|
|
||||||
public class L2NpcAction implements IActionHandler
|
public class L2NpcAction implements IActionHandler
|
||||||
@ -80,16 +81,18 @@ public class L2NpcAction implements IActionHandler
|
|||||||
else if (interact)
|
else if (interact)
|
||||||
{
|
{
|
||||||
// Check if the activeChar is attackable (without a forced attack) and isn't dead
|
// 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))
|
if (GeoEngine.getInstance().canSeeTarget(activeChar, target))
|
||||||
{
|
{
|
||||||
|
// Set the L2PcInstance Intention to AI_INTENTION_ATTACK
|
||||||
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), target.getX(), target.getY(), target.getZ(), activeChar.getInstanceId());
|
// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
|
||||||
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
|
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!target.isAutoAttackable(activeChar))
|
else if (!target.isAutoAttackable(activeChar))
|
||||||
|
@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
|||||||
import com.l2jmobius.gameserver.geoengine.GeoEngine;
|
import com.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
import com.l2jmobius.gameserver.handler.IActionHandler;
|
import com.l2jmobius.gameserver.handler.IActionHandler;
|
||||||
import com.l2jmobius.gameserver.model.L2Object;
|
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.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.entity.TvTEvent;
|
import com.l2jmobius.gameserver.model.entity.TvTEvent;
|
||||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||||
@ -105,13 +104,8 @@ public class L2PcInstanceAction implements IActionHandler
|
|||||||
if (GeoEngine.getInstance().canSeeTarget(activeChar, player))
|
if (GeoEngine.getInstance().canSeeTarget(activeChar, player))
|
||||||
{
|
{
|
||||||
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, 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
|
else
|
||||||
@ -122,11 +116,6 @@ public class L2PcInstanceAction implements IActionHandler
|
|||||||
{
|
{
|
||||||
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,12 +72,9 @@ public class L2SummonAction implements IActionHandler
|
|||||||
{
|
{
|
||||||
activeChar.updateNotMoveUntil();
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4185,13 +4185,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
*/
|
*/
|
||||||
public void moveToLocation(int x, int y, int z, int offset)
|
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
|
// Get the Move Speed of the L2Charcater
|
||||||
final double speed = getMoveSpeed();
|
final double speed = getMoveSpeed();
|
||||||
if ((speed <= 0) || isMovementDisabled())
|
if ((speed <= 0) || isMovementDisabled())
|
||||||
|
@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clientStopMoving(null);
|
||||||
_actor.doAutoAttack((L2Character) target);
|
_actor.doAutoAttack((L2Character) target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3167,13 +3167,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
*/
|
*/
|
||||||
public void moveToLocation(int x, int y, int z, int offset)
|
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
|
// Get the Move Speed of the L2Charcater
|
||||||
final double speed = getMoveSpeed();
|
final double speed = getMoveSpeed();
|
||||||
if ((speed <= 0) || isMovementDisabled())
|
if ((speed <= 0) || isMovementDisabled())
|
||||||
|
@ -262,6 +262,7 @@ public class L2PlayerAI extends L2PlayableAI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clientStopMoving(null);
|
||||||
_actor.doAutoAttack((L2Character) target);
|
_actor.doAutoAttack((L2Character) target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3167,13 +3167,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
|||||||
*/
|
*/
|
||||||
public void moveToLocation(int x, int y, int z, int offset)
|
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
|
// Get the Move Speed of the L2Charcater
|
||||||
final double speed = getMoveSpeed();
|
final double speed = getMoveSpeed();
|
||||||
if ((speed <= 0) || isMovementDisabled())
|
if ((speed <= 0) || isMovementDisabled())
|
||||||
|
Loading…
Reference in New Issue
Block a user