koishi-plugin-lutu 1.0.0
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.d.ts +33 -0
- package/lib/api/evmOpenApi.js +114 -0
- package/lib/api/truckersMpApi.d.ts +34 -0
- package/lib/api/truckersMpApi.js +133 -0
- package/lib/api/truckersMpMapApi.d.ts +6 -0
- package/lib/api/truckersMpMapApi.js +25 -0
- package/lib/api/truckyAppApi.d.ts +12 -0
- package/lib/api/truckyAppApi.js +48 -0
- package/lib/command/ets-app/queryPoint.js +74 -0
- package/lib/command/ets-app/resetPassword.js +111 -0
- package/lib/command/tmpActivityService.js +603 -0
- package/lib/command/tmpBind.d.ts +2 -0
- package/lib/command/tmpBind.js +18 -0
- package/lib/command/tmpDlcMap.d.ts +3 -0
- package/lib/command/tmpDlcMap.js +33 -0
- package/lib/command/tmpMileageRanking.d.ts +3 -0
- package/lib/command/tmpMileageRanking.js +55 -0
- package/lib/command/tmpPosition.d.ts +3 -0
- package/lib/command/tmpPosition.js +107 -0
- package/lib/command/tmpQuery/tmpQuery.d.ts +2 -0
- package/lib/command/tmpQuery/tmpQuery.js +12 -0
- package/lib/command/tmpQuery/tmpQueryImg.d.ts +3 -0
- package/lib/command/tmpQuery/tmpQueryImg.js +103 -0
- package/lib/command/tmpQuery/tmpQueryText.d.ts +2 -0
- package/lib/command/tmpQuery/tmpQueryText.js +175 -0
- package/lib/command/tmpServer.d.ts +2 -0
- package/lib/command/tmpServer.js +41 -0
- package/lib/command/tmpTraffic/tmpTraffic.d.ts +2 -0
- package/lib/command/tmpTraffic/tmpTraffic.js +15 -0
- package/lib/command/tmpTraffic/tmpTrafficMap.d.ts +3 -0
- package/lib/command/tmpTraffic/tmpTrafficMap.js +163 -0
- package/lib/command/tmpTraffic/tmpTrafficText.d.ts +2 -0
- package/lib/command/tmpTraffic/tmpTrafficText.js +60 -0
- package/lib/command/tmpVersion.d.ts +2 -0
- package/lib/command/tmpVersion.js +14 -0
- package/lib/command/tmpVtc.js +29 -0
- package/lib/database/guildBind.d.ts +15 -0
- package/lib/database/guildBind.js +41 -0
- package/lib/database/model.d.ts +2 -0
- package/lib/database/model.js +65 -0
- package/lib/database/translateCache.d.ts +14 -0
- package/lib/database/translateCache.js +31 -0
- package/lib/index.d.ts +35 -0
- package/lib/index.js +276 -0
- package/lib/resource/dlc.html +115 -0
- package/lib/resource/mileage-leaderboard.html +363 -0
- package/lib/resource/package/SEGUIEMJ.TTF +0 -0
- package/lib/resource/package/leaflet/heatmap.min.js +9 -0
- package/lib/resource/package/leaflet/leaflet-heatmap.js +246 -0
- package/lib/resource/package/leaflet/leaflet.min.css +1 -0
- package/lib/resource/package/leaflet/leaflet.min.js +1 -0
- package/lib/resource/position.html +223 -0
- package/lib/resource/query.html +363 -0
- package/lib/resource/traffic.html +207 -0
- package/lib/util/baiduTranslate.d.ts +2 -0
- package/lib/util/baiduTranslate.js +30 -0
- package/lib/util/common.d.ts +1 -0
- package/lib/util/common.js +5 -0
- package/lib/util/constant.d.ts +8 -0
- package/lib/util/constant.js +16 -0
- package/package.json +41 -0
- package/readme.md +143 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Title</title>
|
|
6
|
+
<link href="./package/leaflet/leaflet.min.css" rel="stylesheet">
|
|
7
|
+
<script src="./package/leaflet/leaflet.min.js"></script>
|
|
8
|
+
<style>
|
|
9
|
+
@font-face {
|
|
10
|
+
font-family: 'segui-emj';
|
|
11
|
+
src: url('./package/SEGUIEMJ.TTF');
|
|
12
|
+
font-weight: normal;
|
|
13
|
+
font-style: normal;
|
|
14
|
+
}
|
|
15
|
+
body {
|
|
16
|
+
font-family: 'segui-emj', 'sans-serif';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.border {
|
|
20
|
+
border: 1px solid red;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
#container {
|
|
24
|
+
padding-bottom: 16px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.form-box {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-wrap: wrap;
|
|
30
|
+
}
|
|
31
|
+
.form-box .form-item {
|
|
32
|
+
width: 50%;
|
|
33
|
+
}
|
|
34
|
+
.form-box .form-item.full {
|
|
35
|
+
width: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#container {
|
|
39
|
+
width: 400px;
|
|
40
|
+
background: linear-gradient(135deg, #1f2f54, #0f2c2a);
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.header {
|
|
45
|
+
height: 100px;
|
|
46
|
+
background-color: rgba(0, 0, 0, .1);
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
padding: 0 26px;
|
|
50
|
+
box-shadow: 0 0 16px rgba(0, 0, 0, .4);
|
|
51
|
+
}
|
|
52
|
+
.header .avatar {
|
|
53
|
+
width: 64px;
|
|
54
|
+
height: 64px;
|
|
55
|
+
}
|
|
56
|
+
.header .info {
|
|
57
|
+
flex: 1;
|
|
58
|
+
padding-left: 16px;
|
|
59
|
+
}
|
|
60
|
+
.header .info .name {
|
|
61
|
+
color: #b0c7ff;
|
|
62
|
+
font-size: 18px;
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
}
|
|
65
|
+
.header .info .tmp-id {
|
|
66
|
+
color: #aaaaaa;
|
|
67
|
+
font-size: 14px;
|
|
68
|
+
margin-top: 4px;
|
|
69
|
+
}
|
|
70
|
+
.header .info .group {
|
|
71
|
+
color: #ffffff;
|
|
72
|
+
font-size: 12px;
|
|
73
|
+
padding: 2px 4px;
|
|
74
|
+
margin-left: 6px;
|
|
75
|
+
border-radius: 4px;
|
|
76
|
+
text-shadow: 0 4px 4px rgba(0, 0, 0, 0.8),
|
|
77
|
+
0 -4px 4px rgba(0, 0, 0, 0.8);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.details-container {
|
|
81
|
+
padding: 16px 20px 0 20px;
|
|
82
|
+
}
|
|
83
|
+
.details-container .form-item {
|
|
84
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
85
|
+
box-sizing: border-box;
|
|
86
|
+
}
|
|
87
|
+
.details-container .form-item:nth-child(1) {
|
|
88
|
+
margin-top: 0;
|
|
89
|
+
}
|
|
90
|
+
.details-container .form-item .label {
|
|
91
|
+
color: #dddddd;
|
|
92
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
93
|
+
padding: 4px 8px;
|
|
94
|
+
}
|
|
95
|
+
.details-container .form-item .value {
|
|
96
|
+
color: #ffffff;
|
|
97
|
+
padding: 4px 8px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.ban-container {
|
|
101
|
+
margin: 16px 20px 0 20px;
|
|
102
|
+
background-color: rgba(227, 92, 92, 0.3);
|
|
103
|
+
}
|
|
104
|
+
.ban-header {
|
|
105
|
+
width: 100%;
|
|
106
|
+
height: 30px;
|
|
107
|
+
box-sizing: border-box;
|
|
108
|
+
padding: 0 12px;
|
|
109
|
+
color: #ffffff;
|
|
110
|
+
font-size: 14px;
|
|
111
|
+
line-height: 30px;
|
|
112
|
+
background-color: rgba(227, 92, 92, 0.6);
|
|
113
|
+
}
|
|
114
|
+
.ban-body {
|
|
115
|
+
padding: 12px 16px;
|
|
116
|
+
}
|
|
117
|
+
.ban-body .ban-hidden {
|
|
118
|
+
color: #cccccc;
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
font-style: italic;
|
|
121
|
+
text-align: center;
|
|
122
|
+
}
|
|
123
|
+
.ban-body .form-item {
|
|
124
|
+
margin-top: 8px;
|
|
125
|
+
}
|
|
126
|
+
.ban-body .form-item:nth-child(1),
|
|
127
|
+
.ban-body .form-item:nth-child(2) {
|
|
128
|
+
margin-top: 0;
|
|
129
|
+
}
|
|
130
|
+
.ban-body .form-item .label {
|
|
131
|
+
color: #f3f3f3;
|
|
132
|
+
font-size: 12px;
|
|
133
|
+
}
|
|
134
|
+
.ban-body .form-item .value {
|
|
135
|
+
color: #eeeeee;
|
|
136
|
+
font-size: 14px;
|
|
137
|
+
word-wrap: break-word;
|
|
138
|
+
word-break: break-all;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.position-container {
|
|
142
|
+
margin: 16px 20px;
|
|
143
|
+
}
|
|
144
|
+
.position-container .position-header {
|
|
145
|
+
width: 100%;
|
|
146
|
+
height: 30px;
|
|
147
|
+
box-sizing: border-box;
|
|
148
|
+
padding: 0 12px;
|
|
149
|
+
color: #ffffff;
|
|
150
|
+
font-size: 14px;
|
|
151
|
+
line-height: 30px;
|
|
152
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
153
|
+
}
|
|
154
|
+
.position-container #map {
|
|
155
|
+
width: 100%;
|
|
156
|
+
height: 150px;
|
|
157
|
+
background-color: rgba(0, 0, 0, 0.25);
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
160
|
+
</head>
|
|
161
|
+
<body>
|
|
162
|
+
<div id="container">
|
|
163
|
+
<div class="header">
|
|
164
|
+
<img class="avatar" id="tmp-avatar" src="" alt="avatar"/>
|
|
165
|
+
<div class="info">
|
|
166
|
+
<div class="name" id="tmp-name">-</div>
|
|
167
|
+
<div class="tmp-id" id="tmp-id"></div>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
<div class="details-container">
|
|
171
|
+
<div class="form-box">
|
|
172
|
+
<div class="form-item full">
|
|
173
|
+
<div class="label">🎮SteamID</div>
|
|
174
|
+
<div class="value" id="tmp-steam-id"></div>
|
|
175
|
+
</div>
|
|
176
|
+
<div class="form-item full">
|
|
177
|
+
<div class="label">📑注册日期</div>
|
|
178
|
+
<div class="value" id="tmp-register-date"></div>
|
|
179
|
+
</div>
|
|
180
|
+
<div class="form-item full" id="tmp-vtc-box">
|
|
181
|
+
<div class="label">🚚所属车队</div>
|
|
182
|
+
<div class="value" id="tmp-vtc-name"></div>
|
|
183
|
+
</div>
|
|
184
|
+
<div class="form-item full" id="tmp-vtc-role-box">
|
|
185
|
+
<div class="label">🚚车队角色</div>
|
|
186
|
+
<div class="value" id="tmp-vtc-role"></div>
|
|
187
|
+
</div>
|
|
188
|
+
<div class="form-item" id="tmp-sponsor-box">
|
|
189
|
+
<div class="label">🎁赞助用户</div>
|
|
190
|
+
<div class="value" id="tmp-sponsor-amount"></div>
|
|
191
|
+
</div>
|
|
192
|
+
<div class="form-item" id="tmp-sponsor-cumulative-box">
|
|
193
|
+
<div class="label">🎁累计赞助</div>
|
|
194
|
+
<div class="value" id="tmp-sponsor-cumulative"></div>
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
<div class="position-container" id="position-box">
|
|
199
|
+
<div class="position-header" id="position-title"></div>
|
|
200
|
+
<div id="map"></div>
|
|
201
|
+
</div>
|
|
202
|
+
<div class="ban-container" id="ban-box">
|
|
203
|
+
<div class="ban-header">封禁中</div>
|
|
204
|
+
<div class="ban-body">
|
|
205
|
+
<div class="ban-hidden" id="ban-hidden-box">玩家隐藏信息</div>
|
|
206
|
+
<div class="form-box" id="ban-info-box">
|
|
207
|
+
<div class="form-item">
|
|
208
|
+
<div class="label">截止时间</div>
|
|
209
|
+
<div class="value" id="ban-until"></div>
|
|
210
|
+
</div>
|
|
211
|
+
<div class="form-item">
|
|
212
|
+
<div class="label">封禁次数</div>
|
|
213
|
+
<div class="value" id="ban-count"></div>
|
|
214
|
+
</div>
|
|
215
|
+
<div class="form-item full">
|
|
216
|
+
<div class="label">原因</div>
|
|
217
|
+
<div class="value" id="ban-reason"></div>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
<script>
|
|
224
|
+
let mapConfig = {
|
|
225
|
+
ets: {
|
|
226
|
+
tileUrl: 'https://ets-map.oss-cn-beijing.aliyuncs.com/ets2/05102019/{z}/{x}/{y}.png',
|
|
227
|
+
multipliers: {
|
|
228
|
+
x: 71282,
|
|
229
|
+
y: 56532
|
|
230
|
+
},
|
|
231
|
+
breakpoints: {
|
|
232
|
+
uk: {
|
|
233
|
+
x: -31056.8,
|
|
234
|
+
y: -5832.867
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
bounds: {
|
|
238
|
+
y: 131072,
|
|
239
|
+
x: 131072
|
|
240
|
+
},
|
|
241
|
+
maxZoom: 8,
|
|
242
|
+
minZoom: 2,
|
|
243
|
+
// 游戏地转地图坐标
|
|
244
|
+
calculateMapCoordinate (x, y) {
|
|
245
|
+
return [
|
|
246
|
+
x / 1.325928 + mapConfig.ets.multipliers.x,
|
|
247
|
+
y / 1.325928 + mapConfig.ets.multipliers.y
|
|
248
|
+
];
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
promods: {
|
|
252
|
+
tileUrl: 'https://ets-map.oss-cn-beijing.aliyuncs.com/promods/05102019/{z}/{x}/{y}.png',
|
|
253
|
+
multipliers: {
|
|
254
|
+
x: 51953,
|
|
255
|
+
y: 76024
|
|
256
|
+
},
|
|
257
|
+
breakpoints: {
|
|
258
|
+
uk: {
|
|
259
|
+
x: -31056.8,
|
|
260
|
+
y: -5832.867
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
bounds: {
|
|
264
|
+
y: 131072,
|
|
265
|
+
x: 131072
|
|
266
|
+
},
|
|
267
|
+
maxZoom: 8,
|
|
268
|
+
minZoom: 2,
|
|
269
|
+
// 游戏地转地图坐标
|
|
270
|
+
calculateMapCoordinate (x, y) {
|
|
271
|
+
return [
|
|
272
|
+
x / 2.598541 + mapConfig.promods.multipliers.x,
|
|
273
|
+
y / 2.598541 + mapConfig.promods.multipliers.y
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function init(data) {
|
|
280
|
+
document.getElementById('tmp-name').innerText = data.name
|
|
281
|
+
document.getElementById('tmp-avatar').src = data.avatarUrl
|
|
282
|
+
document.getElementById('tmp-id').innerHTML = `TMP#${data.tmpId} <span class="group" style="background-color: #${data.groupColor}">${data.groupName}</span>`
|
|
283
|
+
document.getElementById('tmp-steam-id').innerText = data.steamId
|
|
284
|
+
document.getElementById('tmp-register-date').innerText = data.registerDate
|
|
285
|
+
if (data.isJoinVtc) {
|
|
286
|
+
document.getElementById('tmp-vtc-name').innerText = data.vtcName
|
|
287
|
+
document.getElementById('tmp-vtc-role').innerText = data.vtcRole
|
|
288
|
+
} else {
|
|
289
|
+
document.getElementById('tmp-vtc-box').remove()
|
|
290
|
+
document.getElementById('tmp-vtc-role-box').remove()
|
|
291
|
+
}
|
|
292
|
+
if (data.isSponsor && !data.sponsorHide) {
|
|
293
|
+
document.getElementById('tmp-sponsor-amount').innerText = '$' + Math.floor(data.sponsorAmount / 100)
|
|
294
|
+
document.getElementById('tmp-sponsor-cumulative').innerText = '$' + Math.floor(data.sponsorCumulativeAmount / 100)
|
|
295
|
+
} else {
|
|
296
|
+
document.getElementById('tmp-sponsor-box').remove()
|
|
297
|
+
document.getElementById('tmp-sponsor-cumulative-box').remove()
|
|
298
|
+
}
|
|
299
|
+
if (data.isOnline) {
|
|
300
|
+
document.getElementById('position-title').innerText = `${data.onlineServerName} · ${data.onlineCountry}-${data.onlineCity}`
|
|
301
|
+
map(data.onlineMapType, data.onlineX, data.onlineY)
|
|
302
|
+
} else {
|
|
303
|
+
document.getElementById('position-box').remove()
|
|
304
|
+
}
|
|
305
|
+
if (data.isBan) {
|
|
306
|
+
if (data.banHide) {
|
|
307
|
+
document.getElementById('ban-info-box').remove()
|
|
308
|
+
} else {
|
|
309
|
+
document.getElementById('ban-hidden-box').remove()
|
|
310
|
+
document.getElementById('ban-until').innerText = (data.banUntil || '永久')
|
|
311
|
+
document.getElementById('ban-count').innerText = (data.banCount || 0) + '次'
|
|
312
|
+
document.getElementById('ban-reason').innerText = data.banReasonZh || data.banReason
|
|
313
|
+
}
|
|
314
|
+
} else {
|
|
315
|
+
document.getElementById('ban-box').remove()
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function map(mapType, x, y) {
|
|
320
|
+
// 定义地图
|
|
321
|
+
let map = L.map('map', {
|
|
322
|
+
attributionControl: false,
|
|
323
|
+
crs: L.CRS.Simple,
|
|
324
|
+
zoomControl: false
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// 边界
|
|
328
|
+
let bounds = L.latLngBounds(
|
|
329
|
+
map.unproject([0, mapConfig[mapType].bounds.y], mapConfig[mapType].maxZoom),
|
|
330
|
+
map.unproject([mapConfig[mapType].bounds.x, 0], mapConfig[mapType].maxZoom)
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
// 瓦片地图
|
|
334
|
+
L.tileLayer(mapConfig[mapType].tileUrl, {
|
|
335
|
+
minZoom: 2,
|
|
336
|
+
maxZoom: 10,
|
|
337
|
+
maxNativeZoom: 8,
|
|
338
|
+
tileSize: 512,
|
|
339
|
+
bounds: bounds,
|
|
340
|
+
reuseTiles: true
|
|
341
|
+
}).addTo(map);
|
|
342
|
+
map.setMaxBounds(
|
|
343
|
+
new L.LatLngBounds(
|
|
344
|
+
map.unproject([0, mapConfig[mapType].bounds.y], mapConfig[mapType].maxZoom),
|
|
345
|
+
map.unproject([mapConfig[mapType].bounds.x, 0], mapConfig[mapType].maxZoom)
|
|
346
|
+
)
|
|
347
|
+
);
|
|
348
|
+
|
|
349
|
+
L.circleMarker(map.unproject(mapConfig[mapType].calculateMapCoordinate(x, y), 8), {
|
|
350
|
+
color: '#2f2f2f', // 标记点边框颜色
|
|
351
|
+
weight: 2, // 标记点边框大小
|
|
352
|
+
fillColor: '#1cb715', // 标记点填充颜色
|
|
353
|
+
fillOpacity: 1, // 标记点填充不透明度(0到1之间的值)
|
|
354
|
+
radius: 5, // 标记点半径(以像素为单位)
|
|
355
|
+
zIndex: 1000
|
|
356
|
+
}).addTo(map);
|
|
357
|
+
|
|
358
|
+
// 设置中心点
|
|
359
|
+
map.setView(map.unproject(mapConfig[mapType].calculateMapCoordinate(x, y), 8), 5);
|
|
360
|
+
}
|
|
361
|
+
</script>
|
|
362
|
+
</body>
|
|
363
|
+
</html>
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title></title>
|
|
6
|
+
<link href="./package/leaflet/leaflet.min.css" rel="stylesheet">
|
|
7
|
+
<script src="./package/leaflet/leaflet.min.js"></script>
|
|
8
|
+
<script src="./package/leaflet/heatmap.min.js"></script>
|
|
9
|
+
<script src="./package/leaflet/leaflet-heatmap.js"></script>
|
|
10
|
+
<style>
|
|
11
|
+
body, html {
|
|
12
|
+
margin: 0;
|
|
13
|
+
padding: 0;
|
|
14
|
+
}
|
|
15
|
+
* {
|
|
16
|
+
font-family: "微软雅黑", serif;
|
|
17
|
+
}
|
|
18
|
+
#container {
|
|
19
|
+
width: 1000px;
|
|
20
|
+
position: relative;
|
|
21
|
+
}
|
|
22
|
+
.map {
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 900px;
|
|
25
|
+
background-color: #4b4b4b;
|
|
26
|
+
}
|
|
27
|
+
.traffic-box {
|
|
28
|
+
//position: absolute;
|
|
29
|
+
//bottom: 0;
|
|
30
|
+
//left: 0;
|
|
31
|
+
//z-index: 9999999;
|
|
32
|
+
width: 100%;
|
|
33
|
+
backdrop-filter: blur(3px);
|
|
34
|
+
background-color: #4b4b4b;
|
|
35
|
+
padding: 12px 16px;
|
|
36
|
+
box-sizing: border-box;
|
|
37
|
+
overflow-y: hidden;
|
|
38
|
+
}
|
|
39
|
+
.traffic-item {
|
|
40
|
+
color: #ffffff;
|
|
41
|
+
width: 33.3333%;
|
|
42
|
+
float: left;
|
|
43
|
+
margin-top: 8px;
|
|
44
|
+
font-size: 14px;
|
|
45
|
+
border-right: 1px solid rgba(255, 255, 255, 0.3);
|
|
46
|
+
box-sizing: border-box;
|
|
47
|
+
padding: 0 10px;
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: row;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
}
|
|
53
|
+
.traffic-item:nth-child(-n+3) {
|
|
54
|
+
margin-top: 0;
|
|
55
|
+
}
|
|
56
|
+
.traffic-item:last-child, .traffic-item:nth-child(3n) {
|
|
57
|
+
border-right: 0;
|
|
58
|
+
}
|
|
59
|
+
.traffic-item .region-info {
|
|
60
|
+
display: inline-block;
|
|
61
|
+
width: 72%;
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
text-overflow: ellipsis;
|
|
65
|
+
}
|
|
66
|
+
.traffic-item .player-count {
|
|
67
|
+
display: inline-block;
|
|
68
|
+
width: 16%;
|
|
69
|
+
text-align: center;
|
|
70
|
+
}
|
|
71
|
+
.traffic-item .traffic-status {
|
|
72
|
+
display: inline-block;
|
|
73
|
+
width: 12%;
|
|
74
|
+
text-align: right;
|
|
75
|
+
}
|
|
76
|
+
</style>
|
|
77
|
+
</head>
|
|
78
|
+
<body>
|
|
79
|
+
<div id="container">
|
|
80
|
+
<div id="map" class="map"></div>
|
|
81
|
+
<div class="traffic-box"></div>
|
|
82
|
+
</div>
|
|
83
|
+
<script>
|
|
84
|
+
let mapConfig = {
|
|
85
|
+
ets: {
|
|
86
|
+
tileUrl: 'https://ets-map.oss-cn-beijing.aliyuncs.com/ets2/05102019/{z}/{x}/{y}.png',
|
|
87
|
+
multipliers: {
|
|
88
|
+
x: 70272,
|
|
89
|
+
y: 76157
|
|
90
|
+
},
|
|
91
|
+
breakpoints: {
|
|
92
|
+
uk: {
|
|
93
|
+
x: -31056.8,
|
|
94
|
+
y: -5832.867
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
bounds: {
|
|
98
|
+
y: 131072,
|
|
99
|
+
x: 131072
|
|
100
|
+
},
|
|
101
|
+
maxZoom: 8,
|
|
102
|
+
minZoom: 2,
|
|
103
|
+
// 游戏地转地图坐标
|
|
104
|
+
calculateMapCoordinate (x, y) {
|
|
105
|
+
return [
|
|
106
|
+
x / 1.609055 + mapConfig.ets.multipliers.x,
|
|
107
|
+
y / 1.609055 + mapConfig.ets.multipliers.y
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
promods: {
|
|
112
|
+
tileUrl: 'https://ets-map.oss-cn-beijing.aliyuncs.com/promods/05102019/{z}/{x}/{y}.png',
|
|
113
|
+
multipliers: {
|
|
114
|
+
x: 51953,
|
|
115
|
+
y: 76024
|
|
116
|
+
},
|
|
117
|
+
breakpoints: {
|
|
118
|
+
uk: {
|
|
119
|
+
x: -31056.8,
|
|
120
|
+
y: -5832.867
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
bounds: {
|
|
124
|
+
y: 131072,
|
|
125
|
+
x: 131072
|
|
126
|
+
},
|
|
127
|
+
maxZoom: 8,
|
|
128
|
+
minZoom: 2,
|
|
129
|
+
// 游戏地转地图坐标
|
|
130
|
+
calculateMapCoordinate (x, y) {
|
|
131
|
+
return [
|
|
132
|
+
x / 2.598541 + mapConfig.promods.multipliers.x,
|
|
133
|
+
y / 2.598541 + mapConfig.promods.multipliers.y
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// 定义地图
|
|
140
|
+
let map = L.map('map', {
|
|
141
|
+
attributionControl: false,
|
|
142
|
+
crs: L.CRS.Simple,
|
|
143
|
+
zoomControl: false,
|
|
144
|
+
zoomSnap: 0.1
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
function setData(data) {
|
|
148
|
+
// 边界
|
|
149
|
+
let bounds = L.latLngBounds(
|
|
150
|
+
map.unproject([0, mapConfig[data.mapType].bounds.y], mapConfig[data.mapType].maxZoom),
|
|
151
|
+
map.unproject([mapConfig[data.mapType].bounds.x, 0], mapConfig[data.mapType].maxZoom)
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
// 瓦片地图
|
|
155
|
+
L.tileLayer(mapConfig[data.mapType].tileUrl, {
|
|
156
|
+
minZoom: 0,
|
|
157
|
+
maxZoom: 8,
|
|
158
|
+
minNativeZoom: 1,
|
|
159
|
+
maxNativeZoom: 8,
|
|
160
|
+
tileSize: 512,
|
|
161
|
+
bounds: bounds,
|
|
162
|
+
reuseTiles: true
|
|
163
|
+
}).addTo(map);
|
|
164
|
+
map.setMaxBounds(
|
|
165
|
+
new L.LatLngBounds(
|
|
166
|
+
map.unproject([0, mapConfig[data.mapType].bounds.y], mapConfig[data.mapType].maxZoom),
|
|
167
|
+
map.unproject([mapConfig[data.mapType].bounds.x, 0], mapConfig[data.mapType].maxZoom)
|
|
168
|
+
)
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
// 展示地图全貌
|
|
172
|
+
map.fitBounds(bounds)
|
|
173
|
+
|
|
174
|
+
// 热力图
|
|
175
|
+
let heatmapLayer = new HeatmapOverlay({
|
|
176
|
+
radius: 3,
|
|
177
|
+
maxOpacity: 0.8,
|
|
178
|
+
scaleRadius: true,
|
|
179
|
+
useLocalExtrema: true,
|
|
180
|
+
latField: "lat",
|
|
181
|
+
lngField: "lng",
|
|
182
|
+
valueField: "count"
|
|
183
|
+
});
|
|
184
|
+
map.addLayer(heatmapLayer);
|
|
185
|
+
let heatmapData = []
|
|
186
|
+
for (const arrayElement of data.playerCoordinateList) {
|
|
187
|
+
let unprojected = map.unproject(mapConfig[data.mapType].calculateMapCoordinate(arrayElement[0], arrayElement[1]), 8);
|
|
188
|
+
heatmapData.push({ lat: unprojected.lat, lng: unprojected.lng, count: 1 });
|
|
189
|
+
}
|
|
190
|
+
heatmapLayer.setData({
|
|
191
|
+
min: 1,
|
|
192
|
+
max: 5000,
|
|
193
|
+
data: heatmapData
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
// 展示热门地区路况状态
|
|
197
|
+
for (const traffic of data.trafficList) {
|
|
198
|
+
document.getElementsByClassName('traffic-box')[0].insertAdjacentHTML('beforeend', `
|
|
199
|
+
<div class="traffic-item">
|
|
200
|
+
<span class="region-info"><strong>${traffic.country}</strong> ${traffic.province}</span><span class="player-count">${traffic.playerCount}人</span><span class="traffic-status" style="color: ${traffic.severity.color}">${traffic.severity.text}</span>
|
|
201
|
+
</div>
|
|
202
|
+
`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
</script>
|
|
206
|
+
</body>
|
|
207
|
+
</html>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const md5 = require('js-md5');
|
|
2
|
+
const translateCache = require('../database/translateCache');
|
|
3
|
+
const TRANSLATE_API = 'https://fanyi-api.baidu.com/api/trans/vip/translate';
|
|
4
|
+
module.exports = async (ctx, cfg, content, cache = true) => {
|
|
5
|
+
// 没有开启百度翻译功能,直接返回文本
|
|
6
|
+
if (!cfg.baiduTranslate?.enable) {
|
|
7
|
+
return content;
|
|
8
|
+
}
|
|
9
|
+
// 如果开启了缓存,尝试从缓存中查询翻译
|
|
10
|
+
if (cfg.baiduTranslate?.cacheEnable && cache) {
|
|
11
|
+
let translateContent = await translateCache.getTranslate(ctx.database, md5(content));
|
|
12
|
+
if (translateContent) {
|
|
13
|
+
return translateContent;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
// 创建请求秘钥
|
|
17
|
+
let randomInt = Math.floor(Math.random() * 10000);
|
|
18
|
+
let sign = md5(cfg.baiduTranslate?.appId + content + randomInt + cfg.baiduTranslate?.key);
|
|
19
|
+
// 调用请求
|
|
20
|
+
let result = await ctx.http.get(`${TRANSLATE_API}?q=${encodeURI(content)}&from=auto&to=zh&appid=${cfg.baiduTranslate?.appId}&salt=${randomInt}&sign=${sign}`);
|
|
21
|
+
// 如果翻译失败,直接返回内容
|
|
22
|
+
if (result.error_code) {
|
|
23
|
+
return content;
|
|
24
|
+
}
|
|
25
|
+
// 如果开启了缓存,将翻译内容缓存到数据库
|
|
26
|
+
if (cfg.baiduTranslate?.cacheEnable && cache) {
|
|
27
|
+
translateCache.save(ctx.database, md5(content), content, result.trans_result[0].dst);
|
|
28
|
+
}
|
|
29
|
+
return result.trans_result[0].dst;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function sleep(ms: any): Promise<any>;
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "koishi-plugin-lutu",
|
|
3
|
+
"description": "鹿途车队查询插件",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"contributors": [
|
|
6
|
+
"opwop <2822296635@qq.com>",
|
|
7
|
+
"bot_actions <2822296635@qq.com>"
|
|
8
|
+
],
|
|
9
|
+
"main": "lib/index.js",
|
|
10
|
+
"typings": "lib/index.d.ts",
|
|
11
|
+
"homepage": "",
|
|
12
|
+
"files": [
|
|
13
|
+
"lib",
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"scripts": {},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"chatbot",
|
|
20
|
+
"koishi",
|
|
21
|
+
"plugin",
|
|
22
|
+
"ETS2",
|
|
23
|
+
"欧卡2",
|
|
24
|
+
"欧洲卡车模拟",
|
|
25
|
+
"车队平台"
|
|
26
|
+
],
|
|
27
|
+
"koishi": {
|
|
28
|
+
"service": {
|
|
29
|
+
"required": [
|
|
30
|
+
"database"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"dayjs": "^1.11.13",
|
|
36
|
+
"js-md5": "^0.8.3"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"koishi": "^4.18.7"
|
|
40
|
+
}
|
|
41
|
+
}
|