mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
refactor!(es_extended): move Jobs into core
This commit is contained in:
@@ -527,7 +527,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
onDuty = Config.DefaultJobDuty
|
||||
end
|
||||
|
||||
local jobObject, gradeObject = ESX.Jobs[newJob], ESX.Jobs[newJob].grades[grade]
|
||||
local jobObject, gradeObject = Core.Jobs[newJob], Core.Jobs[newJob].grades[grade]
|
||||
|
||||
self.job = {
|
||||
id = jobObject.id,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
ESX.Players = {}
|
||||
ESX.Jobs = {}
|
||||
ESX.Items = {}
|
||||
Core = {}
|
||||
Core.Jobs = {}
|
||||
Core.JobsPlayerCount = {}
|
||||
Core.UsableItemsCallbacks = {}
|
||||
Core.RegisteredCommands = {}
|
||||
|
||||
@@ -495,9 +495,9 @@ function ESX.RefreshJobs()
|
||||
|
||||
if not Jobs then
|
||||
-- Fallback data, if no jobs exist
|
||||
ESX.Jobs["unemployed"] = { label = "Unemployed", grades = { ["0"] = { grade = 0, label = "Unemployed", salary = 200, skin_male = {}, skin_female = {} } } }
|
||||
Core.Jobs["unemployed"] = { label = "Unemployed", grades = { ["0"] = { grade = 0, label = "Unemployed", salary = 200, skin_male = {}, skin_female = {} } } }
|
||||
else
|
||||
ESX.Jobs = Jobs
|
||||
Core.Jobs = Jobs
|
||||
end
|
||||
end
|
||||
|
||||
@@ -558,7 +558,7 @@ end
|
||||
|
||||
---@return table
|
||||
function ESX.GetJobs()
|
||||
return ESX.Jobs
|
||||
return Core.Jobs
|
||||
end
|
||||
|
||||
---@return table
|
||||
@@ -601,7 +601,7 @@ end
|
||||
---@param grade string
|
||||
---@return boolean
|
||||
function ESX.DoesJobExist(job, grade)
|
||||
return (ESX.Jobs[job] and ESX.Jobs[job].grades[tostring(grade)] ~= nil) or false
|
||||
return (Core.Jobs[job] and Core.Jobs[job].grades[tostring(grade)] ~= nil) or false
|
||||
end
|
||||
|
||||
---@param playerId string | number
|
||||
|
||||
@@ -69,7 +69,7 @@ end
|
||||
|
||||
if Config.Multichar then
|
||||
AddEventHandler("esx:onPlayerJoined", function(src, char, data)
|
||||
while not next(ESX.Jobs) do
|
||||
while not next(Core.Jobs) do
|
||||
Wait(50)
|
||||
end
|
||||
|
||||
@@ -85,7 +85,7 @@ if Config.Multichar then
|
||||
else
|
||||
RegisterNetEvent("esx:onPlayerJoined", function()
|
||||
local _source = source
|
||||
while not next(ESX.Jobs) do
|
||||
while not next(Core.Jobs) do
|
||||
Wait(50)
|
||||
end
|
||||
|
||||
@@ -171,7 +171,7 @@ function loadESXPlayer(identifier, playerId, isNew)
|
||||
job, grade = "unemployed", "0"
|
||||
end
|
||||
|
||||
local jobObject, gradeObject = ESX.Jobs[job], ESX.Jobs[job].grades[grade]
|
||||
local jobObject, gradeObject = Core.Jobs[job], Core.Jobs[job].grades[grade]
|
||||
|
||||
userData.job = {
|
||||
id = jobObject.id,
|
||||
|
||||
@@ -6,7 +6,7 @@ local NOTIFY_TYPES = {
|
||||
}
|
||||
|
||||
local function doesJobAndGradesExist(name, grades)
|
||||
if not ESX.Jobs[name] then
|
||||
if not Core.Jobs[name] then
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -86,7 +86,7 @@ function ESX.CreateJob(name, label, grades)
|
||||
return success
|
||||
end
|
||||
|
||||
ESX.Jobs[name] = generateNewJobTable(name, label, grades)
|
||||
Core.Jobs[name] = generateNewJobTable(name, label, grades)
|
||||
|
||||
notify("SUCCESS", currentResourceName, 'Job created successfully: `%s`', name)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user