Пример #1
0
        public PokerDealer(int maxPlayers)
        {
            Blessed = true;
            Frozen = true;
            InitStats(100, 100, 100);

            Title = "the poker dealer";
            Hue = Utility.RandomSkinHue();
            NameHue = 0x35;
            Female = Utility.RandomBool();

            if (Female)
            {
                Body = 0x191;
                Name = NameList.RandomName("female");
            }
            else
            {
                Body = 0x190;
                Name = NameList.RandomName("male");
            }

            Dress();

            MaxPlayers = maxPlayers;
            Seats = new List<Point3D>();
            _MRake = 0.10; //10% rake default
            RakeMax = 5000; //5k maximum rake default
            Game = new PokerGame(this);
        }
Пример #2
0
 public PokerPlayer(PlayerMobile owner, int buyin, Point3D seat, PokerGame game)
 {
     Owner = owner;
     Owner.PokerGame = game;
     Seat = seat;
     Currency = buyin;
     HoleCards = new List<Card>();
     TeleportToSeat();
 }
Пример #3
0
 public PokerBetGump(PlayerMobile user, PokerGame game, PokerPlayer player, Gump parent = null)
     : base(user, parent, 526, 449)
 {
     Closable = false;
     Disposable = false;
     Dragable = true;
     Resizable = false;
     _Player = player;
     _Game = game;
 }
Пример #4
0
        public PokerRebuy(Mobile from, PokerGame game)
            : base(50, 50)
        {
            m_Game = game;
            PokerPlayer pokerplayer;

            game.IsPlayer(from as PlayerMobile, out pokerplayer);
            AddBackground(0, 0, 400, 300, 9270);
            AddAlphaRegion(92, 10, 215, 24);
            AddHtml(14, 14, 371, 24, String.Format("<CENTER><BIG><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></BIG></CENTER>", "Rebuy in to the Poker Game?"), false, false);
            AddImageTiled(20, 34, 347, 2, 9277);
            AddImageTiled(34, 36, 347, 2, 9277);

            AddHtml(20, 41, 365, 130, String.Format("<LEFT><BASEFONT COLOR=#F7D358>{0}</BASEFONT><</LEFT>", "Are you sure you want to rebuy in to the poke game? Your new buy-in + your current chips must be greater than or equal to the minimum buy-in and cannot exceed the maximum buy-in.  Please note that this is an easy way for irresponsible people to lose money.  No gold will be refunded."), false, false);
            AddImageTiled(20, 150, 347, 2, 9277);
            AddImageTiled(34, 152, 347, 2, 9277);

            AddHtml(53, 160, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Min Buy-In:"), false, false);
            AddLabel(125, 160, 1258, m_Game.Dealer.MinBuyIn.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));
            AddHtml(50, 180, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Max Buy-In:"), false, false);
            AddLabel(125, 180, 1258, m_Game.Dealer.MaxBuyIn.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));
            AddHtml(40, 200, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Bank Balance:"), false, false);

            int balance = Banker.GetBalance(from, m_Game.TypeOfCurrency);

            AddLabel(125, 200, balance + pokerplayer.Currency >= m_Game.Dealer.MinBuyIn ? 63 : 137, balance.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));

            AddHtml(34, 220, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Current Chips:"), false, false);
            AddLabel(125, 220, 1258, pokerplayer.Currency.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));

            AddHtml(32, 240, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Pending Credit:"), false, false);
            AddLabel(125, 240, 1258, pokerplayer.PendingCredit.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));

            AddHtml(31, 260, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Buy-In Amount:"), false, false);

            AddImageTiled(125, 260, 80, 19, 0xBBC);
            AddAlphaRegion(125, 260, 80, 19);
            if (pokerplayer.Currency + pokerplayer.PendingCredit > m_Game.Dealer.MaxBuyIn)
            {
                AddTextEntry(128, 260, 77, 19, 99, (int)Handlers.txtBuyInAmount, 0.ToString());
            }
            else
            {
                AddTextEntry(128, 260, 77, 19, 99, (int)Handlers.txtBuyInAmount, (m_Game.Dealer.MaxBuyIn - pokerplayer.Currency - pokerplayer.PendingCredit).ToString());
            }

            AddButton(250, 260, 247, 248, (int)Handlers.btnOkay, GumpButtonType.Reply, 0);
            AddButton(320, 260, 242, 241, (int)Handlers.btnCancel, GumpButtonType.Reply, 0);
        }
Пример #5
0
        public void LeaveGame(PokerGame game)
        {
            Payout(game.TypeOfCurrency);
            Owner.SendMessage(0x22, "You have left the poker table.");
            if (Owner.AccessLevel < AccessLevel.Counselor)
            {
                Owner.Blessed = false;
            }
            if (Owner.AccessLevel < AccessLevel.GameMaster)
            {
                Owner.PokerJoinTimer = DateTime.UtcNow + TimeSpan.FromMinutes(1);
            }
            Owner.PokerGame = null;

            CloseAllGumps();
        }
Пример #6
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            {
                TotalRake = reader.ReadInt();
            }
                goto case 1;

            case 1:
            {
                TableName  = reader.ReadString();
                IsDonation = reader.ReadBool();
            }
                goto case 0;

            case 0:
            {
                _MActive     = reader.ReadBool();
                SmallBlind   = reader.ReadInt();
                BigBlind     = reader.ReadInt();
                MinBuyIn     = reader.ReadInt();
                MaxBuyIn     = reader.ReadInt();
                ExitLocation = reader.ReadPoint3D();
                ExitMap      = reader.ReadMap();
                _MRake       = reader.ReadDouble();
                RakeMax      = reader.ReadInt();
                _MMaxPlayers = reader.ReadInt();

                int count = reader.ReadInt();
                Seats = new List <Point3D>();

                for (int i = 0; i < count; ++i)
                {
                    Seats.Add(reader.ReadPoint3D());
                }
            }
            break;
            }

            Game = new PokerGame(this);
        }
