Esempio 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;
                        }
                    }
                }
            }
        }
Esempio 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()));
            }
        }
Esempio 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);
        }
Esempio 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);
                }
            }
        }