Brew Crafting: Exceptional Crafting Experience

Brew Crafting offers a complete solution for creating an exceptional crafting experience.

Features

  • Comprehensive crafting solution for all your needs
  • Customizable to fit your server’s requirements

Events

Here you can find events that you can listen for to make specific actions when a recipe is crafted or failed.

--Server Events

("lc_crafting:craftFailedServer", recipeData, player)
 -- This event is triggered when a recipe is failed.
 -- Parameters:
 -- recipeData: Table -- The whole data of the recipe that is crafted
 -- player: string -- The source of the player that is crafting the recipe

("lc_crafting:craftEventServer", recipeData, player)
 -- This event is triggered when a recipe is successful.
 -- Parameters:
 -- recipeData: Table -- The whole data of the recipe that is crafted
 -- player: string -- The source of the player that is crafting the recipe

 ("lc_crafting:CraftingStartedServer", recipeData.duration, player)
 -- This event is triggered when a recipe is started.
 -- Parameters:
 -- recipeData: Table -- The whole data of the recipe that is crafted
 -- player: string -- The source of the player that is crafting the recipe

--Client Events

("lc_crafting:craftFailedClient", player, recipeData)
 -- This event is triggered when a recipe is failed.
 -- Parameters:
 -- recipeData: Table -- The whole data of the recipe that is crafted

("lc_crafting:craftEventClient", player, recipeData)
 -- This event is triggered when a recipe is successful.
 -- Parameters:
 -- recipeData: Table -- The whole data of the recipe that is crafted

 ("lc_crafting:CraftingStartedClient", player, recipeData.duration)
 -- This event is triggered when a recipe is started.
 -- Parameters:
 -- duration: number -- The duration of the recipe in seconds


Use vorp_inventory before 4.0 version

When you use vorp_inventory before 4.0, you need to set following value in config to true.

    Config.oldInventory = true 

Add images for the needed props nearby

To add images for the needed props nearby, you need to add the image with the prop name into your inventory images folder. Then the inventory will show the image in the needed props.

Exports

With this export you can open the book from the client side. You need to add as parameter the book name.

--Client Seitig
exports.brew_crafting:OpenBook(bookName)

Recipe configuration

Below is a detailed explanation of the recipe configuration options available:

{
    label = "Sugar", -- This is the label that gets displayed in the book

    category = "production", -- This is the category that gets displayed in the book

    recipeImage = "sugar", -- This is the image that gets displayed in the book (itemname -> image from inventory)

    neededSkills = { -- These are the skills that are needed to craft the item. If not set, the player can craft the item without any skills.
        {skill = "drugs", progress = 1, label = "Drogen"},
    },

    neededJobs = { -- These are the jobs that are needed to see the item in the craftingbook. If not set, the player can see the recipe.
        { job = "sd_woodworker", grade = 1 },
    },

    steamids = {"steam:111111111111"}, -- This is the steam id of the player that can see the recipe.

    showNeededProps = true, -- Decides if you show the props in the book.
    needAllProps = false, -- When false then you only need one of the props be near the player to craft the item.
    
    neededProps = { --If no distance has been set, the default distance will be used that is configured in top of config
        { prop = "p_campfire02x", label = "Campfire" }, -- prop model and label for the book
        { prop = "p_campfire02x", label = "Campfire 2", distance = 2.0 }, -- prop model and label for the book with a distance where the prop must be to the player
    },

    --failChance = 10, -- This is the chance that the player will fail the recipe. If the player fails, they will lose the items needed.

    receivingExp = { -- These are the skills exp that are gained when the item is crafted.
        {skill = "drugs", exp = 1, label = "Sugarfactory"},
    },

    needed = { -- These are the items that are needed to craft the item.
        --When you want to allow also degrated items in vorp_iventory 4.0 that have more then 1 percent set allowDegraded = true like this
        -- {label = "Sugarcube", item = "sugar", amount = 1, allowDegraded = true},
        -- else you dont need to add it at all
        {label = "Sugarcube", item = "sugar", amount = 1},
    },

    duration = 3, -- This is the duration of the recipe in seconds.

    retrieve = { -- This is the item list that is retrieved when the item is crafted.
        {item = "sugar", label = "Sugarcube", amount = 2}, -- Item that gets given to the player
    },

    tools = {}, -- These are the tools that are needed to craft the item. With useDurability set to true, the tool
    -- will lose durability when used. If false, it will not have durability, just need the item to be in the player's inventory.

    giveback = {
        {item = "sugar", label = "Sugarcube", amount = 2}, -- Item that gets given to the player
    }, -- This is the item list that is given back to the player when the item is crafted.

    requireJobLocation = false, -- When this is set to true, the player must be in the job location of their current set job to craft the item.
    -- specialLocation = {"rho_special_location"}, -- This is the list of polyzones where the player can craft the item. Cannot be used with requireJobLocation.

    disclaimer = "This is a disclaimer text, to be displayed to the player.", -- This is the disclaimer text that gets displayed in orange above the craft button.

    description = "Here you can write an amazing description for your recipe or tell the player what they can do with it." -- This is the description text that gets displayed below the recipe title in the details tab.
}

