@cybermp/client-types 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/out/bitfields.d.ts +256 -0
- package/out/classes.d.ts +142123 -0
- package/out/enums.d.ts +17887 -0
- package/out/index.d.ts +16131 -0
- package/out/precomputed/classes.d.ts +12 -0
- package/out/precomputed/enums.d.ts +22 -0
- package/out/precomputed/events.d.ts +65 -0
- package/out/precomputed/game.d.ts +140 -0
- package/out/precomputed/global.d.ts +137 -0
- package/out/precomputed/index.d.ts +7 -0
- package/out/precomputed/meta.d.ts +15 -0
- package/out/precomputed/primitives.d.ts +25 -0
- package/package.json +32 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference path="./enums.d.ts" />
|
|
2
|
+
|
|
3
|
+
declare class worldWeatherScriptInterface extends IScriptable {
|
|
4
|
+
public SetWeather(
|
|
5
|
+
weather: CyberEnums.WeatherState,
|
|
6
|
+
blendTime?: number,
|
|
7
|
+
priority?: number
|
|
8
|
+
): void;
|
|
9
|
+
public ResetWeather(forceRestore?: boolean, blendTime?: number): void;
|
|
10
|
+
public GetWeatherState(): worldWeatherState;
|
|
11
|
+
public GetEnvironmentDefinition(): worldEnvironmentDefinition;
|
|
12
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare namespace CyberEnums {
|
|
2
|
+
/**
|
|
3
|
+
* See {@link worldWeatherState#name}
|
|
4
|
+
*/
|
|
5
|
+
declare enum WeatherState {
|
|
6
|
+
SUNNY = "24h_weather_sunny",
|
|
7
|
+
LIGHT_CLOUDS = "24h_weather_light_clouds",
|
|
8
|
+
CLOUDY = "24h_weather_cloudy",
|
|
9
|
+
HEAVY_CLOUDS = "24h_weather_heavy_clouds",
|
|
10
|
+
FOG = "24h_weather_fog",
|
|
11
|
+
RAIN = "24h_weather_rain",
|
|
12
|
+
TOXIC_RAIN = "24h_weather_toxic_rain",
|
|
13
|
+
POLLUTION = "24h_weather_pollution",
|
|
14
|
+
SANDSTORM = "24h_weather_sandstorm",
|
|
15
|
+
DEEP_BLUE = "q302_deeb_blue",
|
|
16
|
+
LIGHT_RAIN = "q302_light_rain",
|
|
17
|
+
SQUAT_MORNING = "q302_squat_morning",
|
|
18
|
+
EPILOGUE_CLOUDY_MORNING = "q306_epilogue_cloudy_morning",
|
|
19
|
+
RAINY_NIGHT = "q306_rainy_night",
|
|
20
|
+
COURIER_CLOUDS = "sa_courier_clouds",
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
declare interface MpEvents {
|
|
2
|
+
on(
|
|
3
|
+
eventName: "onResourceStarted",
|
|
4
|
+
callback: (resourceName: string) => void
|
|
5
|
+
): void;
|
|
6
|
+
|
|
7
|
+
on(
|
|
8
|
+
eventName: "onResourceStopped",
|
|
9
|
+
callback: (resourceName: string) => void
|
|
10
|
+
): void;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Register a custom event listener.
|
|
14
|
+
* @param eventName Name of the event.
|
|
15
|
+
* @param callback Callback function.
|
|
16
|
+
*/
|
|
17
|
+
on(eventName: string, callback: (...args: any[]) => void): void;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* UnRegister a custom event listener.
|
|
21
|
+
* @param eventName Name of the event.
|
|
22
|
+
* @param callback Callback function.
|
|
23
|
+
*/
|
|
24
|
+
off(eventName: string, callback: (...args: any[]) => void): void;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Emit a previously registered custom event.
|
|
28
|
+
*
|
|
29
|
+
* @param eventName Name of the event.
|
|
30
|
+
* @param args Arguments to pass.
|
|
31
|
+
*/
|
|
32
|
+
emit(eventName: string, ...args: any[]): void;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Register a listener for server event on client.
|
|
36
|
+
*/
|
|
37
|
+
onServer(eventName: string, callback: (...args: any[]) => void): void;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Emit an event to the server.
|
|
41
|
+
*/
|
|
42
|
+
emitServer(eventName: string, ...args: any[]): void;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Emit an event to the cef.
|
|
46
|
+
*/
|
|
47
|
+
emitCef(eventName: string, ...args: any[]): void;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Register a custom cef event listener.
|
|
51
|
+
* @param eventName Name of the event.
|
|
52
|
+
* @param callback Callback function.
|
|
53
|
+
*/
|
|
54
|
+
onCef(eventName: string, callback: (...args: any[]) => void): void;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Register a command in the client scope.
|
|
58
|
+
* @param commandName Command name without "/".
|
|
59
|
+
* @param callback Callback with id and args.
|
|
60
|
+
*/
|
|
61
|
+
addCommand(
|
|
62
|
+
commandName: string,
|
|
63
|
+
callback: (id: number, args: string[]) => void
|
|
64
|
+
): void;
|
|
65
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/// <reference path="./enums.d.ts" />
|
|
2
|
+
/// <reference path="../enums.d.ts" />
|
|
3
|
+
/// <reference path="./primitives.d.ts" />
|
|
4
|
+
/// <reference path="./classes.d.ts" />
|
|
5
|
+
/// <reference path="../classes.d.ts" />
|
|
6
|
+
|
|
7
|
+
declare interface MpGamePrecomputed {
|
|
8
|
+
/**
|
|
9
|
+
* Method to retrieve input events.
|
|
10
|
+
*/
|
|
11
|
+
onInputKeyEvent(
|
|
12
|
+
callback: (
|
|
13
|
+
action: CyberEnums.EInputAction,
|
|
14
|
+
key: CyberEnums.EInputKey,
|
|
15
|
+
) => void,
|
|
16
|
+
): void;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Event when the game is started.
|
|
20
|
+
*/
|
|
21
|
+
onGameLoaded(callback: () => void): void;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Event when tweaks is loaded.
|
|
25
|
+
*/
|
|
26
|
+
onTweak(callback: () => void): void;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Event when local player has been spawned.
|
|
30
|
+
*/
|
|
31
|
+
onLocalPlayerSpawned(callback: () => void): void;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get singleton.
|
|
35
|
+
*/
|
|
36
|
+
getSingleton<T extends keyof MpClasses>(name: T): UnwrapMpClass<MpClasses[T]>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Add something to inventory.
|
|
40
|
+
*/
|
|
41
|
+
AddToInventory(itemName: string, count: number): void;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Returns model hash convertable to number.
|
|
45
|
+
* @param name Model name
|
|
46
|
+
* @param type Model name type
|
|
47
|
+
* @returns Model hash
|
|
48
|
+
*/
|
|
49
|
+
getHashFromName(name: string, type: "tweakdbid" | "cname"): string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Overrides method function inside selected class.
|
|
53
|
+
* @param className Class name
|
|
54
|
+
* @param methodName Method name inside of class
|
|
55
|
+
* @param {selfFunction} func Function to override instead
|
|
56
|
+
*/
|
|
57
|
+
override(
|
|
58
|
+
className: string,
|
|
59
|
+
methodName: string,
|
|
60
|
+
func: (self: any, ...args: any[]) => void,
|
|
61
|
+
): void;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Observes method inside selected class.
|
|
65
|
+
* @param className Class name
|
|
66
|
+
* @param methodName Method name inside of class
|
|
67
|
+
* @param {selfFunction} callback Callback of method function.
|
|
68
|
+
*/
|
|
69
|
+
observeAfter(
|
|
70
|
+
className: string,
|
|
71
|
+
methodName: string,
|
|
72
|
+
callback: (self: any, ...args: any[]) => void,
|
|
73
|
+
): void;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Observes method inside selected class.
|
|
77
|
+
* @param className Class name
|
|
78
|
+
* @param methodName Method name inside of class
|
|
79
|
+
* @param {selfFunction} callback Callback of method function.
|
|
80
|
+
*/
|
|
81
|
+
observeBefore(
|
|
82
|
+
className: string,
|
|
83
|
+
methodName: string,
|
|
84
|
+
callback: (self: any, ...args: any[]) => void,
|
|
85
|
+
): void;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Alias for {@link observeBefore}.
|
|
89
|
+
* @param className Class name
|
|
90
|
+
* @param methodName Method name inside of class
|
|
91
|
+
* @param {selfFunction} callback Callback of method function.
|
|
92
|
+
*/
|
|
93
|
+
observe(
|
|
94
|
+
className: string,
|
|
95
|
+
methodName: string,
|
|
96
|
+
callback: (self: any, ...args: any[]) => void,
|
|
97
|
+
): void;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Observes method inside selected class. Can only call methods from {@link MpGame}.
|
|
101
|
+
* Should be used when it's important for the function to execute quickly (as fast as V8 allows).
|
|
102
|
+
* @param className Class name
|
|
103
|
+
* @param methodName Method name inside of class
|
|
104
|
+
* @param {selfFunction} callback Callback of method function.
|
|
105
|
+
*/
|
|
106
|
+
observeAfterRaw(
|
|
107
|
+
className: string,
|
|
108
|
+
methodName: string,
|
|
109
|
+
callback: (self: any, ...args: any[]) => void,
|
|
110
|
+
): void;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Observes method inside selected class. Can only call methods from {@link MpGame}.
|
|
114
|
+
* Should be used when it's important for the function to execute quickly (as fast as V8 allows).
|
|
115
|
+
* @param className Class name
|
|
116
|
+
* @param methodName Method name inside of class
|
|
117
|
+
* @param {selfFunction} callback Callback of method function.
|
|
118
|
+
*/
|
|
119
|
+
observeBeforeRaw(
|
|
120
|
+
className: string,
|
|
121
|
+
methodName: string,
|
|
122
|
+
callback: (self: any, ...args: any[]) => void,
|
|
123
|
+
): void;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Alias for {@link observeBeforeRaw}.
|
|
127
|
+
* @param className Class name
|
|
128
|
+
* @param methodName Method name inside of class
|
|
129
|
+
* @param {selfFunction} callback Callback of method function.
|
|
130
|
+
*/
|
|
131
|
+
observeRaw(
|
|
132
|
+
className: string,
|
|
133
|
+
methodName: string,
|
|
134
|
+
callback: (self: any, ...args: any[]) => void,
|
|
135
|
+
): void;
|
|
136
|
+
|
|
137
|
+
isBlackScreenStarted(): boolean;
|
|
138
|
+
|
|
139
|
+
isBlackScreenEnded(): boolean;
|
|
140
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/// <reference path="./events.d.ts" />
|
|
2
|
+
/// <reference path="./meta.d.ts" />
|
|
3
|
+
|
|
4
|
+
declare type ServerVector3 = [number, number, number];
|
|
5
|
+
declare type ServerVector4 = [number, number, number, number];
|
|
6
|
+
|
|
7
|
+
declare interface MpGlobalPrecomputed {
|
|
8
|
+
events: MpEvents;
|
|
9
|
+
meta: MpMeta;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Focus or unfocus CEF view.
|
|
13
|
+
*/
|
|
14
|
+
setCefInFocusState(justFocus: boolean, withMouse: boolean): void;
|
|
15
|
+
|
|
16
|
+
isInCefFocusState(): boolean;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Mapping between network and game IDs.
|
|
20
|
+
*/
|
|
21
|
+
getVehicleGameIdByNetworkId(id: number): number;
|
|
22
|
+
|
|
23
|
+
getPlayerGameIdByNetworkId(id: number): number;
|
|
24
|
+
|
|
25
|
+
getObjectGameIdByNetworkId(id: number): number;
|
|
26
|
+
|
|
27
|
+
getVehicleNetworkIdByGameId(hash: number): number;
|
|
28
|
+
|
|
29
|
+
getPlayerNetworkIdByGameId(hash: number): number;
|
|
30
|
+
|
|
31
|
+
getObjectNetworkIdByGameId(hash: number): number;
|
|
32
|
+
|
|
33
|
+
getPedNetworkIdByGameId(hash: number): number;
|
|
34
|
+
|
|
35
|
+
getPedGameIdByNetworkId(hash: number): number;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Local player spawning API.
|
|
39
|
+
*/
|
|
40
|
+
setSpawnDataLocalPlayer(
|
|
41
|
+
modelHash: number,
|
|
42
|
+
x: number,
|
|
43
|
+
y: number,
|
|
44
|
+
z: number,
|
|
45
|
+
yaw: number,
|
|
46
|
+
): void;
|
|
47
|
+
|
|
48
|
+
spawnLocalPlayer(): boolean;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Spawn local-only entities (not synced).
|
|
52
|
+
*/
|
|
53
|
+
spawnLocalPed(
|
|
54
|
+
skinHash: number,
|
|
55
|
+
appHash: number,
|
|
56
|
+
x: number,
|
|
57
|
+
y: number,
|
|
58
|
+
z: number,
|
|
59
|
+
yaw: number,
|
|
60
|
+
streaming: boolean,
|
|
61
|
+
): number;
|
|
62
|
+
|
|
63
|
+
spawnLocalVehicle(
|
|
64
|
+
skinHash: number,
|
|
65
|
+
appHash: number,
|
|
66
|
+
x: number,
|
|
67
|
+
y: number,
|
|
68
|
+
z: number,
|
|
69
|
+
roll: number,
|
|
70
|
+
pitch: number,
|
|
71
|
+
yaw: number,
|
|
72
|
+
streaming: boolean,
|
|
73
|
+
): number;
|
|
74
|
+
|
|
75
|
+
spawnLocalObject(
|
|
76
|
+
skinHash: bigint | number,
|
|
77
|
+
appHash: bigint | number,
|
|
78
|
+
x: number,
|
|
79
|
+
y: number,
|
|
80
|
+
z: number,
|
|
81
|
+
roll: number,
|
|
82
|
+
pitch: number,
|
|
83
|
+
yaw: number,
|
|
84
|
+
streaming: boolean,
|
|
85
|
+
): number;
|
|
86
|
+
|
|
87
|
+
despawnLocalPed(hash: number): void;
|
|
88
|
+
|
|
89
|
+
despawnLocalVehicle(hash: number): void;
|
|
90
|
+
|
|
91
|
+
despawnLocalObject(hash: number): void;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get Discord token via game SDK (unstable).
|
|
95
|
+
*/
|
|
96
|
+
getDiscordOAuth2Token(discordAppId: string): string;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Get Discord auth code (preferred).
|
|
100
|
+
*/
|
|
101
|
+
getDiscordCodeAuthorization(discordAppId: string, scopes: string): string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Returns current server IP:PORT string.
|
|
105
|
+
*/
|
|
106
|
+
getCurrentServerEndpoint(): string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Get server ID from player hash.
|
|
110
|
+
*/
|
|
111
|
+
getPlayerServerId(playerHash: number): number;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Get src variable value as string.
|
|
115
|
+
*/
|
|
116
|
+
getVar(varName: string): string;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Get console variable value as integer.
|
|
120
|
+
*/
|
|
121
|
+
getVarInt(varName: string): number;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Returns time in ms since game start.
|
|
125
|
+
*/
|
|
126
|
+
getGameTimer(): number;
|
|
127
|
+
|
|
128
|
+
getLauncherSettingsJSON(): string;
|
|
129
|
+
|
|
130
|
+
getLauncherSettings(): any;
|
|
131
|
+
|
|
132
|
+
changeCefViewUrl(newUrl: string): void;
|
|
133
|
+
|
|
134
|
+
setTick(cb: () => void): number;
|
|
135
|
+
|
|
136
|
+
clearTick(tickId: number): void;
|
|
137
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference path="./primitives.d.ts" />
|
|
2
|
+
/// <reference path="./classes.d.ts" />
|
|
3
|
+
/// <reference path="./global.d.ts" />
|
|
4
|
+
/// <reference path="./game.d.ts" />
|
|
5
|
+
/// <reference path="./events.d.ts" />
|
|
6
|
+
/// <reference path="./meta.d.ts" />
|
|
7
|
+
/// <reference path="./enums.d.ts" />
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare interface MpMeta {
|
|
2
|
+
setGlobalMeta(key: string, value: any, sync?: boolean): void;
|
|
3
|
+
getGlobalMeta<T = any>(key: string): T;
|
|
4
|
+
setPlayerMeta(
|
|
5
|
+
playerId: number,
|
|
6
|
+
key: string,
|
|
7
|
+
value: any,
|
|
8
|
+
sync?: boolean
|
|
9
|
+
): void;
|
|
10
|
+
getPlayerMeta<T = any>(playerId: number, key: string): T;
|
|
11
|
+
setEntityMeta(netId: number, key: string, value: any, sync?: boolean): void;
|
|
12
|
+
getEntityMeta<T = any>(netId: number, key: string): T;
|
|
13
|
+
setLocalPlayerMeta(key: string, value: any): void;
|
|
14
|
+
getLocalPlayerMeta<T = any>(key: string): T;
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type UnwrapMpClass<T> = T extends { new (): infer U } ? U : T;
|
|
2
|
+
type CName = string;
|
|
3
|
+
type Handle<T = any> = T;
|
|
4
|
+
type WeakHandle<T = any> = T;
|
|
5
|
+
type ScriptRef<T = any> = T;
|
|
6
|
+
type NodeRef<T = any> = T;
|
|
7
|
+
type TweakDBID = string;
|
|
8
|
+
type CRUID = any;
|
|
9
|
+
type CGUID = any;
|
|
10
|
+
type Variant = any;
|
|
11
|
+
type LocalizationString = string;
|
|
12
|
+
type Uint16 = number;
|
|
13
|
+
type Uint8 = number;
|
|
14
|
+
type Int8 = number;
|
|
15
|
+
type Int16 = number;
|
|
16
|
+
type Int32 = number;
|
|
17
|
+
type DataBuffer = any;
|
|
18
|
+
type serializationDeferredDataBuffer = any;
|
|
19
|
+
type SharedDataBuffer = any;
|
|
20
|
+
type EditorObjectID = any;
|
|
21
|
+
type MessageResourcePath = any;
|
|
22
|
+
type ResAsyncRef<T> = T;
|
|
23
|
+
type CurveData<T> = T;
|
|
24
|
+
type ResRef<T> = T;
|
|
25
|
+
type MultiChannelCurve<T> = T;
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cybermp/client-types",
|
|
3
|
+
"version": "1.1.9",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./out/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"./out"
|
|
8
|
+
],
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "terminaate",
|
|
11
|
+
"contributors": [
|
|
12
|
+
"An1by"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@vitest/ui": "4.0.15",
|
|
17
|
+
"consola": "^3.4.2",
|
|
18
|
+
"rimraf": "^6.0.1",
|
|
19
|
+
"ts-morph": "^26.0.0",
|
|
20
|
+
"vitest": "^4.0.15"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"start": "tsx ./src",
|
|
27
|
+
"dev": "tsx watch ./src",
|
|
28
|
+
"build": "npm run start",
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"test:dev": "vitest"
|
|
31
|
+
}
|
|
32
|
+
}
|