From 66459e7a64810d37bcab137f067d75c1368a8c7f Mon Sep 17 00:00:00 2001 From: Yuan Si Date: Thu, 1 Feb 2024 15:57:19 +0800 Subject: [PATCH] !fixup: sif: Make some user/ui preferences configurable Signed-off-by: Yuan Si --- handler/live.go | 71 +++++++++++++++++++++++---------------------- handler/userinfo.go | 2 +- model/live.go | 4 +-- 3 files changed, 39 insertions(+), 38 deletions(-) diff --git a/handler/live.go b/handler/live.go index 757fa0e..e7ec66d 100644 --- a/handler/live.go +++ b/handler/live.go @@ -4,6 +4,7 @@ import ( "encoding/base64" "encoding/json" "fmt" + "honoka-chan/config" "honoka-chan/database" "honoka-chan/encrypt" "honoka-chan/model" @@ -517,7 +518,7 @@ func PlayScore(ctx *gin.Context) { }, RankInfo: ranks, CanActivateEffect: true, - ServerTimestamp: int(time.Now().Unix()), + ServerTimestamp: time.Now().Unix(), }, ReleaseInfo: []any{}, StatusCode: 200, @@ -573,22 +574,22 @@ func PlayReward(ctx *gin.Context) { IsHighScore: true, HiScore: totalScore, BaseRewardInfo: model.BaseRewardInfo{ - PlayerExp: 830, + PlayerExp: 0, PlayerExpUnitMax: model.PlayerExpUnitMax{ - Before: 900, - After: 900, + Before: 0, + After: 0, }, PlayerExpFriendMax: model.PlayerExpFriendMax{ Before: 99, After: 99, }, PlayerExpLpMax: model.PlayerExpLpMax{ - Before: 417, - After: 417, + Before: config.Conf.UserPrefs.EnergyMax, + After: config.Conf.UserPrefs.EnergyMax, }, - GameCoin: 4500, + GameCoin: 0, GameCoinRewardBoxFlag: false, - SocialPoint: 10, + SocialPoint: 0, }, RewardUnitList: model.RewardUnitList{ LiveClear: []model.LiveClear{}, @@ -602,57 +603,57 @@ func PlayReward(ctx *gin.Context) { LimitedEffortBox: []any{}, UnitList: unitsList, BeforeUserInfo: model.BeforeUserInfo{ - Level: 1028, - Exp: 28823566, - PreviousExp: 27734700, - NextExp: 28941885, - GameCoin: 86505544, - SnsCoin: 49, - FreeSnsCoin: 48, - PaidSnsCoin: 1, + Level: config.Conf.UserPrefs.Level, + Exp: config.Conf.UserPrefs.ExpNumerator, + PreviousExp: 0, + NextExp: config.Conf.UserPrefs.ExpDenominator, + GameCoin: config.Conf.UserPrefs.GameCoin, + SnsCoin: config.Conf.UserPrefs.SnsCoin, + FreeSnsCoin: config.Conf.UserPrefs.SnsCoin, + PaidSnsCoin: 0, SocialPoint: 1438165, UnitMax: 5000, WaitingUnitMax: 1000, - CurrentEnergy: 392, - EnergyMax: 417, + CurrentEnergy: config.Conf.UserPrefs.EnergyMax, + EnergyMax: config.Conf.UserPrefs.EnergyMax, TrainingEnergy: 9, TrainingEnergyMax: 10, EnergyFullTime: "2023-03-20 01:28:55", LicenseLiveEnergyRecoverlyTime: 60, FriendMax: 99, TutorialState: -1, - OverMaxEnergy: 0, + OverMaxEnergy: config.Conf.UserPrefs.OverMaxEnergy, UnlockRandomLiveMuse: 1, UnlockRandomLiveAqours: 1, }, AfterUserInfo: model.AfterUserInfo{ - Level: 1028, - Exp: 28824396, - PreviousExp: 27734700, - NextExp: 28941885, - GameCoin: 86520044, - SnsCoin: 50, - FreeSnsCoin: 49, - PaidSnsCoin: 1, + Level: config.Conf.UserPrefs.Level, + Exp: config.Conf.UserPrefs.ExpNumerator, + PreviousExp: 0, + NextExp: config.Conf.UserPrefs.ExpDenominator, + GameCoin: config.Conf.UserPrefs.GameCoin, + SnsCoin: config.Conf.UserPrefs.SnsCoin, + FreeSnsCoin: config.Conf.UserPrefs.SnsCoin, + PaidSnsCoin: 0, SocialPoint: 1438375, UnitMax: 5000, WaitingUnitMax: 1000, - CurrentEnergy: 392, - EnergyMax: 417, + CurrentEnergy: config.Conf.UserPrefs.EnergyMax, + EnergyMax: config.Conf.UserPrefs.EnergyMax, TrainingEnergy: 9, TrainingEnergyMax: 10, EnergyFullTime: "2023-03-20 01:28:55", LicenseLiveEnergyRecoverlyTime: 60, FriendMax: 99, TutorialState: -1, - OverMaxEnergy: 0, + OverMaxEnergy: config.Conf.UserPrefs.OverMaxEnergy, UnlockRandomLiveMuse: 1, UnlockRandomLiveAqours: 1, }, NextLevelInfo: []model.NextLevelInfo{ { - Level: 1028, - FromExp: 28823566, + Level: config.Conf.UserPrefs.Level, + FromExp: config.Conf.UserPrefs.ExpNumerator, }, }, GoalAccompInfo: model.GoalAccompInfo{ @@ -675,12 +676,12 @@ func PlayReward(ctx *gin.Context) { IsVisible: true, }, AccomplishedAchievementList: []model.AccomplishedAchievementList{}, - UnaccomplishedAchievementCnt: 15, + UnaccomplishedAchievementCnt: 0, AddedAchievementList: []any{}, MuseumInfo: model.Museum{}, UnitSupportList: []model.RewardUnitSupportList{}, - ServerTimestamp: 1679238066, - PresentCnt: 2159, + ServerTimestamp: time.Now().Unix(), + PresentCnt: 0, }, ReleaseInfo: []any{}, StatusCode: 200, diff --git a/handler/userinfo.go b/handler/userinfo.go index 4145312..198b2fc 100644 --- a/handler/userinfo.go +++ b/handler/userinfo.go @@ -38,7 +38,7 @@ func UserInfo(ctx *gin.Context) { NextExp: config.Conf.UserPrefs.ExpDenominator, GameCoin: config.Conf.UserPrefs.GameCoin, SnsCoin: config.Conf.UserPrefs.SnsCoin, - FreeSnsCoin: 0, + FreeSnsCoin: config.Conf.UserPrefs.SnsCoin, PaidSnsCoin: 0, SocialPoint: 1438395, UnitMax: 5000, diff --git a/model/live.go b/model/live.go index 4bf1634..1f06270 100644 --- a/model/live.go +++ b/model/live.go @@ -240,7 +240,7 @@ type PlayScoreRes struct { Off Off `json:"off"` RankInfo []RankInfo `json:"rank_info"` CanActivateEffect bool `json:"can_activate_effect"` - ServerTimestamp int `json:"server_timestamp"` + ServerTimestamp int64 `json:"server_timestamp"` } // PlayScoreResp ... @@ -617,7 +617,7 @@ type RewardRes struct { AddedAchievementList []any `json:"added_achievement_list"` MuseumInfo Museum `json:"museum_info"` UnitSupportList []RewardUnitSupportList `json:"unit_support_list"` - ServerTimestamp int `json:"server_timestamp"` + ServerTimestamp int64 `json:"server_timestamp"` PresentCnt int `json:"present_cnt"` }