示例#1
0
        /// <summary>
        /// Convert unpacked effect structure to native type
        /// </summary>
        /// <param name="effect"></param>
        /// <returns></returns>
        public static Effect PackEffect(EffectUnpacked effect)
        {
            string sFunc = "PackEffect";

            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.EffectID);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.Type);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.SubType);

            NWNX_PushArgumentFloat(NWNX_Effect, sFunc, effect.Duration);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.ExpiryCalendarDay);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.ExpiryTimeOfDay);

            NWNX_PushArgumentObject(NWNX_Effect, sFunc, effect.Creator);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.SpellID);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.Expose);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.ShowIcon);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.CasterLevel);

            NWNX_PushArgumentEffect(NWNX_Effect, sFunc, effect.LinkLeft);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.LinkLeftValid);
            NWNX_PushArgumentEffect(NWNX_Effect, sFunc, effect.LinkRight);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.LinkRightValid);

            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.NumIntegers);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam0);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam1);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam2);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam3);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam4);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam5);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam6);
            NWNX_PushArgumentInt(NWNX_Effect, sFunc, effect.nParam7);
            NWNX_PushArgumentFloat(NWNX_Effect, sFunc, effect.fParam0);
            NWNX_PushArgumentFloat(NWNX_Effect, sFunc, effect.fParam1);
            NWNX_PushArgumentFloat(NWNX_Effect, sFunc, effect.fParam2);
            NWNX_PushArgumentFloat(NWNX_Effect, sFunc, effect.fParam3);
            NWNX_PushArgumentString(NWNX_Effect, sFunc, effect.sParam0);
            NWNX_PushArgumentString(NWNX_Effect, sFunc, effect.sParam1);
            NWNX_PushArgumentString(NWNX_Effect, sFunc, effect.sParam2);
            NWNX_PushArgumentString(NWNX_Effect, sFunc, effect.sParam3);
            NWNX_PushArgumentString(NWNX_Effect, sFunc, effect.sParam4);
            NWNX_PushArgumentString(NWNX_Effect, sFunc, effect.sParam5);
            NWNX_PushArgumentObject(NWNX_Effect, sFunc, effect.oParam0);
            NWNX_PushArgumentObject(NWNX_Effect, sFunc, effect.oParam1);
            NWNX_PushArgumentObject(NWNX_Effect, sFunc, effect.oParam2);
            NWNX_PushArgumentObject(NWNX_Effect, sFunc, effect.oParam3);

            NWNX_PushArgumentString(NWNX_Effect, sFunc, effect.Tag);

            NWNX_CallFunction(NWNX_Effect, sFunc);
            return(NWNX_GetReturnValueEffect(NWNX_Effect, sFunc));
        }
示例#2
0
        /// <summary>
        /// Convert native effect type to unpacked structure
        /// </summary>
        /// <param name="effect"></param>
        /// <returns></returns>
        public static EffectUnpacked UnpackEffect(Effect effect)
        {
            string sFunc = "UnpackEffect";

            NWNX_PushArgumentEffect(NWNX_Effect, sFunc, effect);
            NWNX_CallFunction(NWNX_Effect, sFunc);

            EffectUnpacked n = new EffectUnpacked
            {
                Tag               = NWNX_GetReturnValueString(NWNX_Effect, sFunc),
                oParam3           = NWNX_GetReturnValueObject(NWNX_Effect, sFunc),
                oParam2           = NWNX_GetReturnValueObject(NWNX_Effect, sFunc),
                oParam1           = NWNX_GetReturnValueObject(NWNX_Effect, sFunc),
                oParam0           = NWNX_GetReturnValueObject(NWNX_Effect, sFunc),
                sParam5           = NWNX_GetReturnValueString(NWNX_Effect, sFunc),
                sParam4           = NWNX_GetReturnValueString(NWNX_Effect, sFunc),
                sParam3           = NWNX_GetReturnValueString(NWNX_Effect, sFunc),
                sParam2           = NWNX_GetReturnValueString(NWNX_Effect, sFunc),
                sParam1           = NWNX_GetReturnValueString(NWNX_Effect, sFunc),
                sParam0           = NWNX_GetReturnValueString(NWNX_Effect, sFunc),
                fParam3           = NWNX_GetReturnValueFloat(NWNX_Effect, sFunc),
                fParam2           = NWNX_GetReturnValueFloat(NWNX_Effect, sFunc),
                fParam1           = NWNX_GetReturnValueFloat(NWNX_Effect, sFunc),
                fParam0           = NWNX_GetReturnValueFloat(NWNX_Effect, sFunc),
                nParam7           = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                nParam6           = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                nParam5           = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                nParam4           = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                nParam3           = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                nParam2           = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                nParam1           = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                nParam0           = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                NumIntegers       = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                LinkRightValid    = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                LinkRight         = NWNX_GetReturnValueEffect(NWNX_Effect, sFunc),
                LinkLeftValid     = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                LinkLeft          = NWNX_GetReturnValueEffect(NWNX_Effect, sFunc),
                CasterLevel       = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                ShowIcon          = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                Expose            = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                SpellID           = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                Creator           = NWNX_GetReturnValueObject(NWNX_Effect, sFunc),
                ExpiryTimeOfDay   = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                ExpiryCalendarDay = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                Duration          = NWNX_GetReturnValueFloat(NWNX_Effect, sFunc),
                SubType           = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                Type              = NWNX_GetReturnValueInt(NWNX_Effect, sFunc),
                EffectID          = NWNX_GetReturnValueInt(NWNX_Effect, sFunc)
            };

            return(n);
        }
