mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
refactor(server/classes/player): refactor some functions
small code format
This commit is contained in:
@@ -121,17 +121,17 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
|
||||
function self.getAccounts(minimal)
|
||||
if minimal then
|
||||
local minimalAccounts = {}
|
||||
|
||||
for i=1, #self.accounts do
|
||||
minimalAccounts[self.accounts[i].name] = self.accounts[i].money
|
||||
end
|
||||
|
||||
return minimalAccounts
|
||||
else
|
||||
if not minimal then
|
||||
return self.accounts
|
||||
end
|
||||
|
||||
local minimalAccounts = {}
|
||||
|
||||
for i=1, #self.accounts do
|
||||
minimalAccounts[self.accounts[i].name] = self.accounts[i].money
|
||||
end
|
||||
|
||||
return minimalAccounts
|
||||
end
|
||||
|
||||
function self.getAccount(account)
|
||||
@@ -163,32 +163,31 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
|
||||
function self.getLoadout(minimal)
|
||||
if minimal then
|
||||
local minimalLoadout = {}
|
||||
|
||||
for k,v in ipairs(self.loadout) do
|
||||
minimalLoadout[v.name] = {ammo = v.ammo}
|
||||
if v.tintIndex > 0 then minimalLoadout[v.name].tintIndex = v.tintIndex end
|
||||
|
||||
if #v.components > 0 then
|
||||
local components = {}
|
||||
|
||||
for k2,component in ipairs(v.components) do
|
||||
if component ~= 'clip_default' then
|
||||
components[#components + 1] = component
|
||||
end
|
||||
end
|
||||
|
||||
if #components > 0 then
|
||||
minimalLoadout[v.name].components = components
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return minimalLoadout
|
||||
else
|
||||
if not minimal then
|
||||
return self.loadout
|
||||
end
|
||||
local minimalLoadout = {}
|
||||
|
||||
for k,v in ipairs(self.loadout) do
|
||||
minimalLoadout[v.name] = {ammo = v.ammo}
|
||||
if v.tintIndex > 0 then minimalLoadout[v.name].tintIndex = v.tintIndex end
|
||||
|
||||
if #v.components > 0 then
|
||||
local components = {}
|
||||
|
||||
for k2,component in ipairs(v.components) do
|
||||
if component ~= 'clip_default' then
|
||||
components[#components + 1] = component
|
||||
end
|
||||
end
|
||||
|
||||
if #components > 0 then
|
||||
minimalLoadout[v.name].components = components
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return minimalLoadout
|
||||
end
|
||||
|
||||
function self.getName()
|
||||
|
||||
Reference in New Issue
Block a user