private static bool CheckSquareMidle(WheelViewModel wheel) { return(CheckWild(2, 1, (int)LuckyRoyaleSymbol.WildSquare, wheel)); }
private void DisplayFreeSpinHistory(GameHistory history) { var xmlHelper = new XmlHelper(); var xml = xmlHelper.Deserialize <BonusXml>(history.HistoryXml); BonusXml = xml; XElement spinXml = xml.Data.Element("spin") ?? xml.Data.Element("wheels").Element("stage").Element("spin"); SpinXml = xmlHelper.Deserialize <SpinXml>(spinXml.ToString()); PayLine = paylineRepository.Get((GameIdEnum)history.GameId).Lines; if (xml.Data.Element("spin") != null && xml.Data.Element("spin").Element("bonus") != null && xml.Data.Element("spin").Element("bonus").Attribute("addFSCount") != null) { AdditionalFreeSpin = (xml.Data.Element("spin").Element("bonus")).Attribute("addFSCount").Value.ToInt(); } var fsReplacementSymbol = new Dictionary <int, int>(); if (!FreeSpinReplacement.TryGetValue(history.GameId, out fsReplacementSymbol)) { fsReplacementSymbol = new Dictionary <int, int>(); } Wheel = new WheelViewModel { reels = new List <List <Symbols> >() }; PostWheel = new WheelViewModel { reels = new List <List <Symbols> >() }; var wheel = SpinXml.Wheel; var postWheel = SpinXml.PostWheel; CreateWheel(Wheel, wheel, fsReplacementSymbol); if (postWheel != null) { CreateWheel(PostWheel, postWheel, fsReplacementSymbol); } OriginalWinPosition = SpinXml.WinPositions.Where(w => !(w is WinPositionExpanding)); ExpandingWinPosition = SpinXml.WinPositions.OfType <WinPositionExpanding>(); switch (history.GameId) { case (int)GameIdEnum.ForbiddenChamber: case (int)GameIdEnum.WorldOfWarlords: BonusXml = xmlHelper.Deserialize <BonusXml>(history.HistoryXml); foreach (FeatureElement item in BonusXml.Feature) { Wheel.reels[item.Reel - 1][item.Row - 1].symbol += 13; } break; case (int)GameIdEnum.Genisys: if (BonusXml.Data.Element("mode") != null && Convert.ToInt32(BonusXml.Data.Element("mode").Value) != (int)GenisysMode.Future) { break; } for (int i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)GenisysSymbol.Wild)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)GenisysSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } break; case (int)GameIdEnum.DesertOasis: for (int i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)DesertOasisSymbol.Camel)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)DesertOasisSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } break; case (int)GameIdEnum.GoldenWheel: if (BonusXml.Type == "fs") { GameResultType = GameResultType.RespinResult; } break; case (int)GameIdEnum.SevenWonders: case (int)GameIdEnum.FloraSecret: if (BonusXml.Type == "fs") { GameResultType = GameResultType.RespinResult; } for (int i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)SevenWondersSymbol.Wild)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)SevenWondersSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } break; case (int)GameIdEnum.FortuneKoi: if (BonusXml.Type == "fs") { GameResultType = GameResultType.RespinResult; } for (int i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)SevenWondersSymbol.Wild)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)SevenWondersSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } break; case (int)GameIdEnum.AssaultOnTitan: if (BonusXml.Data.Element("mode") != null && Convert.ToInt32(BonusXml.Data.Element("mode").Value) != 3) { break; } for (int i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)AssaultOnTitanSymbol.Wild)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)AssaultOnTitanSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } break; case (int)GameIdEnum.FuLuShou: if (BonusXml.Type == "fs") { GameResultType = GameResultType.RespinResult; } new FuLuShouExpandingWild().Expanding(Wheel); break; case (int)GameIdEnum.FortuneDice: EditSymbolWithOverprintSymbols(); break; case (int)GameIdEnum.FourBeauties: case (int)GameIdEnum.ThreeKingdoms: case (int)GameIdEnum.Soccer: if (BonusXml.Data.Element("mode") != null && Convert.ToInt32(BonusXml.Data.Element("mode").Value) != 2) { break; } for (int i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)FourBeautiesSymbol.Wild)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)FourBeautiesSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } break; case (int)GameIdEnum.LanternFestival: case (int)GameIdEnum.LanternFestivalPro: for (int i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)LanternFestivalProSymbol.Scatter)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)LanternFestivalProSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } break; case (int)GameIdEnum.BikiniBeach: for (int i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)BikiniBeachSymbol.Hammock)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)BikiniBeachSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } break; case (int)GameIdEnum.Baseball: for (int i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)BaseballSymbol.Scoreboard)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)BaseballSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } break; case (int)GameIdEnum.MonkeyKing: for (int i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)MonkeyKingSymbol.Monk)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)MonkeyKingSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } break; case (int)GameIdEnum.TrickOrTreat: if (BonusXml.Data.Element("mode") != null && Convert.ToInt32(BonusXml.Data.Element("mode").Value) != 2) { break; } for (int i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)TrickOrTreatSymbol.Wild)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)TrickOrTreatSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } break; case (int)GameIdEnum.WuxiaPrincessMegaReels: { UpdateWheelViewModelSymbols(SpinXml.Wheel.Width, SpinXml.Wheel.Height, SpinXml.Wheel.Rows, Wheel, SymbolReplacement[history.GameId]); break; } case (int)GameIdEnum.HulaGirl: { UpdateWheelViewModelSymbols(SpinXml.Wheel.Width, SpinXml.Wheel.Height, Wheel, SymbolReplacement[history.GameId]); break; } case (int)GameIdEnum.GeniesLuck: { var node = BonusXml.Data.Descendants().FirstOrDefault(n => n.Name == "mode"); if (node?.Value == "2") { GameResultType = GameResultType.RespinResult; } UpdateWheelViewModelSymbols(SpinXml.Wheel.Width, SpinXml.Wheel.Height, SpinXml.Wheel.Rows, Wheel, SymbolReplacement[history.GameId], history.GameId); break; } } WinTable = GetWinTable((GameIdEnum)history.GameId, PayLine, SpinXml); WinTable = GetWinTable((GameIdEnum)history.GameId, PayLine, SpinXml); CreateReelSetsVM(history); }
private void UpdateWheelViewModelSymbols(int wheelWidth, int wheelHeight, List <int> rows, WheelViewModel wheel, Dictionary <GameHistorySymbol, GameHistorySymbol> symbolReplacement, int gameId = 0) { for (var reel = 0; reel < wheelWidth; reel++) { if (gameId == (int)GameIdEnum.GeniesLuck) { if (reel != 0 && reel != (wheelWidth - 1)) { continue; } } var reelHeight = (rows?.Any() ?? false) ? rows[reel] : wheelHeight; var symbols = wheel.reels[reel].Select(s => s.symbol).ToList(); foreach (var sr in symbolReplacement) { var findSym = sr.Key; var replSym = sr.Value; for (var row = (findSym.RowPosition > -1 ? findSym.RowPosition : 0); row < (findSym.RowPosition > -1 ? findSym.RowPosition + 1 : reelHeight); row++) { if (findSym.Symbol != symbols[row]) { continue; } if (findSym.Height > (reelHeight - row)) { continue; } if (findSym.Height > 1 && !symbols.GetRange(row, findSym.Height).TrueForAll(s => s == findSym.Symbol)) { continue; } if (replSym.Height > (reelHeight - row)) { continue; } wheel.reels[reel][row] = new Symbols() { symbol = replSym.Symbol, height = replSym.Height }; if (replSym.Height == 1) { continue; } for (var i = (row + 1); i < (row + replSym.Height); i++) { wheel.reels[reel][i] = new Symbols() { symbol = -1, height = 0 }; } row += (replSym.Height - 1); } } } }
private void DisplaySpinHistory(GameHistory history) { var xmlHelper = new XmlHelper(); var xml = xmlHelper.Deserialize <SpinXml>(history.HistoryXml); SpinXml = xml; Wheel = new WheelViewModel(); Wheel.reels = new List <List <Symbols> >(); var wheel = SpinXml.Wheel; for (var c = 0; c < wheel.Reels.Count; c++) { Wheel.reels.Add(new List <Symbols>()); for (var r = 0; r < wheel.Reels[c].Count; r++) { var symbols = new Symbols { symbol = wheel.Reels[c][r], height = 1, width = 1 }; Wheel.reels[c].Add(symbols); } if (!(wheel.Rows?.Any() ?? false)) { continue; } for (var r = wheel.Rows[c]; r < wheel.Height; r++) { var symbols = new Symbols(true) { symbol = -1, height = 1 }; Wheel.reels[c].Add(symbols); } } switch (history.GameId) { case (int)GameIdEnum.ForbiddenChamber: case (int)GameIdEnum.WorldOfWarlords: if (Wheel.reels[2].Any(s => s.symbol == (int)ForbiddenChamberSymbol.Wild)) { Wheel.reels[2] = new List <Symbols>() { new Symbols { symbol = (int)ForbiddenChamberSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 }, }; } break; case (int)GameIdEnum.DesertOasis: for (int i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)DesertOasisSymbol.Camel)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)DesertOasisSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } break; case (int)GameIdEnum.SevenWonders: case (int)GameIdEnum.FortuneKoi: case (int)GameIdEnum.FloraSecret: for (int i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)SevenWondersSymbol.Wild)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)SevenWondersSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } break; case (int)GameIdEnum.CasinoRoyale: case (int)GameIdEnum.CasinoRoyalePro: case (int)GameIdEnum.RomanEmpire: { for (int i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)CasinoRoyaleSymbol.Joker)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)CasinoRoyaleSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } } break; case (int)GameIdEnum.FortuneDice: EditSymbolWithOverprintSymbols(); break; case (int)GameIdEnum.FourGuardians: case (int)GameIdEnum.StripNRoll: //TODO : later will be use DI new FourGuardianExpanding().Expanding(Wheel); break; case (int)GameIdEnum.LuckyRoyale: new LuckyRoyaleExpanding().Expanding(Wheel); break; case (int)GameIdEnum.FuLuShou: new FuLuShouExpandingWild().Expanding(Wheel); break; case (int)GameIdEnum.SkyStrikers: { var mode = SpinXml.BonusWheel != null ? SpinXml.BonusWheel.Mode : 0; if (mode > 0) { var wildPos = WildPositions[history.GameId][mode]; foreach (var wp in wildPos) { var reel = wp / SpinXml.Wheel.Height; var row = wp % SpinXml.Wheel.Height; Wheel.reels[reel][row] = new Symbols { symbol = (int)SkyStrikersSymbol.SpecialWild, height = 1 }; } } break; } case (int)GameIdEnum.TrickOrTreat: { if (Wheel.reels[2].Any(s => s.symbol == (int)TrickOrTreatSymbol.Wild)) { Wheel.reels[2] = new List <Symbols>() { new Symbols { symbol = (int)TrickOrTreatSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } break; } case (int)GameIdEnum.TokyoHunter: { for (var i = 0; i < Wheel.reels.Count; i++) { if (Wheel.reels[i].Any(s => s.symbol == (int)TokyoHunterSymbol.Wild)) { Wheel.reels[i] = new List <Symbols>() { new Symbols { symbol = (int)TokyoHunterSymbol.RExpandingWild, height = 3 }, new Symbols { symbol = -1, height = 1 }, new Symbols { symbol = -1, height = 1 } }; } } break; } case (int)GameIdEnum.LionDance: { SpinXml.SpinBet.Lines = 27; break; } case (int)GameIdEnum.WuxiaPrincessMegaReels: { UpdateWheelViewModelSymbols(SpinXml.Wheel.Width, SpinXml.Wheel.Height, SpinXml.Wheel.Rows, Wheel, SymbolReplacement[history.GameId]); break; } case (int)GameIdEnum.HulaGirl: { UpdateWheelViewModelSymbols(SpinXml.Wheel.Width, SpinXml.Wheel.Height, Wheel, SymbolReplacement[history.GameId]); break; } case (int)GameIdEnum.GeniesLuck: { UpdateWheelViewModelSymbols(SpinXml.Wheel.Width, SpinXml.Wheel.Height, SpinXml.Wheel.Rows, Wheel, SymbolReplacement[history.GameId], history.GameId); break; } } PayLine = paylineRepository.Get((GameIdEnum)history.GameId).Lines; WinTable = GetWinTable((GameIdEnum)history.GameId, PayLine, xml); RespunReel = xml.RespunReel; CreateReelSetsVM(history); }