koishi-plugin-tmp-bot 1.3.3 → 1.3.4

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.
@@ -4,6 +4,7 @@ const guildBind = require('../database/guildBind')
4
4
  const truckyAppApi = require('../api/truckyAppApi')
5
5
  const truckersMpApi = require('../api/truckersMpApi')
6
6
  const baiduTranslate = require('../util/baiduTranslate')
7
+ const common = require('../util/common')
7
8
 
8
9
  /**
9
10
  * 定位
@@ -54,6 +55,7 @@ module.exports = async (ctx, cfg, session, tmpId) => {
54
55
  await page.setViewport({ width: 1000, height: 1000 })
55
56
  await page.goto(`file:///${resolve(__dirname, '../resource/position.html')}`)
56
57
  await page.evaluate(`setData(${JSON.stringify(data)})`)
58
+ await common.sleep(100)
57
59
  await page.waitForNetworkIdle()
58
60
  const element = await page.$("#container");
59
61
  return (
@@ -168,16 +168,16 @@
168
168
  document.getElementsByClassName('country')[0].innerText = data.country
169
169
  document.getElementsByClassName('real-name')[0].innerText = data.realName
170
170
 
171
- let mapCoordinate = map.unproject(calculateMapCoordinate(data.x, data.y), 8)
172
- L.circleMarker(mapCoordinate, {
173
- color: '#3e9edc', // 标记点边框颜色
174
- fillColor: '#3e9edc', // 标记点填充颜色
175
- fillOpacity: 1, // 标记点填充不透明度(0到1之间的值)
176
- radius: 6 // 标记点半径(以像素为单位)
171
+ L.circleMarker(map.unproject(calculateMapCoordinate(data.x, data.y), 8), {
172
+ color: '#2f2f2f', // 标记点边框颜色
173
+ weight: 2, // 标记点边框大小
174
+ fillColor: '#158cfb', // 标记点填充颜色
175
+ fillOpacity: 1, // 标记点填充不透明度(0到1之间的值)
176
+ radius: 6 // 标记点半径(以像素为单位)
177
177
  }).addTo(map);
178
178
 
179
- // 移动地图到坐标
180
- map.setView(mapCoordinate, 7);
179
+ // 移动地图到坐标,视角稍微向上移动
180
+ map.setView(map.unproject(calculateMapCoordinate(data.x, data.y + 80), 8), 7);
181
181
  }
182
182
  </script>
183
183
  </body>
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ sleep (ms) {
3
+ return new Promise(resolve => setTimeout(resolve, ms));
4
+ }
5
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-tmp-bot",
3
3
  "description": "欧洲卡车模拟2 TMP查询机器人",
4
- "version": "1.3.3",
4
+ "version": "1.3.4",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [