@cybermp-community/client-types 2.5.5 โ 2.6.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/README.md +47 -22
- package/dist/classes.d.ts +5125 -505
- package/dist/enums.ts +2031 -1622
- package/dist/game.d.ts +46 -25
- package/dist/mp-classes.d.ts +334 -33
- package/dist/precomputed/classes/extend.d.ts +8 -0
- package/dist/precomputed/game.d.ts +5 -0
- package/dist/precomputed/index.ts +5 -0
- package/dist/precomputed/network.ts +6 -0
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,41 +1,66 @@
|
|
|
1
1
|
# CyberMP Client Types
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@cybermp-community/client-types` types the global `mp` inside the player's game. `mp.game` covers Cyberpunk 2077 2.5 classes, enums, and bitfields, plus the libraries shipped with the client:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- [Codeware](https://github.com/psiberx/cp2077-codeware) 1.21.1
|
|
6
|
+
- [ArchiveXL](https://github.com/psiberx/cp2077-archive-xl) 1.28.0
|
|
7
|
+
- [TweakXL](https://github.com/psiberx/cp2077-tweak-xl) 1.12.0
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
This package includes built-in types for the following essential modding libraries, providing full type safety and IntelliSense for their respective classes and functions:
|
|
9
|
+
## Installation
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
11
|
+
```bash
|
|
12
|
+
# npm
|
|
13
|
+
npm install -D @cybermp-community/client-types
|
|
14
|
+
|
|
15
|
+
# pnpm
|
|
16
|
+
pnpm add -D @cybermp-community/client-types
|
|
17
|
+
|
|
18
|
+
# bun
|
|
19
|
+
bun add -d @cybermp-community/client-types
|
|
20
|
+
```
|
|
14
21
|
|
|
15
|
-
##
|
|
22
|
+
## Usage
|
|
16
23
|
|
|
17
|
-
|
|
24
|
+
`client/global.d.ts`:
|
|
18
25
|
|
|
19
|
-
```
|
|
20
|
-
|
|
26
|
+
```ts
|
|
27
|
+
import type { MpClient } from "@cybermp-community/client-types";
|
|
28
|
+
|
|
29
|
+
declare global {
|
|
30
|
+
const mp: MpClient;
|
|
31
|
+
}
|
|
21
32
|
```
|
|
22
33
|
|
|
23
|
-
|
|
34
|
+
`client/index.ts` runs inside Cyberpunk 2077 after the server delivers the compiled script:
|
|
24
35
|
|
|
25
|
-
```
|
|
26
|
-
|
|
36
|
+
```ts
|
|
37
|
+
mp.game.onInit(() => {
|
|
38
|
+
mp.cef.setUrl("http://localhost:5173");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
mp.events.emitServer("requestItem", "Items.Preset_Silverhand_3516");
|
|
42
|
+
|
|
43
|
+
mp.events.onServer("giveItem", (itemName: string) => {
|
|
44
|
+
mp.game.AddToInventory(itemName, 1);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
mp.events.onCef("ui:ready", () => {
|
|
48
|
+
mp.cef.setFocus(true, true);
|
|
49
|
+
});
|
|
27
50
|
```
|
|
28
51
|
|
|
29
|
-
|
|
52
|
+
Enums and bitfields are imported as values. `mp` stays the runtime global.
|
|
30
53
|
|
|
31
|
-
```
|
|
32
|
-
|
|
54
|
+
```ts
|
|
55
|
+
import { AICoverExposureMethod } from "@cybermp-community/client-types";
|
|
33
56
|
```
|
|
34
57
|
|
|
35
|
-
|
|
58
|
+
Put `global.d.ts` next to the client scripts so `include` in `tsconfig.json` picks it up.
|
|
59
|
+
|
|
60
|
+
## Disclaimer
|
|
36
61
|
|
|
37
|
-
This repository is developed by [CyberMP Community Developers](https://gitlab.com/cybermp) and is
|
|
62
|
+
This repository is developed by [CyberMP Community Developers](https://gitlab.com/cybermp) and is separate from CyberMP (cyber.mp).
|
|
38
63
|
|
|
39
|
-
##
|
|
64
|
+
## License
|
|
40
65
|
|
|
41
|
-
|
|
66
|
+
CC BY-SA 4.0. See the [LICENSE](LICENSE) file for details.
|