Fixed bow animation when trying to move while hitting.

Contributed by G-hamsteR.
This commit is contained in:
MobiusDevelopment
2020-08-26 10:03:45 +00:00
parent 40d5656846
commit fed7650ed1
2 changed files with 30 additions and 30 deletions

View File

@@ -306,23 +306,20 @@ public class CreatureAI extends AbstractAI
return; return;
} }
if (_actor.isPlayer() && _actor.isCastingNow() && !_actor.isMoving()) if ((_actor.isPlayer()))
{
// Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor
clientActionFailed();
return;
}
// Set the Intention of this AbstractAI to AI_INTENTION_MOVE_TO
changeIntention(AI_INTENTION_MOVE_TO, pos, null);
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack();
// Abort the attack of the Creature and send Server->Client ActionFailed packet
if (_actor.isPlayer())
{ {
final ItemInstance rhand = ((PlayerInstance) _actor).getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND); final ItemInstance rhand = ((PlayerInstance) _actor).getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
if ((_actor.isAttackingNow() && (rhand != null) && (rhand.getItemType() == WeaponType.BOW)) || (_actor.isCastingNow() && !_actor.isMoving()))
{
clientActionFailed();
return;
}
changeIntention(AI_INTENTION_MOVE_TO, pos, null);
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack();
if (((rhand != null) && (rhand.getItemType() == WeaponType.BOW))) if (((rhand != null) && (rhand.getItemType() == WeaponType.BOW)))
{ {
if (!_actor.isAttackingNow()) if (!_actor.isAttackingNow())
@@ -337,6 +334,9 @@ public class CreatureAI extends AbstractAI
} }
else // case Npc else // case Npc
{ {
changeIntention(AI_INTENTION_MOVE_TO, pos, null);
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack();
_actor.abortAttack(); _actor.abortAttack();
} }

View File

@@ -306,23 +306,20 @@ public class CreatureAI extends AbstractAI
return; return;
} }
if (_actor.isPlayer() && _actor.isCastingNow() && !_actor.isMoving()) if ((_actor.isPlayer()))
{
// Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor
clientActionFailed();
return;
}
// Set the Intention of this AbstractAI to AI_INTENTION_MOVE_TO
changeIntention(AI_INTENTION_MOVE_TO, pos, null);
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack();
// Abort the attack of the Creature and send Server->Client ActionFailed packet
if (_actor.isPlayer())
{ {
final ItemInstance rhand = ((PlayerInstance) _actor).getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND); final ItemInstance rhand = ((PlayerInstance) _actor).getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
if ((_actor.isAttackingNow() && (rhand != null) && (rhand.getItemType() == WeaponType.BOW)) || (_actor.isCastingNow() && !_actor.isMoving()))
{
clientActionFailed();
return;
}
changeIntention(AI_INTENTION_MOVE_TO, pos, null);
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack();
if (((rhand != null) && (rhand.getItemType() == WeaponType.BOW))) if (((rhand != null) && (rhand.getItemType() == WeaponType.BOW)))
{ {
if (!_actor.isAttackingNow()) if (!_actor.isAttackingNow())
@@ -337,6 +334,9 @@ public class CreatureAI extends AbstractAI
} }
else // case Npc else // case Npc
{ {
changeIntention(AI_INTENTION_MOVE_TO, pos, null);
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
clientStopAutoAttack();
_actor.abortAttack(); _actor.abortAttack();
} }