@nativewrappers/fivem 0.0.80 → 0.0.82
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/Audio.d.ts +2 -2
- package/Audio.js +99 -0
- package/Blip.d.ts +4 -3
- package/Blip.js +113 -0
- package/Camera.d.ts +3 -3
- package/Camera.js +190 -0
- package/Checkpoint.d.ts +2 -2
- package/Checkpoint.js +51 -0
- package/Events.js +80 -0
- package/Game.d.ts +10 -3
- package/Game.js +478 -0
- package/GameplayCamera.d.ts +2 -2
- package/GameplayCamera.js +152 -0
- package/Model.js +210 -0
- package/NetworkedScene.d.ts +2 -1
- package/NetworkedScene.js +50 -0
- package/ParticleEffect.d.ts +4 -3
- package/ParticleEffect.js +128 -0
- package/ParticleEffectAsset.d.ts +2 -2
- package/ParticleEffectAsset.js +133 -0
- package/Pickup.d.ts +1 -1
- package/Pickup.js +27 -0
- package/Raycast.d.ts +5 -3
- package/Raycast.js +132 -0
- package/RelationshipGroup.d.ts +1 -1
- package/RelationshipGroup.js +72 -0
- package/Rope.d.ts +1 -1
- package/Rope.js +149 -0
- package/TaskSequence.js +52 -0
- package/Tasks.d.ts +8 -3
- package/Tasks.js +334 -0
- package/World.d.ts +13 -4
- package/World.js +945 -0
- package/cfx/StateBagChangeHandler.js +0 -0
- package/cfx/index.d.ts +1 -1
- package/cfx/index.js +4 -0
- package/common/Command.js +111 -0
- package/common/Convar.js +58 -0
- package/common/GlobalData.js +16 -0
- package/common/Kvp.js +137 -0
- package/common/Resource.js +54 -0
- package/common/decors/Events.js +170 -0
- package/common/net/NetworkedMap.js +225 -0
- package/common/types.js +0 -0
- package/common/utils/ClassTypes.js +15 -0
- package/common/utils/Color.js +33 -0
- package/common/utils/Delay.d.ts +1 -0
- package/common/utils/Delay.js +6 -0
- package/common/utils/Maths.js +18 -0
- package/common/utils/Point.d.ts +9 -0
- package/common/utils/Point.js +36 -0
- package/common/utils/PointF.d.ts +1 -1
- package/common/utils/PointF.js +18 -0
- package/common/utils/Quaternion.d.ts +1 -1
- package/common/utils/Quaternion.js +33 -0
- package/common/utils/Vector.js +589 -0
- package/common/utils/cleanPlayerName.js +17 -0
- package/common/utils/enumValues.js +20 -0
- package/common/utils/getStringFromUInt8Array.js +6 -0
- package/common/utils/getUInt32FromUint8Array.js +6 -0
- package/enums/Alignment.js +9 -0
- package/enums/AnimationFlags.js +38 -0
- package/enums/AudioFlag.js +41 -0
- package/enums/BadgeStyle.js +186 -0
- package/enums/Blip.js +229 -0
- package/enums/Bone.js +105 -0
- package/enums/CameraShake.js +17 -0
- package/enums/CameraTypes.js +11 -0
- package/enums/CheckboxStyle.js +8 -0
- package/enums/Checkpoint.js +68 -0
- package/enums/CloudHat.js +27 -0
- package/enums/Control.js +364 -0
- package/enums/CursorSprite.js +18 -0
- package/enums/Driving.js +38 -0
- package/enums/ExplosionType.js +45 -0
- package/enums/FiringPattern.js +23 -0
- package/enums/Font.js +11 -0
- package/enums/ForceType.js +12 -0
- package/enums/Gender.js +8 -0
- package/enums/HelmetType.js +9 -0
- package/enums/HudColor.js +187 -0
- package/enums/HudComponent.js +57 -0
- package/enums/InputMode.js +8 -0
- package/enums/InvertAxis.js +10 -0
- package/enums/Language.js +18 -0
- package/enums/LeaveVehicleFlags.js +14 -0
- package/enums/LoadingSpinnerType.js +11 -0
- package/enums/MarkerType.js +48 -0
- package/enums/MenuAlignment.js +8 -0
- package/enums/NotificationType.js +14 -0
- package/enums/Parachute.js +19 -0
- package/enums/PickupType.js +77 -0
- package/enums/RadioStation.js +28 -0
- package/enums/RagdollType.js +10 -0
- package/enums/RaycastEnums.js +33 -0
- package/enums/Relationship.js +13 -0
- package/enums/RopeType.js +9 -0
- package/enums/ScreenEffect.js +87 -0
- package/enums/SpeechModifier.js +43 -0
- package/enums/Vehicle.js +396 -0
- package/enums/Weather.js +22 -0
- package/enums/ZoneID.js +95 -0
- package/hashes/MaterialHash.js +220 -0
- package/hashes/PedHash.js +728 -0
- package/hashes/VehicleHash.js +526 -0
- package/hashes/WeaponHash.js +155 -0
- package/hashes/WeatherTypeHash.js +22 -0
- package/index.js +166 -18794
- package/interfaces/Dimensions.d.ts +1 -1
- package/interfaces/Dimensions.js +0 -0
- package/models/BaseEntity.d.ts +10 -8
- package/models/BaseEntity.js +576 -0
- package/models/Entity.d.ts +0 -1
- package/models/Entity.js +0 -0
- package/models/EntityBone.d.ts +1 -1
- package/models/EntityBone.js +32 -0
- package/models/EntityBoneCollection.d.ts +1 -1
- package/models/EntityBoneCollection.js +27 -0
- package/models/Ped.d.ts +13 -5
- package/models/Ped.js +711 -0
- package/models/PedBone.d.ts +3 -2
- package/models/PedBone.js +18 -0
- package/models/PedBoneCollection.d.ts +3 -1
- package/models/PedBoneCollection.js +31 -0
- package/models/Player.d.ts +4 -2
- package/models/Player.js +188 -0
- package/models/Prop.d.ts +1 -1
- package/models/Prop.js +34 -0
- package/models/Vehicle.d.ts +9 -4
- package/models/Vehicle.js +582 -0
- package/models/VehicleDoor.d.ts +1 -1
- package/models/VehicleDoor.js +52 -0
- package/models/VehicleDoorCollection.d.ts +1 -1
- package/models/VehicleDoorCollection.js +66 -0
- package/models/VehicleMod.d.ts +1 -1
- package/models/VehicleMod.js +43 -0
- package/models/VehicleModCollection.d.ts +2 -2
- package/models/VehicleModCollection.js +227 -0
- package/models/VehicleToggleMod.d.ts +1 -1
- package/models/VehicleToggleMod.js +37 -0
- package/models/VehicleWheel.js +31 -0
- package/models/VehicleWheelCollection.d.ts +1 -1
- package/models/VehicleWheelCollection.js +61 -0
- package/models/VehicleWindow.d.ts +1 -1
- package/models/VehicleWindow.js +43 -0
- package/models/VehicleWindowCollection.d.ts +1 -1
- package/models/VehicleWindowCollection.js +62 -0
- package/package.json +2 -2
- package/ui/Container.d.ts +4 -2
- package/ui/Container.js +39 -0
- package/ui/Effects.d.ts +1 -1
- package/ui/Effects.js +112 -0
- package/ui/Fading.js +74 -0
- package/ui/Hud.d.ts +3 -2
- package/ui/Hud.js +47 -0
- package/ui/InstructionalButtons.js +42 -0
- package/ui/LoadingPrompt.d.ts +1 -1
- package/ui/LoadingPrompt.js +37 -0
- package/ui/Notification.js +17 -0
- package/ui/Rectangle.d.ts +4 -2
- package/ui/Rectangle.js +46 -0
- package/ui/Scaleform.d.ts +2 -1
- package/ui/Scaleform.js +240 -0
- package/ui/Screen.d.ts +6 -3
- package/ui/Screen.js +83 -0
- package/ui/Sprite.d.ts +3 -1
- package/ui/Sprite.js +70 -0
- package/ui/Text.d.ts +6 -3
- package/ui/Text.js +119 -0
- package/ui/Timerbar.js +241 -0
- package/ui/interfaces/IButton.d.ts +1 -1
- package/ui/interfaces/IButton.js +0 -0
- package/ui/interfaces/IDrawable.d.ts +3 -1
- package/ui/interfaces/IDrawable.js +0 -0
- package/ui/menu/Menu.d.ts +9 -4
- package/ui/menu/Menu.js +830 -0
- package/ui/menu/MenuControl.js +20 -0
- package/ui/menu/MenuControls.js +17 -0
- package/ui/menu/MenuSettings.d.ts +1 -1
- package/ui/menu/MenuSettings.js +57 -0
- package/ui/menu/items/UIMenuCheckboxItem.d.ts +3 -3
- package/ui/menu/items/UIMenuCheckboxItem.js +70 -0
- package/ui/menu/items/UIMenuItem.d.ts +10 -4
- package/ui/menu/items/UIMenuItem.js +1103 -0
- package/ui/menu/items/UIMenuListItem.d.ts +3 -3
- package/ui/menu/items/UIMenuListItem.js +118 -0
- package/ui/menu/items/UIMenuSeparatorItem.d.ts +1 -1
- package/ui/menu/items/UIMenuSeparatorItem.js +37 -0
- package/ui/menu/items/UIMenuSliderItem.d.ts +4 -3
- package/ui/menu/items/UIMenuSliderItem.js +180 -0
- package/ui/menu/items/panels/AbstractUIMenuPanel.d.ts +4 -3
- package/ui/menu/items/panels/AbstractUIMenuPanel.js +49 -0
- package/ui/menu/items/panels/UIMenuColorPanel.d.ts +3 -3
- package/ui/menu/items/panels/UIMenuColorPanel.js +215 -0
- package/ui/menu/items/panels/UIMenuGridPanel.d.ts +3 -3
- package/ui/menu/items/panels/UIMenuGridPanel.js +216 -0
- package/ui/menu/items/panels/UIMenuPercentagePanel.d.ts +2 -2
- package/ui/menu/items/panels/UIMenuPercentagePanel.js +138 -0
- package/ui/menu/items/panels/UIMenuStatisticsPanel.d.ts +3 -2
- package/ui/menu/items/panels/UIMenuStatisticsPanel.js +88 -0
- package/ui/menu/items/panels/UIMenuStatisticsPanelItem.d.ts +2 -1
- package/ui/menu/items/panels/UIMenuStatisticsPanelItem.js +48 -0
- package/ui/menu/modules/ListItem.js +18 -0
- package/utils/Animations.js +43 -0
- package/utils/Crypto.js +33 -0
- package/utils/LiteEvent.js +25 -0
- package/utils/Maths.js +18 -0
- package/utils/Point.js +36 -0
- package/utils/Size.js +16 -0
- package/utils/String.d.ts +1 -1
- package/utils/String.js +35 -0
- package/weapon/DlcWeaponData.d.ts +1 -1
- package/weapon/DlcWeaponData.js +40 -0
- package/weapon/Mk2WeaponHash.js +18 -0
- package/weapon/Weapon.d.ts +7 -7
- package/weapon/Weapon.js +276 -0
- package/weapon/WeaponAsset.d.ts +1 -1
- package/weapon/WeaponAsset.js +87 -0
- package/weapon/WeaponCollection.d.ts +3 -2
- package/weapon/WeaponCollection.js +179 -0
- package/weapon/WeaponDisplayNameByHash.d.ts +1 -1
- package/weapon/WeaponDisplayNameByHash.js +73 -0
- package/weapon/WeaponGroup.js +22 -0
- package/weapon/WeaponHudStats.d.ts +1 -1
- package/weapon/WeaponHudStats.js +33 -0
- package/weapon/WeaponLivery.js +17 -0
- package/weapon/WeaponLiveryColor.js +38 -0
- package/weapon/WeaponTint.js +46 -0
- package/weaponComponent/ComponentAttachmentPoint.js +22 -0
- package/weaponComponent/ComponentAttachmentPointByHash.js +307 -0
- package/weaponComponent/ComponentDisplayNameByHash.js +278 -0
- package/weaponComponent/DlcWeaponComponentData.js +40 -0
- package/weaponComponent/InvalidWeaponComponent.d.ts +1 -1
- package/weaponComponent/InvalidWeaponComponent.js +31 -0
- package/weaponComponent/WeaponComponent.d.ts +4 -4
- package/weaponComponent/WeaponComponent.js +124 -0
- package/weaponComponent/WeaponComponentCollection.d.ts +2 -2
- package/weaponComponent/WeaponComponentCollection.js +187 -0
- package/weaponComponent/WeaponComponentHash.js +670 -0
- package/weaponComponent/WeaponComponentHashesByWeaponHash.d.ts +1 -1
- package/weaponComponent/WeaponComponentHashesByWeaponHash.js +864 -0
- package/weaponComponent/WeaponComponentHudStats.js +33 -0
- package/common/index.d.ts +0 -8
- package/common/utils/Vector2.d.ts +0 -1
- package/common/utils/Vector3.d.ts +0 -1
- package/common/utils/Vector4.d.ts +0 -1
- package/common/utils/index.d.ts +0 -12
- package/enums/index.d.ts +0 -42
- package/hashes/index.d.ts +0 -5
- package/index.d.ts +0 -25
- package/models/index.d.ts +0 -18
- package/ui/index.d.ts +0 -15
- package/ui/interfaces/index.d.ts +0 -2
- package/ui/menu/index.d.ts +0 -6
- package/ui/menu/items/index.d.ts +0 -6
- package/ui/menu/items/panels/index.d.ts +0 -6
- package/ui/menu/modules/index.d.ts +0 -1
- package/utils/PointF.d.ts +0 -7
- package/utils/Quaternion.d.ts +0 -10
- package/utils/enumValues.d.ts +0 -12
- package/utils/getStringFromUInt8Array.d.ts +0 -8
- package/utils/getUInt32FromUint8Array.d.ts +0 -8
- package/utils/index.d.ts +0 -9
- package/weapon/index.d.ts +0 -8
- package/weaponComponent/index.d.ts +0 -5
package/ui/Effects.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
class Effects {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "Effects");
|
|
6
|
+
}
|
|
7
|
+
static start(effectName, duration = 0, looped = false) {
|
|
8
|
+
StartScreenEffect(Effects.effectToString(effectName), duration, looped);
|
|
9
|
+
}
|
|
10
|
+
static stop(screenEffect) {
|
|
11
|
+
if (typeof screenEffect === "undefined") {
|
|
12
|
+
return StopAllScreenEffects();
|
|
13
|
+
}
|
|
14
|
+
StopScreenEffect(Effects.effectToString(screenEffect));
|
|
15
|
+
}
|
|
16
|
+
static isActive(screenEffect) {
|
|
17
|
+
return GetScreenEffectIsActive(Effects.effectToString(screenEffect));
|
|
18
|
+
}
|
|
19
|
+
static effects = [
|
|
20
|
+
"SwitchHUDIn",
|
|
21
|
+
"SwitchHUDOut",
|
|
22
|
+
"FocusIn",
|
|
23
|
+
"FocusOut",
|
|
24
|
+
"MinigameEndNeutral",
|
|
25
|
+
"MinigameEndTrevor",
|
|
26
|
+
"MinigameEndFranklin",
|
|
27
|
+
"MinigameEndMichael",
|
|
28
|
+
"MinigameTransitionOut",
|
|
29
|
+
"MinigameTransitionIn",
|
|
30
|
+
"SwitchShortNeutralIn",
|
|
31
|
+
"SwitchShortFranklinIn",
|
|
32
|
+
"SwitchShortTrevorIn",
|
|
33
|
+
"SwitchShortMichaelIn",
|
|
34
|
+
"SwitchOpenMichaelIn",
|
|
35
|
+
"SwitchOpenFranklinIn",
|
|
36
|
+
"SwitchOpenTrevorIn",
|
|
37
|
+
"SwitchHUDMichaelOut",
|
|
38
|
+
"SwitchHUDFranklinOut",
|
|
39
|
+
"SwitchHUDTrevorOut",
|
|
40
|
+
"SwitchShortFranklinMid",
|
|
41
|
+
"SwitchShortMichaelMid",
|
|
42
|
+
"SwitchShortTrevorMid",
|
|
43
|
+
"DeathFailOut",
|
|
44
|
+
"CamPushInNeutral",
|
|
45
|
+
"CamPushInFranklin",
|
|
46
|
+
"CamPushInMichael",
|
|
47
|
+
"CamPushInTrevor",
|
|
48
|
+
"SwitchSceneFranklin",
|
|
49
|
+
"SwitchSceneTrevor",
|
|
50
|
+
"SwitchSceneMichael",
|
|
51
|
+
"SwitchSceneNeutral",
|
|
52
|
+
"MP_Celeb_Win",
|
|
53
|
+
"MP_Celeb_Win_Out",
|
|
54
|
+
"MP_Celeb_Lose",
|
|
55
|
+
"MP_Celeb_Lose_Out",
|
|
56
|
+
"DeathFailNeutralIn",
|
|
57
|
+
"DeathFailMPDark",
|
|
58
|
+
"DeathFailMPIn",
|
|
59
|
+
"MP_Celeb_Preload_Fade",
|
|
60
|
+
"PeyoteEndOut",
|
|
61
|
+
"PeyoteEndIn",
|
|
62
|
+
"PeyoteIn",
|
|
63
|
+
"PeyoteOut",
|
|
64
|
+
"MP_race_crash",
|
|
65
|
+
"SuccessFranklin",
|
|
66
|
+
"SuccessTrevor",
|
|
67
|
+
"SuccessMichael",
|
|
68
|
+
"DrugsMichaelAliensFightIn",
|
|
69
|
+
"DrugsMichaelAliensFight",
|
|
70
|
+
"DrugsMichaelAliensFightOut",
|
|
71
|
+
"DrugsTrevorClownsFightIn",
|
|
72
|
+
"DrugsTrevorClownsFight",
|
|
73
|
+
"DrugsTrevorClownsFightOut",
|
|
74
|
+
"HeistCelebPass",
|
|
75
|
+
"HeistCelebPassBW",
|
|
76
|
+
"HeistCelebEnd",
|
|
77
|
+
"HeistCelebToast",
|
|
78
|
+
"MenuMGHeistIn",
|
|
79
|
+
"MenuMGTournamentIn",
|
|
80
|
+
"MenuMGSelectionIn",
|
|
81
|
+
"ChopVision",
|
|
82
|
+
"DMT_flight_intro",
|
|
83
|
+
"DMT_flight",
|
|
84
|
+
"DrugsDrivingIn",
|
|
85
|
+
"DrugsDrivingOut",
|
|
86
|
+
"SwitchOpenNeutralFIB5",
|
|
87
|
+
"HeistLocate",
|
|
88
|
+
"MP_job_load",
|
|
89
|
+
"RaceTurbo",
|
|
90
|
+
"MP_intro_logo",
|
|
91
|
+
"HeistTripSkipFade",
|
|
92
|
+
"MenuMGHeistOut",
|
|
93
|
+
"MP_corona_switch",
|
|
94
|
+
"MenuMGSelectionTint",
|
|
95
|
+
"SuccessNeutral",
|
|
96
|
+
"ExplosionJosh3",
|
|
97
|
+
"SniperOverlay",
|
|
98
|
+
"RampageOut",
|
|
99
|
+
"Rampage",
|
|
100
|
+
"Dont_tazeme_bro"
|
|
101
|
+
];
|
|
102
|
+
static effectToString(screenEffect) {
|
|
103
|
+
const effect = Number(screenEffect);
|
|
104
|
+
if (effect >= 0 && effect <= Effects.effects.length) {
|
|
105
|
+
return Effects.effects[effect];
|
|
106
|
+
}
|
|
107
|
+
return "INVALID";
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
Effects
|
|
112
|
+
};
|
package/ui/Fading.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
class Fading {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "Fading");
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Gets whether the screen is faded in
|
|
9
|
+
*
|
|
10
|
+
* @returns True or false
|
|
11
|
+
*/
|
|
12
|
+
static get IsFadedIn() {
|
|
13
|
+
return IsScreenFadedIn();
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Gets whether the screen is faded out
|
|
17
|
+
*
|
|
18
|
+
* @returns True or false
|
|
19
|
+
*/
|
|
20
|
+
static get IsFadedOut() {
|
|
21
|
+
return IsScreenFadedOut();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Gets whether the screen is currently fading in
|
|
25
|
+
*
|
|
26
|
+
* @returns True or false
|
|
27
|
+
*/
|
|
28
|
+
static get IsFadingIn() {
|
|
29
|
+
return IsScreenFadingIn();
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Gets whether the screen is currently fading out
|
|
33
|
+
*
|
|
34
|
+
* @returns True or false
|
|
35
|
+
*/
|
|
36
|
+
static get IsFadingOut() {
|
|
37
|
+
return IsScreenFadingOut();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Fade in the screen for a certain duration.
|
|
41
|
+
*
|
|
42
|
+
* @param duration Time to fade in
|
|
43
|
+
*/
|
|
44
|
+
static fadeIn(duration) {
|
|
45
|
+
return new Promise((resolve) => {
|
|
46
|
+
DoScreenFadeIn(duration);
|
|
47
|
+
const interval = setInterval(() => {
|
|
48
|
+
if (this.IsFadedIn) {
|
|
49
|
+
clearInterval(interval);
|
|
50
|
+
resolve();
|
|
51
|
+
}
|
|
52
|
+
}, 0);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Fade out the screen for a certain duration.
|
|
57
|
+
*
|
|
58
|
+
* @param duration Time to fade out
|
|
59
|
+
*/
|
|
60
|
+
static fadeOut(duration) {
|
|
61
|
+
return new Promise((resolve) => {
|
|
62
|
+
DoScreenFadeOut(duration);
|
|
63
|
+
const interval = setInterval(() => {
|
|
64
|
+
if (this.IsFadedOut) {
|
|
65
|
+
clearInterval(interval);
|
|
66
|
+
resolve();
|
|
67
|
+
}
|
|
68
|
+
}, 0);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
Fading
|
|
74
|
+
};
|
package/ui/Hud.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { CursorSprite
|
|
2
|
-
import type {
|
|
1
|
+
import { CursorSprite } from "fivem/enums/CursorSprite";
|
|
2
|
+
import type { HudComponent } from "fivem/enums/HudComponent";
|
|
3
|
+
import type { Point } from "fivem/utils/Point";
|
|
3
4
|
export declare abstract class Hud {
|
|
4
5
|
static isComponentActive(component: HudComponent): boolean;
|
|
5
6
|
static showComponentThisFrame(component: HudComponent): void;
|
package/ui/Hud.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { CursorSprite } from "fivem/enums/CursorSprite";
|
|
4
|
+
class Hud {
|
|
5
|
+
static {
|
|
6
|
+
__name(this, "Hud");
|
|
7
|
+
}
|
|
8
|
+
static isComponentActive(component) {
|
|
9
|
+
return IsHudComponentActive(Number(component));
|
|
10
|
+
}
|
|
11
|
+
static showComponentThisFrame(component) {
|
|
12
|
+
ShowHudComponentThisFrame(Number(component));
|
|
13
|
+
}
|
|
14
|
+
static hideComponentThisFrame(component) {
|
|
15
|
+
HideHudComponentThisFrame(Number(component));
|
|
16
|
+
}
|
|
17
|
+
static showCursorThisFrame() {
|
|
18
|
+
ShowCursorThisFrame();
|
|
19
|
+
}
|
|
20
|
+
static set CursorPosition(position) {
|
|
21
|
+
SetCursorLocation(position.X, position.Y);
|
|
22
|
+
}
|
|
23
|
+
static get CursorSprite() {
|
|
24
|
+
return CursorSprite.DownArrow;
|
|
25
|
+
}
|
|
26
|
+
static set CursorSprite(sprite) {
|
|
27
|
+
SetCursorSprite(Number(sprite));
|
|
28
|
+
}
|
|
29
|
+
static get IsVisible() {
|
|
30
|
+
return !(IsHudHidden() || !IsHudPreferenceSwitchedOn());
|
|
31
|
+
}
|
|
32
|
+
static set IsVisible(toggle) {
|
|
33
|
+
DisplayHud(toggle);
|
|
34
|
+
}
|
|
35
|
+
static get IsRadarVisible() {
|
|
36
|
+
return !(IsRadarHidden() || IsRadarPreferenceSwitchedOn());
|
|
37
|
+
}
|
|
38
|
+
static set IsRadarVisible(toggle) {
|
|
39
|
+
DisplayRadar(toggle);
|
|
40
|
+
}
|
|
41
|
+
static set RadarZoom(zoomLevel) {
|
|
42
|
+
SetRadarZoom(zoomLevel);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
Hud
|
|
47
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { Scaleform } from "./Scaleform";
|
|
4
|
+
class InstructionalButtons {
|
|
5
|
+
static {
|
|
6
|
+
__name(this, "InstructionalButtons");
|
|
7
|
+
}
|
|
8
|
+
scaleform;
|
|
9
|
+
/**
|
|
10
|
+
* Draws native instructional buttons
|
|
11
|
+
*
|
|
12
|
+
* @param buttons Array of instructional buttons to be drawn
|
|
13
|
+
*/
|
|
14
|
+
constructor(buttons) {
|
|
15
|
+
this.scaleform = new Scaleform("INSTRUCTIONAL_BUTTONS");
|
|
16
|
+
this.scaleform.callFunction("CLEAR_ALL");
|
|
17
|
+
this.scaleform.callFunction("SET_CLEAR_SPACE", 200);
|
|
18
|
+
buttons.forEach((button, index) => {
|
|
19
|
+
this.pushButton(button, index);
|
|
20
|
+
});
|
|
21
|
+
this.scaleform.callFunction("DRAW_INSTRUCTIONAL_BUTTONS");
|
|
22
|
+
this.scaleform.callFunction("SET_BACKGROUND_COLOUR", 0, 0, 0, 80);
|
|
23
|
+
}
|
|
24
|
+
pushButton(button, index) {
|
|
25
|
+
BeginScaleformMovieMethod(this.scaleform.Handle, "SET_DATA_SLOT");
|
|
26
|
+
PushScaleformMovieFunctionParameterInt(index);
|
|
27
|
+
for (let i = button.controls.length - 1; i >= 0; i--) {
|
|
28
|
+
PushScaleformMovieMethodParameterButtonName(GetControlInstructionalButton(2, button.controls[i], true));
|
|
29
|
+
}
|
|
30
|
+
PushScaleformMovieMethodParameterString(button.label);
|
|
31
|
+
EndScaleformMovieMethod();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Renders the instructional button scaleform
|
|
35
|
+
*/
|
|
36
|
+
async draw() {
|
|
37
|
+
await this.scaleform.render2D();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
InstructionalButtons
|
|
42
|
+
};
|
package/ui/LoadingPrompt.d.ts
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { LoadingSpinnerType } from "fivem/enums/LoadingSpinnerType";
|
|
4
|
+
class LoadingPrompt {
|
|
5
|
+
static {
|
|
6
|
+
__name(this, "LoadingPrompt");
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Shows a loading prompt.
|
|
10
|
+
*
|
|
11
|
+
* @param loadingText Text to be displayed inside loading prompt.
|
|
12
|
+
* @param spinnerType Type of spinner.
|
|
13
|
+
*/
|
|
14
|
+
static show(loadingText = "", spinnerType = LoadingSpinnerType.RegularClockwise) {
|
|
15
|
+
if (LoadingPrompt.IsActive) {
|
|
16
|
+
LoadingPrompt.hide();
|
|
17
|
+
}
|
|
18
|
+
if (loadingText === "") {
|
|
19
|
+
BeginTextCommandBusyString("");
|
|
20
|
+
} else {
|
|
21
|
+
BeginTextCommandBusyString("STRING");
|
|
22
|
+
AddTextComponentSubstringPlayerName(loadingText);
|
|
23
|
+
}
|
|
24
|
+
EndTextCommandBusyString(Number(spinnerType));
|
|
25
|
+
}
|
|
26
|
+
static hide() {
|
|
27
|
+
if (LoadingPrompt.IsActive) {
|
|
28
|
+
RemoveLoadingPrompt();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
static get IsActive() {
|
|
32
|
+
return IsLoadingPromptBeingDisplayed();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
LoadingPrompt
|
|
37
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
class Notification {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "Notification");
|
|
6
|
+
}
|
|
7
|
+
handle;
|
|
8
|
+
constructor(handle) {
|
|
9
|
+
this.handle = handle;
|
|
10
|
+
}
|
|
11
|
+
hide() {
|
|
12
|
+
RemoveNotification(this.handle);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
Notification
|
|
17
|
+
};
|
package/ui/Rectangle.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Color } from "../common/utils/Color";
|
|
2
|
+
import { Point } from "fivem/utils/Point";
|
|
3
|
+
import { Size } from "fivem/utils/Size";
|
|
4
|
+
import type { IDrawable } from "./interfaces/IDrawable";
|
|
3
5
|
export declare class Rectangle implements IDrawable {
|
|
4
6
|
pos: Point;
|
|
5
7
|
size: Size;
|
package/ui/Rectangle.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { Point } from "fivem/utils/Point";
|
|
4
|
+
import { Size } from "fivem/utils/Size";
|
|
5
|
+
import { Screen } from "./Screen";
|
|
6
|
+
class Rectangle {
|
|
7
|
+
static {
|
|
8
|
+
__name(this, "Rectangle");
|
|
9
|
+
}
|
|
10
|
+
pos;
|
|
11
|
+
size;
|
|
12
|
+
color;
|
|
13
|
+
constructor(pos, size, color) {
|
|
14
|
+
this.pos = pos;
|
|
15
|
+
this.size = size;
|
|
16
|
+
this.color = color;
|
|
17
|
+
}
|
|
18
|
+
draw(arg1, arg2, color, resolution) {
|
|
19
|
+
resolution = color === void 0 ? arg2 : resolution;
|
|
20
|
+
resolution = resolution || new Size(Screen.ScaledWidth, Screen.Height);
|
|
21
|
+
if (color === void 0) {
|
|
22
|
+
if (arg1 && arg1 instanceof Size) {
|
|
23
|
+
arg1 = new Point(this.pos.X + arg1.width, this.pos.Y + arg1.height);
|
|
24
|
+
} else {
|
|
25
|
+
arg1 = this.pos;
|
|
26
|
+
}
|
|
27
|
+
arg2 = this.size;
|
|
28
|
+
} else {
|
|
29
|
+
if (!arg1) {
|
|
30
|
+
arg1 = this.pos;
|
|
31
|
+
} else {
|
|
32
|
+
arg1 = arg1;
|
|
33
|
+
}
|
|
34
|
+
arg2 = arg2 || this.size;
|
|
35
|
+
}
|
|
36
|
+
color = color || this.color;
|
|
37
|
+
const w = arg2.width / resolution.width;
|
|
38
|
+
const h = arg2.height / resolution.height;
|
|
39
|
+
const x = arg1.X / resolution.width + w * 0.5;
|
|
40
|
+
const y = arg1.Y / resolution.height + h * 0.5;
|
|
41
|
+
DrawRect(x, y, w, h, color.r, color.g, color.b, color.a);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
Rectangle
|
|
46
|
+
};
|
package/ui/Scaleform.d.ts
CHANGED
package/ui/Scaleform.js
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
class Scaleform {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "Scaleform");
|
|
6
|
+
}
|
|
7
|
+
static async render2DMasked(scaleform1, scaleform2) {
|
|
8
|
+
if (!scaleform1.IsLoaded) await scaleform1.load();
|
|
9
|
+
if (!scaleform2.IsLoaded) await scaleform2.load();
|
|
10
|
+
if (scaleform1.IsLoaded && scaleform2.IsLoaded) {
|
|
11
|
+
DrawScaleformMovieFullscreenMasked(scaleform1.Handle, scaleform2.Handle, 255, 255, 255, 255);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
handle;
|
|
15
|
+
name;
|
|
16
|
+
loaded = false;
|
|
17
|
+
constructor(name) {
|
|
18
|
+
this.name = name;
|
|
19
|
+
this.handle = RequestScaleformMovie(this.name);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the handle of the scaleform.
|
|
23
|
+
*/
|
|
24
|
+
get Handle() {
|
|
25
|
+
return this.handle;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get whether the handle is a valid handle.
|
|
29
|
+
*/
|
|
30
|
+
get IsValid() {
|
|
31
|
+
return this.handle !== 0;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get whether the scaleform is loaded.
|
|
35
|
+
*/
|
|
36
|
+
get IsLoaded() {
|
|
37
|
+
if (!this.loaded) {
|
|
38
|
+
this.loaded = HasScaleformMovieLoaded(this.handle);
|
|
39
|
+
}
|
|
40
|
+
return this.loaded;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Dispose the scaleform allowing the GTA engine to free memory when wanted.
|
|
44
|
+
*/
|
|
45
|
+
dispose() {
|
|
46
|
+
if (this.IsLoaded) {
|
|
47
|
+
SetScaleformMovieAsNoLongerNeeded(this.handle);
|
|
48
|
+
this.loaded = false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Call a function on the scaleform.
|
|
53
|
+
*
|
|
54
|
+
* @param name Name of the function
|
|
55
|
+
* @param args Additional arguments
|
|
56
|
+
*/
|
|
57
|
+
callFunction(name, ...args) {
|
|
58
|
+
BeginScaleformMovieMethod(this.handle, name);
|
|
59
|
+
args.forEach((arg) => {
|
|
60
|
+
switch (typeof arg) {
|
|
61
|
+
case "number":
|
|
62
|
+
PushScaleformMovieFunctionParameterInt(arg);
|
|
63
|
+
break;
|
|
64
|
+
case "string":
|
|
65
|
+
PushScaleformMovieFunctionParameterString(arg);
|
|
66
|
+
break;
|
|
67
|
+
case "boolean":
|
|
68
|
+
PushScaleformMovieFunctionParameterBool(arg);
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
throw new Error(
|
|
72
|
+
`Unknown argument type [${typeof arg}] passed to scaleform with handle [${this.handle}], had value of ${arg}`
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
EndScaleformMovieMethod();
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Calls a void method on the scaleform.
|
|
80
|
+
*
|
|
81
|
+
* @param name Name of the function
|
|
82
|
+
*/
|
|
83
|
+
callVoidMethod(name) {
|
|
84
|
+
CallScaleformMovieMethod(this.handle, name);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Calls a string method on the scaleform.
|
|
88
|
+
*
|
|
89
|
+
* @param name Name of the function
|
|
90
|
+
* @param param1
|
|
91
|
+
* @param param2
|
|
92
|
+
* @param param3
|
|
93
|
+
* @param param4
|
|
94
|
+
* @param param5
|
|
95
|
+
*/
|
|
96
|
+
callStringMethod(name, param1 = "", param2 = "", param3 = "", param4 = "", param5 = "") {
|
|
97
|
+
CallScaleformMovieMethodWithString(this.handle, name, param1, param2, param3, param4, param5);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Calls a number method on the scaleform.
|
|
101
|
+
*
|
|
102
|
+
* @param name Name of the function
|
|
103
|
+
* @param param1
|
|
104
|
+
* @param param2
|
|
105
|
+
* @param param3
|
|
106
|
+
* @param param4
|
|
107
|
+
* @param param5
|
|
108
|
+
*/
|
|
109
|
+
callNumberMethod(name, param1 = -1, param2 = -1, param3 = -1, param4 = -1, param5 = -1) {
|
|
110
|
+
CallScaleformMovieMethodWithNumber(this.handle, name, param1, param2, param3, param4, param5);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Calls a number & string method on the scaleform.
|
|
114
|
+
*
|
|
115
|
+
* @param name Name of the function
|
|
116
|
+
* @param fParam1
|
|
117
|
+
* @param fParam2
|
|
118
|
+
* @param fParam3
|
|
119
|
+
* @param fParam4
|
|
120
|
+
* @param fParam5
|
|
121
|
+
* @param sParam1
|
|
122
|
+
* @param sParam2
|
|
123
|
+
* @param sParam3
|
|
124
|
+
* @param sParam4
|
|
125
|
+
* @param sParam5
|
|
126
|
+
*/
|
|
127
|
+
callSharedMethod(name, fParam1 = -1, fParam2 = -1, fParam3 = -1, fParam4 = -1, fParam5 = -1, sParam1 = "", sParam2 = "", sParam3 = "", sParam4 = "", sParam5 = "") {
|
|
128
|
+
CallScaleformMovieMethodWithNumberAndString(
|
|
129
|
+
this.handle,
|
|
130
|
+
name,
|
|
131
|
+
fParam1,
|
|
132
|
+
fParam2,
|
|
133
|
+
fParam3,
|
|
134
|
+
fParam4,
|
|
135
|
+
fParam5,
|
|
136
|
+
sParam1,
|
|
137
|
+
sParam2,
|
|
138
|
+
sParam3,
|
|
139
|
+
sParam4,
|
|
140
|
+
sParam5
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Sets a duration the scaleform should be shown.
|
|
145
|
+
* Useful for showing a scaleform for a known amount of time, such as messages.
|
|
146
|
+
*
|
|
147
|
+
* This only works for any scaleform using {@linkcode render2D};
|
|
148
|
+
*
|
|
149
|
+
* @param duration Duration in milliseconds
|
|
150
|
+
*/
|
|
151
|
+
setDuration(duration) {
|
|
152
|
+
if (duration <= 0) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const start = GetGameTimer();
|
|
156
|
+
const interval = setInterval(async () => {
|
|
157
|
+
if (GetGameTimer() - start < duration) {
|
|
158
|
+
await this.render2D();
|
|
159
|
+
} else {
|
|
160
|
+
clearInterval(interval);
|
|
161
|
+
}
|
|
162
|
+
}, 0);
|
|
163
|
+
}
|
|
164
|
+
async render2D() {
|
|
165
|
+
if (!this.IsLoaded) await this.load();
|
|
166
|
+
if (!this.IsLoaded) return;
|
|
167
|
+
DrawScaleformMovieFullscreen(this.handle, 255, 255, 255, 255, 0);
|
|
168
|
+
}
|
|
169
|
+
async render2DScreenSpace(location, size) {
|
|
170
|
+
if (this.IsLoaded) await this.load();
|
|
171
|
+
if (!this.IsLoaded) return;
|
|
172
|
+
const x = location.x;
|
|
173
|
+
const y = location.y;
|
|
174
|
+
const width = size.x;
|
|
175
|
+
const height = size.y;
|
|
176
|
+
DrawScaleformMovie(this.handle, x + width / 2, y + height / 2, width, height, 255, 255, 255, 255, 0);
|
|
177
|
+
}
|
|
178
|
+
async render3D(position, rotation, scale) {
|
|
179
|
+
if (this.IsLoaded) await this.load();
|
|
180
|
+
if (!this.IsLoaded) return;
|
|
181
|
+
DrawScaleformMovie_3dNonAdditive(
|
|
182
|
+
this.handle,
|
|
183
|
+
position.x,
|
|
184
|
+
position.y,
|
|
185
|
+
position.z,
|
|
186
|
+
rotation.x,
|
|
187
|
+
rotation.y,
|
|
188
|
+
rotation.z,
|
|
189
|
+
2,
|
|
190
|
+
2,
|
|
191
|
+
1,
|
|
192
|
+
scale.x,
|
|
193
|
+
scale.y,
|
|
194
|
+
scale.z,
|
|
195
|
+
2
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
async render3DAdditive(position, rotation, scale) {
|
|
199
|
+
if (this.IsLoaded) await this.load();
|
|
200
|
+
if (!this.IsLoaded) return;
|
|
201
|
+
DrawScaleformMovie_3d(
|
|
202
|
+
this.handle,
|
|
203
|
+
position.x,
|
|
204
|
+
position.y,
|
|
205
|
+
position.z,
|
|
206
|
+
rotation.x,
|
|
207
|
+
rotation.y,
|
|
208
|
+
rotation.z,
|
|
209
|
+
2,
|
|
210
|
+
2,
|
|
211
|
+
1,
|
|
212
|
+
scale.x,
|
|
213
|
+
scale.y,
|
|
214
|
+
scale.z,
|
|
215
|
+
2
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
load() {
|
|
219
|
+
return new Promise((resolve) => {
|
|
220
|
+
if (this.IsLoaded) {
|
|
221
|
+
resolve(true);
|
|
222
|
+
} else {
|
|
223
|
+
const start = GetGameTimer();
|
|
224
|
+
const interval = setInterval(() => {
|
|
225
|
+
if (this.IsLoaded) {
|
|
226
|
+
clearInterval(interval);
|
|
227
|
+
resolve(true);
|
|
228
|
+
} else if (GetGameTimer() - start > 5e3) {
|
|
229
|
+
clearInterval(interval);
|
|
230
|
+
console.log(`^1[fivemjs/client] Could not load scaleform ${this.name}!^7`);
|
|
231
|
+
resolve(false);
|
|
232
|
+
}
|
|
233
|
+
}, 0);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
export {
|
|
239
|
+
Scaleform
|
|
240
|
+
};
|
package/ui/Screen.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Color } from "../common/utils/Color";
|
|
2
|
+
import type { Vector3 } from "../common/utils/Vector";
|
|
3
|
+
import { HudColor } from "fivem/enums/HudColor";
|
|
4
|
+
import { NotificationType } from "fivem/enums/NotificationType";
|
|
5
|
+
import { Size } from "fivem/utils/Size";
|
|
6
|
+
import { Notification } from "./Notification";
|
|
4
7
|
export declare abstract class Screen {
|
|
5
8
|
static get Resolution(): Size;
|
|
6
9
|
static get ScaledResolution(): Size;
|