koishi-plugin-ets2-tools-tmp 2.3.0 → 2.3.2
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/lib/api/evmOpenApi.js +138 -1
- package/lib/api/truckersMpApi.js +133 -1
- package/lib/api/truckersMpMapApi.js +25 -1
- package/lib/api/truckyAppApi.js +48 -1
- package/lib/command/ets-app/queryPoint.js +96 -1
- package/lib/command/ets-app/resetPassword.js +270 -1
- package/lib/command/tmpActivityService.js +603 -1
- package/lib/command/tmpBind.js +19 -1
- package/lib/command/tmpDlcMap.js +33 -1
- package/lib/command/tmpFootprint.js +109 -1
- package/lib/command/tmpMileageRanking.js +55 -1
- package/lib/command/tmpPosition.js +123 -1
- package/lib/command/tmpQuery/tmpQuery.js +12 -1
- package/lib/command/tmpQuery/tmpQueryImg.js +103 -1
- package/lib/command/tmpQuery/tmpQueryText.js +196 -1
- package/lib/command/tmpServer.js +41 -1
- package/lib/command/tmpTraffic/tmpTraffic.js +15 -1
- package/lib/command/tmpTraffic/tmpTrafficMap.js +163 -1
- package/lib/command/tmpTraffic/tmpTrafficText.js +60 -1
- package/lib/command/tmpVersion.js +14 -1
- package/lib/command/tmpVtc.js +29 -1
- package/lib/database/guildBind.js +41 -1
- package/lib/database/model.js +65 -1
- package/lib/database/translateCache.js +31 -1
- package/lib/index.js +332 -1
- package/lib/resource/dlc.html +1 -1
- package/lib/resource/footprint.html +1 -1
- package/lib/resource/package/ets-map.js +63 -1
- package/lib/resource/package/leaflet/heatmap.min.js +9 -1
- package/lib/resource/package/leaflet/leaflet-heatmap.js +246 -1
- package/lib/resource/position.html +1 -1
- package/lib/resource/traffic.html +1 -1
- package/lib/util/baiduTranslate.js +24 -1
- package/lib/util/common.js +5 -1
- package/lib/util/constant.js +36 -1
- package/package.json +1 -1
package/lib/api/evmOpenApi.js
CHANGED
|
@@ -1 +1,138 @@
|
|
|
1
|
-
const
|
|
1
|
+
const BASE_API = 'https://da.vtcm.link'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
/**
|
|
5
|
+
* 查询服务器列表
|
|
6
|
+
*/
|
|
7
|
+
async serverList(http) {
|
|
8
|
+
let result = null
|
|
9
|
+
try {
|
|
10
|
+
result = await http.get(`${BASE_API}/server/list`)
|
|
11
|
+
} catch {
|
|
12
|
+
return {
|
|
13
|
+
error: true
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// 拼接返回数据
|
|
18
|
+
let data = {
|
|
19
|
+
error: result.code !== 200
|
|
20
|
+
}
|
|
21
|
+
if (!data.error) {
|
|
22
|
+
data.data = result.data
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return data
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* 查询在线玩家
|
|
29
|
+
*/
|
|
30
|
+
async mapPlayerList(http, serverId, ax, ay, bx, by) {
|
|
31
|
+
let result = null
|
|
32
|
+
try {
|
|
33
|
+
result = await http.get(`${BASE_API}/map/playerList?aAxisX=${ax}&aAxisY=${ay}&bAxisX=${bx}&bAxisY=${by}&serverId=${serverId}`)
|
|
34
|
+
} catch {
|
|
35
|
+
return {
|
|
36
|
+
error: true
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 拼接返回数据
|
|
41
|
+
let data = {
|
|
42
|
+
error: result.code !== 200
|
|
43
|
+
}
|
|
44
|
+
if (!data.error) {
|
|
45
|
+
data.data = result.data
|
|
46
|
+
}
|
|
47
|
+
return data
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* 查询玩家信息
|
|
51
|
+
*/
|
|
52
|
+
async playerInfo(http, tmpId) {
|
|
53
|
+
let result = null
|
|
54
|
+
try {
|
|
55
|
+
result = await http.get(`${BASE_API}/player/info?tmpId=${tmpId}`)
|
|
56
|
+
} catch {
|
|
57
|
+
return {
|
|
58
|
+
error: true
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 拼接返回数据
|
|
63
|
+
let data = {
|
|
64
|
+
code: result.code,
|
|
65
|
+
error: result.code !== 200
|
|
66
|
+
}
|
|
67
|
+
if (!data.error) {
|
|
68
|
+
data.data = result.data
|
|
69
|
+
}
|
|
70
|
+
return data
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* DLC列表
|
|
74
|
+
*/
|
|
75
|
+
async dlcList(http, type) {
|
|
76
|
+
let result = null
|
|
77
|
+
try {
|
|
78
|
+
result = await http.get(`${BASE_API}/dlc/list?type=${type}`)
|
|
79
|
+
} catch (e) {
|
|
80
|
+
return {
|
|
81
|
+
error: true
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// 拼接返回数据
|
|
86
|
+
let data = {
|
|
87
|
+
error: result.code !== 200
|
|
88
|
+
}
|
|
89
|
+
if (!data.error) {
|
|
90
|
+
data.data = result.data
|
|
91
|
+
}
|
|
92
|
+
return data
|
|
93
|
+
},
|
|
94
|
+
/**
|
|
95
|
+
* 玩家里程排行
|
|
96
|
+
*/
|
|
97
|
+
async mileageRankingList(http, rankingType, tmpId) {
|
|
98
|
+
let result = null
|
|
99
|
+
try {
|
|
100
|
+
result = await http.get(`${BASE_API}/statistics/mileageRankingList?rankingType=${rankingType}&tmpId=${tmpId || ''}&rankingCount=10`)
|
|
101
|
+
} catch (e) {
|
|
102
|
+
return {
|
|
103
|
+
error: true
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// 拼接返回数据
|
|
108
|
+
let data = {
|
|
109
|
+
error: result.code !== 200
|
|
110
|
+
}
|
|
111
|
+
if (!data.error) {
|
|
112
|
+
data.data = result.data
|
|
113
|
+
}
|
|
114
|
+
return data
|
|
115
|
+
},
|
|
116
|
+
/**
|
|
117
|
+
* 查询玩家历史数据
|
|
118
|
+
*/
|
|
119
|
+
async mapPlayerHistory(http, tmpId, serverId, startTime, endTime) {
|
|
120
|
+
let result = null
|
|
121
|
+
try {
|
|
122
|
+
result = await http.get(`${BASE_API}/map/playerHistory?tmpId=${tmpId || ''}&serverId=${serverId || ''}&startTime=${startTime || ''}&endTime=${endTime || ''}`)
|
|
123
|
+
} catch {
|
|
124
|
+
return {
|
|
125
|
+
error: true
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// 拼接返回数据
|
|
130
|
+
let data = {
|
|
131
|
+
error: result.code !== 200
|
|
132
|
+
}
|
|
133
|
+
if (!data.error) {
|
|
134
|
+
data.data = result.data
|
|
135
|
+
}
|
|
136
|
+
return data
|
|
137
|
+
}
|
|
138
|
+
}
|
package/lib/api/truckersMpApi.js
CHANGED
|
@@ -1 +1,133 @@
|
|
|
1
|
-
const
|
|
1
|
+
const BASE_API = 'https://api.truckersmp.com/v2';
|
|
2
|
+
module.exports = {
|
|
3
|
+
/**
|
|
4
|
+
* 查询玩家信息
|
|
5
|
+
*/
|
|
6
|
+
async player(http, tmpId) {
|
|
7
|
+
let result = null;
|
|
8
|
+
try {
|
|
9
|
+
result = await http.get(`${BASE_API}/player/${tmpId}`);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return {
|
|
13
|
+
error: true
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
// 拼接返回数据
|
|
17
|
+
let data = {
|
|
18
|
+
error: JSON.parse(result.error)
|
|
19
|
+
};
|
|
20
|
+
if (!data.error) {
|
|
21
|
+
data.data = result.response;
|
|
22
|
+
}
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* 查询服务器列表
|
|
27
|
+
*/
|
|
28
|
+
async servers(http) {
|
|
29
|
+
let result = null;
|
|
30
|
+
try {
|
|
31
|
+
result = await http.get(`${BASE_API}/servers`);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return {
|
|
35
|
+
error: true
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
// 拼接返回数据
|
|
39
|
+
let data = {
|
|
40
|
+
error: JSON.parse(result.error)
|
|
41
|
+
};
|
|
42
|
+
if (!data.error) {
|
|
43
|
+
data.data = result.response;
|
|
44
|
+
}
|
|
45
|
+
return data;
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* 查询玩家封禁信息
|
|
49
|
+
*/
|
|
50
|
+
async bans(http, tmpId) {
|
|
51
|
+
let result = null;
|
|
52
|
+
try {
|
|
53
|
+
result = await http.get(`${BASE_API}/bans/${tmpId}`);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return {
|
|
57
|
+
error: true
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
// 拼接返回数据
|
|
61
|
+
let data = {
|
|
62
|
+
error: JSON.parse(result.error)
|
|
63
|
+
};
|
|
64
|
+
if (!data.error) {
|
|
65
|
+
data.data = result.response;
|
|
66
|
+
}
|
|
67
|
+
return data;
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* 游戏版本
|
|
71
|
+
*/
|
|
72
|
+
async version(http) {
|
|
73
|
+
let result = null;
|
|
74
|
+
try {
|
|
75
|
+
result = await http.get(`${BASE_API}/version`);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return {
|
|
79
|
+
error: true
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
// 拼接返回数据
|
|
83
|
+
return {
|
|
84
|
+
error: false,
|
|
85
|
+
data: result
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
/**
|
|
89
|
+
* 查询车队成员信息
|
|
90
|
+
*/
|
|
91
|
+
async vtcMember(http, vtcId, memberId) {
|
|
92
|
+
let result = null;
|
|
93
|
+
try {
|
|
94
|
+
result = await http.get(`${BASE_API}/vtc/${vtcId}/member/${memberId}`);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return {
|
|
98
|
+
error: true
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
// 拼接返回数据
|
|
102
|
+
let data = {
|
|
103
|
+
error: JSON.parse(result.error)
|
|
104
|
+
};
|
|
105
|
+
if (!data.error) {
|
|
106
|
+
data.data = result.response;
|
|
107
|
+
}
|
|
108
|
+
return data;
|
|
109
|
+
},
|
|
110
|
+
/*
|
|
111
|
+
* 查询vtc信息
|
|
112
|
+
*/
|
|
113
|
+
async vtc(http, vtcId) {
|
|
114
|
+
let result = null
|
|
115
|
+
try {
|
|
116
|
+
result = await http.get(`${BASE_API}/vtc/${vtcId}`)
|
|
117
|
+
} catch {
|
|
118
|
+
return {
|
|
119
|
+
error: true
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// 拼接返回数据
|
|
124
|
+
let data = {
|
|
125
|
+
error: JSON.parse(result.error)
|
|
126
|
+
}
|
|
127
|
+
if (!data.error) {
|
|
128
|
+
data.data = result.response
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return data
|
|
132
|
+
}
|
|
133
|
+
};
|
|
@@ -1 +1,25 @@
|
|
|
1
|
-
const
|
|
1
|
+
const BASE_API = 'https://tracker.ets2map.com';
|
|
2
|
+
module.exports = {
|
|
3
|
+
/**
|
|
4
|
+
* 区域查询玩家
|
|
5
|
+
*/
|
|
6
|
+
async area(http, serverId, x1, y1, x2, y2) {
|
|
7
|
+
let result = null;
|
|
8
|
+
try {
|
|
9
|
+
result = await http.get(`${BASE_API}/v3/area?x1=${x1}&y1=${y1}&x2=${x2}&y2=${y2}&server=${serverId}`);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return {
|
|
13
|
+
error: true
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
// 拼接返回数据
|
|
17
|
+
let data = {
|
|
18
|
+
error: !result || !result.Success
|
|
19
|
+
};
|
|
20
|
+
if (!data.error) {
|
|
21
|
+
data.data = result.Data;
|
|
22
|
+
}
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
25
|
+
};
|
package/lib/api/truckyAppApi.js
CHANGED
|
@@ -1 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
const BASE_API = 'https://api.codetabs.com/v1/proxy/?quest=https://api.truckyapp.com'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
/**
|
|
5
|
+
* 查询线上信息
|
|
6
|
+
*/
|
|
7
|
+
async online (http, tmpId) {
|
|
8
|
+
let result = null
|
|
9
|
+
try {
|
|
10
|
+
result = await http.get(`${BASE_API}/v3/map/online?playerID=${tmpId}`)
|
|
11
|
+
} catch {
|
|
12
|
+
return {
|
|
13
|
+
error: true
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// 拼接返回数据
|
|
18
|
+
let data = {
|
|
19
|
+
error: !result || !result.response || result.response.error
|
|
20
|
+
}
|
|
21
|
+
if (!data.error) {
|
|
22
|
+
data.data = result.response
|
|
23
|
+
}
|
|
24
|
+
return data
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* 查询热门交通数据
|
|
28
|
+
*/
|
|
29
|
+
async trafficTop (http, serverName) {
|
|
30
|
+
let result = null
|
|
31
|
+
try {
|
|
32
|
+
result = await http.get(`${BASE_API}/v2/traffic/top?game=ets2&server=${serverName}`)
|
|
33
|
+
} catch {
|
|
34
|
+
return {
|
|
35
|
+
error: true
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 拼接返回数据
|
|
40
|
+
let data = {
|
|
41
|
+
error: !result || !result.response || result.response.length <= 0
|
|
42
|
+
}
|
|
43
|
+
if (!data.error) {
|
|
44
|
+
data.data = result.response
|
|
45
|
+
}
|
|
46
|
+
return data
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1 +1,96 @@
|
|
|
1
|
-
|
|
1
|
+
module.exports = async (ctx, cfg, session, targetQQ) => {
|
|
2
|
+
const { Name, url, token, logOutput, platformVersion } = cfg.mainSettings?.settings || {};
|
|
3
|
+
const platform = (platformVersion || "v1").toLowerCase();
|
|
4
|
+
let queryQQ = targetQQ;
|
|
5
|
+
if (!queryQQ) {
|
|
6
|
+
queryQQ = session.userId;
|
|
7
|
+
} else {
|
|
8
|
+
if (queryQQ.startsWith("<at ")) {
|
|
9
|
+
if (queryQQ.startsWith('<at ')) {
|
|
10
|
+
queryQQ = queryQQ.replace('<at ', '');
|
|
11
|
+
}
|
|
12
|
+
let id = '';
|
|
13
|
+
const idStart = queryQQ.indexOf('id="');
|
|
14
|
+
if (idStart !== -1) {
|
|
15
|
+
const valueStart = idStart + 4;
|
|
16
|
+
const valueEnd = queryQQ.indexOf('"', valueStart);
|
|
17
|
+
if (valueEnd !== -1) {
|
|
18
|
+
id = queryQQ.substring(valueStart, valueEnd);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
queryQQ = id;
|
|
22
|
+
}
|
|
23
|
+
if (!/^\d+$/.test(queryQQ)) {
|
|
24
|
+
return "QQ号格式不正确,请输入纯数字QQ号";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
if (logOutput) {
|
|
29
|
+
ctx.logger.info(`开始查询用户 ${queryQQ} 的积分`);
|
|
30
|
+
}
|
|
31
|
+
let userInfo;
|
|
32
|
+
if (platform === "v2") {
|
|
33
|
+
const baseUrl = url || "open.vtcm.link";
|
|
34
|
+
const userInfoUrl = `https://${baseUrl}/members/get?token=${token}&qq=${queryQQ}`;
|
|
35
|
+
if (logOutput) {
|
|
36
|
+
ctx.logger.info(`请求V2.0用户信息: ${userInfoUrl}`);
|
|
37
|
+
}
|
|
38
|
+
const userInfoResponse = await ctx.http.get(userInfoUrl);
|
|
39
|
+
if (logOutput) {
|
|
40
|
+
ctx.logger.info(`V2.0用户信息响应: ${JSON.stringify(userInfoResponse)}`);
|
|
41
|
+
}
|
|
42
|
+
if (userInfoResponse.code !== 200) {
|
|
43
|
+
return `获取用户信息失败: ${userInfoResponse.msg || "未知错误"}`;
|
|
44
|
+
}
|
|
45
|
+
if (!userInfoResponse.data) {
|
|
46
|
+
return `未找到QQ号 ${queryQQ} 关联的用户信息`;
|
|
47
|
+
}
|
|
48
|
+
userInfo = userInfoResponse.data;
|
|
49
|
+
} else {
|
|
50
|
+
const userInfoUrl = `https://${url}/api/user/info/list?token=${token}&page=0&limit=7&tmpId=&tmpName=&teamId=&qq=${queryQQ}&state=0&teamRole=`;
|
|
51
|
+
if (logOutput) {
|
|
52
|
+
ctx.logger.info(`请求V1.0用户信息: ${userInfoUrl}`);
|
|
53
|
+
}
|
|
54
|
+
const userInfoResponse = await ctx.http.post(userInfoUrl);
|
|
55
|
+
if (logOutput) {
|
|
56
|
+
ctx.logger.info(`V1.0用户信息响应: ${JSON.stringify(userInfoResponse)}`);
|
|
57
|
+
}
|
|
58
|
+
if (userInfoResponse.code !== 0) {
|
|
59
|
+
return `获取用户信息失败: ${userInfoResponse.msg || "未知错误"}`;
|
|
60
|
+
}
|
|
61
|
+
const userList = userInfoResponse.page?.list || [];
|
|
62
|
+
if (userList.length === 0) {
|
|
63
|
+
return `未找到QQ号 ${queryQQ} 关联的用户信息`;
|
|
64
|
+
}
|
|
65
|
+
userInfo = userList[0];
|
|
66
|
+
}
|
|
67
|
+
const tmpName = userInfo.tmpName || "未知用户";
|
|
68
|
+
const teamRole = userInfo.teamRole || userInfo.tmpRole || "未知职位";
|
|
69
|
+
const teamId = userInfo.teamId || userInfo.uid || "未知编号";
|
|
70
|
+
const rewardPoints = userInfo.rewardPoints || userInfo.point || 0;
|
|
71
|
+
const joinDate = userInfo.joinDate || "未知";
|
|
72
|
+
let message = `🚛 ${Name}平台 - 积分查询🚚
|
|
73
|
+
`;
|
|
74
|
+
message += `👤 用户: ${tmpName}
|
|
75
|
+
`;
|
|
76
|
+
message += `🆔 车队编号: ${teamId}
|
|
77
|
+
`;
|
|
78
|
+
message += `📧 QQ: ${queryQQ}
|
|
79
|
+
`;
|
|
80
|
+
message += `🏆 职位: ${teamRole}
|
|
81
|
+
`;
|
|
82
|
+
message += `⭐ 当前积分: ${rewardPoints}
|
|
83
|
+
`;
|
|
84
|
+
message += `📅 加入日期: ${joinDate}`;
|
|
85
|
+
return message;
|
|
86
|
+
} catch (error) {
|
|
87
|
+
ctx.logger.error(`积分查询过程出错: ${error}`);
|
|
88
|
+
if (error.response) {
|
|
89
|
+
return `请求失败: ${error.response.status} ${error.response.statusText}`;
|
|
90
|
+
} else if (error.code) {
|
|
91
|
+
return `网络错误: ${error.code}`;
|
|
92
|
+
} else {
|
|
93
|
+
return "系统错误,请稍后重试";
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|