public static ItemPropertyUnpacked UnpackIP(ItemProperty ip) { const string FunctionName = "UnpackIP"; NWNX_PushArgumentItemProperty(NWNX_ItemProperty, FunctionName, ip); NWNX_CallFunction(NWNX_ItemProperty, FunctionName); var n = new ItemPropertyUnpacked { ItemPropertyID = NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), Property = NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), SubType = NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), CostTable = NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), CostTableValue = NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), Param1 = NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), Param1Value = NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), UsesPerDay = NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), ChanceToAppear = NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), IsUseable = Convert.ToBoolean(NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName)), SpellID = NWNX_GetReturnValueInt(NWNX_ItemProperty, FunctionName), Creator = NWNX_GetReturnValueObject(NWNX_ItemProperty, FunctionName), Tag = NWNX_GetReturnValueString(NWNX_ItemProperty, FunctionName) }; return(n); }
// Convert unpacked itemproperty structure to native type. public static 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)); }
public static ItemProperty PackIP(ItemPropertyUnpacked n) { const string sFunc = "PackIP"; NWNX_PushArgumentString(NWNX_ItemProperty, sFunc, n.Tag); NWNX_PushArgumentObject(NWNX_ItemProperty, sFunc, n.Creator); NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.SpellID); NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.IsUseable ? 1 : 0); NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.ChanceToAppear); NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.UsesPerDay); NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.Param1Value); NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.Param1); NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.CostTableValue); NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.CostTable); NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.SubType); NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.Property); NWNX_PushArgumentInt(NWNX_ItemProperty, sFunc, n.ItemPropertyID); NWNX_CallFunction(NWNX_ItemProperty, sFunc); return(NWNX_GetReturnValueItemProperty(NWNX_ItemProperty, sFunc)); }