Exemple #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);
            });
        }
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     variableTypeStore = dataStoreManager.Get("ConjugationTypes");
     variableStore     = dataStoreManager.Get("Variables");
     irregularStore    = dataStoreManager.Get("Irregulars");
     conjugator        = new Conjugator(irregularStore);
 }
        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;
            });
        }
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     variableTypeStore = dataStoreManager.Get("ConjugationTypes");
     variableStore = dataStoreManager.Get("Variables");
     irregularStore = dataStoreManager.Get("Irregulars");
     conjugator = new Conjugator(irregularStore);
 }
Exemple #5
0
        public void Initialize(IDataStoreManager dataStoreManager)
        {
            quotesDataStore = dataStoreManager.Get("Quotes");

            variableHandler.DefineMagicVariable("quote",
                                                msg =>
                                                GetRandomQuoteFromAnyUser());
        }
Exemple #6
0
        private void InitFramework()
        {
            IDataStoreManager      storeManager   = ServiceLocator.Current.GetInstance <IDataStoreManager>();
            EntityResolver         entityResolver = ServiceLocator.Current.GetInstance <EntityResolver>();
            IBusinessObjectFactory factory        = ServiceLocator.Current.GetInstance <IBusinessObjectFactory>();

            UnitOfWorkFactory.Instance.Initialize(storeManager, entityResolver, entityResolver, factory);
        }
        public void Initialize(IDataStoreManager dataStoreManager)
        {
            quotesDataStore = dataStoreManager.Get("Quotes");

            variableHandler.DefineMagicVariable("quote",
                                                msg =>
                                                GetRandomQuoteFromAnyUser());
        }
Exemple #8
0
 public DataStoreTest(
     IDataStoreManager dataStoreManager,
     IDataCacheManager dataCacheManager,
     ILogger <DataStoreTest> logger)
 {
     _dataStoreManager = dataStoreManager;
     _dataCacheManager = dataCacheManager;
     _logger           = logger;
 }
 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);
 }
Exemple #10
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);
        }
Exemple #11
0
        public MessageProcessOverseer(IDataStoreManager dataStoreManager,
                                      IVariableHandler variableHandler)
        {
            this.dataStoreManager = dataStoreManager;
            this.variableHandler  = variableHandler;

            messageListeners    = new List <IMessageListener>();
            messageProducers    = new List <IMessageProducer>();
            messageReactors     = new List <IMessageReactor>();
            messageTransformers = new List <IMessageTransformer>();
        }
        public MessageProcessOverseer(IDataStoreManager dataStoreManager,
                               IVariableHandler variableHandler)
        {
            this.dataStoreManager = dataStoreManager;
            this.variableHandler = variableHandler;

            messageListeners = new List<IMessageListener>();
            messageProducers = new List<IMessageProducer>();
            messageReactors = new List<IMessageReactor>();
            messageTransformers = new List<IMessageTransformer>();
        }
Exemple #13
0
        public void Constructor_ThrowsException_WhenNullParamPassed()
        {
            //Arrange
            IDataStoreManager mockedDataStoreManager = null;
            ReportHelper      reportHelper;
            bool exceptionThrow = false;

            try
            {
                //Act
                reportHelper = new ReportHelper(mockedDataStoreManager);
            }
            catch (ArgumentNullException)
            {
                exceptionThrow = true;
            }
            //Assert
            Assert.IsTrue(exceptionThrow);
        }
Exemple #14
0
        private async Task LoadCreatureEntries()
        {
            IDataStoreManager datastore = GrainFactory.GetGrain <IDataStoreManager>(0);

            //get all creatures for my map!
            var creatures = await datastore.GetCreatureEntriesByMap(State.MapID);

            //add them to their cells
            foreach (var cre in creatures)
            {
                var cellkey = GetCellKey(cre.position_x, cre.position_y);

                if (CreatureEntryByCellKey.ContainsKey(cellkey))
                {
                    CreatureEntryByCellKey[cellkey].Add(cre);
                }
                else
                {
                    List <CreatureEntry> l = new List <CreatureEntry>();
                    l.Add(cre);
                    CreatureEntryByCellKey.Add(cellkey, l);
                }
            }
        }
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     quotesDataStore = dataStoreManager.Get("Quotes");
 }
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     tlaDataStore = dataStoreManager.Get("TLAs");
 }
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     dataStore = dataStoreManager.Get("Factoids");
 }
