diff --git a/api/AltV.Net.CApi/Libraries/ClientLibrary.cs b/api/AltV.Net.CApi/Libraries/ClientLibrary.cs index 87282b950..9a00ddeda 100644 --- a/api/AltV.Net.CApi/Libraries/ClientLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/ClientLibrary.cs @@ -902,7 +902,7 @@ public unsafe interface IClientLibrary public unsafe class ClientLibrary : IClientLibrary { - public readonly uint Methods = 1770; + public readonly uint Methods = 1773; public delegate* unmanaged[Cdecl] Audio_AddOutput { get; } public delegate* unmanaged[Cdecl] Audio_GetBaseObject { get; } public delegate* unmanaged[Cdecl] Audio_GetCurrentTime { get; } @@ -3573,7 +3573,7 @@ private IntPtr GetUnmanagedPtr(IDictionary funcTable, ulong ha public ClientLibrary(Dictionary funcTable) { if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true; - else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 18234026019486245283UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 78812385462098472UL) Outdated = true; Audio_AddOutput = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 9914412815391408844UL, Audio_AddOutputFallback); Audio_GetBaseObject = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 6330360502401226894UL, Audio_GetBaseObjectFallback); Audio_GetCurrentTime = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 2944324482134975819UL, Audio_GetCurrentTimeFallback); diff --git a/api/AltV.Net.CApi/Libraries/ServerLibrary.cs b/api/AltV.Net.CApi/Libraries/ServerLibrary.cs index 40111dcaa..80b124f92 100644 --- a/api/AltV.Net.CApi/Libraries/ServerLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/ServerLibrary.cs @@ -143,10 +143,13 @@ public unsafe interface IServerLibrary public delegate* unmanaged[Cdecl] Entity_SetStreamSyncedMetaData { get; } public delegate* unmanaged[Cdecl] Entity_SetVisible { get; } public delegate* unmanaged[Cdecl] Event_WeaponDamageEvent_SetDamageValue { get; } + public delegate* unmanaged[Cdecl] Metric_Add { get; } public delegate* unmanaged[Cdecl] Metric_Begin { get; } public delegate* unmanaged[Cdecl] Metric_End { get; } + public delegate* unmanaged[Cdecl] Metric_End2 { get; } public delegate* unmanaged[Cdecl] Metric_GetName { get; } public delegate* unmanaged[Cdecl] Metric_GetValue { get; } + public delegate* unmanaged[Cdecl] Metric_Inc { get; } public delegate* unmanaged[Cdecl] Metric_SetValue { get; } public delegate* unmanaged[Cdecl] Object_ActivatePhysics { get; } public delegate* unmanaged[Cdecl] Object_PlaceOnGroundProperly { get; } @@ -485,7 +488,7 @@ public unsafe interface IServerLibrary public unsafe class ServerLibrary : IServerLibrary { - public readonly uint Methods = 1770; + public readonly uint Methods = 1773; public delegate* unmanaged[Cdecl] BaseObject_DeleteSyncedMetaData { get; } public delegate* unmanaged[Cdecl] BaseObject_SetMultipleSyncedMetaData { get; } public delegate* unmanaged[Cdecl] BaseObject_SetSyncedMetaData { get; } @@ -618,10 +621,13 @@ public unsafe class ServerLibrary : IServerLibrary public delegate* unmanaged[Cdecl] Entity_SetStreamSyncedMetaData { get; } public delegate* unmanaged[Cdecl] Entity_SetVisible { get; } public delegate* unmanaged[Cdecl] Event_WeaponDamageEvent_SetDamageValue { get; } + public delegate* unmanaged[Cdecl] Metric_Add { get; } public delegate* unmanaged[Cdecl] Metric_Begin { get; } public delegate* unmanaged[Cdecl] Metric_End { get; } + public delegate* unmanaged[Cdecl] Metric_End2 { get; } public delegate* unmanaged[Cdecl] Metric_GetName { get; } public delegate* unmanaged[Cdecl] Metric_GetValue { get; } + public delegate* unmanaged[Cdecl] Metric_Inc { get; } public delegate* unmanaged[Cdecl] Metric_SetValue { get; } public delegate* unmanaged[Cdecl] Object_ActivatePhysics { get; } public delegate* unmanaged[Cdecl] Object_PlaceOnGroundProperly { get; } @@ -1220,14 +1226,20 @@ public unsafe class ServerLibrary : IServerLibrary private static void Entity_SetVisibleFallback(nint _entity, byte _state) => throw new Exceptions.OutdatedSdkException("Entity_SetVisible", "Entity_SetVisible SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Event_WeaponDamageEvent_SetDamageValueDelegate(nint _event, uint _damageValue); private static void Event_WeaponDamageEvent_SetDamageValueFallback(nint _event, uint _damageValue) => throw new Exceptions.OutdatedSdkException("Event_WeaponDamageEvent_SetDamageValue", "Event_WeaponDamageEvent_SetDamageValue SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Metric_AddDelegate(nint _metric, ulong _value); + private static void Metric_AddFallback(nint _metric, ulong _value) => throw new Exceptions.OutdatedSdkException("Metric_Add", "Metric_Add SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Metric_BeginDelegate(nint _metric); private static void Metric_BeginFallback(nint _metric) => throw new Exceptions.OutdatedSdkException("Metric_Begin", "Metric_Begin SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Metric_EndDelegate(nint _metric); private static void Metric_EndFallback(nint _metric) => throw new Exceptions.OutdatedSdkException("Metric_End", "Metric_End SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Metric_End2Delegate(nint _metric); + private static void Metric_End2Fallback(nint _metric) => throw new Exceptions.OutdatedSdkException("Metric_End2", "Metric_End2 SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Metric_GetNameDelegate(nint _metric, int* _size); private static nint Metric_GetNameFallback(nint _metric, int* _size) => throw new Exceptions.OutdatedSdkException("Metric_GetName", "Metric_GetName SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ulong Metric_GetValueDelegate(nint _metric); private static ulong Metric_GetValueFallback(nint _metric) => throw new Exceptions.OutdatedSdkException("Metric_GetValue", "Metric_GetValue SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Metric_IncDelegate(nint _metric); + private static void Metric_IncFallback(nint _metric) => throw new Exceptions.OutdatedSdkException("Metric_Inc", "Metric_Inc SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Metric_SetValueDelegate(nint _metric, ulong _value); private static void Metric_SetValueFallback(nint _metric, ulong _value) => throw new Exceptions.OutdatedSdkException("Metric_SetValue", "Metric_SetValue SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Object_ActivatePhysicsDelegate(nint _object); @@ -1905,7 +1917,7 @@ private IntPtr GetUnmanagedPtr(IDictionary funcTable, ulong ha public ServerLibrary(Dictionary funcTable) { if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true; - else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 18234026019486245283UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 78812385462098472UL) Outdated = true; BaseObject_DeleteSyncedMetaData = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8228424877092269355UL, BaseObject_DeleteSyncedMetaDataFallback); BaseObject_SetMultipleSyncedMetaData = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 1390762125822890831UL, BaseObject_SetMultipleSyncedMetaDataFallback); BaseObject_SetSyncedMetaData = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8002999088966424231UL, BaseObject_SetSyncedMetaDataFallback); @@ -2038,10 +2050,13 @@ public ServerLibrary(Dictionary funcTable) Entity_SetStreamSyncedMetaData = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 12798418058428333585UL, Entity_SetStreamSyncedMetaDataFallback); Entity_SetVisible = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8026011842118229214UL, Entity_SetVisibleFallback); Event_WeaponDamageEvent_SetDamageValue = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 18440396865533386791UL, Event_WeaponDamageEvent_SetDamageValueFallback); + Metric_Add = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 16053290375636538610UL, Metric_AddFallback); Metric_Begin = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 2348810001298180138UL, Metric_BeginFallback); Metric_End = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 13016512038826983106UL, Metric_EndFallback); + Metric_End2 = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 18410039824979474410UL, Metric_End2Fallback); Metric_GetName = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8652629169459184520UL, Metric_GetNameFallback); Metric_GetValue = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 16033500183040421617UL, Metric_GetValueFallback); + Metric_Inc = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 9564264321313118159UL, Metric_IncFallback); Metric_SetValue = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 13198892627580896636UL, Metric_SetValueFallback); Object_ActivatePhysics = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 17585830173881425980UL, Object_ActivatePhysicsFallback); Object_PlaceOnGroundProperly = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 16593704804065749058UL, Object_PlaceOnGroundProperlyFallback); diff --git a/api/AltV.Net.CApi/Libraries/SharedLibrary.cs b/api/AltV.Net.CApi/Libraries/SharedLibrary.cs index 8e8745ae9..549d703b2 100644 --- a/api/AltV.Net.CApi/Libraries/SharedLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/SharedLibrary.cs @@ -426,7 +426,7 @@ public unsafe interface ISharedLibrary public unsafe class SharedLibrary : ISharedLibrary { - public readonly uint Methods = 1770; + public readonly uint Methods = 1773; public delegate* unmanaged[Cdecl] Audio_GetID { get; } public delegate* unmanaged[Cdecl] AudioAttachedOutput_GetID { get; } public delegate* unmanaged[Cdecl] AudioFilter_GetID { get; } @@ -1669,7 +1669,7 @@ private IntPtr GetUnmanagedPtr(IDictionary funcTable, ulong ha public SharedLibrary(Dictionary funcTable) { if (!funcTable.TryGetValue(0, out var capiHash)) Outdated = true; - else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 18234026019486245283UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 78812385462098472UL) Outdated = true; Audio_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4464042055475980737UL, Audio_GetIDFallback); AudioAttachedOutput_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 17725794901805112189UL, AudioAttachedOutput_GetIDFallback); AudioFilter_GetID = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 8824535635529306325UL, AudioFilter_GetIDFallback); diff --git a/api/AltV.Net/Data/Metric.cs b/api/AltV.Net/Data/Metric.cs index cf312a55e..517f2e200 100644 --- a/api/AltV.Net/Data/Metric.cs +++ b/api/AltV.Net/Data/Metric.cs @@ -53,6 +53,7 @@ public void Begin() } } + [Obsolete("Deprecated old behavior, remove in future. Use End2")] public void End() { unsafe @@ -60,4 +61,28 @@ public void End() Core.Library.Server.Metric_End(MetricNativePointer); } } + + public void Add(ulong value) + { + unsafe + { + Core.Library.Server.Metric_Add(MetricNativePointer, value); + } + } + + public void Inc() + { + unsafe + { + Core.Library.Server.Metric_Inc(MetricNativePointer); + } + } + + public void End2() + { + unsafe + { + Core.Library.Server.Metric_End2(MetricNativePointer); + } + } } \ No newline at end of file diff --git a/api/AltV.Net/Elements/Entities/IMetric.cs b/api/AltV.Net/Elements/Entities/IMetric.cs index c71c27d99..39eeea0cc 100644 --- a/api/AltV.Net/Elements/Entities/IMetric.cs +++ b/api/AltV.Net/Elements/Entities/IMetric.cs @@ -9,5 +9,9 @@ public interface IMetric string Name { get; } ulong Value { get; set; } void Begin(); + [Obsolete("Deprecated old behavior, remove in future. Use End2")] void End(); + void Add(ulong value); + void Inc(); + void End2(); } \ No newline at end of file diff --git a/runtime b/runtime index 133161b34..1831c4cb8 160000 --- a/runtime +++ b/runtime @@ -1 +1 @@ -Subproject commit 133161b34d0a1891b9c4c204fba0f523fe5b57fe +Subproject commit 1831c4cb871c91ee9038e3611ea48cbe274f602e