# Chicken Coop

## Features

🎨 **Intuitive, modern UI**

⏰ **Breeding cycle every four hours.**

🏡 **Place your chicken coop wherever you want.**

⚙️ **Fully configurable and easy to translate**

📡 **Webhook**

🐔 **Add roosters, chickens and chicks to your chicken coop in your inventory.**

👩‍🌾 **Manage the reproduction of your roosters and chickens.**

🛠️ **Maintain your chicken coop**

🌾 **Feed your animals**

🥚 **Collect the eggs in your chicken coop.**

🔪 **Slaughter your animals before they die of old age.**

***

## VORPCore

### Requierements

* VORP Core (2.4 or later)
* VORP Inventory
* VORP Character
* oxymsql

### Installation Steps

* Add `chickencoop_01` yo tour /resources/\[streaming]
* Add `ks_chickencoop` to your resource file
* Add ensure `chickencoop_01` to your resources.cfg
* Add ensure `ks_chickencoop` to your resources.cfg
* Run `data.sql` sql file
* Add `items` folder in /vorp\_inventory/html/img/items
* Configure `config.lua` file

## RSGCore and QBRCore

### Requierements

* RSG-Core or QBR-Core
* RSG-Inventory or QBR-Inventory
* ox\_lib
* oxymsql

### Installation Steps

* Add `chickencoop_01` yo tour /resources/\[streaming]
* Add `ks_chickencoop` to your resource file
* Add ensure `chickencoop_01` to your resources.cfg
* Add ensure `ks_chickencoop` to your resources.cfg
* Run `data.sql` sql file
* Add images from the `items` folder to rsg-inventory/html/images
* Copy/paste the contents of `items/items.lua` into `rsg-core/shared/items.lua`
* Configure `config.lua` file

***

## Useful Information

* Your chicken coop needs to be well fed and clean to produce eggs and chicks.
* You must have at least one rooster in the chicken coop if you want new chicks to be born.
* Adult animals in incubation will not produce anything, so consider transferring them.

## Commands

<details>

<summary>/deleteChickenCoop</summary>

Allows you to delete your nearest chicken coop.\
\ <mark style="color:red;">This command can be translated in</mark><mark style="color:red;">`ks_chickencoop/languages/language.lua`</mark>

</details>

<details>

<summary>/testChickenCoop (Only Admin)</summary>

Allows admins to test script cycles.\
\ <mark style="color:red;">Please note: The command will start a production and birth cycle each time it is used.</mark>

</details>

## Config File

### config.lua

```lua
Config = {
    defaultLang = 'en',
    useWebhook = true,

    webhook = {
        -- Example: https://discord.com/api/webhooks/14016157582420521/ghTBSTcACQmkdddjrjcozqf9T3SKBEgoRngHHxRPOLr
        webHookLink = '',
        -- Example: https://cdn.discordapp.com/attachments/14016157582420521/12045554394/logo2.png?ex=65d36eb7&is=65c0f9b7&hm=30579c3cd934849e845b&
        webHookLogo = '',
        -- Example: https://cdn.discordapp.com/attachments/14016157582420521/12045554394/logo2.png?ex=65d36eb7&is=65c0f9b7&hm=30579c3cd934849e845b&
        webHookIconUrl = '',
    },

    bliphash = 1220803671,              -- https://github.com/femga/rdr3_discoveries/tree/master/useful_info_from_rpfs/textures/blips
    
    onlyOwnerCanManage = false,          -- If true, only the owner can maintain the chicken coop.
    joblock = false,                     -- If true, only characters with an authorised job can maintain the chicken coop.

    authorizedJob = {
        'farmer',
        'breeder',
    },
    
    maxCoopByChar = 2,                  -- The maximum number of chicken coops per character.
    spawnAnimals = 7,                   -- Sets the number of animal props that spawn when approaching the chicken coop.
    maxEgg = 20,                        -- The maximum number of eggs a chick coop can hold. Do not exceed the item limit in the database.
    maxAdultAnimalsInCoop = 20,         -- Maximum number of adult animals in a chick coop.
    animCleanDuration = 15000,          -- Duration of cleaning animation in miliseconds.
    animFeedDuration = 18000,

    foodAccepted = {                    -- List the items in the database that are used to feed the animals.
        'apple',
        'corn',
    },

    cycle = {
        adultAge = 1,                           -- Age from wich animal is an Adult
        oldAge = 5,                             -- Age from which an animal can die of old age
        addEggWithoutRoosterInCoop = 80,        -- 80% chance to add one egg by chicken without rooster adult in coop
        addEggWithRoosterInCoop = 30,           -- 30% chance to add one egg by chicken with rooster adult in coop
        addChick = 20,                          -- 20% chance to born a chick
        probabilityOfDying = 5,                 -- 5% chance that an animal will die of old age if it has passed the oldAge
        increaseAgeByCycle = 0.15               -- 0.15 year by cycle
    },

    slaughter = {                               -- Defines the items obtained when slaughtering animals
        rooster = {
            ['bird'] = {
                label = 'Chicken Meat',
                quantity = 1
            },
            ['chickenf'] = {
                label = 'Chicken Feather',
                quantity = 1
            },
        --[[
            ['databaseName'] = {
                label = 'Chicken Feather',
                quantity = 1
            },
        ]]--
        },
        chicken = {
            ['bird'] = {
                label = 'Rooster Meat',
                quantity = 1
            },
            ['chickenf'] = {
                label = 'Rooster Feather',
                quantity = 1
            },
        }
    }
}

```

### Languages

To add new languages, create a new array with the key to the `interface.lua` and `language.lua` files.<br>
