public static ItemPropertyUnpacked UnpackIP(ItemProperty ip) { const string FunctionName = "UnpackIP"; NWNXCore.NWNX_PushArgumentItemProperty(NWNX_ItemProperty, FunctionName, ip); NWNXCore.NWNX_CallFunction(NWNX_ItemProperty, FunctionName); var n = new ItemPropertyUnpacked { ItemPropertyID = NWNXCore.NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), Property = NWNXCore.NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), SubType = NWNXCore.NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), CostTable = NWNXCore.NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), CostTableValue = NWNXCore.NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), Param1 = NWNXCore.NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), Param1Value = NWNXCore.NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), UsesPerDay = NWNXCore.NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), ChanceToAppear = NWNXCore.NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), IsUseable = Convert.ToBoolean(NWNXCore.NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName)), SpellID = NWNXCore.NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), Creator = NWNXCore.NWNX_GetReturnValueObject(NWNX_ItemProperty, FunctionName), Tag = NWNXCore.NWNX_GetReturnValueString(NWNX_ItemProperty, FunctionName) }; return(n); }
// Convert unpacked itemproperty structure to native type. public static Core.ItemProperty PackIP(ItemPropertyUnpacked itemProperty) { Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "PackIP"); Internal.NativeFunctions.nwnxPushString(itemProperty.Tag); Internal.NativeFunctions.nwnxPushObject(itemProperty.Creator ?? Internal.OBJECT_INVALID); Internal.NativeFunctions.nwnxPushInt(itemProperty.SpellID); Internal.NativeFunctions.nwnxPushInt(itemProperty.IsUseable ? 1 : 0); Internal.NativeFunctions.nwnxPushInt(itemProperty.ChanceToAppear); Internal.NativeFunctions.nwnxPushInt(itemProperty.UsesPerDay); Internal.NativeFunctions.nwnxPushInt(itemProperty.Param1Value); Internal.NativeFunctions.nwnxPushInt(itemProperty.Param1); Internal.NativeFunctions.nwnxPushInt(itemProperty.CostTableValue); Internal.NativeFunctions.nwnxPushInt(itemProperty.CostTable); Internal.NativeFunctions.nwnxPushInt(itemProperty.SubType); Internal.NativeFunctions.nwnxPushInt(itemProperty.Property); Internal.NativeFunctions.nwnxCallFunction(); return(new Core.ItemProperty(Internal.NativeFunctions.nwnxPopItemProperty())); }
// Convert unpacked itemproperty structure to native type. public static Core.ItemProperty PackIP(ItemPropertyUnpacked itemProperty) { const string sFunc = "PackIP"; NWNXCore.NWNX_PushArgumentString(PLUGIN_NAME, sFunc, itemProperty.Tag); NWNXCore.NWNX_PushArgumentObject(PLUGIN_NAME, sFunc, itemProperty.Creator); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.SpellID); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.IsUseable ? 1 : 0); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.ChanceToAppear); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.UsesPerDay); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.Param1Value); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.Param1); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.CostTableValue); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.CostTable); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.SubType); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.Property); NWNXCore.NWNX_CallFunction(PLUGIN_NAME, sFunc); return(NWNXCore.NWNX_GetReturnValueItemProperty(PLUGIN_NAME, sFunc)); }