public virtual void RecoverFreeSpin(Dictionary <string, string> dataList, int iBetAmount = 0) { m_Stage = STAGE.STAGE_FREESPIN; int id = int.Parse(dataList["SLOTID"]); SlotReel FreespinReel = m_SlotReels[id]; if (dataList.ContainsKey("FGRS") && !string.IsNullOrEmpty(dataList["FGRS"].Trim())) { m_SpinResult = m_SlotReels[0].PlayGame(iBetAmount); int[] reelstops = StringUtility.StringToIntArray(dataList["FGRS"], ' '); FreespinReel.Recover(reelstops, iBetAmount); int iCurrentSpin = int.Parse(dataList["CURRENTSPIN"]); int iFSTotalWin = int.Parse(dataList["FSTOTALWIN"]); int iTotalSpin = int.Parse(dataList["TOTALSPIN"]); m_SpinResult.ClearTiggerLine(); m_SpinResult.ReadyForSpin = true; m_SpinResult.setBonusId(0, 0, 0); m_SpinResult.FreePlay = true; m_SpinResult.BaseWinAmount = int.Parse(dataList["BGWINAMOUNT"]); FreespinReel.RestoreFreeSpinProperties(iCurrentSpin, iTotalSpin, iFSTotalWin); m_SpinResult.FreeSpinProp = FreespinReel.getFreeSpinProperties(); } else { m_bRecover = true; int[] reelstops = StringUtility.StringToIntArray(dataList["BGRS"], ' '); m_SlotReels[0].Recover(reelstops, iBetAmount); m_Stage = STAGE.STAGE_IDLE; } }
public void LoadXML(XmlNode node) { XmlAttributeCollection attributes = node.Attributes; m_PayoutList = new Dictionary <int, int>(); m_iSymbolID = int.Parse(attributes["id"].Value); string sPayout = attributes["payout"].Value; int[] ipayout = StringUtility.StringToIntArray(sPayout, ' '); string sCount = attributes["count"].Value; int[] iCount = StringUtility.StringToIntArray(sCount, ' '); for (int i = 0; i < iCount.Length; i++) { m_PayoutList.Add(iCount[i], ipayout[i]); } }
public bool CreateWinningLines(XmlNode node) { XmlAttribute numberList = node.Attributes["list"]; XmlNodeList childNodes = node.ChildNodes; for (int i = 0; i < childNodes.Count; i++) { if (childNodes[i].Name == "WINNING_LINE") { numberList = childNodes[i].Attributes["pos"]; int[] reelStrip = StringUtility.StringToIntArray(numberList.Value, ' '); m_WinningLines.Add(new int[reelStrip.Length]); Array.Copy(reelStrip, m_WinningLines[m_WinningLines.Count - 1], reelStrip.Length); } } if (m_WinningLines.Count == 0) { return(false); } return(true); }
public void SetForceSpin(string sForceSpin, bool bSimulator = false) { if (sForceSpin != "" && !bSimulator) { XmlDocument doc = new XmlDocument(); doc.LoadXml(sForceSpin); XmlNode playNode = doc.SelectSingleNode("PLAY"); string sReelStops = playNode.Attributes["RS"].Value; int[] forcestops = StringUtility.StringToIntArray(sReelStops, ' '); SlotEngine.Log("Game Engine: SlotReel::SetForceSpin() - " + "reel stops: " + sReelStops); if (forcestops.Length != 0) { for (int i = 0; i < m_iReelStops.Count; i++) { m_iReelStops[i] = forcestops[i]; setReelStopIndex(m_iReelStops[i], i); } m_bForceSpin = true; } } else if (sForceSpin != "" && bSimulator) { int[] forcestops = StringUtility.StringToIntArray(sForceSpin, ' '); SlotEngine.Log("Game Engine: SlotReel::SetForceSpin() - " + "reel stops: " + sForceSpin); if (forcestops.Length != 0) { for (int i = 0; i < m_iReelStops.Count; i++) { m_iReelStops[i] = forcestops[i]; setReelStopIndex(m_iReelStops[i], i); } m_bForceSpin = true; } } }
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 bool LoadXML(XmlNode node) { XmlNodeList childNodes = node.ChildNodes; m_SlotColumns = new List <int[]>(); m_WildSymbolsID = new List <int>(); m_WinningLines = new List <int[]>(); int iNumOfColumns = int.Parse(node.Attributes["col"].Value); int iNumOfRows = int.Parse(node.Attributes["row"].Value); m_iSlotId = int.Parse(node.Attributes["id"].Value); m_iExtraWilds = new List <int>(); int iNumOfPositions = iNumOfColumns * iNumOfRows; for (int i = 0; i < iNumOfPositions; i++) { m_iExtraWilds.Add(0); } if (bool.Parse(node.Attributes["freespin"].Value) == true) { m_FreeSpinProperties = new FreeSpinProperties(); m_FreeSpinProperties.FreeSpinsTotal = node.Attributes["freespincount"] != null?int.Parse(node.Attributes["freespincount"].Value) : 0; m_FreeSpinStopsTickets = new List <string>(); } for (int count = 0; count < iNumOfColumns; count++) { m_SlotColumns.Add(new int[iNumOfRows]); m_iReelStops = new List <int>();//new int[iNumOfColumns]; for (int i = 0; i < iNumOfColumns; i++) { m_iReelStops.Add(0); } } for (int i = 0; i < childNodes.Count; i++) { switch (childNodes[i].Name) { case "REELS": { m_ReelStripList = new List <int[]>(); if (!CreateReelStips(childNodes[i])) { return(false); } } break; case "WINNING_LINES": { if (!m_bWayPay) { m_WinningLines = new List <int[]>(); if (!CreateWinningLines(childNodes[i])) { return(false); } m_Winlines = new Winlines(); m_Winlines.CreateWinLines(m_WinningLines); m_Winlines.BuildTree(); } } break; case "PAYTABLE": { m_Paytable = new Paytable(childNodes[i]); } break; case "WILDS": { int[] wildList = StringUtility.StringToIntArray(childNodes[i].Attributes["id"].Value, ' '); for (int wildcount = 0; wildcount < wildList.Length; wildcount++) { m_WildSymbolsID.Add(wildList[wildcount]); } } break; case "TRIGGER": { TriggerSymbol triggerSym = new TriggerSymbol(); if (childNodes[i].Attributes["triggertype"] != null) { if (childNodes[i].Attributes["triggertype"].Value == "slotfeature") { triggerSym.triggerType = TriggerSymbol.TYPE.SLOT_FEATURE; } else { triggerSym.triggerType = TriggerSymbol.TYPE.BONUS; } } else { triggerSym.triggerType = TriggerSymbol.TYPE.BONUS; } triggerSym.iSymbolId = int.Parse(childNodes[i].Attributes["symbolid"].Value); triggerSym.iNumOfSymbols = int.Parse(childNodes[i].Attributes["numofsymbol"].Value); if (childNodes[i].Attributes["bonusgame"] != null) { triggerSym.iBonusId = int.Parse(childNodes[i].Attributes["bonusgame"].Value); } if (childNodes[i].Attributes["slotfeature"] != null) { triggerSym.iBonusId = int.Parse(childNodes[i].Attributes["slotfeature"].Value); } m_TriggerSymbols.Add(triggerSym); } break; case "SCATTER": { ScatterSymbol scatterSym = new ScatterSymbol(); scatterSym.iSymbolId = int.Parse(childNodes[i].Attributes["symbolid"].Value); scatterSym.iNumOfSymbols = int.Parse(childNodes[i].Attributes["numofsymbol"].Value); scatterSym.iCredits = int.Parse(childNodes[i].Attributes["extracredits"].Value); scatterSym.iMultiplier = int.Parse(childNodes[i].Attributes["multiplier"].Value); m_ScatterSymbols.Add(scatterSym); } break; } } #if _SIMULATOR List <Symbol> AllSymbols = m_Paytable.GetAllSymbols(); for (int i = 0; i < AllSymbols.Count; i++) { SymbolStatistics symStat = new SymbolStatistics(); symStat.numofSymCountList = new Dictionary <int, int>(); symStat.iSymbolid = AllSymbols[i].SymbolId; symStat.symbolCount = 0; symStat.iTotalWinAmount = 0; Dictionary <int, int> symbolPaytable = AllSymbols[i].getPayoutList(); foreach (KeyValuePair <int, int> entry in symbolPaytable) { symStat.numofSymCountList.Add(entry.Key, 0); } m_SymbolStats.Add(symStat); } for (int i = 0; i < m_WinningLines.Count; i++) { m_WinLineFoundCount.Add(0); } for (int i = 0; i < m_ScatterSymbols.Count; i++) { if (StatsContainSymbol(m_ScatterSymbols[i].iSymbolId)) { SymbolStatistics stat = getSymbolStat(m_ScatterSymbols[i].iSymbolId); stat.numofSymCountList.Add(m_ScatterSymbols[i].iNumOfSymbols, 0); } else { SymbolStatistics symStat = new SymbolStatistics(); symStat.numofSymCountList = new Dictionary <int, int>(); symStat.iSymbolid = m_ScatterSymbols[i].iSymbolId; symStat.symbolCount = 0; symStat.iTotalWinAmount = 0; symStat.numofSymCountList.Add(m_ScatterSymbols[i].iNumOfSymbols, 0); m_SymbolStats.Add(symStat); } } #endif return(true); }
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); } } }