Ejemplo n.º 1
0
 public static Core.ItemProperty EffectToItemProperty(Core.Effect effect)
 {
     Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "EffectTypeCast");
     Internal.NativeFunctions.nwnxPushEffect(effect.Handle);
     Internal.NativeFunctions.nwnxCallFunction();
     return(new Core.ItemProperty(Internal.NativeFunctions.nwnxPopItemProperty()));
 }
Ejemplo n.º 2
0
        /// @brief replace an already applied effect on an object
        /// Only duration, subtype, tag and spell related fields can be overwritten.
        /// @note eNew and eOld need to have the same type.
        /// @return Number of internal effects updated.
        public static int ReplaceEffect(uint obj, Core.Effect eOld, Core.Effect eNew)
        {
            Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "ReplaceEffect");
            Internal.NativeFunctions.nwnxPushEffect(eNew);
            Internal.NativeFunctions.nwnxPushEffect(eOld);
            Internal.NativeFunctions.nwnxPushObject(obj);

            return(Internal.NativeFunctions.nwnxPopInt());
        }
Ejemplo n.º 3
0
 // Set a script with optional data that runs when an effect expires
 // Only works for TEMPORARY and PERMANENT effects applied to an object
 // Note: OBJECT_SELF in the script is the object the effect is applied to
 public static Core.Effect SetEffectExpiredScript(Core.Effect effect, string script, string data = "")
 {
     Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "SetEffectExpiredScript");
     Internal.NativeFunctions.nwnxPushString(data);
     Internal.NativeFunctions.nwnxPushString(script);
     Internal.NativeFunctions.nwnxPushEffect(effect.Handle);
     Internal.NativeFunctions.nwnxCallFunction();
     return(new Core.Effect(Internal.NativeFunctions.nwnxPopEffect()));
 }
Ejemplo n.º 4
0
        // Convert native effect type to unpacked structure
        public static EffectUnpacked UnpackEffect(Core.Effect effect)
        {
            Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "GetCurrentNodeType");
            Internal.NativeFunctions.nwnxPushEffect(effect.Handle);
            Internal.NativeFunctions.nwnxCallFunction();

            var newEffect = new EffectUnpacked
            {
                Tag               = Internal.NativeFunctions.nwnxPopString(),
                oParam3           = Internal.NativeFunctions.nwnxPopObject(),
                oParam2           = Internal.NativeFunctions.nwnxPopObject(),
                oParam1           = Internal.NativeFunctions.nwnxPopObject(),
                oParam0           = Internal.NativeFunctions.nwnxPopObject(),
                sParam5           = Internal.NativeFunctions.nwnxPopString(),
                sParam4           = Internal.NativeFunctions.nwnxPopString(),
                sParam3           = Internal.NativeFunctions.nwnxPopString(),
                sParam2           = Internal.NativeFunctions.nwnxPopString(),
                sParam1           = Internal.NativeFunctions.nwnxPopString(),
                sParam0           = Internal.NativeFunctions.nwnxPopString(),
                fParam3           = Internal.NativeFunctions.nwnxPopFloat(),
                fParam2           = Internal.NativeFunctions.nwnxPopFloat(),
                fParam1           = Internal.NativeFunctions.nwnxPopFloat(),
                fParam0           = Internal.NativeFunctions.nwnxPopFloat(),
                nParam7           = Internal.NativeFunctions.nwnxPopInt(),
                nParam6           = Internal.NativeFunctions.nwnxPopInt(),
                nParam5           = Internal.NativeFunctions.nwnxPopInt(),
                nParam4           = Internal.NativeFunctions.nwnxPopInt(),
                nParam3           = Internal.NativeFunctions.nwnxPopInt(),
                nParam2           = Internal.NativeFunctions.nwnxPopInt(),
                nParam1           = Internal.NativeFunctions.nwnxPopInt(),
                nParam0           = Internal.NativeFunctions.nwnxPopInt(),
                NumIntegers       = Internal.NativeFunctions.nwnxPopInt(),
                LinkRightValid    = Internal.NativeFunctions.nwnxPopInt(),
                LinkRight         = new Core.Effect(Internal.NativeFunctions.nwnxPopEffect()),
                LinkLeftValid     = Internal.NativeFunctions.nwnxPopInt(),
                LinkLeft          = new Core.Effect(Internal.NativeFunctions.nwnxPopEffect()),
                CasterLevel       = Internal.NativeFunctions.nwnxPopInt(),
                ShowIcon          = Internal.NativeFunctions.nwnxPopInt(),
                Expose            = Internal.NativeFunctions.nwnxPopInt(),
                SpellID           = Internal.NativeFunctions.nwnxPopInt(),
                Creator           = Internal.NativeFunctions.nwnxPopObject(),
                ExpiryTimeOfDay   = Internal.NativeFunctions.nwnxPopInt(),
                ExpiryCalendarDay = Internal.NativeFunctions.nwnxPopInt(),
                Duration          = Internal.NativeFunctions.nwnxPopFloat(),
                SubType           = Internal.NativeFunctions.nwnxPopInt(),
                Type              = Internal.NativeFunctions.nwnxPopInt(),
                EffectID          = Internal.NativeFunctions.nwnxPopInt()
            };

            return(newEffect);
        }
Ejemplo n.º 5
0
 public static void NWNX_PushArgumentEffect(string pluginName, string functionName, Core.Effect value)
 {
     NWScript.NWScript.TagEffect(value, NWNX_INTERNAL_BuildString(pluginName, functionName, "PUSH"));
 }