Ejemplo n.º 1
0
        public async Task <MemberHistoryResult> GetMemberHistoryResult(MemberHistoryResultQuery query)
        {
            using (var db = databaseManager.GetReadOnlyDatabase(query.OperatorTag))
            {
                var history = await db.GameHistories
                              .Include(gh => gh.Game)
                              .FirstOrDefaultAsync(gh => gh.GameTransactionId == query.TransactionId);

                if (history != null)
                {
                    var validTransactionId = MemberHistoryResult.GetTransactionId(history);

                    var spinBetProfile = await db.SpinBetProfiles
                                         .FirstOrDefaultAsync(sbp => sbp.GameTransactionId == validTransactionId);

                    return(new MemberHistoryResult(
                               gamePayoutEngine,
                               paylineRepository,
                               gameInfoRepository,
                               history,
                               historyDecoderFactory,
                               spinBetProfile));
                }
                else
                {
                    return(null);
                }
            }
        }
        protected void FreeGameDecode(MemberHistoryResult model, string historyXml)
        {
            var bonusXml = _xmlHelper.Deserialize <BonusXml>(historyXml);
            var spinXml  = bonusXml.Data.Element("spin").ToString();

            model.BonusXml = bonusXml;
            EncodeWheel(model, spinXml);
        }
Ejemplo n.º 3
0
        protected void FreeGameDecode(MemberHistoryResult model, string historyXml)
        {
            var bonusXml   = _xmlHelper.Deserialize <BonusXml>(historyXml);
            var spinXml    = bonusXml.Data.Element("spin").ToString();
            var multiplier = XElement.Parse(historyXml).Attribute("mp");

            model.BonusXml = bonusXml;
            DecodeWheel(model, spinXml, null != multiplier ? multiplier.Value : "1");
        }
 public void AmendSpinHistory(MemberHistoryResult model, GameHistory history)
 {
     if (history.GameResultType == GameResultType.SpinResult)
     {
         MainGameDecode(model, history.HistoryXml);
     }
     else
     {
         FreeGameDecode(model, history.HistoryXml);
     }
 }
        private void EncodeWheel(MemberHistoryResult model, string historyXml)
        {
            var regex        = new Regex(@"<wheels[^>]+>");
            var wheelPattern = new int[] { 3, 3, 3, 3, 3 };
            var xml          = _xmlHelper.Deserialize <SpinXml>(historyXml);
            var match        = regex.Match(historyXml);
            var element      = XElement.Parse(match.Value);
            var value        = element.AttributeValue("val");

            xml.Wheel      = new Wheel(wheelPattern.ToList(), value);
            model.SpinXml  = xml;
            model.Wheel    = CreateWheelViewModel(xml.Wheel);
            model.WinTable = GetWinTable(xml.WinPositions);
        }
        protected void MainGameDecode(MemberHistoryResult model, string historyXml)
        {
            var regex   = new Regex(@"<wheels[^>]+>");
            var xml     = _xmlHelper.Deserialize <SpinXml>(historyXml);
            var match   = regex.Match(historyXml);
            var element = XElement.Parse(match.Value);
            var value   = element.AttributeValue("val");

            xml.Wheel = new Wheel(new List <int> {
                3, 4, 5, 6, 7, 7
            }, value);
            model.SpinXml  = xml;
            model.Wheel    = CreateWheelViewModel(xml.Wheel);
            model.PayLine  = _mainGamePayLine.Lines;
            model.WinTable = GetWinTable(_freeGamePayLine, model.SpinXml.WinPositions, new[] { 3, 4, 5, 6, 7, 7 });
        }
 protected void MainGameDecode(MemberHistoryResult model, string historyXml)
 {
     EncodeWheel(model, historyXml);
 }