inventory client new properties style update

This commit is contained in:
Luke committed 2022-11-17 11:09:26 +01:00
1 parent 5d2f3e22ff
commit c013d3ff0c
7 files changed
+40 -32

No files matched your search

@@ -4,17 +4,16 @@ import TabItem from '@theme/TabItem';
Searches the inventory for an item, or list of items, with the result varying based on the first argument. Searches the inventory for an item, or list of items, with the result varying based on the first argument.
```lua ```lua
-- search: string
-- item: table or string
-- metadata: table or string (optional)
exports.ox_inventory:Search(search, item, metadata) exports.ox_inventory:Search(search, item, metadata)
``` ```
* search: `'slots'` or `'count'`
If the `search` argument is defined as `'slots'` the return will be a table * `'slots'` returns a table of slots where the item was found at.
of slots where the item was found at. * `'count'` returns the count of the specified item in player's inventory. If searching for multiple items
returns key-value pairs of itemName = count.
Otherwise if the `search` argument is defined as `'count'` the return value * item: `table` or `string`
will be the amount of the specified item in player's inventory. * Can be a single item name or array of item names.
* metadata?: `table` or `string`
* If metadata is provided as a string it will search the item's `metadata.type` property.
### Count ### Count
@@ -3,6 +3,6 @@ Enables the weapon wheel, but disables the use of inventory items.
Mostly used for weaponised vehicles, though could be called for "minigames" Mostly used for weaponised vehicles, though could be called for "minigames"
```lua ```lua
-- state: boolean
local exports.ox_inventory:weaponWheel(state) local exports.ox_inventory:weaponWheel(state)
``` ```
* state: `boolean`
@@ -1,18 +1,13 @@
Sets a metadata property to display in the tooltip. Sets a metadata property to display in the tooltip.
```lua ```lua
-- metadata: table or string
-- value: string (optional)
exports.ox_inventory:displayMetadata(metadata, value) exports.ox_inventory:displayMetadata(metadata, value)
``` ```
* metadata: `table` or `string`
`metadata` can either be table or string, if it's a string it's the metadata property * If metadata is a string then it's the metadata property you want to display, value is **not** optional then.
that you want to display, `value` is **not** optional then. * Can be a table of key-value pairs, key being the metadata property and value being the label for that property.
* value?: `string`
`value` represents the _label_ for the property you want to display. * Label for the string metadata property to be displayed.
Otherwise `metadata` can be a table of key value pairs, key being the metadata property
and value being the label for that metadata.
**Example:** **Example:**
```lua ```lua
@@ -24,4 +19,4 @@ exports.ox_inventory:displayMetadata({
mustard = 'Mustard', mustard = 'Mustard',
ketchup = 'Ketchup' ketchup = 'Ketchup'
}) })
``` ```
@@ -1,13 +1,22 @@
import Tabs from '@theme/Tabs'; import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem'; import TabItem from '@theme/TabItem';
Opens an inventory using on the passed data. Opens an inventory using the passed data.
```lua ```lua
-- invType: string
-- data: number | string | table
exports.ox_inventory:openInventory(invType, data) exports.ox_inventory:openInventory(invType, data)
``` ```
* invType: `string`
* `'player'`
* `'shop'`
* `'stash'`
* `'crafting'`
* `'container'`
* `'drop'`
* `'glovebox'`
* `'trunk'`
* `'dumpster'`
* data: `number` or `string` or `table`
<Tabs> <Tabs>
<TabItem value="1" label="Player"> <TabItem value="1" label="Player">
@@ -1,9 +1,14 @@
Forces the secondary-inventory key to open the passed inventory. Can be useful to enable inventory access while standing inside a marker. Forces the secondary-inventory key to open the passed inventory. Can be useful to enable inventory access while standing inside a marker.
```lua ```lua
-- id: string or number
-- owner: string or number (optional)
exports.ox_inventory:setStashTarget(id, owner) exports.ox_inventory:setStashTarget(id, owner)
```
* id: `string` or `number`
* Stash id.
* owner?: `string` or `number`
**Example:**
```lua
exports.ox_inventory:setStashTarget('motel5', 'bobsmith') exports.ox_inventory:setStashTarget('motel5', 'bobsmith')
``` ```
@@ -2,10 +2,10 @@ Uses the passed item, then triggers the callback function.
Should be calling during item callbacks to utilise the builtin methods (server checks, progress bar, etc.). Should be calling during item callbacks to utilise the builtin methods (server checks, progress bar, etc.).
```lua ```lua
-- data: table
-- cb: function (optional)
exports.ox_inventory:useItem(data, cb) exports.ox_inventory:useItem(data, cb)
``` ```
* data: `table`
* cb?: `function`
```lua ```lua
exports('bandage', function(data, slot) exports('bandage', function(data, slot)
@@ -1,6 +1,6 @@
Uses the item in the given inventory slot. Uses the item in the given inventory slot.
```lua ```lua
-- slot: number
exports.ox_inventory:useSlot(slot) exports.ox_inventory:useSlot(slot)
``` ```
* slot: `number`