@cybermp/client-types 1.6.11 → 1.7.0

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.
@@ -1,96 +1,95 @@
1
- import * as CyberEnums from "../enums";
2
-
3
- declare global {
4
- /**
5
- * Class with custom CyberMP native methods.
6
- */
7
- interface CyberMP {
8
- /**
9
- * Removes game object classes (e.g., T extends gameObject, playerPuppet, NpcPuppet) from the map.
10
- * @param objectClassMap Array of class names to delete.
11
- */
12
- DeclareDeletedObjects(objectClassMap: Array<keyof MpClasses>): void;
13
-
14
- /**
15
- * Removes game objects by their unique hashes from the map.
16
- * @param objectHashMap Array of unique game object hashes to delete.
17
- */
18
- DeletedObjectsByUniqueHash(objectHashMap: string[]): void;
19
-
20
- /**
21
- * Enables or disables synchronization of default effects, as defined by the CyberMP platform.
22
- * @param value Whether to use the default effects.
23
- */
24
- UseDefaultEffectsByPlatform(value: boolean): void;
25
- }
26
-
27
- interface worldWeatherScriptInterface extends IScriptable {
28
- SetWeather(
29
- weather: CyberEnums.WeatherState,
30
- blendTime?: number,
31
- priority?: number,
32
- ): void;
33
- ResetWeather(forceRestore?: boolean, blendTime?: number): void;
34
- GetWeatherState(): worldWeatherState;
35
- GetEnvironmentDefinition(): worldEnvironmentDefinition;
36
- }
37
-
38
- interface vehicleBaseObject extends gameObject {
39
- HasGravity(): boolean;
40
- EnableGravity(enable: boolean): boolean;
41
- AddLinelyVelocity(velocity: Vector3, angularVelocity: Vector3): boolean;
42
- ChangeLinelyVelocity(
43
- velocity: Vector3,
44
- angularVelocity: Vector3,
45
- switchIndex: number,
46
- ): boolean;
47
- GetVelocity(): Vector3;
48
- GetAngularVelocity(): Vector3;
49
- GetPhysicsState(): number;
50
- IsOnGround(): boolean;
51
- GetBoundaryBox(): Box;
52
- VehicleOwnerWasChanged(): void;
53
- }
54
-
55
- interface gameMappinSystem extends gamemappinsIMappinSystem {
56
- TrackMappin(id: gameNewMappinID): void;
57
- }
58
-
59
- type OnlyExtendingScriptableSystem<T> = {
60
- [K in keyof T as T[K] extends typeof gameScriptableSystem
61
- ? K
62
- : never]: T[K];
63
- };
64
-
65
- interface gameScriptableSystemsContainer<
66
- Map = OnlyExtendingScriptableSystem<MpClasses>,
67
- > {
68
- "Get"<N extends keyof Map>(systemName: N): UnwrapMpClass<Map[N]>;
69
- }
70
-
71
- namespace ScriptGameInstance {
72
- export function GetLoadingScreenSystem(): LoadingScreenSystem;
73
- }
74
-
75
- class LoadingScreenSystem {
76
- GetLoadingScreenState(): CyberEnums.ELoadingScreenState;
77
- GetLoadingScreenProgress(): number;
78
- OnLoadingScreenStateChange(newState: CyberEnums.ELoadingScreenState): void;
79
- }
80
-
81
- interface MpClasses {
82
- LoadingScreenSystem: typeof LoadingScreenSystem;
83
- }
84
-
85
- interface inkISystemRequestsHandler {
86
- StartMainMenu(): void;
87
- }
88
-
89
- interface gameuiICharacterCustomizationSystem {
90
- SetPlayerGender(gender: CyberEnums.EPlayerGender, savedPos?: boolean): void;
91
- OnPlayerGenderChanged(gender: CyberEnums.EPlayerGender): void;
92
- }
93
- }
94
-
95
- export { };
96
-
1
+ import type * as CyberEnums from '../enums';
2
+
3
+ declare global {
4
+ /**
5
+ * Class with custom CyberMP native methods.
6
+ */
7
+ interface CyberMP {
8
+ /**
9
+ * Removes game object classes (e.g., T extends gameObject, playerPuppet, NpcPuppet) from the map.
10
+ * @param objectClassMap Array of class names to delete.
11
+ */
12
+ DeclareDeletedObjects(objectClassMap: Array<keyof MpClasses>): void;
13
+
14
+ /**
15
+ * Removes game objects by their unique hashes from the map.
16
+ * @param objectHashMap Array of unique game object hashes to delete.
17
+ */
18
+ DeletedObjectsByUniqueHash(objectHashMap: string[]): void;
19
+
20
+ /**
21
+ * Enables or disables synchronization of default effects, as defined by the CyberMP platform.
22
+ * @param value Whether to use the default effects.
23
+ */
24
+ UseDefaultEffectsByPlatform(value: boolean): void;
25
+
26
+ SetDefaultSpawnPosition(position: Vector3, yaw: number): void;
27
+ }
28
+
29
+ interface worldWeatherScriptInterface extends IScriptable {
30
+ SetWeather(
31
+ weather: CyberEnums.WeatherState,
32
+ blendTime?: number,
33
+ priority?: number,
34
+ ): void;
35
+ ResetWeather(forceRestore?: boolean, blendTime?: number): void;
36
+ GetWeatherState(): worldWeatherState;
37
+ GetEnvironmentDefinition(): worldEnvironmentDefinition;
38
+ }
39
+
40
+ interface vehicleBaseObject extends gameObject {
41
+ HasGravity(): boolean;
42
+ EnableGravity(enable: boolean): boolean;
43
+ AddLinelyVelocity(velocity: Vector3, angularVelocity: Vector3): boolean;
44
+ ChangeLinelyVelocity(
45
+ velocity: Vector3,
46
+ angularVelocity: Vector3,
47
+ switchIndex: number,
48
+ ): boolean;
49
+ GetVelocity(): Vector3;
50
+ GetAngularVelocity(): Vector3;
51
+ GetPhysicsState(): number;
52
+ IsOnGround(): boolean;
53
+ GetBoundaryBox(): Box;
54
+ VehicleOwnerWasChanged(): void;
55
+ }
56
+
57
+ interface gameMappinSystem extends gamemappinsIMappinSystem {
58
+ TrackMappin(id: gameNewMappinID): void;
59
+ }
60
+
61
+ type OnlyExtendingScriptableSystem<T> = {
62
+ [K in keyof T as T[K] extends typeof gameScriptableSystem
63
+ ? K
64
+ : never]: T[K];
65
+ };
66
+
67
+ interface gameScriptableSystemsContainer<
68
+ Map = OnlyExtendingScriptableSystem<MpClasses>,
69
+ > {
70
+ Get<N extends keyof Map>(systemName: N): UnwrapMpClass<Map[N]>;
71
+ }
72
+
73
+ namespace ScriptGameInstance {
74
+ export function GetLoadingScreenSystem(): LoadingScreenSystem;
75
+ }
76
+
77
+ class LoadingScreenSystem {
78
+ GetLoadingScreenState(): CyberEnums.ELoadingScreenState;
79
+ GetLoadingScreenProgress(): number;
80
+ OnLoadingScreenStateChange(newState: CyberEnums.ELoadingScreenState): void;
81
+ }
82
+
83
+ interface MpClasses {
84
+ LoadingScreenSystem: typeof LoadingScreenSystem;
85
+ }
86
+
87
+ interface inkISystemRequestsHandler {
88
+ StartMainMenu(): void;
89
+ }
90
+
91
+ interface gameuiICharacterCustomizationSystem {
92
+ SetPlayerGender(gender: CyberEnums.EPlayerGender, savedPos?: boolean): void;
93
+ OnPlayerGenderChanged(gender: CyberEnums.EPlayerGender): void;
94
+ }
95
+ }
@@ -0,0 +1,3 @@
1
+ interface MpDiscord {
2
+ updateRichPresence(state?: string, details?: string): void;
3
+ }
@@ -1,38 +1,38 @@
1
- /**
2
- * See {@link worldWeatherState#name}
3
- */
4
- export enum WeatherState {
5
- SUNNY = "24h_weather_sunny",
6
- LIGHT_CLOUDS = "24h_weather_light_clouds",
7
- CLOUDY = "24h_weather_cloudy",
8
- HEAVY_CLOUDS = "24h_weather_heavy_clouds",
9
- FOG = "24h_weather_fog",
10
- RAIN = "24h_weather_rain",
11
- TOXIC_RAIN = "24h_weather_toxic_rain",
12
- POLLUTION = "24h_weather_pollution",
13
- SANDSTORM = "24h_weather_sandstorm",
14
- DEEP_BLUE = "q302_deeb_blue",
15
- LIGHT_RAIN = "q302_light_rain",
16
- SQUAT_MORNING = "q302_squat_morning",
17
- EPILOGUE_CLOUDY_MORNING = "q306_epilogue_cloudy_morning",
18
- RAINY_NIGHT = "q306_rainy_night",
19
- COURIER_CLOUDS = "sa_courier_clouds",
20
- }
21
-
22
- export enum VoiceActivationType {
23
- UNDEFINED = 0,
24
- VOICE = 1,
25
- PUSH_TO_TALK = 2,
26
- }
27
-
28
- export enum EPlayerGender {
29
- Female = 1,
30
- Male = 2,
31
- }
32
-
33
- export enum ELoadingScreenState {
34
- Started = 1,
35
- Loading,
36
- PreEnded,
37
- Hidden,
38
- }
1
+ /**
2
+ * See {@link worldWeatherState#name}
3
+ */
4
+ export enum WeatherState {
5
+ SUNNY = '24h_weather_sunny',
6
+ LIGHT_CLOUDS = '24h_weather_light_clouds',
7
+ CLOUDY = '24h_weather_cloudy',
8
+ HEAVY_CLOUDS = '24h_weather_heavy_clouds',
9
+ FOG = '24h_weather_fog',
10
+ RAIN = '24h_weather_rain',
11
+ TOXIC_RAIN = '24h_weather_toxic_rain',
12
+ POLLUTION = '24h_weather_pollution',
13
+ SANDSTORM = '24h_weather_sandstorm',
14
+ DEEP_BLUE = 'q302_deeb_blue',
15
+ LIGHT_RAIN = 'q302_light_rain',
16
+ SQUAT_MORNING = 'q302_squat_morning',
17
+ EPILOGUE_CLOUDY_MORNING = 'q306_epilogue_cloudy_morning',
18
+ RAINY_NIGHT = 'q306_rainy_night',
19
+ COURIER_CLOUDS = 'sa_courier_clouds',
20
+ }
21
+
22
+ export enum VoiceActivationType {
23
+ UNDEFINED = 0,
24
+ VOICE = 1,
25
+ PUSH_TO_TALK = 2,
26
+ }
27
+
28
+ export enum EPlayerGender {
29
+ Female = 1,
30
+ Male = 2,
31
+ }
32
+
33
+ export enum ELoadingScreenState {
34
+ Started = 1,
35
+ Loading,
36
+ PreEnded,
37
+ Hidden,
38
+ }
@@ -1,65 +1,65 @@
1
- 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
- }
1
+ 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
+ }
@@ -1,164 +1,160 @@
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
- interface OverrideFunction {
8
- <
9
- C extends keyof MpClasses,
10
- I extends UnwrapMpClass<MpClasses[C]>,
11
- M extends keyof I extends never ? string : keyof I,
12
- >(
13
- className: C,
14
- methodName: M,
15
- callback: (
16
- self: I,
17
- ...args: [...Parameters<I[M]>, origin: I[M]]
18
- ) => ReturnType<I[M]>,
19
- ): void;
20
- }
21
-
22
- interface ObserveFunction {
23
- <
24
- C extends keyof MpClasses,
25
- I extends UnwrapMpClass<MpClasses[C]>,
26
- M extends keyof I extends never ? string : keyof I,
27
- >(
28
- className: C,
29
- methodName: M,
30
- callback: (self: I, ...args: Parameters<I[M]>) => void,
31
- ): void;
32
- }
33
-
34
- interface TweakDB {
35
- getRecords<T = any>(str: string): T[];
36
- getRecord<T = any>(str: string): T;
37
- query(str: string): string[];
38
- getFlat<T = any>(str: string): T;
39
- setFlats(str: string, arr: any[]): boolean;
40
- setFlat(str: string, obj: any): boolean;
41
- setFlatNoUpdate(str: string, obj: any): boolean;
42
- updateRecord(str: string): boolean;
43
- createRecord(key: string, value: string): boolean;
44
- }
45
-
46
- interface MpGamePrecomputed {
47
- CyberMP: CyberMP;
48
- TweakDB: TweakDB;
49
-
50
- /**
51
- * Method to retrieve input events.
52
- */
53
- onInputKeyEvent(
54
- callback: (
55
- action: CyberEnums.EInputAction,
56
- key: CyberEnums.EInputKey,
57
- ) => void,
58
- ): void;
59
-
60
- getDisplayResolution(): [number, number];
61
-
62
- /**
63
- * Event when the game is started.
64
- */
65
- onGameLoaded(callback: () => void): void;
66
-
67
- /**
68
- * Event when tweaks is loaded.
69
- */
70
- onTweak(callback: () => void): void;
71
-
72
- /**
73
- * Event when tweaks is loaded.
74
- */
75
- onInit(callback: () => void): void;
76
-
77
- /**
78
- * Event when local player has been spawned.
79
- */
80
- onLocalPlayerSpawned(callback: () => void): void;
81
-
82
- /**
83
- * Get singleton.
84
- */
85
- getSingleton<T extends keyof MpClasses>(name: T): UnwrapMpClass<MpClasses[T]>;
86
-
87
- /**
88
- * Add something to inventory.
89
- */
90
- AddToInventory(itemName: string, count: number): void;
91
-
92
- /**
93
- * Returns model hash convertable to number.
94
- * @param name Model name
95
- * @param type Model name type
96
- * @returns Model hash
97
- */
98
- getHashFromName(name: string, type: "tweakdbid" | "cname"): string;
99
-
100
- /**
101
- * Overrides method function inside selected class.
102
- * @param className Class name
103
- * @param methodName Method name inside of class
104
- * @param {selfFunction} func Function to override instead
105
- */
106
- override: OverrideFunction;
107
-
108
- /**
109
- * Observes method inside selected class.
110
- * @param className Class name
111
- * @param methodName Method name inside of class
112
- * @param {selfFunction} callback Callback of method function.
113
- */
114
- observeAfter: ObserveFunction;
115
-
116
- /**
117
- * Observes method inside selected class.
118
- * @param className Class name
119
- * @param methodName Method name inside of class
120
- * @param {selfFunction} callback Callback of method function.
121
- */
122
- observeBefore: ObserveFunction;
123
-
124
- /**
125
- * Alias for {@link observeBefore}.
126
- * @param className Class name
127
- * @param methodName Method name inside of class
128
- * @param {selfFunction} callback Callback of method function.
129
- */
130
- observe: ObserveFunction;
131
-
132
- /**
133
- * Observes method inside selected class. Can only call methods from {@link MpGame}.
134
- * Should be used when it's important for the function to execute quickly (as fast as V8 allows).
135
- * @param className Class name
136
- * @param methodName Method name inside of class
137
- * @param {selfFunction} callback Callback of method function.
138
- */
139
- observeAfterRaw: ObserveFunction;
140
-
141
- /**
142
- * Observes method inside selected class. Can only call methods from {@link MpGame}.
143
- * Should be used when it's important for the function to execute quickly (as fast as V8 allows).
144
- * @param className Class name
145
- * @param methodName Method name inside of class
146
- * @param {selfFunction} callback Callback of method function.
147
- */
148
- observeBeforeRaw: ObserveFunction;
149
-
150
- /**
151
- * Alias for {@link observeBeforeRaw}.
152
- * @param className Class name
153
- * @param methodName Method name inside of class
154
- * @param {selfFunction} callback Callback of method function.
155
- */
156
- observeRaw: ObserveFunction;
157
-
158
- toVariant<R = {}>(obj: any, str: string): R;
159
- fromVariant<R = any>(obj: any): R;
160
-
161
- isBlackScreenStarted(): boolean;
162
-
163
- isBlackScreenEnded(): boolean;
164
- }
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
+ type OverrideFunction = <
8
+ C extends keyof MpClasses,
9
+ I extends UnwrapMpClass<MpClasses[C]>,
10
+ M extends keyof I extends never ? string : keyof I,
11
+ >(
12
+ className: C,
13
+ methodName: M,
14
+ callback: (
15
+ self: I,
16
+ ...args: [...Parameters<I[M]>, origin: I[M]]
17
+ ) => ReturnType<I[M]>,
18
+ ) => void;
19
+
20
+ type ObserveFunction = <
21
+ C extends keyof MpClasses,
22
+ I extends UnwrapMpClass<MpClasses[C]>,
23
+ M extends keyof I extends never ? string : keyof I,
24
+ >(
25
+ className: C,
26
+ methodName: M,
27
+ callback: (self: I, ...args: Parameters<I[M]>) => void,
28
+ ) => void;
29
+
30
+ interface TweakDB {
31
+ getRecords<T = any>(str: string): T[];
32
+ getRecord<T = any>(str: string): T;
33
+ query(str: string): string[];
34
+ getFlat<T = any>(str: string): T;
35
+ setFlats(str: string, arr: any[]): boolean;
36
+ setFlat(str: string, obj: any): boolean;
37
+ setFlatNoUpdate(str: string, obj: any): boolean;
38
+ updateRecord(str: string): boolean;
39
+ createRecord(key: string, value: string): boolean;
40
+ }
41
+
42
+ interface MpGamePrecomputed {
43
+ CyberMP: CyberMP;
44
+ TweakDB: TweakDB;
45
+
46
+ /**
47
+ * Method to retrieve input events.
48
+ */
49
+ onInputKeyEvent(
50
+ callback: (
51
+ action: CyberEnums.EInputAction,
52
+ key: CyberEnums.EInputKey,
53
+ ) => void,
54
+ ): void;
55
+
56
+ getDisplayResolution(): [number, number];
57
+
58
+ /**
59
+ * Event when the game is started.
60
+ */
61
+ onGameLoaded(callback: () => void): void;
62
+
63
+ /**
64
+ * Event when tweaks is loaded.
65
+ */
66
+ onTweak(callback: () => void): void;
67
+
68
+ /**
69
+ * Event when tweaks is loaded.
70
+ */
71
+ onInit(callback: () => void): void;
72
+
73
+ /**
74
+ * Event when local player has been spawned.
75
+ */
76
+ onLocalPlayerSpawned(callback: () => void): void;
77
+
78
+ /**
79
+ * Get singleton.
80
+ */
81
+ getSingleton<T extends keyof MpClasses>(name: T): UnwrapMpClass<MpClasses[T]>;
82
+
83
+ /**
84
+ * Add something to inventory.
85
+ */
86
+ AddToInventory(itemName: string, count: number): void;
87
+
88
+ /**
89
+ * Returns model hash convertable to number.
90
+ * @param name Model name
91
+ * @param type Model name type
92
+ * @returns Model hash
93
+ */
94
+ getHashFromName(name: string, type: 'tweakdbid' | 'cname'): string;
95
+
96
+ /**
97
+ * Overrides method function inside selected class.
98
+ * @param className Class name
99
+ * @param methodName Method name inside of class
100
+ * @param {selfFunction} func Function to override instead
101
+ */
102
+ override: OverrideFunction;
103
+
104
+ /**
105
+ * Observes method inside selected class.
106
+ * @param className Class name
107
+ * @param methodName Method name inside of class
108
+ * @param {selfFunction} callback Callback of method function.
109
+ */
110
+ observeAfter: ObserveFunction;
111
+
112
+ /**
113
+ * Observes method inside selected class.
114
+ * @param className Class name
115
+ * @param methodName Method name inside of class
116
+ * @param {selfFunction} callback Callback of method function.
117
+ */
118
+ observeBefore: ObserveFunction;
119
+
120
+ /**
121
+ * Alias for {@link observeBefore}.
122
+ * @param className Class name
123
+ * @param methodName Method name inside of class
124
+ * @param {selfFunction} callback Callback of method function.
125
+ */
126
+ observe: ObserveFunction;
127
+
128
+ /**
129
+ * Observes method inside selected class. Can only call methods from {@link MpGame}.
130
+ * Should be used when it's important for the function to execute quickly (as fast as V8 allows).
131
+ * @param className Class name
132
+ * @param methodName Method name inside of class
133
+ * @param {selfFunction} callback Callback of method function.
134
+ */
135
+ observeAfterRaw: ObserveFunction;
136
+
137
+ /**
138
+ * Observes method inside selected class. Can only call methods from {@link MpGame}.
139
+ * Should be used when it's important for the function to execute quickly (as fast as V8 allows).
140
+ * @param className Class name
141
+ * @param methodName Method name inside of class
142
+ * @param {selfFunction} callback Callback of method function.
143
+ */
144
+ observeBeforeRaw: ObserveFunction;
145
+
146
+ /**
147
+ * Alias for {@link observeBeforeRaw}.
148
+ * @param className Class name
149
+ * @param methodName Method name inside of class
150
+ * @param {selfFunction} callback Callback of method function.
151
+ */
152
+ observeRaw: ObserveFunction;
153
+
154
+ toVariant<R = {}>(obj: any, str: string): R;
155
+ fromVariant<R = any>(obj: any): R;
156
+
157
+ isBlackScreenStarted(): boolean;
158
+
159
+ isBlackScreenEnded(): boolean;
160
+ }
@@ -1,148 +1,133 @@
1
- /// <reference path="./events.d.ts" />
2
- /// <reference path="./meta.d.ts" />
3
- /// <reference path="./voice-chat.d.ts" />
4
- /// <reference path="./cef.d.ts" />
5
-
6
- type ServerVector3 = [number, number, number];
7
- type ServerVector4 = [number, number, number, number];
8
-
9
- interface MpGlobalPrecomputed {
10
- events: MpEvents;
11
- meta: MpMeta;
12
- voiceChat: MpVoiceChat;
13
- cef: MpCef;
14
-
15
- getStreamedPool(
16
- objName: "CVehicle" | "CPed" | "CPickups" | "CObject",
17
- ): number[];
18
- getStreamedPlayers(): number[];
19
-
20
- /**
21
- * Focus or unfocus CEF view.
22
- * @deprecated use mp.cef instead
23
- */
24
- setCefInFocusState(justFocus: boolean, withMouse: boolean): void;
25
-
26
- /**
27
- * @deprecated use mp.cef instead
28
- */
29
- isInCefFocusState(): boolean;
30
-
31
- /**
32
- *
33
- * @deprecated use mp.cef api instead
34
- */
35
- changeCefViewUrl(newUrl: string): void;
36
-
37
- /**
38
- * Mapping between network and game IDs.
39
- */
40
- getVehicleGameIdByNetworkId(id: number): number;
41
-
42
- getPlayerGameIdByNetworkId(id: number): number;
43
-
44
- getObjectGameIdByNetworkId(id: number): number;
45
-
46
- getVehicleNetworkIdByGameId(hash: number): number;
47
-
48
- getPlayerNetworkIdByGameId(hash: number): number;
49
-
50
- getObjectNetworkIdByGameId(hash: number): number;
51
-
52
- getPedNetworkIdByGameId(hash: number): number;
53
-
54
- getPedGameIdByNetworkId(hash: number): number;
55
-
56
- /**
57
- * Local player spawning API.
58
- */
59
- setSpawnDataLocalPlayer(x: number, y: number, z: number, yaw: number): void;
60
-
61
- spawnLocalPlayer(): boolean;
62
-
63
- /**
64
- * Spawn local-only entities (not synced).
65
- */
66
- spawnLocalPed(
67
- skinHash: number,
68
- appHash: number,
69
- x: number,
70
- y: number,
71
- z: number,
72
- yaw: number,
73
- streaming: boolean,
74
- ): number;
75
-
76
- spawnLocalVehicle(
77
- skinHash: number,
78
- appHash: number,
79
- x: number,
80
- y: number,
81
- z: number,
82
- roll: number,
83
- pitch: number,
84
- yaw: number,
85
- streaming: boolean,
86
- ): number;
87
-
88
- spawnLocalObject(
89
- skinHash: bigint | number,
90
- appHash: bigint | number,
91
- x: number,
92
- y: number,
93
- z: number,
94
- roll: number,
95
- pitch: number,
96
- yaw: number,
97
- streaming: boolean,
98
- ): number;
99
-
100
- despawnLocalPed(hash: number): void;
101
-
102
- despawnLocalVehicle(hash: number): void;
103
-
104
- despawnLocalObject(hash: number): void;
105
-
106
- /**
107
- * Get Discord token via game SDK (unstable).
108
- */
109
- getDiscordOAuth2Token(discordAppId: string): string;
110
-
111
- /**
112
- * Get Discord auth code (preferred).
113
- */
114
- getDiscordCodeAuthorization(discordAppId: string, scopes: string): string;
115
-
116
- /**
117
- * Returns current server IP:PORT string.
118
- */
119
- getCurrentServerEndpoint(): string;
120
-
121
- /**
122
- * Get server ID from player hash.
123
- */
124
- getPlayerServerId(playerHash: number): number;
125
-
126
- /**
127
- * Get src variable value as string.
128
- */
129
- getVar(varName: string): string;
130
-
131
- /**
132
- * Get console variable value as integer.
133
- */
134
- getVarInt(varName: string): number;
135
-
136
- /**
137
- * Returns time in ms since game start.
138
- */
139
- getGameTimer(): number;
140
-
141
- getLauncherSettingsJSON(): string;
142
-
143
- getLauncherSettings(): any;
144
-
145
- setTick(cb: () => any): number;
146
-
147
- clearTick(tickId: number): void;
148
- }
1
+ /// <reference path="./events.d.ts" />
2
+ /// <reference path="./meta.d.ts" />
3
+ /// <reference path="./voice-chat.d.ts" />
4
+ /// <reference path="./cef.d.ts" />
5
+ /// <reference path="./discord.d.ts" />
6
+
7
+ type ServerVector3 = [number, number, number];
8
+ type ServerVector4 = [number, number, number, number];
9
+
10
+ interface MpGlobalPrecomputed {
11
+ events: MpEvents;
12
+ meta: MpMeta;
13
+ voiceChat: MpVoiceChat;
14
+ cef: MpCef;
15
+ discord: MpDiscord;
16
+
17
+ getStreamedPool(
18
+ objName: 'CVehicle' | 'CPed' | 'CPickup' | 'CObject',
19
+ ): number[];
20
+ getStreamedPlayers(): number[];
21
+
22
+ /**
23
+ * Mapping between network and game IDs.
24
+ */
25
+ getVehicleGameIdByNetworkId(id: number): number;
26
+
27
+ getPlayerGameIdByNetworkId(id: number): number;
28
+
29
+ getObjectGameIdByNetworkId(id: number): number;
30
+
31
+ getVehicleNetworkIdByGameId(hash: number): number;
32
+
33
+ getPlayerNetworkIdByGameId(hash: number): number;
34
+
35
+ getObjectNetworkIdByGameId(hash: number): number;
36
+
37
+ getPedNetworkIdByGameId(hash: number): number;
38
+
39
+ getPedGameIdByNetworkId(hash: number): number;
40
+
41
+ /**
42
+ * Local player spawning API.
43
+ */
44
+ setSpawnDataLocalPlayer(x: number, y: number, z: number, yaw: number): void;
45
+
46
+ spawnLocalPlayer(): boolean;
47
+
48
+ /**
49
+ * Spawn local-only entities (not synced).
50
+ */
51
+ spawnLocalPed(
52
+ skinHash: number,
53
+ appHash: number,
54
+ x: number,
55
+ y: number,
56
+ z: number,
57
+ yaw: number,
58
+ streaming: boolean,
59
+ ): number;
60
+
61
+ spawnLocalVehicle(
62
+ skinHash: number,
63
+ appHash: number,
64
+ x: number,
65
+ y: number,
66
+ z: number,
67
+ roll: number,
68
+ pitch: number,
69
+ yaw: number,
70
+ streaming: boolean,
71
+ ): number;
72
+
73
+ spawnLocalObject(
74
+ skinHash: bigint | number,
75
+ appHash: bigint | number,
76
+ x: number,
77
+ y: number,
78
+ z: number,
79
+ roll: number,
80
+ pitch: number,
81
+ yaw: number,
82
+ streaming: boolean,
83
+ ): number;
84
+
85
+ despawnLocalPed(hash: number): void;
86
+
87
+ despawnLocalVehicle(hash: number): void;
88
+
89
+ despawnLocalObject(hash: number): void;
90
+
91
+ /**
92
+ * Get Discord token via game SDK (unstable).
93
+ */
94
+ getDiscordOAuth2Token(discordAppId: string): string;
95
+
96
+ /**
97
+ * Get Discord auth code (preferred).
98
+ */
99
+ getDiscordCodeAuthorization(discordAppId: string, scopes: string): string;
100
+
101
+ /**
102
+ * Returns current server IP:PORT string.
103
+ */
104
+ getCurrentServerEndpoint(): string;
105
+
106
+ /**
107
+ * Get server ID from player hash.
108
+ */
109
+ getPlayerServerId(playerHash: number): number;
110
+
111
+ /**
112
+ * Get src variable value as string.
113
+ */
114
+ getVar(varName: string): string;
115
+
116
+ /**
117
+ * Get console variable value as integer.
118
+ */
119
+ getVarInt(varName: string): number;
120
+
121
+ /**
122
+ * Returns time in ms since game start.
123
+ */
124
+ getGameTimer(): number;
125
+
126
+ getLauncherSettingsJSON(): string;
127
+
128
+ getLauncherSettings(): any;
129
+
130
+ setTick(cb: () => any): number;
131
+
132
+ clearTick(tickId: number): void;
133
+ }
@@ -1,7 +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" />
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" />
@@ -1,21 +1,19 @@
1
- import * as CyberEnums from "../enums";
2
-
3
- export { };
4
-
5
- declare global {
6
- interface MpVoiceChat {
7
- enable(state: boolean): void;
8
- changeActivationType(type: CyberEnums.VoiceActivationType): void;
9
- bindPushToTalkKey(key: number | CyberEnums.EInputKey): void;
10
- setOutputVolume(value: number): void;
11
- setInputVolume(value: number): void;
12
- setMicrophoneSensitivity(value: number): void;
13
- getOutputDevices(): string[];
14
- getInputDevices(): string[];
15
- setOutputDevice(index: number): void;
16
- setInputDevice(index: number): void;
17
- setVoiceInputDistance(distance: number): void;
18
- setVoiceOutputDistance(distance: number): void;
19
- isActive(): boolean;
20
- }
21
- }
1
+ import * as CyberEnums from '../enums';
2
+
3
+ declare global {
4
+ interface MpVoiceChat {
5
+ enable(state: boolean): void;
6
+ changeActivationType(type: CyberEnums.VoiceActivationType): void;
7
+ bindPushToTalkKey(key: number | CyberEnums.EInputKey): void;
8
+ setOutputVolume(value: number): void;
9
+ setInputVolume(value: number): void;
10
+ setMicrophoneSensitivity(value: number): void;
11
+ getOutputDevices(): string[];
12
+ getInputDevices(): string[];
13
+ setOutputDevice(index: number): void;
14
+ setInputDevice(index: number): void;
15
+ setVoiceInputDistance(distance: number): void;
16
+ setVoiceOutputDistance(distance: number): void;
17
+ isActive(): boolean;
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cybermp/client-types",
3
- "version": "1.6.11",
3
+ "version": "1.7.0",
4
4
  "description": "",
5
5
  "types": "./out/index.d.ts",
6
6
  "files": [
@@ -47,6 +47,10 @@
47
47
  "prettify-edited": "tsx ./scripts/prettify-edited.ts",
48
48
  "build": "npm run start",
49
49
  "test": "vitest run",
50
- "test:dev": "vitest"
50
+ "test:dev": "vitest",
51
+ "format": "pnpx @biomejs/biome format --write ./src",
52
+ "lint": "pnpx @biomejs/biome lint --write ./src",
53
+ "check": "pnpx @biomejs/biome check --write ./src",
54
+ "bump": "bumpp"
51
55
  }
52
56
  }