Example #1
0
        /// <summary>
        /// Acopla al saludo la timestamp caracteristica de los mensajes.
        /// </summary>
        /// <returns>String con el saludo.</returns>
        public string SayHello()
        {
            string greeting     = this.SelectGreeting();
            string finalMessage = DateTimeHandler.GetString("time") + " | " + this.name + ": " + greeting;

            return(finalMessage);
        }
Example #2
0
        /// <summary>
        /// Obtener el saludo pertinente utilizando factores relevantes como la hora.
        /// </summary>
        /// <returns>String con el saludo correspondiente.</returns>
        private string SelectGreeting()
        {
            if ((Utilities.RandInt() % 2) == 0)
            {
                return(this.genericGreeting);
            }

            int[] time = new int[3];
            time = DateTimeHandler.GetTime();

            if ((time[0] >= 6) && (time[0] < 12))
            {
                return(this.morningGreeting);
            }

            else if ((time[0] >= 12) && (time[0] < 20))
            {
                return(this.afternoonGreeting);
            }

            else
            {
                return(this.eveningGreeting);
            }
        }
Example #3
0
        /// <summary>
        /// Selecciona el mensaje respuesta en base a la entrada del usuario.
        /// </summary>
        /// <param name="input">Mensaje ingresado por el usuario</param>
        /// <returns>String con la respuesta del chatbot.</returns>
        public string SelectMessage(string input)
        {
            string[] keywordSet1 = { "comprar", "escudo" };
            string[] keywordSet2 = { "comprar", "espadon" };
            string[] keywordSet3 = { "comprar", "tomo" };
            string[] keywordSet4 = { "comprar", "piedra" };
            string[] keywordSet5 = { "comprar", "pocion" };
            string[] keywordSet6 = { "comprar" };

            string[] keywordSet7  = { "hablame", "escudo" };
            string[] keywordSet8  = { "hablame", "espadon" };
            string[] keywordSet9  = { "hablame", "tomo" };
            string[] keywordSet10 = { "hablame", "piedra" };
            string[] keywordSet11 = { "hablame", "pocion" };

            string[] keywordSet12 = { "vender" };
            string[] keywordSet13 = { "escuchado", "interesante" };

            string finalMessage;

            if (Utilities.AreKeywordsInInput(keywordSet1, input))
            {
                if (MainForm.user.cashIsEnough(1500))
                {
                    finalMessage = DateTimeHandler.GetString("time") + " | " + name + ": " + buyingArticles[0];
                    MainForm.user.diminishCurrency(1500);
                }

                else
                {
                    finalMessage = notEnough;
                }

                return(finalMessage);
            }

            else if (Utilities.AreKeywordsInInput(keywordSet2, input))
            {
                if (MainForm.user.cashIsEnough(1750))
                {
                    finalMessage = DateTimeHandler.GetString("time") + " | " + name + ": " + buyingArticles[1];
                    MainForm.user.diminishCurrency(1750);
                }

                else
                {
                    finalMessage = notEnough;
                }

                return(finalMessage);
            }

            else if (Utilities.AreKeywordsInInput(keywordSet3, input))
            {
                if (MainForm.user.cashIsEnough(1000))
                {
                    finalMessage = DateTimeHandler.GetString("time") + " | " + name + ": " + buyingArticles[2];
                    MainForm.user.diminishCurrency(1000);
                }

                else
                {
                    finalMessage = notEnough;
                }

                return(finalMessage);
            }

            else if (Utilities.AreKeywordsInInput(keywordSet4, input))
            {
                if (MainForm.user.cashIsEnough(2500))
                {
                    finalMessage = DateTimeHandler.GetString("time") + " | " + name + ": " + buyingArticles[3];
                    MainForm.user.diminishCurrency(2500);
                }

                else
                {
                    finalMessage = notEnough;
                }

                return(finalMessage);
            }

            else if (Utilities.AreKeywordsInInput(keywordSet5, input))
            {
                if (MainForm.user.cashIsEnough(250))
                {
                    finalMessage = DateTimeHandler.GetString("time") + " | " + name + ": " + buyingArticles[4];
                    MainForm.user.diminishCurrency(250);
                }

                else
                {
                    finalMessage = notEnough;
                }

                return(finalMessage);
            }

            else if (Utilities.AreKeywordsInInput(keywordSet6, input))
            {
                finalMessage = DateTimeHandler.GetString("time") + " | " + name + ": " + buyingResponses[Utilities.RandInt() % 2] + "\n" + merchandise;
                return(finalMessage);
            }

            else if (Utilities.AreKeywordsInInput(keywordSet7, input))
            {
                finalMessage = DateTimeHandler.GetString("time") + " | " + name + ": " + articlesInfo[0];
                return(finalMessage);
            }

            else if (Utilities.AreKeywordsInInput(keywordSet8, input))
            {
                finalMessage = DateTimeHandler.GetString("time") + " | " + name + ": " + articlesInfo[1];
                return(finalMessage);
            }

            else if (Utilities.AreKeywordsInInput(keywordSet9, input))
            {
                finalMessage = DateTimeHandler.GetString("time") + " | " + name + ": " + articlesInfo[2];
                return(finalMessage);
            }

            else if (Utilities.AreKeywordsInInput(keywordSet10, input))
            {
                finalMessage = DateTimeHandler.GetString("time") + " | " + name + ": " + articlesInfo[3];
                return(finalMessage);
            }

            else if (Utilities.AreKeywordsInInput(keywordSet11, input))
            {
                finalMessage = DateTimeHandler.GetString("time") + " | " + name + ": " + articlesInfo[4];
                return(finalMessage);
            }

            else if (Utilities.AreKeywordsInInput(keywordSet12, input))
            {
                finalMessage = DateTimeHandler.GetString("time") + " | " + name + ": " + this.sellingResponse;
                return(finalMessage);
            }

            else if (Utilities.AreKeywordsInInput(keywordSet13, input))
            {
                finalMessage = DateTimeHandler.GetString("time") + " | " + name + ": " + rumours[Utilities.RandInt() % 3];
                return(finalMessage);
            }

            else
            {
                finalMessage = DateTimeHandler.GetString("time") + " | " + name + ": " + misheard[Utilities.RandInt() % 3];
                return(finalMessage);
            }
        }
Example #4
0
        /// <summary>
        /// Acopla al mensaje de despedida la timestamp caracteristica de los mensajes.
        /// </summary>
        /// <returns>String con el despido.</returns>
        public string SayGoodbye()
        {
            string finalMessage = DateTimeHandler.GetString("time") + " | " + this.name + ": " + farewell;

            return(finalMessage);
        }