Skip to content

Module: Inventory

Аниса edited this page Dec 16, 2022 · 55 revisions

━ What's the Objective?

This module provides a custom inventory management interface to integrate w/ your resources.

For servers such as DayZ, Roleplay, RPG efficient & reliable inventory management is essentially needed due to gamemodes being centralized on it, thus the module!.

━ APIs

━ dbify.module.inventory.fetchAll() (Server)

@Objective: Fetches all existing inventories.
local table: result, table: arguments = dbify.module.inventory.fetchAll(
  table: {
    --Conditional datas to be used for the query
    {string: columnName, ~: columnValue},
    ...
  },
  bool: isSoloFetch, --Enabling this returns only first row of the retrieved result
  ~: ...arguments
)

━ dbify.module.inventory.ensureItems() (Server)

@Objective: Ensures/Whitelists inventory's items.
local bool: result, table: arguments = dbify.module.inventory.ensureItems(
  table: {
    --Items to be ensured
    [string: itemName] = true,
    ...
  },
  ~: ...arguments
)

━ dbify.module.inventory.create() (Server)

@Objective: Creates a new inventory.
local int: inventoryID, table: arguments = dbify.module.inventory.create(
  ~: ...arguments
)

━ dbify.module.inventory.delete() (Server)

@Objective: Deletes an existing inventory.
local bool: result, table: arguments = dbify.module.inventory.delete(
  int: inventoryID,
  ~: ...arguments
)

━ dbify.module.inventory.setData() (Server)

@Objective: Sets inventory datas of a valid inventory.
local bool: result, table: arguments = dbify.module.inventory.setData(
  int: inventoryID,
  table: {
    --Columns to be updated w/ their respective values
    {string: columnName, ~: columnValue},
    ...
  },
  ~: ...arguments
)

━ dbify.module.inventory.getData() (Server)

@Objective: Retrieves inventory datas of a valid inventory.
local table: result, table: arguments = dbify.module.inventory.getData(
  int: inventoryID,
  table: {
    --Columns whose values are to be retrieved
    string: columnName,
    ...
  },
  ~: ...arguments
)

━ dbify.module.inventory.item.add() (Server)

@Objective: Adds an ensured item into a valid inventory.
local bool: result, table: arguments = dbify.module.inventory.item.add(
  int: inventoryID,
  table: {
    --Items to be added to the inventory w/ their respective counts
    {string: itemName, int: itemCount},
    ...
  },
  ~: ...arguments
)

━ dbify.module.inventory.item.remove() (Server)

@Objective: Removes an ensured item from a valid inventory.
local bool: result, table: arguments = dbify.module.inventory.item.remove(
  int: inventoryID,
  table: {
    --Items to be removed from the inventory w/ their respective counts
    {string: itemName, int: itemCount},
    ...
  },
  ~: ...arguments
)

━ dbify.module.inventory.item.setProperty() (Server)

@Objective: Sets item properties of ensured items.
local bool: result, table: arguments = dbify.module.inventory.item.setProperty(
  int: inventoryID,
  table: {
    --Items whose properties are to be updated
    string: itemName,
    ...
  },
  table: {
    --Item properties to be updated for specified items w/ their respective values
    {string: propertyName, ~: propertyValue},
    ...
  },
  ~: ...arguments
)

━ dbify.module.inventory.item.getProperty() (Server)

@Objective: Retrieves item properties of ensured items.
local table: result, table: arguments = dbify.module.inventory.item.getProperty(
  int: inventoryID,
  table: {
    --Items whose properties are to be retrieved
    string: itemName,
    ...
  },
  table: {
    --Item properties to be retrieved for specified items
    string: propertyName,
    ...
  },
  ~: ...arguments
)

━ dbify.module.inventory.item.setData() (Server)

@Objective: Sets item datas of ensured items.
local bool: result, table: arguments = dbify.module.inventory.item.setData(
  int: inventoryID,
  table: {
    --Items whose datas are to be updated
    string: itemName,
    ...
  },
  table: {
    --Item datas that has to be updated for specified items w/ their respective values
    {string: dataName, ~: dataValue},
    ...
  },
  ~: ...arguments
)

━ dbify.module.inventory.item.getData() (Server)

@Objective: Retrieves item datas of ensured items.
local table: result, table: arguments = dbify.module.inventory.item.getData(
  int: inventoryID,
  table: {
    --Items whose datas are to be retrieved
    string: itemName,
    ...
  },
  table: {
    --Item datas whose values are to be retrieved
    string: dataName,
    ...
  },
  ~: ...arguments
)
Clone this wiki locally