Move to point message variable naming and handler cleanup

This commit is contained in:
2023-09-10 19:37:46 -05:00
parent 9989cbff24
commit 003b939d33
7 changed files with 84 additions and 89 deletions
@@ -32,37 +32,31 @@ public class MoveToPointHandler extends AbstractClientMsgHandler {
PlayerCharacter pc = (origin != null) ? (origin.getPlayerCharacter()) : null;
if (pc == null)
return false;
if(pc.combatTarget == null){
MovementManager.movement(msg, pc);
return true;
} else{
if (msg.getInitiatedFromAttack() == 1) {
//move message was initiated by an attack message
Enum.GameObjectType combatTargetType = pc.combatTarget.getObjectType();
if(combatTargetType.equals(Enum.GameObjectType.NPC)){
if (combatTargetType.equals(Enum.GameObjectType.NPC)) {
msg.clearTarget();
pc.setCombatTarget(null);
origin.sendMsg(msg);
}
if(combatTargetType.equals(Enum.GameObjectType.Mob) || combatTargetType.equals(Enum.GameObjectType.PlayerCharacter)){
MovementManager.movement(msg, pc);
return true;
} else if(combatTargetType.equals(Enum.GameObjectType.Building)) {
} else if (combatTargetType.equals(Enum.GameObjectType.Building)) {
Building targetBuilding = BuildingManager.getBuilding(pc.combatTarget.getObjectUUID());
if (targetBuilding != null) {
if (targetBuilding.isVulnerable() && targetBuilding.getRank() > -1) {
MovementManager.movement(msg, pc);
return true;
} else{
if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0) {
msg.clearTarget();
pc.setCombatTarget(null);
origin.sendMsg(msg);
}
}
}
msg.setEndCoord(pc.loc);
origin.sendMsg(msg);
return true;
}
msg.setEndCoord(pc.loc);
origin.sendMsg(msg);
MovementManager.movement(msg, pc);
return true;
}
}