Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sportId"></param>
        /// <param name="leagueId"></param>
        /// <param name="eventId"></param>
        /// <param name="periodNumber">0 for sports other than soccer, soccer: 0 = Game, 1 = 1st Half, 2 = 2nd Half</param>
        /// <param name="betType"></param>
        /// <param name="oddsFormat"></param>
        /// <param name="team"></param>
        /// <param name="side"></param>
        /// <param name="handicap"></param>
        /// <returns></returns>
        public Task <GetLineResponse> GetLine(int sportId, int leagueId, long eventId, int periodNumber, BetType betType,
                                              OddsFormat oddsFormat,
                                              TeamType?team = null, SideType?side = null, decimal?handicap = null)
        {
            if (team == null)
            {
                if (betType == BetType.Moneyline || betType == BetType.Spread || betType == BetType.Team_Total_Points)
                {
                    throw new Exception($"TeamType is required for {betType} Bets!");
                }
            }

            if (side == null)
            {
                if (betType == BetType.Total_Points || betType == BetType.Team_Total_Points)
                {
                    throw new Exception($"SideType is required for {betType} Bets!");
                }
            }

            if (handicap == null)
            {
                if (betType == BetType.Spread || betType == BetType.Total_Points || betType == BetType.Team_Total_Points)
                {
                    throw new Exception($"Handicap is required for {betType} Bets!");
                }
            }

            // get request uri
            var sb = new StringBuilder();

            sb.Append($"v1/line?sportId={sportId}");
            sb.Append($"&leagueId={leagueId}");
            sb.Append($"&eventId={eventId}");
            sb.Append($"&betType={betType.ToString().ToUpper()}");
            sb.Append($"&oddsFormat={oddsFormat.ToString().ToUpper()}");
            sb.Append($"&periodNumber={periodNumber}"); // i.e. for soccer: 0 = Game, 1 = 1st Half, 2 = 2nd Half

            if (team != null)
            {
                sb.Append($"&team={team.ToString().ToUpper()}");
            }

            if (side != null)
            {
                sb.Append($"&side={side.ToString().ToUpper()}");
            }

            if (handicap != null)
            {
                sb.Append($"&handicap={handicap.ToString().ToUpper()}");
            }

            var uri = sb.ToString();

            return(GetJsonAsync <GetLineResponse>(uri));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sportId"></param>
        /// <param name="leagueId"></param>
        /// <param name="eventId"></param>
        /// <param name="periodNumber">0 for sports other than soccer, soccer: 0 = Game, 1 = 1st Half, 2 = 2nd Half</param>
        /// <param name="betType"></param>
        /// <param name="oddsFormat"></param>
        /// <param name="team"></param>
        /// <param name="side"></param>
        /// <param name="handicap"></param>
        /// <returns></returns>
        public Task <GetLineResponse> GetLine(int sportId, int leagueId, long eventId, int periodNumber, BetType betType, OddsFormat oddsFormat,
                                              TeamType?team = null, SideType?side = null, decimal?handicap = null)
        {
            if (team == null)
            {
                if (betType == BetType.MoneyLine || betType == BetType.Spread || betType == BetType.TeamTotalPoints)
                {
                    throw new Exception(string.Format("TeamType is required for {0} Bets!", betType));
                }
            }

            if (side == null)
            {
                if (betType == BetType.TotalPoints || betType == BetType.TeamTotalPoints)
                {
                    throw new Exception(string.Format("SideType is required for {0} Bets!", betType));
                }
            }

            if (handicap == null)
            {
                if (betType == BetType.Spread || betType == BetType.TotalPoints || betType == BetType.TeamTotalPoints)
                {
                    throw new Exception(string.Format("Handicap is required for {0} Bets!", betType));
                }
            }

            // get request uri
            var sb = new StringBuilder();

            sb.AppendFormat("v1/line?sportId={0}", sportId);
            sb.AppendFormat("&leagueId={0}", leagueId);
            sb.AppendFormat("&eventId={0}", eventId);
            sb.AppendFormat("&betType={0}", betType.ToString().ToUpper());
            sb.AppendFormat("&oddsFormat={0}", oddsFormat.ToString().ToUpper());
            sb.AppendFormat("&periodNumber={0}", periodNumber);                 // i.e. for soccer: 0 = Game, 1 = 1st Half, 2 = 2nd Half

            if (team != null)
            {
                sb.AppendFormat("&team={0}", team.ToString().ToUpper());
            }

            if (side != null)
            {
                sb.AppendFormat("&side={0}", side.ToString().ToUpper());
            }

            if (handicap != null)
            {
                sb.AppendFormat("&handicap={0}", handicap.ToString().ToUpper());
            }

            var uri = sb.ToString();

            return(JsonGetAsync <GetLineResponse>(uri));
        }
 public StraightLineRequest(int sportId, int leagueId, long eventId, int period, OddsFormat format, BetType betType, decimal?handicap = null, TeamType?team = null, SideType?side = null)
 {
     SportId      = sportId;
     LeagueId     = leagueId;
     EventId      = eventId;
     PeriodNumber = period;
     OddsFormat   = format.ToString();
     BetType      = betType.ToString();
     Handicap     = handicap;
     Team         = team == null ? null : team.ToString();
     Side         = side == null ? null : side.ToString();
 }
Ejemplo n.º 4
0
    public RouletteBet(double betAmount, BetType type, int[] surrNum)
    {
        _betAmount          = betAmount;
        _type               = type;
        _surroundingNumbers = surrNum;



        if (_user.balance() < _betAmount)
        {
            Console.WriteLine($"You don't have enough funds to do the ${_betAmount} bet. - {_type.ToString()}");
            return;
        }

        SplashKit.PlaySoundEffect(new SoundEffect("PlaceBet", "PlaceBet.mp3"));

        _rouletteRoll = new RouletteRoll();
        _roll         = _rouletteRoll.GetRoll();

        _user.BalanceAdjust(false, _betAmount);
        Console.Write($"You have placed a ${betAmount} on {type.ToString().ToLower()}, you need ");
        for (int x = 0; x < surrNum.Length; x++)
        {
            if (surrNum.Length > 1 && surrNum.Length != (x + 1))
            {
                Console.Write(surrNum[x] + ", ");
            }
            else
            {
                Console.Write(surrNum[x] + " ");
            }
        }

        Console.Write("to win...\n");

        Console.WriteLine($"The roll is... {_roll}.");

        HandleBet(type);
    }
Ejemplo n.º 5
0
        /// <summary>
        /// Permet de parier une somme de crédit X contre un utilisateur
        /// </summary>
        /// <param name="username">L'Username de la personne contre laquelle vous pariez</param>
        /// <param name="montant">En int, minimum 50 maximum 10,000</param>
        /// <param name="bet">Choisir le <type cref="BetType"/> de partie : Public, Private, System</param>
        /// <remark>Ne permet pas de savoir si on gagne ou on perd !</remark>
        public static void Bet(string username, string montant, BetType bet)
        {
            var betpoints = montant.ToString();

            var response = MyWebClient.UploadValues("http://hack-free.net/newpoints.php", new NameValueCollection()
           {
               { "my_post_key", PostKey },
               { "action", "betting"},
               { "type", bet.ToString() },
               { "username", username },
               { "points", betpoints },
               { "submit", "Affronter" }
           });

            var result = System.Text.Encoding.UTF8.GetString(response);
        }
Ejemplo n.º 6
0
        public List <int> betValue(int gameId, BetType type, string Choice)
        {
            List <int> betVal = new List <int>();
            var        game   = GetGameById(gameId);

            List <int> playerChoice = new List <int>();

            var count = Choice.Count(x => x == ',');

            if (count > 0)
            {
                for (int i = 0; i <= count; i++)
                {
                    int p = int.Parse(Choice.Split(',')[i]);
                    playerChoice.Add(p);
                }
            }
            else
            {
                playerChoice.Add(int.Parse(Choice));
            }


            int n = 0;

            if (game.GameName.ToLower() == "roulette")
            {
                switch (type.ToString())
                {
                case "column":     //player selects column 1, 2, or 3
                    n = playerChoice[0];
                    betVal.Add(n);
                    break;

                case "corner":                //player selection; must be adjoining numbers; must pass in 2 num
                    int n1 = playerChoice[0]; //lowest num on lowest row
                    int n2 = playerChoice[1]; //lowest num on highest row
                    betVal.Add(n1);
                    betVal.Add(n1 + 1);
                    betVal.Add(n2);
                    betVal.Add(n2 + 1);
                    break;

                case "double_street":     //player selection; pass in 1 num
                    n = playerChoice[0];  //lowest num from 2 adjoining rows
                    betVal.Add(n);
                    betVal.Add(n + 1);
                    betVal.Add(n + 2);
                    betVal.Add(n + 3);
                    betVal.Add(n + 4);
                    betVal.Add(n + 5);
                    break;

                case "dozen":     //player selection 1st doz, 2nd doz, 3rd doz
                    betVal.Add(playerChoice[0]);
                    break;

                case "even":
                    betVal.Add(2);
                    break;

                case "high":
                    betVal.Add(0);
                    break;

                case "low":
                    betVal.Add(1);
                    break;

                case "odd":
                    betVal.Add(1);
                    break;

                case "split":     //player selection 2 adjoining nums
                    n1 = playerChoice[0];
                    n2 = playerChoice[1];
                    betVal.Add(n1);
                    betVal.Add(n2);
                    break;

                case "straight":     //player selects 1 num
                    betVal.Add(playerChoice[0]);
                    break;

                case "street":     // player selects row
                    n = playerChoice[0];
                    if (n > 1)
                    {
                        n = 2 * (n - 1);
                    }
                    betVal.Add(n);
                    betVal.Add(n + 1);
                    betVal.Add(n + 2);
                    break;

                case "trio":     //player selects 1st or 2nd trio
                    betVal.Add(playerChoice[0]);
                    break;

                default:
                    break;
                }
            }
            else
            {
                betVal = playerChoice;
            }

            return(betVal);
        }
Ejemplo n.º 7
0
        public double Roulette(BetType betType, List <int> betValue)
        {
            List <int> targetRange = new List <int>();
            Dictionary <int, string> rouletteWheel = RouletteWheel();

            int    winNum   = Spin(rouletteWheel.Count());
            string winColor = rouletteWheel[winNum];

            switch (betType.ToString())
            {
            case "straight":
                if (betValue[0] == winNum)
                {
                    payout = 35;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "split":
                targetRange = betValue;
                if (targetRange.Contains(winNum))
                {
                    payout = 17;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "street":
                targetRange = betValue;
                if (targetRange.Contains(winNum))
                {
                    payout = 11;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "corner":
                targetRange = betValue;
                if (targetRange.Contains(winNum))
                {
                    payout = 8;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "double_street":
                targetRange = betValue;
                if (targetRange.Contains(winNum))
                {
                    payout = 5;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "trio":
                if (betValue[0] == 0)
                {
                    targetRange.Add(0);
                    targetRange.Add(1);
                    targetRange.Add(2);
                }
                else if (betValue[0] == 1)
                {
                    targetRange.Add(0);
                    targetRange.Add(2);
                    targetRange.Add(3);
                }
                if (targetRange == betValue)
                {
                    payout = 8;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "basket":
                targetRange.Add(0);
                targetRange.Add(1);
                targetRange.Add(2);
                targetRange.Add(3);
                targetRange.Add(37);
                if (targetRange.Contains(winNum))
                {
                    payout = 6;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "high":
                if (betValue[0] == 0)
                {
                    payout = 1;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "low":
                if (betValue[0] == 1)
                {
                    payout = 1;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "red":
                if (winColor.ToLower() == "red")
                {
                    payout = 1;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "black":
                if (winColor.ToLower() == "black")
                {
                    payout = 1;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "even":
                if (winNum % 2 == 0)
                {
                    payout = 1;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "odd":
                if (winNum % 2 != 0)
                {
                    payout = 1;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "dozen":
                if (betValue[0] == 1)
                {
                    targetRange.Add(1);
                    targetRange.Add(2);
                    targetRange.Add(3);
                    targetRange.Add(4);
                    targetRange.Add(5);
                    targetRange.Add(6);
                    targetRange.Add(7);
                    targetRange.Add(8);
                    targetRange.Add(9);
                    targetRange.Add(10);
                    targetRange.Add(11);
                    targetRange.Add(12);
                }
                else if (betValue[0] == 2)
                {
                    targetRange.Add(13);
                    targetRange.Add(14);
                    targetRange.Add(15);
                    targetRange.Add(16);
                    targetRange.Add(17);
                    targetRange.Add(18);
                    targetRange.Add(19);
                    targetRange.Add(20);
                    targetRange.Add(21);
                    targetRange.Add(22);
                    targetRange.Add(23);
                    targetRange.Add(24);
                }
                else if (betValue[0] == 3)
                {
                    targetRange.Add(25);
                    targetRange.Add(26);
                    targetRange.Add(27);
                    targetRange.Add(28);
                    targetRange.Add(29);
                    targetRange.Add(30);
                    targetRange.Add(31);
                    targetRange.Add(32);
                    targetRange.Add(33);
                    targetRange.Add(34);
                    targetRange.Add(35);
                    targetRange.Add(36);
                }
                if (targetRange.Contains(winNum))
                {
                    payout = 2;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "column":
                if (betValue[0] == 1)
                {
                    targetRange.Add(1);
                    targetRange.Add(4);
                    targetRange.Add(7);
                    targetRange.Add(10);
                    targetRange.Add(13);
                    targetRange.Add(16);
                    targetRange.Add(19);
                    targetRange.Add(22);
                    targetRange.Add(25);
                    targetRange.Add(28);
                    targetRange.Add(31);
                    targetRange.Add(34);
                }
                else if (betValue[0] == 2)
                {
                    targetRange.Add(2);
                    targetRange.Add(5);
                    targetRange.Add(8);
                    targetRange.Add(11);
                    targetRange.Add(14);
                    targetRange.Add(17);
                    targetRange.Add(20);
                    targetRange.Add(23);
                    targetRange.Add(26);
                    targetRange.Add(29);
                    targetRange.Add(32);
                    targetRange.Add(35);
                }
                else if (betValue[0] == 3)
                {
                    targetRange.Add(3);
                    targetRange.Add(6);
                    targetRange.Add(9);
                    targetRange.Add(12);
                    targetRange.Add(15);
                    targetRange.Add(18);
                    targetRange.Add(21);
                    targetRange.Add(24);
                    targetRange.Add(27);
                    targetRange.Add(30);
                    targetRange.Add(33);
                    targetRange.Add(36);
                }
                if (targetRange.Contains(winNum))
                {
                    payout = 2;
                }
                else
                {
                    payout = 0;
                }
                break;

            case "snake":
                targetRange.Add(1);
                targetRange.Add(5);
                targetRange.Add(9);
                targetRange.Add(12);
                targetRange.Add(14);
                targetRange.Add(16);
                targetRange.Add(19);
                targetRange.Add(23);
                targetRange.Add(27);
                targetRange.Add(30);
                targetRange.Add(32);
                targetRange.Add(34);
                if (targetRange.Contains(winNum))
                {
                    payout = 2;
                }
                else
                {
                    payout = 0;
                }
                break;
            }
            return(payout);
        }