Esempio n. 1
0
        public StringBuilder getStatisticsOutput(int iTotalBetAmount)
        {
            StringBuilder sBuilder = new StringBuilder();

            sBuilder.AppendLine("Slot id: " + m_iSlotId);
            sBuilder.AppendLine("Total win amount: " + m_iTotalWinAmount);
            sBuilder.AppendLine("Total spin count: " + m_iPlaySpinCount);

            decimal percentage = Decimal.Divide(m_iTotalWinAmount, iTotalBetAmount);

            sBuilder.AppendLine("Percent Returns: " + percentage.ToString());
            sBuilder.AppendLine("Slot Reels:");
            string sSlotReel = "";

            for (int i = 0; i < m_ReelStripList.Count; i++)
            {
                //if (i != 0)
                sSlotReel = "";
                for (int j = 0; j < m_ReelStripList[i].Length; j++)
                {
                    if (j != 0)
                    {
                        sSlotReel += " ";
                    }
                    sSlotReel += m_ReelStripList[i][j].ToString();
                }
                sBuilder.AppendLine(sSlotReel);
            }
            //sBuilder.AppendLine("Slot Reels:");
            //sBuilder.AppendLine(sSlotReel);

            sBuilder.AppendLine("Winlines");
            sBuilder.AppendLine("__________________________________________________________________________________________________");
            for (int i = 0; i < m_WinLineFoundCount.Count; i++)
            {
                sBuilder.AppendLine("Winline: " + i + "count: " + m_WinLineFoundCount[i]);
            }

            sBuilder.AppendLine("Symbol Counts by Reel");
            sBuilder.AppendLine("SymbolId Reel1 Reel2 Reel3 Reel4 Reel5");
            List <Symbol> allSymbols = m_Paytable.GetAllSymbols();

            for (int i = 0; i < m_WildSymbolsID.Count; i++)
            {
                string sReportSymbol = m_WildSymbolsID[i].ToString() + ": ";
                for (int j = 0; j < m_ReelStripList.Count; j++)
                {
                    int iCount = 0;
                    for (int k = 0; k < m_ReelStripList[j].Length; k++)
                    {
                        if (m_ReelStripList[j][k] == m_WildSymbolsID[i])
                        {
                            iCount++;
                        }
                    }
                    sReportSymbol += " " + iCount.ToString();
                }
                sBuilder.AppendLine(sReportSymbol);
            }

            for (int i = 0; i < m_TriggerSymbols.Count; i++)
            {
                string sReportSymbol = m_TriggerSymbols[i].iSymbolId.ToString() + ": ";
                for (int j = 0; j < m_ReelStripList.Count; j++)
                {
                    int iCount = 0;
                    for (int k = 0; k < m_ReelStripList[j].Length; k++)
                    {
                        if (m_ReelStripList[j][k] == m_TriggerSymbols[i].iSymbolId)
                        {
                            iCount++;
                        }
                    }
                    sReportSymbol += " " + iCount.ToString();
                }
                sBuilder.AppendLine(sReportSymbol);
            }

            for (int i = 0; i < allSymbols.Count; i++)
            {
                int    iSymbolId     = allSymbols[i].SymbolId;
                string sReportSymbol = iSymbolId.ToString() + ": ";
                for (int j = 0; j < m_ReelStripList.Count; j++)
                {
                    int iCount = 0;
                    for (int k = 0; k < m_ReelStripList[j].Length; k++)
                    {
                        if (m_ReelStripList[j][k] == iSymbolId)
                        {
                            iCount++;
                        }
                    }
                    sReportSymbol += " " + iCount.ToString();
                }
                sBuilder.AppendLine(sReportSymbol);
            }

            sBuilder.AppendLine("Symbols");
            sBuilder.AppendLine("__________________________________________________________________________________________________");
            for (int i = 0; i < m_SymbolStats.Count; i++)
            {
                string symbolWincount = "";
                foreach (KeyValuePair <int, int> entry in m_SymbolStats[i].numofSymCountList)//for(int j = 0; j < m_SymbolStats[i].numofSymCountList.Count; j++)
                {
                    symbolWincount += " numOfSym:" + entry.Key + " wincount:" + entry.Value;
                }
                sBuilder.AppendLine("id: " + m_SymbolStats[i].iSymbolid + symbolWincount + " Total win amount: " + m_SymbolStats[i].iTotalWinAmount);
            }

            if (m_SlotFeatures != null)
            {
                for (int i = 0; i < m_SlotFeatures.Count; i++)
                {
                    sBuilder.AppendLine(m_SlotFeatures[i].getStatisticsOutput(iTotalBetAmount).ToString());
                }
            }

            sBuilder.AppendLine(m_Paytable.getStatisticsOutput().ToString());

            return(sBuilder);
        }
Esempio n. 2
0
        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);
        }