示例#1
0
        private ParsingResult ParseHandHistory(Handhistory handHistory)
        {
            if (string.IsNullOrEmpty(handHistory.HandhistoryVal))
            {
                LogProvider.Log.Warn(CustomModulesNames.PlayerXRay, $"Hand #{handHistory.Gamenumber} has been skipped, because it has no history.");
                return(null);
            }

            var pokerSite = (EnumPokerSites)handHistory.PokersiteId;

            var pokerSiteNetwork = EntityUtils.GetSiteNetwork(pokerSite);

            var handHistoryParser = pokerSite == EnumPokerSites.Unknown || pokerSiteNetwork == EnumPokerNetworks.WPN ?
                                    handHistoryParserFactory.GetFullHandHistoryParser(handHistory.HandhistoryVal) :
                                    handHistoryParserFactory.GetFullHandHistoryParser(pokerSite);

            var parsedHand = handHistoryParser.ParseFullHandHistory(handHistory.HandhistoryVal, true);

            var gameType = new Gametypes
            {
                Anteincents       = Utils.ConvertToCents(parsedHand.GameDescription.Limit.Ante),
                Bigblindincents   = Utils.ConvertToCents(parsedHand.GameDescription.Limit.BigBlind),
                CurrencytypeId    = (short)parsedHand.GameDescription.Limit.Currency,
                Istourney         = parsedHand.GameDescription.IsTournament,
                PokergametypeId   = (short)(parsedHand.GameDescription.GameType),
                Smallblindincents = Utils.ConvertToCents(parsedHand.GameDescription.Limit.SmallBlind),
                Tablesize         = (short)parsedHand.GameDescription.SeatType.MaxPlayers
            };

            var players = parsedHand.Players.Select(player =>
            {
                var playerPokerSiteKey = new PlayerPokerSiteKey(player.PlayerName, (int)pokerSite);

                if (playersDictionary.ContainsKey(playerPokerSiteKey))
                {
                    return(playersDictionary[playerPokerSiteKey]);
                }

                return(new Players
                {
                    Playername = player.PlayerName,
                    PokersiteId = (short)pokerSite
                });
            }).ToList();

            var parsingResult = new ParsingResult
            {
                HandHistory = handHistory,
                Players     = players,
                GameType    = gameType,
                Source      = parsedHand
            };

            return(parsingResult);
        }
 public void ResetPlayers(Gametypes type)
 {
     Player1.GameType = type;
     Player2.GameType = type;
     if (PlayerModels.Count >= 3)
     {
         Player3.GameType = type;
     }
     if (PlayerModels.Count >= 4)
     {
         Player4.GameType = type;
     }
 }
        public int GetLifeValue(Gametypes type)
        {
            switch (type)
            {
            default:
            case Gametypes.MultiPlayer:
                return(20);

            case Gametypes.Commander:
                return(40);

            case Gametypes.Brawl:
                return(30);
            }
        }
示例#4
0
        private ParsingResult ParseHandHistory(EnumPokerSites pokerSite, string handHistoryText)
        {
            var pokerSiteNetwork = EntityUtils.GetSiteNetwork(pokerSite);

            var handHistoryParserFactory = ServiceLocator.Current.GetInstance <IHandHistoryParserFactory>();

            var handHistoryParser = pokerSite == EnumPokerSites.Unknown || pokerSiteNetwork == EnumPokerNetworks.WPN ?
                                    handHistoryParserFactory.GetFullHandHistoryParser(handHistoryText) :
                                    handHistoryParserFactory.GetFullHandHistoryParser(pokerSite);

            var parsedHand = handHistoryParser.ParseFullHandHistory(handHistoryText, true);

            var gameType = new Gametypes
            {
                Anteincents       = Utils.ConvertToCents(parsedHand.GameDescription.Limit.Ante),
                Bigblindincents   = Utils.ConvertToCents(parsedHand.GameDescription.Limit.BigBlind),
                CurrencytypeId    = (short)parsedHand.GameDescription.Limit.Currency,
                Istourney         = parsedHand.GameDescription.IsTournament,
                PokergametypeId   = (short)(parsedHand.GameDescription.GameType),
                Smallblindincents = Utils.ConvertToCents(parsedHand.GameDescription.Limit.SmallBlind),
                Tablesize         = (short)parsedHand.GameDescription.SeatType.MaxPlayers
            };

            var players = parsedHand.Players.Select(player => new Players
            {
                Playername  = player.PlayerName,
                PokersiteId = (short)pokerSite
            }).ToList();

            var parsingResult = new ParsingResult
            {
                HandHistory = new Handhistory {
                    PokersiteId = (short)pokerSite, HandhistoryVal = handHistoryText
                },
                Players  = players,
                GameType = gameType,
                Source   = parsedHand
            };

            return(parsingResult);
        }
示例#5
0
        public void Reset(Gametypes type = Gametypes.MultiPlayer)
        {
            if (type == Gametypes.Current)
            {
                type = _lastType;
            }

            _lastType = type;

            viewModel.LifeTotal  = _manager.GetLifeValue(type);
            viewModel.Energy     = 0;
            viewModel.Experience = 0;
            viewModel.Poison     = 0;
            viewModel.CmdEnemy1  = 0;
            viewModel.CmdEnemy2  = 0;
            viewModel.CmdEnemy3  = 0;

            if (type == Gametypes.Commander)
            {
                LifeControl.SetValue(Grid.RowSpanProperty, 1);
            }
            else
            {
                LifeControl.SetValue(Grid.RowSpanProperty, 2);
            }


            cmdLife1.LifeChanged -= CmdLife_LifeChanged;
            cmdLife2.LifeChanged -= CmdLife_LifeChanged;
            cmdLife3.LifeChanged -= CmdLife_LifeChanged;

            var cmd = 1;

            foreach (var id in _manager.ActivePlayers())
            {
                if (id == viewModel.ID)
                {
                    continue;
                }
                if (id == PlayerID.Unknown)
                {
                    continue;
                }

                CommanderButtonMapping[id] = cmd;

                switch (cmd)
                {
                case 1:
                    borderLife1.Visibility = cmdLife1.Visibility = Visibility.Visible;
                    break;

                case 2:
                    borderLife2.Visibility = cmdLife2.Visibility = Visibility.Visible;
                    break;

                case 3:
                    borderLife3.Visibility = cmdLife3.Visibility = Visibility.Visible;
                    break;

                default:
                    break;
                }
                cmd++;
            }

            cmdLife1.LifeChanged += CmdLife_LifeChanged;
            cmdLife2.LifeChanged += CmdLife_LifeChanged;
            cmdLife3.LifeChanged += CmdLife_LifeChanged;


            BorderCmd.Visibility = type == Gametypes.Commander ? Visibility.Visible : Visibility.Collapsed;

            LifeControl.SetLife(viewModel.LifeTotal);
            UpdateCustomType();
            UpdateCommanderDmg();
        }