Esempio n. 1
0
        /// <summary>
        /// Execute the script in the passed scope.
        /// </summary>
        /// <param name="scope">The ScriptScope the script will execute in.</param>
        public void ExecuteScript(WorldObject caller = null)
        {
            dynamic resolvedCaller;

            if (caller != null)
            {
                if (caller is User)
                {
                    resolvedCaller = new HybrasylUser(caller as User);
                }
                else
                {
                    resolvedCaller = new HybrasylWorldObject(caller);
                }
                Scope.SetVariable("npc", resolvedCaller);
            }

            Scope.SetVariable("world", Processor.World);
            Compiled.Execute(Scope);
        }
Esempio n. 2
0
        /// <summary>
        /// Execute the script in the passed scope.
        /// </summary>
        /// <param name="scope">The ScriptScope the script will execute in.</param>
        public void ExecuteScript(WorldObject caller = null)
        {
            dynamic resolvedCaller;

            if (caller != null)
            {
                if (caller is User)
                    resolvedCaller = new HybrasylUser(caller as User);
                else
                    resolvedCaller = new HybrasylWorldObject(caller);
                Scope.SetVariable("npc", resolvedCaller);
            }

            Scope.SetVariable("world", Processor.World);
            Compiled.Execute(Scope);
        }