Skip to content

Commit

Permalink
Add IPlayer RemoveHeadBlendData
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Oct 21, 2023
1 parent 822b451 commit a7e872b
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 7 deletions.
9 changes: 9 additions & 0 deletions api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,15 @@ public void SetHeadBlendData(uint shapeFirstID, uint shapeSecondID, uint shapeTh
}
}

public void RemoveHeadBlendData()
{
lock (Player)
{
if (!AsyncContext.CheckIfExistsNullable(Player)) return;
Player.RemoveHeadBlendData();
}
}

public bool SetEyeColor(ushort eyeColor)
{
lock (Player)
Expand Down
4 changes: 2 additions & 2 deletions api/AltV.Net.CApi/Libraries/ClientLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ public unsafe interface IClientLibrary

public unsafe class ClientLibrary : IClientLibrary
{
public readonly uint Methods = 1735;
public readonly uint Methods = 1738;
public delegate* unmanaged[Cdecl]<nint, nint, void> Audio_AddOutput { get; }
public delegate* unmanaged[Cdecl]<nint, nint> Audio_GetBaseObject { get; }
public delegate* unmanaged[Cdecl]<nint, double> Audio_GetCurrentTime { get; }
Expand Down Expand Up @@ -3512,7 +3512,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 != 4677548953854785821UL) Outdated = true;
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 13325244553859733034UL) 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
9 changes: 7 additions & 2 deletions api/AltV.Net.CApi/Libraries/ServerLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ public unsafe interface IServerLibrary
public delegate* unmanaged[Cdecl]<nint, byte, void> Player_RemoveAllWeapons { get; }
public delegate* unmanaged[Cdecl]<nint, uint, uint, void> Player_RemoveDecoration { get; }
public delegate* unmanaged[Cdecl]<nint, byte, byte> Player_RemoveFaceFeature { get; }
public delegate* unmanaged[Cdecl]<nint, void> Player_RemoveHeadBlendData { get; }
public delegate* unmanaged[Cdecl]<nint, byte, byte> Player_RemoveHeadOverlay { get; }
public delegate* unmanaged[Cdecl]<nint, uint, byte> Player_RemoveWeapon { get; }
public delegate* unmanaged[Cdecl]<nint, uint, uint, void> Player_RemoveWeaponComponent { get; }
Expand Down Expand Up @@ -479,7 +480,7 @@ public unsafe interface IServerLibrary

