@nativewrappers/fivem 0.0.29 → 0.0.31
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 +23 -24
- package/client/Game.js +1 -1
- package/client/ParticleEffect.js +1 -1
- package/client/TaskSequence.js +1 -0
- package/client/cfx/index.d.ts +0 -1
- package/client/models/BaseEntity.d.ts +25 -2
- package/client/models/BaseEntity.js +31 -2
- package/client/models/EntityBoneCollection.d.ts +0 -2
- package/client/models/EntityBoneCollection.js +0 -1
- package/client/models/Ped.d.ts +6 -6
- package/client/models/Ped.js +47 -50
- package/client/models/Player.d.ts +1 -2
- package/client/models/Prop.d.ts +1 -1
- package/client/models/Prop.js +3 -3
- package/client/models/Vehicle.d.ts +4 -4
- package/client/models/VehicleModCollection.d.ts +1 -1
- package/client/models/VehicleModCollection.js +1 -2
- package/client/models/VehicleWindowCollection.d.ts +2 -2
- package/client/models/VehicleWindowCollection.js +6 -5
- package/client/ui/Screen.js +2 -2
- package/client/ui/Sprite.js +2 -2
- package/client/ui/Text.js +3 -2
- package/client/ui/Timerbar.js +1 -1
- package/client/ui/menu/Menu.d.ts +2 -2
- package/client/ui/menu/Menu.js +10 -10
- package/client/ui/menu/items/UIMenuCheckboxItem.js +1 -1
- package/client/ui/menu/items/UIMenuItem.d.ts +1 -1
- package/client/ui/menu/items/UIMenuItem.js +9 -9
- package/client/ui/menu/items/UIMenuListItem.js +2 -2
- package/client/ui/menu/items/UIMenuSliderItem.js +9 -9
- package/client/ui/menu/items/panels/AbstractUIMenuPanel.d.ts +2 -2
- package/client/ui/menu/items/panels/AbstractUIMenuPanel.js +1 -1
- package/client/ui/menu/items/panels/UIMenuColorPanel.js +3 -3
- package/client/ui/menu/items/panels/UIMenuGridPanel.d.ts +4 -4
- package/client/ui/menu/items/panels/UIMenuGridPanel.js +1 -1
- package/client/ui/menu/items/panels/UIMenuPercentagePanel.js +3 -3
- package/client/ui/menu/items/panels/UIMenuStatisticsPanel.js +1 -1
- package/client/ui/menu/items/panels/UIMenuStatisticsPanelItem.js +3 -3
- package/client/utils/index.d.ts +1 -2
- package/client/utils/index.js +1 -2
- package/common/types.d.ts +0 -1
- package/common/utils/Color.d.ts +4 -0
- package/common/utils/Color.js +6 -2
- package/package.json +8 -8
- package/server/cfx/index.d.ts +0 -1
- package/server/entities/BaseEntity.d.ts +0 -1
- package/server/entities/Player.d.ts +0 -1
- package/client/utils/Color.d.ts +0 -15
- package/client/utils/Color.js +0 -22
package/README.md
CHANGED
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
<h1 align="center">Monorepo for a FiveM server/client wrapper</h1>
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<i
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
<i>🔥 A Javascript/Typescript package for FiveM resource development 🎮</i>
|
|
5
|
+
<br>
|
|
6
|
+
<small>This project is in no way affiliated with FiveM or the Cfx.re Collective.</small>
|
|
7
|
+
</br></br>
|
|
8
|
+
<a href="https://github.com/nativewrappers/fivem/blob/master/LICENSE">
|
|
9
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat" alt="License: MIT">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@nativewrappers/fivem">
|
|
12
|
+
<img src="https://img.shields.io/npm/v/@nativewrappers/fivem?style=flat" alt="npm version">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/@nativewrappers/fivem">
|
|
15
|
+
<img src="https://img.shields.io/npm/dm/@nativewrappers/fivem?style=flat">
|
|
16
|
+
</a>
|
|
17
|
+
<a href="https://github.com/nativewrappers/fivem/actions/workflows/config.yml">
|
|
18
|
+
<img src="https://github.com/nativewrappers/fivem/actions/workflows/config.yml/badge.svg" alt="Workflow Status">
|
|
19
|
+
</a>
|
|
20
|
+
<a href="https://github.com/nativewrappers/fivem/commits/master">
|
|
21
|
+
<img src="https://img.shields.io/github/last-commit/nativewrappers/fivem.svg?style=flat" alt="Last commit">
|
|
22
|
+
</a>
|
|
22
23
|
</p>
|
|
23
24
|
|
|
25
|
+
<h3 align="center">This project is currently interating rapidly, there will be breaking changes.</h3>
|
|
26
|
+
|
|
24
27
|
<p align="center">
|
|
25
|
-
<a href="https://
|
|
26
|
-
-
|
|
28
|
+
<h2 align="center"><a href="https://github.com/nativewrappers/fivem/tree/main/docs">Documentation</a></h2>
|
|
27
29
|
<!-- <a href="https://forum.fivem.net/t/fivem-js-v1-3-2-javascript-typescript-wrapper-now-with-menu-class-nativeui/268640">Forum</a> -->
|
|
28
30
|
</p>
|
|
29
31
|
|
|
30
|
-
## This project is currently interating rapidly, there will be breaking changes.
|
|
31
|
-
|
|
32
|
-
This project is in no way affiliated with FiveM or the Cfx.re Collective.
|
|
33
|
-
|
|
34
32
|
## Features
|
|
33
|
+
|
|
35
34
|
- No runtime dependencies
|
|
36
35
|
- Abstracts common used FiveM practices
|
|
37
36
|
- Entity management through class objects (i.e. `Vehicle` and `Ped` entities)
|
package/client/Game.js
CHANGED
|
@@ -76,7 +76,7 @@ export class Game {
|
|
|
76
76
|
*/
|
|
77
77
|
static get Player() {
|
|
78
78
|
const handle = PlayerId();
|
|
79
|
-
if (
|
|
79
|
+
if (this.cachedPlayer === undefined || handle !== this.cachedPlayer.Handle) {
|
|
80
80
|
this.cachedPlayer = new Player(handle);
|
|
81
81
|
}
|
|
82
82
|
return this.cachedPlayer;
|
package/client/ParticleEffect.js
CHANGED
|
@@ -14,7 +14,7 @@ export class ParticleEffect {
|
|
|
14
14
|
constructor(asset, effectName) {
|
|
15
15
|
this.offset = new Vector3(0, 0, 0);
|
|
16
16
|
this.rotation = new Vector3(0, 0, 0);
|
|
17
|
-
this.color = Color.
|
|
17
|
+
this.color = Color.Transparent;
|
|
18
18
|
this.scale = 1.0;
|
|
19
19
|
this.range = 1.0;
|
|
20
20
|
this.invertAxis = { flags: InvertAxisFlags.None };
|
package/client/TaskSequence.js
CHANGED
package/client/cfx/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="@citizenfx/client" />
|
|
2
1
|
import { Blip } from '../Blip';
|
|
3
2
|
import { ForceType } from '../enums';
|
|
4
3
|
import { MaterialHash, WeaponHash } from '../hashes';
|
|
@@ -137,8 +136,32 @@ export declare class BaseEntity {
|
|
|
137
136
|
* @param offset: the amount to offset from the entity
|
|
138
137
|
* @returns the offset position from the entity in world coords
|
|
139
138
|
*/
|
|
140
|
-
|
|
139
|
+
getAbsolutePositionOffset(worldCoords: Vector3): Vector3;
|
|
140
|
+
/**
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const ply = Game.PlayerPed;
|
|
144
|
+
* const plyPos = ply.Position;
|
|
145
|
+
* const bag = await World.createProp(new Model('ba_prop_battle_bag_01b'), plyPos, true, true, true);
|
|
146
|
+
* bag.attachToBone(
|
|
147
|
+
* ply.Bones.getBone(64113),
|
|
148
|
+
* new Vector3(0.12, -0.25, 0.0),
|
|
149
|
+
* new Vector3(105.0, 50.0, 190.0)
|
|
150
|
+
* )
|
|
151
|
+
* const offset = bag.getRelativePositionOffset(plyPos);
|
|
152
|
+
* ```
|
|
153
|
+
* @param worldCoords: the offset given the world coords
|
|
154
|
+
* @returns the offset position from the entity in relative coords
|
|
155
|
+
*/
|
|
156
|
+
getRelativePositionOffset(offset: Vector3): Vector3;
|
|
157
|
+
/**
|
|
158
|
+
* @deprecated use [[getAbsolutePositionOffset]] instead
|
|
159
|
+
*/
|
|
141
160
|
getPositionOffset(worldCoords: Vector3): Vector3;
|
|
161
|
+
/**
|
|
162
|
+
* @deprecated use [[getRelativePositionOffset]]
|
|
163
|
+
*/
|
|
164
|
+
getOffsetPosition(offset: Vector3): Vector3;
|
|
142
165
|
attachTo(entity: BaseEntity, position: Vector3, rotation: Vector3, collisions?: boolean, unk9?: boolean, useSoftPinning?: boolean, rotationOrder?: number): void;
|
|
143
166
|
attachToBone(entityBone: EntityBone, position: Vector3, rotation: Vector3, collisions?: boolean, unk9?: boolean, useSoftPinning?: boolean, rotationOrder?: number): void;
|
|
144
167
|
detach(): void;
|
|
@@ -366,11 +366,40 @@ export class BaseEntity {
|
|
|
366
366
|
* @param offset: the amount to offset from the entity
|
|
367
367
|
* @returns the offset position from the entity in world coords
|
|
368
368
|
*/
|
|
369
|
-
|
|
369
|
+
getAbsolutePositionOffset(worldCoords) {
|
|
370
|
+
return Vector3.fromArray(GetOffsetFromEntityGivenWorldCoords(this.handle, worldCoords.x, worldCoords.y, worldCoords.z));
|
|
371
|
+
}
|
|
372
|
+
// TODO: Better example
|
|
373
|
+
/**
|
|
374
|
+
* @example
|
|
375
|
+
* ```typescript
|
|
376
|
+
* const ply = Game.PlayerPed;
|
|
377
|
+
* const plyPos = ply.Position;
|
|
378
|
+
* const bag = await World.createProp(new Model('ba_prop_battle_bag_01b'), plyPos, true, true, true);
|
|
379
|
+
* bag.attachToBone(
|
|
380
|
+
* ply.Bones.getBone(64113),
|
|
381
|
+
* new Vector3(0.12, -0.25, 0.0),
|
|
382
|
+
* new Vector3(105.0, 50.0, 190.0)
|
|
383
|
+
* )
|
|
384
|
+
* const offset = bag.getRelativePositionOffset(plyPos);
|
|
385
|
+
* ```
|
|
386
|
+
* @param worldCoords: the offset given the world coords
|
|
387
|
+
* @returns the offset position from the entity in relative coords
|
|
388
|
+
*/
|
|
389
|
+
getRelativePositionOffset(offset) {
|
|
370
390
|
return Vector3.fromArray(GetOffsetFromEntityInWorldCoords(this.handle, offset.x, offset.y, offset.z));
|
|
371
391
|
}
|
|
392
|
+
/**
|
|
393
|
+
* @deprecated use [[getAbsolutePositionOffset]] instead
|
|
394
|
+
*/
|
|
372
395
|
getPositionOffset(worldCoords) {
|
|
373
|
-
return
|
|
396
|
+
return this.getAbsolutePositionOffset(worldCoords);
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* @deprecated use [[getRelativePositionOffset]]
|
|
400
|
+
*/
|
|
401
|
+
getOffsetPosition(offset) {
|
|
402
|
+
return this.getRelativePositionOffset(offset);
|
|
374
403
|
}
|
|
375
404
|
attachTo(entity, position, rotation, collisions = false, unk9 = true, useSoftPinning = true, rotationOrder = 1) {
|
|
376
405
|
if (this.handle == entity.Handle) {
|
|
@@ -2,8 +2,6 @@ import { EntityBone } from './';
|
|
|
2
2
|
import type { BaseEntity } from './BaseEntity';
|
|
3
3
|
export declare class EntityBoneCollection {
|
|
4
4
|
protected readonly owner: BaseEntity;
|
|
5
|
-
private readonly _collection;
|
|
6
|
-
private _currentIndex;
|
|
7
5
|
constructor(owner: BaseEntity);
|
|
8
6
|
hasBone(name: string): boolean;
|
|
9
7
|
getBone(boneIndex?: number, boneName?: string): EntityBone;
|
package/client/models/Ped.d.ts
CHANGED
|
@@ -9,11 +9,11 @@ import { BaseEntity } from './BaseEntity';
|
|
|
9
9
|
export declare class Ped extends BaseEntity {
|
|
10
10
|
static exists(ped: Ped): boolean;
|
|
11
11
|
static fromHandle(handle: number): Ped | null;
|
|
12
|
-
static fromNetworkId(networkId: number
|
|
12
|
+
static fromNetworkId(networkId: number): Ped | null;
|
|
13
13
|
protected type: ClassTypes;
|
|
14
|
-
private pedBones
|
|
15
|
-
private weapons
|
|
16
|
-
private readonly speechModifierNames;
|
|
14
|
+
private pedBones?;
|
|
15
|
+
private weapons?;
|
|
16
|
+
private static readonly speechModifierNames;
|
|
17
17
|
private tasks;
|
|
18
18
|
constructor(handle: number);
|
|
19
19
|
get Player(): Player;
|
|
@@ -107,7 +107,7 @@ export declare class Ped extends BaseEntity {
|
|
|
107
107
|
set DrivingStyle(style: DrivingStyle);
|
|
108
108
|
set IsDrunk(isDrunk: boolean);
|
|
109
109
|
set MotionBlur(value: boolean);
|
|
110
|
-
get Task(): Tasks
|
|
110
|
+
get Task(): Tasks;
|
|
111
111
|
get DeathCause(): number;
|
|
112
112
|
get TaskSequenceProgress(): number;
|
|
113
113
|
set BlockPermanentEvents(block: boolean);
|
|
@@ -157,7 +157,7 @@ export declare class Ped extends BaseEntity {
|
|
|
157
157
|
setConfigFlag(flagId: number, value: boolean): void;
|
|
158
158
|
resetConfigFlag(flagId: number): void;
|
|
159
159
|
clone(): Ped;
|
|
160
|
-
exists(
|
|
160
|
+
exists(): boolean;
|
|
161
161
|
isFacingPed(ped: Ped, angle?: number): boolean;
|
|
162
162
|
setComponentVariation(componentId: number, drawableId: number, textureId: number, paletteId?: number): void;
|
|
163
163
|
setRandomComponentVariation(): void;
|
package/client/models/Ped.js
CHANGED
|
@@ -12,54 +12,15 @@ export class Ped extends BaseEntity {
|
|
|
12
12
|
static fromHandle(handle) {
|
|
13
13
|
return new Ped(handle);
|
|
14
14
|
}
|
|
15
|
-
static fromNetworkId(networkId
|
|
16
|
-
if (
|
|
17
|
-
|
|
15
|
+
static fromNetworkId(networkId) {
|
|
16
|
+
if (!NetworkDoesEntityExistWithNetworkId(networkId)) {
|
|
17
|
+
return null;
|
|
18
18
|
}
|
|
19
19
|
return new Ped(NetworkGetEntityFromNetworkId(networkId));
|
|
20
20
|
}
|
|
21
21
|
constructor(handle) {
|
|
22
22
|
super(handle);
|
|
23
23
|
this.type = ClassTypes.Ped;
|
|
24
|
-
this.speechModifierNames = [
|
|
25
|
-
'SPEECH_PARAMS_STANDARD',
|
|
26
|
-
'SPEECH_PARAMS_ALLOW_REPEAT',
|
|
27
|
-
'SPEECH_PARAMS_BEAT',
|
|
28
|
-
'SPEECH_PARAMS_FORCE',
|
|
29
|
-
'SPEECH_PARAMS_FORCE_FRONTEND',
|
|
30
|
-
'SPEECH_PARAMS_FORCE_NO_REPEAT_FRONTEND',
|
|
31
|
-
'SPEECH_PARAMS_FORCE_NORMAL',
|
|
32
|
-
'SPEECH_PARAMS_FORCE_NORMAL_CLEAR',
|
|
33
|
-
'SPEECH_PARAMS_FORCE_NORMAL_CRITICAL',
|
|
34
|
-
'SPEECH_PARAMS_FORCE_SHOUTED',
|
|
35
|
-
'SPEECH_PARAMS_FORCE_SHOUTED_CLEAR',
|
|
36
|
-
'SPEECH_PARAMS_FORCE_SHOUTED_CRITICAL',
|
|
37
|
-
'SPEECH_PARAMS_FORCE_PRELOAD_ONLY',
|
|
38
|
-
'SPEECH_PARAMS_MEGAPHONE',
|
|
39
|
-
'SPEECH_PARAMS_HELI',
|
|
40
|
-
'SPEECH_PARAMS_FORCE_MEGAPHONE',
|
|
41
|
-
'SPEECH_PARAMS_FORCE_HELI',
|
|
42
|
-
'SPEECH_PARAMS_INTERRUPT',
|
|
43
|
-
'SPEECH_PARAMS_INTERRUPT_SHOUTED',
|
|
44
|
-
'SPEECH_PARAMS_INTERRUPT_SHOUTED_CLEAR',
|
|
45
|
-
'SPEECH_PARAMS_INTERRUPT_SHOUTED_CRITICAL',
|
|
46
|
-
'SPEECH_PARAMS_INTERRUPT_NO_FORCE',
|
|
47
|
-
'SPEECH_PARAMS_INTERRUPT_FRONTEND',
|
|
48
|
-
'SPEECH_PARAMS_INTERRUPT_NO_FORCE_FRONTEND',
|
|
49
|
-
'SPEECH_PARAMS_ADD_BLIP',
|
|
50
|
-
'SPEECH_PARAMS_ADD_BLIP_ALLOW_REPEAT',
|
|
51
|
-
'SPEECH_PARAMS_ADD_BLIP_FORCE',
|
|
52
|
-
'SPEECH_PARAMS_ADD_BLIP_SHOUTED',
|
|
53
|
-
'SPEECH_PARAMS_ADD_BLIP_SHOUTED_FORCE',
|
|
54
|
-
'SPEECH_PARAMS_ADD_BLIP_INTERRUPT',
|
|
55
|
-
'SPEECH_PARAMS_ADD_BLIP_INTERRUPT_FORCE',
|
|
56
|
-
'SPEECH_PARAMS_FORCE_PRELOAD_ONLY_SHOUTED',
|
|
57
|
-
'SPEECH_PARAMS_FORCE_PRELOAD_ONLY_SHOUTED_CLEAR',
|
|
58
|
-
'SPEECH_PARAMS_FORCE_PRELOAD_ONLY_SHOUTED_CRITICAL',
|
|
59
|
-
'SPEECH_PARAMS_SHOUTED',
|
|
60
|
-
'SPEECH_PARAMS_SHOUTED_CLEAR',
|
|
61
|
-
'SPEECH_PARAMS_SHOUTED_CRITICAL',
|
|
62
|
-
];
|
|
63
24
|
}
|
|
64
25
|
get Player() {
|
|
65
26
|
return new Player(NetworkGetPlayerIndexFromPed(this.handle));
|
|
@@ -441,12 +402,12 @@ export class Ped extends BaseEntity {
|
|
|
441
402
|
RemovePedFromGroup(this.handle);
|
|
442
403
|
}
|
|
443
404
|
playAmbientSpeed(speechName, voiceName = '', modifier = SpeechModifier.Standard) {
|
|
444
|
-
if (Number(modifier) >= 0 && Number(modifier) <
|
|
405
|
+
if (Number(modifier) >= 0 && Number(modifier) < Ped.speechModifierNames.length) {
|
|
445
406
|
if (voiceName === '') {
|
|
446
|
-
PlayAmbientSpeech1(this.handle, speechName,
|
|
407
|
+
PlayAmbientSpeech1(this.handle, speechName, Ped.speechModifierNames[Number(modifier)]);
|
|
447
408
|
}
|
|
448
409
|
else {
|
|
449
|
-
PlayAmbientSpeechWithVoice(this.handle, speechName, voiceName,
|
|
410
|
+
PlayAmbientSpeechWithVoice(this.handle, speechName, voiceName, Ped.speechModifierNames[Number(modifier)], false);
|
|
450
411
|
}
|
|
451
412
|
}
|
|
452
413
|
else {
|
|
@@ -533,11 +494,8 @@ export class Ped extends BaseEntity {
|
|
|
533
494
|
clone() {
|
|
534
495
|
return new Ped(ClonePed(this.handle, false, false, false));
|
|
535
496
|
}
|
|
536
|
-
exists(
|
|
537
|
-
|
|
538
|
-
return super.exists() && GetEntityType(this.handle) === 1;
|
|
539
|
-
}
|
|
540
|
-
return ped?.exists() ?? false;
|
|
497
|
+
exists() {
|
|
498
|
+
return super.exists() && GetEntityType(this.handle) === 1;
|
|
541
499
|
}
|
|
542
500
|
isFacingPed(ped, angle = 25.0) {
|
|
543
501
|
return IsPedFacingPed(this.handle, ped.Handle, angle);
|
|
@@ -683,3 +641,42 @@ export class Ped extends BaseEntity {
|
|
|
683
641
|
return HasPedHeadBlendFinished(this.handle);
|
|
684
642
|
}
|
|
685
643
|
}
|
|
644
|
+
Ped.speechModifierNames = [
|
|
645
|
+
'SPEECH_PARAMS_STANDARD',
|
|
646
|
+
'SPEECH_PARAMS_ALLOW_REPEAT',
|
|
647
|
+
'SPEECH_PARAMS_BEAT',
|
|
648
|
+
'SPEECH_PARAMS_FORCE',
|
|
649
|
+
'SPEECH_PARAMS_FORCE_FRONTEND',
|
|
650
|
+
'SPEECH_PARAMS_FORCE_NO_REPEAT_FRONTEND',
|
|
651
|
+
'SPEECH_PARAMS_FORCE_NORMAL',
|
|
652
|
+
'SPEECH_PARAMS_FORCE_NORMAL_CLEAR',
|
|
653
|
+
'SPEECH_PARAMS_FORCE_NORMAL_CRITICAL',
|
|
654
|
+
'SPEECH_PARAMS_FORCE_SHOUTED',
|
|
655
|
+
'SPEECH_PARAMS_FORCE_SHOUTED_CLEAR',
|
|
656
|
+
'SPEECH_PARAMS_FORCE_SHOUTED_CRITICAL',
|
|
657
|
+
'SPEECH_PARAMS_FORCE_PRELOAD_ONLY',
|
|
658
|
+
'SPEECH_PARAMS_MEGAPHONE',
|
|
659
|
+
'SPEECH_PARAMS_HELI',
|
|
660
|
+
'SPEECH_PARAMS_FORCE_MEGAPHONE',
|
|
661
|
+
'SPEECH_PARAMS_FORCE_HELI',
|
|
662
|
+
'SPEECH_PARAMS_INTERRUPT',
|
|
663
|
+
'SPEECH_PARAMS_INTERRUPT_SHOUTED',
|
|
664
|
+
'SPEECH_PARAMS_INTERRUPT_SHOUTED_CLEAR',
|
|
665
|
+
'SPEECH_PARAMS_INTERRUPT_SHOUTED_CRITICAL',
|
|
666
|
+
'SPEECH_PARAMS_INTERRUPT_NO_FORCE',
|
|
667
|
+
'SPEECH_PARAMS_INTERRUPT_FRONTEND',
|
|
668
|
+
'SPEECH_PARAMS_INTERRUPT_NO_FORCE_FRONTEND',
|
|
669
|
+
'SPEECH_PARAMS_ADD_BLIP',
|
|
670
|
+
'SPEECH_PARAMS_ADD_BLIP_ALLOW_REPEAT',
|
|
671
|
+
'SPEECH_PARAMS_ADD_BLIP_FORCE',
|
|
672
|
+
'SPEECH_PARAMS_ADD_BLIP_SHOUTED',
|
|
673
|
+
'SPEECH_PARAMS_ADD_BLIP_SHOUTED_FORCE',
|
|
674
|
+
'SPEECH_PARAMS_ADD_BLIP_INTERRUPT',
|
|
675
|
+
'SPEECH_PARAMS_ADD_BLIP_INTERRUPT_FORCE',
|
|
676
|
+
'SPEECH_PARAMS_FORCE_PRELOAD_ONLY_SHOUTED',
|
|
677
|
+
'SPEECH_PARAMS_FORCE_PRELOAD_ONLY_SHOUTED_CLEAR',
|
|
678
|
+
'SPEECH_PARAMS_FORCE_PRELOAD_ONLY_SHOUTED_CRITICAL',
|
|
679
|
+
'SPEECH_PARAMS_SHOUTED',
|
|
680
|
+
'SPEECH_PARAMS_SHOUTED_CLEAR',
|
|
681
|
+
'SPEECH_PARAMS_SHOUTED_CRITICAL',
|
|
682
|
+
];
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/// <reference types="@citizenfx/client" />
|
|
2
1
|
import { Model, Color } from '..';
|
|
3
2
|
import { StateBagChangeHandler } from '../cfx';
|
|
4
3
|
import { BaseEntity, Ped } from './';
|
|
5
4
|
export declare class Player {
|
|
6
5
|
private handle;
|
|
7
|
-
private ped
|
|
6
|
+
private ped?;
|
|
8
7
|
private pvp;
|
|
9
8
|
private stateBagCookies;
|
|
10
9
|
private source;
|
package/client/models/Prop.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { BaseEntity } from './BaseEntity';
|
|
|
3
3
|
export declare class Prop extends BaseEntity {
|
|
4
4
|
static exists(prop: Prop): boolean;
|
|
5
5
|
static fromHandle(handle: number): Prop | null;
|
|
6
|
-
static fromNetworkId(networkId: number
|
|
6
|
+
static fromNetworkId(networkId: number): Prop | null;
|
|
7
7
|
protected type: ClassTypes;
|
|
8
8
|
constructor(handle: number);
|
|
9
9
|
exists(): boolean;
|
package/client/models/Prop.js
CHANGED
|
@@ -7,9 +7,9 @@ export class Prop extends BaseEntity {
|
|
|
7
7
|
static fromHandle(handle) {
|
|
8
8
|
return new Prop(handle);
|
|
9
9
|
}
|
|
10
|
-
static fromNetworkId(networkId
|
|
11
|
-
if (
|
|
12
|
-
|
|
10
|
+
static fromNetworkId(networkId) {
|
|
11
|
+
if (!NetworkDoesEntityExistWithNetworkId(networkId)) {
|
|
12
|
+
return null;
|
|
13
13
|
}
|
|
14
14
|
return new Prop(NetworkGetEntityFromNetworkId(networkId));
|
|
15
15
|
}
|
|
@@ -11,10 +11,10 @@ export declare class Vehicle extends BaseEntity {
|
|
|
11
11
|
static exists(vehicle: Vehicle): boolean;
|
|
12
12
|
static fromHandle(handle: number): Vehicle | null;
|
|
13
13
|
static fromNetworkId(networkId: number): Vehicle | null;
|
|
14
|
-
private _doors
|
|
15
|
-
private _mods
|
|
16
|
-
private _wheels
|
|
17
|
-
private _windows
|
|
14
|
+
private _doors?;
|
|
15
|
+
private _mods?;
|
|
16
|
+
private _wheels?;
|
|
17
|
+
private _windows?;
|
|
18
18
|
protected type: ClassTypes;
|
|
19
19
|
constructor(handle: number);
|
|
20
20
|
exists(): boolean;
|
|
@@ -16,7 +16,7 @@ export declare class VehicleModCollection {
|
|
|
16
16
|
set WheelType(type: VehicleWheelType);
|
|
17
17
|
installModKit(): void;
|
|
18
18
|
get Livery(): number | undefined;
|
|
19
|
-
set Livery(value: number
|
|
19
|
+
set Livery(value: number);
|
|
20
20
|
get LiveryCount(): number;
|
|
21
21
|
get WindowTint(): VehicleWindowTint;
|
|
22
22
|
set WindowTint(tint: VehicleWindowTint);
|
|
@@ -44,6 +44,7 @@ export class VehicleModCollection {
|
|
|
44
44
|
installModKit() {
|
|
45
45
|
SetVehicleModKit(this._owner.Handle, 0);
|
|
46
46
|
}
|
|
47
|
+
// TODO: This should return always return a number
|
|
47
48
|
get Livery() {
|
|
48
49
|
const modCount = this.getMod(VehicleModType.Livery)?.ModCount;
|
|
49
50
|
if (modCount !== undefined && modCount > 0) {
|
|
@@ -52,8 +53,6 @@ export class VehicleModCollection {
|
|
|
52
53
|
return GetVehicleLivery(this._owner.Handle);
|
|
53
54
|
}
|
|
54
55
|
set Livery(value) {
|
|
55
|
-
if (value === undefined)
|
|
56
|
-
return;
|
|
57
56
|
const mod = this.getMod(VehicleModType.Livery);
|
|
58
57
|
if (mod !== undefined && mod.ModCount > 0) {
|
|
59
58
|
mod.Index = value;
|
|
@@ -5,8 +5,8 @@ export declare class VehicleWindowCollection {
|
|
|
5
5
|
private _owner;
|
|
6
6
|
private readonly _vehicleWindows;
|
|
7
7
|
constructor(owner: Vehicle);
|
|
8
|
-
getWindow(index: VehicleWindowIndex): VehicleWindow
|
|
9
|
-
getAllWindows(): (VehicleWindow | null
|
|
8
|
+
getWindow(index: VehicleWindowIndex): VehicleWindow;
|
|
9
|
+
getAllWindows(): (VehicleWindow | null)[];
|
|
10
10
|
get AreAllWindowsIntact(): boolean;
|
|
11
11
|
rollDownAllWindows(): void;
|
|
12
12
|
rollUpAllWindows(): void;
|
|
@@ -6,10 +6,13 @@ export class VehicleWindowCollection {
|
|
|
6
6
|
this._owner = owner;
|
|
7
7
|
}
|
|
8
8
|
getWindow(index) {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
let window = this._vehicleWindows.get(index);
|
|
10
|
+
if (!window) {
|
|
11
|
+
const vehicleWindow = new VehicleWindow(this._owner, index);
|
|
12
|
+
this._vehicleWindows.set(index, vehicleWindow);
|
|
13
|
+
return vehicleWindow;
|
|
11
14
|
}
|
|
12
|
-
return
|
|
15
|
+
return window;
|
|
13
16
|
}
|
|
14
17
|
getAllWindows() {
|
|
15
18
|
return Object.keys(VehicleWindowIndex)
|
|
@@ -37,8 +40,6 @@ export class VehicleWindowCollection {
|
|
|
37
40
|
});
|
|
38
41
|
}
|
|
39
42
|
hasWindow(window) {
|
|
40
|
-
if (this._owner.Bones === undefined)
|
|
41
|
-
return false;
|
|
42
43
|
switch (window) {
|
|
43
44
|
case VehicleWindowIndex.FrontLeftWindow:
|
|
44
45
|
return this._owner.Bones.hasBone('window_lf');
|
package/client/ui/Screen.js
CHANGED
|
@@ -47,7 +47,7 @@ export class Screen {
|
|
|
47
47
|
});
|
|
48
48
|
return new Notification(DrawNotification(blinking, true));
|
|
49
49
|
}
|
|
50
|
-
static showAdvancedNotification(message, title, subtitle, iconSet, icon, bgColor = HudColor.NONE, flashColor = Color.
|
|
50
|
+
static showAdvancedNotification(message, title, subtitle, iconSet, icon, bgColor = HudColor.NONE, flashColor = Color.Transparent, blinking = false, type = NotificationType.Default, showInBrief = true, sound = true) {
|
|
51
51
|
const strings = String.stringToArray(message);
|
|
52
52
|
SetNotificationTextEntry('CELL_EMAIL_BCON');
|
|
53
53
|
strings.forEach(element => {
|
|
@@ -56,7 +56,7 @@ export class Screen {
|
|
|
56
56
|
if (bgColor !== HudColor.NONE) {
|
|
57
57
|
SetNotificationBackgroundColor(Number(bgColor));
|
|
58
58
|
}
|
|
59
|
-
if (flashColor !== Color.
|
|
59
|
+
if (flashColor !== Color.Transparent && blinking) {
|
|
60
60
|
SetNotificationFlashColor(flashColor.r, flashColor.g, flashColor.b, flashColor.a);
|
|
61
61
|
}
|
|
62
62
|
if (sound) {
|
package/client/ui/Sprite.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Color, Point, Size } from '../utils';
|
|
2
2
|
import { Screen } from './';
|
|
3
3
|
export class Sprite {
|
|
4
|
-
constructor(textureDict, textureName, pos, size, heading = 0, color = Color.
|
|
4
|
+
constructor(textureDict, textureName, pos, size, heading = 0, color = Color.White) {
|
|
5
5
|
this._textureDict = textureDict;
|
|
6
6
|
this.textureName = textureName;
|
|
7
7
|
this.pos = pos || new Point();
|
|
8
8
|
this.size = size || new Size();
|
|
9
9
|
this.heading = heading || 0;
|
|
10
|
-
this.color = color || Color.
|
|
10
|
+
this.color = color || Color.White;
|
|
11
11
|
this.visible = true;
|
|
12
12
|
}
|
|
13
13
|
loadTextureDictionary() {
|
package/client/ui/Text.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Alignment, Font } from '../enums';
|
|
|
2
2
|
import { Color, Point, Size } from '../utils';
|
|
3
3
|
import { Screen } from './';
|
|
4
4
|
export class Text {
|
|
5
|
-
static draw(caption, pos, scale = 1, color = Color.
|
|
5
|
+
static draw(caption, pos, scale = 1, color = Color.White, font = Font.ChaletLondon, alignment = Alignment.Left, dropShadow = false, outline = false, wordWrap, resolution) {
|
|
6
6
|
resolution = resolution || new Size(Screen.ScaledWidth, Screen.Height);
|
|
7
7
|
const x = pos.X / resolution.width;
|
|
8
8
|
const y = pos.Y / resolution.height;
|
|
@@ -36,6 +36,7 @@ export class Text {
|
|
|
36
36
|
static addLongString(str) {
|
|
37
37
|
const strLen = 99;
|
|
38
38
|
for (let i = 0; i < str.length; i += strLen) {
|
|
39
|
+
// TODO: Fix deprecation warning
|
|
39
40
|
const substr = str.substr(i, Math.min(strLen, str.length - i));
|
|
40
41
|
AddTextComponentSubstringPlayerName(substr);
|
|
41
42
|
}
|
|
@@ -52,7 +53,7 @@ export class Text {
|
|
|
52
53
|
* @param outline
|
|
53
54
|
* @param wordWrap
|
|
54
55
|
*/
|
|
55
|
-
constructor(caption, pos, scale = 1, color = Color.
|
|
56
|
+
constructor(caption, pos, scale = 1, color = Color.White, font = Font.ChaletLondon, alignment = Alignment.Left, dropShadow = false, outline = false, wordWrap = new Size(500, 300)) {
|
|
56
57
|
this.caption = caption;
|
|
57
58
|
this.pos = pos;
|
|
58
59
|
this.scale = scale;
|
package/client/ui/Timerbar.js
CHANGED
|
@@ -87,7 +87,7 @@ export class Timerbar {
|
|
|
87
87
|
const safeZone = GetSafeZoneSize();
|
|
88
88
|
const safeZoneX = (1.0 - safeZone) * 0.5;
|
|
89
89
|
const safeZoneY = (1.0 - safeZone) * 0.5;
|
|
90
|
-
this.sprite = new Sprite('timerbars', 'all_black_bg', new Point(Screen.ScaledWidth * 0.918 - safeZoneX, Screen.Height * 0.984 - safeZoneY), new Size(Screen.ScaledWidth * 0.165, Screen.Height * 0.035), 0, new Color(
|
|
90
|
+
this.sprite = new Sprite('timerbars', 'all_black_bg', new Point(Screen.ScaledWidth * 0.918 - safeZoneX, Screen.Height * 0.984 - safeZoneY), new Size(Screen.ScaledWidth * 0.165, Screen.Height * 0.035), 0, new Color(255, 255, 255, 160));
|
|
91
91
|
if (!this.sprite.IsTextureDictionaryLoaded) {
|
|
92
92
|
this.sprite.loadTextureDictionary();
|
|
93
93
|
}
|
package/client/ui/menu/Menu.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export declare class Menu {
|
|
|
9
9
|
static screenResolution: Size;
|
|
10
10
|
readonly id: string;
|
|
11
11
|
visible: boolean;
|
|
12
|
-
parentMenu
|
|
13
|
-
parentItem
|
|
12
|
+
parentMenu?: Menu;
|
|
13
|
+
parentItem?: UIMenuItem;
|
|
14
14
|
items: UIMenuItem[];
|
|
15
15
|
children: Map<string, Menu>;
|
|
16
16
|
readonly menuOpen: LiteEvent;
|
package/client/ui/menu/Menu.js
CHANGED
|
@@ -38,26 +38,26 @@ export class Menu {
|
|
|
38
38
|
this._settings = new MenuSettings();
|
|
39
39
|
this._offset = offset;
|
|
40
40
|
// Create everything
|
|
41
|
-
this._mainMenu = new Container(new Point(), new Size(700, 500), Color.
|
|
41
|
+
this._mainMenu = new Container(new Point(), new Size(700, 500), Color.Transparent);
|
|
42
42
|
this._logo = new Sprite(spriteLibrary || '', spriteName || '', new Point(this._offset.X, this._offset.Y), new Size(431, 107));
|
|
43
43
|
this._mainMenu.addItem([
|
|
44
|
-
(this._title = new Text(title || '', new Point(431 / 2 + this._offset.X, 20 + this._offset.Y), 1.15, Color.
|
|
45
|
-
(this._subtitleResRectangle = new Rectangle(new Point(this._offset.X, 107 + this._offset.Y), new Size(431, 37), Color.
|
|
46
|
-
(this._subtitle = new Text(subtitle || '', new Point(8 + this._offset.X, 110 + this._offset.Y), 0.35, Color.
|
|
44
|
+
(this._title = new Text(title || '', new Point(431 / 2 + this._offset.X, 20 + this._offset.Y), 1.15, Color.White, 1, Alignment.Centered)),
|
|
45
|
+
(this._subtitleResRectangle = new Rectangle(new Point(this._offset.X, 107 + this._offset.Y), new Size(431, 37), Color.Black)),
|
|
46
|
+
(this._subtitle = new Text(subtitle || '', new Point(8 + this._offset.X, 110 + this._offset.Y), 0.35, Color.White, 0, Alignment.Left)),
|
|
47
47
|
]);
|
|
48
48
|
if (this._subtitle.caption.startsWith('~')) {
|
|
49
49
|
this._counterPretext = this._subtitle.caption.substr(0, 3);
|
|
50
50
|
}
|
|
51
|
-
this._counterText = new Text('', new Point(425 + this._offset.X, 110 + this._offset.Y), 0.35, Color.
|
|
51
|
+
this._counterText = new Text('', new Point(425 + this._offset.X, 110 + this._offset.Y), 0.35, Color.White, 0, Alignment.Right);
|
|
52
52
|
this._upAndDownSprite = new Sprite('commonmenu', 'shop_arrows_upanddown', new Point(), new Size(50, 50));
|
|
53
53
|
const extraRectanglePos = new Point(this._offset.X);
|
|
54
54
|
const extraRectangleSize = new Size(431, 18);
|
|
55
|
-
const extraRectangleColor = new Color(
|
|
55
|
+
const extraRectangleColor = new Color(0, 0, 0, 200);
|
|
56
56
|
this._extraRectangleUp = new Rectangle(extraRectanglePos, extraRectangleSize, extraRectangleColor);
|
|
57
57
|
this._extraRectangleDown = new Rectangle({ ...extraRectanglePos }, { ...extraRectangleSize }, { ...extraRectangleColor });
|
|
58
|
-
this._descriptionBar = new Rectangle(new Point(this._offset.X), new Size(431, 4), Color.
|
|
58
|
+
this._descriptionBar = new Rectangle(new Point(this._offset.X), new Size(431, 4), Color.Black);
|
|
59
59
|
this._descriptionRectangle = new Sprite('commonmenu', 'gradient_bgd', new Point(this._offset.X), new Size(431, 30));
|
|
60
|
-
this._descriptionText = new Text('Description', new Point(this._offset.X + 8), 0.35, Color.
|
|
60
|
+
this._descriptionText = new Text('Description', new Point(this._offset.X + 8), 0.35, Color.White, Font.ChaletLondon, Alignment.Left);
|
|
61
61
|
this._background = new Sprite('commonmenu', 'gradient_bgd', new Point(this._offset.X, 144 + this._offset.Y), new Size(290, 25));
|
|
62
62
|
setTick(() => {
|
|
63
63
|
this._render();
|
|
@@ -560,7 +560,7 @@ export class Menu {
|
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
else {
|
|
563
|
-
this._extraRectangleUp.color = new Color(
|
|
563
|
+
this._extraRectangleUp.color = new Color(0, 0, 0, 200);
|
|
564
564
|
}
|
|
565
565
|
if (this._mousePressed) {
|
|
566
566
|
return;
|
|
@@ -581,7 +581,7 @@ export class Menu {
|
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
else {
|
|
584
|
-
this._extraRectangleDown.color = new Color(
|
|
584
|
+
this._extraRectangleDown.color = new Color(0, 0, 0, 200);
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
587
|
_processControl() {
|
|
@@ -52,6 +52,6 @@ export class UIMenuCheckboxItem extends UIMenuItem {
|
|
|
52
52
|
return `shop_box_${name}${this.selected ? 'b' : ''}`;
|
|
53
53
|
}
|
|
54
54
|
_getSpriteColor() {
|
|
55
|
-
return this.enabled ? Color.
|
|
55
|
+
return this.enabled ? Color.White : Color.fromRgb(109, 109, 109);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -1004,10 +1004,10 @@ export class UIMenuItem {
|
|
|
1004
1004
|
case BadgeStyle.BrandRune:
|
|
1005
1005
|
return selected
|
|
1006
1006
|
? enabled
|
|
1007
|
-
? Color.
|
|
1007
|
+
? Color.Black
|
|
1008
1008
|
: Color.fromRgb(50, 50, 50)
|
|
1009
1009
|
: enabled
|
|
1010
|
-
? Color.
|
|
1010
|
+
? Color.White
|
|
1011
1011
|
: Color.fromRgb(109, 109, 109);
|
|
1012
1012
|
case BadgeStyle.GlobeBlue:
|
|
1013
1013
|
return enabled ? Color.fromRgb(10, 103, 166) : Color.fromRgb(11, 62, 117);
|
|
@@ -1020,7 +1020,7 @@ export class UIMenuItem {
|
|
|
1020
1020
|
case BadgeStyle.GlobeYellow:
|
|
1021
1021
|
return enabled ? Color.fromRgb(232, 207, 14) : Color.fromRgb(131, 133, 12);
|
|
1022
1022
|
default:
|
|
1023
|
-
return enabled ? Color.
|
|
1023
|
+
return enabled ? Color.White : Color.fromRgb(109, 109, 109);
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
1026
|
setVerticalPosition(y) {
|
|
@@ -1050,7 +1050,7 @@ export class UIMenuItem {
|
|
|
1050
1050
|
: this.hovered
|
|
1051
1051
|
? UIMenuItem.defaultHoveredForeColor
|
|
1052
1052
|
: this._foreColor
|
|
1053
|
-
: new Color(
|
|
1053
|
+
: new Color(163, 159, 148);
|
|
1054
1054
|
if (this.supportsLeftBadge && this._leftBadge !== BadgeStyle.None) {
|
|
1055
1055
|
const widthOffset = UIMenuItem.getBadgeSpriteWidthOffset(this.badgeLeft);
|
|
1056
1056
|
this.badgeLeft.pos.X = this.offset.X + widthOffset;
|
|
@@ -1082,9 +1082,9 @@ export class UIMenuItem {
|
|
|
1082
1082
|
this.text.draw(undefined, Menu.screenResolution);
|
|
1083
1083
|
}
|
|
1084
1084
|
}
|
|
1085
|
-
UIMenuItem.defaultBackColor = Color.
|
|
1086
|
-
UIMenuItem.defaultHighlightedBackColor = Color.
|
|
1087
|
-
UIMenuItem.defaultHoveredBackColor = new Color(
|
|
1088
|
-
UIMenuItem.defaultForeColor = Color.
|
|
1085
|
+
UIMenuItem.defaultBackColor = Color.Transparent;
|
|
1086
|
+
UIMenuItem.defaultHighlightedBackColor = Color.White;
|
|
1087
|
+
UIMenuItem.defaultHoveredBackColor = new Color(255, 255, 255, 25);
|
|
1088
|
+
UIMenuItem.defaultForeColor = Color.WhiteSmoke;
|
|
1089
1089
|
UIMenuItem.defaultHoveredForeColor = UIMenuItem.defaultForeColor;
|
|
1090
|
-
UIMenuItem.defaultHighlightedForeColor = Color.
|
|
1090
|
+
UIMenuItem.defaultHighlightedForeColor = Color.Black;
|
|
@@ -15,7 +15,7 @@ export class UIMenuListItem extends UIMenuItem {
|
|
|
15
15
|
this._textWidth = 0;
|
|
16
16
|
this._leftArrow = new Sprite('commonmenu', 'arrowleft', new Point(), new Size(30, 30));
|
|
17
17
|
this._rightArrow = new Sprite('commonmenu', 'arrowright', new Point(), new Size(30, 30));
|
|
18
|
-
this._itemText = new Text('', new Point(), 0.35, Color.
|
|
18
|
+
this._itemText = new Text('', new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Right);
|
|
19
19
|
this.ArrowOnlyOnSelected = arrowOnlyOnSelected;
|
|
20
20
|
this.Items = items;
|
|
21
21
|
this.Index = startIndex;
|
|
@@ -89,7 +89,7 @@ export class UIMenuListItem extends UIMenuItem {
|
|
|
89
89
|
? this.selected
|
|
90
90
|
? this.HighlightedForeColor
|
|
91
91
|
: this.ForeColor
|
|
92
|
-
: new Color(
|
|
92
|
+
: new Color(163, 159, 148);
|
|
93
93
|
if (this._arrowOnlyOnSelected && !this.selected) {
|
|
94
94
|
this._itemText.pos.X += this._rightArrow.size.width / 2;
|
|
95
95
|
}
|
|
@@ -15,9 +15,9 @@ export class UIMenuSliderItem extends UIMenuItem {
|
|
|
15
15
|
this._arrowOnlyOnSelected = false;
|
|
16
16
|
this._leftSliderBadge = BadgeStyle.None;
|
|
17
17
|
this._rightSliderBadge = BadgeStyle.None;
|
|
18
|
-
this._background = new Rectangle(new Point(), new Size(150, 9), new Color(
|
|
19
|
-
this._slider = new Rectangle(new Point(), new Size(75, 9), new Color(
|
|
20
|
-
this._divider = new Rectangle(new Point(), new Size(2.5, 20), Color.
|
|
18
|
+
this._background = new Rectangle(new Point(), new Size(150, 9), new Color(4, 32, 57));
|
|
19
|
+
this._slider = new Rectangle(new Point(), new Size(75, 9), new Color(57, 116, 200));
|
|
20
|
+
this._divider = new Rectangle(new Point(), new Size(2.5, 20), Color.WhiteSmoke);
|
|
21
21
|
this._leftArrow = new Sprite('commonmenutu', 'arrowleft', new Point(), new Size(15, 15));
|
|
22
22
|
this._rightArrow = new Sprite('commonmenutu', 'arrowright', new Point(), new Size(15, 15));
|
|
23
23
|
this._leftSliderBadgeSprite = new Sprite('', '');
|
|
@@ -58,19 +58,19 @@ export class UIMenuSliderItem extends UIMenuItem {
|
|
|
58
58
|
return this._background.color;
|
|
59
59
|
}
|
|
60
60
|
set BackgroundColor(value) {
|
|
61
|
-
this._background.color = value || new Color(
|
|
61
|
+
this._background.color = value || new Color(4, 32, 57);
|
|
62
62
|
}
|
|
63
63
|
get SliderColor() {
|
|
64
64
|
return this._slider.color;
|
|
65
65
|
}
|
|
66
66
|
set SliderColor(value) {
|
|
67
|
-
this._slider.color = value || new Color(
|
|
67
|
+
this._slider.color = value || new Color(57, 116, 200);
|
|
68
68
|
}
|
|
69
69
|
get DividerColor() {
|
|
70
70
|
return this._divider.color;
|
|
71
71
|
}
|
|
72
72
|
set DividerColor(value) {
|
|
73
|
-
this._divider.color = value || Color.
|
|
73
|
+
this._divider.color = value || Color.WhiteSmoke;
|
|
74
74
|
}
|
|
75
75
|
get LeftSliderBadge() {
|
|
76
76
|
return this._leftSliderBadge;
|
|
@@ -153,9 +153,9 @@ export class UIMenuSliderItem extends UIMenuItem {
|
|
|
153
153
|
this._slider.pos.X = this._background.pos.X + sliderXOffset;
|
|
154
154
|
this._leftArrow.color = this.enabled
|
|
155
155
|
? this.selected
|
|
156
|
-
? Color.
|
|
157
|
-
: Color.
|
|
158
|
-
: new Color(
|
|
156
|
+
? Color.Black
|
|
157
|
+
: Color.WhiteSmoke
|
|
158
|
+
: new Color(163, 159, 148);
|
|
159
159
|
this._rightArrow.color = this._leftArrow.color;
|
|
160
160
|
this._background.draw(undefined, Menu.screenResolution);
|
|
161
161
|
this._slider.draw(undefined, Menu.screenResolution);
|
|
@@ -3,9 +3,9 @@ import { Rectangle, Sprite } from '../../../';
|
|
|
3
3
|
import { Menu } from '../../';
|
|
4
4
|
export declare abstract class AbstractUIMenuPanel {
|
|
5
5
|
readonly id: string;
|
|
6
|
-
protected parentItem
|
|
6
|
+
protected parentItem?: UIMenuItem;
|
|
7
7
|
protected enabled: boolean;
|
|
8
|
-
protected readonly background
|
|
8
|
+
protected readonly background?: Sprite | Rectangle;
|
|
9
9
|
get ParentMenu(): Menu | undefined;
|
|
10
10
|
get ParentItem(): UIMenuItem | undefined;
|
|
11
11
|
set ParentItem(value: UIMenuItem | undefined);
|
|
@@ -9,7 +9,7 @@ export class UIMenuColorPanel extends AbstractUIMenuPanel {
|
|
|
9
9
|
this._title = '';
|
|
10
10
|
this._colors = [];
|
|
11
11
|
this._bar = [];
|
|
12
|
-
this._lastColor = Color.
|
|
12
|
+
this._lastColor = Color.Transparent;
|
|
13
13
|
// Pagination
|
|
14
14
|
this._min = 0;
|
|
15
15
|
this._max = 8;
|
|
@@ -18,8 +18,8 @@ export class UIMenuColorPanel extends AbstractUIMenuPanel {
|
|
|
18
18
|
this.background = new Sprite('commonmenu', 'gradient_bgd', new Point(), new Size(431, 112));
|
|
19
19
|
this._leftArrow = new Sprite('commonmenu', 'arrowleft', new Point(), new Size(30, 30));
|
|
20
20
|
this._rightArrow = new Sprite('commonmenu', 'arrowright', new Point(), new Size(30, 30));
|
|
21
|
-
this._selectedRectangle = new Rectangle(new Point(), new Size(44.5, 8), Color.
|
|
22
|
-
this._text = new Text('', new Point(), 0.35, Color.
|
|
21
|
+
this._selectedRectangle = new Rectangle(new Point(), new Size(44.5, 8), Color.White);
|
|
22
|
+
this._text = new Text('', new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Centered);
|
|
23
23
|
this.Title = title;
|
|
24
24
|
this.Colors = colors;
|
|
25
25
|
}
|
|
@@ -7,10 +7,10 @@ export declare class UIMenuGridPanel extends AbstractUIMenuPanel {
|
|
|
7
7
|
private _pressed;
|
|
8
8
|
private _lockXAxis;
|
|
9
9
|
private _lockYAxis;
|
|
10
|
-
private _topText
|
|
11
|
-
private _leftText
|
|
12
|
-
private _rightText
|
|
13
|
-
private _bottomText
|
|
10
|
+
private _topText?;
|
|
11
|
+
private _leftText?;
|
|
12
|
+
private _rightText?;
|
|
13
|
+
private _bottomText?;
|
|
14
14
|
private _lastCirclePosition;
|
|
15
15
|
private readonly _grid;
|
|
16
16
|
private readonly _circle;
|
|
@@ -160,7 +160,7 @@ export class UIMenuGridPanel extends AbstractUIMenuPanel {
|
|
|
160
160
|
// @ts-ignore
|
|
161
161
|
if (!this[name]) {
|
|
162
162
|
// @ts-ignore
|
|
163
|
-
this[name] = new Text(value, new Point(), 0.35, Color.
|
|
163
|
+
this[name] = new Text(value, new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Centered);
|
|
164
164
|
}
|
|
165
165
|
else {
|
|
166
166
|
// @ts-ignore
|
|
@@ -11,9 +11,9 @@ export class UIMenuPercentagePanel extends AbstractUIMenuPanel {
|
|
|
11
11
|
const barSize = new Size(413, 10);
|
|
12
12
|
this._activeBar = new Rectangle(new Point(), barSize, Color.fromRgb(245, 245, 245));
|
|
13
13
|
this._backgroundBar = new Rectangle(new Point(), { ...barSize }, Color.fromRgb(87, 87, 87));
|
|
14
|
-
this._title = new Text('', new Point(), 0.35, Color.
|
|
15
|
-
this._minText = new Text('', new Point(), 0.35, Color.
|
|
16
|
-
this._maxText = new Text('', new Point(), 0.35, Color.
|
|
14
|
+
this._title = new Text('', new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Centered);
|
|
15
|
+
this._minText = new Text('', new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Centered);
|
|
16
|
+
this._maxText = new Text('', new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Centered);
|
|
17
17
|
this.Title = title;
|
|
18
18
|
this.MinText = minText || '0%';
|
|
19
19
|
this.MaxText = maxText || '100%';
|
|
@@ -6,7 +6,7 @@ export class UIMenuStatisticsPanel extends AbstractUIMenuPanel {
|
|
|
6
6
|
super();
|
|
7
7
|
this._divider = true;
|
|
8
8
|
this._items = [];
|
|
9
|
-
this.background = new Rectangle(new Point(), new Size(431, 47), new Color(
|
|
9
|
+
this.background = new Rectangle(new Point(), new Size(431, 47), new Color(0, 0, 0, 170));
|
|
10
10
|
if (item) {
|
|
11
11
|
this.addItem(item);
|
|
12
12
|
}
|
|
@@ -5,11 +5,11 @@ export class UIMenuStatisticsPanelItem {
|
|
|
5
5
|
constructor(name, percentage = 0) {
|
|
6
6
|
this.id = Crypto.uuidv4();
|
|
7
7
|
this.divider = [];
|
|
8
|
-
this.text = new Text('', new Point(), 0.35, Color.
|
|
8
|
+
this.text = new Text('', new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Left);
|
|
9
9
|
this.backgroundBar = new Rectangle(new Point(), new Size(200, 10), Color.fromArgb(100, 87, 87, 87));
|
|
10
|
-
this.activeBar = new Rectangle(new Point(), new Size(0, 10), Color.
|
|
10
|
+
this.activeBar = new Rectangle(new Point(), new Size(0, 10), Color.White);
|
|
11
11
|
for (let i = 1; i <= 4; i++) {
|
|
12
|
-
this.divider.push(new Rectangle(new Point(), new Size(2, 10), Color.
|
|
12
|
+
this.divider.push(new Rectangle(new Point(), new Size(2, 10), Color.Black));
|
|
13
13
|
}
|
|
14
14
|
this.Name = name;
|
|
15
15
|
this.Percentage = percentage;
|
package/client/utils/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export { PointF } from './PointF';
|
|
|
4
4
|
export { Crypto } from './Crypto';
|
|
5
5
|
export { Point } from './Point';
|
|
6
6
|
export { Size } from './Size';
|
|
7
|
-
export { Color } from '
|
|
8
|
-
export { Vector2, Vector3, Vector4, Maths, Quaternion, Delay, enumValues, getStringFromUInt8Array, getUInt32FromUint8Array, } from '../../common/utils/index';
|
|
7
|
+
export { Vector2, Vector3, Vector4, Maths, Color, Quaternion, Delay, enumValues, getStringFromUInt8Array, getUInt32FromUint8Array, } from '../../common/utils/index';
|
|
9
8
|
export declare const Wait: (milliseconds: number) => Promise<void>;
|
|
10
9
|
export * from './Animations';
|
package/client/utils/index.js
CHANGED
|
@@ -4,7 +4,6 @@ export { PointF } from './PointF';
|
|
|
4
4
|
export { Crypto } from './Crypto';
|
|
5
5
|
export { Point } from './Point';
|
|
6
6
|
export { Size } from './Size';
|
|
7
|
-
export { Color } from '
|
|
8
|
-
export { Vector2, Vector3, Vector4, Maths, Quaternion, Delay, enumValues, getStringFromUInt8Array, getUInt32FromUint8Array, } from '../../common/utils/index';
|
|
7
|
+
export { Vector2, Vector3, Vector4, Maths, Color, Quaternion, Delay, enumValues, getStringFromUInt8Array, getUInt32FromUint8Array, } from '../../common/utils/index';
|
|
9
8
|
export const Wait = (milliseconds) => new Promise(resolve => setTimeout(resolve, milliseconds));
|
|
10
9
|
export * from './Animations';
|
package/common/types.d.ts
CHANGED
package/common/utils/Color.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export declare class Color {
|
|
2
|
+
static Transparent: Color;
|
|
3
|
+
static Black: Color;
|
|
4
|
+
static White: Color;
|
|
5
|
+
static WhiteSmoke: Color;
|
|
2
6
|
static fromArgb(a: number, r: number, g: number, b: number): Color;
|
|
3
7
|
static fromRgb(r: number, g: number, b: number): Color;
|
|
4
8
|
static fromArray(primitive: [number, number, number] | number[]): Color;
|
package/common/utils/Color.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export class Color {
|
|
2
2
|
static fromArgb(a, r, g, b) {
|
|
3
|
-
return new Color(
|
|
3
|
+
return new Color(r, g, b, a);
|
|
4
4
|
}
|
|
5
5
|
static fromRgb(r, g, b) {
|
|
6
|
-
return new Color(
|
|
6
|
+
return new Color(r, g, b);
|
|
7
7
|
}
|
|
8
8
|
static fromArray(primitive) {
|
|
9
9
|
return new Color(primitive[0], primitive[1], primitive[2], 255);
|
|
@@ -15,3 +15,7 @@ export class Color {
|
|
|
15
15
|
this.a = a;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
Color.Transparent = new Color(0, 0, 0, 0);
|
|
19
|
+
Color.Black = new Color(0, 0, 0);
|
|
20
|
+
Color.White = new Color(255, 255, 255);
|
|
21
|
+
Color.WhiteSmoke = new Color(245, 245, 245);
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"author": "Remco Troost <d0p3t>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "0.0.
|
|
7
|
+
"version": "0.0.31",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"directory": "lib"
|
|
10
10
|
},
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"./**/*.d.ts"
|
|
34
34
|
],
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@citizenfx/client": "2.0.7604-1",
|
|
37
|
-
"@citizenfx/server": "2.0.7604-1",
|
|
38
|
-
"@types/node": "^16.18.
|
|
36
|
+
"@citizenfx/client": "^2.0.7604-1",
|
|
37
|
+
"@citizenfx/server": "^2.0.7604-1",
|
|
38
|
+
"@types/node": "^16.18.103",
|
|
39
39
|
"buffer": "^6.0.3",
|
|
40
|
-
"prettier": "^
|
|
40
|
+
"prettier": "^3.3.3",
|
|
41
41
|
"prettier-linter-helpers": "^1.0.0",
|
|
42
42
|
"tsc-alias": "^1.8.10",
|
|
43
|
-
"typedoc": "^0.
|
|
43
|
+
"typedoc": "^0.26.5",
|
|
44
44
|
"typedoc-fivemjs-theme": "^0.2.7",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
45
|
+
"typedoc-plugin-markdown": "^4.2.1",
|
|
46
|
+
"typescript": "^5.5.3"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"delete": "rm -rf lib",
|
package/server/cfx/index.d.ts
CHANGED
package/client/utils/Color.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare class Color {
|
|
2
|
-
static empty: Color;
|
|
3
|
-
static transparent: Color;
|
|
4
|
-
static black: Color;
|
|
5
|
-
static white: Color;
|
|
6
|
-
static whiteSmoke: Color;
|
|
7
|
-
static fromArgb(a: number, r: number, g: number, b: number): Color;
|
|
8
|
-
static fromRgb(r: number, g: number, b: number): Color;
|
|
9
|
-
static fromArray(primitive: [number, number, number] | number[]): Color;
|
|
10
|
-
a: number;
|
|
11
|
-
r: number;
|
|
12
|
-
g: number;
|
|
13
|
-
b: number;
|
|
14
|
-
constructor(a: number | undefined, r: number, g: number, b: number);
|
|
15
|
-
}
|
package/client/utils/Color.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export class Color {
|
|
2
|
-
static fromArgb(a, r, g, b) {
|
|
3
|
-
return new Color(a, r, g, b);
|
|
4
|
-
}
|
|
5
|
-
static fromRgb(r, g, b) {
|
|
6
|
-
return new Color(255, r, g, b);
|
|
7
|
-
}
|
|
8
|
-
static fromArray(primitive) {
|
|
9
|
-
return new Color(255, primitive[0], primitive[1], primitive[2]);
|
|
10
|
-
}
|
|
11
|
-
constructor(a = 255, r, g, b) {
|
|
12
|
-
this.a = a;
|
|
13
|
-
this.r = r;
|
|
14
|
-
this.g = g;
|
|
15
|
-
this.b = b;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
Color.empty = new Color(0, 0, 0, 0);
|
|
19
|
-
Color.transparent = new Color(0, 0, 0, 0);
|
|
20
|
-
Color.black = new Color(255, 0, 0, 0);
|
|
21
|
-
Color.white = new Color(255, 255, 255, 255);
|
|
22
|
-
Color.whiteSmoke = new Color(255, 245, 245, 245);
|