refactor(gacha): extract gacha logic into GachaService

Move payment processing, reward selection, stepup state management,
and box gacha tracking from handlers into a dedicated service layer.
Handlers now delegate to GachaService methods and only handle
protocol serialization.
This commit is contained in:
Houmgaor
2026-02-23 23:57:54 +01:00
parent 32c5a9bf9c
commit 1e9de7920d
6 changed files with 709 additions and 236 deletions

View File

@@ -66,6 +66,11 @@ func ensureAchievementService(s *Server) {
s.achievementService = NewAchievementService(s.achievementRepo, s.logger)
}
// ensureGachaService wires the GachaService from the server's current repos.
func ensureGachaService(s *Server) {
s.gachaService = NewGachaService(s.gachaRepo, s.userRepo, s.charRepo, s.logger, 100000)
}
// createMockSession creates a minimal Session for testing.
// Imported from v9.2.x-stable and adapted for main.
func createMockSession(charID uint32, server *Server) *Session {