@cybermp-community/client-types 2.5.1 → 2.5.3
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/dist/classes.d.ts +810 -810
- package/dist/game.d.ts +5 -5
- package/dist/precomputed/cef.ts +16 -2
- package/dist/precomputed/classes/extend.d.ts +157 -96
- package/dist/precomputed/classes/index.ts +2 -2
- package/dist/precomputed/classes/screens.d.ts +67 -46
- package/dist/precomputed/commands.ts +17 -0
- package/dist/precomputed/discord.ts +20 -0
- package/dist/precomputed/enums.ts +1662 -1630
- package/dist/precomputed/events/cef.ts +28 -0
- package/dist/precomputed/events/index.ts +34 -42
- package/dist/precomputed/events/map.ts +110 -19
- package/dist/precomputed/exports.ts +48 -12
- package/dist/precomputed/game.d.ts +142 -47
- package/dist/precomputed/index.ts +1 -0
- package/dist/precomputed/local-storage.ts +27 -0
- package/dist/precomputed/local.ts +103 -0
- package/dist/precomputed/meta.ts +61 -7
- package/dist/precomputed/mp.d.ts +60 -79
- package/dist/precomputed/network.ts +79 -0
- package/dist/precomputed/resources.d.ts +64 -0
- package/dist/precomputed/voice-chat.ts +64 -0
- package/package.json +4 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type CefLoadingFailedError = {
|
|
2
|
+
/** Name of the browser frame that failed to load. */
|
|
3
|
+
frameName: string;
|
|
4
|
+
/** Human-readable error description. */
|
|
5
|
+
message: string;
|
|
6
|
+
/** Source file URL where the error occurred. */
|
|
7
|
+
source: string;
|
|
8
|
+
/** Line number in the source file. */
|
|
9
|
+
line: string;
|
|
10
|
+
/** Column offset in the source line. */
|
|
11
|
+
column: string;
|
|
12
|
+
/** Raw stack trace string. */
|
|
13
|
+
stack: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export interface MpCefEventsMap {
|
|
17
|
+
/**
|
|
18
|
+
* Triggered when the browser finishes parsing the DOM.
|
|
19
|
+
* @param name - Registration name of the browser frame.
|
|
20
|
+
*/
|
|
21
|
+
domReady(name: string): void;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Triggered when the browser fails to load or encounters an error.
|
|
25
|
+
* @param error - Error details payload.
|
|
26
|
+
*/
|
|
27
|
+
loadingFailed(error: CefLoadingFailedError): void;
|
|
28
|
+
}
|
|
@@ -1,75 +1,67 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MpCefEventsMap } from './cef';
|
|
2
|
+
import type { MpEventsMap } from './map';
|
|
2
3
|
|
|
3
4
|
type Args = any[];
|
|
4
5
|
|
|
5
6
|
export interface MpEvents {
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @param eventName
|
|
9
|
-
* @param callback
|
|
8
|
+
* Subscribes a handler to a local event.
|
|
9
|
+
* @param eventName - Event name.
|
|
10
|
+
* @param callback - Handler function.
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
12
|
on<E extends keyof MpEventsMap>(eventName: E, callback: MpEventsMap[E]): void;
|
|
13
|
-
on<T extends unknown[] = Args>(
|
|
14
|
-
eventName: string,
|
|
15
|
-
callback: (...args: T) => void,
|
|
16
|
-
): void;
|
|
13
|
+
on<T extends unknown[] = Args>(eventName: string, callback: (...args: T) => void): void;
|
|
17
14
|
|
|
18
15
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @param eventName
|
|
21
|
-
* @param callback
|
|
16
|
+
* Removes a previously registered local event handler.
|
|
17
|
+
* @param eventName - Event name.
|
|
18
|
+
* @param callback - The handler reference to remove.
|
|
22
19
|
*/
|
|
23
|
-
off<T extends unknown[] = Args>(
|
|
24
|
-
eventName: string,
|
|
25
|
-
callback: (...args: T) => void,
|
|
26
|
-
): void;
|
|
20
|
+
off<T extends unknown[] = Args>(eventName: string, callback: (...args: T) => void): void;
|
|
27
21
|
|
|
28
22
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* @param
|
|
32
|
-
* @param args Arguments to pass.
|
|
23
|
+
* Dispatches a local event to all registered handlers.
|
|
24
|
+
* @param eventName - Event name.
|
|
25
|
+
* @param args - Arguments passed to each handler.
|
|
33
26
|
*/
|
|
34
27
|
emit<T extends unknown[] = Args>(eventName: string, ...args: T): void;
|
|
35
28
|
|
|
36
29
|
/**
|
|
37
|
-
*
|
|
30
|
+
* Subscribes a handler to an event dispatched from the server.
|
|
31
|
+
* @param eventName - Event name.
|
|
32
|
+
* @param callback - Handler function.
|
|
38
33
|
*/
|
|
39
|
-
onServer<T extends unknown[] = Args>(
|
|
40
|
-
eventName: string,
|
|
41
|
-
callback: (...args: T) => void,
|
|
42
|
-
): void;
|
|
34
|
+
onServer<T extends unknown[] = Args>(eventName: string, callback: (...args: T) => void): void;
|
|
43
35
|
|
|
44
36
|
/**
|
|
45
|
-
*
|
|
37
|
+
* Sends an event to the server.
|
|
38
|
+
* @param eventName - Event name.
|
|
39
|
+
* @param args - Arguments to send.
|
|
46
40
|
*/
|
|
47
41
|
emitServer<T extends unknown[] = Args>(eventName: string, ...args: T): void;
|
|
48
42
|
|
|
49
43
|
/**
|
|
50
|
-
*
|
|
44
|
+
* Sends an event to the CEF web view.
|
|
45
|
+
* @param eventName - Event name.
|
|
46
|
+
* @param args - Arguments to send.
|
|
51
47
|
*/
|
|
52
48
|
emitCef<T extends unknown[] = Args>(eventName: string, ...args: T): void;
|
|
53
49
|
|
|
54
50
|
/**
|
|
55
|
-
*
|
|
56
|
-
* @
|
|
57
|
-
* @param
|
|
51
|
+
* Subscribes a typed handler to a built-in CEF lifecycle event.
|
|
52
|
+
* @template E - Key of `MpCefEventsMap`.
|
|
53
|
+
* @param eventName - The CEF lifecycle event name.
|
|
54
|
+
* @param callback - Typed handler matching the event's signature.
|
|
58
55
|
*/
|
|
59
|
-
onCef<
|
|
60
|
-
eventName: string,
|
|
61
|
-
callback: (...args: T) => void,
|
|
62
|
-
): void;
|
|
56
|
+
onCef<E extends keyof MpCefEventsMap>(eventName: E, callback: MpCefEventsMap[E]): void;
|
|
63
57
|
|
|
64
58
|
/**
|
|
65
|
-
*
|
|
66
|
-
* @param
|
|
67
|
-
* @param callback
|
|
59
|
+
* Subscribes a handler to a custom CEF event.
|
|
60
|
+
* @param eventName - Event name.
|
|
61
|
+
* @param callback - Handler function.
|
|
68
62
|
*/
|
|
69
|
-
|
|
70
|
-
commandName: string,
|
|
71
|
-
callback: (id: number, args: T) => void,
|
|
72
|
-
): void;
|
|
63
|
+
onCef<T extends unknown[] = Args>(eventName: string, callback: (...args: T) => void): void;
|
|
73
64
|
}
|
|
74
65
|
|
|
75
|
-
export * from
|
|
66
|
+
export * from './map';
|
|
67
|
+
export * from './cef';
|
|
@@ -1,19 +1,110 @@
|
|
|
1
|
-
export interface MpEventsMap {
|
|
2
|
-
globalMetaChange<T = any, K = T>(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
export interface MpEventsMap {
|
|
2
|
+
globalMetaChange<T = any, K = T>(key: string, newValue: T, oldValue: K): undefined | boolean;
|
|
3
|
+
playerMetaChange<T = any, K = T>(
|
|
4
|
+
netId: number,
|
|
5
|
+
key: string,
|
|
6
|
+
newValue: T,
|
|
7
|
+
oldValue: K,
|
|
8
|
+
): undefined | boolean;
|
|
9
|
+
entityMetaChange<T = any, K = T>(
|
|
10
|
+
netId: number,
|
|
11
|
+
key: string,
|
|
12
|
+
newValue: T,
|
|
13
|
+
oldValue: K,
|
|
14
|
+
): undefined | boolean;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Triggered when a local resource starts running.
|
|
18
|
+
* @param resourceName - Name of the started resource.
|
|
19
|
+
*/
|
|
20
|
+
anyResourceStart(resourceName: string): void;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Triggered when a local resource stops or is reloaded.
|
|
24
|
+
* @param resourceName - Name of the stopped resource.
|
|
25
|
+
*/
|
|
26
|
+
anyResourceStop(resourceName: string): void;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Triggered when the server reports that a server-side resource has started.
|
|
30
|
+
* @param resourceName - Name of the server resource.
|
|
31
|
+
*/
|
|
32
|
+
anyServerResourceStart(resourceName: string): void;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Triggered when the server reports that a server-side resource has stopped.
|
|
36
|
+
* @param resourceName - Name of the server resource.
|
|
37
|
+
*/
|
|
38
|
+
anyServerResourceStop(resourceName: string): void;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Triggered when this specific resource finishes loading.
|
|
42
|
+
*/
|
|
43
|
+
resourceStart(): void;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Triggered when this specific resource is being shut down.
|
|
47
|
+
*/
|
|
48
|
+
resourceStop(): void;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Triggered when the engine refreshes the global resource manifest.
|
|
52
|
+
*/
|
|
53
|
+
resourcesRefresh(): void;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Triggered when a synced object leaves the local player's stream range.
|
|
57
|
+
* @param netID - Network entity ID.
|
|
58
|
+
* @param gameID - Local game engine handle.
|
|
59
|
+
*/
|
|
60
|
+
objectStreamOut(netID: number, gameID: number): void;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Triggered when a synced object enters the local player's stream range.
|
|
64
|
+
* @param netID - Network entity ID.
|
|
65
|
+
* @param gameID - Local game engine handle.
|
|
66
|
+
*/
|
|
67
|
+
objectStreamIn(netID: number, gameID: number): void;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Triggered when a synced ped or NPC leaves the local player's stream range.
|
|
71
|
+
* @param netID - Network entity ID.
|
|
72
|
+
* @param gameID - Local game engine handle.
|
|
73
|
+
*/
|
|
74
|
+
pedStreamOut(netID: number, gameID: number): void;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Triggered when a synced ped or NPC enters the local player's stream range.
|
|
78
|
+
* @param netID - Network entity ID.
|
|
79
|
+
* @param gameID - Local game engine handle.
|
|
80
|
+
*/
|
|
81
|
+
pedStreamIn(netID: number, gameID: number): void;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Triggered when a remote player leaves the local player's stream zone.
|
|
85
|
+
* @param netID - Network player ID.
|
|
86
|
+
* @param gameID - Local game engine handle.
|
|
87
|
+
*/
|
|
88
|
+
remotePlayerStreamOut(netID: number, gameID: number): void;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Triggered when a remote player enters the local player's stream zone.
|
|
92
|
+
* @param netID - Network player ID.
|
|
93
|
+
* @param gameID - Local game engine handle.
|
|
94
|
+
*/
|
|
95
|
+
remotePlayerStreamIn(netID: number, gameID: number): void;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Triggered when a synced vehicle leaves the local player's stream range.
|
|
99
|
+
* @param netID - Network entity ID.
|
|
100
|
+
* @param gameID - Local game engine handle.
|
|
101
|
+
*/
|
|
102
|
+
vehicleStreamOut(netID: number, gameID: number): void;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Triggered when a synced vehicle enters the local player's stream range.
|
|
106
|
+
* @param netID - Network entity ID.
|
|
107
|
+
* @param gameID - Local game engine handle.
|
|
108
|
+
*/
|
|
109
|
+
vehicleStreamIn(netID: number, gameID: number): void;
|
|
110
|
+
}
|
|
@@ -1,12 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Interface managing cross-resource execution pipelines.
|
|
3
|
+
*
|
|
4
|
+
* This intersection type enables a dual-purpose pattern: it can be invoked directly as a
|
|
5
|
+
* function to register and expose local routines (`MpCreateExport`), or accessed as a nested
|
|
6
|
+
* directory dictionary to invoke public endpoints exposed by external resources (`MpExternalExports`).
|
|
7
|
+
* @example
|
|
8
|
+
* // in resource named "freeroam" -
|
|
9
|
+
* mp.exports('showNotification', (message) => console.log("Notification from freeroam", message))
|
|
10
|
+
* // triggering this function in any other resource -
|
|
11
|
+
* mp.exports.freeroam.showNotification('test message')
|
|
12
|
+
*/
|
|
13
|
+
export type MpExports = MpExternalExports & MpCreateExport;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A dynamic index mapping representing foreign modules and their exposed public functions.
|
|
17
|
+
*/
|
|
18
|
+
interface MpExternalExports {
|
|
19
|
+
/**
|
|
20
|
+
* Accesses an external module's public namespace by its resource name string.
|
|
21
|
+
*/
|
|
22
|
+
[module: string]: {
|
|
23
|
+
/**
|
|
24
|
+
* Invokes a specific exported method from the targeted external resource.
|
|
25
|
+
* @template T - Array type mapping the arguments passed to the external routine.
|
|
26
|
+
* @template R - The expected return value or wrapped Promise type.
|
|
27
|
+
* @param args - Arbitrary parameters forwarded directly to the target function execution context.
|
|
28
|
+
* @returns The synchronous or asynchronous output value of the foreign routine.
|
|
29
|
+
*/
|
|
30
|
+
[name: string]: <T extends unknown[] = unknown[], R = unknown>(...args: T) => R | Promise<R>;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Defines a function signature used to expose a local routine to the global environment.
|
|
36
|
+
*
|
|
37
|
+
* Registers a callback execution mapping under a specific name identifier, making it
|
|
38
|
+
* discoverable and executable by separate script runtime containers.
|
|
39
|
+
*
|
|
40
|
+
* @template T - Array type mapping the callback's expected input parameters.
|
|
41
|
+
* @template R - The expected synchronous or asynchronous return layout pattern.
|
|
42
|
+
* @param name - The unique public string label assigned to this export entry point.
|
|
43
|
+
* @param callback - The underlying functional routine logic triggered upon external invocation.
|
|
44
|
+
*/
|
|
45
|
+
type MpCreateExport = <T extends unknown[] = unknown[], R = unknown>(
|
|
46
|
+
name: string,
|
|
47
|
+
callback: (...args: T) => R | Promise<R>,
|
|
48
|
+
) => void;
|
|
@@ -1,77 +1,180 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
3
|
-
import type * as CyberEnums from "../enums";
|
|
1
|
+
import type { MpClasses } from '../mp-classes.d.ts';
|
|
2
|
+
import type * as CyberEnums from '../enums';
|
|
4
3
|
|
|
5
4
|
// THIS CODE IS FOR PRECOMPUTED TYPES
|
|
6
5
|
export type UnwrapClass<T> = T extends { new (): infer U } ? U : T;
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export type AnyFunc = (...args: any[]) => any;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export type SafeMethod<I, M extends keyof I> = I[M] extends AnyFunc ? I[M] : AnyFunc;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Defines a function signature used to completely override a method within a specified game class.
|
|
19
|
+
* The callback receives the instance (`self`), the original arguments, and the original method implementation as the final parameter.
|
|
20
|
+
* @template C - The class name key from `MpClasses`.
|
|
21
|
+
* @template I - The resolved instance type of the class.
|
|
22
|
+
* @template M - The method names available on the class instance.
|
|
23
|
+
*/
|
|
8
24
|
export type OverrideFunction = <
|
|
9
25
|
C extends keyof MpClasses,
|
|
10
26
|
I extends UnwrapClass<MpClasses[C]>,
|
|
11
|
-
M extends keyof I
|
|
27
|
+
M extends keyof I,
|
|
12
28
|
>(
|
|
13
29
|
className: C,
|
|
14
30
|
methodName: M,
|
|
15
31
|
callback: (
|
|
16
32
|
self: I,
|
|
17
|
-
...args: [...Parameters<I
|
|
18
|
-
) => ReturnType<I
|
|
33
|
+
...args: [...Parameters<SafeMethod<I, M>>, origin: SafeMethod<I, M>]
|
|
34
|
+
) => ReturnType<SafeMethod<I, M>>,
|
|
19
35
|
) => void;
|
|
20
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Defines a function signature used to observe (hook into) a method within a specified game class.
|
|
39
|
+
* The callback receives the instance (`self`) and the arguments passed to the method.
|
|
40
|
+
* @template C - The class name key from `MpClasses`.
|
|
41
|
+
* @template I - The resolved instance type of the class.
|
|
42
|
+
* @template M - The method names available on the class instance.
|
|
43
|
+
*/
|
|
21
44
|
export type ObserveFunction = <
|
|
22
45
|
C extends keyof MpClasses,
|
|
23
46
|
I extends UnwrapClass<MpClasses[C]>,
|
|
24
|
-
M extends keyof I
|
|
47
|
+
M extends keyof I,
|
|
25
48
|
>(
|
|
26
49
|
className: C,
|
|
27
50
|
methodName: M,
|
|
28
|
-
callback: (self: I, ...args: Parameters<I
|
|
51
|
+
callback: (self: I, ...args: Parameters<SafeMethod<I, M>>) => void,
|
|
29
52
|
) => void;
|
|
30
53
|
|
|
31
54
|
export interface TweakDB {
|
|
55
|
+
/**
|
|
56
|
+
* Retrieves an array of records matching a specific query or record type.
|
|
57
|
+
* @template T - The expected type of the records.
|
|
58
|
+
* @param str - The TweakDB record path or type identifier.
|
|
59
|
+
* @returns An array of matching records.
|
|
60
|
+
*/
|
|
32
61
|
getRecords<T = any>(str: string): T[];
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves a single record from TweakDB.
|
|
65
|
+
* @template T - The expected type of the record.
|
|
66
|
+
* @param str - The specific TweakDB ID or path string.
|
|
67
|
+
* @returns The requested record.
|
|
68
|
+
*/
|
|
33
69
|
getRecord<T = any>(str: string): T;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Queries TweakDB paths and returns matching entry keys.
|
|
73
|
+
* @param str - The search or query pattern string.
|
|
74
|
+
* @returns An array of matching string IDs.
|
|
75
|
+
*/
|
|
34
76
|
query(str: string): string[];
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Retrieves a "flat" property value directly from TweakDB.
|
|
80
|
+
* @template T - The expected type of the flat property.
|
|
81
|
+
* @param str - The path to the flat property (e.g., "Items.SomeItem.someProperty").
|
|
82
|
+
* @returns The flat property value.
|
|
83
|
+
*/
|
|
35
84
|
getFlat<T = any>(str: string): T;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Overwrites an array flat property in TweakDB and updates the engine immediately.
|
|
88
|
+
* @param str - The path to the flat property.
|
|
89
|
+
* @param arr - The new array of values to assign.
|
|
90
|
+
* @returns `true` if the operation was successful, otherwise `false`.
|
|
91
|
+
*/
|
|
36
92
|
setFlats(str: string, arr: any[]): boolean;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Overwrites a single flat property value in TweakDB and updates the engine immediately.
|
|
96
|
+
* @param str - The path to the flat property.
|
|
97
|
+
* @param obj - The new value to assign.
|
|
98
|
+
* @returns `true` if the operation was successful, otherwise `false`.
|
|
99
|
+
*/
|
|
37
100
|
setFlat(str: string, obj: any): boolean;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Overwrites a flat property value in TweakDB *without* triggering an immediate engine update.
|
|
104
|
+
* Useful when batching multiple TweakDB edits before a manual refresh.
|
|
105
|
+
* @param str - The path to the flat property.
|
|
106
|
+
* @param obj - The new value to assign.
|
|
107
|
+
* @returns `true` if the operation was successful, otherwise `false`.
|
|
108
|
+
*/
|
|
38
109
|
setFlatNoUpdate(str: string, obj: any): boolean;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Forces the engine to re-read and update a specific record from its current TweakDB state.
|
|
113
|
+
* @param str - The path to the record to update.
|
|
114
|
+
* @returns `true` if the update succeeded, otherwise `false`.
|
|
115
|
+
*/
|
|
39
116
|
updateRecord(str: string): boolean;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Runtime creates a new TweakDB record.
|
|
120
|
+
* @param key - The new record identifier key.
|
|
121
|
+
* @param value - The record blueprint or type definition key.
|
|
122
|
+
* @returns `true` if creation succeeded, otherwise `false`.
|
|
123
|
+
*/
|
|
40
124
|
createRecord(key: string, value: string): boolean;
|
|
41
125
|
}
|
|
42
126
|
|
|
43
|
-
export interface
|
|
127
|
+
export interface MpGameHashes {
|
|
128
|
+
/**
|
|
129
|
+
* Converts a TweakDB record string path into its unique TweakDBID hash signature format.
|
|
130
|
+
* @param name - The text record path string (e.g., `"Items.money"`).
|
|
131
|
+
* @returns The resolved TweakDBID hash string reference.
|
|
132
|
+
*/
|
|
133
|
+
toTweakdbid(name: string): string;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Resolves an internal TweakDBID hash signature string back into its original readable record path string.
|
|
137
|
+
* @param hash - The native TweakDBID hash layout signature.
|
|
138
|
+
* @returns The readable path text description string if found, otherwise an empty or fallback string representation.
|
|
139
|
+
*/
|
|
140
|
+
fromTweakdbid(hash: string): string;
|
|
141
|
+
|
|
44
142
|
/**
|
|
45
|
-
*
|
|
46
|
-
* @param
|
|
143
|
+
* Resolves a resource file route or asset system address string into its designated numeric/hexadecimal Resource Reference (`ResRef`) signature hash.
|
|
144
|
+
* @param name - The full system asset path string (e.g., `"base\\characters\\main_npc\\jackie.ent"`).
|
|
145
|
+
* @returns The matching native ResRef serialization target hash key.
|
|
47
146
|
*/
|
|
48
|
-
|
|
147
|
+
toResref(name: string): string;
|
|
49
148
|
|
|
50
149
|
/**
|
|
51
|
-
*
|
|
52
|
-
* @param
|
|
150
|
+
* Translates a native game engine Resource Reference (`ResRef`) asset identifier string back into its readable raw directory path string.
|
|
151
|
+
* @param hash - The target ResRef hash format token layout string.
|
|
152
|
+
* @returns The verified asset resource string path.
|
|
53
153
|
*/
|
|
54
|
-
|
|
154
|
+
fromResref(hash: string): string;
|
|
55
155
|
|
|
56
156
|
/**
|
|
57
|
-
*
|
|
58
|
-
* @param
|
|
157
|
+
* Converts a standard text identifier string into its corresponding internal engine unique 64-bit string identifier (`CName`) hash representation.
|
|
158
|
+
* @param name - The plaintext string label configuration name to translate.
|
|
159
|
+
* @returns The matching numeric engine structure string token representation.
|
|
59
160
|
*/
|
|
60
|
-
|
|
161
|
+
toCname(name: string): string;
|
|
61
162
|
|
|
62
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Reverses a native engine 64-bit name identification token identifier (`CName`) back into its human-readable plaintext string label.
|
|
165
|
+
* @param hash - The string representation of the target CName identifier.
|
|
166
|
+
* @returns The corresponding unhashed string literal value.
|
|
167
|
+
*/
|
|
168
|
+
fromCname(hash: string): string;
|
|
63
169
|
}
|
|
64
170
|
|
|
65
|
-
declare module
|
|
171
|
+
declare module '../game.d.ts' {
|
|
66
172
|
export interface MpGame {
|
|
67
|
-
CyberMP: CyberMP;
|
|
68
173
|
TweakDB: TweakDB;
|
|
174
|
+
hashes: MpGameHashes;
|
|
69
175
|
|
|
70
176
|
onInputKeyEvent(
|
|
71
|
-
callback: (
|
|
72
|
-
action: CyberEnums.EInputAction,
|
|
73
|
-
key: CyberEnums.EInputKey,
|
|
74
|
-
) => void,
|
|
177
|
+
callback: (action: CyberEnums.EInputAction, key: CyberEnums.EInputKey) => void,
|
|
75
178
|
): void;
|
|
76
179
|
|
|
77
180
|
getDisplayResolution(): [width: number, height: number];
|
|
@@ -106,28 +209,6 @@ declare module "../game.d.ts" {
|
|
|
106
209
|
*/
|
|
107
210
|
AddToInventory(itemName: string, count: number): void;
|
|
108
211
|
|
|
109
|
-
/**
|
|
110
|
-
* Returns model hash convertable to number.
|
|
111
|
-
* @param name Model name
|
|
112
|
-
* @param type Model name type
|
|
113
|
-
* @returns Model hash
|
|
114
|
-
*/
|
|
115
|
-
getHashFromName(
|
|
116
|
-
name: string,
|
|
117
|
-
type: "tweakdbid" | "cname" | "resref",
|
|
118
|
-
): string;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Returns model name.
|
|
122
|
-
* @param name Model hash
|
|
123
|
-
* @param type Model hash type
|
|
124
|
-
* @returns Model name
|
|
125
|
-
*/
|
|
126
|
-
getNameFromHash(
|
|
127
|
-
hash: string,
|
|
128
|
-
type: "tweakdbid" | "cname" | "resref",
|
|
129
|
-
): string;
|
|
130
|
-
|
|
131
212
|
/**
|
|
132
213
|
* Overrides method function inside selected class.
|
|
133
214
|
* @param className Class name
|
|
@@ -186,7 +267,21 @@ declare module "../game.d.ts" {
|
|
|
186
267
|
*/
|
|
187
268
|
observeRaw: ObserveFunction;
|
|
188
269
|
|
|
270
|
+
/**
|
|
271
|
+
* Serializes a JavaScript runtime payload object structural value into a native engine container format (`Variant`).
|
|
272
|
+
* @template R - The expected return typing output blueprint shape.
|
|
273
|
+
* @param obj - Target entity object structure to convert.
|
|
274
|
+
* @param str - Native structural reflection mapping blueprint name string.
|
|
275
|
+
* @returns The wrapped engine reference asset layout structure.
|
|
276
|
+
*/
|
|
189
277
|
toVariant<R = Record<string, unknown>>(obj: any, str: string): R;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Deserializes a native engine container structure layout (`Variant`) back into raw accessible JavaScript object values.
|
|
281
|
+
* @template R - The expected target JavaScript shape format.
|
|
282
|
+
* @param obj - Variant payload container input from the game engine.
|
|
283
|
+
* @returns The unwrapped JavaScript object structure data.
|
|
284
|
+
*/
|
|
190
285
|
fromVariant<R = any>(obj: any): R;
|
|
191
286
|
}
|
|
192
287
|
}
|
|
@@ -1,9 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent key-value storage on the client.
|
|
3
|
+
* Survives resource restarts and server reconnections.
|
|
4
|
+
*/
|
|
1
5
|
export interface MpLocalStorage {
|
|
6
|
+
/**
|
|
7
|
+
* Stores a string value under the given key, overwriting any existing entry.
|
|
8
|
+
* @param key - Storage key.
|
|
9
|
+
* @param value - String value to store.
|
|
10
|
+
*/
|
|
2
11
|
set(key: string, value: string): void;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Returns the value associated with the given key.
|
|
15
|
+
* @param key - Storage key to look up.
|
|
16
|
+
* @returns The stored string, or an empty string if the key doesn't exist.
|
|
17
|
+
*/
|
|
3
18
|
get(key: string): string;
|
|
4
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Deletes a specific entry from storage.
|
|
22
|
+
* @param key - Storage key to remove.
|
|
23
|
+
*/
|
|
5
24
|
delete(key: string): void;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Clears all entries from this resource's local storage.
|
|
28
|
+
*/
|
|
6
29
|
deleteAll(): void;
|
|
7
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Flushes in-memory storage to disk.
|
|
33
|
+
* Call this if you need to guarantee data is not lost on a client crash.
|
|
34
|
+
*/
|
|
8
35
|
save(): void;
|
|
9
36
|
}
|