Module sv_rarity

Rarity System

Functions

GetRarityTable (rarity) GetRarityTable function.
GetRandomItem (items, customRarities, src, xpCategory, probabilityMax) GetRandomItem function.
GetRandomItems (items, amount, customRarities, src, xpCategory, probabilityMax) GetRandomItems function.

Tables

Rarity Rarity Table.


Functions

GetRarityTable (rarity)
GetRarityTable function. This function returns a rarity table.

Parameters:

  • rarity The rarity to start from.

Returns:

    table

Usage:

    local rarityTable = exports.jones_util:GetRarityTable("rare")
GetRandomItem (items, customRarities, src, xpCategory, probabilityMax)
GetRandomItem function. This function returns a random item from a table.

Parameters:

  • items The item table.
  • customRarities The custom rarity table.
  • src The source. optional
  • xpCategory The xp category. optional
  • probabilityMax The max proability. optional

Returns:

    string

See also:

Usage:

    local item = exports.jones_util:GetRandomItem(items)
GetRandomItems (items, amount, customRarities, src, xpCategory, probabilityMax)
GetRandomItems function. This function returns a table of random items.

Parameters:

  • items The item table.
  • amount The amount of items to return.
  • customRarities The custom rarity table.
  • src The source. optional
  • xpCategory The xp category. optional
  • probabilityMax The max proability. optional

Returns:

    table

See also:

Usage:

    local items = exports.jones_util:GetRandomItems(items, 5)

Tables

Rarity
Rarity Table. This table contains all the rarities in the server.

Fields:

  • common The common rarity. number
  • uncommon The uncommon rarity. number
  • rare The rare rarity. number
  • very rare The very rare rarity. number
  • legendary The legendary rarity. number

Usage:

    local rarity = {
    	["common"] = 775,
    	["uncommon"] = 150,
    	["rare"] = 50,
    	["very rare"] = 20,
    	["legendary"] = 5
    }
generated by LDoc 1.5.0 Last updated 2024-05-13 19:05:24