koishi-plugin-ets2-tools-tmp 3.3.6 → 3.3.62
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.
|
@@ -55,16 +55,22 @@ module.exports = async (ctx, cfg, session, tmpId) => {
|
|
|
55
55
|
}
|
|
56
56
|
tmpId = guildBindData.tmp_id;
|
|
57
57
|
}
|
|
58
|
-
//
|
|
59
|
-
|
|
58
|
+
// 并行请求玩家信息与线上状态(互不依赖,避免串行等待)
|
|
59
|
+
const [playerInfo, playerMapInfo] = await Promise.all([
|
|
60
|
+
evmOpenApi.playerInfo(ctx.http, tmpId),
|
|
61
|
+
truckyAppApi.online(ctx.http, tmpId)
|
|
62
|
+
]);
|
|
60
63
|
if (playerInfo.error && playerInfo.code === 10001) {
|
|
61
64
|
return '玩家不存在';
|
|
62
65
|
}
|
|
63
66
|
else if (playerInfo.error) {
|
|
64
67
|
return '查询玩家信息失败,请重试';
|
|
65
68
|
}
|
|
66
|
-
//
|
|
67
|
-
|
|
69
|
+
// Steam游戏时长请求提前发起,与下方积分查询/翻译并行执行
|
|
70
|
+
const steamApiKey = cfg.steamApi?.key;
|
|
71
|
+
const steamGameTimePromise = (cfg.commands?.tmpQueryGameTime && steamApiKey)
|
|
72
|
+
? evmOpenApi.steamGameTime(ctx.http, steamApiKey, playerInfo.data.steamId)
|
|
73
|
+
: null;
|
|
68
74
|
// 拼接数据
|
|
69
75
|
let data = {};
|
|
70
76
|
data.showAvatar = cfg.tmpQuery?.showAvatar !== false;
|
|
@@ -94,8 +100,12 @@ module.exports = async (ctx, cfg, session, tmpId) => {
|
|
|
94
100
|
if (data.isOnline) {
|
|
95
101
|
data.onlineStatus = '在线';
|
|
96
102
|
data.onlineServerName = playerMapInfo.data.serverDetails.name;
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
const [onlineCountry, onlineCity] = await Promise.all([
|
|
104
|
+
baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.country),
|
|
105
|
+
baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.realName)
|
|
106
|
+
]);
|
|
107
|
+
data.onlineCountry = onlineCountry;
|
|
108
|
+
data.onlineCity = onlineCity;
|
|
99
109
|
data.onlineX = playerMapInfo.data.x;
|
|
100
110
|
data.onlineY = playerMapInfo.data.y;
|
|
101
111
|
data.onlineMapType = playerMapInfo.data.serverDetails.id === 50 ? 'promods' : 'ets';
|
|
@@ -157,17 +167,13 @@ module.exports = async (ctx, cfg, session, tmpId) => {
|
|
|
157
167
|
}
|
|
158
168
|
}
|
|
159
169
|
}
|
|
160
|
-
//
|
|
170
|
+
// 等待Steam游戏时长结果(请求已提前发起,与积分查询/翻译并行)
|
|
161
171
|
data.ets2GameTime = null;
|
|
162
172
|
data.atsGameTime = null;
|
|
163
|
-
if (
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const gameTimes = await evmOpenApi.steamGameTime(ctx.http, steamApiKey, steamId);
|
|
168
|
-
data.ets2GameTime = gameTimes.ets2;
|
|
169
|
-
data.atsGameTime = gameTimes.ats;
|
|
170
|
-
}
|
|
173
|
+
if (steamGameTimePromise) {
|
|
174
|
+
const gameTimes = await steamGameTimePromise;
|
|
175
|
+
data.ets2GameTime = gameTimes.ets2;
|
|
176
|
+
data.atsGameTime = gameTimes.ats;
|
|
171
177
|
}
|
|
172
178
|
let page;
|
|
173
179
|
try {
|
|
@@ -51,16 +51,22 @@ module.exports = async (ctx, cfg, session, tmpId) => {
|
|
|
51
51
|
}
|
|
52
52
|
tmpId = guildBindData.tmp_id;
|
|
53
53
|
}
|
|
54
|
-
//
|
|
55
|
-
|
|
54
|
+
// 并行请求玩家信息与线上状态(互不依赖,避免串行等待)
|
|
55
|
+
const [playerInfo, playerMapInfo] = await Promise.all([
|
|
56
|
+
evmOpenApi.playerInfo(ctx.http, tmpId),
|
|
57
|
+
truckyAppApi.online(ctx.http, tmpId)
|
|
58
|
+
]);
|
|
56
59
|
if (playerInfo.error && playerInfo.code === 10001) {
|
|
57
60
|
return '玩家不存在';
|
|
58
61
|
}
|
|
59
62
|
else if (playerInfo.error) {
|
|
60
63
|
return '玩家信息查询失败,请重试';
|
|
61
64
|
}
|
|
62
|
-
//
|
|
63
|
-
|
|
65
|
+
// Steam游戏时长请求提前发起,与下方积分查询并行执行
|
|
66
|
+
const steamApiKey = cfg.steamApi?.key;
|
|
67
|
+
const steamGameTimePromise = (cfg.commands?.tmpQueryGameTime && steamApiKey)
|
|
68
|
+
? evmOpenApi.steamGameTime(ctx.http, steamApiKey, playerInfo.data.steamId)
|
|
69
|
+
: null;
|
|
64
70
|
// 拼接消息模板
|
|
65
71
|
let message = '';
|
|
66
72
|
if (cfg.tmpQuery?.showAvatar) {
|
|
@@ -171,30 +177,20 @@ module.exports = async (ctx, cfg, session, tmpId) => {
|
|
|
171
177
|
if (playerMapInfo && !playerMapInfo.error) {
|
|
172
178
|
message += '\n📶在线状态: ' + (playerMapInfo.data.online ? `在线🟢 (${playerMapInfo.data.serverDetails.name})` : '离线⚫');
|
|
173
179
|
if (playerMapInfo.data.online) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
180
|
+
const [onlineCountry, onlineCity] = await Promise.all([
|
|
181
|
+
baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.country),
|
|
182
|
+
baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.realName)
|
|
183
|
+
]);
|
|
184
|
+
message += '\n🌍线上位置: ' + onlineCountry + ' - ' + onlineCity;
|
|
178
185
|
}
|
|
179
186
|
else if (playerInfo.data.lastOnlineTime) {
|
|
180
187
|
message += '\n📶上次在线: ' + dayjs(playerInfo.data.lastOnlineTime).fromNow(false);
|
|
181
188
|
}
|
|
182
189
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
// 查询Steam游戏时长
|
|
186
|
-
async function getSteamGameTimes(steamId) {
|
|
187
|
-
const steamApiKey = cfg.steamApi?.key;
|
|
188
|
-
if (!steamApiKey) {
|
|
189
|
-
return { ets2: null, ats: null };
|
|
190
|
-
}
|
|
191
|
-
return evmOpenApi.steamGameTime(ctx.http, steamApiKey, steamId);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// 获取欧卡和美卡游戏时长
|
|
190
|
+
// 获取欧卡和美卡游戏时长(请求已提前发起,与积分查询/翻译并行)
|
|
195
191
|
if (cfg.commands?.tmpQueryGameTime) {
|
|
196
|
-
const gameTimes = await
|
|
197
|
-
|
|
192
|
+
const gameTimes = (await steamGameTimePromise) || { ets2: null, ats: null };
|
|
193
|
+
|
|
198
194
|
// 添加游戏时长信息
|
|
199
195
|
if (gameTimes.ets2) {
|
|
200
196
|
message += '\n🎮欧卡游戏时长: ' + gameTimes.ets2;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let mapConfig = {
|
|
2
2
|
ets: {
|
|
3
|
-
tileUrl: 'https://
|
|
3
|
+
tileUrl: 'https://ets_tiles.cnly.top/20260903/tmp-ets-yellow/Tiles/{z}/{x}/{y}.png',
|
|
4
4
|
multipliers: {
|
|
5
5
|
x: 70272,
|
|
6
6
|
y: 76157
|
|
@@ -26,7 +26,7 @@ let mapConfig = {
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
promods: {
|
|
29
|
-
tileUrl: 'https://
|
|
29
|
+
tileUrl: 'https://ets_tiles.cnly.top/20260903/tmp-promods-yellow/Tiles/{z}/{x}/{y}.png',
|
|
30
30
|
multipliers: {
|
|
31
31
|
x: 51953,
|
|
32
32
|
y: 76024
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
<script>
|
|
122
122
|
let mapConfig = {
|
|
123
123
|
ets: {
|
|
124
|
-
tileUrl: 'https://
|
|
124
|
+
tileUrl: 'https://ets_tiles.cnly.top/20260903/tmp-ets-yellow/Tiles/{z}/{x}/{y}.png',
|
|
125
125
|
multipliers: {
|
|
126
126
|
x: 70272,
|
|
127
127
|
y: 76157
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
}
|
|
148
148
|
},
|
|
149
149
|
promods: {
|
|
150
|
-
tileUrl: 'https://
|
|
150
|
+
tileUrl: 'https://ets_tiles.cnly.top/20260903/tmp-promods-yellow/Tiles/{z}/{x}/{y}.png',
|
|
151
151
|
multipliers: {
|
|
152
152
|
x: 51953,
|
|
153
153
|
y: 76024
|
package/lib/resource/query.html
CHANGED
|
@@ -351,6 +351,13 @@
|
|
|
351
351
|
width: 100%;
|
|
352
352
|
height: 180px;
|
|
353
353
|
border-radius: 0 0 16px 16px;
|
|
354
|
+
/* 未加载到瓦片的区域使用卡片同款深蓝底色,避免白底突兀 */
|
|
355
|
+
background: #0f1439;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/* 瓦片暗色化:部分反转(0.6)让底色为浅中灰,色相回转 + 提饱和保持黄色道路鲜亮 */
|
|
359
|
+
.map-section .leaflet-tile-pane {
|
|
360
|
+
filter: invert(0.78) hue-rotate(180deg) saturate(1.35) brightness(2);
|
|
354
361
|
}
|
|
355
362
|
|
|
356
363
|
/* ===== SPONSOR SECTION ===== */
|
|
@@ -585,7 +592,7 @@
|
|
|
585
592
|
<script>
|
|
586
593
|
let mapConfig = {
|
|
587
594
|
ets: {
|
|
588
|
-
tileUrl: 'https://
|
|
595
|
+
tileUrl: 'https://ets_tiles.cnly.top/20260903/tmp-ets-yellow/Tiles/{z}/{x}/{y}.png',
|
|
589
596
|
multipliers: { x: 70272, y: 76157 },
|
|
590
597
|
breakpoints: { uk: { x: -31056.8, y: -5832.867 } },
|
|
591
598
|
bounds: { y: 131072, x: 131072 },
|
|
@@ -596,7 +603,7 @@
|
|
|
596
603
|
}
|
|
597
604
|
},
|
|
598
605
|
promods: {
|
|
599
|
-
tileUrl: 'https://
|
|
606
|
+
tileUrl: 'https://ets_tiles.cnly.top/20260903/tmp-promods-yellow/Tiles/{z}/{x}/{y}.png',
|
|
600
607
|
multipliers: { x: 51953, y: 76024 },
|
|
601
608
|
breakpoints: { uk: { x: -31056.8, y: -5832.867 } },
|
|
602
609
|
bounds: { y: 131072, x: 131072 },
|
|
@@ -774,7 +781,7 @@
|
|
|
774
781
|
map.unproject([mapConfig[mapType].bounds.x, 0], mapConfig[mapType].maxZoom)
|
|
775
782
|
));
|
|
776
783
|
L.circleMarker(map.unproject(mapConfig[mapType].calculateMapCoordinate(x, y), 8), {
|
|
777
|
-
color: '#
|
|
784
|
+
color: '#e2e8f0', weight: 2, fillColor: '#22c55e', fillOpacity: 1, radius: 5, zIndex: 1000
|
|
778
785
|
}).addTo(map);
|
|
779
786
|
map.setView(map.unproject(mapConfig[mapType].calculateMapCoordinate(x, y), 8), 5);
|
|
780
787
|
}
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
<script>
|
|
247
247
|
let mapConfig = {
|
|
248
248
|
ets: {
|
|
249
|
-
tileUrl: 'https://
|
|
249
|
+
tileUrl: 'https://ets_tiles.cnly.top/20260903/tmp-ets-yellow/Tiles/{z}/{x}/{y}.png',
|
|
250
250
|
multipliers: { x: 70272, y: 76157 },
|
|
251
251
|
breakpoints: { uk: { x: -31056.8, y: -5832.867 } },
|
|
252
252
|
bounds: { y: 131072, x: 131072 },
|
|
@@ -256,7 +256,7 @@
|
|
|
256
256
|
}
|
|
257
257
|
},
|
|
258
258
|
promods: {
|
|
259
|
-
tileUrl: 'https://
|
|
259
|
+
tileUrl: 'https://ets_tiles.cnly.top/20260903/tmp-promods-yellow/Tiles/{z}/{x}/{y}.png',
|
|
260
260
|
multipliers: { x: 51953, y: 76024 },
|
|
261
261
|
breakpoints: { uk: { x: -31056.8, y: -5832.867 } },
|
|
262
262
|
bounds: { y: 131072, x: 131072 },
|