@nativewrappers/fivem 0.0.65 → 0.0.73

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 (243) 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 +5 -13
  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 +7 -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 +18794 -26
  40. package/interfaces/Dimensions.d.ts +1 -1
  41. package/models/BaseEntity.d.ts +3 -3
  42. package/models/Ped.d.ts +4 -15
  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 -8
  72. package/utils/PointF.d.ts +0 -5
  73. package/utils/String.d.ts +1 -1
  74. package/utils/index.d.ts +2 -2
  75. package/weapon/DlcWeaponData.d.ts +1 -1
  76. package/weapon/Weapon.d.ts +7 -7
  77. package/weapon/WeaponAsset.d.ts +1 -1
  78. package/weapon/WeaponCollection.d.ts +2 -2
  79. package/weaponComponent/DlcWeaponComponentData.d.ts +1 -1
  80. package/weaponComponent/InvalidWeaponComponent.d.ts +1 -1
  81. package/weaponComponent/WeaponComponent.d.ts +3 -3
  82. package/weaponComponent/WeaponComponentCollection.d.ts +3 -3
  83. package/Audio.js +0 -93
  84. package/Blip.js +0 -105
  85. package/Camera.js +0 -162
  86. package/Checkpoint.js +0 -43
  87. package/Events.js +0 -74
  88. package/Game.js +0 -474
  89. package/GameplayCamera.js +0 -141
  90. package/Model.js +0 -213
  91. package/NetworkedScene.js +0 -18
  92. package/ParticleEffect.js +0 -123
  93. package/ParticleEffectAsset.js +0 -105
  94. package/Pickup.js +0 -19
  95. package/Raycast.js +0 -123
  96. package/RelationshipGroup.js +0 -67
  97. package/Rope.js +0 -129
  98. package/TaskSequence.js +0 -48
  99. package/Tasks.js +0 -241
  100. package/World.js +0 -765
  101. package/cfx/StateBagChangeHandler.js +0 -1
  102. package/cfx/index.js +0 -1
  103. package/enums/Alignment.js +0 -6
  104. package/enums/AnimationFlags.js +0 -35
  105. package/enums/AudioFlag.js +0 -38
  106. package/enums/BadgeStyle.js +0 -183
  107. package/enums/Blip.js +0 -225
  108. package/enums/Bone.js +0 -103
  109. package/enums/CameraShake.js +0 -14
  110. package/enums/CameraTypes.js +0 -8
  111. package/enums/CheckboxStyle.js +0 -5
  112. package/enums/Checkpoint.js +0 -67
  113. package/enums/CloudHat.js +0 -27
  114. package/enums/Control.js +0 -361
  115. package/enums/CursorSprite.js +0 -15
  116. package/enums/Driving.js +0 -34
  117. package/enums/ExplosionType.js +0 -45
  118. package/enums/FiringPattern.js +0 -20
  119. package/enums/Font.js +0 -8
  120. package/enums/ForceType.js +0 -9
  121. package/enums/Gender.js +0 -5
  122. package/enums/HelmetType.js +0 -6
  123. package/enums/HudColor.js +0 -184
  124. package/enums/HudComponent.js +0 -54
  125. package/enums/InputMode.js +0 -5
  126. package/enums/InvertAxis.js +0 -7
  127. package/enums/Language.js +0 -15
  128. package/enums/LeaveVehicleFlags.js +0 -11
  129. package/enums/LoadingSpinnerType.js +0 -8
  130. package/enums/MarkerType.js +0 -50
  131. package/enums/MenuAlignment.js +0 -5
  132. package/enums/NotificationType.js +0 -11
  133. package/enums/Parachute.js +0 -15
  134. package/enums/PickupType.js +0 -74
  135. package/enums/RadioStation.js +0 -25
  136. package/enums/RagdollType.js +0 -7
  137. package/enums/RaycastEnums.js +0 -32
  138. package/enums/Relationship.js +0 -10
  139. package/enums/RopeType.js +0 -6
  140. package/enums/ScreenEffect.js +0 -84
  141. package/enums/SpeechModifier.js +0 -40
  142. package/enums/Vehicle.js +0 -376
  143. package/enums/Weather.js +0 -22
  144. package/enums/ZoneID.js +0 -95
  145. package/enums/index.js +0 -42
  146. package/hashes/MaterialHash.js +0 -217
  147. package/hashes/PedHash.js +0 -725
  148. package/hashes/VehicleHash.js +0 -523
  149. package/hashes/WeaponHash.js +0 -161
  150. package/hashes/WeatherTypeHash.js +0 -22
  151. package/hashes/index.js +0 -5
  152. package/interfaces/Dimensions.js +0 -1
  153. package/models/BaseEntity.js +0 -477
  154. package/models/Entity.js +0 -25
  155. package/models/EntityBone.js +0 -26
  156. package/models/EntityBoneCollection.js +0 -18
  157. package/models/Ped.js +0 -692
  158. package/models/PedBone.js +0 -9
  159. package/models/PedBoneCollection.js +0 -21
  160. package/models/Player.js +0 -186
  161. package/models/Prop.js +0 -26
  162. package/models/Vehicle.js +0 -576
  163. package/models/VehicleDoor.js +0 -44
  164. package/models/VehicleDoorCollection.js +0 -62
  165. package/models/VehicleMod.js +0 -35
  166. package/models/VehicleModCollection.js +0 -227
  167. package/models/VehicleToggleMod.js +0 -29
  168. package/models/VehicleWheel.js +0 -23
  169. package/models/VehicleWheelCollection.js +0 -57
  170. package/models/VehicleWindow.js +0 -35
  171. package/models/VehicleWindowCollection.js +0 -57
  172. package/models/index.js +0 -19
  173. package/ui/Container.js +0 -31
  174. package/ui/Effects.js +0 -106
  175. package/ui/Fading.js +0 -69
  176. package/ui/Hud.js +0 -39
  177. package/ui/InstructionalButtons.js +0 -54
  178. package/ui/LoadingPrompt.js +0 -45
  179. package/ui/Notification.js +0 -9
  180. package/ui/Rectangle.js +0 -40
  181. package/ui/Scaleform.js +0 -236
  182. package/ui/Screen.js +0 -72
  183. package/ui/Sprite.js +0 -60
  184. package/ui/Text.js +0 -115
  185. package/ui/Timerbar.js +0 -248
  186. package/ui/index.js +0 -15
  187. package/ui/interfaces/IButton.js +0 -1
  188. package/ui/interfaces/IDrawable.js +0 -1
  189. package/ui/interfaces/index.js +0 -1
  190. package/ui/menu/Menu.js +0 -831
  191. package/ui/menu/MenuControl.js +0 -12
  192. package/ui/menu/MenuControls.js +0 -9
  193. package/ui/menu/MenuSettings.js +0 -54
  194. package/ui/menu/index.js +0 -6
  195. package/ui/menu/items/UIMenuCheckboxItem.js +0 -59
  196. package/ui/menu/items/UIMenuItem.js +0 -1111
  197. package/ui/menu/items/UIMenuListItem.js +0 -119
  198. package/ui/menu/items/UIMenuSeparatorItem.js +0 -29
  199. package/ui/menu/items/UIMenuSliderItem.js +0 -191
  200. package/ui/menu/items/index.js +0 -6
  201. package/ui/menu/items/panels/AbstractUIMenuPanel.js +0 -44
  202. package/ui/menu/items/panels/UIMenuColorPanel.js +0 -217
  203. package/ui/menu/items/panels/UIMenuGridPanel.js +0 -261
  204. package/ui/menu/items/panels/UIMenuPercentagePanel.js +0 -124
  205. package/ui/menu/items/panels/UIMenuStatisticsPanel.js +0 -79
  206. package/ui/menu/items/panels/UIMenuStatisticsPanelItem.js +0 -35
  207. package/ui/menu/items/panels/index.js +0 -6
  208. package/ui/menu/modules/ListItem.js +0 -10
  209. package/ui/menu/modules/index.js +0 -1
  210. package/utils/Animations.js +0 -55
  211. package/utils/Crypto.js +0 -25
  212. package/utils/LiteEvent.js +0 -19
  213. package/utils/Maths.js +0 -10
  214. package/utils/Point.js +0 -30
  215. package/utils/PointF.js +0 -14
  216. package/utils/Quaternion.js +0 -27
  217. package/utils/Size.js +0 -8
  218. package/utils/String.js +0 -25
  219. package/utils/enumValues.js +0 -14
  220. package/utils/index.js +0 -9
  221. package/weapon/DlcWeaponData.js +0 -44
  222. package/weapon/Mk2WeaponHash.js +0 -25
  223. package/weapon/Weapon.js +0 -270
  224. package/weapon/WeaponAsset.js +0 -84
  225. package/weapon/WeaponCollection.js +0 -187
  226. package/weapon/WeaponDisplayNameByHash.js +0 -75
  227. package/weapon/WeaponGroup.js +0 -19
  228. package/weapon/WeaponHudStats.js +0 -38
  229. package/weapon/WeaponLivery.js +0 -14
  230. package/weapon/WeaponLiveryColor.js +0 -35
  231. package/weapon/WeaponTint.js +0 -43
  232. package/weapon/index.js +0 -8
  233. package/weaponComponent/ComponentAttachmentPoint.js +0 -19
  234. package/weaponComponent/ComponentAttachmentPointByHash.js +0 -573
  235. package/weaponComponent/ComponentDisplayNameByHash.js +0 -280
  236. package/weaponComponent/DlcWeaponComponentData.js +0 -44
  237. package/weaponComponent/InvalidWeaponComponent.js +0 -28
  238. package/weaponComponent/WeaponComponent.js +0 -123
  239. package/weaponComponent/WeaponComponentCollection.js +0 -174
  240. package/weaponComponent/WeaponComponentHash.js +0 -887
  241. package/weaponComponent/WeaponComponentHashesByWeaponHash.js +0 -829
  242. package/weaponComponent/WeaponComponentHudStats.js +0 -34
  243. package/weaponComponent/index.js +0 -5
