# qb-mechanicjob
Mechanic Job for QB-Core Framework :mechanic:

# License

    QBCore Framework
    Copyright (C) 2021 Joshua Eger

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>


## Dependencies
- [qb-core](https://github.com/qbcore-framework/qb-core)
- [qb-inventory](https://github.com/qbcore-framework/qb-inventory) - 

## Screenshots
![Platform](https://imgur.com/KzmXIaY.png)
![Vehicle Spawner](https://imgur.com/bDYiFoG.png)
![Stash](https://imgur.com/8fvy9FA.png)
![On Duty/Off Duty](https://i.imgur.com/CM34EsL.png)

## Features
- /setmechanic - Sets someone mechanic
- /firemechanic - Fires a mechanic worker
- On Duty/Off Duty
- Placing vehicles to platform for repairing it part by part.
- Towtruck, Blista, Minivan, Flatbed for workers.

## Installation
### Manual
- Download the script and put it in the `[qb]` directory.
- Import `qb-.sql` in your database
- Add the following code to your server.cfg/resouces.cfg
```
ensure qb-core
ensure qb-inventory
ensure qb-mechanicjob
```

## Configuration
```
Config.AttachedVehicle = nil -- Don't touch

Config.AuthorizedIds = { -- Authorized citizens (citizenid)
    "insertcitizenidhere",
}

Config.MaxStatusValues = { -- Max health values for parts
    ["engine"] = 1000.0,
    ["body"] = 1000.0,
    ["radiator"] = 100,
    ["axle"] = 100,
    ["brakes"] = 100,
    ["clutch"] = 100,
    ["fuel"] = 100,
}

Config.ValuesLabels = { -- Labels of parts (will be shown at platform)
    ["engine"] = "Motor",
    ["body"] = "Body",
    ["radiator"] = "Radiator",
    ["axle"] = "Drive Shaft",
    ["brakes"] = "Brakes",
    ["clutch"] = "Clutch",
    ["fuel"] = "Fuel Ttank",
}

Config.RepairCost = {
    ["body"] = "plastic", -- Material needed to repair the part
    ["radiator"] = "plastic",
    ["axle"] = "steel",
    ["brakes"] = "iron",
    ["clutch"] = "aluminum",
    ["fuel"] = "plastic",
}

Config.RepairCostAmount = { -- Material count needed to repair the part
    ["engine"] = {
        item = "metalscrap",
        costs = 2,
    },
    ["body"] = {
        item = "plastic",
        costs = 3,
    },
    ["radiator"] = {
        item = "steel",
        costs = 5,
    },
    ["axle"] = {
        item = "aluminum",
        costs = 7,
    },
    ["brakes"] = {
        item = "copper",
        costs = 5,
    },
    ["clutch"] = {
        item = "copper",
        costs = 6,
    },
    ["fuel"] = {
        item = "plastic",
        costs = 5,
    },
}

Config.Businesses = {
    "Auto Repair",
}

Config.Plates = { -- Platforms
    [1] = {
        coords = {x = 937.91, y = -970.64, z = 39.49, h = 271.5, r = 1.0},
        AttachedVehicle = nil,
    },
    [2] = {
        coords = {x = 922.37, y = -979.86, z = 39.49, h = 271.5, r = 1.0}, 
        AttachedVehicle = nil,
    },
    [3] = {
        coords = {x = 921.54, y = -962.17, z = 39.49, h = 274.5, r = 1.0}, 
        AttachedVehicle = nil,
    },
    [4] = {
        coords = {x = 949.89, y = -947.75, z = 39.49, h = 90.5, r = 1.0}, 
        AttachedVehicle = nil,
    },
}

Config.Locations = {
    ["exit"] = {x = 945.13, y = -975.84, z = 39.49, h = 181.5, r = 1.0},
    ["stash"] = {x = 947.62, y = -972.46, z = 39.49, h = 274.5, r = 1.0}, -- Stash Marker Location
    ["duty"] = {x = 950.73, y = -968.64, z = 39.5, h = 180.5, r = 1.0}, -- On Duty/Off Duty Marker Location
    ["vehicle"] = {x = 937.93, y = -990.7, z = 38.42, h = 94.5, r = 1.0},  -- Marker Location for towtruck, flatbed etc.
}

Config.Vehicles = { -- Available vehicles for workers
    ["flatbed"] = "Flatbed",
    ["towtruck"] = "Towtruck",
    ["minivan"] = "Minivan (Leen Auto)",
    ["blista"] = "Blista",
}

Config.MinimalMetersForDamage = { -- Minimum distance player needs to drive in order to vehicle to get damaged
    [1] = {
        min = 8000,
        max = 12000,
        multiplier = {
            min = 1,
            max = 8,
        }
    },
    [2] = {
        min = 12000,
        max = 16000,
        multiplier = {
            min = 8,
            max = 16,
        }
    },
    [3] = {
        min = 12000,
        max = 16000,
        multiplier = {
            min = 16,
            max = 24,
        }
    },
}

Config.Damages = { -- Part labels which will be damaged
    ["radiator"] = "Radiator",
    ["axle"] = "Drive Shaft",
    ["brakes"] = "Brakes",
    ["clutch"] = "Clutch",
    ["fuel"] = "Fuel Tank",
}
```
