public static bool Calculate(int x, int y, int z, Direction dir, out int newZ, out int newDir) { int walkDirection = Engine.GetWalkDirection(dir); newZ = z; newDir = walkDirection; if (!IsDiagonal(walkDirection)) { int num4; int num5; int num6; int num2 = Turn(walkDirection, 1); int num3 = Turn(walkDirection, -1); bool flag = CheckMovement(x, y, z, num2, out num4); bool flag2 = CheckMovement(x, y, z, num3, out num5); bool flag3 = CheckMovement(x, y, z, walkDirection, out num6); Mobile player = World.Player; if (flag3 && ((player.Body == 0x3db) ? (flag || flag2) : (flag && flag2))) { newZ = num6; } else if (flag) { newZ = num4; newDir = num2; } else if (flag2) { newZ = num5; newDir = num3; } else { return(false); } return(true); } return(CheckMovement(x, y, z, walkDirection, out newZ)); }