Exemple #18
0
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     dataStore = dataStoreManager.Get("Factoids");
 }
Exemple #19
0
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     invDataStore = dataStoreManager.Get("Inventory");
 }
Exemple #20
0
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     tlaDataStore = dataStoreManager.Get("TLAs");
 }
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     ratingsStore = dataStoreManager.Get("Ratings");
 }
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     variableStore = dataStoreManager.Get("Variables");
 }
 public void Initialize(IDataStoreManager dataStoreManager)
 {}
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     factoidDataStore = dataStoreManager.Get("Factoids");
     tlaDataStore     = dataStoreManager.Get("TLAs");
 }
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     factoidDataStore = dataStoreManager.Get("Factoids");
     tlaDataStore = dataStoreManager.Get("TLAs");
 }
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     invDataStore = dataStoreManager.Get("Inventory");
 }
Exemple #27
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);
            }
        }
Exemple #28
0
 public ReportHelper(IDataStoreManager dataStoreManager)
 {
     _DataStoreManager = dataStoreManager ?? throw new ArgumentNullException("dataStoreManager cannot be null");
 }
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     variableStore = dataStoreManager.Get("Variables");
 }
Exemple #30
0
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     quotesDataStore = dataStoreManager.Get("Quotes");
 }
        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);
        }
Exemple #32
0
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     // nothing to be done
 }
Exemple #33
0
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     throw new NotImplementedException();
 }
 public void Initialize(IDataStoreManager dataStoreManager)
 {
 }
Exemple #35
0
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     ratingsStore = dataStoreManager.Get("Ratings");
 }
Exemple #36
0
        public async Task CreatePlayer(CMSG_CHAR_CREATE create)
        {
            IDataStoreManager datastore = GrainFactory.GetGrain <IDataStoreManager>(0);

            var createinfo = await datastore.GetPlayerCreateInfo(create.Class, create.Race);

            if (createinfo == null)
            {
                await SendCharCreateReply(LoginErrorCode.CHAR_CREATE_ERROR);

                return;
            }

            var plrnameindex  = GrainFactory.GetGrain <IPlayerByNameIndex>(create.Name);
            var guidnameindex = await plrnameindex.GetPlayerGUID();

            if (guidnameindex != 0)
            {
                await SendCharCreateReply(LoginErrorCode.CHAR_CREATE_NAME_IN_USE);

                return;
            }

            var chrclass = await datastore.GetChrClasses(create.Class);

            var chrrace = await datastore.GetChrRaces(create.Race);

            if (chrclass == null || chrrace == null)
            {
                await SendCharCreateReply(LoginErrorCode.CHAR_CREATE_ERROR);

                return;
            }

            var chars = GetCharacters(RealmSessionRealmID);

            if (chars != null && chars.Length >= 10) //todo: add max
            {
                await SendCharCreateReply(LoginErrorCode.CHAR_CREATE_SERVER_LIMIT);

                return;
            }

            var creator = GrainFactory.GetGrain <ICreator>(0);

            //OK LETS CREATE
            PlayerCreateData info = new PlayerCreateData();

            info.CreateData  = create;
            info.RealmID     = RealmSessionRealmID;
            info.AccountName = this.GetPrimaryKeyString();

            var create_response = await creator.CreatePlayer(info);

            if (create_response.Item1 != LoginErrorCode.CHAR_CREATE_SUCCESS)
            {
                await SendCharCreateReply(create_response.Item1);

                return;
            }
            await plrnameindex.SetPlayer(create_response.Item2);

            await SendCharCreateReply(LoginErrorCode.CHAR_CREATE_SUCCESS);

            await CreateCharacterListEntryForPlayer(info, create_response.Item2);
        }
 public void Initialize(IDataStoreManager dataStoreManager)
 {
     // nothing to be done
 }