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); }
/// <summary> /// Returns an object from the provided object ID. /// This is the counterpart to ObjectToString. /// </summary> /// <param name="id"></param> /// <returns></returns> public static NWGameObject StringToObject(string id) { string sFunc = "StringToObject"; NWNXCore.NWNX_PushArgumentString(NWNX_Object, sFunc, id); NWNXCore.NWNX_CallFunction(NWNX_Object, sFunc); return(NWNXCore.NWNX_GetReturnValueObject(NWNX_Object, sFunc)); }
/// <summary> /// Deserialize the object. The object will be created outside of the world and /// needs to be manually positioned at a location/inventory. /// </summary> /// <param name="serialized"></param> /// <returns></returns> public static NWGameObject Deserialize(string serialized) { string sFunc = "Deserialize"; NWNXCore.NWNX_PushArgumentString(NWNX_Object, sFunc, serialized); NWNXCore.NWNX_CallFunction(NWNX_Object, sFunc); return(NWNXCore.NWNX_GetReturnValueObject(NWNX_Object, sFunc)); }
// Convert native itemproperty type to unpacked structure public static ItemPropertyUnpacked UnpackIP(Core.ItemProperty ip) { const string func = "UnpackIP"; NWNXCore.NWNX_PushArgumentItemProperty(PLUGIN_NAME, func, ip); NWNXCore.NWNX_CallFunction(PLUGIN_NAME, func); return(new ItemPropertyUnpacked { Property = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, func), SubType = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, func), CostTable = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, func), CostTableValue = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, func), Param1 = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, func), Param1Value = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, func), UsesPerDay = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, func), ChanceToAppear = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, func), IsUseable = Convert.ToBoolean(NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, func)), SpellID = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, func), Creator = NWNXCore.NWNX_GetReturnValueObject(PLUGIN_NAME, func), Tag = NWNXCore.NWNX_GetReturnValueString(PLUGIN_NAME, func) }); }