@nativewrappers/fivem 0.0.65 → 0.0.72

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 (241) hide show
  1. package/Audio.d.ts +2 -2
  2. package/Blip.d.ts +2 -2
  3. package/Camera.d.ts +1 -1
  4. package/Game.d.ts +1 -1
  5. package/GameplayCamera.d.ts +1 -1
  6. package/Model.d.ts +1 -1
  7. package/ParticleEffect.d.ts +2 -2
  8. package/ParticleEffectAsset.d.ts +1 -1
  9. package/README.md +45 -0
  10. package/Raycast.d.ts +2 -2
  11. package/RelationshipGroup.d.ts +1 -1
  12. package/Tasks.d.ts +3 -3
  13. package/World.d.ts +2 -2
  14. package/cfx/StateBagChangeHandler.d.ts +1 -3
  15. package/common/Command.d.ts +30 -0
  16. package/common/Convar.d.ts +13 -0
  17. package/common/GlobalData.d.ts +8 -0
  18. package/common/Kvp.d.ts +69 -0
  19. package/common/Resource.d.ts +14 -0
  20. package/common/decors/Events.d.ts +54 -0
  21. package/common/index.d.ts +8 -0
  22. package/common/net/NetworkedMap.d.ts +28 -0
  23. package/common/types.d.ts +5 -0
  24. package/common/utils/ClassTypes.d.ts +11 -0
  25. package/common/utils/Color.d.ts +14 -0
  26. package/common/utils/Maths.d.ts +4 -0
  27. package/common/utils/PointF.d.ts +12 -0
  28. package/common/utils/Quaternion.d.ts +10 -0
  29. package/common/utils/Vector.d.ts +429 -0
  30. package/common/utils/Vector2.d.ts +1 -0
  31. package/common/utils/Vector3.d.ts +1 -0
  32. package/common/utils/Vector4.d.ts +1 -0
  33. package/common/utils/cleanPlayerName.d.ts +6 -0
  34. package/common/utils/enumValues.d.ts +12 -0
  35. package/{utils/getStringFromUInt8Array.js → common/utils/getStringFromUInt8Array.d.ts} +1 -3
  36. package/{utils/getUInt32FromUint8Array.js → common/utils/getUInt32FromUint8Array.d.ts} +1 -1
  37. package/common/utils/index.d.ts +12 -0
  38. package/index.d.ts +1 -1
  39. package/index.js +20136 -26
  40. package/interfaces/Dimensions.d.ts +1 -1
  41. package/models/BaseEntity.d.ts +3 -3
  42. package/models/Ped.d.ts +2 -2
  43. package/models/PedBone.d.ts +1 -1
  44. package/models/PedBoneCollection.d.ts +1 -1
  45. package/models/Player.d.ts +1 -1
  46. package/models/Vehicle.d.ts +2 -2
  47. package/models/VehicleDoor.d.ts +2 -2
  48. package/models/VehicleDoorCollection.d.ts +1 -1
  49. package/models/VehicleMod.d.ts +2 -2
  50. package/models/VehicleModCollection.d.ts +2 -2
  51. package/models/VehicleToggleMod.d.ts +2 -2
  52. package/models/VehicleWheel.d.ts +1 -1
  53. package/models/VehicleWheelCollection.d.ts +1 -1
  54. package/models/VehicleWindow.d.ts +2 -2
  55. package/models/VehicleWindowCollection.d.ts +1 -1
  56. package/package.json +6 -4
  57. package/ui/Container.d.ts +2 -2
  58. package/ui/Effects.d.ts +1 -1
  59. package/ui/Hud.d.ts +2 -2
  60. package/ui/InstructionalButtons.d.ts +1 -1
  61. package/ui/Rectangle.d.ts +2 -2
  62. package/ui/Scaleform.d.ts +1 -1
  63. package/ui/Screen.d.ts +1 -1
  64. package/ui/Text.d.ts +1 -1
  65. package/ui/interfaces/IButton.d.ts +1 -1
  66. package/ui/interfaces/IDrawable.d.ts +1 -1
  67. package/ui/menu/items/UIMenuItem.d.ts +1 -1
  68. package/ui/menu/items/UIMenuListItem.d.ts +1 -1
  69. package/ui/menu/items/panels/AbstractUIMenuPanel.d.ts +2 -2
  70. package/ui/menu/items/panels/UIMenuStatisticsPanel.d.ts +1 -1
  71. package/utils/LiteEvent.d.ts +2 -6
  72. package/utils/index.d.ts +1 -1
  73. package/weapon/DlcWeaponData.d.ts +1 -1
  74. package/weapon/Weapon.d.ts +7 -7
  75. package/weapon/WeaponAsset.d.ts +1 -1
  76. package/weapon/WeaponCollection.d.ts +2 -2
  77. package/weaponComponent/DlcWeaponComponentData.d.ts +1 -1
  78. package/weaponComponent/InvalidWeaponComponent.d.ts +1 -1
  79. package/weaponComponent/WeaponComponent.d.ts +3 -3
  80. package/weaponComponent/WeaponComponentCollection.d.ts +3 -3
  81. package/Audio.js +0 -93
  82. package/Blip.js +0 -105
  83. package/Camera.js +0 -162
  84. package/Checkpoint.js +0 -43
  85. package/Events.js +0 -74
  86. package/Game.js +0 -474
  87. package/GameplayCamera.js +0 -141
  88. package/Model.js +0 -213
  89. package/NetworkedScene.js +0 -18
  90. package/ParticleEffect.js +0 -123
  91. package/ParticleEffectAsset.js +0 -105
  92. package/Pickup.js +0 -19
  93. package/Raycast.js +0 -123
  94. package/RelationshipGroup.js +0 -67
  95. package/Rope.js +0 -129
  96. package/TaskSequence.js +0 -48
  97. package/Tasks.js +0 -241
  98. package/World.js +0 -765
  99. package/cfx/StateBagChangeHandler.js +0 -1
  100. package/cfx/index.js +0 -1
  101. package/enums/Alignment.js +0 -6
  102. package/enums/AnimationFlags.js +0 -35
  103. package/enums/AudioFlag.js +0 -38
  104. package/enums/BadgeStyle.js +0 -183
  105. package/enums/Blip.js +0 -225
  106. package/enums/Bone.js +0 -103
  107. package/enums/CameraShake.js +0 -14
  108. package/enums/CameraTypes.js +0 -8
  109. package/enums/CheckboxStyle.js +0 -5
  110. package/enums/Checkpoint.js +0 -67
  111. package/enums/CloudHat.js +0 -27
  112. package/enums/Control.js +0 -361
  113. package/enums/CursorSprite.js +0 -15
  114. package/enums/Driving.js +0 -34
  115. package/enums/ExplosionType.js +0 -45
  116. package/enums/FiringPattern.js +0 -20
  117. package/enums/Font.js +0 -8
  118. package/enums/ForceType.js +0 -9
  119. package/enums/Gender.js +0 -5
  120. package/enums/HelmetType.js +0 -6
  121. package/enums/HudColor.js +0 -184
  122. package/enums/HudComponent.js +0 -54
  123. package/enums/InputMode.js +0 -5
  124. package/enums/InvertAxis.js +0 -7
  125. package/enums/Language.js +0 -15
  126. package/enums/LeaveVehicleFlags.js +0 -11
  127. package/enums/LoadingSpinnerType.js +0 -8
  128. package/enums/MarkerType.js +0 -50
  129. package/enums/MenuAlignment.js +0 -5
  130. package/enums/NotificationType.js +0 -11
  131. package/enums/Parachute.js +0 -15
  132. package/enums/PickupType.js +0 -74
  133. package/enums/RadioStation.js +0 -25
  134. package/enums/RagdollType.js +0 -7
  135. package/enums/RaycastEnums.js +0 -32
  136. package/enums/Relationship.js +0 -10
  137. package/enums/RopeType.js +0 -6
  138. package/enums/ScreenEffect.js +0 -84
  139. package/enums/SpeechModifier.js +0 -40
  140. package/enums/Vehicle.js +0 -376
  141. package/enums/Weather.js +0 -22
  142. package/enums/ZoneID.js +0 -95
  143. package/enums/index.js +0 -42
  144. package/hashes/MaterialHash.js +0 -217
  145. package/hashes/PedHash.js +0 -725
  146. package/hashes/VehicleHash.js +0 -523
  147. package/hashes/WeaponHash.js +0 -161
  148. package/hashes/WeatherTypeHash.js +0 -22
  149. package/hashes/index.js +0 -5
  150. package/interfaces/Dimensions.js +0 -1
  151. package/models/BaseEntity.js +0 -477
  152. package/models/Entity.js +0 -25
  153. package/models/EntityBone.js +0 -26
  154. package/models/EntityBoneCollection.js +0 -18
  155. package/models/Ped.js +0 -692
  156. package/models/PedBone.js +0 -9
  157. package/models/PedBoneCollection.js +0 -21
  158. package/models/Player.js +0 -186
  159. package/models/Prop.js +0 -26
  160. package/models/Vehicle.js +0 -576
  161. package/models/VehicleDoor.js +0 -44
  162. package/models/VehicleDoorCollection.js +0 -62
  163. package/models/VehicleMod.js +0 -35
  164. package/models/VehicleModCollection.js +0 -227
  165. package/models/VehicleToggleMod.js +0 -29
  166. package/models/VehicleWheel.js +0 -23
  167. package/models/VehicleWheelCollection.js +0 -57
  168. package/models/VehicleWindow.js +0 -35
  169. package/models/VehicleWindowCollection.js +0 -57
  170. package/models/index.js +0 -19
  171. package/ui/Container.js +0 -31
  172. package/ui/Effects.js +0 -106
  173. package/ui/Fading.js +0 -69
  174. package/ui/Hud.js +0 -39
  175. package/ui/InstructionalButtons.js +0 -54
  176. package/ui/LoadingPrompt.js +0 -45
  177. package/ui/Notification.js +0 -9
  178. package/ui/Rectangle.js +0 -40
  179. package/ui/Scaleform.js +0 -236
  180. package/ui/Screen.js +0 -72
  181. package/ui/Sprite.js +0 -60
  182. package/ui/Text.js +0 -115
  183. package/ui/Timerbar.js +0 -248
  184. package/ui/index.js +0 -15
  185. package/ui/interfaces/IButton.js +0 -1
  186. package/ui/interfaces/IDrawable.js +0 -1
  187. package/ui/interfaces/index.js +0 -1
  188. package/ui/menu/Menu.js +0 -831
  189. package/ui/menu/MenuControl.js +0 -12
  190. package/ui/menu/MenuControls.js +0 -9
  191. package/ui/menu/MenuSettings.js +0 -54
  192. package/ui/menu/index.js +0 -6
  193. package/ui/menu/items/UIMenuCheckboxItem.js +0 -59
  194. package/ui/menu/items/UIMenuItem.js +0 -1111
  195. package/ui/menu/items/UIMenuListItem.js +0 -119
  196. package/ui/menu/items/UIMenuSeparatorItem.js +0 -29
  197. package/ui/menu/items/UIMenuSliderItem.js +0 -191
  198. package/ui/menu/items/index.js +0 -6
  199. package/ui/menu/items/panels/AbstractUIMenuPanel.js +0 -44
  200. package/ui/menu/items/panels/UIMenuColorPanel.js +0 -217
  201. package/ui/menu/items/panels/UIMenuGridPanel.js +0 -261
  202. package/ui/menu/items/panels/UIMenuPercentagePanel.js +0 -124
  203. package/ui/menu/items/panels/UIMenuStatisticsPanel.js +0 -79
  204. package/ui/menu/items/panels/UIMenuStatisticsPanelItem.js +0 -35
  205. package/ui/menu/items/panels/index.js +0 -6
  206. package/ui/menu/modules/ListItem.js +0 -10
  207. package/ui/menu/modules/index.js +0 -1
  208. package/utils/Animations.js +0 -55
  209. package/utils/Crypto.js +0 -25
  210. package/utils/LiteEvent.js +0 -19
  211. package/utils/Maths.js +0 -10
  212. package/utils/Point.js +0 -30
  213. package/utils/PointF.js +0 -14
  214. package/utils/Quaternion.js +0 -27
  215. package/utils/Size.js +0 -8
  216. package/utils/String.js +0 -25
  217. package/utils/enumValues.js +0 -14
  218. package/utils/index.js +0 -9
  219. package/weapon/DlcWeaponData.js +0 -44
  220. package/weapon/Mk2WeaponHash.js +0 -25
  221. package/weapon/Weapon.js +0 -270
  222. package/weapon/WeaponAsset.js +0 -84
  223. package/weapon/WeaponCollection.js +0 -187
  224. package/weapon/WeaponDisplayNameByHash.js +0 -75
  225. package/weapon/WeaponGroup.js +0 -19
  226. package/weapon/WeaponHudStats.js +0 -38
  227. package/weapon/WeaponLivery.js +0 -14
  228. package/weapon/WeaponLiveryColor.js +0 -35
  229. package/weapon/WeaponTint.js +0 -43
  230. package/weapon/index.js +0 -8
  231. package/weaponComponent/ComponentAttachmentPoint.js +0 -19
  232. package/weaponComponent/ComponentAttachmentPointByHash.js +0 -573
  233. package/weaponComponent/ComponentDisplayNameByHash.js +0 -280
  234. package/weaponComponent/DlcWeaponComponentData.js +0 -44
  235. package/weaponComponent/InvalidWeaponComponent.js +0 -28
  236. package/weaponComponent/WeaponComponent.js +0 -123
  237. package/weaponComponent/WeaponComponentCollection.js +0 -174
  238. package/weaponComponent/WeaponComponentHash.js +0 -887
  239. package/weaponComponent/WeaponComponentHashesByWeaponHash.js +0 -829
  240. package/weaponComponent/WeaponComponentHudStats.js +0 -34
  241. package/weaponComponent/index.js +0 -5
