Exemple #1
0
        public Table(String handHistoryFilePath, Window window, PokerClient pokerClient, PlayerDatabase playerDatabase)
        {
            this.handHistoryFilePath = handHistoryFilePath;
            this.window = window;
            this.pokerClient = pokerClient;
            this.playerDatabase = playerDatabase;
            this.Game = PokerGame.Unknown;
            this.maxSeatingCapacity = 0; // We don't know yet
            this.TableId = String.Empty; // We don't know yet
            this.GameID = String.Empty; // We don't know yet
            this.currentHeroName = String.Empty;
            this.currentHeroSeat = 0;
            this.gameType = pokerClient.GetPokerGameTypeFromWindowTitle(WindowTitle);
            this.statistics = new TableStatistics(this); // We don't know what specific kind
            this.Hud = new Hud(this);
            this.visualRecognitionManager = null; // Not all tables have a visual recognition manager
            this.displayWindow = PokerMuck.TableDisplayWindow.CreateForTable(this);

            // By default we use the universal parser
            handHistoryParser = new UniversalHHParser(pokerClient, System.IO.Path.GetFileName(handHistoryFilePath));

            // But as soon as we find what kind of game we're using, we're going to update our parser */
            ((UniversalHHParser)handHistoryParser).GameDiscovered += new UniversalHHParser.GameDiscoveredHandler(handHistoryParser_GameDiscovered);

            playerList = new List<Player>(10); //Usually no more than 10 players per table

            // Init hand history monitor
            hhMonitor = new HHMonitor(handHistoryFilePath, this);
            hhMonitor.StartMonitoring();
        }
        public override void RegisterParserHandlers(HHParser parser)
        {
            base.RegisterParserHandlers(parser);

            ((HoldemHHParser)parser).FoundBigBlind += new HoldemHHParser.FoundBigBlindHandler(handHistoryParser_FoundBigBlind);
            ((HoldemHHParser)parser).FoundSmallBlind += new HoldemHHParser.FoundSmallBlindHandler(handHistoryParser_FoundSmallBlind);
            ((HoldemHHParser)parser).FoundBigBlindAmount += new HoldemHHParser.FoundBigBlindAmountHandler(HoldemTableStatistics_FoundBigBlindAmount);
            ((HoldemHHParser)parser).FoundSmallBlindAmount += new HoldemHHParser.FoundSmallBlindAmountHandler(HoldemTableStatistics_FoundSmallBlindAmount);

            ((HoldemHHParser)parser).PlayerBet += new HoldemHHParser.PlayerBetHandler(handHistoryParser_PlayerBet);
            ((HoldemHHParser)parser).PlayerCalled += new HoldemHHParser.PlayerCalledHandler(handHistoryParser_PlayerCalled);
            ((HoldemHHParser)parser).PlayerFolded += new HoldemHHParser.PlayerFoldedHandler(handHistoryParser_PlayerFolded);
            ((HoldemHHParser)parser).PlayerRaised += new HoldemHHParser.PlayerRaisedHandler(handHistoryParser_PlayerRaised);
            ((HoldemHHParser)parser).PlayerChecked += new HoldemHHParser.PlayerCheckedHandler(handHistoryParser_PlayerChecked);
            ((HoldemHHParser)parser).FoundButton += new HoldemHHParser.FoundButtonHandler(handHistoryParser_FoundButton);
            ((HoldemHHParser)parser).HoleCardsWillBeDealt += new HHParser.HoleCardsWillBeDealtHandler(HoldemTableStatistics_HoleCardsWillBeDealt);
            ((HoldemHHParser)parser).FoundWinner += new HoldemHHParser.FoundWinnerHandler(HoldemTableStatistics_FoundWinner);
            ((HoldemHHParser)parser).PlayerPushedAllIn += new HoldemHHParser.PlayerPushedAllInHandler(HoldemTableStatistics_PlayerPushedAllIn);
            ((HoldemHHParser)parser).ShowdownWillBegin += new HHParser.ShowdownWillBeginHandler(HoldemTableStatistics_ShowdownWillBegin);
            ((HoldemHHParser)parser).FinalBoardAvailable += new HoldemHHParser.FinalBoardAvailableHandler(HoldemTableStatistics_FinalBoardAvailable);
        }
Exemple #3
0
        private void handHistoryParser_GameDiscovered(string game)
        {
            Trace.WriteLine(String.Format("Game discovered! {0}",game));

            // Find to what game this game string corresponds
            Game = pokerClient.GetPokerGameFromGameDescription(game);

            bool foundParser = false;

            // Holdem?
            if (foundParser = (Game == PokerGame.Holdem))
            {
                handHistoryParser = new HoldemHHParser(pokerClient, System.IO.Path.GetFileName(handHistoryFilePath));
                statistics = new HoldemTableStatistics(this);
            }
            else if (Game == PokerGame.Unknown)
            {
                Trace.WriteLine("We weren't able to find a better parser for this Game");
            }

            // If we replaced our parser, we need to register the event handlers
            if (foundParser)
            {
                // Generic handlers (all game types)
                handHistoryParser.PlayerIsSeated += new HHParser.PlayerIsSeatedHandler(handHistoryParser_PlayerIsSeated);
                handHistoryParser.RoundHasTerminated += new HHParser.RoundHasTerminatedHandler(handHistoryParser_RoundHasTerminated);
                handHistoryParser.NewTableHasBeenCreated += new HHParser.NewTableHasBeenCreatedHandler(handHistoryParser_NewTableHasBeenCreated);
                handHistoryParser.FoundTableMaxSeatingCapacity += new HHParser.FoundTableMaxSeatingCapacityHandler(handHistoryParser_FoundTableMaxSeatingCapacity);
                handHistoryParser.HeroNameFound += new HHParser.HeroNameFoundHandler(handHistoryParser_HeroNameFound);

                // Game specific handlers
                if (Game == PokerGame.Holdem)
                {
                    ((HoldemHHParser)handHistoryParser).FinalBoardAvailable += new HoldemHHParser.FinalBoardAvailableHandler(handHistoryParser_FinalBoardAvailable);
                    statistics.RegisterParserHandlers(handHistoryParser);
                }

                // Also, resend the last line to the new parser!
                hhMonitor.ResendLastLine();
            }

            if (Game != PokerGame.Unknown)
            {
                // Close temporary window
                if (displayWindow != null) displayWindow.Dispose();

                Globals.Director.RunFromGUIThread(
                    (Action)delegate()
                    {
                        if (displayWindow != null)
                        {
                            displayWindow = TableDisplayWindow.CreateForTable(this);
                            displayWindow.Show();
                        }
                    }, false
                 );
            }
        }
 /* This method takes care of registering the handlers specific to the game type */
 public virtual void RegisterParserHandlers(HHParser parser)
 {
     parser.PlayerMuckHandAvailable += new HHParser.PlayerMuckHandAvailableHandler(parser_PlayerMuckHandAvailable);
 }