Skip to content

Commit 3dabbd1

Browse files
authored
Merge pull request #1754 from Kr3mu/types
(refactor:es_extended) Moves types to the additional folder types
2 parents 0e9b8e5 + 2f79933 commit 3dabbd1

File tree

9 files changed

+172
-176
lines changed

9 files changed

+172
-176
lines changed

[core]/es_extended/client/functions.lua

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -272,23 +272,6 @@ function ESX.UI.Menu.RegisterType(menuType, open, close)
272272
}
273273
end
274274

275-
---@class ESXMenu
276-
---@field type string
277-
---@field namespace string
278-
---@field resourceName string
279-
---@field name string
280-
---@field data table
281-
---@field submit? function
282-
---@field cancel? function
283-
---@field change? function
284-
---@field close function
285-
---@field update function
286-
---@field refresh function
287-
---@field setElement function
288-
---@field setElements function
289-
---@field setTitle function
290-
---@field removeElement function
291-
292275
---@param menuType string
293276
---@param namespace string
294277
---@param name string

[core]/es_extended/server/classes/player.lua

Lines changed: 0 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1,141 +1,3 @@
1-
---@class ESXAccount
2-
---@field name string # Account name (e.g., "bank", "money").
3-
---@field money number # Current balance in this account.
4-
---@field label string # Human-readable label for the account.
5-
---@field round boolean # Whether amounts are rounded for display.
6-
---@field index number # Index of the account in the player's accounts list.
7-
8-
---@class ESXItem
9-
---@field name string # Item identifier (internal name).
10-
---@field label string # Display name of the item.
11-
---@field weight number # Weight of a single unit of the item.
12-
---@field usable boolean # Whether the item can be used.
13-
---@field rare boolean # Whether the item is rare.
14-
---@field canRemove boolean # Whether the item can be removed from inventory.
15-
16-
---@class ESXInventoryItem:ESXItem
17-
---@field count number # Number of this item in the player's inventory.
18-
19-
---@class ESXJob
20-
---@field id number # Job ID.
21-
---@field name string # Job internal name.
22-
---@field label string # Job display label.
23-
---@field grade number # Current grade/rank number.
24-
---@field grade_name string # Name of the current grade.
25-
---@field grade_label string # Label of the current grade.
26-
---@field grade_salary number # Salary for the current grade.
27-
---@field skin_male table # Skin configuration for male characters.
28-
---@field skin_female table # Skin configuration for female characters.
29-
---@field onDuty boolean? # Whether the player is currently on duty.
30-
31-
---@class ESXWeapon
32-
---@field name string # Weapon identifier (internal name).
33-
---@field label string # Weapon display name.
34-
35-
---@class ESXInventoryWeapon:ESXWeapon
36-
---@field ammo number # Amount of ammo in the weapon.
37-
---@field components string[] # List of components attached to the weapon.
38-
---@field tintIndex number # Current weapon tint index.
39-
40-
---@class ESXWeaponComponent
41-
---@field name string # Component identifier (internal name).
42-
---@field label string # Component display name.
43-
---@field hash string|number # Component hash or identifier.
44-
45-
---@class StaticPlayer
46-
---@field src number # Player's server ID.
47-
--- Money Functions
48-
---@field setMoney fun(money: number) # Set player's cash balance.
49-
---@field getMoney fun(): number # Get player's current cash balance.
50-
---@field addMoney fun(money: number, reason: string) # Add money to the player's cash balance.
51-
---@field removeMoney fun(money: number, reason: string) # Remove money from the player's cash balance.
52-
---@field setAccountMoney fun(accountName: string, money: number, reason?: string) # Set specific account balance.
53-
---@field addAccountMoney fun(accountName: string, money: number, reason?: string) # Add money to an account.
54-
---@field removeAccountMoney fun(accountName: string, money: number, reason?: string) # Remove money from an account.
55-
---@field getAccount fun(account: string): ESXAccount? # Get account data by name.
56-
---@field getAccounts fun(minimal?: boolean): ESXAccount[]|table<string,number> # Get all accounts, optionally minimal.
57-
--- Inventory Functions
58-
---@field getInventory fun(minimal?: boolean): ESXInventoryItem[]|table<string,number> # Get inventory, optionally minimal.
59-
---@field getInventoryItem fun(itemName: string): ESXInventoryItem? # Get a specific item from inventory.
60-
---@field addInventoryItem fun(itemName: string, count: number) # Add items to inventory.
61-
---@field removeInventoryItem fun(itemName: string, count: number) # Remove items from inventory.
62-
---@field setInventoryItem fun(itemName: string, count: number) # Set item count in inventory.
63-
---@field getWeight fun(): number # Get current carried weight.
64-
---@field getMaxWeight fun(): number # Get maximum carry weight.
65-
---@field setMaxWeight fun(newWeight: number) # Set maximum carry weight.
66-
---@field canCarryItem fun(itemName: string, count: number): boolean # Check if player can carry more of an item.
67-
---@field canSwapItem fun(firstItem: string, firstItemCount: number, testItem: string, testItemCount: number): boolean # Check if items can be swapped.
68-
---@field hasItem fun(item: string): ESXInventoryItem|false, number? # Check if player has an item.
69-
---@field getLoadout fun(minimal?: boolean): ESXInventoryWeapon[]|table<string, {ammo:number, tintIndex?:number, components?:string[]}> # Get player's weapon loadout.
70-
--- Job Functions
71-
---@field getJob fun(): ESXJob # Get player's current job.
72-
---@field setJob fun(newJob: string, grade: string, onDuty?: boolean) # Set player's job and grade.
73-
---@field setGroup fun(newGroup: string) # Set player's permission group.
74-
---@field getGroup fun(): string # Get player's permission group.
75-
--- Weapon Functions
76-
---@field addWeapon fun(weaponName: string, ammo: number) # Give player a weapon.
77-
---@field removeWeapon fun(weaponName: string) # Remove weapon from player.
78-
---@field hasWeapon fun(weaponName: string): boolean # Check if player has a weapon.
79-
---@field getWeapon fun(weaponName: string): number?, table? # Get weapon ammo & components.
80-
---@field addWeaponAmmo fun(weaponName: string, ammoCount: number) # Add ammo to a weapon.
81-
---@field removeWeaponAmmo fun(weaponName: string, ammoCount: number) # Remove ammo from a weapon.
82-
---@field updateWeaponAmmo fun(weaponName: string, ammoCount: number) # Update ammo count for a weapon.
83-
---@field addWeaponComponent fun(weaponName: string, weaponComponent: string) # Add component to weapon.
84-
---@field removeWeaponComponent fun(weaponName: string, weaponComponent: string) # Remove component from weapon.
85-
---@field hasWeaponComponent fun(weaponName: string, weaponComponent: string): boolean # Check if weapon has component.
86-
---@field setWeaponTint fun(weaponName: string, weaponTintIndex: number) # Set weapon tint.
87-
---@field getWeaponTint fun(weaponName: string): number # Get weapon tint.
88-
--- Player State Functions
89-
---@field getIdentifier fun(): string # Get player's unique identifier.
90-
---@field getSSN fun(): string # Get player's social security number.
91-
---@field getSource fun(): number # Get player source/server ID.
92-
---@field getPlayerId fun(): number # Alias for getSource.
93-
---@field getName fun(): string # Get player's name.
94-
---@field setName fun(newName: string) # Set player's name.
95-
---@field setCoords fun(coordinates: vector4|vector3|table) # Teleport player to coordinates.
96-
---@field getCoords fun(vector?: boolean, heading?: boolean): vector3|vector4|table # Get player's coordinates.
97-
---@field isAdmin fun(): boolean # Check if player is admin.
98-
---@field kick fun(reason: string) # Kick player from server.
99-
---@field getPlayTime fun(): number # Get total playtime in seconds.
100-
---@field set fun(k: string, v: any) # Set custom variable.
101-
---@field get fun(k: string): any # Get custom variable.
102-
---@field updatePlayerData fun(key: string, value: any) # Update player data
103-
--- Metadata Functions
104-
---@field getMeta fun(index?: string, subIndex?: string|table): any # Get metadata value(s).
105-
---@field setMeta fun(index: string, value: any, subValue?: any) # Set metadata value(s).
106-
---@field clearMeta fun(index: string, subValues?: string|table) # Clear metadata value(s).
107-
--- Notification Functions
108-
---@field showNotification fun(msg: string, notifyType?: string, length?: number, title?: string, position?: string) # Show a simple notification.
109-
---@field showAdvancedNotification fun(sender: string, subject: string, msg: string, textureDict: string, iconType: string, flash: boolean, saveToBrief: boolean, hudColorIndex: number) # Show advanced notification.
110-
---@field showHelpNotification fun(msg: string, thisFrame?: boolean, beep?: boolean, duration?: number) # Show help notification.
111-
--- Misc Functions
112-
---@field togglePaycheck fun(toggle: boolean) # Enable/disable paycheck.
113-
---@field isPaycheckEnabled fun(): boolean # Check if paycheck is enabled.
114-
---@field executeCommand fun(command: string) # Execute a server command.
115-
---@field triggerEvent fun(eventName: string, ...) # Trigger client event for this player.
116-
117-
118-
---@class xPlayer:StaticPlayer
119-
--- Properties
120-
---@field accounts ESXAccount[] # Array of the player's accounts.
121-
---@field coords table # Player's coordinates {x, y, z, heading}.
122-
---@field group string # Player permission group.
123-
---@field identifier string # Unique identifier (usually Steam or license).
124-
---@field license string # Player license string.
125-
---@field inventory ESXInventoryItem[] # Player's inventory items.
126-
---@field job ESXJob # Player's current job.
127-
---@field loadout ESXInventoryWeapon[] # Player's current weapons.
128-
---@field name string # Player's display name.
129-
---@field playerId number # Player's ID (server ID).
130-
---@field source number # Player's source (alias for playerId).
131-
---@field variables table # Custom player variables.
132-
---@field weight number # Current carried weight.
133-
---@field maxWeight number # Maximum carry weight.
134-
---@field metadata table # Custom metadata table.
135-
---@field lastPlaytime number # Last recorded playtime in seconds.
136-
---@field paycheckEnabled boolean # Whether paycheck is enabled.
137-
---@field admin boolean # Whether the player is an admin.
138-
1391
---@param playerId number
1402
---@param identifier string
1413
---@param ssn string