Пример #7
0
        public PokerLeaveGump(PokerGame game)
            : base(50, 50)
        {
            _MGame = game;

            AddBackground(0, 0, 400, 165, 9270);
            AddAlphaRegion(115, 10, 165, 24);
            AddHtml(14, 14, 371, 24, String.Format("<CENTER><BIG><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></BIG></CENTER>", "Stand Up and Leave?"), false, false);
            AddImageTiled(20, 34, 347, 2, 9277);
            AddImageTiled(34, 36, 347, 2, 9277);

            AddHtml(20, 41, 365, 130, String.Format("<LEFT><BASEFONT COLOR=#F7D358>{0}</BASEFONT><</LEFT>", "Are you sure you want to cash-in and leave the poker table? You will play the current hand to completion and then any winnings will be deposited in your bank box. You will be unable to join another poker table for 60 seconds."), false, false);
            AddImageTiled(20, 115, 347, 2, 9277);
            AddImageTiled(34, 117, 347, 2, 9277);

            AddButton(250, 125, 247, 248, (int)Handlers.BtnOkay, GumpButtonType.Reply, 0);
            AddButton(320, 125, 242, 241, (int)Handlers.None, GumpButtonType.Reply, 0);
        }
Пример #8
0
        public PokerJoinGump(Mobile from, PokerGame game)
            : base(50, 50)
        {
            m_Game = game;

            AddBackground(0, 0, 400, 285, 9270);
            AddAlphaRegion(135, 10, 125, 24);
            AddHtml(14, 14, 371, 24, String.Format("<CENTER><BIG><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></BIG></CENTER>", "Join Poker Table"), false, false);
            AddImageTiled(20, 34, 347, 2, 9277);
            AddImageTiled(34, 36, 347, 2, 9277);

            AddHtml(20, 41, 365, 130, String.Format("<LEFT><BASEFONT COLOR=#F7D358>{0}</BASEFONT><</LEFT>", "You are asking to join a poker table. If you are unfamiliar with the rules of Texas Hold'em, or are uneasy about " +
                                                    "losing " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold") + ", then you are advised against proceeding. Only specify a buy-in amount that you would be comfortable losing--all bets are made with real gold and there are no refunds."), false, false);
            if (!m_Game.Dealer.IsDonation)
            {
                AddImageTiled(20, 135, 347, 2, 9277);
                AddImageTiled(34, 137, 347, 2, 9277);
            }

            AddHtml(52, 150, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Small Blind:"), false, false);
            AddLabel(125, 150, 1258, m_Game.Dealer.SmallBlind.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));
            AddHtml(64, 170, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Big Blind:"), false, false);
            AddLabel(125, 170, 1258, m_Game.Dealer.BigBlind.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));
            AddHtml(53, 190, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Min Buy-In:"), false, false);
            AddLabel(125, 190, 1258, m_Game.Dealer.MinBuyIn.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));
            AddHtml(50, 210, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Max Buy-In:"), false, false);
            AddLabel(125, 210, 1258, m_Game.Dealer.MaxBuyIn.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));
            AddHtml(40, 230, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Bank Balance:"), false, false);

            int balance = Banker.GetBalance(from, m_Game.TypeOfCurrency);

            AddLabel(125, 230, balance >= m_Game.Dealer.MinBuyIn ? 63 : 137, balance.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));

            AddHtml(31, 250, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Buy-In Amount:"), false, false);

            AddImageTiled(125, 250, 80, 19, 0xBBC);
            AddAlphaRegion(125, 250, 80, 19);
            AddTextEntry(128, 250, 77, 19, 99, (int)Handlers.txtBuyInAmount, m_Game.Dealer.MinBuyIn.ToString());

            AddButton(250, 250, 247, 248, (int)Handlers.btnOkay, GumpButtonType.Reply, 0);
            AddButton(320, 250, 242, 241, (int)Handlers.btnCancel, GumpButtonType.Reply, 0);
        }
Пример #9
0
        public PokerJoinGump(Mobile from, PokerGame game)
            : base(50, 50)
        {
            m_Game = game;

            AddBackground(0, 0, 400, 285, 9270);
            AddAlphaRegion(135, 10, 125, 24);
            AddHtml(14, 14, 371, 24, String.Format("<CENTER><BIG><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></BIG></CENTER>", "Join Poker Table"), false, false);
            AddImageTiled(20, 34, 347, 2, 9277);
            AddImageTiled(34, 36, 347, 2, 9277);

            AddHtml(20, 41, 365, 130, String.Format("<LEFT><BASEFONT COLOR=#F7D358>{0}</BASEFONT><</LEFT>", "You are asking to join a poker table. If you are unfamiliar with the rules of Texas Hold'em, or are uneasy about " +
                                                                           "losing " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold") + ", then you are advised against proceeding. Only specify a buy-in amount that you would be comfortable losing--all bets are made with real gold and there are no refunds."), false, false);
            if (!m_Game.Dealer.IsDonation)
            {
                AddImageTiled(20, 135, 347, 2, 9277);
                AddImageTiled(34, 137, 347, 2, 9277);
            }

            AddHtml(52, 150, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Small Blind:"), false, false);
            AddLabel(125, 150, 1258, m_Game.Dealer.SmallBlind.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));
            AddHtml(64, 170, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Big Blind:"), false, false);
            AddLabel(125, 170, 1258, m_Game.Dealer.BigBlind.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));
            AddHtml(53, 190, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Min Buy-In:"), false, false);
            AddLabel(125, 190, 1258, m_Game.Dealer.MinBuyIn.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));
            AddHtml(50, 210, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Max Buy-In:"), false, false);
            AddLabel(125, 210, 1258, m_Game.Dealer.MaxBuyIn.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));
            AddHtml(40, 230, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Bank Balance:"), false, false);

            int balance = Banker.GetBalance(from, m_Game.TypeOfCurrency);

            AddLabel(125, 230, balance >= m_Game.Dealer.MinBuyIn ? 63 : 137, balance.ToString("#,0") + " " + (m_Game.Dealer.IsDonation ? "donation coins" : "gold"));

            AddHtml(31, 250, 100, 25, String.Format("<LEFT><BASEFONT COLOR=#FFFFFF>{0}</BASEFONT></LEFT>", "Buy-In Amount:"), false, false);

            AddImageTiled(125, 250, 80, 19, 0xBBC);
            AddAlphaRegion(125, 250, 80, 19);
            AddTextEntry(128, 250, 77, 19, 99, (int)Handlers.txtBuyInAmount,m_Game.Dealer.MinBuyIn.ToString());

            AddButton(250, 250, 247, 248, (int)Handlers.btnOkay, GumpButtonType.Reply, 0);
            AddButton(320, 250, 242, 241, (int)Handlers.btnCancel, GumpButtonType.Reply, 0);
        }
Пример #10
0
        public void ProcessHand(PokerGame game)
        {
            var task = new Task(async() =>
            {
                object handidobject = await UOFLegends.InsertWithReturn("pokerhands", new List <PokerHand> {
                    new PokerHand(game)
                }, "id");

                if (handidobject != null)
                {
                    var handid = (int)handidobject;

                    foreach (var action in Actions)
                    {
                        action.HandId = handid;
                    }

                    await UOFLegends.InsertWithReturn("pokeractions", Actions, "id");

                    List <PokerPlayerObj> playerobjects = game.ActivePlayers.Select(player => new PokerPlayerObj(handid, player)).ToList();

                    await UOFLegends.InsertWithReturn("pokerplayers", playerobjects, "id");

                    Actions = new List <PokerAction>();

                    foreach (var player in game.Players.ToArray())
                    {
                        new PokerWebsiteGump(player.Owner, handid).Send();
                    }

                    foreach (var viewer in game.Viewers.ToArray())
                    {
                        new PokerWebsiteGump(viewer, handid).Send();
                    }

                    //send gump here uoforever.com/legends/pokerhands/handid
                }
            });

            task.Start();
        }
Пример #11
0
        public void ProcessHand(PokerGame game)
        {
            var task = new Task(async () =>
            {
                object handidobject = await UOFLegends.InsertWithReturn("pokerhands", new List<PokerHand>{new PokerHand(game)}, "id");

                if (handidobject != null)
                {
                    var handid = (int) handidobject;

                    foreach (var action in Actions)
                    {
                        action.HandId = handid;
                    }

                    await UOFLegends.InsertWithReturn("pokeractions", Actions, "id");

                    List<PokerPlayerObj> playerobjects = game.ActivePlayers.Select(player => new PokerPlayerObj(handid, player)).ToList();

                    await UOFLegends.InsertWithReturn("pokerplayers", playerobjects, "id");

                    Actions = new List<PokerAction>();

                    foreach (var player in game.Players.ToArray())
                    {
                        new PokerWebsiteGump(player.Owner, handid).Send();
                    }

                    foreach (var viewer in game.Viewers.ToArray())
                    {
                        new PokerWebsiteGump(viewer, handid).Send();
                    }

                    //send gump here uoforever.com/legends/pokerhands/handid
                }
            });

            task.Start();
        }
Пример #12
0
        public PokerHand(PokerGame game)
        {
            StartTime = game.StartTime;
            EndTime   = DateTime.Now;

            FinalPot = game.PokerPots.Sum(x => x.GetTotalCurrency());

            StringBuilder sb = new StringBuilder();

            foreach (var card in game.CommunityCards)
            {
                if (game.CommunityCards.Last() != card)
                {
                    sb.Append(card.GetRankLetterExport() + card.GetSuitLetter() + " ");
                }
                else
                {
                    sb.Append(card.GetRankLetterExport() + card.GetSuitLetter());
                }
            }

            CommunityCards = sb.ToString();
        }
Пример #13
0
        public PokerHand(PokerGame game)
        {
            StartTime = game.StartTime;
            EndTime = DateTime.Now;

            FinalPot = game.PokerPots.Sum(x => x.GetTotalCurrency());

            StringBuilder sb = new StringBuilder();

            foreach (var card in game.CommunityCards)
            {
                if (game.CommunityCards.Last() != card)
                {
                    sb.Append(card.GetRankLetterExport() + card.GetSuitLetter() + " ");
                }
                else
                {
                    sb.Append(card.GetRankLetterExport() + card.GetSuitLetter());
                }
            }

            CommunityCards = sb.ToString();
        }
Пример #14
0
        private static void EventSink_Disconnected(DisconnectedEventArgs e)
        {
            Mobile from = e.Mobile;

            if (from == null)
            {
                return;
            }

            if (!(from is PlayerMobile))
            {
                return;
            }

            var pm = (PlayerMobile)from;

            PokerGame game = pm.PokerGame;

            if (game == null)
            {
                return;
            }

            PokerPlayer player;


            if (!game.IsPlayer(pm, out player))
            {
                Timer.DelayCall(TimeSpan.FromMinutes(1), () =>
                {
                    if (!player.IsOnline())
                    {
                        player.RequestLeave = true;
                    }
                });
            }
        }
Пример #15
0
        public void LeaveGame(PokerGame game)
        {
            Payout(game.TypeOfCurrency);
            Owner.SendMessage(0x22, "You have left the poker table.");
            if (Owner.AccessLevel < AccessLevel.Counselor)
                Owner.Blessed = false;
            if (Owner.AccessLevel < AccessLevel.GameMaster)
                Owner.PokerJoinTimer = DateTime.UtcNow + TimeSpan.FromMinutes(1);
            Owner.PokerGame = null;

            CloseAllGumps();
        }
Пример #16
0
        public void DistributeCredit(PokerGame game)
        {
            string currencyType = game.TypeOfCurrency == typeof(Gold) ? "gold coins" : "donation coins";
            var publicmessage = string.Empty;
            if (AmountWon > 0)
            {
                publicmessage = string.Format("Won {0:n0} {1}.", AmountWon, currencyType);
                Currency += AmountWon;
            }
            else if (AmountWon < 0)
            {
                publicmessage = string.Format("Lost {0:n0} {1}.", Math.Abs(AmountWon), currencyType);
            }

            if (!string.IsNullOrEmpty(publicmessage))
                Owner.PublicOverheadMessage(MessageType.Spell, 36, true, publicmessage);

            if (AmountToReturn > 0)
            {
                Owner.SendMessage(38, string.Format("{0} {1} have been returned to you.", AmountToReturn, currencyType));
                Currency += AmountToReturn;
            }
        }
Пример #17
0
 public PokerGameTimer(PokerGame game)
     : base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0))
 {
     _Game = game;
 }
Пример #18
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 2:
                {
                    TotalRake = reader.ReadInt();
                }
                    goto case 1;
                case 1:
                {
                    TableName = reader.ReadString();
                    IsDonation = reader.ReadBool();
                }
                    goto case 0;
                case 0:
                    {
                        _MActive = reader.ReadBool();
                        SmallBlind = reader.ReadInt();
                        BigBlind = reader.ReadInt();
                        MinBuyIn = reader.ReadInt();
                        MaxBuyIn = reader.ReadInt();
                        ExitLocation = reader.ReadPoint3D();
                        ExitMap = reader.ReadMap();
                        _MRake = reader.ReadDouble();
                        RakeMax = reader.ReadInt();
                        _MMaxPlayers = reader.ReadInt();

                        int count = reader.ReadInt();
                        Seats = new List<Point3D>();

                        for (int i = 0; i < count; ++i)
                        {
                            Seats.Add(reader.ReadPoint3D());
                        }
                    }
                    break;
            }

            Game = new PokerGame(this);
        }
Пример #19
0
 public PokerGameTimer(PokerGame game)
     : base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0))
 {
     _Game = game;
 }