Add campaign bonuses; fix parts variant/sub-stat grants and menu-pick quest resume state
Build and Push Docker images to Docker Hub / build-and-push (push) Has been cancelled

This commit is contained in:
Ilya Groshev
2026-05-25 09:31:53 +03:00
parent 2d0c0d8ef0
commit dc7c1df4fd
21 changed files with 825 additions and 69 deletions
+19 -1
View File
@@ -3,6 +3,7 @@ package userdata
import (
"sort"
"lunar-tear/server/internal/model"
"lunar-tear/server/internal/store"
"lunar-tear/server/internal/utils"
)
@@ -13,13 +14,30 @@ func sortedQuestRecords(user store.UserState) []map[string]any {
ids = append(ids, int(id))
}
sort.Ints(ids)
var replayQuestId int32
if user.MainQuest.SavedContext.Active && questHandler != nil {
if scene, ok := questHandler.SceneById[user.MainQuest.ProgressQuestSceneId]; ok {
replayQuestId = scene.QuestId
}
}
records := make([]map[string]any, 0, len(ids))
for _, id := range ids {
row := user.Quests[int32(id)]
stateType := row.QuestStateType
if replayQuestId != 0 {
switch {
case int32(id) == replayQuestId:
stateType = model.UserQuestStateTypeActive
case stateType == model.UserQuestStateTypeActive:
stateType = model.UserQuestStateTypeCleared
}
}
records = append(records, map[string]any{
"userId": user.UserId,
"questId": row.QuestId,
"questStateType": row.QuestStateType,
"questStateType": stateType,
"isBattleOnly": row.IsBattleOnly,
"latestStartDatetime": row.LatestStartDatetime,
"clearCount": row.ClearCount,