public string getBaseDefaultReelStops() { SpinResult result = m_CurrentSlotReel.PlayGame(); while (result.getWinAmount() != 0) { result = m_CurrentSlotReel.PlayGame(); } string sReels = ""; int[] reels = result.getReelStops(); for (int i = 0; i < reels.Length; i++) { if (i != 0) { sReels += " "; } sReels += reels[i]; } return(sReels); }
public SpinResult PlayTicket(int[] reelStops, int betAmount = 1, bool bFreeSpin = false) { if (!bFreeSpin) { try { for (int i = 0; i < m_iReelStops.Count; i++) { m_iReelStops[i] = reelStops[i]; setReelStopIndex(m_iReelStops[i], i); } } catch (Exception e) { SlotEngine.ThrowError("GAME ENGINE ERROR!"); SlotEngine.Log("GAME ENGINE reel stops. SlotReel::PlayTicket() - " + e.Message); } int getAmount = Evaluate(betAmount, bFreeSpin); EvaluateScatterSymbols(); List <ScatterSymbol> scatterWins = m_SpinResult.getScatterWins(); if (!m_bWayPay) { List <WinLine> winLines = m_Winlines.getWinLines(); for (int i = 0; i < scatterWins.Count; i++) { if (scatterWins[i].iCredits != 0) { getAmount += scatterWins[i].iCredits * betAmount; WinLine wLine = new WinLine(-1, scatterWins[i].iSymbolId, scatterWins[i].iNumOfSymbols, scatterWins[i].iCredits * betAmount, null); winLines.Add(wLine); } } m_SpinResult.setResult(getAmount, /*m_Winlines.getWinLines()*/ winLines, m_iReelStops); } EvaluateTriggerLines(); } if (bFreeSpin) { int[] FSreelStops = StringUtility.StringToIntArray(m_FreeSpinStopsTickets[m_FreeSpinProperties.CurrentFreeSpin], ' '); try { for (int i = 0; i < m_iReelStops.Count; i++) { m_iReelStops[i] = FSreelStops[i]; setReelStopIndex(m_iReelStops[i], i); } } catch (Exception e) { SlotEngine.ThrowError("GAME ENGINE ERROR!"); SlotEngine.Log("GAME ENGINE FS reel stops. SlotReel::PlayTicket() - " + e.Message); } int getAmount = Evaluate(betAmount, bFreeSpin); EvaluateTriggerLines(); m_FreeSpinProperties.CurrentFreeSpin++; m_FreeSpinProperties.WinAmount += m_SpinResult.getWinAmount(); m_SpinResult.FreeSpinProp = m_FreeSpinProperties; if (m_FreeSpinProperties.CurrentFreeSpin == m_FreeSpinProperties.FreeSpinsTotal) { m_SpinResult.FreePlay = false; } else { m_SpinResult.FreePlay = true; } } return(m_SpinResult); }
public void Recover(Dictionary <string, string> dataList, string sTicket = "", int iBetAmount = 0) { if (dataList.ContainsKey("ENGINESTAGE")) { m_Stage = (STAGE)Enum.Parse(typeof(STAGE), dataList["ENGINESTAGE"]); } if (dataList.ContainsKey("BGRS")) { int[] reelstops = StringUtility.StringToIntArray(dataList["BGRS"], ' '); m_SlotReels[0].Recover(reelstops, iBetAmount); m_SpinResult = m_SlotReels[0].PlayGame(iBetAmount); //NEW m_SpinResult.BaseWinAmount = m_SpinResult.getWinAmount(); } m_iBetLevel = iBetAmount; for (int i = 0; i < m_SlotReels.Count; i++) { m_SlotReels[i].SetSlotFeatureBetLevel(m_iBetLevel); } if (m_Stage == STAGE.STAGE_STARTGAME) { m_bRecover = true; int[] reelstops = StringUtility.StringToIntArray(dataList["BGRS"], ' '); m_SlotReels[0].Recover(reelstops, iBetAmount); m_Stage = STAGE.STAGE_IDLE; } if (m_Stage == STAGE.STAGE_FREESPIN) { RecoverFreeSpin(dataList); } else if (m_Stage == STAGE.STAGE_BONUS) { bool bBonusStarted = false; if (dataList.ContainsKey("BONUSSTARTED")) { bBonusStarted = bool.Parse(dataList["BONUSSTARTED"]); } if (bBonusStarted) { m_SpinResult.BaseWinAmount = int.Parse(dataList["BGWINAMOUNT"]); //m_iBaseWinAmount = m_SpinResult.BaseWinAmount; m_Stage = STAGE.STAGE_BONUS; RecoverBonusSpin(dataList, iBetAmount); } else { m_bRecover = true; m_Stage = STAGE.STAGE_BONUS; RecoverBonusSpin(dataList, iBetAmount); int[] reelstops = StringUtility.StringToIntArray(dataList["BGRS"], ' '); m_SlotReels[0].Recover(reelstops, iBetAmount); m_Stage = STAGE.STAGE_IDLE; } } else if (m_Stage == STAGE.STAGE_SLOTFEATURE) { m_SpinResult.BaseWinAmount = m_SpinResult.getWinAmount(); //m_iBaseWinAmount = m_SpinResult.BaseWinAmount; } if (m_Stage == STAGE.STAGE_IDLE && dataList.ContainsKey("ENGINEBONUSID")) { if (dataList.ContainsKey("BONUSSTARTED") && bool.Parse(dataList["BONUSSTARTED"])) { RecoverBonusSpin(dataList, iBetAmount); } } }
public virtual void PlayGameSimulator(int betAmount = 1) { m_iBetLevel = 1; if (m_Stage == STAGE.STAGE_IDLE || m_Stage == STAGE.STAGE_IDLE) { //m_FSReelStops.Clear(); m_SpinResult.ClearTiggerLine(); m_TriggeredSlotFeatures.Clear(); m_SpinResult.ResetFlags(); if (m_sForceStop != "" && m_bForceSpin) { try { m_CurrentSlotReel.SetForceSpin(m_sForceStop, true); } catch (Exception e) { ThrowError("GAME ENGINE ERROR! Force Ticket "); Log("GameEngine Error! SlotEngine::PlayThread() - Parse ticket error " + e.Message); } } else if (m_sFSForceStop != "" && m_bFSForceSpin) { try { m_CurrentSlotReel.SetForceSpin(m_sFSForceStop, true); } catch (Exception e) { ThrowError("GAME ENGINE ERROR! Force Ticket "); Log("GameEngine Error! SlotEngine::PlayThread() - Parse ticket error " + e.Message); } } m_SpinResult = m_CurrentSlotReel.PlayGame(betAmount); int[] spinResults = m_SpinResult.getReelStops(); m_Stage = STAGE.STAGE_STARTGAME; m_SpinResult.BaseWinAmount = m_SpinResult.getWinAmount(); // m_iBaseWinAmount = m_SpinResult.BaseWinAmount; m_Stage = STAGE.STAGE_IDLE; if (!m_SpinResult.FreePlay) { m_Stage = STAGE.STAGE_IDLE; m_SpinResult.FreePlay = false; } else { m_Stage = STAGE.STAGE_FREESPIN; } m_SpinResult.ReadyForSpin = true; PlaySlotFeatures(); PlayBonusGame(); GameResults(m_SpinResult); #if _SIMULATOR m_CurrentSlotReel.CollectStatistics(); //NEED TO RECHECK THIS #endif } /* else if (m_Stage == STAGE.STAGE_FREESPIN) * { * m_SpinResult = m_FreespinSlot.PlayGame((int)betAmount, true); * List<int> reelStops = new List<int>(); * * if (!m_SpinResult.FreePlay) * { * m_Stage = STAGE.STAGE_IDLE; * m_SpinResult.FreePlay = false; * } * m_SpinResult.ReadyForSpin = true; * GameResults(m_SpinResult); * }*/ }
/* public virtual void ParseTicket(string sTicket) * { * XmlDocument doc = new XmlDocument(); * doc.LoadXml(sTicket); * XmlNode playNode = doc.SelectSingleNode("PLAY"); * string sReelStops = playNode.Attributes["RS"].Value; * int[] reelStops = StringUtility.StringToIntArray(sReelStops, ' '); * m_iTotalWinAmount = int.Parse(playNode.Attributes["TotalWin"].Value) * m_iBetLevel; * * m_SpinResult = m_BaseSlot.PlayTicket(reelStops, m_iBetLevel); * for (int i = 0; i < playNode.ChildNodes.Count; i++) * { * XmlNode childNode = playNode.ChildNodes[i]; * if (childNode.Name == "BONUS") * { * int iBonusId = int.Parse(childNode.Attributes["Type"].Value); * Bonus bonusTicket = m_BonusList[iBonusId]; * bonusTicket.setBetLevel(m_iBetLevel); * bonusTicket.InitTicket(childNode); * } * else if (childNode.Name == "FREESPINS") * { * m_FreespinSlot.InitFreeStopsTickets(childNode); * } * } * }*/ public virtual void PlayThread(object betAmount) { //m_Stage = STAGE.STAGE_STARTGAME; m_TriggeredSlotFeatures.Clear(); m_SpinResult.ResetFlags(); m_CurrentSlotReel.ResetFlags(); m_iBetLevel = (int)betAmount; /* if (m_ePlayType == ePlayType.PullTab || m_ePlayType == ePlayType.Bingo) * { * try * { * ParseTicket(m_sTicket); * } * catch (Exception e) * { * ThrowError("GAME ENGINE ERROR! Parse Ticket "); * Log("GameEngine Error! SlotEngine::PlayThread() - Parse ticket error " + e.Message); * } * }*/ if (m_ePlayType == ePlayType.Local) { Log("GameEngine Error! IGameEngine::PlayGame() - Inside play thread "); if (!string.IsNullOrEmpty(m_sTicket)) { try { m_CurrentSlotReel.SetForceSpin(m_sTicket); } catch (Exception e) { ThrowError("GAME ENGINE ERROR! Force Ticket "); Log("GameEngine Error! SlotEngine::PlayThread() - Parse ticket error " + e.Message); } } try { Log("GameEngine Error! IGameEngine::PlayThread() - Call PlayGame "); m_SpinResult = m_CurrentSlotReel.PlayGame((int)betAmount, m_Stage == STAGE.STAGE_FREESPIN ? true : false); } catch (Exception e) { ThrowError("GameEngine ERROR! slot reel play game: " + e.Message); } try { string sReelStops = ""; int[] reelStops = m_SpinResult.getReelStops(); for (int i = 0; i < reelStops.Length; i++) { if (i != 0) { sReelStops += " "; } sReelStops += reelStops[i].ToString(); } setRecoveryData("BGRS", sReelStops); setRecoveryData("ENGINESTAGE", m_Stage.ToString()); } catch (Exception e) { ThrowError("GameEngine ERROR! slot reel play game: " + e.Message); Log("Game Engine Error! " + e.Message + " " + e.StackTrace); } } try { m_SpinResult.BaseWinAmount = m_SpinResult.getWinAmount(); setRecoveryData("BGWINAMOUNT", m_SpinResult.BaseWinAmount.ToString()); // m_iBaseWinAmount = m_SpinResult.BaseWinAmount; //m_Stage = STAGE.STAGE_IDLE; //m_SpinResult.ReadyForSpin = true; //m_SpinResult.FreePlay = false; } catch (Exception e) { ThrowError("GameEngine ERROR! BGWINAMOUNT: " + e.Message); Log("Game Engine Error! " + e.Message + " " + e.StackTrace); } try { PlaySlotFeatures(); } catch (Exception e) { ThrowError("GameEngine ERROR! In feature"); Log("SlotEngine::PlayThread() - Error!! " + e.Message); } Log("GameEngine Error! IGameEngine::PlayThread() - Sending results "); GameResults(m_SpinResult); //GC.Collect(); #if _SIMULATOR m_CurrentSlotReel.CollectStatistics(); //NEED TO RECHECK THIS #endif if (m_BaseThread != null && m_BaseThread.IsAlive) { m_BaseThread.Join(); } }