public async Task <Result <RequestContext <BonusArgs>, ErrorCode> > Build(BonusGameMessage message) { var buildRequest = await RequestContextBuilder.Build <BonusArgs>(userService, gameService, cachedSettings, httpContextAccessor, message.Key, message.Game); if (buildRequest.IsError) { return(buildRequest.Error); } var request = buildRequest.Value; var gameState = await userService.GetGameState(request); if (gameState == null || gameState.Type == GameStateType.SlotStateNormal) { return(ErrorCode.IncorrectState); } request.LastGameState = gameState; request.Parameters = new BonusArgs { Bonus = message.Bonus, Param = message.Param, Step = 0 }; return(request); }
public async Task <Result <RequestContext <SpinArgs>, ErrorCode> > Build(SpinMessage message) { var buildRequest = await RequestContextBuilder.Build <SpinArgs>(userService, gameService, cachedSettings, httpContextAccessor, message.Key, message.Game); if (buildRequest.IsError) { return(buildRequest.Error); } var request = buildRequest.Value; var gameState = await userService.GetGameState(request); if (gameState.Type == GameStateType.SlotStateBonus) { return(ErrorCode.IncorrectState); } request.LastGameState = gameState; if (message.Bet < 0m) { return(ErrorCode.IncorrectBet); } if (!request.GameSetting.CoinsDenomination .Split(';') .Select(decimal.Parse).ToList().Any(s => s == message.Bet)) { return(ErrorCode.IncorrectBet); } EnsureBetMultiplier(message, request.GameSetting.CoinsMultiplier); if (message.SideBet && !request.Game.IsSideBet) { return(ErrorCode.WrongParameter); } request.Query.TryGetInt32("cheat", out int cheat); var args = new SpinArgs { LineBet = message.Bet, SideBet = message.SideBet, FunPlayDemoKey = cheat, IsAutoSpin = false, BettingLines = 0, Multiplier = message.Multiplier }; request.Parameters = args; return(request); }
public async Task <Result <RequestContext <GetBetsArgs>, ErrorCode> > Build(GetBetsMessage message) { var buildRequest = await RequestContextBuilder.Build <GetBetsArgs>(userService, gameService, cachedSettings, httpContextAccessor, message.Key, message.Game); if (buildRequest.IsError) { return(buildRequest.Error); } var request = buildRequest.Value; return(request); }