-
Notifications
You must be signed in to change notification settings - Fork 1
/
struct.go
704 lines (665 loc) · 19.9 KB
/
struct.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
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
235
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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
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
406
407
408
409
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
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
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
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
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
564
565
566
567
568
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
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
package mai
import (
"encoding/json"
"fmt"
"image"
"image/color"
"image/png"
"io"
"log"
"math"
"net/http"
"os"
"strconv"
"strings"
"sync"
"unicode/utf8"
"github.com/FloatTech/gg"
"github.com/FloatTech/imgfactory"
"github.com/MoYoez/Lucy_reibot/utils/toolchain"
"github.com/MoYoez/Lucy_reibot/utils/transform"
rei "github.com/fumiama/ReiBot"
"golang.org/x/image/font"
"golang.org/x/image/font/opentype"
"golang.org/x/text/width"
)
type WebPingStauts struct {
Details struct {
MaimaiDXCN struct {
Uptime float64 `json:"uptime"`
} `json:"maimai DX CN"`
MaimaiDXCNDXNet struct {
Uptime float64 `json:"uptime"`
} `json:"maimai DX CN DXNet"`
MaimaiDXCNMain struct {
Uptime float64 `json:"uptime"`
} `json:"maimai DX CN Main"`
MaimaiDXCNNetLogin struct {
Uptime float64 `json:"uptime"`
} `json:"maimai DX CN NetLogin"`
MaimaiDXCNTitle struct {
Uptime float64 `json:"uptime"`
} `json:"maimai DX CN Title"`
MaimaiDXCNUpdate struct {
Uptime float64 `json:"uptime"`
} `json:"maimai DX CN Update"`
} `json:"details"`
Status bool `json:"status"`
}
type RealConvertPlay struct {
ReturnValue []struct {
SkippedCount int `json:"skippedCount"`
RetriedCount int `json:"retriedCount"`
RetryCountSum int `json:"retryCountSum"`
TotalCount int `json:"totalCount"`
FailedCount int `json:"failedCount"`
} `json:"returnValue"`
}
type ZlibErrorStatus struct {
Full struct {
Field1 int `json:"10"`
Field2 int `json:"30"`
Field3 int `json:"60"`
} `json:"full"`
FullError struct {
Field1 int `json:"10"`
Field2 int `json:"30"`
Field3 int `json:"60"`
} `json:"full_Error"`
ZlibError struct {
Field1 int `json:"10"`
Field2 int `json:"30"`
Field3 int `json:"60"`
} `json:"zlib_Error"`
}
type player struct {
AdditionalRating int `json:"additional_rating"`
Charts struct {
Dx []struct {
Achievements float64 `json:"achievements"`
Ds float64 `json:"ds"`
DxScore int `json:"dxScore"`
Fc string `json:"fc"`
Fs string `json:"fs"`
Level string `json:"level"`
LevelIndex int `json:"level_index"`
LevelLabel string `json:"level_label"`
Ra int `json:"ra"`
Rate string `json:"rate"`
SongId int `json:"song_id"`
Title string `json:"title"`
Type string `json:"type"`
} `json:"dx"`
Sd []struct {
Achievements float64 `json:"achievements"`
Ds float64 `json:"ds"`
DxScore int `json:"dxScore"`
Fc string `json:"fc"`
Fs string `json:"fs"`
Level string `json:"level"`
LevelIndex int `json:"level_index"`
LevelLabel string `json:"level_label"`
Ra int `json:"ra"`
Rate string `json:"rate"`
SongId int `json:"song_id"`
Title string `json:"title"`
Type string `json:"type"`
} `json:"sd"`
} `json:"charts"`
Nickname string `json:"nickname"`
Plate string `json:"plate"`
Rating int `json:"rating"`
UserData interface{} `json:"user_data"`
UserId interface{} `json:"user_id"`
Username string `json:"username"`
}
type playerData struct {
Achievements float64 `json:"achievements"`
Ds float64 `json:"ds"`
DxScore int `json:"dxScore"`
Fc string `json:"fc"`
Fs string `json:"fs"`
Level string `json:"level"`
LevelIndex int `json:"level_index"`
LevelLabel string `json:"level_label"`
Ra int `json:"ra"`
Rate string `json:"rate"`
SongId int `json:"song_id"`
Title string `json:"title"`
Type string `json:"type"`
}
var (
loadMaiPic = Root + "pic/"
defaultCoverLink = Root + "default_cover.png"
typeImageDX = loadMaiPic + "chart_type_dx.png"
typeImageSD = loadMaiPic + "chart_type_sd.png"
titleFontPath = maifont + "NotoSansSC-Bold.otf"
UniFontPath = maifont + "Montserrat-Bold.ttf"
nameFont = maifont + "NotoSansSC-Regular.otf"
maifont = Root + "font/"
b50bgOriginal = loadMaiPic + "b50_bg.png"
b50bg = loadMaiPic + "b50_bg.png"
b50Custom = loadMaiPic + "b50_bg_custom.png"
Root = transform.ReturnLucyMainDataIndex("maidx") + "resources/maimai/"
userPlate = engine.DataFolder() + "user/"
titleFont font.Face
scoreFont font.Face
rankFont font.Face
levelFont font.Face
ratingFont font.Face
nameTypeFont font.Face
diffColor []color.RGBA
ratingBgFilenames = []string{
"rating_white.png",
"rating_blue.png",
"rating_green.png",
"rating_yellow.png",
"rating_red.png",
"rating_purple.png",
"rating_copper.png",
"rating_silver.png",
"rating_gold.png",
"rating_rainbow.png",
}
)
func init() {
if _, err := os.Stat(userPlate); os.IsNotExist(err) {
err := os.MkdirAll(userPlate, 0777)
if err != nil {
return
}
}
nameTypeFont = LoadFontFace(nameFont, 36)
titleFont = LoadFontFace(titleFontPath, 20)
scoreFont = LoadFontFace(UniFontPath, 32)
rankFont = LoadFontFace(UniFontPath, 24)
levelFont = LoadFontFace(UniFontPath, 20)
ratingFont = LoadFontFace(UniFontPath, 24)
diffColor = []color.RGBA{
{69, 193, 36, 255},
{255, 186, 1, 255},
{255, 90, 102, 255},
{134, 49, 200, 255},
{207, 144, 240, 255},
}
}
// FullPageRender Render Full Page
func FullPageRender(data player, ctx *rei.Ctx) (raw image.Image) {
// muilt-threading.
getUserID, _ := toolchain.GetChatUserInfoID(ctx)
var avatarHandler sync.WaitGroup
avatarHandler.Add(1)
var getAvatarFormat *gg.Context
// avatar handler.
go func() {
// avatar Round Style
defer avatarHandler.Done()
getAvatar := toolchain.GetTargetAvatar(ctx)
if getAvatar != nil {
avatarFormat := imgfactory.Size(getAvatar, 180, 180)
getAvatarFormat = gg.NewContext(180, 180)
getAvatarFormat.DrawRoundedRectangle(0, 0, 178, 178, 20)
getAvatarFormat.Clip()
getAvatarFormat.DrawImage(avatarFormat.Image(), 0, 0)
getAvatarFormat.Fill()
}
}()
userPlatedCustom := GetUserDefaultBackgroundDataFromDatabase(getUserID)
// render Header.
b50Render := gg.NewContext(2090, 1660)
rawPlateData, errs := gg.LoadImage(userPlate + strconv.Itoa(int(getUserID)) + ".png")
if errs == nil {
b50bg = b50Custom
b50Render.DrawImage(rawPlateData, 595, 30)
b50Render.Fill()
} else {
if userPlatedCustom != "" {
b50bg = b50Custom
images, _ := GetDefaultPlate(userPlatedCustom)
b50Render.DrawImage(images, 595, 30)
b50Render.Fill()
} else {
// show nil
b50bg = b50bgOriginal
}
}
getContent, _ := gg.LoadImage(b50bg)
b50Render.DrawImage(getContent, 0, 0)
b50Render.Fill()
// render user info
avatarHandler.Wait()
if getAvatarFormat != nil {
b50Render.DrawImage(getAvatarFormat.Image(), 610, 50)
b50Render.Fill()
}
// render Userinfo
b50Render.SetFontFace(nameTypeFont)
b50Render.SetColor(color.Black)
b50Render.DrawStringAnchored(width.Widen.String(data.Nickname), 825, 160, 0, 0)
b50Render.Fill()
b50Render.SetFontFace(titleFont)
setPlateLocalStatus := GetUserPlateInfoFromDatabase(getUserID)
if setPlateLocalStatus != "" {
data.Plate = setPlateLocalStatus
}
b50Render.DrawStringAnchored(strings.Join(strings.Split(data.Plate, ""), " "), 1050, 207, 0.5, 0.5)
b50Render.Fill()
getRating := getRatingBg(data.Rating)
getRatingBG, err := gg.LoadImage(loadMaiPic + getRating)
if err != nil {
return
}
b50Render.DrawImage(getRatingBG, 800, 40)
b50Render.Fill()
// render Rank
imgs, err := GetRankPicRaw(data.AdditionalRating)
if err != nil {
return
}
b50Render.DrawImage(imgs, 1080, 50)
b50Render.Fill()
// draw number
b50Render.SetFontFace(scoreFont)
b50Render.SetRGBA255(236, 219, 113, 255)
b50Render.DrawStringAnchored(strconv.Itoa(data.Rating), 1056, 60, 1, 1)
b50Render.Fill()
// Render Card Type
getSDLength := len(data.Charts.Sd)
getDXLength := len(data.Charts.Dx)
getDXinitX := 45
getDXinitY := 1225
getInitX := 45
getInitY := 285
var i int
for i = 0; i < getSDLength; i++ {
b50Render.DrawImage(RenderCard(data.Charts.Sd[i], i+1, false), getInitX, getInitY)
getInitX += 400
if getInitX == 2045 {
getInitX = 45
getInitY += 125
}
}
for dx := 0; dx < getDXLength; dx++ {
b50Render.DrawImage(RenderCard(data.Charts.Dx[dx], dx+1, false), getDXinitX, getDXinitY)
getDXinitX += 400
if getDXinitX == 2045 {
getDXinitX = 45
getDXinitY += 125
}
}
return b50Render.Image()
}
// RenderCard Main Lucy Render Page , if isSimpleRender == true, then render count will not show here.
func RenderCard(data playerData, num int, isSimpleRender bool) image.Image {
getType := data.Type
var CardBackGround string
var multiTypeRender sync.WaitGroup
var CoverDownloader sync.WaitGroup
CoverDownloader.Add(1)
multiTypeRender.Add(1)
// choose Type.
if getType == "SD" {
CardBackGround = typeImageSD
} else {
CardBackGround = typeImageDX
}
charCount := 0.0
setBreaker := false
var truncated string
var charFloatNum float64
getSongName := data.Title
var getSongId string
switch {
case data.SongId < 1000:
getSongId = fmt.Sprintf("%05d", data.SongId)
case data.SongId < 10000:
getSongId = fmt.Sprintf("1%d", data.SongId)
default:
getSongId = strconv.Itoa(data.SongId)
}
var Image image.Image
go func() {
defer CoverDownloader.Done()
Image, _ = GetCover(getSongId)
}()
// set rune count
go func() {
defer multiTypeRender.Done()
for _, runeValue := range getSongName {
charWidth := utf8.RuneLen(runeValue)
if charWidth == 3 {
charFloatNum = 1.5
} else {
charFloatNum = float64(charWidth)
}
if charCount+charFloatNum > 19 {
setBreaker = true
break
}
truncated += string(runeValue)
charCount += charFloatNum
}
if setBreaker {
getSongName = truncated + ".."
} else {
getSongName = truncated
}
}()
loadSongType, _ := gg.LoadImage(CardBackGround)
// draw pic
drawBackGround := gg.NewContextForImage(GetChartType(data.LevelLabel))
// draw song pic
CoverDownloader.Wait()
drawBackGround.DrawImage(Image, 25, 25)
// draw name
drawBackGround.SetColor(color.White)
drawBackGround.SetFontFace(titleFont)
multiTypeRender.Wait()
drawBackGround.DrawStringAnchored(getSongName, 130, 32.5, 0, 0.5)
drawBackGround.Fill()
// draw acc
drawBackGround.SetFontFace(scoreFont)
drawBackGround.DrawStringAnchored(strconv.FormatFloat(data.Achievements, 'f', 4, 64)+"%", 129, 62.5, 0, 0.5)
// draw rate
drawBackGround.DrawImage(GetRateStatusAndRenderToImage(data.Rate), 305, 45)
drawBackGround.Fill()
drawBackGround.SetFontFace(rankFont)
drawBackGround.SetColor(diffColor[data.LevelIndex])
if !isSimpleRender {
drawBackGround.DrawString("#"+strconv.Itoa(num), 130, 111)
}
drawBackGround.FillPreserve()
// draw rest of card.
drawBackGround.SetFontFace(levelFont)
drawBackGround.DrawString(strconv.FormatFloat(data.Ds, 'f', 1, 64), 195, 111)
drawBackGround.FillPreserve()
drawBackGround.SetFontFace(ratingFont)
drawBackGround.DrawString("▶", 235, 111)
drawBackGround.FillPreserve()
drawBackGround.SetFontFace(ratingFont)
drawBackGround.DrawString(strconv.Itoa(data.Ra), 250, 111)
drawBackGround.FillPreserve()
if data.Fc != "" {
drawBackGround.DrawImage(LoadComboImage(data.Fc), 290, 84)
}
if data.Fs != "" {
drawBackGround.DrawImage(LoadSyncImage(data.Fs), 325, 84)
}
drawBackGround.DrawImage(loadSongType, 68, 88)
return drawBackGround.Image()
}
func GetRankPicRaw(id int) (image.Image, error) {
var idStr string
if id < 10 {
idStr = "0" + strconv.FormatInt(int64(id), 10)
} else {
idStr = strconv.FormatInt(int64(id), 10)
}
if id == 22 {
idStr = "21"
}
data := Root + "rank/UI_CMN_DaniPlate_" + idStr + ".png"
imgRaw, err := gg.LoadImage(data)
if err != nil {
return nil, err
}
return imgRaw, nil
}
func GetDefaultPlate(id string) (image.Image, error) {
data := Root + "plate/plate_" + id + ".png"
imgRaw, err := gg.LoadImage(data)
if err != nil {
return nil, err
}
return imgRaw, nil
}
// GetCover Careful The nil data
func GetCover(id string) (image.Image, error) {
fileName := id + ".png"
filePath := Root + "cover/" + fileName
if _, err := os.Stat(filePath); os.IsNotExist(err) {
// Auto download cover from diving fish's site
downloadURL := "https://www.diving-fish.com/covers/" + fileName
cover, err := downloadImage(downloadURL)
if err != nil {
return LoadPictureWithResize(defaultCoverLink, 90, 90), nil
}
saveImage(cover, filePath)
}
imageFile, err := os.Open(filePath)
if err != nil {
return LoadPictureWithResize(defaultCoverLink, 90, 90), nil
}
defer func(imageFile *os.File) {
err := imageFile.Close()
if err != nil {
return
}
}(imageFile)
img, _, err := image.Decode(imageFile)
if err != nil {
return LoadPictureWithResize(defaultCoverLink, 90, 90), nil
}
return Resize(img, 90, 90), nil
}
// Resize Image width height
func Resize(image image.Image, w int, h int) image.Image {
return imgfactory.Size(image, w, h).Image()
}
// LoadPictureWithResize Load Picture
func LoadPictureWithResize(link string, w int, h int) image.Image {
getImage, err := gg.LoadImage(link)
if err != nil {
return nil
}
return Resize(getImage, w, h)
}
// GetRateStatusAndRenderToImage Get Rate
func GetRateStatusAndRenderToImage(rank string) image.Image {
// Load rank images
return LoadPictureWithResize(loadMaiPic+"rate_"+rank+".png", 80, 40)
}
// GetChartType Get Chart Type
func GetChartType(chart string) image.Image {
data, _ := gg.LoadImage(loadMaiPic + "chart_" + NoHeadLineCase(chart) + ".png")
return data
}
// LoadComboImage Load combo images
func LoadComboImage(imageName string) image.Image {
link := loadMaiPic + "combo_" + imageName + ".png"
return LoadPictureWithResize(link, 60, 40)
}
// LoadSyncImage Load sync images
func LoadSyncImage(imageName string) image.Image {
link := loadMaiPic + "sync_" + imageName + ".png"
return LoadPictureWithResize(link, 60, 40)
}
// NoHeadLineCase No HeadLine.
func NoHeadLineCase(word string) string {
text := strings.ToLower(word)
textNewer := strings.ReplaceAll(text, ":", "")
return textNewer
}
// LoadFontFace load font face once before running, to work it quickly and save memory.
func LoadFontFace(filePath string, size float64) font.Face {
fontFile, _ := os.ReadFile(filePath)
fontFileParse, _ := opentype.Parse(fontFile)
fontFace, _ := opentype.NewFace(fontFileParse, &opentype.FaceOptions{Size: size, DPI: 70, Hinting: font.HintingFull})
return fontFace
}
// Inline Code.
func saveImage(img image.Image, path string) {
files, err := os.Create(path)
if err != nil {
log.Fatal(err)
}
defer func(files *os.File) {
err := files.Close()
if err != nil {
return
}
}(files)
err = png.Encode(files, img)
if err != nil {
log.Fatal(err)
}
}
func downloadImage(url string) (image.Image, error) {
response, err := http.Get(url)
if err != nil {
return nil, err
}
defer func(Body io.ReadCloser) {
err := Body.Close()
if err != nil {
return
}
}(response.Body)
img, _, err := image.Decode(response.Body)
if err != nil {
return nil, err
}
return img, nil
}
func getRatingBg(rating int) string {
index := 0
switch {
case rating >= 15000:
index++
fallthrough
case rating >= 14000:
index++
fallthrough
case rating >= 13000:
index++
fallthrough
case rating >= 12000:
index++
fallthrough
case rating >= 10000:
index++
fallthrough
case rating >= 7000:
index++
fallthrough
case rating >= 4000:
index++
fallthrough
case rating >= 2000:
index++
fallthrough
case rating >= 1000:
index++
}
return ratingBgFilenames[index]
}
// MixedRegionWriter Some Mixed Magic, looking for your region information.
func MixedRegionWriter(regionID int, playCount int, createdDate string) string {
getCountryID := returnCountryID(regionID)
return fmt.Sprintf(" - 在 regionID 为 %d (%s) 的省/直辖市 游玩过 %d 次, 第一次游玩时间于 %s", regionID+1, getCountryID, playCount, createdDate)
}
// ReportToEndPoint Report Some Error To Wahlap Server.
func ReportToEndPoint(getReport int, getReportType string) string {
url := "https://maihook.lemonkoi.one/api/zlib?report=" + strconv.Itoa(getReport) + "&reportType=" + getReportType
method := "GET"
client := &http.Client{}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return ""
}
req.Header.Add("authkey", authKey)
req.Header.Add("Accept", "*/*")
req.Header.Add("Host", "maihook.lemonkoi.one")
req.Header.Add("Connection", "keep-alive")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return ""
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return ""
}
return string(body)
}
// ReturnZlibError Return Zlib ERROR
func ReturnZlibError() ZlibErrorStatus {
url := "https://maihook.lemonkoi.one/api/zlib"
method := "GET"
client := &http.Client{}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return ZlibErrorStatus{}
}
req.Header.Add("Accept", "*/*")
req.Header.Add("Host", "maihook.lemonkoi.one")
req.Header.Add("Connection", "keep-alive")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return ZlibErrorStatus{}
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return ZlibErrorStatus{}
}
var returnData ZlibErrorStatus
json.Unmarshal(body, &returnData)
return returnData
}
func ConvertZlib(value, total int) string {
if total == 0 {
return "0.000%"
}
percentage := float64(value) / float64(total) * 100
return fmt.Sprintf("%.3f%%", percentage)
}
func ConvertRealPlayWords(retry RealConvertPlay) string {
var pickedWords string
var count = 0
var header = " - 错误率数据收集自机台的真实网络通信,可以反映舞萌 DX 的网络状况。\n"
for _, word := range retry.ReturnValue {
var timeCount int
var UserReturnLogs string
switch {
case count == 0:
timeCount = 10
case count == 1:
timeCount = 30
case count == 2:
timeCount = 60
}
if word.TotalCount < 20 {
UserReturnLogs = "没有收集到足够的数据进行分析~"
} else {
totalSuccess := word.TotalCount - word.FailedCount
skippedRate := float64(word.SkippedCount) / float64(totalSuccess) * 100
otherErrorRate := float64(word.RetryCountSum) / float64(totalSuccess+word.RetryCountSum) * 100
overallErrorRate := (float64(word.SkippedCount+word.RetryCountSum) / float64(totalSuccess+word.RetryCountSum)) * 100
skippedRate = math.Round(skippedRate*100) / 100
otherErrorRate = math.Round(otherErrorRate*100) / 100
overallErrorRate = math.Round(overallErrorRate*100) / 100
UserReturnLogs = fmt.Sprintf("共 %d 个成功的请求中,有 %d 次未压缩(%.2f%%),有 %d 个请求共 %d 次其他错误(%.2f%%),整体错误率为 %.2f%%。", totalSuccess, word.SkippedCount, skippedRate, word.RetriedCount, word.RetryCountSum, otherErrorRate, overallErrorRate)
}
pickedWords = pickedWords + fmt.Sprintf("\n - 在 %d 分钟内%s", timeCount, UserReturnLogs)
count = count + 1
}
var AdditionReply string
switch {
case retry.ReturnValue[2].FailedCount > 8:
AdditionReply = fmt.Sprintf(" 💥在过去的 60 分钟内 出现 Wahlap Service 在多次尝试访问下未响应 (错误次数: %d 次) , 游戏服务器可能出现严重问题, 目前正在运行的加速方案失效, Bot服务可能会出现未响应错误 ,请耐心等待官方服务器修复 ( ", retry.ReturnValue[2].FailedCount)
}
if float64(retry.ReturnValue[2].RetryCountSum)/float64(retry.ReturnValue[2].TotalCount-retry.ReturnValue[2].FailedCount+retry.ReturnValue[2].RetryCountSum) > 0.3 && AdditionReply == "" {
AdditionReply = "❌ Wahlap Service 重试率较高,所有机台登录和保存成绩时均可能耗时较长, Bot 服务可能会出现长期未响应错误. "
}
if float64(retry.ReturnValue[2].SkippedCount)/float64(retry.ReturnValue[2].TotalCount-retry.ReturnValue[2].FailedCount) > 0.2 && AdditionReply == "" {
AdditionReply = "⚠️ 压缩跳过率较高,部分未加速方案机台可能会出现登陆出现小黑屋 / 加载与保存时间过长或错误的问题, 已加速方案可忽视."
}
return header + pickedWords + "\n\n" + AdditionReply
}