mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 05:43:41 +03:00
Implement Fate Boards
Build and Push Docker images to Docker Hub / build-and-push (push) Has been cancelled
Build and Push Docker images to Docker Hub / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
package userdata
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"lunar-tear/server/internal/masterdata"
|
||||
"lunar-tear/server/internal/store"
|
||||
"lunar-tear/server/internal/utils"
|
||||
)
|
||||
|
||||
var labyrinthCatalog = sync.OnceValue(masterdata.LoadLabyrinthCatalog)
|
||||
|
||||
func init() {
|
||||
register("IUserEventQuestLabyrinthSeason", func(user store.UserState) string {
|
||||
chapters := labyrinthCatalog().ChaptersByOrder
|
||||
records := make([]map[string]any, 0, len(chapters))
|
||||
for _, ch := range chapters {
|
||||
if st, ok := user.LabyrinthSeasons[ch.EventQuestChapterId]; ok {
|
||||
records = append(records, map[string]any{
|
||||
"userId": user.UserId,
|
||||
"eventQuestChapterId": st.EventQuestChapterId,
|
||||
"lastJoinSeasonNumber": st.LastJoinSeasonNumber,
|
||||
"lastSeasonRewardReceivedSeasonNumber": st.LastSeasonRewardReceivedSeasonNumber,
|
||||
"latestVersion": st.LatestVersion,
|
||||
})
|
||||
continue
|
||||
}
|
||||
records = append(records, map[string]any{
|
||||
"userId": user.UserId,
|
||||
"eventQuestChapterId": ch.EventQuestChapterId,
|
||||
"lastJoinSeasonNumber": ch.LatestSeasonNumber,
|
||||
"lastSeasonRewardReceivedSeasonNumber": 0,
|
||||
"latestVersion": user.GameStartDatetime,
|
||||
})
|
||||
}
|
||||
s, _ := utils.EncodeJSONMaps(records...)
|
||||
return s
|
||||
})
|
||||
|
||||
register("IUserEventQuestLabyrinthStage", func(user store.UserState) string {
|
||||
records := make([]map[string]any, 0)
|
||||
for _, ch := range labyrinthCatalog().ChaptersByOrder {
|
||||
for _, stageOrder := range ch.StageOrders {
|
||||
key := store.LabyrinthStageKey{
|
||||
EventQuestChapterId: ch.EventQuestChapterId,
|
||||
StageOrder: stageOrder,
|
||||
}
|
||||
if st, ok := user.LabyrinthStages[key]; ok {
|
||||
records = append(records, map[string]any{
|
||||
"userId": user.UserId,
|
||||
"eventQuestChapterId": st.EventQuestChapterId,
|
||||
"stageOrder": st.StageOrder,
|
||||
"isReceivedStageClearReward": st.IsReceivedStageClearReward,
|
||||
"accumulationRewardReceivedQuestMissionCount": st.AccumulationRewardReceivedQuestMissionCount,
|
||||
"latestVersion": st.LatestVersion,
|
||||
})
|
||||
continue
|
||||
}
|
||||
records = append(records, map[string]any{
|
||||
"userId": user.UserId,
|
||||
"eventQuestChapterId": ch.EventQuestChapterId,
|
||||
"stageOrder": stageOrder,
|
||||
"isReceivedStageClearReward": false,
|
||||
"accumulationRewardReceivedQuestMissionCount": 0,
|
||||
"latestVersion": user.GameStartDatetime,
|
||||
})
|
||||
}
|
||||
}
|
||||
s, _ := utils.EncodeJSONMaps(records...)
|
||||
return s
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user