From f9e00c8900e43489219080f05d00b3231bdcad3c Mon Sep 17 00:00:00 2001 From: doxoh Date: Wed, 3 Jan 2024 16:49:21 +0100 Subject: [PATCH] feat(server): add count param to AddDecoration --- api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs | 4 ++-- api/AltV.Net.CApi/Libraries/ClientLibrary.cs | 2 +- api/AltV.Net.CApi/Libraries/ServerLibrary.cs | 12 ++++++------ api/AltV.Net.CApi/Libraries/SharedLibrary.cs | 2 +- api/AltV.Net/Elements/Entities/IPlayer.cs | 2 +- api/AltV.Net/Elements/Entities/Player.cs | 4 ++-- runtime | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs b/api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs index b79c55094..ffbe7c38d 100644 --- a/api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs +++ b/api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs @@ -1482,12 +1482,12 @@ public int GetAmmoMax100(uint ammoHash) } } - public void AddDecoration(uint collection, uint overlay) + public void AddDecoration(uint collection, uint overlay, byte count = 1) { lock (Player) { if (!AsyncContext.CheckIfExistsNullable(Player)) return; - Player.AddDecoration(collection, overlay); + Player.AddDecoration(collection, overlay, count); } } diff --git a/api/AltV.Net.CApi/Libraries/ClientLibrary.cs b/api/AltV.Net.CApi/Libraries/ClientLibrary.cs index b1ea92999..7e4ef25a3 100644 --- a/api/AltV.Net.CApi/Libraries/ClientLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/ClientLibrary.cs @@ -3565,7 +3565,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 != 13630124142623987997UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 16106728582837015091UL) 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 5ef506840..540556b22 100644 --- a/api/AltV.Net.CApi/Libraries/ServerLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/ServerLibrary.cs @@ -157,7 +157,7 @@ public unsafe interface IServerLibrary public delegate* unmanaged[Cdecl] Ped_SetCurrentWeapon { get; } public delegate* unmanaged[Cdecl] Ped_SetHealth { get; } public delegate* unmanaged[Cdecl] Ped_SetMaxHealth { get; } - public delegate* unmanaged[Cdecl] Player_AddDecoration { get; } + public delegate* unmanaged[Cdecl] Player_AddDecoration { get; } public delegate* unmanaged[Cdecl] Player_AddWeaponComponent { get; } public delegate* unmanaged[Cdecl] Player_ClearBloodDamage { get; } public delegate* unmanaged[Cdecl] Player_ClearClothes { get; } @@ -632,7 +632,7 @@ public unsafe class ServerLibrary : IServerLibrary public delegate* unmanaged[Cdecl] Ped_SetCurrentWeapon { get; } public delegate* unmanaged[Cdecl] Ped_SetHealth { get; } public delegate* unmanaged[Cdecl] Ped_SetMaxHealth { get; } - public delegate* unmanaged[Cdecl] Player_AddDecoration { get; } + public delegate* unmanaged[Cdecl] Player_AddDecoration { get; } public delegate* unmanaged[Cdecl] Player_AddWeaponComponent { get; } public delegate* unmanaged[Cdecl] Player_ClearBloodDamage { get; } public delegate* unmanaged[Cdecl] Player_ClearClothes { get; } @@ -1248,8 +1248,8 @@ public unsafe class ServerLibrary : IServerLibrary private static void Ped_SetHealthFallback(nint _ped, ushort _health) => throw new Exceptions.OutdatedSdkException("Ped_SetHealth", "Ped_SetHealth SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Ped_SetMaxHealthDelegate(nint _ped, ushort _maxHealth); private static void Ped_SetMaxHealthFallback(nint _ped, ushort _maxHealth) => throw new Exceptions.OutdatedSdkException("Ped_SetMaxHealth", "Ped_SetMaxHealth SDK method is outdated. Please update your module nuget"); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Player_AddDecorationDelegate(nint _player, uint _collection, uint _overlay); - private static void Player_AddDecorationFallback(nint _player, uint _collection, uint _overlay) => throw new Exceptions.OutdatedSdkException("Player_AddDecoration", "Player_AddDecoration SDK method is outdated. Please update your module nuget"); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Player_AddDecorationDelegate(nint _player, uint _collection, uint _overlay, byte _count); + private static void Player_AddDecorationFallback(nint _player, uint _collection, uint _overlay, byte _count) => throw new Exceptions.OutdatedSdkException("Player_AddDecoration", "Player_AddDecoration SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Player_AddWeaponComponentDelegate(nint _player, uint _weapon, uint _component); private static void Player_AddWeaponComponentFallback(nint _player, uint _weapon, uint _component) => throw new Exceptions.OutdatedSdkException("Player_AddWeaponComponent", "Player_AddWeaponComponent SDK method is outdated. Please update your module nuget"); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Player_ClearBloodDamageDelegate(nint _player); @@ -1905,7 +1905,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 != 13630124142623987997UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 16106728582837015091UL) 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); @@ -2052,7 +2052,7 @@ public ServerLibrary(Dictionary funcTable) Ped_SetCurrentWeapon = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 1890144317981520558UL, Ped_SetCurrentWeaponFallback); Ped_SetHealth = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 15651278310887155719UL, Ped_SetHealthFallback); Ped_SetMaxHealth = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 487582698440451683UL, Ped_SetMaxHealthFallback); - Player_AddDecoration = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 11189476182745634495UL, Player_AddDecorationFallback); + Player_AddDecoration = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 4335399707847968795UL, Player_AddDecorationFallback); Player_AddWeaponComponent = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 9305362021789278268UL, Player_AddWeaponComponentFallback); Player_ClearBloodDamage = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 1935399752104807234UL, Player_ClearBloodDamageFallback); Player_ClearClothes = (delegate* unmanaged[Cdecl]) GetUnmanagedPtr(funcTable, 992364219024894490UL, Player_ClearClothesFallback); diff --git a/api/AltV.Net.CApi/Libraries/SharedLibrary.cs b/api/AltV.Net.CApi/Libraries/SharedLibrary.cs index ac99219f9..9c3e0f4b7 100644 --- a/api/AltV.Net.CApi/Libraries/SharedLibrary.cs +++ b/api/AltV.Net.CApi/Libraries/SharedLibrary.cs @@ -1665,7 +1665,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 != 13630124142623987997UL) Outdated = true; + else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 16106728582837015091UL) 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/Elements/Entities/IPlayer.cs b/api/AltV.Net/Elements/Entities/IPlayer.cs index 7624c7830..abf2b21c2 100644 --- a/api/AltV.Net/Elements/Entities/IPlayer.cs +++ b/api/AltV.Net/Elements/Entities/IPlayer.cs @@ -462,7 +462,7 @@ void PlayAnimation(string animDict, string animName, float blendInSpeed, float b void SetAmmoMax100(uint ammoHash, int ammoMax); int GetAmmoMax100(uint ammoHash); - void AddDecoration(uint collection, uint overlay); + void AddDecoration(uint collection, uint overlay, byte count = 1); void RemoveDecoration(uint collection, uint overlay); void ClearDecorations(); Decoration[] GetDecorations(); diff --git a/api/AltV.Net/Elements/Entities/Player.cs b/api/AltV.Net/Elements/Entities/Player.cs index 4e3f5e68c..8d5d97e28 100644 --- a/api/AltV.Net/Elements/Entities/Player.cs +++ b/api/AltV.Net/Elements/Entities/Player.cs @@ -328,12 +328,12 @@ public int GetAmmoMax100(uint ammoHash) } } - public void AddDecoration(uint collection, uint overlay) + public void AddDecoration(uint collection, uint overlay, byte count = 1) { unsafe { CheckIfEntityExists(); - Core.Library.Server.Player_AddDecoration(PlayerNativePointer, collection, overlay); + Core.Library.Server.Player_AddDecoration(PlayerNativePointer, collection, overlay, count); } } diff --git a/runtime b/runtime index b33791886..810a26d29 160000 --- a/runtime +++ b/runtime @@ -1 +1 @@ -Subproject commit b337918866d3f40fcb54304e39edd35f5d83843c +Subproject commit 810a26d294ce6f98523dcc23c5b0672bc996fc5d