Implement Tower accumulation reward claiming

This commit is contained in:
Ilya Groshev
2026-05-16 20:51:44 +03:00
parent 1dc5b8fd7c
commit 25cbe8635f
13 changed files with 272 additions and 66 deletions
@@ -263,6 +263,9 @@ func ChangedTables(before, after *store.UserState) []string {
if !mapsEqualStruct(before.CageOrnamentRewards, after.CageOrnamentRewards) {
add("IUserCageOrnamentReward")
}
if !mapsEqualStruct(before.TowerAccumulationRewards, after.TowerAccumulationRewards) {
add("IUserEventQuestTowerAccumulationReward")
}
if !mapsEqualStruct(before.BigHuntMaxScores, after.BigHuntMaxScores) {
add("IUserBigHuntMaxScore")
@@ -426,6 +429,8 @@ func keyFieldsForTable(table string) []string {
return []string{"userId", "userPartsPresetTagNumber"}
case "IUserCageOrnamentReward":
return []string{"userId", "cageOrnamentId"}
case "IUserEventQuestTowerAccumulationReward":
return []string{"userId", "eventQuestChapterId"}
case "IUserAutoSaleSettingDetail":
return []string{"userId", "possessionAutoSaleItemType"}
case "IUserCharacterRebirth":
+22 -1
View File
@@ -219,11 +219,32 @@ func init() {
s, _ := utils.EncodeJSONMaps(records...)
return s
})
register("IUserEventQuestTowerAccumulationReward", func(user store.UserState) string {
if len(user.TowerAccumulationRewards) == 0 {
return "[]"
}
ids := make([]int, 0, len(user.TowerAccumulationRewards))
for id := range user.TowerAccumulationRewards {
ids = append(ids, int(id))
}
sort.Ints(ids)
records := make([]map[string]any, 0, len(ids))
for _, id := range ids {
st := user.TowerAccumulationRewards[int32(id)]
records = append(records, map[string]any{
"userId": user.UserId,
"eventQuestChapterId": st.EventQuestChapterId,
"latestRewardReceiveQuestMissionClearCount": st.LatestRewardReceiveQuestMissionClearCount,
"latestVersion": st.LatestVersion,
})
}
s, _ := utils.EncodeJSONMaps(records...)
return s
})
registerStatic(
"IUserEventQuestDailyGroupCompleteReward",
"IUserEventQuestLabyrinthSeason",
"IUserEventQuestLabyrinthStage",
"IUserEventQuestTowerAccumulationReward",
"IUserQuestReplayFlowRewardGroup",
"IUserQuestAutoOrbit",
"IUserQuestSceneChoice",