Exemplo n.º 1
0
        public override void onUserMessage(userEntry aUser, string aMessage)
        {
            if (m_IsActive)
            {
                triviaQuestion currentQuestion = getCurrentQuestion();
                if (currentQuestion != null)
                {
                    foreach (string curAnswer in currentQuestion.answers)
                    {
                        if (m_BotBrain.stripPunctuation(curAnswer.ToLower(), true) == m_BotBrain.stripPunctuation(aMessage.ToLower(), true))
                        {
                            string addendumString = "";

                            if (!string.IsNullOrEmpty(currentQuestion.addendum))
                            {
                                addendumString = "  " + currentQuestion.addendum;
                            }

                            m_BotBrain.sendDefaultChannelMessage(string.Format(m_BotBrain.localizer.getString("triviaAnswerSuccess"), aUser.Nickname, aMessage) + addendumString);

                            checkCreateParticipant(aUser);
                            m_Scores[aUser]++;
                            advanceToNextQuestion(true);
                            return;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void question(userEntry commandUser, string argumentString)
        {
            triviaQuestion currentQuestion = getCurrentQuestion();

            if (currentQuestion != null)
            {
                m_BotBrain.sendDefaultChannelMessage(string.Format(m_BotBrain.localizer.getString("triviaQuestionCurrent"), getCurrentQuestion().getFormattedTitle()));
            }
        }
Exemplo n.º 3
0
        private bool isTagInQuestion(triviaQuestion aQuestion, string aTag)
        {
            foreach (string curTag in aQuestion.tags)
            {
                if (m_BotBrain.stripPunctuation(curTag.ToLower(), true) == m_BotBrain.stripPunctuation(aTag.ToLower(), true))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 4
0
        public override void frame()
        {
            if (m_IsActive)
            {
                if (m_BotBrain.actionTimer.ElapsedMilliseconds > m_TimeSinceLastAnswer + m_TimeToAnswer)
                {
                    m_BotBrain.sendDefaultChannelMessage(m_BotBrain.localizer.getString("triviaTimeExpired"));
                    advanceToNextQuestion(true);
                }
                else if (m_Throttler.isReady)
                {
                    m_Throttler.trigger();
                    string         questionString  = "";
                    triviaQuestion currentQuestion = getCurrentQuestion();
                    if (currentQuestion != null)
                    {
                        questionString = string.Format(m_BotBrain.localizer.getString("triviaQuestionCurrent"), getCurrentQuestion().getFormattedTitle());
                    }

                    m_BotBrain.sendDefaultChannelMessage(m_BotBrain.localizer.getString("triviaTimeExpired") + "  " + questionString);
                }
            }
        }