Skip to content

Commit

Permalink
feat(server): add count param to AddDecoration
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Jan 3, 2024
1 parent b8047ae commit f9e00c8
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion api/AltV.Net.CApi/Libraries/ClientLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3565,7 +3565,7 @@ private IntPtr GetUnmanagedPtr<T>(IDictionary<ulong, IntPtr> funcTable, ulong ha
public ClientLibrary(Dictionary<ulong, IntPtr> 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]<nint, nint, void>) GetUnmanagedPtr<Audio_AddOutputDelegate>(funcTable, 9914412815391408844UL, Audio_AddOutputFallback);
Audio_GetBaseObject = (delegate* unmanaged[Cdecl]<nint, nint>) GetUnmanagedPtr<Audio_GetBaseObjectDelegate>(funcTable, 6330360502401226894UL, Audio_GetBaseObjectFallback);
Audio_GetCurrentTime = (delegate* unmanaged[Cdecl]<nint, double>) GetUnmanagedPtr<Audio_GetCurrentTimeDelegate>(funcTable, 2944324482134975819UL, Audio_GetCurrentTimeFallback);
Expand Down
12 changes: 6 additions & 6 deletions api/AltV.Net.CApi/Libraries/ServerLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public unsafe interface IServerLibrary
public delegate* unmanaged[Cdecl]<nint, uint, void> Ped_SetCurrentWeapon { get; }
public delegate* unmanaged[Cdecl]<nint, ushort, void> Ped_SetHealth { get; }
public delegate* unmanaged[Cdecl]<nint, ushort, void> Ped_SetMaxHealth { get; }
public delegate* unmanaged[Cdecl]<nint, uint, uint, void> Player_AddDecoration { get; }
public delegate* unmanaged[Cdecl]<nint, uint, uint, byte, void> Player_AddDecoration { get; }
public delegate* unmanaged[Cdecl]<nint, uint, uint, void> Player_AddWeaponComponent { get; }
public delegate* unmanaged[Cdecl]<nint, void> Player_ClearBloodDamage { get; }
public delegate* unmanaged[Cdecl]<nint, byte, byte> Player_ClearClothes { get; }
Expand Down Expand Up @@ -632,7 +632,7 @@ public unsafe class ServerLibrary : IServerLibrary
public delegate* unmanaged[Cdecl]<nint, uint, void> Ped_SetCurrentWeapon { get; }
public delegate* unmanaged[Cdecl]<nint, ushort, void> Ped_SetHealth { get; }
public delegate* unmanaged[Cdecl]<nint, ushort, void> Ped_SetMaxHealth { get; }
public delegate* unmanaged[Cdecl]<nint, uint, uint, void> Player_AddDecoration { get; }
public delegate* unmanaged[Cdecl]<nint, uint, uint, byte, void> Player_AddDecoration { get; }
public delegate* unmanaged[Cdecl]<nint, uint, uint, void> Player_AddWeaponComponent { get; }
public delegate* unmanaged[Cdecl]<nint, void> Player_ClearBloodDamage { get; }
public delegate* unmanaged[Cdecl]<nint, byte, byte> Player_ClearClothes { get; }
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1905,7 +1905,7 @@ private IntPtr GetUnmanagedPtr<T>(IDictionary<ulong, IntPtr> funcTable, ulong ha
public ServerLibrary(Dictionary<ulong, IntPtr> 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]<nint, nint, void>) GetUnmanagedPtr<BaseObject_DeleteSyncedMetaDataDelegate>(funcTable, 8228424877092269355UL, BaseObject_DeleteSyncedMetaDataFallback);
BaseObject_SetMultipleSyncedMetaData = (delegate* unmanaged[Cdecl]<nint, nint[], nint[], ulong, void>) GetUnmanagedPtr<BaseObject_SetMultipleSyncedMetaDataDelegate>(funcTable, 1390762125822890831UL, BaseObject_SetMultipleSyncedMetaDataFallback);
BaseObject_SetSyncedMetaData = (delegate* unmanaged[Cdecl]<nint, nint, nint, void>) GetUnmanagedPtr<BaseObject_SetSyncedMetaDataDelegate>(funcTable, 8002999088966424231UL, BaseObject_SetSyncedMetaDataFallback);
Expand Down Expand Up @@ -2052,7 +2052,7 @@ public ServerLibrary(Dictionary<ulong, IntPtr> funcTable)
Ped_SetCurrentWeapon = (delegate* unmanaged[Cdecl]<nint, uint, void>) GetUnmanagedPtr<Ped_SetCurrentWeaponDelegate>(funcTable, 1890144317981520558UL, Ped_SetCurrentWeaponFallback);
Ped_SetHealth = (delegate* unmanaged[Cdecl]<nint, ushort, void>) GetUnmanagedPtr<Ped_SetHealthDelegate>(funcTable, 15651278310887155719UL, Ped_SetHealthFallback);
Ped_SetMaxHealth = (delegate* unmanaged[Cdecl]<nint, ushort, void>) GetUnmanagedPtr<Ped_SetMaxHealthDelegate>(funcTable, 487582698440451683UL, Ped_SetMaxHealthFallback);
Player_AddDecoration = (delegate* unmanaged[Cdecl]<nint, uint, uint, void>) GetUnmanagedPtr<Player_AddDecorationDelegate>(funcTable, 11189476182745634495UL, Player_AddDecorationFallback);
Player_AddDecoration = (delegate* unmanaged[Cdecl]<nint, uint, uint, byte, void>) GetUnmanagedPtr<Player_AddDecorationDelegate>(funcTable, 4335399707847968795UL, Player_AddDecorationFallback);
Player_AddWeaponComponent = (delegate* unmanaged[Cdecl]<nint, uint, uint, void>) GetUnmanagedPtr<Player_AddWeaponComponentDelegate>(funcTable, 9305362021789278268UL, Player_AddWeaponComponentFallback);
Player_ClearBloodDamage = (delegate* unmanaged[Cdecl]<nint, void>) GetUnmanagedPtr<Player_ClearBloodDamageDelegate>(funcTable, 1935399752104807234UL, Player_ClearBloodDamageFallback);
Player_ClearClothes = (delegate* unmanaged[Cdecl]<nint, byte, byte>) GetUnmanagedPtr<Player_ClearClothesDelegate>(funcTable, 992364219024894490UL, Player_ClearClothesFallback);
Expand Down
2 changes: 1 addition & 1 deletion api/AltV.Net.CApi/Libraries/SharedLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ private IntPtr GetUnmanagedPtr<T>(IDictionary<ulong, IntPtr> funcTable, ulong ha
public SharedLibrary(Dictionary<ulong, IntPtr> 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]<nint, uint>) GetUnmanagedPtr<Audio_GetIDDelegate>(funcTable, 4464042055475980737UL, Audio_GetIDFallback);
AudioAttachedOutput_GetID = (delegate* unmanaged[Cdecl]<nint, uint>) GetUnmanagedPtr<AudioAttachedOutput_GetIDDelegate>(funcTable, 17725794901805112189UL, AudioAttachedOutput_GetIDFallback);
AudioFilter_GetID = (delegate* unmanaged[Cdecl]<nint, uint>) GetUnmanagedPtr<AudioFilter_GetIDDelegate>(funcTable, 8824535635529306325UL, AudioFilter_GetIDFallback);
Expand Down
2 changes: 1 addition & 1 deletion api/AltV.Net/Elements/Entities/IPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions api/AltV.Net/Elements/Entities/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion runtime

0 comments on commit f9e00c8

Please sign in to comment.