Example #1
0
        private string FavoriteQuestion()
        {
            int    index        = question.IndexOf("favorite");
            string objectWanted = question[++index];

            if (!favoriteShit.ContainsKey(objectWanted))
            {
                string eventMessage = "I don't have a favorite " + objectWanted + ". I only have a favorite";
                foreach (string s in shitIKnow.Keys)
                {
                    eventMessage += $" {s}";
                }

                UnknownQuestion?.Invoke(this, new UnknownEventArgs(lastQuestion, eventMessage));
                return(string.Empty);
            }

            return(favoriteShit[objectWanted]);
        }
Example #2
0
        private void HandleQuesiton()
        {
            if (question == null)
            {
                UnknownQuestion?.Invoke(this, new UnknownEventArgs("NONE", "No Question Given"));
            }

            string localQuestion = string.Empty;
            string awnser        = string.Empty;

            for (int i = 0; i < question.Count; i++)
            {
                localQuestion += $"{question[i]} ";
            }

            if (timesQuestionAsked >= frustationThreshold && frustationThreshold != 0)
            {
                Frustrated?.Invoke(this, new FrustrationEventArgs(localQuestion));
                return;
            }

            if (IsKnowEverythinQuestion())
            {
                KnowEverythingAsked?.Invoke(this, new KnowEverythingArgs(localQuestion));
            }
            else if (IsAbout())
            {
                awnser = aboutAwnser;
            }
            else if (IsRemember())
            {
                awnser = Remember();
                RememberSomething?.Invoke(this, new QuestionAwnseredEventArgs(localQuestion, awnser));
            }
            else if (IsYesNo())
            {
                awnser = AwnserYesNo();
                YesNoQuestion?.Invoke(this, new YesNoEventArgs(localQuestion, awnser));
            }
            else if (IsChoice())
            {
                string[] choices = GetChoices();
                awnser = AwnserChoice(choices);
                ChoiceAwnsered?.Invoke(this, new ChoiceEventArgs(localQuestion, awnser, choices));
            }
            else if (IsFavorite())
            {
                awnser = FavoriteQuestion();
                FavoriteAwnsered?.Invoke(this, new QuestionAwnseredEventArgs(localQuestion, awnser));
            }
            else if (IsEncode())
            {
                localQuestion = localQuestion.Remove(0, 7);
                EncodedMessage?.Invoke(this, new EncodingEventArgs(localQuestion));
                return;
            }
            else if (IsInsult())
            {
                Insulted?.Invoke(this, new InsultEventArgs());
            }
            else
            {
                UnknownQuestion?.Invoke(this, new UnknownEventArgs(localQuestion));
            }

            QuestionAwnsered?.Invoke(this, new QuestionAwnseredEventArgs(localQuestion, awnser));
        }