feat: 在 ScoreSaber 记录输出中添加歌曲 ID 信息

This commit is contained in:
lixiangwuxian 2025-03-08 20:42:26 +08:00
parent 5750128f60
commit 78afc9005f

View File

@ -123,23 +123,23 @@ type RecordDataLite struct {
}
func (r RecordDataLite) ToString() string {
formatedStrRanked := "%s%s 使用 %s 在 %s 的 %s 难度(%.1f🌟)中打到了全球排名第%dpp 为 %.2f,准度为 %s。"
formatedStrUnranked := "%s, %s 使用 %s 在 %s 的 %s 难度中打到了全球排名第%d准度为 %s。"
formatedStrWithoutDevice := "%s, %s 在 %s 的 %s 难度(%.1f🌟)中打到了全球排名第%dpp 为 %.2f,准度为 %s。"
formatedStrWithoutDeviceAndRank := "%s, %s 在 %s 的 %s 难度中打到了全球排名第%d准度为 %s。"
formatedStrRanked := "%s%s 使用 %s 在 %s(%s) 的 %s 难度(%.1f🌟)中打到了全球排名第%dpp 为 %.2f,准度为 %s。"
formatedStrUnranked := "%s, %s 使用 %s 在 %s(%s) 的 %s 难度中打到了全球排名第%d准度为 %s。"
formatedStrWithoutDevice := "%s, %s 在 %s(%s) 的 %s 难度(%.1f🌟)中打到了全球排名第%dpp 为 %.2f,准度为 %s。"
formatedStrWithoutDeviceAndRank := "%s, %s 在 %s(%s) 的 %s 难度中打到了全球排名第%d准度为 %s。"
hardStr := strings.Split(r.DifficultyRaw, "_")[1]
layout := "2006-01-02 15:04:05.999999999-07:00"
parsedTime, _ := time.Parse(layout, r.GeneratedTime)
duration := time.Since(parsedTime)
timeStr := timeConvert(duration)
if r.Stars == 0 && r.DeviceHmd != "" {
return fmt.Sprintf(formatedStrUnranked, timeStr, r.Name, r.DeviceHmd, r.SongName, hardStr, r.Rank, fmt.Sprintf("%.2f%%", float64(r.Score)/float64(r.MaxScore)*100))
return fmt.Sprintf(formatedStrUnranked, timeStr, r.Name, r.DeviceHmd, r.SongName, r.SongId, hardStr, r.Rank, fmt.Sprintf("%.2f%%", float64(r.Score)/float64(r.MaxScore)*100))
} else if r.Stars != 0 && r.DeviceHmd != "" {
return fmt.Sprintf(formatedStrRanked, timeStr, r.Name, r.DeviceHmd, r.SongName, hardStr, r.Stars, r.Rank, r.PP, fmt.Sprintf("%.2f%%", float64(r.Score)/float64(r.MaxScore)*100))
return fmt.Sprintf(formatedStrRanked, timeStr, r.Name, r.DeviceHmd, r.SongName, r.SongId, hardStr, r.Stars, r.Rank, r.PP, fmt.Sprintf("%.2f%%", float64(r.Score)/float64(r.MaxScore)*100))
} else if r.Stars != 0 && r.DeviceHmd == "" {
return fmt.Sprintf(formatedStrWithoutDevice, timeStr, r.Name, r.SongName, hardStr, r.Stars, r.Rank, r.PP, fmt.Sprintf("%.2f%%", float64(r.Score)/float64(r.MaxScore)*100))
return fmt.Sprintf(formatedStrWithoutDevice, timeStr, r.Name, r.SongName, r.SongId, hardStr, r.Stars, r.Rank, r.PP, fmt.Sprintf("%.2f%%", float64(r.Score)/float64(r.MaxScore)*100))
} else {
return fmt.Sprintf(formatedStrWithoutDeviceAndRank, timeStr, r.Name, r.SongName, hardStr, r.Rank, fmt.Sprintf("%.2f%%", float64(r.Score)/float64(r.MaxScore)*100))
return fmt.Sprintf(formatedStrWithoutDeviceAndRank, timeStr, r.Name, r.SongName, r.SongId, hardStr, r.Rank, fmt.Sprintf("%.2f%%", float64(r.Score)/float64(r.MaxScore)*100))
}
}