@nativewrappers/fivem 0.0.79 → 0.0.81

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.
Files changed (265) hide show
  1. package/Audio.d.ts +2 -2
  2. package/Audio.js +99 -0
  3. package/Blip.d.ts +4 -3
  4. package/Blip.js +113 -0
  5. package/Camera.d.ts +3 -3
  6. package/Camera.js +190 -0
  7. package/Checkpoint.d.ts +2 -2
  8. package/Checkpoint.js +51 -0
  9. package/Events.js +80 -0
  10. package/Game.d.ts +10 -3
  11. package/Game.js +478 -0
  12. package/GameplayCamera.d.ts +2 -2
  13. package/GameplayCamera.js +152 -0
  14. package/Model.js +210 -0
  15. package/NetworkedScene.d.ts +2 -1
  16. package/NetworkedScene.js +50 -0
  17. package/ParticleEffect.d.ts +4 -3
  18. package/ParticleEffect.js +128 -0
  19. package/ParticleEffectAsset.d.ts +2 -2
  20. package/ParticleEffectAsset.js +133 -0
  21. package/Pickup.d.ts +1 -1
  22. package/Pickup.js +27 -0
  23. package/Raycast.d.ts +5 -3
  24. package/Raycast.js +132 -0
  25. package/RelationshipGroup.d.ts +1 -1
  26. package/RelationshipGroup.js +72 -0
  27. package/Rope.d.ts +1 -1
  28. package/Rope.js +149 -0
  29. package/TaskSequence.js +52 -0
  30. package/Tasks.d.ts +8 -3
  31. package/Tasks.js +334 -0
  32. package/World.d.ts +13 -4
  33. package/World.js +945 -0
  34. package/cfx/StateBagChangeHandler.js +0 -0
  35. package/cfx/index.d.ts +1 -1
  36. package/cfx/index.js +4 -0
  37. package/common/Command.js +111 -0
  38. package/common/Convar.js +58 -0
  39. package/common/GlobalData.js +16 -0
  40. package/common/Kvp.js +137 -0
  41. package/common/Resource.js +54 -0
  42. package/common/decors/Events.js +170 -0
  43. package/common/net/NetworkedMap.js +225 -0
  44. package/common/types.js +0 -0
  45. package/common/utils/ClassTypes.js +15 -0
  46. package/common/utils/Color.js +33 -0
  47. package/common/utils/Delay.d.ts +1 -0
  48. package/common/utils/Delay.js +6 -0
  49. package/common/utils/Maths.js +18 -0
  50. package/common/utils/Point.d.ts +9 -0
  51. package/common/utils/Point.js +36 -0
  52. package/common/utils/PointF.d.ts +1 -1
  53. package/common/utils/PointF.js +18 -0
  54. package/common/utils/Quaternion.d.ts +1 -1
  55. package/common/utils/Quaternion.js +33 -0
  56. package/common/utils/Vector.js +589 -0
  57. package/common/utils/cleanPlayerName.js +17 -0
  58. package/common/utils/enumValues.js +20 -0
  59. package/common/utils/getStringFromUInt8Array.js +6 -0
  60. package/common/utils/getUInt32FromUint8Array.js +6 -0
  61. package/enums/Alignment.js +9 -0
  62. package/enums/AnimationFlags.js +38 -0
  63. package/enums/AudioFlag.js +41 -0
  64. package/enums/BadgeStyle.js +186 -0
  65. package/enums/Blip.js +229 -0
  66. package/enums/Bone.js +105 -0
  67. package/enums/CameraShake.js +17 -0
  68. package/enums/CameraTypes.js +11 -0
  69. package/enums/CheckboxStyle.js +8 -0
  70. package/enums/Checkpoint.js +68 -0
  71. package/enums/CloudHat.js +27 -0
  72. package/enums/Control.js +364 -0
  73. package/enums/CursorSprite.js +18 -0
  74. package/enums/Driving.js +38 -0
  75. package/enums/ExplosionType.js +45 -0
  76. package/enums/FiringPattern.js +23 -0
  77. package/enums/Font.js +11 -0
  78. package/enums/ForceType.js +12 -0
  79. package/enums/Gender.js +8 -0
  80. package/enums/HelmetType.js +9 -0
  81. package/enums/HudColor.js +187 -0
  82. package/enums/HudComponent.js +57 -0
  83. package/enums/InputMode.js +8 -0
  84. package/enums/InvertAxis.js +10 -0
  85. package/enums/Language.js +18 -0
  86. package/enums/LeaveVehicleFlags.js +14 -0
  87. package/enums/LoadingSpinnerType.js +11 -0
  88. package/enums/MarkerType.js +48 -0
  89. package/enums/MenuAlignment.js +8 -0
  90. package/enums/NotificationType.js +14 -0
  91. package/enums/Parachute.js +19 -0
  92. package/enums/PickupType.js +77 -0
  93. package/enums/RadioStation.js +28 -0
  94. package/enums/RagdollType.js +10 -0
  95. package/enums/RaycastEnums.js +33 -0
  96. package/enums/Relationship.js +13 -0
  97. package/enums/RopeType.js +9 -0
  98. package/enums/ScreenEffect.js +87 -0
  99. package/enums/SpeechModifier.js +43 -0
  100. package/enums/Vehicle.js +396 -0
  101. package/enums/Weather.js +22 -0
  102. package/enums/ZoneID.js +95 -0
  103. package/hashes/MaterialHash.js +220 -0
  104. package/hashes/PedHash.js +728 -0
  105. package/hashes/VehicleHash.js +526 -0
  106. package/hashes/WeaponHash.js +155 -0
  107. package/hashes/WeatherTypeHash.js +22 -0
  108. package/interfaces/Dimensions.d.ts +1 -1
  109. package/interfaces/Dimensions.js +0 -0
  110. package/models/BaseEntity.d.ts +10 -8
  111. package/models/BaseEntity.js +576 -0
  112. package/models/Entity.d.ts +0 -1
  113. package/models/Entity.js +0 -0
  114. package/models/EntityBone.d.ts +1 -1
  115. package/models/EntityBone.js +32 -0
  116. package/models/EntityBoneCollection.d.ts +1 -1
  117. package/models/EntityBoneCollection.js +27 -0
  118. package/models/Ped.d.ts +13 -5
  119. package/models/Ped.js +711 -0
  120. package/models/PedBone.d.ts +3 -2
  121. package/models/PedBone.js +18 -0
  122. package/models/PedBoneCollection.d.ts +3 -1
  123. package/models/PedBoneCollection.js +31 -0
  124. package/models/Player.d.ts +4 -2
  125. package/models/Player.js +188 -0
  126. package/models/Prop.d.ts +1 -1
  127. package/models/Prop.js +34 -0
  128. package/models/Vehicle.d.ts +9 -4
  129. package/models/Vehicle.js +582 -0
  130. package/models/VehicleDoor.d.ts +1 -1
  131. package/models/VehicleDoor.js +52 -0
  132. package/models/VehicleDoorCollection.d.ts +1 -1
  133. package/models/VehicleDoorCollection.js +66 -0
  134. package/models/VehicleMod.d.ts +1 -1
  135. package/models/VehicleMod.js +43 -0
  136. package/models/VehicleModCollection.d.ts +2 -2
  137. package/models/VehicleModCollection.js +227 -0
  138. package/models/VehicleToggleMod.d.ts +1 -1
  139. package/models/VehicleToggleMod.js +37 -0
  140. package/models/VehicleWheel.js +31 -0
  141. package/models/VehicleWheelCollection.d.ts +1 -1
  142. package/models/VehicleWheelCollection.js +61 -0
  143. package/models/VehicleWindow.d.ts +1 -1
  144. package/models/VehicleWindow.js +43 -0
  145. package/models/VehicleWindowCollection.d.ts +1 -1
  146. package/models/VehicleWindowCollection.js +62 -0
  147. package/package.json +2 -2
  148. package/ui/Container.d.ts +4 -2
  149. package/ui/Container.js +39 -0
  150. package/ui/Effects.d.ts +1 -1
  151. package/ui/Effects.js +112 -0
  152. package/ui/Fading.js +74 -0
  153. package/ui/Hud.d.ts +3 -2
  154. package/ui/Hud.js +47 -0
  155. package/ui/InstructionalButtons.js +42 -0
  156. package/ui/LoadingPrompt.d.ts +1 -1
  157. package/ui/LoadingPrompt.js +37 -0
  158. package/ui/Notification.js +17 -0
  159. package/ui/Rectangle.d.ts +4 -2
  160. package/ui/Rectangle.js +46 -0
  161. package/ui/Scaleform.d.ts +2 -1
  162. package/ui/Scaleform.js +240 -0
  163. package/ui/Screen.d.ts +6 -3
  164. package/ui/Screen.js +83 -0
  165. package/ui/Sprite.d.ts +3 -1
  166. package/ui/Sprite.js +70 -0
  167. package/ui/Text.d.ts +6 -3
  168. package/ui/Text.js +119 -0
  169. package/ui/Timerbar.js +241 -0
  170. package/ui/interfaces/IButton.d.ts +1 -1
  171. package/ui/interfaces/IButton.js +0 -0
  172. package/ui/interfaces/IDrawable.d.ts +3 -1
  173. package/ui/interfaces/IDrawable.js +0 -0
  174. package/ui/menu/Menu.d.ts +9 -4
  175. package/ui/menu/Menu.js +830 -0
  176. package/ui/menu/MenuControl.js +20 -0
  177. package/ui/menu/MenuControls.js +17 -0
  178. package/ui/menu/MenuSettings.d.ts +1 -1
  179. package/ui/menu/MenuSettings.js +57 -0
  180. package/ui/menu/items/UIMenuCheckboxItem.d.ts +3 -3
  181. package/ui/menu/items/UIMenuCheckboxItem.js +70 -0
  182. package/ui/menu/items/UIMenuItem.d.ts +10 -4
  183. package/ui/menu/items/UIMenuItem.js +1103 -0
  184. package/ui/menu/items/UIMenuListItem.d.ts +3 -3
  185. package/ui/menu/items/UIMenuListItem.js +118 -0
  186. package/ui/menu/items/UIMenuSeparatorItem.d.ts +1 -1
  187. package/ui/menu/items/UIMenuSeparatorItem.js +37 -0
  188. package/ui/menu/items/UIMenuSliderItem.d.ts +4 -3
  189. package/ui/menu/items/UIMenuSliderItem.js +180 -0
  190. package/ui/menu/items/panels/AbstractUIMenuPanel.d.ts +4 -3
  191. package/ui/menu/items/panels/AbstractUIMenuPanel.js +49 -0
  192. package/ui/menu/items/panels/UIMenuColorPanel.d.ts +3 -3
  193. package/ui/menu/items/panels/UIMenuColorPanel.js +215 -0
  194. package/ui/menu/items/panels/UIMenuGridPanel.d.ts +3 -3
  195. package/ui/menu/items/panels/UIMenuGridPanel.js +216 -0
  196. package/ui/menu/items/panels/UIMenuPercentagePanel.d.ts +2 -2
  197. package/ui/menu/items/panels/UIMenuPercentagePanel.js +138 -0
  198. package/ui/menu/items/panels/UIMenuStatisticsPanel.d.ts +3 -2
  199. package/ui/menu/items/panels/UIMenuStatisticsPanel.js +88 -0
  200. package/ui/menu/items/panels/UIMenuStatisticsPanelItem.d.ts +2 -1
  201. package/ui/menu/items/panels/UIMenuStatisticsPanelItem.js +48 -0
  202. package/ui/menu/modules/ListItem.js +18 -0
  203. package/utils/Animations.js +43 -0
  204. package/utils/Crypto.js +33 -0
  205. package/utils/LiteEvent.js +25 -0
  206. package/utils/Maths.js +18 -0
  207. package/utils/Point.js +36 -0
  208. package/utils/Size.js +16 -0
  209. package/utils/String.d.ts +1 -1
  210. package/utils/String.js +35 -0
  211. package/weapon/DlcWeaponData.d.ts +1 -1
  212. package/weapon/DlcWeaponData.js +40 -0
  213. package/weapon/Mk2WeaponHash.js +18 -0
  214. package/weapon/Weapon.d.ts +7 -7
  215. package/weapon/Weapon.js +276 -0
  216. package/weapon/WeaponAsset.d.ts +1 -1
  217. package/weapon/WeaponAsset.js +87 -0
  218. package/weapon/WeaponCollection.d.ts +3 -2
  219. package/weapon/WeaponCollection.js +179 -0
  220. package/weapon/WeaponDisplayNameByHash.d.ts +1 -1
  221. package/weapon/WeaponDisplayNameByHash.js +73 -0
  222. package/weapon/WeaponGroup.js +22 -0
  223. package/weapon/WeaponHudStats.d.ts +1 -1
  224. package/weapon/WeaponHudStats.js +33 -0
  225. package/weapon/WeaponLivery.js +17 -0
  226. package/weapon/WeaponLiveryColor.js +38 -0
  227. package/weapon/WeaponTint.js +46 -0
  228. package/weaponComponent/ComponentAttachmentPoint.js +22 -0
  229. package/weaponComponent/ComponentAttachmentPointByHash.js +307 -0
  230. package/weaponComponent/ComponentDisplayNameByHash.js +278 -0
  231. package/weaponComponent/DlcWeaponComponentData.js +40 -0
  232. package/weaponComponent/InvalidWeaponComponent.d.ts +1 -1
  233. package/weaponComponent/InvalidWeaponComponent.js +31 -0
  234. package/weaponComponent/WeaponComponent.d.ts +4 -4
  235. package/weaponComponent/WeaponComponent.js +124 -0
  236. package/weaponComponent/WeaponComponentCollection.d.ts +2 -2
  237. package/weaponComponent/WeaponComponentCollection.js +187 -0
  238. package/weaponComponent/WeaponComponentHash.js +670 -0
  239. package/weaponComponent/WeaponComponentHashesByWeaponHash.d.ts +1 -1
  240. package/weaponComponent/WeaponComponentHashesByWeaponHash.js +864 -0
  241. package/weaponComponent/WeaponComponentHudStats.js +33 -0
  242. package/common/index.d.ts +0 -8
  243. package/common/utils/Vector2.d.ts +0 -1
  244. package/common/utils/Vector3.d.ts +0 -1
  245. package/common/utils/Vector4.d.ts +0 -1
  246. package/common/utils/index.d.ts +0 -12
  247. package/enums/index.d.ts +0 -42
  248. package/hashes/index.d.ts +0 -5
  249. package/index.d.ts +0 -25
  250. package/index.js +0 -18794
  251. package/models/index.d.ts +0 -18
  252. package/ui/index.d.ts +0 -15
  253. package/ui/interfaces/index.d.ts +0 -2
  254. package/ui/menu/index.d.ts +0 -6
  255. package/ui/menu/items/index.d.ts +0 -6
  256. package/ui/menu/items/panels/index.d.ts +0 -6
  257. package/ui/menu/modules/index.d.ts +0 -1
  258. package/utils/PointF.d.ts +0 -7
  259. package/utils/Quaternion.d.ts +0 -10
  260. package/utils/enumValues.d.ts +0 -12
  261. package/utils/getStringFromUInt8Array.d.ts +0 -8
  262. package/utils/getUInt32FromUint8Array.d.ts +0 -8
  263. package/utils/index.d.ts +0 -9
  264. package/weapon/index.d.ts +0 -8
  265. 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, type HudComponent } from "../enums";
2
- import type { Point } from "../utils";
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
+ };
@@ -1,4 +1,4 @@
1
- import { LoadingSpinnerType } from "../enums";
1
+ import { LoadingSpinnerType } from "fivem/enums/LoadingSpinnerType";
2
2
  /**
3
3
  * Show and hide loading prompt on the bottom right of the screen.
4
4
  *
@@ -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 { type Color, Point, Size } from "../utils";
2
- import { type IDrawable } from "./";
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;
@@ -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
@@ -1,4 +1,5 @@
1
- import type { PointF, Vector3 } from "../utils";
1
+ import type { PointF } from "../common/utils/PointF";
2
+ import type { Vector3 } from "../common/utils/Vector";
2
3
  /**
3
4
  * Scaleforms will automatically load when calling any of the render functions.
4
5
  *
@@ -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 { HudColor, NotificationType } from "../enums";
2
- import { Color, Size, type Vector3 } from "../utils";
3
- import { Notification } from "./";
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;