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; } }
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); } } } }
public void TryAddVote(string username, string effectText) { if (!Config.Instance.TwitchAllowVoting) { return; } AbstractEffect effect = EffectDatabase.GetByWord(effectText, true); if (effect != null) { UserVotes[username] = effect; } }
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; } } } }