예제 #1
0
        public void ExecuteScript(IScriptableQuestSystemObject obj)
        {
            Script script = obj.Script;

            GameDebugger.Log(LogLevel.Debug, "QS: Executing script of {0} '0x{1:X16}'", obj.GetType().Name, obj.Id);
            if (script == null)
            {
                GameDebugger.Log(LogLevel.Debug, "QS: no script to execute");
                return;
            }
            script.Run(this);
            GameDebugger.Log(LogLevel.Debug, "QS: done");
        }
예제 #2
0
        public bool CheckCondition(IScriptableQuestSystemObject obj, bool defaultvalue)
        {
            Script script = obj.Script;

            GameDebugger.Log(LogLevel.Debug, "QS: Executing condition of {0} '0x{1:X16}'", obj.GetType().Name, obj.Id);
            if (script == null)
            {
                GameDebugger.Log(LogLevel.Debug, "QS: no script to execute, result={0}", defaultvalue);
                return(defaultvalue);
            }
            if (Player == null)
            {
                GameDebugger.Log(LogLevel.Debug, "QS: WHERE DID THE PLAYER GO?!");
            }
            dynamic result = script.Run(this);

            if (!(result is Boolean))
            {
                GameDebugger.Log(LogLevel.Warning, "Condition script exits with a non boolean result ({0}) on {1} '0x{2:X16}'", result.GetType().Name, obj.GetType().Name, obj.Id);
                return(false);
            }
            GameDebugger.Log(LogLevel.Debug, "QS: done. result={0}", (bool)result);
            return((bool)result);
        }