koishi-plugin-tmp-bot 1.19.1 → 1.19.3
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.
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const { segment } = require('koishi');
|
|
2
|
+
const dayjs = require('dayjs');
|
|
2
3
|
const { resolve } = require('path');
|
|
3
4
|
const common = require('../util/common');
|
|
4
5
|
const { ServerAliasToId, PromodsIds } = require('../util/constant');
|
|
5
6
|
const evmOpenApi = require('../api/evmOpenApi');
|
|
6
7
|
const guildBind = require('../database/guildBind');
|
|
7
|
-
const dayjs = require('dayjs');
|
|
8
8
|
module.exports = async (ctx, session, serverName) => {
|
|
9
9
|
if (!ctx.puppeteer) {
|
|
10
10
|
return '未启用 puppeteer 服务';
|
|
@@ -43,7 +43,6 @@ module.exports = async (ctx, session, serverName) => {
|
|
|
43
43
|
todayMileage: playerInfo.data.todayMileage,
|
|
44
44
|
points: mapPlayerHistory.data
|
|
45
45
|
};
|
|
46
|
-
console.info(data.mapType);
|
|
47
46
|
let page;
|
|
48
47
|
try {
|
|
49
48
|
page = await ctx.puppeteer.page();
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
document.getElementById('avatar').src = data.smallAvatarUrl;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
const points = data.points || [];
|
|
130
|
+
const points = (data.points || []).filter(p => !(p.axisX === 0 && p.axisY === 0 && p.heading === 0));
|
|
131
131
|
// 使用传入的今日里程数据(米转千米)
|
|
132
132
|
const mileage = data.todayMileage || 0;
|
|
133
133
|
const km = (mileage / 1000).toFixed(1);
|
|
@@ -148,15 +148,16 @@
|
|
|
148
148
|
const prev = points[i - 1];
|
|
149
149
|
const curr = points[i];
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
let dist = calculateDistance(prev, curr);
|
|
152
|
+
dist = dist * 19;
|
|
153
|
+
const isDistJump = dist > 50000; // > 50km
|
|
153
154
|
|
|
154
155
|
let timeDiff = 0;
|
|
155
156
|
try {
|
|
156
157
|
timeDiff = (parseTime(curr.updateTime) - parseTime(prev.updateTime)) / 1000;
|
|
157
158
|
} catch (e) { }
|
|
158
159
|
|
|
159
|
-
const isTimeJump = timeDiff >
|
|
160
|
+
const isTimeJump = timeDiff > 90;
|
|
160
161
|
const isServerJump = prev.serverId !== curr.serverId;
|
|
161
162
|
|
|
162
163
|
if (isDistJump || isTimeJump || isServerJump) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-tmp-bot",
|
|
3
3
|
"description": "欧洲卡车模拟2 TMP查询插件,不会部署的可以直接使用此机器人->QQ:3523283907",
|
|
4
|
-
"version": "1.19.
|
|
4
|
+
"version": "1.19.3",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"homepage": "https://github.com/79887143/koishi-plugin-tmp-bot",
|