Skip to content

Commit

Permalink
Document GetTattooShopDlcItemData (#987)
Browse files Browse the repository at this point in the history
* Document GetTattooShopDlcItemData

Researched the struct values from shop_tattoo.meta and changed few stuff.

* Update GetTattooShopDlcItemData.md

Made the structure properties and character types into a table + added a LUA example.

* Change the CharacterType param description

* change tables to enums and structs

* add suggested changes

* tweak: add language tags to structs

---------

Co-authored-by: Dillon Skaggs <[email protected]>
  • Loading branch information
freedy69 and AvarianKnight authored Aug 9, 2024
1 parent 9d6308f commit ffc42ed
Showing 1 changed file with 61 additions and 33 deletions.
94 changes: 61 additions & 33 deletions FILES/GetTattooShopDlcItemData.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,43 @@ aliases: ["0xFF56381874F82086","_GET_TATTOO_COLLECTION_DATA"]
BOOL GET_TATTOO_SHOP_DLC_ITEM_DATA(int characterType, int decorationIndex, Any* outComponent);
```
Returns data that adheres to the tattoo shop item data that is used in shop_tattoo.meta
Character types:
```
0 = Michael,
1 = Franklin,
2 = Trevor,
3 = MPMale,
4 = MPFemale
```c
enum eTattooFaction
{
TATTOO_SP_MICHAEL = 0,
TATTOO_SP_FRANKLIN = 1,
TATTOO_SP_TREVOR = 2,
TATTOO_MP_FM = 3,
TATTOO_MP_FM_F = 4
}
```

```csharp
enum TattooZoneData
Returned struct properties:
```c
struct sTattooShopItemValues
{
ZONE_TORSO = 0,
ZONE_HEAD = 1,
ZONE_LEFT_ARM = 2,
ZONE_RIGHT_ARM = 3,
ZONE_LEFT_LEG = 4,
ZONE_RIGHT_LEG = 5,
ZONE_UNKNOWN = 6,
ZONE_NONE = 7,
int LockHash; // Lock hash, used with IS_CONTENT_ITEM_LOCKED
int Index; // Unique ID of this slot. It can also be 0.
int CollectionHash; // Collection hash of this tattoo
int PresetHash; // Preset hash of this tattoo
int Cost; // Cost of this tattoo in shops.
int eFacing; // Secondary placement of this tattoo.
int UpdateGroup; // Location of this tattoo on the body (for example, for torso there would be chest upper, stomach, etc)
const char* NameTextLabel; // This tattoo's name in the form of a text label.
};
struct outComponent
{
// these vars are suffixed with 4 bytes of padding each.
uint unk;
int unk2;
uint tattooCollectionHash;
uint tattooNameHash;
int unk3;
TattooZoneData zoneId;
uint unk4;
uint unk5;
// maybe more, not sure exactly, decompiled scripts are very vague around this part.
}
```


## Parameters
* **characterType**: Character types 0 = Michael, 1 = Franklin, 2 = Trevor, 3 = MPMale, 4 = MPFemale.
* **decorationIndex**: Tattoo index, value between 0 and GetNumDecorations(characterType).
* **characterType**: Which character to get the tattoo data for (Refer to `eTattooFaction` above).
* **decorationIndex**: Tattoo index, value between 0 and [GET_NUM_TATTOO_SHOP_DLC_ITEMS](#_0x278F76C3B0A8F109).
* **outComponent**: The referenced struct.

## Return value
A bool indicating that the tattoo data could be fetched(?)
A bool indicating that the tattoo data exists in the files.

## Examples
```js
Expand All @@ -67,4 +59,40 @@ if (Citizen.invokeNative("0xFF56381874F82086", characterType, tattooIndex, struc
Console.Log(JSON.stringify(structArray));
}
```
```lua
local function TattooBlobToTable(blob)
local LockHash = string.unpack('<i4', blob, 1) & 0xFFFFFFFF -- uint (hash)
local Index = string.unpack('<i4', blob, 9) -- int
local Collection = string.unpack('<i4', blob, 17) & 0xFFFFFFFF -- uint (hash)
local Preset = string.unpack('<i4', blob, 25) & 0xFFFFFFFF -- uint (hash)
local Price = string.unpack('<i4', blob, 33) -- int
local eFacing = string.unpack('<i4', blob, 41) -- TattooZoneData
local UpdateGroup = string.unpack('<i4', blob, 49) -- uint (hash)
local TextLabel = string.unpack('z', blob, 57) -- uint

return {
LockHash = LockHash,
Index = Index,
Collection = Collection,
Preset = Preset,
Price = Price,
eFacing = eFacing,
UpdateGroup = UpdateGroup,
TextLabel = TextLabel
}
end

function GetTattooDlcItemDataTable(CharacterType, DecorationIndex)
local blob = string.rep('\0\0\0\0\0\0\0\0', 7+16)
if not Citizen.InvokeNative(0xFF56381874F82086, CharacterType, DecorationIndex, blob) then return nil end -- Data doesn't exist, return a nil

return TattooBlobToTable(blob) -- Return the data table
end

local numberOfTattoos = GetNumTattooShopDlcItems(3) -- get all tattoos for mpmale
for i = 0, numberOfTattoos - 1 do
local tattooData = GetTattooDlcItemDataTable(3, i)
-- Do stuff with your tattoo data
end

```

0 comments on commit ffc42ed

Please sign in to comment.