mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 05:43:41 +03:00
Fix map replay flow and quest mission rewards
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user