Attackables should be able to see and move to target.

This commit is contained in:
MobiusDevelopment
2021-03-28 21:49:55 +00:00
parent 061bc41de8
commit 94700077b3
46 changed files with 301 additions and 125 deletions

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -479,15 +479,12 @@ abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_accessor.moveTo(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _accessor.moveTo(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
// Mobius: Solves moving to wrong Z when not using geodata, // May result to make monsters stop moving.
// but probably is not accurate and you should use geodata. // if (!_actor.isMoving())
// _accessor.moveTo(pawn.getX(), pawn.getY(), _actor.getZ(), offset); // {
// _actor.sendPacket(ActionFailed.STATIC_PACKET);
if (!_actor.isMoving()) // return;
{ // }
_actor.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn instanceof Creature) if (pawn instanceof Creature)

View File

@@ -667,8 +667,8 @@ public class AttackableAI extends CreatureAI
} }
} }
final Creature originalAttackTarget = getAttackTarget();
// Check if target is dead or if timeout is expired to stop this attack // Check if target is dead or if timeout is expired to stop this attack
final Creature originalAttackTarget = getAttackTarget();
if ((originalAttackTarget == null) || originalAttackTarget.isAlikeDead() || ((originalAttackTarget instanceof PlayerInstance) && (((PlayerInstance) originalAttackTarget).isInOfflineMode() || !((PlayerInstance) originalAttackTarget).isOnline())) || (_attackTimeout < GameTimeController.getGameTicks())) if ((originalAttackTarget == null) || originalAttackTarget.isAlikeDead() || ((originalAttackTarget instanceof PlayerInstance) && (((PlayerInstance) originalAttackTarget).isInOfflineMode() || !((PlayerInstance) originalAttackTarget).isOnline())) || (_attackTimeout < GameTimeController.getGameTicks()))
{ {
// Stop hating this target after the attack timeout or if target is dead // Stop hating this target after the attack timeout or if target is dead
@@ -684,6 +684,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, originalAttackTarget))
{
moveTo(originalAttackTarget.getX(), originalAttackTarget.getY(), originalAttackTarget.getZ());
return;
}
// Call all WorldObject of its Faction inside the Faction Range // Call all WorldObject of its Faction inside the Faction Range
if (((NpcInstance) _actor).getFactionId() != null) if (((NpcInstance) _actor).getFactionId() != null)
{ {

View File

@@ -479,15 +479,12 @@ abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_accessor.moveTo(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _accessor.moveTo(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
// Mobius: Solves moving to wrong Z when not using geodata, // May result to make monsters stop moving.
// but probably is not accurate and you should use geodata. // if (!_actor.isMoving())
// _accessor.moveTo(pawn.getX(), pawn.getY(), _actor.getZ(), offset); // {
// _actor.sendPacket(ActionFailed.STATIC_PACKET);
if (!_actor.isMoving()) // return;
{ // }
_actor.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn instanceof Creature) if (pawn instanceof Creature)

View File

@@ -667,8 +667,8 @@ public class AttackableAI extends CreatureAI
} }
} }
final Creature originalAttackTarget = getAttackTarget();
// Check if target is dead or if timeout is expired to stop this attack // Check if target is dead or if timeout is expired to stop this attack
final Creature originalAttackTarget = getAttackTarget();
if ((originalAttackTarget == null) || originalAttackTarget.isAlikeDead() || ((originalAttackTarget instanceof PlayerInstance) && (((PlayerInstance) originalAttackTarget).isInOfflineMode() || !((PlayerInstance) originalAttackTarget).isOnline())) || (_attackTimeout < GameTimeController.getGameTicks())) if ((originalAttackTarget == null) || originalAttackTarget.isAlikeDead() || ((originalAttackTarget instanceof PlayerInstance) && (((PlayerInstance) originalAttackTarget).isInOfflineMode() || !((PlayerInstance) originalAttackTarget).isOnline())) || (_attackTimeout < GameTimeController.getGameTicks()))
{ {
// Stop hating this target after the attack timeout or if target is dead // Stop hating this target after the attack timeout or if target is dead
@@ -684,6 +684,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, originalAttackTarget))
{
moveTo(originalAttackTarget.getX(), originalAttackTarget.getY(), originalAttackTarget.getZ());
return;
}
// Call all WorldObject of its Faction inside the Faction Range // Call all WorldObject of its Faction inside the Faction Range
if (((NpcInstance) _actor).getFactionId() != null) if (((NpcInstance) _actor).getFactionId() != null)
{ {

View File

@@ -533,11 +533,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -835,6 +835,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, originalAttackTarget))
{
moveTo(originalAttackTarget);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -533,11 +533,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -835,6 +835,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, originalAttackTarget))
{
moveTo(originalAttackTarget);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range

View File

@@ -470,11 +470,12 @@ public abstract class AbstractAI implements Ctrl
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving()) // May result to make monsters stop moving.
{ // if (!_actor.isMoving())
clientActionFailed(); // {
return; // clientActionFailed();
} // return;
// }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
if (pawn.isCreature()) if (pawn.isCreature())

View File

@@ -685,6 +685,13 @@ public class AttackableAI extends CreatureAI
return; return;
} }
// Actor should be able to see target.
if (!GeoEngine.getInstance().canSeeTarget(_actor, target))
{
moveTo(target);
return;
}
final int collision = npc.getTemplate().getCollisionRadius(); final int collision = npc.getTemplate().getCollisionRadius();
// Handle all WorldObject of its Faction inside the Faction Range // Handle all WorldObject of its Faction inside the Faction Range