Book configuration

Below is a detailed explanation of the recipe configuration options available:

["drugs_book"] = {          --This is the book name must be same as the item 
    item = "drugs_book",    --Here you enter the item name of the book you want to make usable if false the book is not binded to a item and can only be used with the prompt methodes
    command = "sugarbook",  -- /sugarbook opens the book if set to "command = nil" then its disabled or when the line is removed
    label = "Example Book", --This is the label that gets displayed in the book top left corner
    jobs = false,           --This is the job setting for the book, if false any job can access this book. If a list of jobs, only those jobs can access this book.
    skillList = {           --This is the skill list that gets displayed in the book with progressbars, you can decide if you want to display the skill in the book or not.
        {
            label = "Sugarfactory", --This is the label that gets displayed in the book
            skill = "drugs", --This is the skill name like in the vorp core skills.lua
        },
        {
            label = "Schreiner", --This is the label that gets displayed in the book
            skill = "woodwork", --This is the skill name like in the vorp core skills.lua
            --You can add a job and a minimum grade to see this skill in the book as progressbar, but 
            --you can remove the whole line so that it shows for everyone like in the skill above where jobs is removed completely.
            jobs = {{job = "sdwoodworker", grade = 1}}, },
    },

    categorys = {
        ["production"] = "Produce", --this is the category and its label that gets displayed in the book

    },
    categoryImages = {
        ["production"] = "sugar", --this is the category and the image that gets displayed in the book (itemname -> image from inventory)

    },

    --This line is optional and can be removed if not used
    categoryJobFilter = { -- This is the job filter for the category. If not set, the player can see the recipes in the category when he can open the book.
        -- When you set a job filter, the player can only see the category when he has the job and the grade. This filters all recipes of a category out without checking requirements set for a specific recipe in this category.
        ["production"] = {
            { job = "sd_woodworker", grade = 1 },
        },
    },

    --This line is optional and can be removed if not used
    categorySteamIDFilter = { -- This is the steam id filter for the category. If not set, the player can see the recipes in the category when he can open the book.
        ["production"] = {"steam:111111111111"}, -- This is the steam id of the player that can see the recipes in the category.
    },

    recipes = {
        ...
    },
}

Prompt keys

You can adjust the prompt key and hold time in the config file.

Config.PromptKey = 0xB2F377E8 -- A
Config.PromptHoldTime = 1000 -- 1 second (If you want to have a button and not a hold event, set this to 0)

Here you can find a list of all the prompt keys:

Source: https://forum.cfx.re/t/keybind-hashes/1666877/3