public unsafe class ServerLibrary : IServerLibrary
{
public readonly uint Methods = 1735;
public readonly uint Methods = 1738;
public delegate* unmanaged[Cdecl]<nint, nint, void> BaseObject_DeleteSyncedMetaData { get; }
public delegate* unmanaged[Cdecl]<nint, nint[], nint[], ulong, void> BaseObject_SetMultipleSyncedMetaData { get; }
public delegate* unmanaged[Cdecl]<nint, nint, nint, void> BaseObject_SetSyncedMetaData { get; }
Expand Down Expand Up @@ -691,6 +692,7 @@ public unsafe class ServerLibrary : IServerLibrary
public delegate* unmanaged[Cdecl]<nint, byte, void> Player_RemoveAllWeapons { get; }
public delegate* unmanaged[Cdecl]<nint, uint, uint, void> Player_RemoveDecoration { get; }
public delegate* unmanaged[Cdecl]<nint, byte, byte> Player_RemoveFaceFeature { get; }
public delegate* unmanaged[Cdecl]<nint, void> Player_RemoveHeadBlendData { get; }
public delegate* unmanaged[Cdecl]<nint, byte, byte> Player_RemoveHeadOverlay { get; }
public delegate* unmanaged[Cdecl]<nint, uint, byte> Player_RemoveWeapon { get; }
public delegate* unmanaged[Cdecl]<nint, uint, uint, void> Player_RemoveWeaponComponent { get; }
Expand Down Expand Up @@ -1367,6 +1369,8 @@ public unsafe class ServerLibrary : IServerLibrary
private static void Player_RemoveDecorationFallback(nint _player, uint _collection, uint _overlay) => throw new Exceptions.OutdatedSdkException("Player_RemoveDecoration", "Player_RemoveDecoration SDK method is outdated. Please update your module nuget");
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Player_RemoveFaceFeatureDelegate(nint _player, byte _index);
private static byte Player_RemoveFaceFeatureFallback(nint _player, byte _index) => throw new Exceptions.OutdatedSdkException("Player_RemoveFaceFeature", "Player_RemoveFaceFeature SDK method is outdated. Please update your module nuget");
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate void Player_RemoveHeadBlendDataDelegate(nint _player);
private static void Player_RemoveHeadBlendDataFallback(nint _player) => throw new Exceptions.OutdatedSdkException("Player_RemoveHeadBlendData", "Player_RemoveHeadBlendData SDK method is outdated. Please update your module nuget");
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Player_RemoveHeadOverlayDelegate(nint _player, byte _overlayID);
private static byte Player_RemoveHeadOverlayFallback(nint _player, byte _overlayID) => throw new Exceptions.OutdatedSdkException("Player_RemoveHeadOverlay", "Player_RemoveHeadOverlay SDK method is outdated. Please update your module nuget");
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate byte Player_RemoveWeaponDelegate(nint _player, uint _weapon);
Expand Down Expand Up @@ -1884,7 +1888,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 != 4677548953854785821UL) Outdated = true;
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 13325244553859733034UL) 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 @@ -2096,6 +2100,7 @@ public ServerLibrary(Dictionary<ulong, IntPtr> funcTable)
Player_RemoveAllWeapons = (delegate* unmanaged[Cdecl]<nint, byte, void>) GetUnmanagedPtr<Player_RemoveAllWeaponsDelegate>(funcTable, 2232062854990357196UL, Player_RemoveAllWeaponsFallback);
Player_RemoveDecoration = (delegate* unmanaged[Cdecl]<nint, uint, uint, void>) GetUnmanagedPtr<Player_RemoveDecorationDelegate>(funcTable, 3139723963307924640UL, Player_RemoveDecorationFallback);
Player_RemoveFaceFeature = (delegate* unmanaged[Cdecl]<nint, byte, byte>) GetUnmanagedPtr<Player_RemoveFaceFeatureDelegate>(funcTable, 1204109734587833282UL, Player_RemoveFaceFeatureFallback);
Player_RemoveHeadBlendData = (delegate* unmanaged[Cdecl]<nint, void>) GetUnmanagedPtr<Player_RemoveHeadBlendDataDelegate>(funcTable, 8805714842908729165UL, Player_RemoveHeadBlendDataFallback);
Player_RemoveHeadOverlay = (delegate* unmanaged[Cdecl]<nint, byte, byte>) GetUnmanagedPtr<Player_RemoveHeadOverlayDelegate>(funcTable, 12300710546613769705UL, Player_RemoveHeadOverlayFallback);
Player_RemoveWeapon = (delegate* unmanaged[Cdecl]<nint, uint, byte>) GetUnmanagedPtr<Player_RemoveWeaponDelegate>(funcTable, 6739305111416325852UL, Player_RemoveWeaponFallback);
Player_RemoveWeaponComponent = (delegate* unmanaged[Cdecl]<nint, uint, uint, void>) GetUnmanagedPtr<Player_RemoveWeaponComponentDelegate>(funcTable, 937601034617427157UL, Player_RemoveWeaponComponentFallback);
Expand Down
14 changes: 12 additions & 2 deletions api/AltV.Net.CApi/Libraries/SharedLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ public unsafe interface ISharedLibrary
public delegate* unmanaged[Cdecl]<byte> Core_GetEventTypeSize { get; }
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetMarkers { get; }
public delegate* unmanaged[Cdecl]<nint, nint, nint> Core_GetMetaData { get; }
public delegate* unmanaged[Cdecl]<nint, nint[], int, ulong> Core_GetMValueArgsSize { get; }
public delegate* unmanaged[Cdecl]<nint, nint, ulong> Core_GetMValueSize { get; }
public delegate* unmanaged[Cdecl]<nint, int> Core_GetNetTime { get; }
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetNetworkObjects { get; }
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetPeds { get; }
Expand Down Expand Up @@ -410,7 +412,7 @@ public unsafe interface ISharedLibrary

