Add LP recovery items to user info

Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
2026-06-05 05:48:43 +08:00
parent 947da92a66
commit a7ec1f1b7b
2 changed files with 52 additions and 31 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ type UserInfo struct {
CrystalCoin int `json:"crystal_coin"`
UnlockRandomLiveMuse int `json:"unlock_random_live_muse"`
UnlockRandomLiveAqours int `json:"unlock_random_live_aqours"`
// LpRecoveryItem []LpRecoveryItem `json:"lp_recovery_item"`
LpRecoveryItem []LpRecoveryItem `json:"lp_recovery_item"`
}
type Birth struct {
+21
View File
@@ -7,6 +7,15 @@ import (
userschema "honoka-chan/internal/schema/user"
)
// recovery_item_m
// https://github.com/lemon-devs/llsif_cn_db_diff/blob/master/item/item.db.sql
var defaultLpRecoveryItemIDs = []int{
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, 801, 802, 803, 804, 805, 995, 777001, 777002, 777003,
777005, 777006, 777007, 777008, 777009, 777010, 777011, 777012, 777013, 777014,
777015, 777016, 777017, 777018, 777019, 777020,
}
func (ss *Session) GetUserPref(userID string) usermodel.UserPref {
pref := usermodel.UserPref{}
has, err := ss.UserEng.Table(new(usermodel.UserPref)).
@@ -64,9 +73,21 @@ func (ss *Session) GetUserInfo() userschema.UserInfo {
CrystalCoin: 0,
UnlockRandomLiveMuse: 1,
UnlockRandomLiveAqours: 1,
LpRecoveryItem: buildLpRecoveryItems(),
}
}
func buildLpRecoveryItems() []userschema.LpRecoveryItem {
items := make([]userschema.LpRecoveryItem, 0, len(defaultLpRecoveryItemIDs))
for _, itemID := range defaultLpRecoveryItemIDs {
items = append(items, userschema.LpRecoveryItem{
ItemID: itemID,
Amount: 1,
})
}
return items
}
func (ss *Session) GetUserLiveRecord(liveDifficultyID int) []usermodel.UserLiveRecord {
liveRecord := []usermodel.UserLiveRecord{}
err := ss.UserEng.Table(new(usermodel.UserLiveRecord)).