Example #1
0
        private void AdjustHandHistory(HandHistory handHistory)
        {
            if (handHistory == null)
            {
                return;
            }

            HandHistoryUtils.UpdateAllInActions(handHistory);
            HandHistoryUtils.CalculateBets(handHistory);
            HandHistoryUtils.CalculateTotalPot(handHistory);
            HandHistoryUtils.RemoveSittingOutPlayers(handHistory);

            foreach (var player in handHistory.Players)
            {
                handHistory.HandActions
                .Where(x => x.PlayerName == player.PlayerName)
                .ForEach(x => x.PlayerName = player.PlayerNick);

                if (handHistory.HeroName == player.PlayerName)
                {
                    handHistory.HeroName = player.PlayerNick;
                }

                player.PlayerName = player.PlayerNick;
                player.PlayerNick = null;
            }
        }
Example #2
0
        private void AdjustHandHistory(HandHistory handHistory, long heroId)
        {
            // replace 1st raise with bet
            ReplaceFirstRaiseWithBet(handHistory.Flop);
            ReplaceFirstRaiseWithBet(handHistory.Turn);
            ReplaceFirstRaiseWithBet(handHistory.River);

            HandHistoryUtils.AddShowActions(handHistory);
            HandHistoryUtils.AddWinningActions(handHistory);
            HandHistoryUtils.CalculateBets(handHistory);
            HandHistoryUtils.CalculateUncalledBets(handHistory, true);
            HandHistoryUtils.CalculateTotalPot(handHistory);
            HandHistoryUtils.SortHandActions(handHistory);
            HandHistoryUtils.RemoveSittingOutPlayers(handHistory);
        }
        private void AdjustHandHistory(HandHistory history)
        {
            const decimal divider = 100m;

            if (history == null)
            {
                return;
            }

            HandHistoryUtils.UpdateAllInActions(history);
            HandHistoryUtils.CalculateBets(history);
            HandHistoryUtils.CalculateUncalledBets(history, false);
            HandHistoryUtils.CalculateTotalPot(history);
            HandHistoryUtils.RemoveSittingOutPlayers(history);

            if (history.GameDescription.IsTournament)
            {
                history.GameDescription.Tournament.BuyIn.PrizePoolValue /= divider;
                history.GameDescription.Tournament.BuyIn.KnockoutValue  /= divider;
                history.GameDescription.Tournament.BuyIn.Rake           /= divider;
                history.GameDescription.Tournament.Addon      /= divider;
                history.GameDescription.Tournament.Rebuy      /= divider;
                history.GameDescription.Tournament.Winning    /= divider;
                history.GameDescription.Tournament.Bounty     /= divider;
                history.GameDescription.Tournament.TotalPrize /= divider;
            }

            history.HandActions.ForEach(a => a.Amount = a.Amount / divider);

            history.GameDescription.Limit.SmallBlind /= divider;
            history.GameDescription.Limit.BigBlind   /= divider;
            history.GameDescription.Limit.Ante       /= divider;

            history.Players.ForEach(p =>
            {
                p.Bet           /= divider;
                p.StartingStack /= divider;
                p.Win           /= divider;
            });

            history.TotalPot /= divider;

            if (!history.GameDescription.IsTournament)
            {
                HandHistoryUtils.CalculateRake(history);
            }
        }
Example #4
0
        private void AdjustHandHistory(HandHistory handHistory)
        {
            if (handHistory == null)
            {
                return;
            }

            HandHistoryUtils.UpdateAllInActions(handHistory);
            HandHistoryUtils.CalculateBets(handHistory);
            HandHistoryUtils.CalculateUncalledBets(handHistory, true);
            HandHistoryUtils.CalculateTotalPot(handHistory);
            HandHistoryUtils.RemoveSittingOutPlayers(handHistory);

            if (handHistory.GameDescription == null)
            {
                throw new HandBuilderException(handHistory.HandId, "GameDescription must be not null.");
            }

            if (!handHistory.GameDescription.IsTournament)
            {
                const decimal divider = 100m;

                handHistory.HandActions.ForEach(a => a.Amount = a.Amount / divider);

                if (handHistory.GameDescription.Limit == null)
                {
                    throw new HandBuilderException(handHistory.HandId, "GameDescription.Limit must be not null.");
                }

                handHistory.GameDescription.Limit.SmallBlind /= divider;
                handHistory.GameDescription.Limit.BigBlind   /= divider;
                handHistory.GameDescription.Limit.Ante       /= divider;

                handHistory.Players.ForEach(p =>
                {
                    p.Bet           /= divider;
                    p.StartingStack /= divider;
                    p.Win           /= divider;
                });

                handHistory.TotalPot /= divider;
            }
        }