Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MoveUseItemEventFactory"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="scriptFactory">A reference to the script factory.</param>
        public MoveUseItemEventFactory(ILogger logger, IScriptApi scriptFactory)
        {
            logger.ThrowIfNull(nameof(logger));
            scriptFactory.ThrowIfNull(nameof(scriptFactory));

            this.Logger        = logger;
            this.ScriptFactory = scriptFactory;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MoveUseScriptApiAdapter"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="scriptApi">A reference to the script api in use.</param>
        public MoveUseScriptApiAdapter(
            ILogger logger,
            IScriptApi scriptApi)
        {
            logger.ThrowIfNull(nameof(logger));
            scriptApi.ThrowIfNull(nameof(scriptApi));

            this.Logger    = logger.ForContext <MoveUseScriptApiAdapter>();
            this.ScriptApi = scriptApi;
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MoveUseEventRulesLoader"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger instance.</param>
        /// <param name="options">The options for this loader.</param>
        /// <param name="scriptFactory">A reference to the script factory in use.</param>
        public MoveUseEventRulesLoader(
            ILogger logger,
            IOptions <MoveUseEventRulesLoaderOptions> options,
            IScriptApi scriptFactory)
        {
            logger.ThrowIfNull(nameof(logger));
            options.ThrowIfNull(nameof(options));
            scriptFactory.ThrowIfNull(nameof(scriptFactory));

            this.LoaderOptions = options.Value;
            this.Logger        = logger.ForContext <MoveUseEventRulesLoader>();

            this.ItemEventFactory = new MoveUseItemEventFactory(logger, scriptFactory);
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MoveUseEventRule"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="scriptApi">A reference to the script factory in use.</param>
        /// <param name="conditionSet">The conditions for this event.</param>
        /// <param name="actionSet">The actions of this event.</param>
        public MoveUseEventRule(ILogger logger, IScriptApi scriptApi, IList <string> conditionSet, IList <string> actionSet)
        {
            logger.ThrowIfNull(nameof(logger));
            scriptApi.ThrowIfNull(nameof(scriptApi));

            this.ScriptFactory = scriptApi;
            this.Logger        = logger.ForContext(this.GetType());

            this.Conditions = this.ParseRules(conditionSet);
            this.Actions    = this.ParseRules(actionSet);

            this.Adapter = new MoveUseScriptApiAdapter(logger, scriptApi);

            this.isSetup = false;
        }