Example #1
0
 private void GameWon(IChatClient chatClient, ChatUser chatUser)
 {
     chatClient.SendMessage(
         $"Congratulations, {chatUser.DisplayName} ! You won the game and will get {TOKENS_TO_WINNER} tokens!");
     _currencyGenerator.AddCurrencyTo(new List <string> {
         chatUser.DisplayName
     }, TOKENS_TO_WINNER);
     GivePerLetterTokens(chatClient);
     ResetGame();
 }
Example #2
0
 private void GameWon(IChatClient chatClient, ChatUser chatUser)
 {
     chatClient.SendMessage(
         $"Congratulations, {chatUser.DisplayName} ! You won the game and will get {_hangmanSettings.TokensToWinner} tokens!");
     _currencyGenerator.AddCurrencyTo(new List <string> {
         chatUser.DisplayName
     }, _hangmanSettings.TokensToWinner);
     GivePerLetterTokens(chatClient);
     _hangmanDisplayNotification.HangmanWin();
     ResetGame();
 }
Example #3
0
        public override void Process(IChatClient chatClient, CommandReceivedEventArgs eventArgs)
        {
            string bonusReceiver = (eventArgs?.Arguments?.ElementAtOrDefault(0) ?? "").NoAt();
            string bonusGiver    = eventArgs?.ChatUser?.DisplayName;

            if (bonusGiver.EqualsIns(bonusReceiver))
            {
                chatClient.SendMessage($"Did you seriously think this would work, {bonusGiver}");
                return;
            }

            if (int.TryParse(eventArgs?.Arguments?.ElementAtOrDefault(1), out int amount))
            {
                if (amount < 0)
                {
                    chatClient.SendMessage($"Quit messing around, {bonusGiver}. You can't give negative amounts.");
                    return;
                }

                _currencyGenerator.AddCurrencyTo(new List <string> {
                    bonusReceiver
                }, amount);                                                                 // TODO: prevent overflow
                chatClient.SendMessage($"Added {amount} coins to @{bonusReceiver}.");
            }
        }
Example #4
0
        private void AwardWinners(IChatClient chatClient, QuizQuestion question)
        {
            char          correctLetter = question.LetterAssignment.Single(x => x.Value == question.CorrectAnswer).Key;
            List <string> winners       = CurrentPlayers.Where(x => x.Value == correctLetter).Select(x => x.Key).ToList();

            chatClient.SendMessage($"Congratulations to {string.Join(", ", winners)}");
            _currencyGenerator.AddCurrencyTo(winners, 10);
        }
 private void FollowerServiceOnOnNewFollower(
     object sender, NewFollowersEventArgs eventArgs)
 {
     foreach (ChatUser newFollower in eventArgs.NewFollowers)
     {
         _currencyGenerator.AddCurrencyTo(newFollower.DisplayName, TOKENS_FOR_FOLLOWING);
         _chatClient.SendMessage($"Welcome, {newFollower.DisplayName}! Thank you for following! {TOKENS_FOR_FOLLOWING} coins to have some fun. Everyone, say \"hello\"!");
     }
 }
 private void FollowerServiceOnOnNewFollower(object sender, NewFollowersEventArgs eventArgs)
 {
     foreach (IChatClient chatClient in _chatClients)
     {
         foreach (string followerName in eventArgs.FollowerNames)
         {
             _currencyGenerator.AddCurrencyTo(followerName, TOKENS_FOR_FOLLOWING);
             chatClient.SendMessage(
                 $"Welcome, {followerName}! Thank you for following! {TOKENS_FOR_FOLLOWING} coins to have some fun. Everyone, say \"hello\"!");
         }
     }
 }
Example #7
0
        public void StartHeist(IChatClient chatClient)
        {
            HeistMissionResult heistMissionResult = _selectedHeist.AttemptHeist(_heistMembers);

            foreach (string resultMessage in heistMissionResult.ResultMessages)
            {
                chatClient.SendMessage(resultMessage);
            }

            _currencyGenerator.AddCurrencyTo(heistMissionResult.SurvivingMembers, 50);

            ResetHeist();
        }
        protected override void HandleCommand(IChatClient chatClient, CommandReceivedEventArgs eventArgs)
        {
            var name   = eventArgs.ChatUser.DisplayName;
            var random = MyRandom.RandomNumber(0, 100);

            if (random < _rouletteSettings.WinPercentageChance)
            {
                chatClient.SendMessage($"{name} pulls the trigger and the revolver clicks! {name} survived the roulette!");
                _currencyGenerator.AddCurrencyTo(name, _rouletteSettings.CoinsReward);
            }
            else
            {
                if (_rouletteSettings.ProtectSubscribers && eventArgs.ChatUser.Role == UserRole.Subscriber)
                {
                    chatClient.SendMessage(
                        $"{name} pulls the trigger and the revolver fires! A bright light flashes through chat and revives {name}");
                }
                else
                {
                    chatClient.SendMessage($"{name} pulls the trigger and the revolver fires! {name} lies dead in chat. RIP");
                    chatClient.Timeout(name, TimeSpan.FromSeconds(_rouletteSettings.TimeoutDurationInSeconds), "Died playing roulette");
                }
            }
        }