@@ -1,280 +0,0 @@
1
- import { WeaponComponentHash } from "./WeaponComponentHash";
2
- import { DlcWeaponComponentData } from "./DlcWeaponComponentData";
3
- /**
4
- * Mapping of WeaponComponentHash -> ComponentDisplayName(Label)
5
- *
6
- */
7
- export const ComponentDisplayNameByHash = new Map([
8
- [WeaponComponentHash.Invalid, "WCT_INVALID"],
9
- // [WeaponComponentHash.COMPONENT_KNUCKLE_VARMOD_BASE, 'WT_KNUCKLE'],
10
- // [WeaponComponentHash.COMPONENT_KNUCKLE_VARMOD_PIMP, 'WCT_KNUCK_02'],
11
- // [WeaponComponentHash.COMPONENT_KNUCKLE_VARMOD_BALLAS, 'WCT_KNUCK_BG'],
12
- // [WeaponComponentHash.COMPONENT_KNUCKLE_VARMOD_DOLLAR, 'WCT_KNUCK_DLR'],
13
- // [WeaponComponentHash.COMPONENT_KNUCKLE_VARMOD_DIAMOND, 'WCT_KNUCK_DMD'],
14
- // [WeaponComponentHash.COMPONENT_KNUCKLE_VARMOD_HATE, 'WCT_KNUCK_HT'],
15
- // [WeaponComponentHash.COMPONENT_KNUCKLE_VARMOD_LOVE, 'WCT_KNUCK_LV'],
16
- // [WeaponComponentHash.COMPONENT_KNUCKLE_VARMOD_PLAYER, 'WCT_KNUCK_PC'],
17
- // [WeaponComponentHash.COMPONENT_KNUCKLE_VARMOD_KING, 'WCT_KNUCK_SLG'],
18
- // [WeaponComponentHash.COMPONENT_KNUCKLE_VARMOD_VAGOS, 'WCT_KNUCK_VG'],
19
- [WeaponComponentHash.KnuckleVarmodBase, "WT_KNUCKLE"],
20
- [WeaponComponentHash.KnuckleVarmodPimp, "WCT_KNUCK_02"],
21
- [WeaponComponentHash.KnuckleVarmodBallas, "WCT_KNUCK_BG"],
22
- [WeaponComponentHash.KnuckleVarmodDollar, "WCT_KNUCK_DLR"],
23
- [WeaponComponentHash.KnuckleVarmodDiamond, "WCT_KNUCK_DMD"],
24
- [WeaponComponentHash.KnuckleVarmodHate, "WCT_KNUCK_HT"],
25
- [WeaponComponentHash.KnuckleVarmodLove, "WCT_KNUCK_LV"],
26
- [WeaponComponentHash.KnuckleVarmodPlayer, "WCT_KNUCK_PC"],
27
- [WeaponComponentHash.KnuckleVarmodKing, "WCT_KNUCK_SLG"],
28
- [WeaponComponentHash.KnuckleVarmodVagos, "WCT_KNUCK_VG"],
29
- [WeaponComponentHash.Invalid, "WCT_INVALID"],
30
- [WeaponComponentHash.AtRailCover01, "WCT_RAIL"],
31
- [WeaponComponentHash.AtArAfGrip, "WCT_GRIP"],
32
- [WeaponComponentHash.AtArAfGrip2, "WCT_GRIP"],
33
- [WeaponComponentHash.AtPiFlsh, "WCT_FLASH"],
34
- [WeaponComponentHash.AtArFlsh, "WCT_FLASH"],
35
- [WeaponComponentHash.PistolMk2Flash, "WCT_FLASH"],
36
- [WeaponComponentHash.AtScopeMacro, "WCT_SCOPE_MAC"],
37
- [WeaponComponentHash.AtScopeMacro02, "WCT_SCOPE_MAC"],
38
- [WeaponComponentHash.AtScopeSmall, "WCT_SCOPE_SML"],
39
- [WeaponComponentHash.AtScopeSmall02, "WCT_SCOPE_SML"],
40
- [WeaponComponentHash.AtScopeMedium, "WCT_SCOPE_MED"],
41
- [WeaponComponentHash.AtScopeLarge, "WCT_SCOPE_LRG"],
42
- [WeaponComponentHash.AtScopeMax, "WCT_SCOPE_MAX"],
43
- [WeaponComponentHash.AtPiSupp, "WCT_SUPP"],
44
- [WeaponComponentHash.AtArSupp, "WCT_SUPP"],
45
- [WeaponComponentHash.AtArSupp02, "WCT_SUPP"],
46
- [WeaponComponentHash.AtSrSupp, "WCT_SUPP"],
47
- [WeaponComponentHash.HeavySniperMk2Suppressor, "WCT_SUPP"],
48
- [WeaponComponentHash.AtPiSupp02, "WCT_SUPP"],
49
- [WeaponComponentHash.CombatPistolClip01, "WCT_CLIP1"],
50
- [WeaponComponentHash.APPistolClip01, "WCT_CLIP1"],
51
- [WeaponComponentHash.MicroSMGClip01, "WCT_CLIP1"],
52
- [WeaponComponentHash.AssaultRifleClip01, "WCT_CLIP1"],
53
- [WeaponComponentHash.CarbineRifleClip01, "WCT_CLIP1"],
54
- [WeaponComponentHash.AdvancedRifleClip01, "WCT_CLIP1"],
55
- [WeaponComponentHash.MGClip01, "WCT_CLIP1"],
56
- [WeaponComponentHash.CombatMGClip01, "WCT_CLIP1"],
57
- [WeaponComponentHash.AssaultShotgunClip01, "WCT_CLIP1"],
58
- [WeaponComponentHash.SniperRifleClip01, "WCT_CLIP1"],
59
- [WeaponComponentHash.HeavySniperClip01, "WCT_CLIP1"],
60
- [WeaponComponentHash.AssaultSMGClip01, "WCT_CLIP1"],
61
- [WeaponComponentHash.Pistol50Clip01, "WCT_CLIP1"],
62
- [0x0baab157, "WCT_CLIP1"],
63
- [0x5af49386, "WCT_CLIP1"],
64
- [0xcaebd246, "WCT_CLIP1"],
65
- [0xf8955d89, "WCT_CLIP1"],
66
- [WeaponComponentHash.SNSPistolClip01, "WCT_CLIP1"],
67
- [WeaponComponentHash.VintagePistolClip01, "WCT_CLIP1"],
68
- [WeaponComponentHash.HeavyShotgunClip01, "WCT_CLIP1"],
69
- [WeaponComponentHash.MarksmanRifleClip01, "WCT_CLIP1"],
70
- [WeaponComponentHash.CombatPDWClip01, "WCT_CLIP1"],
71
- [WeaponComponentHash.MarksmanPistolClip01, "WCT_CLIP1"],
72
- [WeaponComponentHash.MachinePistolClip01, "WCT_CLIP1"],
73
- [WeaponComponentHash.PistolMk2ClipNormal, "WCT_CLIP1"],
74
- [WeaponComponentHash.AssaultRifleMk2ClipNormal, "WCT_CLIP1"],
75
- [WeaponComponentHash.CarbineRifleMk2ClipNormal, "WCT_CLIP1"],
76
- [WeaponComponentHash.CombatMGMk2ClipNormal, "WCT_CLIP1"],
77
- [WeaponComponentHash.HeavySniperMk2ClipNormal, "WCT_CLIP1"],
78
- [WeaponComponentHash.SMGMk2ClipNormal, "WCT_CLIP1"],
79
- [WeaponComponentHash.PistolClip02, "WCT_CLIP2"],
80
- [WeaponComponentHash.CombatPistolClip02, "WCT_CLIP2"],
81
- [WeaponComponentHash.APPistolClip02, "WCT_CLIP2"],
82
- [WeaponComponentHash.MicroSMGClip02, "WCT_CLIP2"],
83
- [WeaponComponentHash.SMGClip02, "WCT_CLIP2"],
84
- [WeaponComponentHash.AssaultRifleClip02, "WCT_CLIP2"],
85
- [WeaponComponentHash.CarbineRifleClip02, "WCT_CLIP2"],
86
- [WeaponComponentHash.AdvancedRifleClip02, "WCT_CLIP2"],
87
- [WeaponComponentHash.MGClip02, "WCT_CLIP2"],
88
- [WeaponComponentHash.CombatMGClip02, "WCT_CLIP2"],
89
- [WeaponComponentHash.AssaultShotgunClip02, "WCT_CLIP2"],
90
- [WeaponComponentHash.MinigunClip01, "WCT_CLIP2"],
91
- [WeaponComponentHash.AssaultSMGClip02, "WCT_CLIP2"],
92
- [WeaponComponentHash.Pistol50Clip02, "WCT_CLIP2"],
93
- [0x6cbf371b, "WCT_CLIP2"],
94
- [0xe1c5fffa, "WCT_CLIP2"],
95
- [0x3e7e6956, "WCT_CLIP2"],
96
- [WeaponComponentHash.SNSPistolClip02, "WCT_CLIP2"],
97
- [WeaponComponentHash.VintagePistolClip02, "WCT_CLIP2"],
98
- [WeaponComponentHash.HeavyShotgunClip02, "WCT_CLIP2"],
99
- [WeaponComponentHash.MarksmanRifleClip02, "WCT_CLIP2"],
100
- [WeaponComponentHash.CombatPDWClip02, "WCT_CLIP2"],
101
- [WeaponComponentHash.MachinePistolClip02, "WCT_CLIP2"],
102
- [WeaponComponentHash.PistolMk2ClipExtended, "WCT_CLIP2"],
103
- [WeaponComponentHash.AssaultRifleMk2ClipExtended, "WCT_CLIP2"],
104
- [WeaponComponentHash.CarbineRifleMk2ClipExtended, "WCT_CLIP2"],
105
- [WeaponComponentHash.CombatMGMk2ClipExtended, "WCT_CLIP2"],
106
- [WeaponComponentHash.HeavySniperMk2ClipExtended, "WCT_CLIP2"],
107
- [WeaponComponentHash.SMGMk2ClipExtended, "WCT_CLIP2"],
108
- [WeaponComponentHash.AtScopeLargeFixedZoom, "WCT_SCOPE_LRG"],
109
- [WeaponComponentHash.AssaultRifleVarmodLuxe, "WCT_VAR_GOLD"],
110
- [WeaponComponentHash.CarbineRifleVarmodLuxe, "WCT_VAR_GOLD"],
111
- [WeaponComponentHash.PistolVarmodLuxe, "WCT_VAR_GOLD"],
112
- [WeaponComponentHash.SMGVarmodLuxe, "WCT_VAR_GOLD"],
113
- [WeaponComponentHash.MicroSMGVarmodLuxe, "WCT_VAR_GOLD"],
114
- [0x161e9241, "WCT_VAR_GOLD"],
115
- [WeaponComponentHash.AssaultSMGVarmodLowrider, "WCT_VAR_GOLD"],
116
- [WeaponComponentHash.CombatPistolVarmodLowrider, "WCT_VAR_GOLD"],
117
- [WeaponComponentHash.MGVarmodLowrider, "WCT_VAR_GOLD"],
118
- [WeaponComponentHash.PumpShotgunVarmodLowrider, "WCT_VAR_GOLD"],
119
- [WeaponComponentHash.AdvancedRifleVarmodLuxe, "WCT_VAR_METAL"],
120
- [WeaponComponentHash.APPistolVarmodLuxe, "WCT_VAR_METAL"],
121
- [WeaponComponentHash.SawnoffShotgunVarmodLuxe, "WCT_VAR_METAL"],
122
- [WeaponComponentHash.BullpupRifleVarmodLow, "WCT_VAR_METAL"],
123
- [WeaponComponentHash.Pistol50VarmodLuxe, "WCT_VAR_SIL"],
124
- [WeaponComponentHash.HeavyPistolVarmodLuxe, "WCT_VAR_WOOD"],
125
- [WeaponComponentHash.SniperRifleVarmodLuxe, "WCT_VAR_WOOD"],
126
- [WeaponComponentHash.SNSPistolVarmodLowrider, "WCT_VAR_WOOD"],
127
- [WeaponComponentHash.CombatMGVarmodLowrider, "WCT_VAR_ETCHM"],
128
- [WeaponComponentHash.SpecialCarbineVarmodLowrider, "WCT_VAR_ETCHM"],
129
- [WeaponComponentHash.SwitchbladeVarmodBase, "WCT_SB_BASE"],
130
- [WeaponComponentHash.SwitchbladeVarmodVar1, "WCT_SB_VAR1"],
131
- [WeaponComponentHash.SwitchbladeVarmodVar2, "WCT_SB_VAR2"],
132
- [WeaponComponentHash.RevolverClip01, "WCT_CLIP1"],
133
- [WeaponComponentHash.RevolverVarmodBoss, "WCT_REV_VARB"],
134
- [WeaponComponentHash.RevolverVarmodGoon, "WCT_REV_VARG"],
135
- [WeaponComponentHash.SMGClip03, "WCT_CLIP_DRM"],
136
- [WeaponComponentHash.AssaultRifleClip03, "WCT_CLIP_DRM"],
137
- [WeaponComponentHash.HeavyShotgunClip03, "WCT_CLIP_DRM"],
138
- [WeaponComponentHash.CarbineRifleClip03, "WCT_CLIP_BOX"],
139
- [WeaponComponentHash.AssaultRifleMk2ClipArmorPiercing, "WCT_CLIP_AP"],
140
- [WeaponComponentHash.CarbineRifleMk2ClipArmorPiercing, "WCT_CLIP_AP"],
141
- [WeaponComponentHash.CombatMGMk2ClipArmorPiercing, "WCT_CLIP_AP"],
142
- [WeaponComponentHash.HeavySniperMk2ClipArmorPiercing, "WCT_CLIP_AP"],
143
- [WeaponComponentHash.PistolMk2ClipFMJ, "WCT_CLIP_FMJ"],
144
- [WeaponComponentHash.AssaultRifleMk2ClipFMJ, "WCT_CLIP_FMJ"],
145
- [WeaponComponentHash.CarbineRifleMk2ClipFMJ, "WCT_CLIP_FMJ"],
146
- [WeaponComponentHash.CombatMGMk2ClipFMJ, "WCT_CLIP_FMJ"],
147
- [WeaponComponentHash.HeavySniperMk2ClipFMJ, "WCT_CLIP_FMJ"],
148
- [WeaponComponentHash.SMGMk2ClipFMJ, "WCT_CLIP_FMJ"],
149
- [WeaponComponentHash.PistolMk2ClipIncendiary, "WCT_CLIP_INC"],
150
- [WeaponComponentHash.AssaultRifleMk2ClipIncendiary, "WCT_CLIP_INC"],
151
- [WeaponComponentHash.CarbineRifleMk2ClipIncendiary, "WCT_CLIP_INC"],
152
- [WeaponComponentHash.CombatMGMk2ClipIncendiary, "WCT_CLIP_INC"],
153
- [WeaponComponentHash.HeavySniperMk2ClipIncendiary, "WCT_CLIP_INC"],
154
- [WeaponComponentHash.SMGMk2ClipIncendiary, "WCT_CLIP_INC"],
155
- [WeaponComponentHash.PistolMk2ClipTracer, "WCT_CLIP_TR"],
156
- [WeaponComponentHash.AssaultRifleMk2ClipTracer, "WCT_CLIP_TR"],
157
- [WeaponComponentHash.CarbineRifleMk2ClipTracer, "WCT_CLIP_TR"],
158
- [WeaponComponentHash.CombatMGMk2ClipTracer, "WCT_CLIP_TR"],
159
- [WeaponComponentHash.SMGMk2ClipTracer, "WCT_CLIP_TR"],
160
- [WeaponComponentHash.HeavySniperMk2ClipExplosive, "WCT_CLIP_EX"],
161
- [WeaponComponentHash.PistolMk2ClipHollowpoint, "WCT_CLIP_HP"],
162
- [WeaponComponentHash.SMGMk2ClipHollowpoint, "WCT_CLIP_HP"],
163
- [WeaponComponentHash.AssaultRifleMk2BarrelNormal, "WCT_BARR"],
164
- [WeaponComponentHash.CarbineRifleMk2BarrelNormal, "WCT_BARR"],
165
- [WeaponComponentHash.CombatMGMk2BarrelNormal, "WCT_BARR"],
166
- [WeaponComponentHash.SMGMk2BarrelNormal, "WCT_BARR"],
167
- [WeaponComponentHash.AssaultRifleMk2BarrelHeavy, "WCT_BARR2"],
168
- [WeaponComponentHash.CarbineRifleMk2BarrelHeavy, "WCT_BARR2"],
169
- [WeaponComponentHash.CombatMGMk2BarrelHeavy, "WCT_BARR2"],
170
- [WeaponComponentHash.SMGMk2BarrelHeavy, "WCT_BARR2"],
171
- [WeaponComponentHash.PistolMk2CamoDigital, "WCT_CAMO_1"],
172
- [WeaponComponentHash.AssaultRifleMk2CamoDigital, "WCT_CAMO_1"],
173
- [WeaponComponentHash.CarbineRifleMk2CamoDigital, "WCT_CAMO_1"],
174
- [WeaponComponentHash.CombatMGMk2CamoDigital, "WCT_CAMO_1"],
175
- [WeaponComponentHash.HeavySniperMk2CamoDigital, "WCT_CAMO_1"],
176
- [WeaponComponentHash.SMGMk2CamoDigital, "WCT_CAMO_1"],
177
- [WeaponComponentHash.PistolMk2CamoSlideDigital, "WCT_CAMO_1"],
178
- [WeaponComponentHash.PistolMk2CamoBrushstroke, "WCT_CAMO_2"],
179
- [WeaponComponentHash.AssaultRifleMk2CamoBrushstroke, "WCT_CAMO_2"],
180
- [WeaponComponentHash.CarbineRifleMk2CamoBrushstroke, "WCT_CAMO_2"],
181
- [WeaponComponentHash.CombatMGMk2CamoBrushstroke, "WCT_CAMO_2"],
182
- [WeaponComponentHash.HeavySniperMk2CamoBrushstroke, "WCT_CAMO_2"],
183
- [WeaponComponentHash.SMGMk2CamoBrushstroke, "WCT_CAMO_2"],
184
- [WeaponComponentHash.PistolMk2CamoSlideBrushstroke, "WCT_CAMO_2"],
185
- [WeaponComponentHash.PistolMk2CamoWoodland, "WCT_CAMO_3"],
186
- [WeaponComponentHash.AssaultRifleMk2CamoWoodland, "WCT_CAMO_3"],
187
- [WeaponComponentHash.CarbineRifleMk2CamoWoodland, "WCT_CAMO_3"],
188
- [WeaponComponentHash.CombatMGMk2CamoWoodland, "WCT_CAMO_3"],
189
- [WeaponComponentHash.HeavySniperMk2CamoWoodland, "WCT_CAMO_3"],
190
- [WeaponComponentHash.SMGMk2CamoWoodland, "WCT_CAMO_3"],
191
- [WeaponComponentHash.PistolMk2CamoSlideWoodland, "WCT_CAMO_3"],
192
- [WeaponComponentHash.PistolMk2CamoSkull, "WCT_CAMO_4"],
193
- [WeaponComponentHash.AssaultRifleMk2CamoSkull, "WCT_CAMO_4"],
194
- [WeaponComponentHash.CarbineRifleMk2CamoSkull, "WCT_CAMO_4"],
195
- [WeaponComponentHash.CombatMGMk2CamoSkull, "WCT_CAMO_4"],
196
- [WeaponComponentHash.HeavySniperMk2CamoSkull, "WCT_CAMO_4"],
197
- [WeaponComponentHash.SMGMk2CamoSkull, "WCT_CAMO_4"],
198
- [WeaponComponentHash.PistolMk2CamoSlideSkull, "WCT_CAMO_4"],
199
- [WeaponComponentHash.PistolMk2CamoSessanta, "WCT_CAMO_5"],
200
- [WeaponComponentHash.AssaultRifleMk2CamoSessanta, "WCT_CAMO_5"],
201
- [WeaponComponentHash.CarbineRifleMk2CamoSessanta, "WCT_CAMO_5"],
202
- [WeaponComponentHash.CombatMGMk2CamoSessanta, "WCT_CAMO_5"],
203
- [WeaponComponentHash.HeavySniperMk2CamoSessanta, "WCT_CAMO_5"],
204
- [WeaponComponentHash.SMGMk2CamoSessanta, "WCT_CAMO_5"],
205
- [WeaponComponentHash.PistolMk2CamoSlideSessanta, "WCT_CAMO_5"],
206
- [WeaponComponentHash.PistolMk2CamoPerseus, "WCT_CAMO_6"],
207
- [WeaponComponentHash.AssaultRifleMk2CamoPerseus, "WCT_CAMO_6"],
208
- [WeaponComponentHash.CarbineRifleMk2CamoPerseus, "WCT_CAMO_6"],
209
- [WeaponComponentHash.CombatMGMk2CamoPerseus, "WCT_CAMO_6"],
210
- [WeaponComponentHash.HeavySniperMk2CamoPerseus, "WCT_CAMO_6"],
211
- [WeaponComponentHash.SMGMk2CamoPerseus, "WCT_CAMO_6"],
212
- [WeaponComponentHash.PistolMk2CamoSlidePerseus, "WCT_CAMO_6"],
213
- [WeaponComponentHash.PistolMk2CamoLeopard, "WCT_CAMO_7"],
214
- [WeaponComponentHash.AssaultRifleMk2CamoLeopard, "WCT_CAMO_7"],
215
- [WeaponComponentHash.CarbineRifleMk2CamoLeopard, "WCT_CAMO_7"],
216
- [WeaponComponentHash.CombatMGMk2CamoLeopard, "WCT_CAMO_7"],
217
- [WeaponComponentHash.HeavySniperMk2CamoLeopard, "WCT_CAMO_7"],
218
- [WeaponComponentHash.SMGMk2CamoLeopard, "WCT_CAMO_7"],
219
- [WeaponComponentHash.PistolMk2CamoSlideLeopard, "WCT_CAMO_7"],
220
- [WeaponComponentHash.PistolMk2CamoZebra, "WCT_CAMO_8"],
221
- [WeaponComponentHash.AssaultRifleMk2CamoZebra, "WCT_CAMO_8"],
222
- [WeaponComponentHash.CarbineRifleMk2CamoZebra, "WCT_CAMO_8"],
223
- [WeaponComponentHash.CombatMGMk2CamoZebra, "WCT_CAMO_8"],
224
- [WeaponComponentHash.HeavySniperMk2CamoZebra, "WCT_CAMO_8"],
225
- [WeaponComponentHash.SMGMk2CamoZebra, "WCT_CAMO_8"],
226
- [WeaponComponentHash.PistolMk2CamoSlideZebra, "WCT_CAMO_8"],
227
- [WeaponComponentHash.PistolMk2CamoGeometric, "WCT_CAMO_9"],
228
- [WeaponComponentHash.AssaultRifleMk2CamoGeometric, "WCT_CAMO_9"],
229
- [WeaponComponentHash.CarbineRifleMk2CamoGeometric, "WCT_CAMO_9"],
230
- [WeaponComponentHash.CombatMGMk2CamoGeometric, "WCT_CAMO_9"],
231
- [WeaponComponentHash.HeavySniperMk2CamoGeometric, "WCT_CAMO_9"],
232
- [WeaponComponentHash.SMGMk2CamoGeometric, "WCT_CAMO_9"],
233
- [WeaponComponentHash.PistolMk2CamoSlideGeometric, "WCT_CAMO_9"],
234
- [WeaponComponentHash.PistolMk2CamoBoom, "WCT_CAMO_10"],
235
- [WeaponComponentHash.AssaultRifleMk2CamoBoom, "WCT_CAMO_10"],
236
- [WeaponComponentHash.CarbineRifleMk2CamoBoom, "WCT_CAMO_10"],
237
- [WeaponComponentHash.CombatMGMk2CamoBoom, "WCT_CAMO_10"],
238
- [WeaponComponentHash.HeavySniperMk2CamoBoom, "WCT_CAMO_10"],
239
- [WeaponComponentHash.SMGMk2CamoBoom, "WCT_CAMO_10"],
240
- [WeaponComponentHash.PistolMk2CamoSlideBoom, "WCT_CAMO_10"],
241
- [WeaponComponentHash.PistolMk2CamoPatriotic, "WCT_CAMO_IND"],
242
- [WeaponComponentHash.AssaultRifleMk2CamoPatriotic, "WCT_CAMO_IND"],
243
- [WeaponComponentHash.CarbineRifleMk2CamoPatriotic, "WCT_CAMO_IND"],
244
- [WeaponComponentHash.CombatMGMk2CamoPatriotic, "WCT_CAMO_IND"],
245
- [WeaponComponentHash.HeavySniperMk2CamoPatriotic, "WCT_CAMO_IND"],
246
- [WeaponComponentHash.SMGMk2CamoPatriotic, "WCT_CAMO_IND"],
247
- [WeaponComponentHash.PistolMk2CamoSlidePatriotic, "WCT_CAMO_IND"],
248
- [WeaponComponentHash.AtSights, "WCT_HOLO"],
249
- [WeaponComponentHash.AtScopeSmallMk2, "WCT_SCOPE_SML2"],
250
- [WeaponComponentHash.AtScopeMacroMk2, "WCT_SCOPE_MAC2"],
251
- [WeaponComponentHash.AtScopeMediumMk2, "WCT_SCOPE_MED2"],
252
- [WeaponComponentHash.AtMuzzle1, "WCT_MUZZ"],
253
- [WeaponComponentHash.AtMuzzle2, "WCT_MUZZ"],
254
- [WeaponComponentHash.AtMuzzle3, "WCT_MUZZ"],
255
- [WeaponComponentHash.AtMuzzle4, "WCT_MUZZ"],
256
- [WeaponComponentHash.AtMuzzle5, "WCT_MUZZ"],
257
- [WeaponComponentHash.AtMuzzle7, "WCT_MUZZ"],
258
- [WeaponComponentHash.HeavySniperMk2Muzzle8, "WCT_MUZZ"],
259
- [WeaponComponentHash.HeavySniperMk2Muzzle9, "WCT_MUZZ"],
260
- [WeaponComponentHash.PistolMk2Scope, "WCT_SCOPE_PI"],
261
- [WeaponComponentHash.PistolMk2Compensator, "WCT_COMP"],
262
- [WeaponComponentHash.HeavySniperMk2ScopeLarge, "WCT_SCOPE_LRG2"],
263
- ]);
264
- /**
265
- * Initialize with DlcWeaponComponentData, in case of any missing dlc data
266
- *
267
- */
268
- function initializeOnce() {
269
- let isInitialized = false;
270
- return function () {
271
- if (isInitialized) {
272
- return;
273
- }
274
- for (const [hash, data] of DlcWeaponComponentData) {
275
- ComponentDisplayNameByHash.set(hash, data.name);
276
- }
277
- isInitialized = true;
278
- };
279
- }
280
- initializeOnce()();
@@ -1,44 +0,0 @@
1
- import { getStringFromUInt8Array, getUInt32FromUint8Array } from "../utils";
2
- /**
3
- * DlcWeaponComponentData
4
- *
5
- */
6
- export const DlcWeaponComponentData = new Map();
7
- /**
8
- * Initialize DlcWeaponComponentData, avoid calling expansive native repeatedly
9
- *
10
- */
11
- function initializeOnce() {
12
- let isInitialized = false;
13
- return function () {
14
- if (isInitialized || IsDuplicityVersion()) {
15
- return;
16
- }
17
- // magic number based on struct DlcWeaponData
18
- const intLength = 4;
19
- const strLength = 64;
20
- const weaponCount = GetNumDlcWeapons();
21
- for (let i = 0; i < weaponCount; i++) {
22
- const componentCount = GetNumDlcWeaponComponents(i);
23
- for (let j = 0; j < componentCount; j++) {
24
- const buffer = new Uint8Array(14 * intLength + 4 * strLength);
25
- // https://docs.fivem.net/natives/?_0x6CF598A2957C2BF8
26
- Citizen.invokeNative("0x6CF598A2957C2BF8", i, j, buffer, Citizen.returnResultAnyway());
27
- // noinspection PointlessArithmeticExpressionJS
28
- const dlcWeaponComponentData = {
29
- attachBone: getUInt32FromUint8Array(buffer, 0 * intLength, 1 * intLength),
30
- bActiveByDefault: getUInt32FromUint8Array(buffer, 2 * intLength, 3 * intLength),
31
- unk: getUInt32FromUint8Array(buffer, 4 * intLength, 5 * intLength),
32
- componentHash: getUInt32FromUint8Array(buffer, 6 * intLength, 7 * intLength),
33
- unk2: getUInt32FromUint8Array(buffer, 8 * intLength, 9 * intLength),
34
- componentCost: getUInt32FromUint8Array(buffer, 10 * intLength, 11 * intLength),
35
- name: getStringFromUInt8Array(buffer, 12 * intLength, 12 * intLength + strLength),
36
- desc: getStringFromUInt8Array(buffer, 12 * intLength + strLength, 12 * intLength + 2 * strLength),
37
- };
38
- DlcWeaponComponentData.set(dlcWeaponComponentData.componentHash, dlcWeaponComponentData);
39
- }
40
- }
41
- isInitialized = true;
42
- };
43
- }
44
- initializeOnce()();
@@ -1,28 +0,0 @@
1
- import { WeaponComponent } from "./WeaponComponent";
2
- import { WeaponComponentHash } from "./WeaponComponentHash";
3
- import { ComponentAttachmentPoint } from "./ComponentAttachmentPoint";
4
- import { Game } from "../Game";
5
- export class InvalidWeaponComponent extends WeaponComponent {
6
- constructor() {
7
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8
- super(null, null, WeaponComponentHash.Invalid);
9
- }
10
- get Active() {
11
- return false;
12
- }
13
- // eslint-disable-next-line @typescript-eslint/no-empty-function
14
- set Active(value) { }
15
- get DisplayName() {
16
- return "WCT_INVALID";
17
- }
18
- get LocalizedName() {
19
- return Game.getGXTEntry(this.DisplayName);
20
- }
21
- static getAttachmentPoint(
22
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
23
- hash,
24
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
25
- componentHash) {
26
- return ComponentAttachmentPoint.Invalid;
27
- }
28
- }
@@ -1,123 +0,0 @@
1
- import { WeaponComponentHash } from "./WeaponComponentHash";
2
- import { ComponentAttachmentPoint } from "./ComponentAttachmentPoint";
3
- import { Game } from "../Game";
4
- import { ComponentDisplayNameByHash } from "./ComponentDisplayNameByHash";
5
- import { WeaponComponentHashesByWeaponHash } from "./WeaponComponentHashesByWeaponHash";
6
- import { ComponentAttachmentPointByHash } from "./ComponentAttachmentPointByHash";
7
- import { WeaponComponentHudStats } from "./WeaponComponentHudStats";
8
- /**
9
- * ped weapon component on weapon
10
- *
11
- */
12
- export class WeaponComponent {
13
- owner;
14
- weapon;
15
- componentHash;
16
- constructor(owner, weapon, componentHash) {
17
- this.owner = owner;
18
- this.weapon = weapon;
19
- this.componentHash = componentHash;
20
- }
21
- /**
22
- * Check WeaponComponent is invalid or not
23
- *
24
- * @constructor
25
- */
26
- get IsInvalid() {
27
- return this.componentHash === WeaponComponentHash.Invalid;
28
- }
29
- /**
30
- * get component hash
31
- *
32
- * @constructor
33
- */
34
- get ComponentHash() {
35
- return this.componentHash;
36
- }
37
- /**
38
- * check ped has weapon component
39
- *
40
- * @constructor
41
- */
42
- get Active() {
43
- return HasPedGotWeaponComponent(this.owner.Handle, this.weapon.Hash, this.componentHash);
44
- }
45
- /**
46
- * give weapon component to ped
47
- *
48
- * @param value
49
- * @constructor
50
- */
51
- set Active(value) {
52
- if (value) {
53
- GiveWeaponComponentToPed(this.owner.Handle, this.weapon.Hash, this.componentHash);
54
- }
55
- else {
56
- RemoveWeaponComponentFromPed(this.owner.Handle, this.weapon.Hash, this.componentHash);
57
- }
58
- }
59
- /**
60
- * get component display name / label
61
- *
62
- * @constructor
63
- */
64
- get DisplayName() {
65
- return WeaponComponent.getComponentDisplayNameFromHash(this.weapon.Hash, this.componentHash);
66
- }
67
- /**
68
- * get component localized name
69
- *
70
- * @constructor
71
- */
72
- get LocalizedName() {
73
- return Game.getGXTEntry(this.DisplayName);
74
- }
75
- /**
76
- * get component attachment point
77
- *
78
- * @constructor
79
- */
80
- get AttachmentPoint() {
81
- return WeaponComponent.getAttachmentPoint(this.weapon.Hash, this.componentHash);
82
- }
83
- /**
84
- * get component hud stats
85
- *
86
- * @constructor
87
- */
88
- get HudStats() {
89
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
90
- return WeaponComponentHudStats.get(this.componentHash);
91
- }
92
- /**
93
- * get component display name / label by hash
94
- *
95
- * @param hash
96
- * @param componentHash
97
- * @constructor
98
- */
99
- static getComponentDisplayNameFromHash(hash, componentHash) {
100
- if (!hash) {
101
- return "WCT_INVALID";
102
- }
103
- return ComponentDisplayNameByHash.get(componentHash) ?? "WCT_INVALID";
104
- }
105
- /**
106
- * get component attachment point by WeaponHash and WeaponComponentHash
107
- *
108
- * @param weaponHash
109
- * @param componentHash
110
- * @constructor
111
- */
112
- static getAttachmentPoint(weaponHash, componentHash) {
113
- const componentHashes = WeaponComponentHashesByWeaponHash.get(weaponHash);
114
- if (!componentHashes) {
115
- return ComponentAttachmentPoint.Invalid;
116
- }
117
- if (componentHashes.every((x) => x !== componentHash)) {
118
- return ComponentAttachmentPoint.Invalid;
119
- }
120
- return (ComponentAttachmentPointByHash.get(componentHash) ??
121
- ComponentAttachmentPoint.Invalid);
122
- }
123
- }
@@ -1,174 +0,0 @@
1
- import { WeaponComponent } from "./WeaponComponent";
2
- import { InvalidWeaponComponent } from "./InvalidWeaponComponent";
3
- import { WeaponComponentHashesByWeaponHash } from "./WeaponComponentHashesByWeaponHash";
4
- import { ComponentAttachmentPoint } from "./ComponentAttachmentPoint";
5
- import { ComponentAttachmentPointByHash } from "./ComponentAttachmentPointByHash";
6
- /**
7
- * ped weapon components on weapon
8
- *
9
- */
10
- export class WeaponComponentCollection {
11
- owner;
12
- weapon;
13
- components = new Map();
14
- invalidComponent = new InvalidWeaponComponent();
15
- constructor(owner, weapon) {
16
- this.owner = owner;
17
- this.weapon = weapon;
18
- }
19
- [Symbol.iterator]() {
20
- let pointer = 0;
21
- const components = Array.from(this.components.values());
22
- return {
23
- next() {
24
- if (pointer < components.length) {
25
- return { done: false, value: components[pointer++] };
26
- }
27
- else {
28
- return { done: true, value: null };
29
- }
30
- },
31
- };
32
- }
33
- /**
34
- * get component
35
- *
36
- * @param componentHash
37
- */
38
- get(componentHash) {
39
- if (this.AllWeaponComponentHashes.some((x) => x === componentHash)) {
40
- let component = this.components.get(componentHash);
41
- if (!component) {
42
- component = this.createAndAddComponent(componentHash);
43
- }
44
- return component;
45
- }
46
- return this.invalidComponent;
47
- }
48
- /**
49
- * get current weapon component count
50
- *
51
- * @constructor
52
- */
53
- get Count() {
54
- return this.components.size;
55
- }
56
- /**
57
- * get clip component
58
- *
59
- * @param index - index of component
60
- */
61
- getClipComponent(index) {
62
- return this.getAnyComponentByAttachmentPoints(index, ComponentAttachmentPoint.Clip, ComponentAttachmentPoint.Clip2);
63
- }
64
- /**
65
- * get clip variation count
66
- *
67
- * @constructor
68
- */
69
- get ClipVariationsCount() {
70
- return this.getComponentHashesByAttachmentPoints(ComponentAttachmentPoint.Clip, ComponentAttachmentPoint.Clip2).length;
71
- }
72
- /**
73
- * get scope component
74
- *
75
- * @param index - index of component
76
- */
77
- getScopeComponent(index) {
78
- return this.getAnyComponentByAttachmentPoints(index, ComponentAttachmentPoint.Scope, ComponentAttachmentPoint.Scope2);
79
- }
80
- /**
81
- * get scope variation count
82
- *
83
- * @constructor
84
- */
85
- get ScopeVariationsCount() {
86
- return this.getComponentHashesByAttachmentPoints(ComponentAttachmentPoint.Scope, ComponentAttachmentPoint.Scope2).length;
87
- }
88
- /**
89
- * get suppressor component
90
- *
91
- */
92
- getSuppressorComponent() {
93
- return this.getAnyComponentByAttachmentPoints(undefined, ComponentAttachmentPoint.Supp, ComponentAttachmentPoint.Supp2);
94
- }
95
- /**
96
- * get flash light component
97
- *
98
- */
99
- getFlashLightComponent() {
100
- return this.getAnyComponentByAttachmentPoints(undefined, ComponentAttachmentPoint.FlashLaser, ComponentAttachmentPoint.FlashLaser2);
101
- }
102
- /**
103
- * get luxury finish component
104
- *
105
- */
106
- getLuxuryFinishComponent() {
107
- return this.getAnyComponentByAttachmentPoints(undefined, ComponentAttachmentPoint.GunRoot);
108
- }
109
- /**
110
- * get Mk2 camo component
111
- *
112
- * @param index - index of component
113
- */
114
- getMk2CamoComponent(index) {
115
- return this.getAnyComponentByAttachmentPoints(index, ComponentAttachmentPoint.GunRoot);
116
- }
117
- /**
118
- * get Mk2 barrel component
119
- *
120
- * @param index - index of component
121
- */
122
- getMk2BarrelComponent(index) {
123
- return this.getAnyComponentByAttachmentPoints(index, ComponentAttachmentPoint.Barrel);
124
- }
125
- /**
126
- * Create component object and add to collection
127
- *
128
- * @param hash
129
- * @private
130
- */
131
- createAndAddComponent(hash) {
132
- const uintHash = hash >>> 0;
133
- console.log("createAndAdd", hash, uintHash);
134
- console.log("about to create", this.owner, this.weapon, uintHash);
135
- const component = new WeaponComponent(this.owner, this.weapon, uintHash);
136
- this.components.set(uintHash, component);
137
- return component;
138
- }
139
- /**
140
- * get all WeaponComponentHash belongs to weapon
141
- *
142
- * @constructor
143
- * @private
144
- */
145
- get AllWeaponComponentHashes() {
146
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
147
- return WeaponComponentHashesByWeaponHash.get(this.weapon.Hash);
148
- }
149
- /**
150
- * get components belongs to attachmentPoints
151
- *
152
- * @param attachmentPoints
153
- * @private
154
- */
155
- getComponentHashesByAttachmentPoints(...attachmentPoints) {
156
- return this.AllWeaponComponentHashes.filter((hash) => attachmentPoints.some((attachmentPoint) => ComponentAttachmentPointByHash.get(hash) === attachmentPoint));
157
- }
158
- /**
159
- * get component by index and attachmentPoints
160
- *
161
- * @param index - component index
162
- * @param attachmentPoints - attachmentPoints to search
163
- * @private
164
- */
165
- getAnyComponentByAttachmentPoints(index, ...attachmentPoints) {
166
- const hashes = this.getComponentHashesByAttachmentPoints(...attachmentPoints);
167
- if (index === undefined) {
168
- return this.get(hashes[0]) ?? this.invalidComponent;
169
- }
170
- return 0 <= index && index <= hashes.length - 1
171
- ? this.get(hashes[index])
172
- : this.invalidComponent;
173
- }
174
- }