@cybermp/client-types 1.6.11 → 1.8.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.
- package/out/precomputed/classes.d.ts +95 -96
- package/out/precomputed/discord.d.ts +3 -0
- package/out/precomputed/enums.d.ts +38 -38
- package/out/precomputed/events.d.ts +65 -65
- package/out/precomputed/game.d.ts +160 -164
- package/out/precomputed/global.d.ts +134 -148
- package/out/precomputed/index.d.ts +7 -7
- package/out/precomputed/local-storage.d.ts +7 -0
- package/out/precomputed/voice-chat.d.ts +19 -21
- package/package.json +6 -2
|
@@ -1,96 +1,95 @@
|
|
|
1
|
-
import * as CyberEnums from
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* See {@link worldWeatherState#name}
|
|
3
|
-
*/
|
|
4
|
-
export enum WeatherState {
|
|
5
|
-
SUNNY =
|
|
6
|
-
LIGHT_CLOUDS =
|
|
7
|
-
CLOUDY =
|
|
8
|
-
HEAVY_CLOUDS =
|
|
9
|
-
FOG =
|
|
10
|
-
RAIN =
|
|
11
|
-
TOXIC_RAIN =
|
|
12
|
-
POLLUTION =
|
|
13
|
-
SANDSTORM =
|
|
14
|
-
DEEP_BLUE =
|
|
15
|
-
LIGHT_RAIN =
|
|
16
|
-
SQUAT_MORNING =
|
|
17
|
-
EPILOGUE_CLOUDY_MORNING =
|
|
18
|
-
RAINY_NIGHT =
|
|
19
|
-
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:
|
|
4
|
-
callback: (resourceName: string) => void,
|
|
5
|
-
): void;
|
|
6
|
-
|
|
7
|
-
on(
|
|
8
|
-
eventName:
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
):
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
*
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
*
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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,134 @@
|
|
|
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
|
-
|
|
7
|
-
type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
):
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
+
localStorage: MpLocalStorage;
|
|
17
|
+
|
|
18
|
+
getStreamedPool(
|
|
19
|
+
objName: 'CVehicle' | 'CPed' | 'CPickup' | 'CObject',
|
|
20
|
+
): number[];
|
|
21
|
+
getStreamedPlayers(): number[];
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Mapping between network and game IDs.
|
|
25
|
+
*/
|
|
26
|
+
getVehicleGameIdByNetworkId(id: number): number;
|
|
27
|
+
|
|
28
|
+
getPlayerGameIdByNetworkId(id: number): number;
|
|
29
|
+
|
|
30
|
+
getObjectGameIdByNetworkId(id: number): number;
|
|
31
|
+
|
|
32
|
+
getVehicleNetworkIdByGameId(hash: number): number;
|
|
33
|
+
|
|
34
|
+
getPlayerNetworkIdByGameId(hash: number): number;
|
|
35
|
+
|
|
36
|
+
getObjectNetworkIdByGameId(hash: number): number;
|
|
37
|
+
|
|
38
|
+
getPedNetworkIdByGameId(hash: number): number;
|
|
39
|
+
|
|
40
|
+
getPedGameIdByNetworkId(hash: number): number;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Local player spawning API.
|
|
44
|
+
*/
|
|
45
|
+
setSpawnDataLocalPlayer(x: number, y: number, z: number, yaw: number): void;
|
|
46
|
+
|
|
47
|
+
spawnLocalPlayer(): boolean;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Spawn local-only entities (not synced).
|
|
51
|
+
*/
|
|
52
|
+
spawnLocalPed(
|
|
53
|
+
skinHash: number,
|
|
54
|
+
appHash: number,
|
|
55
|
+
x: number,
|
|
56
|
+
y: number,
|
|
57
|
+
z: number,
|
|
58
|
+
yaw: number,
|
|
59
|
+
streaming: boolean,
|
|
60
|
+
): number;
|
|
61
|
+
|
|
62
|
+
spawnLocalVehicle(
|
|
63
|
+
skinHash: number,
|
|
64
|
+
appHash: number,
|
|
65
|
+
x: number,
|
|
66
|
+
y: number,
|
|
67
|
+
z: number,
|
|
68
|
+
roll: number,
|
|
69
|
+
pitch: number,
|
|
70
|
+
yaw: number,
|
|
71
|
+
streaming: boolean,
|
|
72
|
+
): number;
|
|
73
|
+
|
|
74
|
+
spawnLocalObject(
|
|
75
|
+
skinHash: bigint | number,
|
|
76
|
+
appHash: bigint | number,
|
|
77
|
+
x: number,
|
|
78
|
+
y: number,
|
|
79
|
+
z: number,
|
|
80
|
+
roll: number,
|
|
81
|
+
pitch: number,
|
|
82
|
+
yaw: number,
|
|
83
|
+
streaming: boolean,
|
|
84
|
+
): number;
|
|
85
|
+
|
|
86
|
+
despawnLocalPed(hash: number): void;
|
|
87
|
+
|
|
88
|
+
despawnLocalVehicle(hash: number): void;
|
|
89
|
+
|
|
90
|
+
despawnLocalObject(hash: number): void;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Get Discord token via game SDK (unstable).
|
|
94
|
+
*/
|
|
95
|
+
getDiscordOAuth2Token(discordAppId: string): string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get Discord auth code (preferred).
|
|
99
|
+
*/
|
|
100
|
+
getDiscordCodeAuthorization(discordAppId: string, scopes: string): string;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Returns current server IP:PORT string.
|
|
104
|
+
*/
|
|
105
|
+
getCurrentServerEndpoint(): string;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get server ID from player hash.
|
|
109
|
+
*/
|
|
110
|
+
getPlayerServerId(playerHash: number): number;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Get src variable value as string.
|
|
114
|
+
*/
|
|
115
|
+
getVar(varName: string): string;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Get console variable value as integer.
|
|
119
|
+
*/
|
|
120
|
+
getVarInt(varName: string): number;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Returns time in ms since game start.
|
|
124
|
+
*/
|
|
125
|
+
getGameTimer(): number;
|
|
126
|
+
|
|
127
|
+
getLauncherSettingsJSON(): string;
|
|
128
|
+
|
|
129
|
+
getLauncherSettings(): any;
|
|
130
|
+
|
|
131
|
+
setTick(cb: () => any): number;
|
|
132
|
+
|
|
133
|
+
clearTick(tickId: number): void;
|
|
134
|
+
}
|
|
@@ -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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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.
|
|
3
|
+
"version": "1.8.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
|
}
|