@nativewrappers/fivem 0.0.80 → 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
@@ -0,0 +1,216 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Control } from "fivem/enums/Control";
4
+ import { Game } from "fivem/Game";
5
+ import { Sprite } from "fivem/ui/Sprite";
6
+ import { Text } from "fivem/ui/Text";
7
+ import { Point } from "fivem/utils/Point";
8
+ import { Size } from "fivem/utils/Size";
9
+ import { Menu } from "../../Menu";
10
+ import { AbstractUIMenuPanel } from "./AbstractUIMenuPanel";
11
+ import { Delay } from "../../../../common/utils/Delay";
12
+ class UIMenuGridPanel extends AbstractUIMenuPanel {
13
+ static {
14
+ __name(this, "UIMenuGridPanel");
15
+ }
16
+ background;
17
+ _isCircleLocked = false;
18
+ _pressed = false;
19
+ _lockXAxis = false;
20
+ _lockYAxis = false;
21
+ _topText;
22
+ _leftText;
23
+ _rightText;
24
+ _bottomText;
25
+ _lastCirclePosition;
26
+ _grid;
27
+ _circle;
28
+ _setCirclePosition;
29
+ constructor(topText, leftText, rightText, bottomText, circlePosition) {
30
+ super();
31
+ this._setCirclePosition = circlePosition || new Point(0.5, 0.5);
32
+ this.background = new Sprite("commonmenu", "gradient_bgd", new Point(), new Size(431, 275));
33
+ this._grid = new Sprite("pause_menu_pages_char_mom_dad", "nose_grid", new Point(), new Size(200, 200));
34
+ this._circle = new Sprite("mpinventory", "in_world_circle", new Point(), new Size(20, 20));
35
+ this.TopText = topText ?? "";
36
+ this.LeftText = leftText ?? "";
37
+ this.RightText = rightText ?? "";
38
+ this.BottomText = bottomText ?? "";
39
+ this._lastCirclePosition = this._setCirclePosition;
40
+ }
41
+ get TopText() {
42
+ return this._topText ? this._topText.caption : "";
43
+ }
44
+ set TopText(value) {
45
+ this._setText("_topText", value);
46
+ }
47
+ get LeftText() {
48
+ return this._leftText ? this._leftText.caption : "";
49
+ }
50
+ set LeftText(value) {
51
+ this._setText("_leftText", value);
52
+ }
53
+ get RightText() {
54
+ return this._rightText ? this._rightText.caption : "";
55
+ }
56
+ set RightText(value) {
57
+ this._setText("_rightText", value);
58
+ }
59
+ get BottomText() {
60
+ return this._bottomText ? this._bottomText.caption : "";
61
+ }
62
+ set BottomText(value) {
63
+ this._setText("_bottomText", value);
64
+ }
65
+ get CirclePosition() {
66
+ return new Point(
67
+ Math.round(
68
+ (this._circle.pos.X - (this._grid.pos.X + 20) + this._circle.size.width / 2) / (this._grid.size.width - 40) * 100
69
+ ) / 100,
70
+ Math.round(
71
+ (this._circle.pos.Y - (this._grid.pos.Y + 20) + this._circle.size.height / 2) / (this._grid.size.height - 40) * 100
72
+ ) / 100
73
+ );
74
+ }
75
+ set CirclePosition(position) {
76
+ this.CirclePositionX = position.X;
77
+ this.CirclePositionY = position.Y;
78
+ }
79
+ set CirclePositionX(x) {
80
+ if (this._isCircleLocked && this._lockXAxis) {
81
+ return;
82
+ }
83
+ x = x >= 0 && x <= 1 ? x : 0;
84
+ this._setCirclePosition.X = x;
85
+ this._circle.pos.X = this._grid.pos.X + 20 + (this._grid.size.width - 40) * x - this._circle.size.width / 2;
86
+ }
87
+ set CirclePositionY(y) {
88
+ if (this._isCircleLocked && this._lockYAxis) {
89
+ return;
90
+ }
91
+ y = y >= 0 && y <= 1 ? y : 0;
92
+ this._setCirclePosition.Y = y;
93
+ this._circle.pos.Y = this._grid.pos.Y + 20 + (this._grid.size.height - 40) * y - this._circle.size.height / 2;
94
+ }
95
+ get LockXAxis() {
96
+ return this._lockXAxis;
97
+ }
98
+ set LockXAxis(value) {
99
+ this._lockXAxis = value;
100
+ if (value) {
101
+ if (this._lockYAxis) {
102
+ this._lockYAxis = false;
103
+ }
104
+ this.CirclePositionX = 0.5;
105
+ }
106
+ }
107
+ get LockYAxis() {
108
+ return this._lockYAxis;
109
+ }
110
+ set LockYAxis(value) {
111
+ this._lockYAxis = value;
112
+ if (value) {
113
+ if (this._lockXAxis) {
114
+ this._lockXAxis = false;
115
+ }
116
+ this.CirclePositionY = 0.5;
117
+ }
118
+ }
119
+ updateParentItem() {
120
+ const last = this._lastCirclePosition;
121
+ const current = this.CirclePosition;
122
+ if (!last || last.X !== current.X || last.Y !== current.Y) {
123
+ this._lastCirclePosition = current;
124
+ if (this.ParentMenu && this.parentItem) {
125
+ this.ParentMenu.panelActivated.emit(this.parentItem, this, current);
126
+ this.parentItem.panelActivated.emit(this, current);
127
+ }
128
+ }
129
+ }
130
+ setVerticalPosition(y) {
131
+ super.setVerticalPosition(y);
132
+ this._grid.pos.Y = y + 37.5;
133
+ if (this._topText) {
134
+ this._topText.pos.Y = y + 5;
135
+ }
136
+ if (this._leftText) {
137
+ this._leftText.pos.Y = y + 120;
138
+ }
139
+ if (this._rightText) {
140
+ this._rightText.pos.Y = y + 120;
141
+ }
142
+ if (this._bottomText) {
143
+ this._bottomText.pos.Y = y + 240;
144
+ }
145
+ }
146
+ draw() {
147
+ if (this.enabled) {
148
+ super.draw();
149
+ const x = this.parentItem?.offset.X ?? 0 + (this.ParentMenu?.WidthOffset ?? 0) / 2;
150
+ this._grid.pos.X = x + 115.5;
151
+ if (!this._isCircleLocked) {
152
+ this.CirclePosition = this._setCirclePosition;
153
+ this._isCircleLocked = true;
154
+ }
155
+ this._grid.draw(Menu.screenResolution);
156
+ this._circle.draw(Menu.screenResolution);
157
+ if (this._topText) {
158
+ this._topText.pos.X = x + 215.5;
159
+ this._topText.draw(void 0, Menu.screenResolution);
160
+ }
161
+ if (this._leftText) {
162
+ this._leftText.pos.X = x + 57.75;
163
+ this._leftText.draw(void 0, Menu.screenResolution);
164
+ }
165
+ if (this._rightText) {
166
+ this._rightText.pos.X = x + 373.25;
167
+ this._rightText.draw(void 0, Menu.screenResolution);
168
+ }
169
+ if (this._bottomText) {
170
+ this._bottomText.pos.X = x + 215.5;
171
+ this._bottomText.draw(void 0, Menu.screenResolution);
172
+ }
173
+ this._processControls();
174
+ }
175
+ }
176
+ _setText(name, value) {
177
+ if (value && value.trim() !== "") {
178
+ if (!this[name]) {
179
+ this[name] = new Text(value, new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Centered);
180
+ } else {
181
+ this[name].caption = value;
182
+ }
183
+ } else if (this[name]) {
184
+ delete this[name];
185
+ }
186
+ }
187
+ _processControls() {
188
+ if (!this._pressed && Game.isDisabledControlJustPressed(0, Control.Attack) && this.ParentMenu?.isMouseInBounds(this._grid.pos, this._grid.size)) {
189
+ this._pressed = true;
190
+ (async () => {
191
+ const drawOffset = this.ParentMenu?.DrawOffset ?? new Point(0, 0);
192
+ while (Game.isDisabledControlPressed(0, Control.Attack)) {
193
+ await Delay(0);
194
+ let cX = (GetControlNormal(0, Control.CursorX) - drawOffset.X) * Menu.screenWidth;
195
+ let cY = (GetControlNormal(0, Control.CursorY) - drawOffset.Y) * Menu.screenHeight;
196
+ cX -= this._circle.size.width / 2;
197
+ cY -= this._circle.size.height / 2;
198
+ this._circle.pos.X = cX > this._grid.pos.X + 10 + this._grid.size.width - (this._lockXAxis ? 120 : 40) ? this._grid.pos.X + 10 + this._grid.size.width - (this._lockXAxis ? 120 : 40) : cX < this._grid.pos.X + (this._lockXAxis ? 100 : 20) - this._circle.size.width / 2 ? this._grid.pos.X + (this._lockXAxis ? 100 : 20) - this._circle.size.width / 2 : cX;
199
+ this._circle.pos.Y = cY > this._grid.pos.Y + 10 + this._grid.size.height - (this._lockYAxis ? 120 : 40) ? this._grid.pos.Y + 10 + this._grid.size.height - (this._lockYAxis ? 120 : 40) : cY < this._grid.pos.Y + (this._lockYAxis ? 100 : 20) - this._circle.size.height / 2 ? this._grid.pos.Y + (this._lockYAxis ? 100 : 20) - this._circle.size.height / 2 : cY;
200
+ }
201
+ this.updateParentItem();
202
+ this._pressed = false;
203
+ })();
204
+ const interval = setInterval(async () => {
205
+ if (Game.isDisabledControlPressed(0, Control.Attack)) {
206
+ this.updateParentItem();
207
+ } else {
208
+ clearInterval(interval);
209
+ }
210
+ }, 75);
211
+ }
212
+ }
213
+ }
214
+ export {
215
+ UIMenuGridPanel
216
+ };
@@ -1,5 +1,5 @@
1
- import { AbstractUIMenuPanel } from "./";
2
- import { Sprite } from "../../../";
1
+ import { Sprite } from "fivem/ui/Sprite";
2
+ import { AbstractUIMenuPanel } from "./AbstractUIMenuPanel";
3
3
  export declare class UIMenuPercentagePanel extends AbstractUIMenuPanel {
4
4
  protected readonly background: Sprite;
5
5
  private _pressed;
@@ -0,0 +1,138 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Color } from "../../../../common/utils/Color";
4
+ import { Alignment } from "fivem/enums/Alignment";
5
+ import { Control } from "fivem/enums/Control";
6
+ import { Font } from "fivem/enums/Font";
7
+ import { Game } from "fivem/Game";
8
+ import { Rectangle } from "fivem/ui/Rectangle";
9
+ import { Sprite } from "fivem/ui/Sprite";
10
+ import { Text } from "fivem/ui/Text";
11
+ import { Point } from "fivem/utils/Point";
12
+ import { Size } from "fivem/utils/Size";
13
+ import { Menu } from "../../Menu";
14
+ import { AbstractUIMenuPanel } from "./AbstractUIMenuPanel";
15
+ import { Delay } from "../../../../common/utils/Delay";
16
+ class UIMenuPercentagePanel extends AbstractUIMenuPanel {
17
+ static {
18
+ __name(this, "UIMenuPercentagePanel");
19
+ }
20
+ background;
21
+ _pressed = false;
22
+ _lastPercentage;
23
+ _title;
24
+ _minText;
25
+ _maxText;
26
+ _activeBar;
27
+ _backgroundBar;
28
+ constructor(title = "", percentage = 0, minText, maxText) {
29
+ super();
30
+ this.background = new Sprite("commonmenu", "gradient_bgd", new Point(), new Size(431, 76));
31
+ const barSize = new Size(413, 10);
32
+ this._activeBar = new Rectangle(new Point(), barSize, Color.fromRgb(245, 245, 245));
33
+ this._backgroundBar = new Rectangle(new Point(), { ...barSize }, Color.fromRgb(87, 87, 87));
34
+ this._title = new Text("", new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Centered);
35
+ this._minText = new Text("", new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Centered);
36
+ this._maxText = new Text("", new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Centered);
37
+ this.Title = title;
38
+ this.MinText = minText || "0%";
39
+ this.MaxText = maxText || "100%";
40
+ this.Percentage = percentage;
41
+ this._lastPercentage = percentage;
42
+ }
43
+ get Title() {
44
+ return this._title.caption;
45
+ }
46
+ set Title(value) {
47
+ this._title.caption = value ? value.trim() : "";
48
+ }
49
+ get MinText() {
50
+ return this._minText.caption;
51
+ }
52
+ set MinText(value) {
53
+ this._minText.caption = value ? value.trim() : "";
54
+ }
55
+ get MaxText() {
56
+ return this._maxText.caption;
57
+ }
58
+ set MaxText(value) {
59
+ this._maxText.caption = value ? value.trim() : "";
60
+ }
61
+ get Percentage() {
62
+ const progress = this._activeBar.size.width / this._backgroundBar.size.width;
63
+ return Math.round(progress * 100) / 100;
64
+ }
65
+ set Percentage(value) {
66
+ value = value || 0;
67
+ value = value < 0 ? 0 : value > 1 ? 1 : value;
68
+ this._activeBar.size.width = this._backgroundBar.size.width * value;
69
+ }
70
+ updateParentItem() {
71
+ const last = this._lastPercentage;
72
+ const current = this.Percentage;
73
+ if (last !== current) {
74
+ this._lastPercentage = current;
75
+ if (this.ParentMenu && this.parentItem) {
76
+ this.ParentMenu.panelActivated.emit(this.parentItem, this, current);
77
+ this.parentItem.panelActivated.emit(this, current);
78
+ }
79
+ }
80
+ }
81
+ setVerticalPosition(y) {
82
+ super.setVerticalPosition(y);
83
+ this._activeBar.pos.Y = y + 50;
84
+ this._backgroundBar.pos.Y = y + 50;
85
+ y += 15;
86
+ this._minText.pos.Y = y;
87
+ this._title.pos.Y = y;
88
+ this._maxText.pos.Y = y;
89
+ }
90
+ draw() {
91
+ if (this.enabled) {
92
+ super.draw();
93
+ const x = this.parentItem?.offset.X ?? 0 + (this.ParentMenu?.WidthOffset ?? 0) / 2;
94
+ this._activeBar.pos.X = x + 9;
95
+ this._backgroundBar.pos.X = x + 9;
96
+ this._minText.pos.X = x + 25;
97
+ this._title.pos.X = x + 215.5;
98
+ this._maxText.pos.X = x + 398;
99
+ this._backgroundBar.draw(void 0, Menu.screenResolution);
100
+ this._activeBar.draw(void 0, Menu.screenResolution);
101
+ this._minText.draw(void 0, Menu.screenResolution);
102
+ this._title.draw(void 0, Menu.screenResolution);
103
+ this._maxText.draw(void 0, Menu.screenResolution);
104
+ this._processControls();
105
+ }
106
+ }
107
+ _processControls() {
108
+ if (!this._pressed && Game.isDisabledControlJustPressed(0, Control.Attack) && this.ParentMenu?.isMouseInBounds(
109
+ new Point(this._backgroundBar.pos.X, this._backgroundBar.pos.Y - 4),
110
+ new Size(this._backgroundBar.size.width, this._backgroundBar.size.height + 8)
111
+ )) {
112
+ this._pressed = true;
113
+ (async () => {
114
+ while (Game.isDisabledControlPressed(0, Control.Attack)) {
115
+ await Delay(0);
116
+ this._activeBar.size.width = this._getProgress();
117
+ }
118
+ this.updateParentItem();
119
+ this._pressed = false;
120
+ })();
121
+ const interval = setInterval(async () => {
122
+ if (Game.isDisabledControlPressed(0, Control.Attack)) {
123
+ this.updateParentItem();
124
+ } else {
125
+ clearInterval(interval);
126
+ }
127
+ }, 75);
128
+ }
129
+ }
130
+ _getProgress() {
131
+ const drawOffset = this.ParentMenu?.DrawOffset ?? new Point(0, 0);
132
+ const progress = (GetControlNormal(0, 239) - drawOffset.X) * Menu.screenWidth - this._activeBar.pos.X;
133
+ return progress < 0 ? 0 : progress > 413 ? 413 : progress;
134
+ }
135
+ }
136
+ export {
137
+ UIMenuPercentagePanel
138
+ };
@@ -1,5 +1,6 @@
1
- import { AbstractUIMenuPanel, type UIMenuStatisticsPanelItem } from "./";
2
- import { Rectangle } from "../../../";
1
+ import { Rectangle } from "fivem/ui/Rectangle";
2
+ import { AbstractUIMenuPanel } from "./AbstractUIMenuPanel";
3
+ import type { UIMenuStatisticsPanelItem } from "./UIMenuStatisticsPanelItem";
3
4
  export declare class UIMenuStatisticsPanel extends AbstractUIMenuPanel {
4
5
  protected readonly background: Rectangle;
5
6
  private _divider;
@@ -0,0 +1,88 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Color } from "../../../../common/utils/Color";
4
+ import { Rectangle } from "fivem/ui/Rectangle";
5
+ import { Point } from "fivem/utils/Point";
6
+ import { Size } from "fivem/utils/Size";
7
+ import { Menu } from "../../Menu";
8
+ import { AbstractUIMenuPanel } from "./AbstractUIMenuPanel";
9
+ class UIMenuStatisticsPanel extends AbstractUIMenuPanel {
10
+ static {
11
+ __name(this, "UIMenuStatisticsPanel");
12
+ }
13
+ background;
14
+ _divider = true;
15
+ _items = [];
16
+ constructor(item, divider = true) {
17
+ super();
18
+ this.background = new Rectangle(new Point(), new Size(431, 47), new Color(0, 0, 0, 170));
19
+ if (item) {
20
+ this.addItem(item);
21
+ }
22
+ this.Divider = divider;
23
+ }
24
+ get Divider() {
25
+ return this._divider;
26
+ }
27
+ set Divider(value) {
28
+ this._divider = value || false;
29
+ }
30
+ get Items() {
31
+ return this._items;
32
+ }
33
+ set Items(value) {
34
+ this._items = value;
35
+ }
36
+ addItem(item) {
37
+ const items = Array.isArray(item) ? item : [item];
38
+ this._items.push(...items);
39
+ }
40
+ removeItem(itemOrIndex) {
41
+ if (typeof itemOrIndex === "number") {
42
+ this._items = this._items.filter((i, index) => index !== itemOrIndex);
43
+ } else {
44
+ this._items = this._items.filter((i) => i.id !== itemOrIndex.id);
45
+ }
46
+ }
47
+ setVerticalPosition(y) {
48
+ super.setVerticalPosition(y);
49
+ this._items.forEach(async (item, index) => {
50
+ const itemCountOffset = 40 * (index + 1);
51
+ const yOffset = y + itemCountOffset - 22;
52
+ item.backgroundBar.pos.Y = yOffset;
53
+ item.activeBar.pos.Y = yOffset;
54
+ item.text.pos.Y = yOffset - 12;
55
+ if (this._divider) {
56
+ item.divider.forEach(async (divider) => {
57
+ divider.pos.Y = yOffset;
58
+ });
59
+ }
60
+ });
61
+ }
62
+ draw() {
63
+ if (this.enabled) {
64
+ super.draw();
65
+ const x = this.parentItem?.offset.X ?? 0 + (this.ParentMenu?.WidthOffset ?? 0) / 2;
66
+ this._items.forEach(async (item, index) => {
67
+ const itemCountOffset = 40 * (index + 1);
68
+ item.backgroundBar.pos.X = x + 200;
69
+ item.activeBar.pos.X = x + 200;
70
+ item.text.pos.X = x + 13;
71
+ item.backgroundBar.draw(void 0, Menu.screenResolution);
72
+ item.activeBar.draw(void 0, Menu.screenResolution);
73
+ item.text.draw(void 0, Menu.screenResolution);
74
+ if (this._divider) {
75
+ item.divider.forEach(async (divider, index2) => {
76
+ const dividerWidthOffset = (index2 + 1) * 40;
77
+ divider.pos.X = x + dividerWidthOffset + 200;
78
+ this.background.size.height = itemCountOffset + 47 - 39;
79
+ divider.draw(void 0, Menu.screenResolution);
80
+ });
81
+ }
82
+ });
83
+ }
84
+ }
85
+ }
86
+ export {
87
+ UIMenuStatisticsPanel
88
+ };
@@ -1,4 +1,5 @@
1
- import { Rectangle, Text } from "../../../";
1
+ import { Rectangle } from "fivem/ui/Rectangle";
2
+ import { Text } from "fivem/ui/Text";
2
3
  export declare class UIMenuStatisticsPanelItem {
3
4
  readonly id: string;
4
5
  readonly text: Text;
@@ -0,0 +1,48 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Color } from "../../../../common/utils/Color";
4
+ import { Alignment } from "fivem/enums/Alignment";
5
+ import { Font } from "fivem/enums/Font";
6
+ import { Rectangle } from "fivem/ui/Rectangle";
7
+ import { Text } from "fivem/ui/Text";
8
+ import { Crypto } from "fivem/utils/Crypto";
9
+ import { Point } from "fivem/utils/Point";
10
+ import { Size } from "fivem/utils/Size";
11
+ class UIMenuStatisticsPanelItem {
12
+ static {
13
+ __name(this, "UIMenuStatisticsPanelItem");
14
+ }
15
+ id = Crypto.uuidv4();
16
+ text;
17
+ activeBar;
18
+ backgroundBar;
19
+ divider = [];
20
+ constructor(name, percentage = 0) {
21
+ this.text = new Text("", new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Left);
22
+ this.backgroundBar = new Rectangle(new Point(), new Size(200, 10), Color.fromArgb(100, 87, 87, 87));
23
+ this.activeBar = new Rectangle(new Point(), new Size(0, 10), Color.White);
24
+ for (let i = 1; i <= 4; i++) {
25
+ this.divider.push(new Rectangle(new Point(), new Size(2, 10), Color.Black));
26
+ }
27
+ this.Name = name;
28
+ this.Percentage = percentage;
29
+ }
30
+ get Name() {
31
+ return this.text.caption;
32
+ }
33
+ set Name(value) {
34
+ this.text.caption = value ? value.trim() : "";
35
+ }
36
+ get Percentage() {
37
+ return this.activeBar.size.width / 200;
38
+ }
39
+ set Percentage(value) {
40
+ value = value || 0;
41
+ value = Math.round(value * 100) / 100;
42
+ value = value < 0 ? 0 : value > 1 ? 1 : value;
43
+ this.activeBar.size.width = value * 200;
44
+ }
45
+ }
46
+ export {
47
+ UIMenuStatisticsPanelItem
48
+ };
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Crypto } from "fivem/utils/Crypto";
4
+ class ListItem {
5
+ static {
6
+ __name(this, "ListItem");
7
+ }
8
+ id = Crypto.uuidv4();
9
+ name;
10
+ value;
11
+ constructor(name, value = null) {
12
+ this.name = name;
13
+ this.value = value;
14
+ }
15
+ }
16
+ export {
17
+ ListItem
18
+ };
@@ -0,0 +1,43 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { Delay } from "../common/utils/Delay";
4
+ const LoadAnimDict = /* @__PURE__ */ __name(async (animDict, waitTime = 1e3) => {
5
+ const start = GetGameTimer();
6
+ if (!HasAnimDictLoaded(animDict)) {
7
+ RequestAnimDict(animDict);
8
+ }
9
+ while (!HasAnimDictLoaded(animDict)) {
10
+ if (GetGameTimer() - start >= waitTime) return false;
11
+ await Delay(0);
12
+ }
13
+ return true;
14
+ }, "LoadAnimDict");
15
+ const LoadAnimDictArray = /* @__PURE__ */ __name(async (animDict, waitTime = 1e3) => {
16
+ const start = GetGameTimer();
17
+ for (const dict of animDict) {
18
+ if (!HasAnimDictLoaded(dict)) {
19
+ RequestAnimDict(dict);
20
+ }
21
+ }
22
+ const animsLoaded = /* @__PURE__ */ new Set();
23
+ while (animsLoaded.size !== animDict.length) {
24
+ for (const dict of animDict) {
25
+ if (!animsLoaded.has(dict) && HasAnimDictLoaded(dict)) {
26
+ animsLoaded.add(dict);
27
+ }
28
+ }
29
+ if (GetGameTimer() - start >= waitTime) return [false, animDict.filter((dict) => !animsLoaded.has(dict))];
30
+ await Delay(0);
31
+ }
32
+ return [true, null];
33
+ }, "LoadAnimDictArray");
34
+ const RemoveAnimDictArray = /* @__PURE__ */ __name((animDict) => {
35
+ for (const dict of animDict) {
36
+ RemoveAnimDict(dict);
37
+ }
38
+ }, "RemoveAnimDictArray");
39
+ export {
40
+ LoadAnimDict,
41
+ LoadAnimDictArray,
42
+ RemoveAnimDictArray
43
+ };
@@ -0,0 +1,33 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ class Crypto {
4
+ static {
5
+ __name(this, "Crypto");
6
+ }
7
+ static uuidv4() {
8
+ let uuid = "";
9
+ for (let ii = 0; ii < 32; ii += 1) {
10
+ switch (ii) {
11
+ case 8:
12
+ case 20:
13
+ uuid += "-";
14
+ uuid += (Math.random() * 16 | 0).toString(16);
15
+ break;
16
+ case 12:
17
+ uuid += "-";
18
+ uuid += "4";
19
+ break;
20
+ case 16:
21
+ uuid += "-";
22
+ uuid += (Math.random() * 4 | 8).toString(16);
23
+ break;
24
+ default:
25
+ uuid += (Math.random() * 16 | 0).toString(16);
26
+ }
27
+ }
28
+ return uuid;
29
+ }
30
+ }
31
+ export {
32
+ Crypto
33
+ };
@@ -0,0 +1,25 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ class LiteEvent {
4
+ static {
5
+ __name(this, "LiteEvent");
6
+ }
7
+ handlers = [];
8
+ on(handler) {
9
+ this.handlers.push(handler);
10
+ }
11
+ off(handler) {
12
+ this.handlers = this.handlers.filter((h) => h !== handler);
13
+ }
14
+ emit(...args) {
15
+ this.handlers.slice(0).forEach((h) => {
16
+ h(...args);
17
+ });
18
+ }
19
+ expose() {
20
+ return this;
21
+ }
22
+ }
23
+ export {
24
+ LiteEvent
25
+ };
package/utils/Maths.js ADDED
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ class Maths {
4
+ static {
5
+ __name(this, "Maths");
6
+ }
7
+ static clamp(num, min, max) {
8
+ return num <= min ? min : num >= max ? max : num;
9
+ }
10
+ static getRandomInt(min, max) {
11
+ min = Math.ceil(min);
12
+ max = Math.floor(max);
13
+ return Math.floor(Math.random() * (max - min)) + min;
14
+ }
15
+ }
16
+ export {
17
+ Maths
18
+ };