@bettergi/utils 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -103,7 +103,7 @@ await assertRegionDisappearing(findButton, "点击购买按钮超时", () => fin
103
103
 
104
104
  ```ts
105
105
  // 鼠标从 (745, 610) 平滑自然地移动 (1920, 1080)
106
- await naturalMouseMove(0, 0, 1920, 1080);
106
+ await naturalMouseMove(745, 610, 1920, 1080);
107
107
 
108
108
  // 鼠标从 (745, 610) 拖拽到 (1280, 610)
109
109
  await mouseDrag(745, 610, 1280, 610);
@@ -129,7 +129,7 @@ await mouseScrollDownLines(1, 115);
129
129
  // 创建/读取存储对象,保存到存储文件 store/my-data.json 中
130
130
  const store = useStore<{ lastUsedTime?: number; count: number }>("my-data");
131
131
  // 默认值版本
132
- // const state = useStoreWithDefaults("my-data", { lastUsedTime: 0, count: 0 });
132
+ // const store = useStoreWithDefaults("my-data", { lastUsedTime: 0, count: 0 });
133
133
 
134
134
  if (store?.lastUsedTime) {
135
135
  log.info(`欢迎回来!上次使用时间: ${store.lastUsedTime},计数器已累计至: ${store.count}`);
package/dist/game.d.ts CHANGED
@@ -39,6 +39,8 @@ export type ClockOptions = {
39
39
  radius?: number;
40
40
  /** 平滑度(默认: 3) */
41
41
  smooth?: number;
42
+ /** 容差(单位:分钟,默认: 2) */
43
+ tolerance?: number;
42
44
  };
43
45
  /**
44
46
  * 调整游戏时间到指定时分
package/dist/game.js CHANGED
@@ -92,12 +92,13 @@ export const setTimeTo = async (hour, minute, options) => {
92
92
  // 1.打开时间页面
93
93
  await openMenu("时间", true);
94
94
  // 2.计算调整时钟的路径点
95
- const { centerX = 1440, centerY = 502, offsetHours = 6, radius = 150, smooth = 4 } = options || {};
95
+ const { centerX = 1440, centerY = 502, offsetHours = 6, radius = 150, smooth = 4, tolerance = 2 } = options || {};
96
96
  const radian = ((((hour + offsetHours) * 60 + minute) % 1440) / 1440) * Math.PI * 2;
97
97
  const trackRadius = radius + 150; // 增加拨动半径,提高准确度
98
+ const toleranceRadian = (tolerance / (60 * 24)) * Math.PI * 2; // 容差弧度
98
99
  const waypoints = [{ x: centerX, y: centerY }].concat(Array.from({ length: Math.max(smooth, 3) })
99
100
  // 计算弧度
100
- .map((_, i) => radian + (1 + i / (Math.max(smooth, 3) - 1)) * Math.PI)
101
+ .map((_, i) => radian + (1 + i / (Math.max(smooth, 3) - 1)) * Math.PI + toleranceRadian)
101
102
  // 计算相对圆点坐标
102
103
  .map(rad => ({ x: trackRadius * Math.cos(rad), y: trackRadius * Math.sin(rad) }))
103
104
  // 计算绝对坐标
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bettergi/utils",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "开发 BetterGI 脚本常用工具集",
5
5
  "type": "module",
6
6
  "author": "Bread Grocery<https://github.com/breadgrocery>",