From a7ec1f1b7b203beab297538bb548be36de862f42 Mon Sep 17 00:00:00 2001 From: Sean Du Date: Fri, 5 Jun 2026 04:00:32 +0800 Subject: [PATCH] Add LP recovery items to user info Signed-off-by: Sean Du --- internal/schema/user/userinfo.go | 62 ++++++++++++++++---------------- internal/session/userdata.go | 21 +++++++++++ 2 files changed, 52 insertions(+), 31 deletions(-) diff --git a/internal/schema/user/userinfo.go b/internal/schema/user/userinfo.go index 9a35e63..01ae08c 100644 --- a/internal/schema/user/userinfo.go +++ b/internal/schema/user/userinfo.go @@ -6,37 +6,37 @@ type LpRecoveryItem struct { } type UserInfo struct { - UserID int `json:"user_id"` - Name string `json:"name"` - Level int `json:"level"` - Exp int `json:"exp"` - PreviousExp int `json:"previous_exp"` - NextExp int `json:"next_exp"` - GameCoin int `json:"game_coin"` - SnsCoin int `json:"sns_coin"` - FreeSnsCoin int `json:"free_sns_coin"` - PaidSnsCoin int `json:"paid_sns_coin"` - SocialPoint int `json:"social_point"` - UnitMax int `json:"unit_max"` - WaitingUnitMax int `json:"waiting_unit_max"` - CurrentEnergy int `json:"current_energy"` - EnergyMax int `json:"energy_max"` - EnergyFullTime string `json:"energy_full_time"` - LicenseLiveEnergyRecoverlyTime int `json:"license_live_energy_recoverly_time"` - EnergyFullNeedTime int `json:"energy_full_need_time"` - OverMaxEnergy int `json:"over_max_energy"` - TrainingEnergy int `json:"training_energy"` - TrainingEnergyMax int `json:"training_energy_max"` - FriendMax int `json:"friend_max"` - InviteCode string `json:"invite_code"` - InsertDate string `json:"insert_date"` - UpdateDate string `json:"update_date"` - TutorialState int `json:"tutorial_state"` - DiamondCoin int `json:"diamond_coin"` - 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"` + UserID int `json:"user_id"` + Name string `json:"name"` + Level int `json:"level"` + Exp int `json:"exp"` + PreviousExp int `json:"previous_exp"` + NextExp int `json:"next_exp"` + GameCoin int `json:"game_coin"` + SnsCoin int `json:"sns_coin"` + FreeSnsCoin int `json:"free_sns_coin"` + PaidSnsCoin int `json:"paid_sns_coin"` + SocialPoint int `json:"social_point"` + UnitMax int `json:"unit_max"` + WaitingUnitMax int `json:"waiting_unit_max"` + CurrentEnergy int `json:"current_energy"` + EnergyMax int `json:"energy_max"` + EnergyFullTime string `json:"energy_full_time"` + LicenseLiveEnergyRecoverlyTime int `json:"license_live_energy_recoverly_time"` + EnergyFullNeedTime int `json:"energy_full_need_time"` + OverMaxEnergy int `json:"over_max_energy"` + TrainingEnergy int `json:"training_energy"` + TrainingEnergyMax int `json:"training_energy_max"` + FriendMax int `json:"friend_max"` + InviteCode string `json:"invite_code"` + InsertDate string `json:"insert_date"` + UpdateDate string `json:"update_date"` + TutorialState int `json:"tutorial_state"` + DiamondCoin int `json:"diamond_coin"` + 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"` } type Birth struct { diff --git a/internal/session/userdata.go b/internal/session/userdata.go index 00dcafb..c85a9f3 100644 --- a/internal/session/userdata.go +++ b/internal/session/userdata.go @@ -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)).