Skip to content

Commit

Permalink
refactor: reconstruction of the drug system
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Aug 27, 2024
1 parent 52a855c commit 15d20c5
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,9 @@ INSERT INTO `bpt_items` (`name`, `label`) VALUES
('plastic_bag', 'Plastic bag'),
('recycled_plastic', 'Recycled plastic'),
('WEAPON_NIGHTSTICK', 'NIGHTSTICK'),
('WEAPON_PISTOL', 'Pistol')
('WEAPON_PISTOL', 'Pistol'),
('marijuana', 'marijuana'),
('cannabis', 'Cannabis'),
('diamond_tip', 'Diamond tip'),
('diamond', 'Diamond')
;
39 changes: 36 additions & 3 deletions server-data/resources/[bpt_addons]/bpt_crafting/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@ Config = {
},
},

["marijuana"] = {
Level = 0,
Category = "medical",
isGun = false,
Jobs = { "ambulance" },
JobGrades = {},
Amount = 1,
SuccessRate = 100,
requireBlueprint = false,
Time = 20,
Ingredients = {
["cannabis"] = 2,
["diamond_tip"] = 1,
},
},

["cottonforbandages"] = {
Level = 0, -- From what level this item will be craftable
Category = "import", -- The category item will be put in
Expand Down Expand Up @@ -98,6 +114,23 @@ Config = {
},
},

["diamond_tip"] = {
Level = 0,
Category = "import",
isGun = false,
Jobs = { "import" },
JobGrades = {},
Amount = 1,
SuccessRate = 100,
requireBlueprint = false,
Time = 60,
Ingredients = {
["diamond"] = 1,
["hammer"] = 1,
["steel"] = 1,
},
},

["recycled_paper"] = {
Level = 0,
Category = "import",
Expand Down Expand Up @@ -426,14 +459,14 @@ Config = {
coords = vector3(1020.936279, -2404.628662, 30.122314),
jobs = { "import" },
blip = false,
recipes = { "cottonforbandages", "hammer", "ironsheet", "recycled_paper", "paper", "recycled_plastic", "iron" },
recipes = { "cottonforbandages", "hammer", "ironsheet", "recycled_paper", "paper", "recycled_plastic", "iron", "diamond_tip" },
radius = 1.0,
},
{
coords = vector3(311.314301, -565.213196, 43.282104),
jobs = { "ambulance" },
blip = false,
recipes = { "bandage" },
recipes = { "bandage", "marijuana" },
radius = 1.0,
},
{
Expand Down Expand Up @@ -469,7 +502,7 @@ Config = {
coords = vector3(83.156044, -1960.259277, 18.041016),
jobs = { "ballas" },
blip = false,
recipes = { "cigarette_paper" },
recipes = { "cigarette_paper", "marijuana" },
radius = 1.0,
},
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,9 @@ INSERT INTO `bpt_items` (`name`, `label`) VALUES
('plastic_bag', 'Sacchetto di plastica'),
('recycled_plastic', 'Plastica riciclata'),
('WEAPON_NIGHTSTICK', 'Manganello'),
('WEAPON_PISTOL', 'Pistola 9mm')
('WEAPON_PISTOL', 'Pistola 9mm'),
('marijuana', 'marijuana'),
('cannabis', 'Cannabis'),
('diamond_tip', 'Punta di diamante'),
('diamond', 'Diamond')
;
6 changes: 3 additions & 3 deletions server-data/resources/[bpt_addons]/bpt_drugs/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function OpenDrugShop()
}
menuOpen = true

for k, v in pairs(ESX.GetPlayerData().inventory) do
for _, v in pairs(ESX.GetPlayerData().inventory) do
local price = Config.DrugDealerItems[v.name]

if price and v.count > 0 then
Expand Down Expand Up @@ -92,7 +92,7 @@ function OpenDrugShop()
end

TriggerServerEvent("bpt_drugs:sellDrug", tostring(element.name), count)
end, function(menu)
end, function()
menuOpen = false
end)
end, function(menu)
Expand Down Expand Up @@ -130,7 +130,7 @@ function CreateBlipCircle(coords, text, radius, color, sprite)
end

CreateThread(function()
for k, zone in pairs(Config.CircleZones) do
for _, zone in pairs(Config.CircleZones) do
CreateBlipCircle(zone.coords, zone.name, zone.radius, zone.color, zone.sprite)
end
end)
8 changes: 0 additions & 8 deletions server-data/resources/[bpt_addons]/bpt_drugs/client/weed.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ CreateThread(function()
end
end)

function ProcessWeed(xCannabis)
ESX.ShowNotification(TranslateCap("weed_processingstarted"))
TriggerServerEvent("bpt_drugs:processCannabis")
if xCannabis <= 3 then
xCannabis = 0
end
end

CreateThread(function()
while true do
local Sleep = 1500
Expand Down
21 changes: 8 additions & 13 deletions server-data/resources/[ox]/ox_inventory/data/items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ return {
consume = 0,
},

["diamond_tip"] = {
label = "Punta di diamante",
weight = 1,
stack = true,
close = false,
consume = 0,
},

["emerald"] = {
label = "Smeraldo",
weight = 1,
Expand Down Expand Up @@ -557,19 +565,6 @@ return {
},
},

["coke_seed"] = {
label = "seme di cocaina",
weight = 220,
stack = true,
},

["coke"] = {
label = "cocaina",
weight = 220,
stack = true,
consume = 1,
},

["salmon_fillet"] = {
label = "filetto di salmone",
weight = 220,
Expand Down
13 changes: 0 additions & 13 deletions server-data/resources/[ox]/ox_inventory/data/shops.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,6 @@ return {
targets = {},
},

ballas = {
name = "ballas",
groups = {
["ballas"] = 0,
},
inventory = {
{ name = "coke_seed", price = 15000 },
},
locations = {
vec3(81.692307, -1966.021973, 18.041016),
},
},

Grocerystore = {
name = "Grocerystore",
blip = {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 15d20c5

Please sign in to comment.