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

@@ -73,6 +73,7 @@ type Server struct {
mercenaryRepo MercenaryRepo
guildService *GuildService
achievementService *AchievementService
gachaService *GachaService
erupeConfig *cfg.Config
acceptConns chan net.Conn
deleteConns chan net.Conn
@@ -157,6 +158,7 @@ func NewServer(config *Config) *Server {
s.guildService = NewGuildService(s.guildRepo, s.mailRepo, s.charRepo, s.logger)
s.achievementService = NewAchievementService(s.achievementRepo, s.logger)
s.gachaService = NewGachaService(s.gachaRepo, s.userRepo, s.charRepo, s.logger, config.ErupeConfig.GameplayOptions.MaximumNP)
// Mezeporta
s.stages.Store("sl1Ns200p0a0u0", NewStage("sl1Ns200p0a0u0"))