示例#3
0
        // Convert native effect type to unpacked structure
        public static EffectUnpacked UnpackEffect(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 Effect(Internal.NativeFunctions.nwnxPopEffect()),
                LinkLeftValid     = Internal.NativeFunctions.nwnxPopInt(),
                LinkLeft          = new 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);
        }
示例#4
0
 // Convert unpacked effect structure to native type
 public static Effect PackEffect(EffectUnpacked effect)
 {
     Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "PackEffect");
     Internal.NativeFunctions.nwnxPushInt(effect.EffectID);
     Internal.NativeFunctions.nwnxPushInt(effect.Type);
     Internal.NativeFunctions.nwnxPushInt(effect.SubType);
     Internal.NativeFunctions.nwnxPushFloat(effect.Duration);
     Internal.NativeFunctions.nwnxPushInt(effect.ExpiryCalendarDay);
     Internal.NativeFunctions.nwnxPushInt(effect.ExpiryTimeOfDay);
     Internal.NativeFunctions.nwnxPushObject(effect.Creator ?? Internal.OBJECT_INVALID);
     Internal.NativeFunctions.nwnxPushInt(effect.SpellID);
     Internal.NativeFunctions.nwnxPushInt(effect.Expose);
     Internal.NativeFunctions.nwnxPushInt(effect.ShowIcon);
     Internal.NativeFunctions.nwnxPushInt(effect.CasterLevel);
     Internal.NativeFunctions.nwnxPushEffect(effect.LinkLeft !.Handle);
     Internal.NativeFunctions.nwnxPushInt(effect.LinkLeftValid);
     Internal.NativeFunctions.nwnxPushEffect(effect.LinkRight !.Handle);
     Internal.NativeFunctions.nwnxPushInt(effect.LinkRightValid);
     Internal.NativeFunctions.nwnxPushInt(effect.NumIntegers);
     Internal.NativeFunctions.nwnxPushInt(effect.nParam0);
     Internal.NativeFunctions.nwnxPushInt(effect.nParam1);
     Internal.NativeFunctions.nwnxPushInt(effect.nParam2);
     Internal.NativeFunctions.nwnxPushInt(effect.nParam3);
     Internal.NativeFunctions.nwnxPushInt(effect.nParam4);
     Internal.NativeFunctions.nwnxPushInt(effect.nParam5);
     Internal.NativeFunctions.nwnxPushInt(effect.nParam6);
     Internal.NativeFunctions.nwnxPushInt(effect.nParam7);
     Internal.NativeFunctions.nwnxPushFloat(effect.fParam0);
     Internal.NativeFunctions.nwnxPushFloat(effect.fParam1);
     Internal.NativeFunctions.nwnxPushFloat(effect.fParam2);
     Internal.NativeFunctions.nwnxPushFloat(effect.fParam3);
     Internal.NativeFunctions.nwnxPushString(effect.sParam0 !);
     Internal.NativeFunctions.nwnxPushString(effect.sParam1 !);
     Internal.NativeFunctions.nwnxPushString(effect.sParam2 !);
     Internal.NativeFunctions.nwnxPushString(effect.sParam3 !);
     Internal.NativeFunctions.nwnxPushString(effect.sParam4 !);
     Internal.NativeFunctions.nwnxPushString(effect.sParam5 !);
     Internal.NativeFunctions.nwnxPushObject(effect.oParam0 ?? Internal.OBJECT_INVALID);
     Internal.NativeFunctions.nwnxPushObject(effect.oParam1 ?? Internal.OBJECT_INVALID);
     Internal.NativeFunctions.nwnxPushObject(effect.oParam2 ?? Internal.OBJECT_INVALID);
     Internal.NativeFunctions.nwnxPushObject(effect.oParam3 ?? Internal.OBJECT_INVALID);
     Internal.NativeFunctions.nwnxPushString(effect.Tag !);
     Internal.NativeFunctions.nwnxCallFunction();
     return(new Effect(Internal.NativeFunctions.nwnxPopEffect()));
 }