Skip to content

Commit 81a028a

Browse files
committed
[FIX] Conflict with PR #1725
2 parents fd80479 + 48194a7 commit 81a028a

File tree

11 files changed

+1388
-325
lines changed

11 files changed

+1388
-325
lines changed

[core]/es_extended/server/classes/overrides/oxinventory.lua

Lines changed: 0 additions & 219 deletions
This file was deleted.
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
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+
--- Metadata Functions
103+
---@field getMeta fun(index?: string, subIndex?: string|table): any # Get metadata value(s).
104+
---@field setMeta fun(index: string, value: any, subValue?: any) # Set metadata value(s).
105+
---@field clearMeta fun(index: string, subValues?: string|table) # Clear metadata value(s).
106+
--- Notification Functions
107+
---@field showNotification fun(msg: string, notifyType?: string, length?: number, title?: string, position?: string) # Show a simple notification.
108+
---@field showAdvancedNotification fun(sender: string, subject: string, msg: string, textureDict: string, iconType: string, flash: boolean, saveToBrief: boolean, hudColorIndex: number) # Show advanced notification.
109+
---@field showHelpNotification fun(msg: string, thisFrame?: boolean, beep?: boolean, duration?: number) # Show help notification.
110+
--- Misc Functions
111+
---@field togglePaycheck fun(toggle: boolean) # Enable/disable paycheck.
112+
---@field isPaycheckEnabled fun(): boolean # Check if paycheck is enabled.
113+
---@field executeCommand fun(command: string) # Execute a server command.
114+
---@field triggerEvent fun(eventName: string, ...) # Trigger client event for this player.
115+
116+
---@class xPlayer:StaticPlayer
117+
--- Properties
118+
---@field accounts ESXAccount[] # Array of the player's accounts.
119+
---@field coords table # Player's coordinates {x, y, z, heading}.
120+
---@field group string # Player permission group.
121+
---@field identifier string # Unique identifier (usually Steam or license).
122+
---@field license string # Player license string.
123+
---@field inventory ESXInventoryItem[] # Player's inventory items.
124+
---@field job ESXJob # Player's current job.
125+
---@field loadout ESXInventoryWeapon[] # Player's current weapons.
126+
---@field name string # Player's display name.
127+
---@field playerId number # Player's ID (server ID).
128+
---@field source number # Player's source (alias for playerId).
129+
---@field variables table # Custom player variables.
130+
---@field weight number # Current carried weight.
131+
---@field maxWeight number # Maximum carry weight.
132+
---@field metadata table # Custom metadata table.
133+
---@field lastPlaytime number # Last recorded playtime in seconds.
134+
---@field paycheckEnabled boolean # Whether paycheck is enabled.
135+
---@field admin boolean # Whether the player is an admin.
136+
137+
---@class xPlayerClass:xPlayer
138+
---@field hooks { hookId: string, functionName: string, invokerRes: string, isJustAddition: boolean, functionReference: fun(xPlayer: xPlayer, ...: any): any }[]
139+
---@field addHook fun(self: xPlayerClass, functionName: string, isJustAddition: boolean, functionReference: fun(xPlayer: xPlayer, ...: any): any): string Returns the hookId of the created hook
140+
---@field removeHook fun(self: xPlayerClass, hookId: string): boolean Returns success status
141+
---@field kick function
142+
---@field setMoney function
143+
---@field getMoney function
144+
---@field addMoney function
145+
---@field removeMoney function
146+
---@field getInventory function
147+
---@field getLoadout function
148+
---@field setAccountMoney function
149+
---@field addAccountMoney function
150+
---@field removeAccountMoney function
151+
---@field getInventoryItem function
152+
---@field addInventoryItem function
153+
---@field removeInventoryItem function
154+
---@field setInventoryItem function
155+
---@field canCarryItem function
156+
---@field canSwapItem function
157+
---@field setMaxWeight function
158+
---@field addWeapon function
159+
---@field addWeaponComponent function
160+
---@field addWeaponAmmo function
161+
---@field updateWeaponAmmo function
162+
---@field setWeaponTint function
163+
---@field getWeaponTint function
164+
---@field removeWeapon function
165+
---@field removeWeaponComponent function
166+
---@field removeWeaponAmmo function
167+
---@field hasWeaponComponent function
168+
---@field hasWeapon function
169+
---@field hasItem function
170+
---@field getWeapon function
171+
---@field showNotification function
172+
---@field showAdvancedNotification function
173+
---@field showHelpNotification function
174+
---@field __index fun(self: xPlayerClass, k: string): any
175+
---@field __newindex fun(self: xPlayerClass, k: string, v: any)
176+
---@field __call fun(self: xPlayerClass, xPlayer: xPlayer, functionName): fun(...: any): any Function to convert each function from the xPlayer class to actual xPlayer function (only available to call from es_extended)

0 commit comments

Comments
 (0)