@@ -1,261 +0,0 @@
1
- /* eslint-disable @typescript-eslint/ban-ts-comment */
2
- import { Color, Point, Size, Wait } from "../../../../utils";
3
- import { AbstractUIMenuPanel } from "./";
4
- import { Menu, Sprite, Text } from "../../../";
5
- import { Alignment, Control, Font } from "../../../../enums";
6
- import { Game } from "../../../../Game";
7
- export class UIMenuGridPanel extends AbstractUIMenuPanel {
8
- background;
9
- _isCircleLocked = false;
10
- _pressed = false;
11
- _lockXAxis = false;
12
- _lockYAxis = false;
13
- _topText;
14
- _leftText;
15
- _rightText;
16
- _bottomText;
17
- _lastCirclePosition;
18
- _grid;
19
- _circle;
20
- _setCirclePosition;
21
- constructor(topText, leftText, rightText, bottomText, circlePosition) {
22
- super();
23
- this._setCirclePosition = circlePosition || new Point(0.5, 0.5);
24
- this.background = new Sprite("commonmenu", "gradient_bgd", new Point(), new Size(431, 275));
25
- this._grid = new Sprite("pause_menu_pages_char_mom_dad", "nose_grid", new Point(), new Size(200, 200));
26
- this._circle = new Sprite("mpinventory", "in_world_circle", new Point(), new Size(20, 20));
27
- this.TopText = topText ?? "";
28
- this.LeftText = leftText ?? "";
29
- this.RightText = rightText ?? "";
30
- this.BottomText = bottomText ?? "";
31
- this._lastCirclePosition = this._setCirclePosition;
32
- }
33
- get TopText() {
34
- return this._topText ? this._topText.caption : "";
35
- }
36
- set TopText(value) {
37
- this._setText("_topText", value);
38
- }
39
- get LeftText() {
40
- return this._leftText ? this._leftText.caption : "";
41
- }
42
- set LeftText(value) {
43
- this._setText("_leftText", value);
44
- }
45
- get RightText() {
46
- return this._rightText ? this._rightText.caption : "";
47
- }
48
- set RightText(value) {
49
- this._setText("_rightText", value);
50
- }
51
- get BottomText() {
52
- return this._bottomText ? this._bottomText.caption : "";
53
- }
54
- set BottomText(value) {
55
- this._setText("_bottomText", value);
56
- }
57
- get CirclePosition() {
58
- return new Point(Math.round(((this._circle.pos.X -
59
- (this._grid.pos.X + 20) +
60
- this._circle.size.width / 2) /
61
- (this._grid.size.width - 40)) *
62
- 100) / 100, Math.round(((this._circle.pos.Y -
63
- (this._grid.pos.Y + 20) +
64
- this._circle.size.height / 2) /
65
- (this._grid.size.height - 40)) *
66
- 100) / 100);
67
- }
68
- set CirclePosition(position) {
69
- this.CirclePositionX = position.X;
70
- this.CirclePositionY = position.Y;
71
- }
72
- set CirclePositionX(x) {
73
- if (this._isCircleLocked && this._lockXAxis) {
74
- return;
75
- }
76
- x = x >= 0 && x <= 1 ? x : 0;
77
- this._setCirclePosition.X = x;
78
- this._circle.pos.X =
79
- this._grid.pos.X +
80
- 20 +
81
- (this._grid.size.width - 40) * x -
82
- this._circle.size.width / 2;
83
- }
84
- set CirclePositionY(y) {
85
- if (this._isCircleLocked && this._lockYAxis) {
86
- return;
87
- }
88
- y = y >= 0 && y <= 1 ? y : 0;
89
- this._setCirclePosition.Y = y;
90
- this._circle.pos.Y =
91
- this._grid.pos.Y +
92
- 20 +
93
- (this._grid.size.height - 40) * y -
94
- this._circle.size.height / 2;
95
- }
96
- get LockXAxis() {
97
- return this._lockXAxis;
98
- }
99
- set LockXAxis(value) {
100
- this._lockXAxis = value;
101
- if (value) {
102
- if (this._lockYAxis) {
103
- this._lockYAxis = false;
104
- }
105
- this.CirclePositionX = 0.5;
106
- }
107
- }
108
- get LockYAxis() {
109
- return this._lockYAxis;
110
- }
111
- set LockYAxis(value) {
112
- this._lockYAxis = value;
113
- if (value) {
114
- if (this._lockXAxis) {
115
- this._lockXAxis = false;
116
- }
117
- this.CirclePositionY = 0.5;
118
- }
119
- }
120
- updateParentItem() {
121
- const last = this._lastCirclePosition;
122
- const current = this.CirclePosition;
123
- if (!last || last.X !== current.X || last.Y !== current.Y) {
124
- this._lastCirclePosition = current;
125
- if (this.ParentMenu && this.parentItem) {
126
- this.ParentMenu.panelActivated.emit(this.parentItem, this, current);
127
- this.parentItem.panelActivated.emit(this, current);
128
- }
129
- }
130
- }
131
- setVerticalPosition(y) {
132
- super.setVerticalPosition(y);
133
- this._grid.pos.Y = y + 37.5;
134
- if (this._topText) {
135
- this._topText.pos.Y = y + 5;
136
- }
137
- if (this._leftText) {
138
- this._leftText.pos.Y = y + 120;
139
- }
140
- if (this._rightText) {
141
- this._rightText.pos.Y = y + 120;
142
- }
143
- if (this._bottomText) {
144
- this._bottomText.pos.Y = y + 240;
145
- }
146
- }
147
- draw() {
148
- if (this.enabled) {
149
- super.draw();
150
- const x = this.parentItem?.offset.X ??
151
- 0 + (this.ParentMenu?.WidthOffset ?? 0) / 2;
152
- this._grid.pos.X = x + 115.5;
153
- if (!this._isCircleLocked) {
154
- this.CirclePosition = this._setCirclePosition;
155
- this._isCircleLocked = true;
156
- }
157
- this._grid.draw(Menu.screenResolution);
158
- this._circle.draw(Menu.screenResolution);
159
- if (this._topText) {
160
- this._topText.pos.X = x + 215.5;
161
- this._topText.draw(undefined, Menu.screenResolution);
162
- }
163
- if (this._leftText) {
164
- this._leftText.pos.X = x + 57.75;
165
- this._leftText.draw(undefined, Menu.screenResolution);
166
- }
167
- if (this._rightText) {
168
- this._rightText.pos.X = x + 373.25;
169
- this._rightText.draw(undefined, Menu.screenResolution);
170
- }
171
- if (this._bottomText) {
172
- this._bottomText.pos.X = x + 215.5;
173
- this._bottomText.draw(undefined, Menu.screenResolution);
174
- }
175
- this._processControls();
176
- }
177
- }
178
- _setText(name, value) {
179
- if (value && value.trim() !== "") {
180
- // @ts-ignore
181
- if (!this[name]) {
182
- // @ts-ignore
183
- this[name] = new Text(value, new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Centered);
184
- }
185
- else {
186
- // @ts-ignore
187
- this[name].caption = value;
188
- }
189
- // @ts-ignore
190
- }
191
- else if (this[name]) {
192
- // @ts-ignore
193
- delete this[name];
194
- }
195
- }
196
- _processControls() {
197
- if (!this._pressed &&
198
- Game.isDisabledControlJustPressed(0, Control.Attack) &&
199
- this.ParentMenu?.isMouseInBounds(this._grid.pos, this._grid.size)) {
200
- this._pressed = true;
201
- (async () => {
202
- const drawOffset = this.ParentMenu?.DrawOffset ?? new Point(0, 0);
203
- while (Game.isDisabledControlPressed(0, Control.Attack)) {
204
- await Wait(0);
205
- let cX = (GetControlNormal(0, Control.CursorX) - drawOffset.X) *
206
- Menu.screenWidth;
207
- let cY = (GetControlNormal(0, Control.CursorY) - drawOffset.Y) *
208
- Menu.screenHeight;
209
- cX -= this._circle.size.width / 2;
210
- cY -= this._circle.size.height / 2;
211
- this._circle.pos.X =
212
- cX >
213
- this._grid.pos.X +
214
- 10 +
215
- this._grid.size.width -
216
- (this._lockXAxis ? 120 : 40)
217
- ? this._grid.pos.X +
218
- 10 +
219
- this._grid.size.width -
220
- (this._lockXAxis ? 120 : 40)
221
- : cX <
222
- this._grid.pos.X +
223
- (this._lockXAxis ? 100 : 20) -
224
- this._circle.size.width / 2
225
- ? this._grid.pos.X +
226
- (this._lockXAxis ? 100 : 20) -
227
- this._circle.size.width / 2
228
- : cX;
229
- this._circle.pos.Y =
230
- cY >
231
- this._grid.pos.Y +
232
- 10 +
233
- this._grid.size.height -
234
- (this._lockYAxis ? 120 : 40)
235
- ? this._grid.pos.Y +
236
- 10 +
237
- this._grid.size.height -
238
- (this._lockYAxis ? 120 : 40)
239
- : cY <
240
- this._grid.pos.Y +
241
- (this._lockYAxis ? 100 : 20) -
242
- this._circle.size.height / 2
243
- ? this._grid.pos.Y +
244
- (this._lockYAxis ? 100 : 20) -
245
- this._circle.size.height / 2
246
- : cY;
247
- }
248
- this.updateParentItem();
249
- this._pressed = false;
250
- })();
251
- const interval = setInterval(async () => {
252
- if (Game.isDisabledControlPressed(0, Control.Attack)) {
253
- this.updateParentItem();
254
- }
255
- else {
256
- clearInterval(interval);
257
- }
258
- }, 75);
259
- }
260
- }
261
- }
@@ -1,124 +0,0 @@
1
- import { Color, Point, Size } from "../../../../utils";
2
- import { AbstractUIMenuPanel } from "./";
3
- import { Menu, Rectangle, Sprite, Text } from "../../../";
4
- import { Alignment, Control, Font } from "../../../../enums";
5
- import { Game, Wait } from "../../../../";
6
- export class UIMenuPercentagePanel extends AbstractUIMenuPanel {
7
- background;
8
- _pressed = false;
9
- _lastPercentage;
10
- _title;
11
- _minText;
12
- _maxText;
13
- _activeBar;
14
- _backgroundBar;
15
- constructor(title = "", percentage = 0, minText, maxText) {
16
- super();
17
- this.background = new Sprite("commonmenu", "gradient_bgd", new Point(), new Size(431, 76));
18
- const barSize = new Size(413, 10);
19
- this._activeBar = new Rectangle(new Point(), barSize, Color.fromRgb(245, 245, 245));
20
- this._backgroundBar = new Rectangle(new Point(), { ...barSize }, Color.fromRgb(87, 87, 87));
21
- this._title = new Text("", new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Centered);
22
- this._minText = new Text("", new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Centered);
23
- this._maxText = new Text("", new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Centered);
24
- this.Title = title;
25
- this.MinText = minText || "0%";
26
- this.MaxText = maxText || "100%";
27
- this.Percentage = percentage;
28
- this._lastPercentage = percentage;
29
- }
30
- get Title() {
31
- return this._title.caption;
32
- }
33
- set Title(value) {
34
- this._title.caption = value ? value.trim() : "";
35
- }
36
- get MinText() {
37
- return this._minText.caption;
38
- }
39
- set MinText(value) {
40
- this._minText.caption = value ? value.trim() : "";
41
- }
42
- get MaxText() {
43
- return this._maxText.caption;
44
- }
45
- set MaxText(value) {
46
- this._maxText.caption = value ? value.trim() : "";
47
- }
48
- get Percentage() {
49
- const progress = this._activeBar.size.width / this._backgroundBar.size.width;
50
- return Math.round(progress * 100) / 100;
51
- }
52
- set Percentage(value) {
53
- value = value || 0;
54
- value = value < 0 ? 0 : value > 1 ? 1 : value;
55
- this._activeBar.size.width = this._backgroundBar.size.width * value;
56
- }
57
- updateParentItem() {
58
- const last = this._lastPercentage;
59
- const current = this.Percentage;
60
- if (last !== current) {
61
- this._lastPercentage = current;
62
- if (this.ParentMenu && this.parentItem) {
63
- this.ParentMenu.panelActivated.emit(this.parentItem, this, current);
64
- this.parentItem.panelActivated.emit(this, current);
65
- }
66
- }
67
- }
68
- setVerticalPosition(y) {
69
- super.setVerticalPosition(y);
70
- this._activeBar.pos.Y = y + 50;
71
- this._backgroundBar.pos.Y = y + 50;
72
- y += 15;
73
- this._minText.pos.Y = y;
74
- this._title.pos.Y = y;
75
- this._maxText.pos.Y = y;
76
- }
77
- draw() {
78
- if (this.enabled) {
79
- super.draw();
80
- const x = this.parentItem?.offset.X ??
81
- 0 + (this.ParentMenu?.WidthOffset ?? 0) / 2;
82
- this._activeBar.pos.X = x + 9;
83
- this._backgroundBar.pos.X = x + 9;
84
- this._minText.pos.X = x + 25;
85
- this._title.pos.X = x + 215.5;
86
- this._maxText.pos.X = x + 398;
87
- this._backgroundBar.draw(undefined, Menu.screenResolution);
88
- this._activeBar.draw(undefined, Menu.screenResolution);
89
- this._minText.draw(undefined, Menu.screenResolution);
90
- this._title.draw(undefined, Menu.screenResolution);
91
- this._maxText.draw(undefined, Menu.screenResolution);
92
- this._processControls();
93
- }
94
- }
95
- _processControls() {
96
- if (!this._pressed &&
97
- Game.isDisabledControlJustPressed(0, Control.Attack) &&
98
- this.ParentMenu?.isMouseInBounds(new Point(this._backgroundBar.pos.X, this._backgroundBar.pos.Y - 4), new Size(this._backgroundBar.size.width, this._backgroundBar.size.height + 8))) {
99
- this._pressed = true;
100
- (async () => {
101
- while (Game.isDisabledControlPressed(0, Control.Attack)) {
102
- await Wait(0);
103
- this._activeBar.size.width = this._getProgress();
104
- }
105
- this.updateParentItem();
106
- this._pressed = false;
107
- })();
108
- const interval = setInterval(async () => {
109
- if (Game.isDisabledControlPressed(0, Control.Attack)) {
110
- this.updateParentItem();
111
- }
112
- else {
113
- clearInterval(interval);
114
- }
115
- }, 75);
116
- }
117
- }
118
- _getProgress() {
119
- const drawOffset = this.ParentMenu?.DrawOffset ?? new Point(0, 0);
120
- const progress = (GetControlNormal(0, 239) - drawOffset.X) * Menu.screenWidth -
121
- this._activeBar.pos.X;
122
- return progress < 0 ? 0 : progress > 413 ? 413 : progress;
123
- }
124
- }
@@ -1,79 +0,0 @@
1
- import { Color, Point, Size } from "../../../../utils";
2
- import { AbstractUIMenuPanel } from "./";
3
- import { Menu, Rectangle } from "../../../";
4
- export class UIMenuStatisticsPanel extends AbstractUIMenuPanel {
5
- background;
6
- _divider = true;
7
- _items = [];
8
- constructor(item, divider = true) {
9
- super();
10
- this.background = new Rectangle(new Point(), new Size(431, 47), new Color(0, 0, 0, 170));
11
- if (item) {
12
- this.addItem(item);
13
- }
14
- this.Divider = divider;
15
- }
16
- get Divider() {
17
- return this._divider;
18
- }
19
- set Divider(value) {
20
- this._divider = value || false;
21
- }
22
- get Items() {
23
- return this._items;
24
- }
25
- set Items(value) {
26
- this._items = value;
27
- }
28
- addItem(item) {
29
- const items = Array.isArray(item) ? item : [item];
30
- this._items.push(...items);
31
- }
32
- removeItem(itemOrIndex) {
33
- if (typeof itemOrIndex === "number") {
34
- this._items = this._items.filter((i, index) => index !== itemOrIndex);
35
- }
36
- else {
37
- this._items = this._items.filter((i) => i.id !== itemOrIndex.id);
38
- }
39
- }
40
- setVerticalPosition(y) {
41
- super.setVerticalPosition(y);
42
- this._items.forEach(async (item, index) => {
43
- const itemCountOffset = 40 * (index + 1);
44
- const yOffset = y + itemCountOffset - 22;
45
- item.backgroundBar.pos.Y = yOffset;
46
- item.activeBar.pos.Y = yOffset;
47
- item.text.pos.Y = yOffset - 12;
48
- if (this._divider) {
49
- item.divider.forEach(async (divider) => {
50
- divider.pos.Y = yOffset;
51
- });
52
- }
53
- });
54
- }
55
- draw() {
56
- if (this.enabled) {
57
- super.draw();
58
- const x = this.parentItem?.offset.X ??
59
- 0 + (this.ParentMenu?.WidthOffset ?? 0) / 2;
60
- this._items.forEach(async (item, index) => {
61
- const itemCountOffset = 40 * (index + 1);
62
- item.backgroundBar.pos.X = x + 200;
63
- item.activeBar.pos.X = x + 200;
64
- item.text.pos.X = x + 13;
65
- item.backgroundBar.draw(undefined, Menu.screenResolution);
66
- item.activeBar.draw(undefined, Menu.screenResolution);
67
- item.text.draw(undefined, Menu.screenResolution);
68
- if (this._divider) {
69
- item.divider.forEach(async (divider, index) => {
70
- const dividerWidthOffset = (index + 1) * 40;
71
- divider.pos.X = x + dividerWidthOffset + 200;
72
- this.background.size.height = itemCountOffset + 47 - 39;
73
- divider.draw(undefined, Menu.screenResolution);
74
- });
75
- }
76
- });
77
- }
78
- }
79
- }
@@ -1,35 +0,0 @@
1
- import { Color, Crypto, Point, Size } from "../../../../utils";
2
- import { Rectangle, Text } from "../../../";
3
- import { Alignment, Font } from "../../../../enums";
4
- export class UIMenuStatisticsPanelItem {
5
- id = Crypto.uuidv4();
6
- text;
7
- activeBar;
8
- backgroundBar;
9
- divider = [];
10
- constructor(name, percentage = 0) {
11
- this.text = new Text("", new Point(), 0.35, Color.White, Font.ChaletLondon, Alignment.Left);
12
- this.backgroundBar = new Rectangle(new Point(), new Size(200, 10), Color.fromArgb(100, 87, 87, 87));
13
- this.activeBar = new Rectangle(new Point(), new Size(0, 10), Color.White);
14
- for (let i = 1; i <= 4; i++) {
15
- this.divider.push(new Rectangle(new Point(), new Size(2, 10), Color.Black));
16
- }
17
- this.Name = name;
18
- this.Percentage = percentage;
19
- }
20
- get Name() {
21
- return this.text.caption;
22
- }
23
- set Name(value) {
24
- this.text.caption = value ? value.trim() : "";
25
- }
26
- get Percentage() {
27
- return this.activeBar.size.width / 200;
28
- }
29
- set Percentage(value) {
30
- value = value || 0;
31
- value = Math.round(value * 100) / 100;
32
- value = value < 0 ? 0 : value > 1 ? 1 : value;
33
- this.activeBar.size.width = value * 200;
34
- }
35
- }
@@ -1,6 +0,0 @@
1
- export { AbstractUIMenuPanel } from "./AbstractUIMenuPanel";
2
- export { UIMenuGridPanel } from "./UIMenuGridPanel";
3
- export { UIMenuColorPanel } from "./UIMenuColorPanel";
4
- export { UIMenuPercentagePanel } from "./UIMenuPercentagePanel";
5
- export { UIMenuStatisticsPanel } from "./UIMenuStatisticsPanel";
6
- export { UIMenuStatisticsPanelItem } from "./UIMenuStatisticsPanelItem";
@@ -1,10 +0,0 @@
1
- import { Crypto } from "../../../utils";
2
- export class ListItem {
3
- id = Crypto.uuidv4();
4
- name;
5
- value;
6
- constructor(name, value = null) {
7
- this.name = name;
8
- this.value = value;
9
- }
10
- }
@@ -1 +0,0 @@
1
- export { ListItem } from "./ListItem";
@@ -1,55 +0,0 @@
1
- import { Wait } from "..";
2
- /**
3
- * A utility to load an animation dictionary, anything that loads an animation should RemoveAnimDict after its finish being used.
4
- * @param animDict the animation dictionary to load
5
- * @param waitTime how long to wait for the dictionary to load
6
- * @returns {boolean} if the animation successfully loaded
7
- */
8
- export const LoadAnimDict = async (animDict, waitTime = 1000) => {
9
- const start = GetGameTimer();
10
- if (!HasAnimDictLoaded(animDict)) {
11
- RequestAnimDict(animDict);
12
- }
13
- while (!HasAnimDictLoaded(animDict)) {
14
- if (GetGameTimer() - start >= waitTime)
15
- return false;
16
- await Wait(0);
17
- }
18
- return true;
19
- };
20
- /**
21
- * A utility to load multiple animation dictionary, anything that loads an animation should RemoveAnimDict after its finish being used.
22
- * @param animDict the animation dictionary to load
23
- * @param waitTime how long to wait for the dictionary to load
24
- * @returns if the animation successfully loaded, if the animation failed to load it will return an array of animations that failed to load
25
- */
26
- export const LoadAnimDictArray = async (animDict, waitTime = 1000) => {
27
- const start = GetGameTimer();
28
- for (const dict of animDict) {
29
- if (!HasAnimDictLoaded(dict)) {
30
- RequestAnimDict(dict);
31
- }
32
- }
33
- // TODO: more optimized way to do this
34
- const animsLoaded = new Set();
35
- while (animsLoaded.size !== animDict.length) {
36
- for (const dict of animDict) {
37
- if (!animsLoaded.has(dict) && HasAnimDictLoaded(dict)) {
38
- animsLoaded.add(dict);
39
- }
40
- }
41
- if (GetGameTimer() - start >= waitTime)
42
- return [false, animDict.filter((dict) => !animsLoaded.has(dict))];
43
- await Wait(0);
44
- }
45
- return [true, null];
46
- };
47
- /**
48
- * A utility to unload multiple animation dictionary
49
- * @param animDict the animation dictionaries to unload
50
- */
51
- export const RemoveAnimDictArray = (animDict) => {
52
- for (const dict of animDict) {
53
- RemoveAnimDict(dict);
54
- }
55
- };
package/utils/Crypto.js DELETED
@@ -1,25 +0,0 @@
1
- export class Crypto {
2
- static uuidv4() {
3
- let uuid = "";
4
- for (let ii = 0; ii < 32; ii += 1) {
5
- switch (ii) {
6
- case 8:
7
- case 20:
8
- uuid += "-";
9
- uuid += ((Math.random() * 16) | 0).toString(16);
10
- break;
11
- case 12:
12
- uuid += "-";
13
- uuid += "4";
14
- break;
15
- case 16:
16
- uuid += "-";
17
- uuid += ((Math.random() * 4) | 8).toString(16);
18
- break;
19
- default:
20
- uuid += ((Math.random() * 16) | 0).toString(16);
21
- }
22
- }
23
- return uuid;
24
- }
25
- }
@@ -1,19 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
3
- export class LiteEvent {
4
- handlers = [];
5
- on(handler) {
6
- this.handlers.push(handler);
7
- }
8
- off(handler) {
9
- this.handlers = this.handlers.filter((h) => h !== handler);
10
- }
11
- emit(...args) {
12
- this.handlers.slice(0).forEach((h) => {
13
- h(...args);
14
- });
15
- }
16
- expose() {
17
- return this;
18
- }
19
- }
package/utils/Maths.js DELETED
@@ -1,10 +0,0 @@
1
- export class Maths {
2
- static clamp(num, min, max) {
3
- return num <= min ? min : num >= max ? max : num;
4
- }
5
- static getRandomInt(min, max) {
6
- min = Math.ceil(min);
7
- max = Math.floor(max);
8
- return Math.floor(Math.random() * (max - min)) + min;
9
- }
10
- }
package/utils/Point.js DELETED
@@ -1,30 +0,0 @@
1
- export class Point {
2
- static parse(arg) {
3
- let point = new Point();
4
- if (arg) {
5
- if (typeof arg === "object") {
6
- if (Array.isArray(arg)) {
7
- if (arg.length === 2) {
8
- point = new Point(arg[0], arg[1]);
9
- }
10
- }
11
- else if (arg.X && arg.Y) {
12
- point = new Point(arg.X, arg.Y);
13
- }
14
- }
15
- else {
16
- if (arg.indexOf(",") !== -1) {
17
- const arr = arg.split(",");
18
- point = new Point(parseFloat(arr[0]), parseFloat(arr[1]));
19
- }
20
- }
21
- }
22
- return point;
23
- }
24
- X;
25
- Y;
26
- constructor(x = 0, y = 0) {
27
- this.X = x;
28
- this.Y = y;
29
- }
30
- }
package/utils/PointF.js DELETED
@@ -1,14 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
2
- export class PointF {
3
- x;
4
- y;
5
- z;
6
- static empty() {
7
- return new PointF(0, 0, 0);
8
- }
9
- constructor(x, y, z) {
10
- this.x = x;
11
- this.y = y;
12
- this.z = z;
13
- }
14
- }