public unsafe class SharedLibrary : ISharedLibrary
{
public readonly uint Methods = 1735;
public readonly uint Methods = 1738;
public delegate* unmanaged[Cdecl]<nint, uint> Audio_GetID { get; }
public delegate* unmanaged[Cdecl]<nint, uint> AudioAttachedOutput_GetID { get; }
public delegate* unmanaged[Cdecl]<nint, uint> AudioFilter_GetID { get; }
Expand Down Expand Up @@ -590,6 +592,8 @@ public unsafe class SharedLibrary : ISharedLibrary
public delegate* unmanaged[Cdecl]<byte> Core_GetEventTypeSize { get; }
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetMarkers { get; }
public delegate* unmanaged[Cdecl]<nint, nint, nint> Core_GetMetaData { get; }
public delegate* unmanaged[Cdecl]<nint, nint[], int, ulong> Core_GetMValueArgsSize { get; }
public delegate* unmanaged[Cdecl]<nint, nint, ulong> Core_GetMValueSize { get; }
public delegate* unmanaged[Cdecl]<nint, int> Core_GetNetTime { get; }
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetNetworkObjects { get; }
public delegate* unmanaged[Cdecl]<nint, ulong*, nint> Core_GetPeds { get; }
Expand Down Expand Up @@ -1165,6 +1169,10 @@ public unsafe class SharedLibrary : ISharedLibrary
private static nint Core_GetMarkersFallback(nint _core, ulong* _size) => throw new Exceptions.OutdatedSdkException("Core_GetMarkers", "Core_GetMarkers SDK method is outdated. Please update your module nuget");
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Core_GetMetaDataDelegate(nint _core, nint _key);
private static nint Core_GetMetaDataFallback(nint _core, nint _key) => throw new Exceptions.OutdatedSdkException("Core_GetMetaData", "Core_GetMetaData SDK method is outdated. Please update your module nuget");
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ulong Core_GetMValueArgsSizeDelegate(nint _core, nint[] args, int _size);
private static ulong Core_GetMValueArgsSizeFallback(nint _core, nint[] args, int _size) => throw new Exceptions.OutdatedSdkException("Core_GetMValueArgsSize", "Core_GetMValueArgsSize SDK method is outdated. Please update your module nuget");
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate ulong Core_GetMValueSizeDelegate(nint _core, nint _args);
private static ulong Core_GetMValueSizeFallback(nint _core, nint _args) => throw new Exceptions.OutdatedSdkException("Core_GetMValueSize", "Core_GetMValueSize SDK method is outdated. Please update your module nuget");
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate int Core_GetNetTimeDelegate(nint _core);
private static int Core_GetNetTimeFallback(nint _core) => throw new Exceptions.OutdatedSdkException("Core_GetNetTime", "Core_GetNetTime SDK method is outdated. Please update your module nuget");
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate nint Core_GetNetworkObjectsDelegate(nint _core, ulong* _size);
Expand Down Expand Up @@ -1608,7 +1616,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 != 4677548953854785821UL) Outdated = true;
else if (capiHash == IntPtr.Zero || *(ulong*)capiHash != 13325244553859733034UL) 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 Expand Up @@ -1788,6 +1796,8 @@ public SharedLibrary(Dictionary<ulong, IntPtr> funcTable)
Core_GetEventTypeSize = (delegate* unmanaged[Cdecl]<byte>) GetUnmanagedPtr<Core_GetEventTypeSizeDelegate>(funcTable, 13737530370025977174UL, Core_GetEventTypeSizeFallback);
Core_GetMarkers = (delegate* unmanaged[Cdecl]<nint, ulong*, nint>) GetUnmanagedPtr<Core_GetMarkersDelegate>(funcTable, 7482854450085275693UL, Core_GetMarkersFallback);
Core_GetMetaData = (delegate* unmanaged[Cdecl]<nint, nint, nint>) GetUnmanagedPtr<Core_GetMetaDataDelegate>(funcTable, 2139798095052897524UL, Core_GetMetaDataFallback);
Core_GetMValueArgsSize = (delegate* unmanaged[Cdecl]<nint, nint[], int, ulong>) GetUnmanagedPtr<Core_GetMValueArgsSizeDelegate>(funcTable, 2001253713694863162UL, Core_GetMValueArgsSizeFallback);
Core_GetMValueSize = (delegate* unmanaged[Cdecl]<nint, nint, ulong>) GetUnmanagedPtr<Core_GetMValueSizeDelegate>(funcTable, 3166577616070768315UL, Core_GetMValueSizeFallback);
Core_GetNetTime = (delegate* unmanaged[Cdecl]<nint, int>) GetUnmanagedPtr<Core_GetNetTimeDelegate>(funcTable, 15652019729912249391UL, Core_GetNetTimeFallback);
Core_GetNetworkObjects = (delegate* unmanaged[Cdecl]<nint, ulong*, nint>) GetUnmanagedPtr<Core_GetNetworkObjectsDelegate>(funcTable, 8454955647873390265UL, Core_GetNetworkObjectsFallback);
Core_GetPeds = (delegate* unmanaged[Cdecl]<nint, ulong*, nint>) GetUnmanagedPtr<Core_GetPedsDelegate>(funcTable, 5411021830103603795UL, Core_GetPedsFallback);
Expand Down
2 changes: 2 additions & 0 deletions api/AltV.Net/Elements/Entities/IPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,8 @@ void SetDateTime(int day, int month, int year, int hour,
/// <exception cref="EntityRemovedException">This entity was removed</exception>
void SetHeadBlendData(uint shapeFirstID, uint shapeSecondID, uint shapeThirdID, uint skinFirstID, uint skinSecondID, uint skinThirdID, float shapeMix, float skinMix, float thirdMix);

void RemoveHeadBlendData();

/// <summary>
/// Set Eye Color
/// </summary>
Expand Down
9 changes: 9 additions & 0 deletions api/AltV.Net/Elements/Entities/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,15 @@ public void SetHeadBlendData(uint shapeFirstID, uint shapeSecondID, uint shapeTh
}
}

public void RemoveHeadBlendData()
{
unsafe
{
CheckIfEntityExists();
Core.Library.Server.Player_RemoveHeadBlendData(PlayerNativePointer);
}
}

public bool SetEyeColor(ushort eyeColor)
{
unsafe
Expand Down
2 changes: 1 addition & 1 deletion runtime

0 comments on commit a7e872b

Please sign in to comment.