|
|
@ -14,6 +14,8 @@ import engine.gameManager.MovementManager; |
|
|
|
import engine.net.client.ClientConnection; |
|
|
|
import engine.net.client.ClientConnection; |
|
|
|
import engine.net.client.msg.ClientNetMsg; |
|
|
|
import engine.net.client.msg.ClientNetMsg; |
|
|
|
import engine.net.client.msg.MoveToPointMsg; |
|
|
|
import engine.net.client.msg.MoveToPointMsg; |
|
|
|
|
|
|
|
import engine.objects.AbstractWorldObject; |
|
|
|
|
|
|
|
import engine.objects.Building; |
|
|
|
import engine.objects.PlayerCharacter; |
|
|
|
import engine.objects.PlayerCharacter; |
|
|
|
|
|
|
|
|
|
|
|
public class MoveToPointHandler extends AbstractClientMsgHandler { |
|
|
|
public class MoveToPointHandler extends AbstractClientMsgHandler { |
|
|
@ -30,9 +32,23 @@ public class MoveToPointHandler extends AbstractClientMsgHandler { |
|
|
|
PlayerCharacter pc = (origin != null) ? (origin.getPlayerCharacter()) : null; |
|
|
|
PlayerCharacter pc = (origin != null) ? (origin.getPlayerCharacter()) : null; |
|
|
|
if (pc == null) |
|
|
|
if (pc == null) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
PlayerCharacter player = origin.getPlayerCharacter(); |
|
|
|
|
|
|
|
if (player == null) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AbstractWorldObject target = player.combatTarget; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (target != null) { |
|
|
|
|
|
|
|
switch (target.getObjectType()) { |
|
|
|
|
|
|
|
case NPC: |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
case Building: |
|
|
|
|
|
|
|
Building targetBuilding = (Building) target; |
|
|
|
|
|
|
|
if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
MovementManager.movement(msg, pc); |
|
|
|
MovementManager.movement(msg, pc); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|