PublusCoordsGenerator

Use for generating coords for unscrambling images.

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.gf.qytechs.cn/scripts/451812/1096750/PublusCoordsGenerator.js

  1. function PublusCoordsGenerator(e, t, r, i, n) { // imageWidth, imageHeight, pieceWidth, pieceHeight, pattern
  2. const calcPositionWithRest_ = function (e, t, r, i) {
  3. return e * i + (e >= t ? r : 0)
  4. }
  5.  
  6. const calcXCoordinateXRest_ = function (e, t, r) {
  7. return (e + 61 * r) % t
  8. }
  9.  
  10. const calcYCoordinateXRest_ = function (e, t, r, i, n) {
  11. var s, a, o = n % 2 == 1;
  12. return (e < t ? o : !o) ? (a = r,
  13. s = 0) : (a = i - r,
  14. s = r),
  15. (e + 53 * n + 59 * r) % a + s
  16. }
  17.  
  18. const calcXCoordinateYRest_ = function (e, t, r, i, n) {
  19. var s, a, o = n % 2 == 1;
  20. return (e < r ? o : !o) ? (a = i - t,
  21. s = t) : (a = t,
  22. s = 0),
  23. (e + 67 * n + t + 71) % a + s
  24. }
  25.  
  26. const calcYCoordinateYRest_ = function (e, t, r) {
  27. return (e + 73 * r) % t
  28. }
  29.  
  30. var s, a, o, u, c, p, l, m, d, h, y = Math.floor(e / r),
  31. g = Math.floor(t / i),
  32. f = e % r,
  33. b = t % i,
  34. S = [];
  35. if (s = y - 43 * n % y,
  36. s = s % y == 0 ? (y - 4) % y : s,
  37. s = 0 == s ? y - 1 : s,
  38. a = g - 47 * n % g,
  39. a = a % g == 0 ? (g - 4) % g : a,
  40. a = 0 == a ? g - 1 : a,
  41. f > 0 && b > 0 && (o = s * r,
  42. u = a * i,
  43. S.push({
  44. srcX: o,
  45. srcY: u,
  46. destX: o,
  47. destY: u,
  48. width: f,
  49. height: b
  50. })),
  51. b > 0)
  52. for (l = 0; l < y; l++)
  53. d = calcXCoordinateXRest_(l, y, n),
  54. h = calcYCoordinateXRest_(d, s, a, g, n),
  55. c = calcPositionWithRest_(d, s, f, r),
  56. p = h * i,
  57. o = calcPositionWithRest_(l, s, f, r),
  58. u = a * i,
  59. S.push({
  60. srcX: o,
  61. srcY: u,
  62. destX: c,
  63. destY: p,
  64. width: r,
  65. height: b
  66. });
  67. if (f > 0)
  68. for (m = 0; m < g; m++)
  69. h = calcYCoordinateYRest_(m, g, n),
  70. c = (d = calcXCoordinateYRest_(h, s, a, y, n)) * r,
  71. p = calcPositionWithRest_(h, a, b, i),
  72. o = s * r,
  73. u = calcPositionWithRest_(m, a, b, i),
  74. S.push({
  75. srcX: o,
  76. srcY: u,
  77. destX: c,
  78. destY: p,
  79. width: f,
  80. height: i
  81. });
  82. for (l = 0; l < y; l++)
  83. for (m = 0; m < g; m++)
  84. h = (m + 37 * n + 41 * (d = (l + 29 * n + 31 * m) % y)) % g,
  85. c = d * r + (d >= calcXCoordinateYRest_(h, s, a, y, n) ? f : 0),
  86. p = h * i + (h >= calcYCoordinateXRest_(d, s, a, g, n) ? b : 0),
  87. o = l * r + (l >= s ? f : 0),
  88. u = m * i + (m >= a ? b : 0),
  89. S.push({
  90. srcX: o,
  91. srcY: u,
  92. destX: c,
  93. destY: p,
  94. width: r,
  95. height: i
  96. });
  97. return S;
  98. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址