Ejemplo n.º 1
0
        public void Initialize(IDataStoreManager dataStoreManager)
        {
            random = new Random();

            variableHandler.DefineMagicVariable("who", (message) =>
            {
                LastReferencedPerson = message.Who;
                return(message.Who);
            });

            variableHandler.DefineMagicVariable("to", (message) =>
            {
                var person = message.To ??
                             GetSomeone(message.Where) ?? message.Who;
                LastReferencedPerson = person;
                return(person);
            });

            variableHandler.DefineMagicVariable("someone", (message) =>
            {
                var person           = GetSomeone(message.Where) ?? message.Who;
                LastReferencedPerson = person;
                return(person);
            });
        }
Ejemplo n.º 2
0
        public void Initialize(IDataStoreManager dataStoreManager)
        {
            invDataStore     = dataStoreManager.Get("Inventory");
            factoidDataStore = dataStoreManager.Get("Factoids");

            variableHandler.DefineMagicVariable("item", GetRandomItem);
            variableHandler.DefineMagicVariable("giveitem", GetRandomItemAndDiscard);
            variableHandler.DefineMagicVariable("newitem", GetNewItem);
        }
Ejemplo n.º 3
0
        public void Initialize(IDataStoreManager dataStoreManager)
        {
            quotesDataStore = dataStoreManager.Get("Quotes");

            variableHandler.DefineMagicVariable("quote",
                                                msg =>
                                                GetRandomQuoteFromAnyUser());
        }
 public AcronymExpansionReactor(IVariableHandler variableHandler)
 {
     variableHandler.DefineMagicVariable("tla", msg => tlaDataStore.GetRandomValue().Value);
     variableHandler.DefineMagicVariable("band", msg => tlaDataStore.GetRandomValue().Value);
 }
Ejemplo n.º 5
0
        public void Initialize(IDataStoreManager dataStoreManager)
        {
            genderStore = dataStoreManager.Get("Genders");

            var subjectivePronouns = new Dictionary <Gender, string>
            {
                { Gender.Androgynous, "they" },
                { Gender.Male, "he" },
                { Gender.Female, "she" },
                { Gender.Inanimate, "it" }
            };

            var objectivePronouns = new Dictionary <Gender, string>
            {
                { Gender.Androgynous, "them" },
                { Gender.Male, "him" },
                { Gender.Female, "her" },
                { Gender.Inanimate, "it" }
            };

            var reflexivePronouns = new Dictionary <Gender, string>
            {
                { Gender.Androgynous, "themself" },
                { Gender.Male, "himself" },
                { Gender.Female, "herself" },
                { Gender.Inanimate, "itself" }
            };

            var possessivePronouns = new Dictionary <Gender, string>
            {
                { Gender.Androgynous, "theirs" },
                { Gender.Male, "his" },
                { Gender.Female, "hers" },
                { Gender.Inanimate, "its" }
            };

            var possessiveDeterminers = new Dictionary <Gender, string>
            {
                { Gender.Androgynous, "their" },
                { Gender.Male, "his" },
                { Gender.Female, "her" },
                { Gender.Inanimate, "its" }
            };

            var subjectiveHandler =
                new Func <IMessage, string>(
                    (IMessage context) =>
                    subjectivePronouns[
                        GetGender(KnownPeopleListener.LastReferencedPerson)]);
            var objectiveHandler =
                new Func <IMessage, string>(
                    (IMessage context) =>
                    objectivePronouns[
                        GetGender(KnownPeopleListener.LastReferencedPerson)]);
            var reflexiveHandler =
                new Func <IMessage, string>(
                    (IMessage context) =>
                    reflexivePronouns[
                        GetGender(KnownPeopleListener.LastReferencedPerson)]);
            var possessiveHandler =
                new Func <IMessage, string>(
                    (IMessage context) =>
                    possessivePronouns[
                        GetGender(KnownPeopleListener.LastReferencedPerson)]);
            var possessiveDHandler =
                new Func <IMessage, string>(
                    (IMessage context) =>
                    possessiveDeterminers[
                        GetGender(KnownPeopleListener.LastReferencedPerson)]);

            foreach (
                var pronoun in
                new[]
                { "subjective", "shehe", "heshe", "he", "she", "they", "it" })
            {
                variableHandler.DefineMagicVariable(pronoun, subjectiveHandler);
            }
            foreach (
                var pronoun in
                new[]
                { "objective", "him", "her", "them", "himher", "herhim" })
            {
                variableHandler.DefineMagicVariable(pronoun, objectiveHandler);
            }
            foreach (
                var pronoun in
                new[]
            {
                "reflexive", "himselfherself", "herselfhimself", "himself",
                "herself", "themself", "itself"
            })
            {
                variableHandler.DefineMagicVariable(pronoun, reflexiveHandler);
            }
            foreach (
                var pronoun in
                new[] { "possessive", "hishers", "hershis", "hers", "theirs" }
                )
            {
                variableHandler.DefineMagicVariable(pronoun, possessiveHandler);
            }
            foreach (
                var pronoun in new[] { "determiner", "hisher", "herhis", "their" }
                )
            {
                variableHandler.DefineMagicVariable(pronoun, possessiveDHandler);
            }
        }
Ejemplo n.º 6
0
 public AcronymExpansionReactor(IVariableHandler variableHandler)
 {
     variableHandler.DefineMagicVariable("tla", msg => tlaDataStore.GetRandomValue().Value);
     variableHandler.DefineMagicVariable("band", msg => tlaDataStore.GetRandomValue().Value);
 }