keys = {
    -- Letters

    ["A"] = 0x7065027D, ["B"] = 0x4CC0E2FE, ["C"] = 0x9959A6F0, ["D"] = 0xB4E465B4, ["E"] = 0xCEFD9220, ["F"] = 0xB2F377E8,
    ["G"] = 0x760A9C6F, ["H"] = 0x24978A28, ["I"] = 0xC1989F95, ["J"] = 0xF3830D8E, ["K"] = Missing, ["L"] = 0x80F28E95,
    ["M"] = 0xE31C6A41, ["N"] = 0x4BC9DABB (Push to talk key), ["O"] = 0xF1301666, ["P"] = 0xD82E0BD2, ["Q"] = 0xDE794E3E,
    ["R"] = 0xE30CD707, ["S"] = 0xD27782E3, ["T"] = Missing, ["U"] = 0xD8F73058, ["V"] = 0x7F8D09B8, ["W"] = 0x8FD015D8,
    ["X"] = 0x8CC9CD42, ["Y"] = Missing, ["Z"] = 0x26E9DC00

    -- Symbol Keys

    ["RIGHTBRACKET"] = 0xA5BDCD3C, ["LEFTBRACKET"] = 0x430593AA

    -- Mouse buttons

    ["MOUSE1"] = 0x07CE1E61, ["MOUSE2"] = 0xF84FA74F, ["MOUSE3"] = 0xCEE12B50, ["MWUP"] = 0x3076E97C

    -- Modifier Keys

    ["CTRL"] = 0xDB096B85, ["TAB"] = 0xB238FE0B, ["SHIFT"] = 0x8FFC75D6, ["SPACEBAR"] = 0xD9D0E1C0, ["ENTER"] = 0xC7B5340A,
    ["BACKSPACE"] = 0x156F7119, ["LALT"] = 0x8AAA0AD4, ["DEL"] = 0x4AF4D473, ["PGUP"] = 0x446258B6, ["PGDN"] = 0x3C3DD371,

    -- Function Keys

    ["F1"] = 0xA8E3F467, ["F4"] = 0x1F6D95E5, ["F6"] = 0x3C0A40F2

    -- Number Keys

    ["1"] = 0xE6F612E4, ["2"] = 0x1CE6D9EB, ["3"] = 0x4F49CC4C, ["4"] = 0x8F9F9E58, ["5"] = 0xAB62E997, ["6"] = 0xA1FDE2A6,
    ["7"] = 0xB03A913B, ["8"] = 0x42385422

    -- Arrow Keys

    ["DOWN"] = 0x05CA7C52, ["UP"] = 0x6319DB71, ["LEFT"] = 0xA65EBAB4, ["RIGHT"] = 0xDEB34313,
}

Add blips to crafting locations

If you want to add blips to crafting locations, you can add BlipSettings to a crafting location. Here is an example of how to do it:

Config.CraftingLocations = {
	{coords={-292.9522, 792.5771, 118.5612, 62.4914},book = "drugs_book",label ="Example Book for as Prompt", jobs= false, BlipSettings = {name = "Example Book", sprite = "blip_ambient_tithing", color = "PINKISH"} },
}

You set BlipSettings with a name, sprite and color. If you dont have BlipSettings in the line then it will not show a blip.

Possible colors

Here you can see all the possible colors you can use for the blip.

    --LIGHT_BLUE
    --DARK_RED
    --PURPLE
    --ORANGE
    --TEAL
    --LIGHT_YELLOW
    --PINK
    --GREEN
    --DARK_TEAL
    --RED
    --LIGHT_GREEN
    --TEAL2
    --BLUE
    --DARK_PUPLE
    --DARK_PINK
    --DARK_DARK_RED
    --GRAY
    --PINKISH
    --YELLOW_GREEN
    --DARK_GREEN
    --BRIGHT_BLUE
    --BRIGHT_PURPLE
    --YELLOW_ORANGE
    --BLUE2
    --TEAL3
    --TAN
    --OFF_WHITE
    --LIGHT_YELLOW2
    --LIGHT_PINK
    --LIGHT_RED
    --LIGHT_YELLOW3
    --WHITE