[core]/es_extended/server/classes/vehicle.lua

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
---@class CVehicleData
2-
---@field plate string
3-
---@field netId number
4-
---@field entity number
5-
---@field modelHash number
6-
---@field owner string
7-
8-
---@class CExtendedVehicle
9-
---@field plate string
10-
---@field isValid fun(self:CExtendedVehicle):boolean
11-
---@field new fun(owner:string, plate:string, coords:vector4): CExtendedVehicle?
12-
---@field getFromPlate fun(plate:string):CExtendedVehicle?
13-
---@field getPlate fun(self:CExtendedVehicle):string?
14-
---@field getNetId fun(self:CExtendedVehicle):number?
15-
---@field getEntity fun(self:CExtendedVehicle):number?
16-
---@field getModelHash fun(self:CExtendedVehicle):number?
17-
---@field getOwner fun(self:CExtendedVehicle):string?
18-
---@field setPlate fun(self:CExtendedVehicle, newPlate:string):boolean
19-
---@field setProps fun(self:CExtendedVehicle, newProps:table):boolean
20-
---@field setOwner fun(self:CExtendedVehicle, newOwner:string):boolean
21-
---@field delete fun(self:CExtendedVehicle, garageName:string?, isImpound:boolean?):nil
221
Core.vehicleClass = {
232
plate = "",
243
new = function(owner, plate, coords)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---@class ESXAccount
2+
---@field name string # Account name (e.g., "bank", "money").
3+
---@field money number # Current balance in this account.
4+
---@field label string # Human-readable label for the account.
5+
---@field round boolean # Whether amounts are rounded for display.
6+
---@field index number # Index of the account in the player's accounts list.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---@class ESXItem
2+
---@field name string # Item identifier (internal name).
3+
---@field label string # Display name of the item.
4+
---@field weight number # Weight of a single unit of the item.
5+
---@field usable boolean # Whether the item can be used.
6+
---@field rare boolean # Whether the item is rare.
7+
---@field canRemove boolean # Whether the item can be removed from inventory.
8+
9+
---@class ESXInventoryItem:ESXItem
10+
---@field count number # Number of this item in the player's inventory.
11+
12+
---@class ESXWeapon
13+
---@field name string # Weapon identifier (internal name).
14+
---@field label string # Weapon display name.
15+
16+
---@class ESXInventoryWeapon:ESXWeapon
17+
---@field ammo number # Amount of ammo in the weapon.
18+
---@field components string[] # List of components attached to the weapon.
19+
---@field tintIndex number # Current weapon tint index.
20+
21+
---@class ESXWeaponComponent
22+
---@field name string # Component identifier (internal name).
23+
---@field label string # Component display name.
24+
---@field hash string|number # Component hash or identifier.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---@class ESXJob
2+
---@field id number # Job ID.
3+
---@field name string # Job internal name.
4+
---@field label string # Job display label.
5+
---@field grade number # Current grade/rank number.
6+
---@field grade_name string # Name of the current grade.
7+
---@field grade_label string # Label of the current grade.
8+
---@field grade_salary number # Salary for the current grade.
9+
---@field skin_male table # Skin configuration for male characters.
10+
---@field skin_female table # Skin configuration for female characters.
11+
---@field onDuty boolean? # Whether the player is currently on duty.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---@class ESXMenu
2+
---@field type string
3+
---@field namespace string
4+
---@field resourceName string
5+
---@field name string
6+
---@field data table
7+
---@field submit? function
8+
---@field cancel? function
9+
---@field change? function
10+
---@field close function
11+
---@field update function
12+
---@field refresh function
13+
---@field setElement function
14+
---@field setElements function
15+
---@field setTitle function
16+
---@field removeElement function

0 commit comments

Comments
 (0)