Fixed getting stuck upon attacking.

Contributed by G-hamsteR.
This commit is contained in:
MobiusDevelopment 2020-08-25 17:22:38 +00:00
parent 0e87341023
commit 40d5656846
4 changed files with 54 additions and 54 deletions

View File

@ -306,7 +306,7 @@ public class CreatureAI extends AbstractAI
return;
}
if ((_actor instanceof PlayerInstance) && (_actor.isAttackingNow() || _actor.isCastingNow()) && !_actor.isMoving())
if (_actor.isPlayer() && _actor.isCastingNow() && !_actor.isMoving())
{
// Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor
clientActionFailed();
@ -320,7 +320,7 @@ public class CreatureAI extends AbstractAI
clientStopAutoAttack();
// Abort the attack of the Creature and send Server->Client ActionFailed packet
if (_actor instanceof PlayerInstance)
if (_actor.isPlayer())
{
final ItemInstance rhand = ((PlayerInstance) _actor).getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
if (((rhand != null) && (rhand.getItemType() == WeaponType.BOW)))

View File

@ -5449,37 +5449,37 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
protected void moveToLocation(int xValue, int yValue, int zValue, int offsetValue)
{
// Block movement during Event start
if (this instanceof PlayerInstance)
if (isPlayer())
{
if (GameEvent.active && ((PlayerInstance) this).eventSitForced)
if (GameEvent.active && getActingPlayer().eventSitForced)
{
((PlayerInstance) this).sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
((PlayerInstance) this).getClient().sendPacket(ActionFailed.STATIC_PACKET);
getActingPlayer().sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
getActingPlayer().getClient().sendPacket(ActionFailed.STATIC_PACKET);
return;
}
else if ((TvT.isSitForced() && ((PlayerInstance) this)._inEventTvT) || (CTF.isSitForced() && ((PlayerInstance) this)._inEventCTF) || (DM.isSitForced() && ((PlayerInstance) this)._inEventDM))
else if ((TvT.isSitForced() && getActingPlayer()._inEventTvT) || (CTF.isSitForced() && getActingPlayer()._inEventCTF) || (DM.isSitForced() && getActingPlayer()._inEventDM))
{
((PlayerInstance) this).sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
((PlayerInstance) this).getClient().sendPacket(ActionFailed.STATIC_PACKET);
getActingPlayer().sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
getActingPlayer().getClient().sendPacket(ActionFailed.STATIC_PACKET);
return;
}
else if (VIP._sitForced && ((PlayerInstance) this)._inEventVIP)
else if (VIP._sitForced && getActingPlayer()._inEventVIP)
{
((PlayerInstance) this).sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
((PlayerInstance) this).sendPacket(ActionFailed.STATIC_PACKET);
getActingPlayer().sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
getActingPlayer().sendPacket(ActionFailed.STATIC_PACKET);
return;
}
}
// Fix archer bug with movement/hittask
if ((this instanceof PlayerInstance) && isAttackingNow())
if (isAttackingNow())
{
final ItemInstance rhand = ((PlayerInstance) this).getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
final ItemInstance rhand = getActingPlayer().getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
if (((rhand != null) && (rhand.getItemType() == WeaponType.BOW)))
{
return;
}
}
}
// Get the Move Speed of the Creature
final float speed = getStat().getMoveSpeed();
@ -5587,9 +5587,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
// GEODATA MOVEMENT CHECKS AND PATHFINDING
m.onGeodataPathIndex = -1; // Initialize not on geodata path
m.disregardingGeodata = false;
if (!_isFlying && !isInWater && !(this instanceof BoatInstance) && !(this instanceof NpcWalkerInstance) && !_cursorKeyMovement)
if (!_isFlying && !isInWater && !isBoat() && !(this instanceof NpcWalkerInstance) && !_cursorKeyMovement)
{
final boolean isInBoat = (this instanceof PlayerInstance) && ((PlayerInstance) this).isInBoat();
final boolean isInBoat = isPlayer() && getActingPlayer().isInBoat();
if (isInBoat)
{
m.disregardingGeodata = true;
@ -5625,11 +5625,11 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
{
LOGGER.warning("Character " + getName() + " outside world area, in coordinates x:" + curX + " y:" + curY);
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
if (this instanceof PlayerInstance)
if (isPlayer())
{
((PlayerInstance) this).deleteMe();
getActingPlayer().deleteMe();
}
else if (this instanceof Summon)
else if (isSummon())
{
return;
}
@ -5691,9 +5691,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
}
// If no distance to go through, the movement is cancelled
if ((distance < 1) && (Config.PATHFINDING || (this instanceof Playable) || _isAfraid || (this instanceof RiftInvaderInstance)))
if ((distance < 1) && (Config.PATHFINDING || isPlayable() || _isAfraid || (this instanceof RiftInvaderInstance)))
{
if (this instanceof Summon)
if (isSummon())
{
// Do not break following owner.
if (getAI().getFollowTarget() != getActingPlayer())

View File

@ -306,7 +306,7 @@ public class CreatureAI extends AbstractAI
return;
}
if ((_actor instanceof PlayerInstance) && (_actor.isAttackingNow() || _actor.isCastingNow()) && !_actor.isMoving())
if (_actor.isPlayer() && _actor.isCastingNow() && !_actor.isMoving())
{
// Cancel action client side by sending Server->Client packet ActionFailed to the PlayerInstance actor
clientActionFailed();
@ -320,7 +320,7 @@ public class CreatureAI extends AbstractAI
clientStopAutoAttack();
// Abort the attack of the Creature and send Server->Client ActionFailed packet
if (_actor instanceof PlayerInstance)
if (_actor.isPlayer())
{
final ItemInstance rhand = ((PlayerInstance) _actor).getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
if (((rhand != null) && (rhand.getItemType() == WeaponType.BOW)))

View File

@ -5497,37 +5497,37 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
protected void moveToLocation(int xValue, int yValue, int zValue, int offsetValue)
{
// Block movement during Event start
if (this instanceof PlayerInstance)
if (isPlayer())
{
if (GameEvent.active && ((PlayerInstance) this).eventSitForced)
if (GameEvent.active && getActingPlayer().eventSitForced)
{
((PlayerInstance) this).sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
((PlayerInstance) this).getClient().sendPacket(ActionFailed.STATIC_PACKET);
getActingPlayer().sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
getActingPlayer().getClient().sendPacket(ActionFailed.STATIC_PACKET);
return;
}
else if ((TvT.isSitForced() && ((PlayerInstance) this)._inEventTvT) || (CTF.isSitForced() && ((PlayerInstance) this)._inEventCTF) || (DM.isSitForced() && ((PlayerInstance) this)._inEventDM))
else if ((TvT.isSitForced() && getActingPlayer()._inEventTvT) || (CTF.isSitForced() && getActingPlayer()._inEventCTF) || (DM.isSitForced() && getActingPlayer()._inEventDM))
{
((PlayerInstance) this).sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
((PlayerInstance) this).getClient().sendPacket(ActionFailed.STATIC_PACKET);
getActingPlayer().sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
getActingPlayer().getClient().sendPacket(ActionFailed.STATIC_PACKET);
return;
}
else if (VIP._sitForced && ((PlayerInstance) this)._inEventVIP)
else if (VIP._sitForced && getActingPlayer()._inEventVIP)
{
((PlayerInstance) this).sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
((PlayerInstance) this).sendPacket(ActionFailed.STATIC_PACKET);
getActingPlayer().sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up...");
getActingPlayer().sendPacket(ActionFailed.STATIC_PACKET);
return;
}
}
// Fix archer bug with movement/hittask
if ((this instanceof PlayerInstance) && isAttackingNow())
if (isAttackingNow())
{
final ItemInstance rhand = ((PlayerInstance) this).getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
final ItemInstance rhand = getActingPlayer().getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
if (((rhand != null) && (rhand.getItemType() == WeaponType.BOW)))
{
return;
}
}
}
// Get the Move Speed of the Creature
final float speed = getStat().getMoveSpeed();
@ -5635,9 +5635,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
// GEODATA MOVEMENT CHECKS AND PATHFINDING
m.onGeodataPathIndex = -1; // Initialize not on geodata path
m.disregardingGeodata = false;
if (!_isFlying && !isInWater && !(this instanceof BoatInstance) && !(this instanceof NpcWalkerInstance) && !_cursorKeyMovement)
if (!_isFlying && !isInWater && !isBoat() && !(this instanceof NpcWalkerInstance) && !_cursorKeyMovement)
{
final boolean isInBoat = (this instanceof PlayerInstance) && ((PlayerInstance) this).isInBoat();
final boolean isInBoat = isPlayer() && getActingPlayer().isInBoat();
if (isInBoat)
{
m.disregardingGeodata = true;
@ -5673,11 +5673,11 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
{
LOGGER.warning("Character " + getName() + " outside world area, in coordinates x:" + curX + " y:" + curY);
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
if (this instanceof PlayerInstance)
if (isPlayer())
{
((PlayerInstance) this).deleteMe();
getActingPlayer().deleteMe();
}
else if (this instanceof Summon)
else if (isSummon())
{
return;
}
@ -5739,9 +5739,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
}
// If no distance to go through, the movement is cancelled
if ((distance < 1) && (Config.PATHFINDING || (this instanceof Playable) || _isAfraid || (this instanceof RiftInvaderInstance)))
if ((distance < 1) && (Config.PATHFINDING || isPlayable() || _isAfraid || (this instanceof RiftInvaderInstance)))
{
if (this instanceof Summon)
if (isSummon())
{
// Do not break following owner.
if (getAI().getFollowTarget() != getActingPlayer())