Example #1
0
 public InternalTimer(KenoBoard Keno, Mobile From, KenoBoard.PlayerInfo player, bool played, int PayTable, float[] PayOutTable, int CPayMethod, byte QuickPickCount, bool PickButtons, byte[] Selected, byte TotalSelected, byte[] MachinePicks, TimeSpan delay)
     : base(delay)
 {
     //Priority = TimerPriority.OneSecond;
     Priority = TimerPriority.TwoFiftyMS;
     m_Keno = Keno;
     m_From = From;
     m_player = player;
     m_played = played;
     m_PayTable = PayTable;
     m_PayOutTable = PayOutTable;
     m_CPayMethod = CPayMethod;
     m_QuickPickCount = QuickPickCount;
     m_PickButtons = PickButtons;
     m_Selected = Selected;
     m_TotalSelected = TotalSelected;
     m_MachinePicks = MachinePicks;
 }
Example #2
0
        public KenoGump(KenoBoard Keno, Mobile From, KenoBoard.PlayerInfo player, bool played, int PayTable, float[] PayOutTable, int CPayMethod, byte QuickPickCount, bool PickButtons, byte[] Selected, byte TotalSelected, byte[] MachinePicks)
            : base(400, 263)
        {
            m_Keno = Keno;
            m_Selected = Selected;
            m_TotalSelected = TotalSelected;
            m_MachinePicks = MachinePicks;
            m_PickButtons = PickButtons;
            m_PayTable = (PayMethod)PayTable;
            m_QuickPickCount = QuickPickCount;
            m_CPayMethod = (PayMethod)CPayMethod;
            m_PayOutTable = PayOutTable;
            m_Player = player;
            m_From = From;

            Closable = true;
            Disposable = true;
            Dragable = true;
            Resizable = false;
            AddPage(0);
            AddBackground(0, 0, 650, 340, 9250);
            string text = String.Format("Cost: {0}", player.Cost);
            AddLabel(380, 15, 2213, text);
            AddButton(440, 15, 0x983, 0x984, 101, GumpButtonType.Reply, 0);
            AddButton(440, 25, 0x985, 0x986, 102, GumpButtonType.Reply, 0);
            AddLabel(227 - ((m_Keno.Name.Length/2) * 7), 10, (m_Keno.Hue == 907 ? 0 : m_Keno.Hue - 1), m_Keno.Name);
            AddLabel(475, 25, 1149, "Number Selection Method");
            AddLabel(485, 50, 1149, "Special:");
            AddLabel(485, 75, 1149, "Standard");
            AddLabel(485, 100, 1149, "Quick Pick");
            AddLabel(485, 166, 1149, "Total Matched:");
            AddLabel(460, 210, 1149, "Credits:");
            AddLabel(460, 230, 1149, "Last Pay:");
            if (player.mobile.AccessLevel >= AccessLevel.GameMaster)
            {
                int paybackhue = 66;
                if (m_Keno.WinningPercentage > 95.0)
                {
                    paybackhue = 37;
                }
                AddLabel(475, 185, 1152, "Payout Percentage:");
                text = String.Format("{0:##0.00%}", m_Keno.WinningPercentage/100);
                AddLabel(590, 185, paybackhue, text);
            }
            AddImageTiled(15, 175, 455, 4, 2624);
            AddImageTiled(450, 30, 3, 290, 2624);
            int numberx = 20;
            int numbery = 35;
            int bottomhalf = 0;
            int totalhit = 0;
            int tophalf = 0;
            AddButton(460, 50, ((m_PayTable >= PayMethod.BottomHalf && m_PayTable <= PayMethod.Millionare10) ? 0xD3 : 0xD2), ((m_PayTable >= PayMethod.BottomHalf && m_PayTable <= PayMethod.Edges) ? 0xD2 : 0xD3), 4000, GumpButtonType.Reply, 0);
            AddButton(460, 75, (m_PayTable == PayMethod.Standard ? 0xD3 : 0xD2), (m_PayTable == PayMethod.Standard ? 0xD2 : 0xD3), 4001, GumpButtonType.Reply, 0);
            AddButton(460, 100, (m_PayTable == PayMethod.QuickPick ? 0xD3 : 0xD2), (m_PayTable == PayMethod.QuickPick ? 0xD2 : 0xD3), 4002, GumpButtonType.Reply, 0);
            AddButton(460, 125, 4026, 4027, 520, GumpButtonType.Reply, 0);
            AddLabel(495, 125, 1149, @"View Pay Table");

            AddButton(460, 265, 4020, 4021, 200, GumpButtonType.Reply, 0);
            /*if (m_Keno.FreeSpin)
                AddLabel(65, 307, 1149, @"Free");
            else */
                AddLabel(495, 265, 1149, @"Play");
            AddButton(540, 265, 4029, 4030, 201, GumpButtonType.Reply, 0); //CASHOUT
            AddLabel(575, 265, 1149, @"Cash Out");
            AddButton(457, 290, 4037, 4036, 202, GumpButtonType.Reply, 0); //ATM
            AddLabel(495, 299, 1149, @"ATM");

            if (player.mobile.AccessLevel >= AccessLevel.GameMaster) 
            {
                AddButton(540, 295, 0xFAB, 0xFAD, 999, GumpButtonType.Reply, 0); //Props
                AddLabel(575, 295, 0x384, @"Props");
            }
            if (m_PayTable == PayMethod.Standard)
            {           
                text = String.Format("Min: {0}", m_MinPicks);
                AddLabel(585, 68, 1149, text);
                text = String.Format("Max: {0}", m_MaxPicks);
                AddLabel(585, 83, 1149, text);
                text = String.Format(": {0}", m_TotalSelected);
                AddLabel(537, 75, 1149, text);
                DisplaySpecial(m_CPayMethod);  
            }
            else if (m_PayTable == PayMethod.QuickPick)
            {
                AddButton(565, 100, 0x983, 0x984, 501, GumpButtonType.Reply, 0);
                AddButton(565, 110, 0x985, 0x986, 502, GumpButtonType.Reply, 0);
                AddLabel(550, 100, 1149, m_QuickPickCount.ToString());
                DisplaySpecial(m_CPayMethod);  
            }
            else if (m_PayTable >= PayMethod.BottomHalf && m_PayTable <= PayMethod.Millionare10)
            {
                m_PayTable = m_CPayMethod;
                DisplaySpecial(m_PayTable);                
                AddButton(610, 50, 0x983, 0x984, 601, GumpButtonType.Reply, 0);
                AddButton(610, 60, 0x985, 0x986, 602, GumpButtonType.Reply, 0);
            }
            for (int i = 0; i < 20; i++)
                if (m_MachinePicks[i] != 255)
                    m_Selected[m_MachinePicks[i]] += 2;
            int numberHue = 0;
            for (int i = 0; i < 80; i++)
            {
                switch (m_Selected[i])
                {
                    case 0:
                        numberHue = 0;
                        break;
                    case 1:
                        numberHue = 1149;
                        break;
                    case 2:
                        numberHue = 37;
                        m_Selected[i] = 0;
                        if (i < 40)
                            tophalf++;
                        else
                            bottomhalf++;
                        break;
                    case 3:
                        numberHue = 66;
                        totalhit++;
                        m_Selected[i] = 1;
                        if (i < 40)
                            tophalf++;
                        else
                            bottomhalf++;
                        break;
                }
                if (m_PickButtons)
                    AddButton(numberx - 3, numbery - 5, 4202, 4202, i + 1, GumpButtonType.Reply, 0);
                AddLabel(numberx, numbery, numberHue, (i + 1).ToString());
                numberx += 45;
                if (( i + 1) % 10 == 0)
                {
                    numbery += 37;
                    numberx = 20;
                }
            }
            for (int i = 0; i < 20; i++)
                    m_MachinePicks[i] = 255;
            AddLabel(455, 155, 957, tophalf.ToString());
            AddLabel(455, 180, 957, bottomhalf.ToString());
            text = String.Format("{0}/{1}", totalhit,m_TotalSelected);
            AddLabel(575, 166, 66, text);

            if (played)
            {
                int wonhue = 957;
                int won = (int)(m_Player.Cost * m_PayOutTable[totalhit]);
                if (won == 0)
                {
                    if (Utility.RandomDouble() < .01 && m_From != null && !m_From.Deleted)
                    {
                        if (m_From.Female)
                            m_From.PlaySound(Utility.RandomList(1372, 1373, 816, 796, 782));
                        else
                            m_From.PlaySound(Utility.RandomList(1372, 1373, 1090, 1068, 1053));
                    }
                    if ((int)m_Keno.SecurityChatter == 2)
                    {
                        text = String.Format("{0} lost {1}.", m_Player.mobile.Name, m_Player.Cost);
                        m_Keno.SecurityCamera(2, text);
                        text = String.Format("OnCredit={1}.", m_Player.mobile.Name, m_Player.OnCredit);
                        m_Keno.SecurityCamera(2, text);
                    }
                }
                else
                {
                    m_Keno.ProcessPlay(m_From, m_Player, won);
                    wonhue = 2213;
                }
                AddLabel(525, 230, wonhue, won.ToString());
                m_Keno.IncrementStats(totalhit);
                if (Utility.RandomDouble() < .0008 && m_From != null && !m_From.Deleted)
                    CEOCookie(m_Keno.Hue);
            }
            else
                AddLabel(525, 230, 957, "0");
            AddLabel(525, 210, 2213, m_Keno.OnCredit(m_From, m_Player, 0).ToString());
        }