public LotteryGumpInfo( Mobile from, LotteryEntry entry )
            : base(0, 0)
        {
            LotterySystem.CloseAllLotteryGumps(from);

            this.Closable=true;
            this.Disposable=true;
            this.Dragable=true;
            this.Resizable=false;
            this.AddPage(0);
            this.AddBackground(6, 10, 468, 276, 9380);
            this.AddLabel(191, 14, 0, @"Lottery Report");
            this.AddButton(422, 263, 4017, 4018, (int)Buttons.ButtonClose, GumpButtonType.Reply, 0);
            this.AddLabel(382, 263, 0, @"Close");

            string info = "";

            info += string.Format("Lottery report from {0}.<br><br>", entry.m_dtTicketBought);
            info += string.Format("You Won {0}gp.<br><br>", entry.m_iWinMoney);

            // Show winning Number
            info += "Winning Numbers: ";
            foreach( int winningNumber in entry.m_iWinningNumbers )
                info += string.Format("{0} ", winningNumber);
            info += "<br>";

            // Show Player Numbers
            info += "<br>Your Numbers:<br>";
            info += LotteryGump.FormatPlayerNumbers(entry, true);

            // Show Global correct numbers
            info += "<br>Global Correct Numbers:<br>";
            for( int sortedNum=0;sortedNum<entry.m_TotalCorrectNumbers.Length;sortedNum++ )
                info += string.Format( "{0} correct numbers: {1}<br>", sortedNum, entry.m_TotalCorrectNumbers[sortedNum] );

            this.AddHtml( 33, 47, 417, 208, info, (bool)true, (bool)true);

            // Do not show info again
            if( entry != null )
                entry.m_bShowWinnings = false;
        }
 /// <summary>
 /// This will show winning info when needed.
 /// </summary>
 /// <param name="entry">This is the players entry in the registry</param>
 /// <returns>Returns true if gump has been shown.</returns>
 public static bool TryToShowWinInfo( Mobile from, LotteryEntry entry )
 {
     if( entry != null && entry.m_bShowWinnings )
     {
         from.SendGump( new LotteryGumpInfo( from, entry ) );
         return true;
     }
     return false;
 }
        public static void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();
            switch (version)
            {
                case 0:
                    {
                        m_dtStartTime = reader.ReadDateTime();
                        m_iJackpot = reader.ReadInt();
                        m_iTotalLotteryMoney = reader.ReadInt();

                        // LottoRegistry
                        int sizeA = reader.ReadInt();
                        for (int i = 0; i < sizeA; i++)
                        {
                            Mobile player = reader.ReadMobile();
                            bool enabled = reader.ReadBool();
                            bool showWinnings = reader.ReadBool();
                            int winMoney = reader.ReadInt();
                            DateTime lastAccessTime = reader.ReadDateTime();
                            DateTime ticketBought = reader.ReadDateTime();

                            // m_NumberList
                            int sizeB = reader.ReadInt();
                            List<int[]> numList = new List<int[]>(sizeB);
                            for (int b = 0; b < sizeB; b++)
                            {
                                int numSize = reader.ReadInt();
                                int[] number = new int[numSize];
                                for (int a = 0; a < numSize; a++)
                                    number[a] = reader.ReadInt();

                                numList.Add(number);
                            }

                            // m_CorrectNumbers
                            sizeB = reader.ReadInt();
                            int[] correctNum = new int[sizeB];
                            for (int a = 0; a < sizeB; a++)
                                correctNum[a] = reader.ReadInt();

                            // m_TotalCorrectNumbers
                            sizeB = reader.ReadInt();
                            int[] totalCorrectNum = new int[sizeB];
                            for (int a = 0; a < sizeB; a++)
                                totalCorrectNum[a] = reader.ReadInt();

                            // m_iWinningNumbers
                            sizeB = reader.ReadInt();
                            int[] winningNumbers = new int[sizeB];
                            for (int d = 0; d < sizeB; d++)
                                winningNumbers[d] = reader.ReadInt();

                            // Create the final entry
                            LotteryEntry entry = new LotteryEntry(player, numList, enabled, correctNum, totalCorrectNum, winningNumbers, showWinnings, ticketBought, lastAccessTime, winMoney);
                            m_LottoRegister.Add(entry);
                        }
                        break;
                    }
            }
        }
        /// <summary>
        /// Gets the entry from the registry for the player. If the player is not found in registry
        /// he gets added.
        /// </summary>
        /// <param name="player"></param>
        /// <returns></returns>
        public static LotteryEntry GetPlayerEntry(Mobile from)
        {
            foreach (LotteryEntry entry in m_LottoRegister)
            {
                if (entry.m_Player == from)
                {
                    entry.m_dtLastAccessTime = DateTime.Now;
                    return entry;
                }
            }

            LotteryEntry newEntry = new LotteryEntry(from);
            newEntry.m_dtLastAccessTime = DateTime.Now;
            m_LottoRegister.Add(newEntry);
            return newEntry;
        }
        public static void CancelTickets(Mobile from, LotteryEntry entry)
        {
            if (entry.m_bEnabled)
            {
                int gold = LotterySystem.m_iTicketPrice * entry.m_NumberList.Count;
                LotterySystem.GiveGold(from.BankBox, gold);

                from.SendMessage("{0}gp added to your bankbox.", gold);
                entry.m_bEnabled = false;
            }
        }