Fix map replay flow and quest mission rewards
Build and Push Docker images to Docker Hub / build-and-push (push) Has been cancelled

This commit is contained in:
Ilya Groshev
2026-05-11 20:21:55 +03:00
parent 9a2cc92a6f
commit 6c9e3c45f0
14 changed files with 241 additions and 188 deletions
+7
View File
@@ -6,6 +6,7 @@ import (
pb "lunar-tear/server/gen/proto"
"lunar-tear/server/internal/gametime"
"lunar-tear/server/internal/model"
"lunar-tear/server/internal/store"
)
@@ -27,6 +28,12 @@ func (s *PortalCageServiceServer) UpdatePortalCageSceneProgress(ctx context.Cont
now := gametime.NowMillis()
user.PortalCageStatus.IsCurrentProgress = true
user.PortalCageStatus.LatestVersion = now
// Mama's Room ends any active replay — flip flow type to MainFlow;
// ReplayFlow* stay sticky (matches original userdata snapshot).
if user.MainQuest.CurrentQuestFlowType != int32(model.QuestFlowTypeMainFlow) {
user.MainQuest.CurrentQuestFlowType = int32(model.QuestFlowTypeMainFlow)
user.MainQuest.LatestVersion = now
}
})
return &pb.UpdatePortalCageSceneProgressResponse{}, nil
}
+1 -19
View File
@@ -19,7 +19,6 @@ import (
pb "lunar-tear/server/gen/proto"
"lunar-tear/server/internal/gametime"
"lunar-tear/server/internal/model"
"lunar-tear/server/internal/questflow"
"lunar-tear/server/internal/runtime"
"lunar-tear/server/internal/store"
)
@@ -96,24 +95,7 @@ func (s *UserServiceServer) GameStart(ctx context.Context, _ *emptypb.Empty) (*p
userId := CurrentUserId(ctx, s.users, s.sessions)
s.users.UpdateUser(userId, func(user *store.UserState) {
now := gametime.NowMillis()
user.GameStartDatetime = now
// Backfill IUserMainQuestSeasonRoute history so the client can compute
// the next route after a chapter end. Idempotent: RecordSeasonRoute
// is a no-op for entries that already exist.
if catalog := s.holder.Get(); catalog != nil && catalog.QuestHandler != nil {
if user.MainQuest.MainQuestSeasonId > 0 && user.MainQuest.CurrentMainQuestRouteId > 0 {
before := len(user.MainQuestSeasonRoutes)
for _, p := range catalog.QuestHandler.SeasonRoutesUpToCurrent(user.MainQuest.MainQuestSeasonId, user.MainQuest.CurrentMainQuestRouteId) {
questflow.RecordSeasonRoute(user, p.MainQuestSeasonId, p.MainQuestRouteId, now)
}
if added := len(user.MainQuestSeasonRoutes) - before; added > 0 {
user.MainQuest.LatestVersion = now
log.Printf("[UserService] GameStart: backfilled %d MainQuestSeasonRoute entries", added)
}
}
}
user.GameStartDatetime = gametime.NowMillis()
})
return &pb.GameStartResponse{}, nil