Esempio n. 1
0
        public void EnterDuel(SteamFriends.ChatMsgCallback callback, string[] args)
        {
            var dueler = callback.ChatterID;
            var chat = callback.ChatRoomID;
            var name = SteamNerd.ChatterNames[dueler];

            if (_inProgress || _players.Contains(dueler)) return;

            _players.Add(dueler);

            if (_players.Count == 1)
            {
                SteamNerd.SendMessage(string.Format("{0} wants to duel someone! Bring it on!", name),
                    chat);
            }
            else if (_players.Count == 2)
            {
                var challengerName = SteamNerd.ChatterNames[_players[0]];

                _inProgress = true;
                SteamNerd.SendMessage(string.Format("{0} is dueling {1}! D-d-d-d-d-duel.", challengerName, name), chat);

                var countdown = new Countdown(SteamNerd, chat, (src, e) => StartDuel(callback), 4f, 3);

                var webRequest = WebRequest.Create("http://randomword.setgetgo.com/get.php");
                var webResponse = webRequest.GetResponse();
                var buffer = new StringBuilder();

                using (var stream = new StreamReader(webResponse.GetResponseStream()))
                {
                    _word = stream.ReadToEnd().ToLower().Trim();
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// When players can place bets.
        /// </summary>
        public void PlaceBets()
        {
            MoveWaitingToPlaying();

            var message = string.Format("Betting has started now!\n" +
                "You have 30 seconds to place your bets.\n" +
                "Join the game with '{0}blackjack'! Quit the game with 'quit'!\n" +
                "Use 'bet [money]' to place your bets.\n" +
                "If you don't, you're gonna get kicked out of the game!\n",
                SteamNerd.CommandChar);

            SteamNerd.SendMessage(message, _chat);

            // Wait for bets.
            _preRoundTimer = new Countdown(SteamNerd, _chat, (src, e) => StartBlackjack(), PREROUND_TIMER, 3);
        }