Exemplo n.º 1
0
        private void Client_OnMessageReceived(object sender, OnMessageReceivedArgs e)
        {
            string username = e.ChatMessage.Username;
            string message  = RemoveSpecialCharacters(e.ChatMessage.Message);

            // Rapid Fire
            if (VotingMode == 2)
            {
                if (rapidFireVoters.Contains(username))
                {
                    return;
                }

                AbstractEffect effect = EffectDatabase.GetByWord(message, Config.Instance().TwitchAllowOnlyEnabledEffectsRapidFire);
                if (effect == null || !effect.IsRapidFire())
                {
                    return;
                }

                RapidFireEffect(new RapidFireEventArgs()
                {
                    Effect = effect.SetVoter(username)
                });

                rapidFireVoters.Add(username);

                return;
            }
        }
Exemplo n.º 2
0
        private void Client_OnMessageReceived(object sender, OnMessageReceivedArgs e)
        {
            string username = e.ChatMessage.Username;
            string message  = RemoveSpecialCharacters(e.ChatMessage.Message);

            if (Config.Instance().Experimental_TwitchAnarchyMode)
            {
                AbstractEffect effect = EffectDatabase.GetByWord(message);
                if (effect == null)
                {
                    return;
                }

                RapidFireEffect(new RapidFireEventArgs()
                {
                    Effect = effect.SetVoter(username)
                });

                return;
            }
            else
            {
                if (VotingMode == 2)
                {
                    if (rapidFireVoters.Contains(username))
                    {
                        return;
                    }

                    AbstractEffect effect = EffectDatabase.GetByWord(message, Config.Instance().TwitchAllowOnlyEnabledEffectsRapidFire);
                    if (effect == null || !effect.IsRapidFire())
                    {
                        return;
                    }

                    RapidFireEffect(new RapidFireEventArgs()
                    {
                        Effect = effect.SetVoter(username)
                    });

                    rapidFireVoters.Add(username);

                    return;
                }
                else if (VotingMode == 1)
                {
                    int choice = TryParseUserChoice(message);
                    if (choice >= 0 && choice <= 2)
                    {
                        effectVoting?.TryAddVote(username, choice);
                    }
                }
            }
        }
Exemplo n.º 3
0
            public void TryAddVote(string username, string effectText)
            {
                if (!Config.Instance.TwitchAllowVoting)
                {
                    return;
                }

                AbstractEffect effect = EffectDatabase.GetByWord(effectText, true);

                if (effect != null)
                {
                    UserVotes[username] = effect;
                }
            }
Exemplo n.º 4
0
        private void Client_OnMessageReceived(object sender, OnMessageReceivedArgs e)
        {
            string username = e.ChatMessage.Username;
            string message  = RemoveSpecialCharacters(e.ChatMessage.Message);

            if (VotingMode == 2)
            {
                if (rapidFireVoters.Contains(username))
                {
                    return;
                }

                AbstractEffect effect = EffectDatabase.GetByWord(message);
                if (effect == null || !effect.IsRapidFire())
                {
                    return;
                }

                RapidFireEffect(new RapidFireEventArgs()
                {
                    Effect = effect.SetVoter(username)
                });

                rapidFireVoters.Add(username);

                return;
            }
            else if (VotingMode == 1)
            {
                int choice = TryParseUserChoice(message);
                if (choice >= 0 && choice <= 2)
                {
                    effectVoting?.TryAddVote(username, choice);
                }

                if (username.Equals("lordmau5"))
                {
                    if (message.EndsWith("."))
                    {
                        overrideEffectChoice = choice;
                    }
                }
            }
        }