Ejemplo n.º 1
0
        /// <summary>
        /// Validates the types using for invoking functions
        /// </summary>
        public void ValidateTypes()
        {
            if (m_InvokeType == null || m_InvokeFunction == null)
            {
                m_Invoke = false;
                return;
            }

            m_Type = DialogNPC.FindType(m_InvokeType);
            if (m_Type == null)
            {
                m_Invoke = false;
                return;
            }

            m_Method = m_Type.GetMethod(m_InvokeFunction);

            if (m_Method == null || !m_Method.IsStatic)
            {
                m_Type   = null;
                m_Method = null;

                m_Invoke = false;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Verifies if the types for the player backpack and
        /// </summary>
        public void ValidateTypes()
        {
            Type t = null;

            // Item in backpack
            if (m_ReactToItemInBackpack && m_TypeBackpack != null)
            {
                t = ScriptCompiler.FindTypeByName(m_TypeBackpack, true);

                if (t == null)
                {
                    t = ScriptCompiler.FindTypeByFullName(m_TypeBackpack, true);
                }

                m_ItemType = t;

                if (t == null)                   // If the item doesn't exist, don't bother checking
                {
                    m_ReactToItemInBackpack = false;
                }
            }

            // Item given
            if (m_ReactToItemGiven && m_TypeGiven != null)
            {
                t = ScriptCompiler.FindTypeByName(m_TypeGiven, true);

                if (t == null)
                {
                    t = ScriptCompiler.FindTypeByFullName(m_TypeGiven, true);
                }

                m_ItemGivenType = t;

                if (t == null)
                {
                    m_ReactToItemGiven = false;
                }
            }

            // Function
            if (m_TriggerFunction)
            {
                t = DialogNPC.FindType(m_FunctionType);
                if (t == null)
                {
                    m_TriggerFunction = false;
                    return;
                }

                m_Method = t.GetMethod(m_FunctionName, new Type[] { typeof(DialogNPC), typeof(Mobile) });

                if (m_Method == null)
                {
                    m_TriggerFunction = false;
                }
            }
        }