aram-mayhem-dsh 0.3.0 → 0.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/INSTALL.zh-CN.txt +61 -54
- package/LICENSE +27 -27
- package/README.md +234 -194
- package/THIRD_PARTY_NOTICES.md +50 -50
- package/client.js +973 -829
- package/config/settings.json +57 -57
- package/cordis.patch.yml +5 -6
- package/data/README.md +9 -9
- package/docs/DETAIL.md +3 -3
- package/docs/DETAIL.zh.md +3 -3
- package/docs/preview.svg +63 -63
- package/icon.svg +23 -23
- package/index.js +544 -439
- package/install.ps1 +63 -63
- package/locale/en.json +7 -7
- package/locale/zh.json +7 -7
- package/package.json +72 -72
- package/requirements-core.txt +6 -6
- package/requirements-dsh.txt +8 -8
- package/scripts/desktop_overlay.py +1305 -1305
- package/scripts/dsh_service.py +999 -999
- package/src/__init__.py +3 -3
- package/src/app.py +462 -462
- package/src/core/__init__.py +1 -1
- package/src/core/event_bus.py +56 -56
- package/src/core/events.py +28 -28
- package/src/core/hotkeys.py +166 -166
- package/src/core/logging_setup.py +44 -44
- package/src/core/paths.py +44 -44
- package/src/core/settings.py +271 -271
- package/src/data/__init__.py +1 -1
- package/src/data/fetcher.py +239 -239
- package/src/data/matcher.py +534 -534
- package/src/data/models.py +287 -287
- package/src/data/schema.py +128 -128
- package/src/data/scoring.py +127 -127
- package/src/data/store.py +543 -543
- package/src/lcu/__init__.py +1 -1
- package/src/lcu/connector.py +316 -316
- package/src/lcu/listener.py +507 -507
- package/src/main.py +76 -76
- package/src/ui/__init__.py +1 -1
- package/src/ui/augment_panel.py +276 -276
- package/src/ui/build_panel.py +319 -319
- package/src/ui/champ_panel.py +236 -236
- package/src/ui/overlay_window.py +631 -631
- package/src/ui/theme.py +298 -298
- package/src/ui/widgets.py +408 -408
- package/src/vision/__init__.py +1 -1
- package/src/vision/capture.py +249 -249
- package/src/vision/ocr_engine.py +122 -122
- package/src/vision/scanner.py +272 -272
package/client.js
CHANGED
|
@@ -1,829 +1,973 @@
|
|
|
1
|
-
window.__ModuleLoader__.load({
|
|
2
|
-
id: 'aram-mayhem-dsh',
|
|
3
|
-
factory(require) {
|
|
4
|
-
const React = require('react')
|
|
5
|
-
const h = React.createElement
|
|
6
|
-
const { useEffect, useRef, useState } = React
|
|
7
|
-
|
|
8
|
-
// Web and Electron (app://app) use the DSH same-origin relay; a plain
|
|
9
|
-
// file:// page falls back to the loopback service, which allows null origin.
|
|
10
|
-
const API = location.protocol === 'file:' ? 'http://127.0.0.1:8123' : '/aram-api'
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
{ id: '
|
|
15
|
-
{ id: '
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
return h('div', { style: S.
|
|
235
|
-
h('
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
},
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
h('
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
(
|
|
343
|
-
|
|
344
|
-
},
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
h(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
h('div', null,
|
|
358
|
-
h('div', { style: S.section }, h('span', { style: S.sectionTitle }, '
|
|
359
|
-
h('div', { style:
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
const [
|
|
406
|
-
const
|
|
407
|
-
const
|
|
408
|
-
const
|
|
409
|
-
const
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
} catch
|
|
448
|
-
if (alive)
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
pull()
|
|
452
|
-
const timer = setInterval(pull,
|
|
453
|
-
return () => { alive = false; clearInterval(timer) }
|
|
454
|
-
}, [])
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
if (
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
try {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
if (
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
try {
|
|
568
|
-
const data =
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
const
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
:
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
:
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
},
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: 'aram-mayhem-dsh',
|
|
3
|
+
factory(require) {
|
|
4
|
+
const React = require('react')
|
|
5
|
+
const h = React.createElement
|
|
6
|
+
const { useEffect, useRef, useState } = React
|
|
7
|
+
|
|
8
|
+
// Web and Electron (app://app) use the DSH same-origin relay; a plain
|
|
9
|
+
// file:// page falls back to the loopback service, which allows null origin.
|
|
10
|
+
const API = location.protocol === 'file:' ? 'http://127.0.0.1:8123' : '/aram-api'
|
|
11
|
+
const CONTROL = '/aram-control'
|
|
12
|
+
const AUTO_KEY = 'dsh.aram-mayhem.auto-scan.v1'
|
|
13
|
+
const TABS = [
|
|
14
|
+
{ id: 'champ', label: '选人' },
|
|
15
|
+
{ id: 'augment', label: '推荐海克斯' },
|
|
16
|
+
{ id: 'build', label: '出装' },
|
|
17
|
+
]
|
|
18
|
+
const TIER = {
|
|
19
|
+
T0: { color: '#B8862F', bg: 'rgba(184,134,47,.12)' },
|
|
20
|
+
T1: { color: '#238A78', bg: 'rgba(35,138,120,.12)' },
|
|
21
|
+
T2: { color: '#4E78A8', bg: 'rgba(78,120,168,.12)' },
|
|
22
|
+
T3: { color: '#7B8798', bg: 'rgba(123,135,152,.12)' },
|
|
23
|
+
}
|
|
24
|
+
// League augment rarity accents: silver / gold / prismatic.
|
|
25
|
+
const RARITY = {
|
|
26
|
+
prismatic: {
|
|
27
|
+
color: '#8B5CF6',
|
|
28
|
+
// Iridescent border, the same cyan → violet → gold reading as the
|
|
29
|
+
// prismatic augment card frame in game.
|
|
30
|
+
background: 'linear-gradient(135deg, rgba(92,225,230,.18), rgba(179,136,255,.22), rgba(255,209,102,.18)) padding-box, '
|
|
31
|
+
+ 'linear-gradient(135deg, #5CE1E6, #B388FF, #FFD166) border-box',
|
|
32
|
+
border: '1px solid transparent',
|
|
33
|
+
},
|
|
34
|
+
gold: {
|
|
35
|
+
color: '#A77B2C',
|
|
36
|
+
bg: 'rgba(200,170,110,.16)',
|
|
37
|
+
border: '1px solid #C8AA6E99',
|
|
38
|
+
},
|
|
39
|
+
silver: {
|
|
40
|
+
color: '#6F7F94',
|
|
41
|
+
bg: 'rgba(174,186,203,.16)',
|
|
42
|
+
border: '1px solid #AEBACB99',
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const S = {
|
|
47
|
+
page: {
|
|
48
|
+
height: '100%', minHeight: 0, boxSizing: 'border-box', display: 'flex',
|
|
49
|
+
flexDirection: 'column', padding: '18px 26px 14px', gap: 10,
|
|
50
|
+
fontSize: 13, lineHeight: 1.55, overflow: 'hidden',
|
|
51
|
+
},
|
|
52
|
+
row: { display: 'flex', alignItems: 'center', gap: 8 },
|
|
53
|
+
wrap: { display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' },
|
|
54
|
+
title: { fontSize: 22, fontWeight: 650, margin: 0, letterSpacing: '-0.01em' },
|
|
55
|
+
sub: { opacity: 0.64, fontSize: 12.5 },
|
|
56
|
+
header: { display: 'flex', justifyContent: 'space-between', gap: 14, alignItems: 'flex-start', flexWrap: 'wrap', flexShrink: 0 },
|
|
57
|
+
card: {
|
|
58
|
+
border: '1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.22))',
|
|
59
|
+
background: 'var(--dsw-alias-card-fill, rgba(128,128,128,.055))',
|
|
60
|
+
borderRadius: 14,
|
|
61
|
+
},
|
|
62
|
+
hero: {
|
|
63
|
+
border: '1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.22))',
|
|
64
|
+
background: 'var(--dsw-alias-card-fill, rgba(128,128,128,.055))',
|
|
65
|
+
borderRadius: 16, padding: 16,
|
|
66
|
+
},
|
|
67
|
+
chip: {
|
|
68
|
+
display: 'inline-flex', alignItems: 'center', gap: 5, padding: '2px 8px',
|
|
69
|
+
borderRadius: 999, border: '1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.26))',
|
|
70
|
+
fontSize: 11.5, lineHeight: 1.6, whiteSpace: 'nowrap',
|
|
71
|
+
},
|
|
72
|
+
btn: {
|
|
73
|
+
border: '1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.35))',
|
|
74
|
+
background: 'transparent', color: 'inherit', borderRadius: 9,
|
|
75
|
+
padding: '6px 12px', cursor: 'pointer', fontSize: 12.5,
|
|
76
|
+
},
|
|
77
|
+
primary: {
|
|
78
|
+
border: '1px solid var(--dsw-alias-border-l3, rgba(128,128,128,.3))',
|
|
79
|
+
background: 'var(--dsw-alias-button-primary-dimmed, rgba(128,128,128,.16))',
|
|
80
|
+
color: 'var(--dsw-alias-label-primary, inherit)',
|
|
81
|
+
borderRadius: 9, padding: '7px 14px', cursor: 'pointer', fontSize: 12.5,
|
|
82
|
+
},
|
|
83
|
+
input: {
|
|
84
|
+
border: '1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.3))',
|
|
85
|
+
background: 'transparent', color: 'inherit', borderRadius: 9,
|
|
86
|
+
padding: '7px 10px', fontSize: 12.5, width: 170, outline: 'none',
|
|
87
|
+
},
|
|
88
|
+
tab: on => ({
|
|
89
|
+
border: 'none', borderBottom: `2px solid ${on ? 'var(--dsw-alias-brand-primary, #0F8A9D)' : 'transparent'}`,
|
|
90
|
+
background: 'transparent', color: on ? 'var(--dsw-alias-brand-primary, #0F8A9D)' : 'inherit',
|
|
91
|
+
opacity: on ? 1 : 0.65, padding: '7px 12px', cursor: 'pointer', fontSize: 13,
|
|
92
|
+
fontWeight: on ? 650 : 500,
|
|
93
|
+
}),
|
|
94
|
+
section: { display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', gap: 10, margin: '4px 0 8px' },
|
|
95
|
+
sectionTitle: { fontSize: 13, fontWeight: 650 },
|
|
96
|
+
muted: { opacity: 0.62, fontSize: 12 },
|
|
97
|
+
benchGrid: { display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))', gap: 8 },
|
|
98
|
+
rowCard: {
|
|
99
|
+
display: 'flex', alignItems: 'center', gap: 9, padding: '8px 10px',
|
|
100
|
+
border: '1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.2))', borderRadius: 11,
|
|
101
|
+
background: 'transparent', color: 'inherit', textAlign: 'left', cursor: 'pointer', width: '100%',
|
|
102
|
+
},
|
|
103
|
+
metric: { display: 'flex', flexDirection: 'column', gap: 0, minWidth: 58 },
|
|
104
|
+
metricV: { fontSize: 15, fontWeight: 700, fontVariantNumeric: 'tabular-nums' },
|
|
105
|
+
metricL: { fontSize: 10.5, opacity: 0.58, whiteSpace: 'nowrap' },
|
|
106
|
+
bar: { height: 5, borderRadius: 999, background: 'var(--dsw-alias-border-l2, rgba(128,128,128,.2))', overflow: 'hidden' },
|
|
107
|
+
body: { flex: 1, minHeight: 0, overflow: 'auto', paddingRight: 4, display: 'flex', flexDirection: 'column', gap: 10 },
|
|
108
|
+
item: {
|
|
109
|
+
display: 'inline-flex', alignItems: 'center', gap: 6, padding: '4px 8px',
|
|
110
|
+
borderRadius: 8, border: '1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.22))',
|
|
111
|
+
fontSize: 11.5, whiteSpace: 'nowrap',
|
|
112
|
+
},
|
|
113
|
+
skill: color => ({
|
|
114
|
+
width: 28, height: 28, display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
|
115
|
+
borderRadius: 7, border: `1px solid ${color}66`, color, background: `${color}18`,
|
|
116
|
+
fontSize: 12.5, fontWeight: 700,
|
|
117
|
+
}),
|
|
118
|
+
banner: {
|
|
119
|
+
border: '1px solid rgba(200,120,50,.35)', background: 'rgba(200,120,50,.08)',
|
|
120
|
+
borderRadius: 10, padding: '8px 10px', fontSize: 12.5, flexShrink: 0,
|
|
121
|
+
},
|
|
122
|
+
error: {
|
|
123
|
+
border: '1px solid rgba(200,70,70,.35)', background: 'rgba(200,70,70,.08)',
|
|
124
|
+
borderRadius: 10, padding: '9px 11px', fontSize: 12.5, flexShrink: 0,
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const pct = (value, digits = 1) => typeof value === 'number' ? `${(value * 100).toFixed(digits)}%` : '--'
|
|
129
|
+
|
|
130
|
+
async function get(path, timeout = 8000) {
|
|
131
|
+
const response = await fetch(`${API}${path}`, { signal: AbortSignal.timeout(timeout) })
|
|
132
|
+
const data = await response.json().catch(() => ({}))
|
|
133
|
+
if (!response.ok) throw new Error(data.error || `HTTP ${response.status}`)
|
|
134
|
+
return data
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async function post(path, body, timeout = 180000) {
|
|
138
|
+
const response = await fetch(`${API}${path}`, {
|
|
139
|
+
method: 'POST',
|
|
140
|
+
headers: { 'Content-Type': 'application/json; charset=utf-8' },
|
|
141
|
+
body: JSON.stringify(body || {}),
|
|
142
|
+
signal: AbortSignal.timeout(timeout),
|
|
143
|
+
})
|
|
144
|
+
const data = await response.json().catch(() => ({}))
|
|
145
|
+
if (!response.ok) throw new Error(data.error || `HTTP ${response.status}`)
|
|
146
|
+
return data
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async function controlGet(path = '/status', timeout = 5000) {
|
|
150
|
+
const response = await fetch(`${CONTROL}${path}`, { signal: AbortSignal.timeout(timeout) })
|
|
151
|
+
const data = await response.json().catch(() => ({}))
|
|
152
|
+
if (!response.ok) throw new Error(data.error || `HTTP ${response.status}`)
|
|
153
|
+
return data
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
async function controlPost(path, timeout = 75000) {
|
|
157
|
+
const response = await fetch(`${CONTROL}${path}`, {
|
|
158
|
+
method: 'POST',
|
|
159
|
+
headers: { 'Content-Type': 'application/json; charset=utf-8' },
|
|
160
|
+
body: '{}',
|
|
161
|
+
signal: AbortSignal.timeout(timeout),
|
|
162
|
+
})
|
|
163
|
+
const data = await response.json().catch(() => ({}))
|
|
164
|
+
if (!response.ok) throw new Error(data.error || `HTTP ${response.status}`)
|
|
165
|
+
return data
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function Chip({ children, tone = 'normal', title }) {
|
|
169
|
+
const color = tone === 'gold' ? '#B8862F' : tone === 'green' ? '#2F9E62'
|
|
170
|
+
: tone === 'red' ? '#C05050' : undefined
|
|
171
|
+
return h('span', {
|
|
172
|
+
style: {
|
|
173
|
+
...S.chip,
|
|
174
|
+
...(color ? { color, borderColor: `${color}55`, background: `${color}10` } : {}),
|
|
175
|
+
},
|
|
176
|
+
title,
|
|
177
|
+
}, children)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function Tier({ tier }) {
|
|
181
|
+
const t = TIER[tier] || TIER.T2
|
|
182
|
+
return h('span', {
|
|
183
|
+
style: {
|
|
184
|
+
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
|
185
|
+
minWidth: 26, height: 18, padding: '0 5px', borderRadius: 5,
|
|
186
|
+
color: t.color, background: t.bg, border: `1px solid ${t.color}44`,
|
|
187
|
+
fontSize: 10, fontWeight: 700,
|
|
188
|
+
},
|
|
189
|
+
}, tier || 'T2')
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function Rarity({ rarity, label }) {
|
|
193
|
+
const r = RARITY[rarity] || RARITY.gold
|
|
194
|
+
return h('span', {
|
|
195
|
+
style: {
|
|
196
|
+
padding: '1px 5px', borderRadius: 4, fontSize: 10,
|
|
197
|
+
color: r.color, background: r.bg || r.background,
|
|
198
|
+
border: r.border || `1px solid ${r.color}44`,
|
|
199
|
+
},
|
|
200
|
+
}, label || rarity || '?')
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const AVATAR_COLORS = ['#3A6B8E', '#6F5AA8', '#A86E3A', '#3E8078', '#9A5E72']
|
|
204
|
+
|
|
205
|
+
function Avatar({ name, size = 38, tier }) {
|
|
206
|
+
const initial = (name || '?').slice(0, 1)
|
|
207
|
+
const color = AVATAR_COLORS[Math.abs((name || '').split('').reduce((a, ch) => a + ch.charCodeAt(0), 0)) % AVATAR_COLORS.length]
|
|
208
|
+
const border = (TIER[tier] || TIER.T2).color
|
|
209
|
+
return h('span', {
|
|
210
|
+
style: {
|
|
211
|
+
width: size, height: size, borderRadius: '50%', flex: '0 0 auto',
|
|
212
|
+
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
|
213
|
+
color: '#fff', fontSize: Math.round(size * .4), fontWeight: 700,
|
|
214
|
+
background: `linear-gradient(135deg, ${color}, ${color}99)`,
|
|
215
|
+
border: `1px solid ${border}88`,
|
|
216
|
+
},
|
|
217
|
+
}, initial)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function Bar({ value, best }) {
|
|
221
|
+
const width = Math.max(0, Math.min(100, Number(value) || 0))
|
|
222
|
+
return h('div', { style: S.bar },
|
|
223
|
+
h('div', {
|
|
224
|
+
style: {
|
|
225
|
+
width: `${width}%`, height: '100%', borderRadius: 999,
|
|
226
|
+
background: best
|
|
227
|
+
? 'linear-gradient(90deg, #B8862F, #E0B962)'
|
|
228
|
+
: 'linear-gradient(90deg, #2E8B8B, #4FC3B8)',
|
|
229
|
+
},
|
|
230
|
+
}))
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function Metric({ value, label, color }) {
|
|
234
|
+
return h('div', { style: S.metric },
|
|
235
|
+
h('span', { style: { ...S.metricV, color: color || 'inherit' } }, value),
|
|
236
|
+
h('span', { style: S.metricL }, label))
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function ItemChip({ item }) {
|
|
240
|
+
return h('span', { style: S.item, title: `${item.name} · ${item.total || 0} 金币` },
|
|
241
|
+
h('span', {
|
|
242
|
+
style: {
|
|
243
|
+
width: 18, height: 18, borderRadius: 4, display: 'inline-flex',
|
|
244
|
+
alignItems: 'center', justifyContent: 'center', fontSize: 9,
|
|
245
|
+
background: 'var(--dsw-alias-interactive-bg-active, rgba(128,128,128,.18))',
|
|
246
|
+
color: 'inherit', fontWeight: 700,
|
|
247
|
+
},
|
|
248
|
+
}, (item.name || '?').slice(0, 1)),
|
|
249
|
+
h('span', null, item.name))
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function HeroCard({ summary, preview, onReset }) {
|
|
253
|
+
const c = summary.champion
|
|
254
|
+
return h('div', { style: S.hero },
|
|
255
|
+
h('div', { style: { ...S.row, alignItems: 'flex-start', gap: 13 } },
|
|
256
|
+
h(Avatar, { name: c.name, size: 58, tier: c.tier }),
|
|
257
|
+
h('div', { style: { flex: 1, minWidth: 0 } },
|
|
258
|
+
h('div', { style: { ...S.row, gap: 7, flexWrap: 'wrap' } },
|
|
259
|
+
h('span', { style: { fontSize: 20, fontWeight: 700 } }, c.name),
|
|
260
|
+
h(Tier, { tier: c.tier }),
|
|
261
|
+
preview ? h('button', { style: { ...S.btn, padding: '2px 8px', fontSize: 11 }, onClick: onReset }, '返回我的英雄') : null),
|
|
262
|
+
h('div', { style: S.muted }, `${c.title || ''} · ${summary.style_label || '均衡强化'}`),
|
|
263
|
+
h('div', { style: { ...S.row, gap: 14, marginTop: 10, flexWrap: 'wrap' } },
|
|
264
|
+
h(Metric, { value: c.rank, label: '全服排名' }),
|
|
265
|
+
h(Metric, { value: c.pick_rate_label, label: '选取率' }),
|
|
266
|
+
h(Metric, { value: Number(c.games || 0).toLocaleString('en-US'), label: '样本' }))),
|
|
267
|
+
h('div', { style: { textAlign: 'right', minWidth: 72 } },
|
|
268
|
+
h('div', { style: { fontSize: 26, fontWeight: 750, letterSpacing: '-0.02em', fontVariantNumeric: 'tabular-nums' } }, c.win_rate_label),
|
|
269
|
+
h('div', { style: S.muted }, '海斗胜率'))),
|
|
270
|
+
h('div', { style: { marginTop: 12 } }, h(Bar, { value: c.win_rate * 100, best: c.tier === 'T0' || c.tier === 'T1' })),
|
|
271
|
+
summary.top_augments?.length
|
|
272
|
+
? h('div', { style: { ...S.row, gap: 6, marginTop: 10, flexWrap: 'wrap' } },
|
|
273
|
+
h('span', { style: S.muted }, '优先:'),
|
|
274
|
+
summary.top_augments.slice(0, 3).map(item => h(Chip, {
|
|
275
|
+
key: item.augment.id, tone: item.is_best ? 'gold' : 'normal',
|
|
276
|
+
title: `推荐分 ${item.score}`,
|
|
277
|
+
}, item.augment.name)))
|
|
278
|
+
: null)
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function BenchRow({ item, my, active, onClick }) {
|
|
282
|
+
const c = item.champion
|
|
283
|
+
const delta = my ? c.win_rate - my.champion.win_rate : null
|
|
284
|
+
return h('button', {
|
|
285
|
+
style: {
|
|
286
|
+
...S.rowCard,
|
|
287
|
+
...(active ? {
|
|
288
|
+
borderColor: 'var(--dsw-alias-brand-primary, #0F8A9D)',
|
|
289
|
+
boxShadow: 'inset 0 0 0 1px var(--dsw-alias-brand-primary, #0F8A9D)',
|
|
290
|
+
} : {}),
|
|
291
|
+
},
|
|
292
|
+
onClick,
|
|
293
|
+
title: '点击查看该英雄的出装与海克斯',
|
|
294
|
+
},
|
|
295
|
+
h(Avatar, { name: c.name, size: 32, tier: c.tier }),
|
|
296
|
+
h('div', { style: { minWidth: 0, flex: 1 } },
|
|
297
|
+
h('div', { style: { ...S.row, gap: 5 } },
|
|
298
|
+
h('span', { style: { fontWeight: 600 } }, c.name),
|
|
299
|
+
h(Tier, { tier: c.tier })),
|
|
300
|
+
h('div', { style: { ...S.muted, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' } },
|
|
301
|
+
item.top_augments?.[0] ? `首选 ${item.top_augments[0].augment.name}` : '暂无英雄样本')),
|
|
302
|
+
h('div', { style: { textAlign: 'right', flex: '0 0 auto' } },
|
|
303
|
+
h('div', { style: { fontWeight: 700, fontVariantNumeric: 'tabular-nums' } }, c.win_rate_label),
|
|
304
|
+
h('div', {
|
|
305
|
+
style: { ...S.muted, color: delta == null ? undefined : delta >= 0 ? '#2F9E62' : '#C05050' },
|
|
306
|
+
}, delta == null ? '海斗胜率' : `${delta >= 0 ? '+' : ''}${(delta * 100).toFixed(1)} vs 我的`)))
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function Candidate({ item }) {
|
|
310
|
+
const best = item.is_best
|
|
311
|
+
return h('div', {
|
|
312
|
+
style: {
|
|
313
|
+
...S.card, padding: 11,
|
|
314
|
+
...(best ? { borderColor: 'rgba(184,134,47,.65)', background: 'rgba(184,134,47,.055)' } : {}),
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
h('div', { style: { ...S.row, gap: 7 } },
|
|
318
|
+
h('span', {
|
|
319
|
+
style: {
|
|
320
|
+
width: 24, height: 24, borderRadius: 12, flex: '0 0 auto',
|
|
321
|
+
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
|
322
|
+
fontSize: 10, fontWeight: 700,
|
|
323
|
+
color: best ? '#8a5d14' : 'inherit',
|
|
324
|
+
background: best ? 'rgba(184,134,47,.14)' : 'rgba(128,128,128,.08)',
|
|
325
|
+
border: `1px solid ${best ? 'rgba(184,134,47,.4)' : 'rgba(128,128,128,.22)'}`,
|
|
326
|
+
},
|
|
327
|
+
}, item.rank),
|
|
328
|
+
h('span', {
|
|
329
|
+
style: {
|
|
330
|
+
fontWeight: 700, fontSize: 13.5, flex: '1 1 auto', minWidth: 0,
|
|
331
|
+
overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
|
|
332
|
+
},
|
|
333
|
+
}, item.augment.name),
|
|
334
|
+
h(Rarity, { rarity: item.augment.rarity, label: item.augment.rarity_label }),
|
|
335
|
+
h(Tier, { tier: item.tier }),
|
|
336
|
+
h('span', { style: { fontSize: 19, fontWeight: 750, color: best ? '#B8862F' : 'inherit', fontVariantNumeric: 'tabular-nums' } }, Math.round(item.score)),
|
|
337
|
+
h('span', { style: { ...S.muted, fontSize: 10 } }, '/100')),
|
|
338
|
+
h('div', { style: { ...S.row, gap: 12, flexWrap: 'wrap', margin: '5px 0 6px' } },
|
|
339
|
+
h('span', { style: { fontWeight: 650 } }, `胜率 ${item.win_rate_label}`),
|
|
340
|
+
h('span', { style: { ...S.muted, color: item.delta >= 0 ? '#2F9E62' : '#C05050' } },
|
|
341
|
+
`差值 ${item.delta_label}pp`),
|
|
342
|
+
h('span', { style: S.muted }, `选取 ${item.pick_rate_label}`),
|
|
343
|
+
h('span', { style: S.muted }, `样本 ${Number(item.games || 0).toLocaleString('en-US')}`),
|
|
344
|
+
!item.champion_stats ? h('span', { style: S.muted }, '全服数据') : null),
|
|
345
|
+
h(Bar, { value: item.score, best }),
|
|
346
|
+
item.tags?.length
|
|
347
|
+
? h('div', { style: { ...S.wrap, gap: 4, marginTop: 6 } },
|
|
348
|
+
item.tags.map(tag => h(Chip, { key: tag, tone: tag === '首选' ? 'gold' : tag.includes('偏低') ? 'red' : 'normal' }, tag)))
|
|
349
|
+
: null)
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function BuildView({ summary }) {
|
|
353
|
+
if (!summary?.build) return h('div', { style: { ...S.card, padding: 16 } }, h('div', { style: S.muted }, '该英雄暂无出装数据。'))
|
|
354
|
+
const b = summary.build
|
|
355
|
+
const itemNames = items => (items || []).map(item => h(ItemChip, { key: item.id, item }))
|
|
356
|
+
return h('div', { style: { display: 'flex', flexDirection: 'column', gap: 12 } },
|
|
357
|
+
h('div', null,
|
|
358
|
+
h('div', { style: S.section }, h('span', { style: S.sectionTitle }, '出门装'), h('span', { style: S.muted }, '按定位推荐')),
|
|
359
|
+
h('div', { style: S.wrap }, itemNames(b.starting_items))),
|
|
360
|
+
h('div', null,
|
|
361
|
+
h('div', { style: S.section }, h('span', { style: S.sectionTitle }, '核心三件套'), h('span', { style: S.muted }, '统计样本')),
|
|
362
|
+
(b.core_builds || []).map((core, index) => h('div', {
|
|
363
|
+
key: index, style: { ...S.card, padding: '9px 10px', marginBottom: 7 },
|
|
364
|
+
},
|
|
365
|
+
h('div', { style: { ...S.row, gap: 6, marginBottom: 5 } },
|
|
366
|
+
h('span', { style: { color: index === 0 ? '#B8862F' : undefined, fontWeight: 650, fontSize: 11.5 } },
|
|
367
|
+
index === 0 ? '首选' : `方案 ${index + 1}`),
|
|
368
|
+
h('span', { style: { flex: 1 } }),
|
|
369
|
+
h('span', { style: { fontWeight: 650 } }, `${core.win_rate_label} 胜率`),
|
|
370
|
+
h('span', { style: S.muted }, `${Number(core.games || 0).toLocaleString('en-US')} 局`),
|
|
371
|
+
core.pick_rate_label ? h('span', { style: S.muted }, `选取 ${core.pick_rate_label}`) : null),
|
|
372
|
+
h('div', { style: { ...S.wrap, gap: 3 } },
|
|
373
|
+
(core.items || []).flatMap((item, itemIndex) => [
|
|
374
|
+
itemIndex ? h('span', { key: `a${itemIndex}`, style: S.muted }, '→') : null,
|
|
375
|
+
h(ItemChip, { key: item.id, item }),
|
|
376
|
+
]))))),
|
|
377
|
+
h('div', null,
|
|
378
|
+
h('div', { style: S.section }, h('span', { style: S.sectionTitle }, '鞋子与召唤师技能'), h('span', { style: S.muted }, '按定位 / 样本最高组合')),
|
|
379
|
+
h('div', { style: { ...S.wrap, gap: 6 } },
|
|
380
|
+
itemNames(b.boots),
|
|
381
|
+
(b.spells || []).map(spell => h('span', { key: spell, style: S.chip }, spell)))),
|
|
382
|
+
h('div', null,
|
|
383
|
+
h('div', { style: S.section }, h('span', { style: S.sectionTitle }, '命运之武器'), h('span', { style: S.muted }, '首件传说参考')),
|
|
384
|
+
h('div', { style: { ...S.card, padding: 10 } },
|
|
385
|
+
b.destiny
|
|
386
|
+
? h('div', null,
|
|
387
|
+
h('div', { style: { ...S.wrap, gap: 6 } }, itemNames(b.destiny.items)),
|
|
388
|
+
h('div', { style: { ...S.muted, marginTop: 6 } },
|
|
389
|
+
`${b.destiny.win_rate_label} 胜率 · ${Number(b.destiny.games || 0).toLocaleString('en-US')} 局${b.destiny.note ? ` · ${b.destiny.note}` : ''}`))
|
|
390
|
+
: h('div', { style: S.muted }, '该英雄暂无达标的命运之武器装备样本。'))),
|
|
391
|
+
h('div', null,
|
|
392
|
+
h('div', { style: S.section }, h('span', { style: S.sectionTitle }, '技能加点'), h('span', { style: S.muted }, '通用模板,非统计数据')),
|
|
393
|
+
h('div', { style: { ...S.row, gap: 5, flexWrap: 'wrap' } },
|
|
394
|
+
(b.skill_priority || []).map((skill, index) => h(React.Fragment, { key: skill + index },
|
|
395
|
+
index ? h('span', { key: `arrow${index}`, style: S.muted }, '›') : null,
|
|
396
|
+
h('span', { style: S.skill(['#4E78A8', '#238A78', '#8B5CF6'][index] || '#7B8798') }, skill))),
|
|
397
|
+
h('span', { style: { ...S.skill('#B8862F'), marginLeft: 6 } }, 'R'),
|
|
398
|
+
h('span', { style: { ...S.muted, marginLeft: 5 } }, '6 / 11 / 16 级')),
|
|
399
|
+
b.skill_note ? h('div', { style: { ...S.muted, marginTop: 6 } }, b.skill_note) : null),
|
|
400
|
+
h('div', { style: { ...S.muted, borderTop: '1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.2))', paddingTop: 10 } },
|
|
401
|
+
b.notes || ''))
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
function Page() {
|
|
405
|
+
const [snap, setSnap] = useState(null)
|
|
406
|
+
const [loadError, setLoadError] = useState('')
|
|
407
|
+
const [tab, setTab] = useState('champ')
|
|
408
|
+
const [preview, setPreview] = useState(null)
|
|
409
|
+
const [search, setSearch] = useState('')
|
|
410
|
+
const [results, setResults] = useState([])
|
|
411
|
+
const [searchBusy, setSearchBusy] = useState(false)
|
|
412
|
+
const [searchError, setSearchError] = useState('')
|
|
413
|
+
const [searchEmpty, setSearchEmpty] = useState(false)
|
|
414
|
+
const [detected, setDetected] = useState([])
|
|
415
|
+
const [evals, setEvals] = useState([])
|
|
416
|
+
const [scanError, setScanError] = useState('')
|
|
417
|
+
const [scanning, setScanning] = useState(false)
|
|
418
|
+
const [autoScan, setAutoScan] = useState(() => {
|
|
419
|
+
try { return localStorage.getItem(AUTO_KEY) === '1' } catch { return false }
|
|
420
|
+
})
|
|
421
|
+
const [scanAt, setScanAt] = useState(0)
|
|
422
|
+
const [serviceWait, setServiceWait] = useState(false)
|
|
423
|
+
const [serviceOn, setServiceOn] = useState(null)
|
|
424
|
+
const [serviceBusy, setServiceBusy] = useState(false)
|
|
425
|
+
const [serviceError, setServiceError] = useState('')
|
|
426
|
+
const [overlayOn, setOverlayOn] = useState(null)
|
|
427
|
+
const [overlayBusy, setOverlayBusy] = useState(false)
|
|
428
|
+
const [overlayError, setOverlayError] = useState('')
|
|
429
|
+
const scanRef = useRef(null)
|
|
430
|
+
const scanningRef = useRef(false)
|
|
431
|
+
const lastScanRef = useRef(0)
|
|
432
|
+
const myIdRef = useRef(0)
|
|
433
|
+
|
|
434
|
+
useEffect(() => {
|
|
435
|
+
const timer = setTimeout(() => setServiceWait(true), 8000)
|
|
436
|
+
return () => clearTimeout(timer)
|
|
437
|
+
}, [])
|
|
438
|
+
|
|
439
|
+
useEffect(() => {
|
|
440
|
+
let alive = true
|
|
441
|
+
const pull = async () => {
|
|
442
|
+
try {
|
|
443
|
+
const data = await controlGet('/status', 4000)
|
|
444
|
+
if (!alive) return
|
|
445
|
+
setServiceOn(!!data.running)
|
|
446
|
+
setServiceError(data.error || '')
|
|
447
|
+
} catch {
|
|
448
|
+
if (alive) setServiceOn(false)
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
pull()
|
|
452
|
+
const timer = setInterval(pull, 3000)
|
|
453
|
+
return () => { alive = false; clearInterval(timer) }
|
|
454
|
+
}, [])
|
|
455
|
+
|
|
456
|
+
useEffect(() => {
|
|
457
|
+
if (!serviceOn) {
|
|
458
|
+
setOverlayOn(false)
|
|
459
|
+
return
|
|
460
|
+
}
|
|
461
|
+
let alive = true
|
|
462
|
+
const pull = async () => {
|
|
463
|
+
try {
|
|
464
|
+
const data = await get('/overlay/status', 4000)
|
|
465
|
+
if (!alive) return
|
|
466
|
+
setOverlayOn(!!data.running)
|
|
467
|
+
setOverlayError(data.pyside === false ? '缺少 PySide6,无法启动桌面图标' : '')
|
|
468
|
+
} catch {
|
|
469
|
+
if (alive) setOverlayOn(false)
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
pull()
|
|
473
|
+
const timer = setInterval(pull, 8000)
|
|
474
|
+
return () => { alive = false; clearInterval(timer) }
|
|
475
|
+
}, [serviceOn])
|
|
476
|
+
|
|
477
|
+
useEffect(() => {
|
|
478
|
+
if (!serviceOn) {
|
|
479
|
+
setSnap(null)
|
|
480
|
+
setLoadError('')
|
|
481
|
+
return
|
|
482
|
+
}
|
|
483
|
+
let alive = true
|
|
484
|
+
const pull = async () => {
|
|
485
|
+
try {
|
|
486
|
+
const data = await get('/snapshot', 6000)
|
|
487
|
+
if (!alive) return
|
|
488
|
+
setSnap(data)
|
|
489
|
+
setLoadError('')
|
|
490
|
+
if (data.last_scan && data.last_scan.at > lastScanRef.current) {
|
|
491
|
+
lastScanRef.current = data.last_scan.at
|
|
492
|
+
setDetected(data.last_scan.matches || [])
|
|
493
|
+
setEvals(data.last_scan.evaluations || [])
|
|
494
|
+
setScanAt(data.last_scan.at)
|
|
495
|
+
}
|
|
496
|
+
} catch (error) {
|
|
497
|
+
if (alive) setLoadError(`${error?.message || error}(服务已启动,但请求失败)`)
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
pull()
|
|
501
|
+
const timer = setInterval(pull, 2000)
|
|
502
|
+
return () => { alive = false; clearInterval(timer) }
|
|
503
|
+
}, [serviceOn])
|
|
504
|
+
|
|
505
|
+
const myId = snap?.champ_select?.my_champion_id || 0
|
|
506
|
+
useEffect(() => {
|
|
507
|
+
if (myId !== myIdRef.current) {
|
|
508
|
+
myIdRef.current = myId
|
|
509
|
+
setPreview(null)
|
|
510
|
+
setEvals([])
|
|
511
|
+
setDetected([])
|
|
512
|
+
setScanError('')
|
|
513
|
+
if (myId) setTab('champ')
|
|
514
|
+
}
|
|
515
|
+
}, [myId])
|
|
516
|
+
|
|
517
|
+
useEffect(() => {
|
|
518
|
+
try { localStorage.setItem(AUTO_KEY, autoScan ? '1' : '0') } catch { /* ignore */ }
|
|
519
|
+
}, [autoScan])
|
|
520
|
+
|
|
521
|
+
const active = preview || snap?.my_champion || null
|
|
522
|
+
const scanChampionId = snap?.my_champion?.champion?.id || myId || active?.champion?.id || null
|
|
523
|
+
const lcu = snap?.lcu || {}
|
|
524
|
+
const canScan = !!lcu.in_game || lcu.phase === 'InProgress' || lcu.phase === 'Reconnect'
|
|
525
|
+
|
|
526
|
+
const runScan = async (championOverride) => {
|
|
527
|
+
if (scanningRef.current) return
|
|
528
|
+
scanningRef.current = true
|
|
529
|
+
setScanning(true)
|
|
530
|
+
setScanError('')
|
|
531
|
+
try {
|
|
532
|
+
const body = { champion: championOverride || scanChampionId || undefined }
|
|
533
|
+
const data = await post('/scan', body)
|
|
534
|
+
if (!data.ok) {
|
|
535
|
+
setScanError(data.error || '识别失败')
|
|
536
|
+
setDetected([])
|
|
537
|
+
setEvals([])
|
|
538
|
+
return
|
|
539
|
+
}
|
|
540
|
+
setDetected(data.matches || [])
|
|
541
|
+
setEvals(data.evaluations || [])
|
|
542
|
+
setScanAt(data.at || Date.now() / 1000)
|
|
543
|
+
lastScanRef.current = data.at || Date.now() / 1000
|
|
544
|
+
} catch (error) {
|
|
545
|
+
setScanError(String(error?.message || error))
|
|
546
|
+
} finally {
|
|
547
|
+
scanningRef.current = false
|
|
548
|
+
setScanning(false)
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
scanRef.current = runScan
|
|
552
|
+
|
|
553
|
+
useEffect(() => {
|
|
554
|
+
if (!autoScan || !canScan || tab !== 'augment') return
|
|
555
|
+
const timer = setInterval(() => {
|
|
556
|
+
if (!scanningRef.current) scanRef.current?.(scanChampionId)
|
|
557
|
+
}, 6000)
|
|
558
|
+
return () => clearInterval(timer)
|
|
559
|
+
}, [autoScan, canScan, scanChampionId, tab])
|
|
560
|
+
|
|
561
|
+
const doSearch = async () => {
|
|
562
|
+
const q = search.trim()
|
|
563
|
+
if (!q) return
|
|
564
|
+
setSearchBusy(true)
|
|
565
|
+
setSearchError('')
|
|
566
|
+
setSearchEmpty(false)
|
|
567
|
+
try {
|
|
568
|
+
const data = await get(`/champions?q=${encodeURIComponent(q)}&limit=10`)
|
|
569
|
+
setResults(data.champions || [])
|
|
570
|
+
setSearchEmpty(!data.champions?.length)
|
|
571
|
+
} catch (error) {
|
|
572
|
+
setSearchError(String(error?.message || error))
|
|
573
|
+
} finally {
|
|
574
|
+
setSearchBusy(false)
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
const chooseResult = async champion => {
|
|
579
|
+
setSearchBusy(true)
|
|
580
|
+
setSearchError('')
|
|
581
|
+
setSearchEmpty(false)
|
|
582
|
+
try {
|
|
583
|
+
const data = await get(`/champion?champion=${champion.id}&top=5`)
|
|
584
|
+
setPreview(data.summary)
|
|
585
|
+
setTab('champ')
|
|
586
|
+
setResults([])
|
|
587
|
+
setSearch('')
|
|
588
|
+
} catch (error) {
|
|
589
|
+
setSearchError(String(error?.message || error))
|
|
590
|
+
} finally {
|
|
591
|
+
setSearchBusy(false)
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
const resetPreview = () => {
|
|
596
|
+
setPreview(null)
|
|
597
|
+
setTab('champ')
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
const previewBench = async item => {
|
|
601
|
+
setPreview(item)
|
|
602
|
+
setTab('champ')
|
|
603
|
+
try {
|
|
604
|
+
const data = await get(`/champion?champion=${item.champion.id}&top=5`)
|
|
605
|
+
setPreview(data.summary)
|
|
606
|
+
} catch {
|
|
607
|
+
// Keep the snapshot's top-three summary if the follow-up fails.
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
const toggleService = async () => {
|
|
612
|
+
if (serviceBusy || serviceOn === null) return
|
|
613
|
+
const turningOff = !!serviceOn
|
|
614
|
+
setServiceBusy(true)
|
|
615
|
+
setServiceError('')
|
|
616
|
+
try {
|
|
617
|
+
const data = turningOff
|
|
618
|
+
? await controlPost('/stop', 15000)
|
|
619
|
+
: await controlPost('/start', 75000)
|
|
620
|
+
if (turningOff) {
|
|
621
|
+
setServiceOn(false)
|
|
622
|
+
setSnap(null)
|
|
623
|
+
setOverlayOn(false)
|
|
624
|
+
setDetected([])
|
|
625
|
+
setEvals([])
|
|
626
|
+
setScanError('')
|
|
627
|
+
if (data.running) throw new Error(data.error || '服务关闭失败')
|
|
628
|
+
} else if (data.running || data.starting) {
|
|
629
|
+
setServiceOn(true)
|
|
630
|
+
} else {
|
|
631
|
+
throw new Error(data.error || '服务启动失败')
|
|
632
|
+
}
|
|
633
|
+
} catch (error) {
|
|
634
|
+
setServiceError(String(error?.message || error))
|
|
635
|
+
try {
|
|
636
|
+
const status = await controlGet('/status', 4000)
|
|
637
|
+
setServiceOn(!!status.running)
|
|
638
|
+
} catch { /* keep previous state */ }
|
|
639
|
+
} finally {
|
|
640
|
+
setServiceBusy(false)
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
const toggleOverlay = async () => {
|
|
645
|
+
if (overlayBusy) return
|
|
646
|
+
if (!serviceOn) {
|
|
647
|
+
setOverlayError('请先启动本地服务,再打开桌面图标')
|
|
648
|
+
return
|
|
649
|
+
}
|
|
650
|
+
const turningOff = !!overlayOn
|
|
651
|
+
setOverlayBusy(true)
|
|
652
|
+
setOverlayError('')
|
|
653
|
+
try {
|
|
654
|
+
const data = turningOff
|
|
655
|
+
? await post('/overlay/stop', { persist: true }, 15000)
|
|
656
|
+
: await post('/overlay/start', { persist: true }, 25000)
|
|
657
|
+
if (turningOff) {
|
|
658
|
+
if (data.running) throw new Error(data.note || '图标仍在运行')
|
|
659
|
+
setOverlayOn(false)
|
|
660
|
+
} else {
|
|
661
|
+
if (!data.running) throw new Error(data.note || '图标启动失败')
|
|
662
|
+
setOverlayOn(true)
|
|
663
|
+
}
|
|
664
|
+
} catch (error) {
|
|
665
|
+
setOverlayError(String(error?.message || error))
|
|
666
|
+
try {
|
|
667
|
+
const status = await get('/overlay/status', 4000)
|
|
668
|
+
setOverlayOn(!!status.running)
|
|
669
|
+
} catch { /* keep previous state */ }
|
|
670
|
+
} finally {
|
|
671
|
+
setOverlayBusy(false)
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
const meta = snap?.meta || {}
|
|
676
|
+
const bench = snap?.bench || []
|
|
677
|
+
const me = snap?.my_champion || null
|
|
678
|
+
const augmentName = active?.champion?.name || '等待英雄'
|
|
679
|
+
const recommendations = active?.top_augments || []
|
|
680
|
+
const scanChampionName = me?.champion?.name || augmentName
|
|
681
|
+
const phase = lcu.phase || 'Disconnected'
|
|
682
|
+
const phaseLabel = {
|
|
683
|
+
ChampSelect: '选人阶段', InProgress: '对局中', Reconnect: '重连中',
|
|
684
|
+
Lobby: '大厅', None: '空闲', Disconnected: '未连接', EndOfGame: '对局结束',
|
|
685
|
+
}[phase] || phase
|
|
686
|
+
|
|
687
|
+
const serviceSwitch = h('button', {
|
|
688
|
+
type: 'button',
|
|
689
|
+
role: 'switch',
|
|
690
|
+
'aria-checked': !!serviceOn,
|
|
691
|
+
'aria-label': '启动或关闭本地服务',
|
|
692
|
+
title: '启动/关闭本地 Python 服务(不会自动启动)',
|
|
693
|
+
disabled: serviceBusy || serviceOn === null,
|
|
694
|
+
onClick: toggleService,
|
|
695
|
+
style: {
|
|
696
|
+
...S.chip,
|
|
697
|
+
fontFamily: 'inherit', fontSize: 11.5,
|
|
698
|
+
cursor: serviceBusy || serviceOn === null ? 'wait' : 'pointer',
|
|
699
|
+
background: serviceOn ? 'rgba(47,158,98,.12)' : 'transparent',
|
|
700
|
+
borderColor: serviceOn ? '#2F9E62' : 'var(--dsw-alias-border-l2, rgba(128,128,128,.3))',
|
|
701
|
+
opacity: serviceOn === null ? .6 : 1,
|
|
702
|
+
},
|
|
703
|
+
},
|
|
704
|
+
h('span', {
|
|
705
|
+
style: {
|
|
706
|
+
width: 7, height: 7, borderRadius: '50%',
|
|
707
|
+
background: serviceOn ? '#2F9E62' : '#8A8A8A',
|
|
708
|
+
},
|
|
709
|
+
}),
|
|
710
|
+
`服务 ${serviceBusy ? '…' : serviceOn === null ? '…' : serviceOn ? '开' : '关'}`)
|
|
711
|
+
|
|
712
|
+
if (serviceOn === false) {
|
|
713
|
+
return h('div', { style: S.page },
|
|
714
|
+
h('div', { style: S.header },
|
|
715
|
+
h('div', null,
|
|
716
|
+
h('h1', { style: S.title }, '海斗助手'),
|
|
717
|
+
h('div', { style: S.sub }, 'ARAM: Mayhem · 按需启动')),
|
|
718
|
+
serviceSwitch),
|
|
719
|
+
h('div', { style: S.card, padding: 18 },
|
|
720
|
+
h('div', { style: { fontWeight: 650, fontSize: 16, marginBottom: 6 } }, '本地服务未启动'),
|
|
721
|
+
h('div', { style: S.muted }, '服务不会随插件自动启动,也不会一直占用后台。点击「启动服务」后才加载英雄、海克斯、出装和 LCU 数据;不用时请关闭服务。'),
|
|
722
|
+
h('div', { style: { ...S.row, gap: 8, marginTop: 12, flexWrap: 'wrap' } },
|
|
723
|
+
h('button', {
|
|
724
|
+
type: 'button',
|
|
725
|
+
style: { ...S.primary, opacity: serviceBusy ? .55 : 1 },
|
|
726
|
+
disabled: serviceBusy,
|
|
727
|
+
onClick: toggleService,
|
|
728
|
+
}, serviceBusy ? '启动中…' : '启动服务')),
|
|
729
|
+
serviceError ? h('div', { style: { ...S.error, marginTop: 10 } }, serviceError) : null,
|
|
730
|
+
h('div', { style: { ...S.muted, marginTop: 10 } },
|
|
731
|
+
'启动后仍可在右上角关闭;桌面图标需要单独打开,服务关闭时会一并停止。')),
|
|
732
|
+
h('div', { style: S.muted },
|
|
733
|
+
'数据依赖本地 Python 服务(127.0.0.1:8123)。'))
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
if (!snap && serviceOn === null) {
|
|
737
|
+
return h('div', { style: { ...S.page, justifyContent: 'center', alignItems: 'center', opacity: .75 }, role: 'status' },
|
|
738
|
+
'正在检测本地服务…')
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
if (!snap && loadError) {
|
|
742
|
+
if (!serviceWait) {
|
|
743
|
+
return h('div', { style: { ...S.page, justifyContent: 'center', alignItems: 'center', opacity: .7 }, role: 'status' },
|
|
744
|
+
'服务已启动,正在连接数据…')
|
|
745
|
+
}
|
|
746
|
+
return h('div', { style: S.page },
|
|
747
|
+
h('div', { style: S.header },
|
|
748
|
+
h('div', null, h('h1', { style: S.title }, '海斗助手'), h('div', { style: S.sub }, 'ARAM: Mayhem · 服务已启动但数据不可用')),
|
|
749
|
+
serviceSwitch),
|
|
750
|
+
h('div', { style: S.error, role: 'alert' },
|
|
751
|
+
h('div', { style: { fontWeight: 650, marginBottom: 4 } }, '本地服务已启动,但数据请求失败'),
|
|
752
|
+
h('div', null, loadError),
|
|
753
|
+
h('div', { style: { ...S.muted, marginTop: 6 } }, '可以先关闭服务,再重新启动;也可以检查 Python 日志 logs\\dsh-service.log。'),
|
|
754
|
+
h('button', { style: { ...S.btn, marginTop: 8 }, onClick: toggleService }, '关闭服务')),
|
|
755
|
+
h('div', { style: { ...S.card, padding: 16, marginTop: 8 } },
|
|
756
|
+
h('div', { style: { fontWeight: 650, marginBottom: 6 } }, '仍无法启动时'),
|
|
757
|
+
h('div', { style: S.muted }, '在插件目录运行:python scripts/dsh_service.py --port 8123 --root .'),
|
|
758
|
+
h('div', { style: { ...S.muted, marginTop: 4 } }, '或检查 Python 依赖:python -m pip install -r requirements-dsh.txt')))
|
|
759
|
+
}
|
|
760
|
+
if (!snap) {
|
|
761
|
+
return h('div', { style: { ...S.page, justifyContent: 'center', alignItems: 'center', opacity: .65 }, role: 'status' }, '正在连接海斗助手服务…')
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
return h('div', { style: S.page },
|
|
765
|
+
h('div', { style: S.header },
|
|
766
|
+
h('div', null,
|
|
767
|
+
h('h1', { style: S.title }, '海斗助手'),
|
|
768
|
+
h('div', { style: S.sub }, `ARAM: Mayhem · ${meta.patch || '--'} · ${meta.source || '本地数据'}`)),
|
|
769
|
+
h('div', { style: { ...S.row, gap: 7, flexWrap: 'wrap', justifyContent: 'flex-end' } },
|
|
770
|
+
h(Chip, { tone: 'gold' }, `数据 ${meta.patch || '--'}`),
|
|
771
|
+
h(Chip, { tone: lcu.connected ? 'green' : 'normal', title: lcu.error || undefined },
|
|
772
|
+
`LCU ${lcu.connected ? '已连接' : '未连接'}`),
|
|
773
|
+
h(Chip, null, phaseLabel),
|
|
774
|
+
serviceSwitch,
|
|
775
|
+
h('button', {
|
|
776
|
+
type: 'button',
|
|
777
|
+
role: 'switch',
|
|
778
|
+
'aria-checked': !!overlayOn,
|
|
779
|
+
'aria-label': '显示屏幕置顶桌面图标',
|
|
780
|
+
title: serviceOn ? '显示或隐藏屏幕置顶的海斗助手图标' : '请先启动本地服务',
|
|
781
|
+
disabled: overlayBusy || overlayOn === null || !serviceOn,
|
|
782
|
+
onClick: toggleOverlay,
|
|
783
|
+
style: {
|
|
784
|
+
...S.chip,
|
|
785
|
+
fontFamily: 'inherit', fontSize: 11.5,
|
|
786
|
+
cursor: overlayBusy || overlayOn === null || !serviceOn ? 'not-allowed' : 'pointer',
|
|
787
|
+
background: overlayOn ? 'rgba(47,158,98,.12)' : 'transparent',
|
|
788
|
+
borderColor: overlayOn ? '#2F9E62' : 'var(--dsw-alias-border-l2, rgba(128,128,128,.3))',
|
|
789
|
+
opacity: overlayOn === null || !serviceOn ? .6 : 1,
|
|
790
|
+
},
|
|
791
|
+
},
|
|
792
|
+
h('span', {
|
|
793
|
+
style: {
|
|
794
|
+
width: 7, height: 7, borderRadius: '50%',
|
|
795
|
+
background: overlayOn ? '#2F9E62' : '#8A8A8A',
|
|
796
|
+
},
|
|
797
|
+
}),
|
|
798
|
+
`桌面图标 ${overlayBusy || overlayOn === null ? '…' : overlayOn ? '开' : '关'}`),
|
|
799
|
+
h('input', {
|
|
800
|
+
style: S.input, value: search, placeholder: '搜索英雄,如 亚索',
|
|
801
|
+
'aria-label': '搜索英雄',
|
|
802
|
+
onChange: event => {
|
|
803
|
+
setSearch(event.target.value)
|
|
804
|
+
setSearchError('')
|
|
805
|
+
setSearchEmpty(false)
|
|
806
|
+
},
|
|
807
|
+
onKeyDown: event => { if (event.key === 'Enter') doSearch() },
|
|
808
|
+
}),
|
|
809
|
+
h('button', { style: S.btn, onClick: doSearch, disabled: searchBusy }, searchBusy ? '…' : '查询'))),
|
|
810
|
+
|
|
811
|
+
loadError ? h('div', { style: S.error, role: 'alert', 'aria-live': 'polite' }, `服务暂时不可用:${loadError}`) : null,
|
|
812
|
+
serviceError ? h('div', { style: S.error, role: 'alert', 'aria-live': 'polite' }, `本地服务:${serviceError}`) : null,
|
|
813
|
+
overlayError ? h('div', { style: S.error, role: 'alert', 'aria-live': 'polite' }, `桌面图标:${overlayError}`) : null,
|
|
814
|
+
!lcu.connected && lcu.error
|
|
815
|
+
? h('div', { style: { ...S.muted, flexShrink: 0 } }, `LCU:${lcu.error}。仍可搜索英雄;进入对局后可手动扫描。`)
|
|
816
|
+
: null,
|
|
817
|
+
lcu.connected && !lcu.is_mayhem && lcu.queue_id
|
|
818
|
+
? h('div', { style: S.banner }, `当前队列:${lcu.queue_name || lcu.queue_id}。海斗统计仅供参考。`)
|
|
819
|
+
: null,
|
|
820
|
+
searchError ? h('div', { style: S.error, role: 'alert', 'aria-live': 'polite' }, searchError) : null,
|
|
821
|
+
searchEmpty
|
|
822
|
+
? h('div', { style: { ...S.muted, flexShrink: 0 } }, '没有找到匹配的英雄。')
|
|
823
|
+
: null,
|
|
824
|
+
results.length
|
|
825
|
+
? h('div', { style: { ...S.card, padding: 10, flexShrink: 0 } },
|
|
826
|
+
h('div', { style: { ...S.muted, marginBottom: 6 } }, '搜索结果'),
|
|
827
|
+
h('div', { style: S.wrap },
|
|
828
|
+
results.map(item => h('button', {
|
|
829
|
+
key: item.id, style: S.btn, onClick: () => chooseResult(item),
|
|
830
|
+
}, `${item.name} ${item.tier} ${item.win_rate_label}`))))
|
|
831
|
+
: null,
|
|
832
|
+
|
|
833
|
+
h('div', {
|
|
834
|
+
style: { ...S.row, gap: 3, borderBottom: '1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.2))', flexShrink: 0 },
|
|
835
|
+
role: 'tablist', 'aria-label': '海斗助手页签',
|
|
836
|
+
},
|
|
837
|
+
TABS.map(item => h('button', {
|
|
838
|
+
key: item.id, style: S.tab(tab === item.id), onClick: () => setTab(item.id),
|
|
839
|
+
role: 'tab', 'aria-selected': tab === item.id, type: 'button',
|
|
840
|
+
}, item.label, item.id === 'augment' && evals.length ? ' ●' : ''))),
|
|
841
|
+
|
|
842
|
+
h('div', { style: S.body },
|
|
843
|
+
tab === 'champ'
|
|
844
|
+
? h(React.Fragment, null,
|
|
845
|
+
active
|
|
846
|
+
? h(HeroCard, { summary: active, preview: !!preview, onReset: resetPreview })
|
|
847
|
+
: h('div', { style: { ...S.card, padding: 20, textAlign: 'center' } },
|
|
848
|
+
h('div', { style: { fontWeight: 650, marginBottom: 5 } }, '等待选人'),
|
|
849
|
+
h('div', { style: S.muted }, '连接客户端后自动读取你的英雄;也可以在上方搜索英雄查看数据。')),
|
|
850
|
+
bench.length
|
|
851
|
+
? h('div', null,
|
|
852
|
+
h('div', { style: S.section },
|
|
853
|
+
h('span', { style: S.sectionTitle }, '备战席'),
|
|
854
|
+
h('span', { style: S.muted }, `${bench.length} 位可选 · 点击预览`)),
|
|
855
|
+
h('div', { style: S.benchGrid },
|
|
856
|
+
bench.map(item => h(BenchRow, {
|
|
857
|
+
key: item.champion.id, item, my: me, active: preview?.champion?.id === item.champion.id,
|
|
858
|
+
onClick: () => previewBench(item),
|
|
859
|
+
}))))
|
|
860
|
+
: null,
|
|
861
|
+
h('div', { style: S.muted },
|
|
862
|
+
`数据快照:${meta.matches ? Number(meta.matches).toLocaleString('en-US') + ' 场' : '--'} · 更新 ${meta.updated_label || '--'}。`
|
|
863
|
+
+ ' 统计为部分对局样本,胜率与选取是相关关系。'))
|
|
864
|
+
: tab === 'augment'
|
|
865
|
+
? h(React.Fragment, null,
|
|
866
|
+
h('div', { style: { ...S.card, padding: '9px 11px' } },
|
|
867
|
+
h('div', { style: { ...S.row, gap: 9, flexWrap: 'wrap' } },
|
|
868
|
+
h(Avatar, { name: augmentName, size: 32, tier: active?.champion?.tier }),
|
|
869
|
+
h('div', { style: { flex: 1, minWidth: 130 } },
|
|
870
|
+
h('div', { style: { fontWeight: 650 } }, augmentName),
|
|
871
|
+
h('div', { style: S.muted }, active
|
|
872
|
+
? `${active.champion.title || ''} · 胜率 ${active.champion.win_rate_label} · ${active.champion.tier}`
|
|
873
|
+
: '先选择英雄,或等待 LCU 选人')),
|
|
874
|
+
h('label', {
|
|
875
|
+
style: { ...S.row, gap: 5, fontSize: 11.5, opacity: .75, cursor: 'pointer' },
|
|
876
|
+
title: '仅在本页签打开时,每 6 秒扫描一次游戏客户区',
|
|
877
|
+
},
|
|
878
|
+
h('input', {
|
|
879
|
+
type: 'checkbox', checked: autoScan,
|
|
880
|
+
onChange: event => setAutoScan(event.target.checked),
|
|
881
|
+
}), '自动扫描 6s'),
|
|
882
|
+
h('button', {
|
|
883
|
+
style: { ...S.primary, opacity: scanning ? .55 : 1 },
|
|
884
|
+
disabled: scanning,
|
|
885
|
+
onClick: () => runScan(scanChampionId),
|
|
886
|
+
}, scanning ? '识别中…' : '立即扫描'))),
|
|
887
|
+
scanError ? h('div', { style: S.error, role: 'alert', 'aria-live': 'polite' }, scanError) : null,
|
|
888
|
+
!canScan
|
|
889
|
+
? h('div', { style: { ...S.card, padding: 16, ...S.muted } },
|
|
890
|
+
'进入对局后,海克斯三选一出现时可扫描当前卡片;即使 LCU 未连接,也可以手动扫描。'
|
|
891
|
+
+ '建议使用无边框/窗口化;首次 OCR 会加载本地模型,只读取游戏客户区。')
|
|
892
|
+
: null,
|
|
893
|
+
evals.length
|
|
894
|
+
? h(React.Fragment, null,
|
|
895
|
+
h('div', { style: S.section },
|
|
896
|
+
h('span', { style: S.sectionTitle }, `本局识别 · ${scanChampionName}`),
|
|
897
|
+
h('span', { style: S.muted }, `${evals.length} 张 · 按推荐度排序${scanAt ? ' · ' + new Date(scanAt * 1000).toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' }) : ''}`)),
|
|
898
|
+
evals.map(item => h(Candidate, { key: 'scan-' + item.augment.id, item })),
|
|
899
|
+
h('div', { style: S.muted },
|
|
900
|
+
'本局识别按当前客户端英雄评分;推荐分 = 英雄专属胜率(向全服收缩)+ 全服强度。'))
|
|
901
|
+
: detected.length
|
|
902
|
+
? h('div', { style: { ...S.card, padding: 12 } },
|
|
903
|
+
h('div', { style: { fontWeight: 650, marginBottom: 5 } }, '识别到卡片'),
|
|
904
|
+
h('div', { style: S.wrap }, detected.map(item => h(Chip, { key: item.id }, `${item.name} ${Math.round((item.confidence || 0) * 100)}%`))))
|
|
905
|
+
: null,
|
|
906
|
+
h('div', { style: S.section },
|
|
907
|
+
h('span', { style: S.sectionTitle }, `版本推荐 · ${augmentName}`),
|
|
908
|
+
h('span', { style: S.muted }, recommendations.length
|
|
909
|
+
? `${recommendations.length} 个 · 英雄专属 + 全服样本`
|
|
910
|
+
: '暂无英雄推荐')),
|
|
911
|
+
recommendations.length
|
|
912
|
+
? recommendations.map(item => h(Candidate, { key: 'rec-' + item.augment.id, item }))
|
|
913
|
+
: h('div', { style: { ...S.card, padding: 18, textAlign: 'center' } },
|
|
914
|
+
h('div', { style: { fontWeight: 650, marginBottom: 5 } }, active ? '暂无该英雄的推荐' : '还没有选择英雄'),
|
|
915
|
+
h('div', { style: S.muted }, active
|
|
916
|
+
? '该英雄在本版本没有足够的海克斯样本。'
|
|
917
|
+
: '等待 LCU 选人,或在上方搜索英雄后查看推荐。')),
|
|
918
|
+
h('div', { style: S.muted },
|
|
919
|
+
'推荐分 = 英雄专属胜率(向全服收缩)+ 全服强度;低样本会被压低。'
|
|
920
|
+
+ ' 差值单位为百分点。'))
|
|
921
|
+
: h(React.Fragment, null,
|
|
922
|
+
active
|
|
923
|
+
? h('div', { style: { ...S.row, gap: 7, marginBottom: 2 } },
|
|
924
|
+
h(Avatar, { name: active.champion.name, size: 30, tier: active.champion.tier }),
|
|
925
|
+
h('span', { style: { fontWeight: 700 } }, active.champion.name),
|
|
926
|
+
h(Tier, { tier: active.champion.tier }),
|
|
927
|
+
preview ? h('button', { style: { ...S.btn, padding: '2px 8px', fontSize: 11 }, onClick: resetPreview }, '返回我的英雄') : null)
|
|
928
|
+
: h('div', { style: { ...S.card, padding: 18, textAlign: 'center' } },
|
|
929
|
+
h('div', { style: { fontWeight: 650, marginBottom: 5 } }, '还没有选择英雄'),
|
|
930
|
+
h('div', { style: S.muted }, '等待 LCU 选人,或在上方搜索英雄后查看出装。')),
|
|
931
|
+
active ? h(BuildView, { summary: active }) : null)),
|
|
932
|
+
|
|
933
|
+
h('div', {
|
|
934
|
+
style: {
|
|
935
|
+
...S.row, justifyContent: 'space-between', gap: 8, flexWrap: 'wrap',
|
|
936
|
+
borderTop: '1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.2))',
|
|
937
|
+
paddingTop: 8, flexShrink: 0, fontSize: 11, opacity: .62,
|
|
938
|
+
},
|
|
939
|
+
},
|
|
940
|
+
h('span', null, `数据 ${meta.patch || '--'} · ${meta.source || '--'} · ${meta.license || '--'}`),
|
|
941
|
+
h('span', null, `服务 127.0.0.1:8123${lcu.summoner ? ' · ' + lcu.summoner : ''}`)))
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
function Icon({ size = 20, active = false }) {
|
|
945
|
+
return h('svg', {
|
|
946
|
+
width: size, height: size, viewBox: '0 0 24 24', fill: 'none',
|
|
947
|
+
stroke: 'currentColor', strokeWidth: 1.7, strokeLinecap: 'round', strokeLinejoin: 'round',
|
|
948
|
+
style: { display: 'block', color: active ? 'var(--dsw-alias-brand-primary)' : 'currentColor' },
|
|
949
|
+
'aria-hidden': true, focusable: false,
|
|
950
|
+
},
|
|
951
|
+
h('path', { d: 'M12 2.6l7.2 4.1v8.1L12 19l-7.2-4.2V6.7L12 2.6z' }),
|
|
952
|
+
h('path', { d: 'M12 7.2l3.4 2v4.1L12 15.5l-3.4-2.2V9.2L12 7.2z', opacity: 0.55 }),
|
|
953
|
+
h('path', { d: 'M8.4 19.1L12 21.5l3.6-2.4' }))
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
return {
|
|
957
|
+
inject: ['slots'],
|
|
958
|
+
apply(ctx) {
|
|
959
|
+
ctx.slots.inject('sidebar.panellist', () => ctx.slots.register({
|
|
960
|
+
name: 'sidebar.panellist',
|
|
961
|
+
id: 'aram-mayhem',
|
|
962
|
+
order: 25,
|
|
963
|
+
label: () => '海斗助手',
|
|
964
|
+
}, Icon))
|
|
965
|
+
|
|
966
|
+
ctx.slots.inject('main', () => ctx.slots.register({
|
|
967
|
+
name: 'main',
|
|
968
|
+
key: 'aram-mayhem',
|
|
969
|
+
}, Page))
|
|
970
|
+
},
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
})
|