@nativewrappers/fivem 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +33 -0
- package/lib/client/Audio.d.ts +17 -0
- package/lib/client/Audio.js +92 -0
- package/lib/client/Blip.d.ts +39 -0
- package/lib/client/Blip.js +104 -0
- package/lib/client/Camera.d.ts +46 -0
- package/lib/client/Camera.js +161 -0
- package/lib/client/Checkpoint.d.ts +18 -0
- package/lib/client/Checkpoint.js +42 -0
- package/lib/client/Events.d.ts +11 -0
- package/lib/client/Events.js +73 -0
- package/lib/client/Game.d.ts +283 -0
- package/lib/client/Game.js +451 -0
- package/lib/client/GameplayCamera.d.ts +102 -0
- package/lib/client/GameplayCamera.js +141 -0
- package/lib/client/Model.d.ts +134 -0
- package/lib/client/Model.js +198 -0
- package/lib/client/NetworkedScene.d.ts +10 -0
- package/lib/client/NetworkedScene.js +17 -0
- package/lib/client/ParticleEffect.d.ts +80 -0
- package/lib/client/ParticleEffect.js +120 -0
- package/lib/client/ParticleEffectAsset.d.ts +54 -0
- package/lib/client/ParticleEffectAsset.js +104 -0
- package/lib/client/Pickup.d.ts +9 -0
- package/lib/client/Pickup.js +18 -0
- package/lib/client/Raycast.d.ts +49 -0
- package/lib/client/Raycast.js +70 -0
- package/lib/client/RelationshipGroup.d.ts +49 -0
- package/lib/client/RelationshipGroup.js +63 -0
- package/lib/client/Rope.d.ts +99 -0
- package/lib/client/Rope.js +125 -0
- package/lib/client/TaskSequence.d.ts +15 -0
- package/lib/client/TaskSequence.js +43 -0
- package/lib/client/Tasks.d.ts +66 -0
- package/lib/client/Tasks.js +236 -0
- package/lib/client/World.d.ts +402 -0
- package/lib/client/World.js +726 -0
- package/lib/client/cfx/StateBagChangeHandler.d.ts +3 -0
- package/lib/client/cfx/StateBagChangeHandler.js +1 -0
- package/lib/client/cfx/index.d.ts +7 -0
- package/lib/client/cfx/index.js +1 -0
- package/lib/client/enums/Alignment.d.ts +5 -0
- package/lib/client/enums/Alignment.js +6 -0
- package/lib/client/enums/AnimationFlags.d.ts +9 -0
- package/lib/client/enums/AnimationFlags.js +10 -0
- package/lib/client/enums/AudioFlag.d.ts +37 -0
- package/lib/client/enums/AudioFlag.js +38 -0
- package/lib/client/enums/BadgeStyle.d.ts +182 -0
- package/lib/client/enums/BadgeStyle.js +183 -0
- package/lib/client/enums/Blip.d.ts +223 -0
- package/lib/client/enums/Blip.js +225 -0
- package/lib/client/enums/Bone.d.ts +101 -0
- package/lib/client/enums/Bone.js +103 -0
- package/lib/client/enums/CameraShake.d.ts +13 -0
- package/lib/client/enums/CameraShake.js +14 -0
- package/lib/client/enums/CameraTypes.d.ts +7 -0
- package/lib/client/enums/CameraTypes.js +8 -0
- package/lib/client/enums/CheckboxStyle.d.ts +4 -0
- package/lib/client/enums/CheckboxStyle.js +5 -0
- package/lib/client/enums/Checkpoint.d.ts +62 -0
- package/lib/client/enums/Checkpoint.js +67 -0
- package/lib/client/enums/ClassTypes.d.ts +11 -0
- package/lib/client/enums/ClassTypes.js +12 -0
- package/lib/client/enums/CloudHat.d.ts +26 -0
- package/lib/client/enums/CloudHat.js +27 -0
- package/lib/client/enums/Control.d.ts +360 -0
- package/lib/client/enums/Control.js +361 -0
- package/lib/client/enums/CursorSprite.d.ts +14 -0
- package/lib/client/enums/CursorSprite.js +15 -0
- package/lib/client/enums/Driving.d.ts +32 -0
- package/lib/client/enums/Driving.js +34 -0
- package/lib/client/enums/ExplosionType.d.ts +44 -0
- package/lib/client/enums/ExplosionType.js +45 -0
- package/lib/client/enums/FiringPattern.d.ts +19 -0
- package/lib/client/enums/FiringPattern.js +20 -0
- package/lib/client/enums/Font.d.ts +7 -0
- package/lib/client/enums/Font.js +8 -0
- package/lib/client/enums/ForceType.d.ts +8 -0
- package/lib/client/enums/ForceType.js +9 -0
- package/lib/client/enums/Gender.d.ts +4 -0
- package/lib/client/enums/Gender.js +5 -0
- package/lib/client/enums/HelmetType.d.ts +5 -0
- package/lib/client/enums/HelmetType.js +6 -0
- package/lib/client/enums/HudColor.d.ts +183 -0
- package/lib/client/enums/HudColor.js +184 -0
- package/lib/client/enums/HudComponent.d.ts +53 -0
- package/lib/client/enums/HudComponent.js +54 -0
- package/lib/client/enums/InputMode.d.ts +4 -0
- package/lib/client/enums/InputMode.js +5 -0
- package/lib/client/enums/IntersectOptions.d.ts +15 -0
- package/lib/client/enums/IntersectOptions.js +16 -0
- package/lib/client/enums/InvertAxis.d.ts +9 -0
- package/lib/client/enums/InvertAxis.js +7 -0
- package/lib/client/enums/Language.d.ts +14 -0
- package/lib/client/enums/Language.js +15 -0
- package/lib/client/enums/LeaveVehicleFlags.d.ts +10 -0
- package/lib/client/enums/LeaveVehicleFlags.js +11 -0
- package/lib/client/enums/LoadingSpinnerType.d.ts +7 -0
- package/lib/client/enums/LoadingSpinnerType.js +8 -0
- package/lib/client/enums/MarkerType.d.ts +49 -0
- package/lib/client/enums/MarkerType.js +50 -0
- package/lib/client/enums/MenuAlignment.d.ts +4 -0
- package/lib/client/enums/MenuAlignment.js +5 -0
- package/lib/client/enums/NotificationType.d.ts +10 -0
- package/lib/client/enums/NotificationType.js +11 -0
- package/lib/client/enums/Parachute.d.ts +13 -0
- package/lib/client/enums/Parachute.js +15 -0
- package/lib/client/enums/PickupType.d.ts +73 -0
- package/lib/client/enums/PickupType.js +74 -0
- package/lib/client/enums/RadioStation.d.ts +24 -0
- package/lib/client/enums/RadioStation.js +25 -0
- package/lib/client/enums/RagdollType.d.ts +6 -0
- package/lib/client/enums/RagdollType.js +7 -0
- package/lib/client/enums/Relationship.d.ts +9 -0
- package/lib/client/enums/Relationship.js +10 -0
- package/lib/client/enums/RopeType.d.ts +5 -0
- package/lib/client/enums/RopeType.js +6 -0
- package/lib/client/enums/ScreenEffect.d.ts +83 -0
- package/lib/client/enums/ScreenEffect.js +84 -0
- package/lib/client/enums/SpeechModifier.d.ts +39 -0
- package/lib/client/enums/SpeechModifier.js +40 -0
- package/lib/client/enums/Vehicle.d.ts +358 -0
- package/lib/client/enums/Vehicle.js +376 -0
- package/lib/client/enums/Weather.d.ts +21 -0
- package/lib/client/enums/Weather.js +22 -0
- package/lib/client/enums/ZoneID.d.ts +94 -0
- package/lib/client/enums/ZoneID.js +95 -0
- package/lib/client/enums/index.d.ts +42 -0
- package/lib/client/enums/index.js +42 -0
- package/lib/client/hashes/MaterialHash.d.ts +216 -0
- package/lib/client/hashes/MaterialHash.js +217 -0
- package/lib/client/hashes/PedHash.d.ts +724 -0
- package/lib/client/hashes/PedHash.js +725 -0
- package/lib/client/hashes/VehicleHash.d.ts +522 -0
- package/lib/client/hashes/VehicleHash.js +523 -0
- package/lib/client/hashes/WeaponHash.d.ts +147 -0
- package/lib/client/hashes/WeaponHash.js +161 -0
- package/lib/client/hashes/WeatherTypeHash.d.ts +21 -0
- package/lib/client/hashes/WeatherTypeHash.js +22 -0
- package/lib/client/hashes/index.d.ts +5 -0
- package/lib/client/hashes/index.js +5 -0
- package/lib/client/index.d.ts +24 -0
- package/lib/client/index.js +25 -0
- package/lib/client/interfaces/Dimensions.d.ts +5 -0
- package/lib/client/interfaces/Dimensions.js +1 -0
- package/lib/client/models/BaseEntity.d.ts +169 -0
- package/lib/client/models/BaseEntity.js +459 -0
- package/lib/client/models/Entity.d.ts +9 -0
- package/lib/client/models/Entity.js +24 -0
- package/lib/client/models/EntityBone.d.ts +12 -0
- package/lib/client/models/EntityBone.js +24 -0
- package/lib/client/models/EntityBoneCollection.d.ts +11 -0
- package/lib/client/models/EntityBoneCollection.js +16 -0
- package/lib/client/models/Ped.d.ts +199 -0
- package/lib/client/models/Ped.js +685 -0
- package/lib/client/models/PedBone.d.ts +6 -0
- package/lib/client/models/PedBone.js +9 -0
- package/lib/client/models/PedBoneCollection.d.ts +8 -0
- package/lib/client/models/PedBoneCollection.js +19 -0
- package/lib/client/models/Player.d.ts +63 -0
- package/lib/client/models/Player.js +174 -0
- package/lib/client/models/Prop.d.ts +11 -0
- package/lib/client/models/Prop.js +26 -0
- package/lib/client/models/Vehicle.d.ts +171 -0
- package/lib/client/models/Vehicle.js +551 -0
- package/lib/client/models/VehicleDoor.d.ts +19 -0
- package/lib/client/models/VehicleDoor.js +42 -0
- package/lib/client/models/VehicleDoorCollection.d.ts +14 -0
- package/lib/client/models/VehicleDoorCollection.js +61 -0
- package/lib/client/models/VehicleMod.d.ts +16 -0
- package/lib/client/models/VehicleMod.js +33 -0
- package/lib/client/models/VehicleModCollection.d.ts +61 -0
- package/lib/client/models/VehicleModCollection.js +227 -0
- package/lib/client/models/VehicleToggleMod.d.ts +14 -0
- package/lib/client/models/VehicleToggleMod.js +27 -0
- package/lib/client/models/VehicleWheel.d.ts +11 -0
- package/lib/client/models/VehicleWheel.js +21 -0
- package/lib/client/models/VehicleWheelCollection.d.ts +13 -0
- package/lib/client/models/VehicleWheelCollection.js +56 -0
- package/lib/client/models/VehicleWindow.d.ts +16 -0
- package/lib/client/models/VehicleWindow.js +33 -0
- package/lib/client/models/VehicleWindowCollection.d.ts +14 -0
- package/lib/client/models/VehicleWindowCollection.js +55 -0
- package/lib/client/models/index.d.ts +18 -0
- package/lib/client/models/index.js +18 -0
- package/lib/client/types/EntityType.d.ts +2 -0
- package/lib/client/types/EntityType.js +1 -0
- package/lib/client/ui/Container.d.ts +11 -0
- package/lib/client/ui/Container.js +28 -0
- package/lib/client/ui/Effects.d.ts +8 -0
- package/lib/client/ui/Effects.js +106 -0
- package/lib/client/ui/Fading.d.ts +41 -0
- package/lib/client/ui/Fading.js +69 -0
- package/lib/client/ui/Hud.d.ts +16 -0
- package/lib/client/ui/Hud.js +39 -0
- package/lib/client/ui/InstructionalButtons.d.ts +33 -0
- package/lib/client/ui/InstructionalButtons.js +53 -0
- package/lib/client/ui/LoadingPrompt.d.ts +27 -0
- package/lib/client/ui/LoadingPrompt.js +45 -0
- package/lib/client/ui/Notification.d.ts +5 -0
- package/lib/client/ui/Notification.js +8 -0
- package/lib/client/ui/Rectangle.d.ts +10 -0
- package/lib/client/ui/Rectangle.js +37 -0
- package/lib/client/ui/Scaleform.d.ts +106 -0
- package/lib/client/ui/Scaleform.js +234 -0
- package/lib/client/ui/Screen.d.ts +16 -0
- package/lib/client/ui/Screen.js +72 -0
- package/lib/client/ui/Sprite.d.ts +17 -0
- package/lib/client/ui/Sprite.js +53 -0
- package/lib/client/ui/Text.d.ts +31 -0
- package/lib/client/ui/Text.js +102 -0
- package/lib/client/ui/Timerbar.d.ts +44 -0
- package/lib/client/ui/Timerbar.js +241 -0
- package/lib/client/ui/index.d.ts +15 -0
- package/lib/client/ui/index.js +15 -0
- package/lib/client/ui/interfaces/IButton.d.ts +5 -0
- package/lib/client/ui/interfaces/IButton.js +1 -0
- package/lib/client/ui/interfaces/IDrawable.d.ts +7 -0
- package/lib/client/ui/interfaces/IDrawable.js +1 -0
- package/lib/client/ui/interfaces/index.d.ts +2 -0
- package/lib/client/ui/interfaces/index.js +1 -0
- package/lib/client/ui/menu/Menu.d.ts +108 -0
- package/lib/client/ui/menu/Menu.js +802 -0
- package/lib/client/ui/menu/MenuControl.d.ts +6 -0
- package/lib/client/ui/menu/MenuControl.js +11 -0
- package/lib/client/ui/menu/MenuControls.d.ts +9 -0
- package/lib/client/ui/menu/MenuControls.js +11 -0
- package/lib/client/ui/menu/MenuSettings.d.ts +20 -0
- package/lib/client/ui/menu/MenuSettings.js +51 -0
- package/lib/client/ui/menu/index.d.ts +6 -0
- package/lib/client/ui/menu/index.js +6 -0
- package/lib/client/ui/menu/items/UIMenuCheckboxItem.d.ts +20 -0
- package/lib/client/ui/menu/items/UIMenuCheckboxItem.js +57 -0
- package/lib/client/ui/menu/items/UIMenuItem.d.ts +78 -0
- package/lib/client/ui/menu/items/UIMenuItem.js +1090 -0
- package/lib/client/ui/menu/items/UIMenuListItem.d.ts +31 -0
- package/lib/client/ui/menu/items/UIMenuListItem.js +110 -0
- package/lib/client/ui/menu/items/UIMenuSeparatorItem.d.ts +11 -0
- package/lib/client/ui/menu/items/UIMenuSeparatorItem.js +29 -0
- package/lib/client/ui/menu/items/UIMenuSliderItem.d.ts +47 -0
- package/lib/client/ui/menu/items/UIMenuSliderItem.js +173 -0
- package/lib/client/ui/menu/items/index.d.ts +6 -0
- package/lib/client/ui/menu/items/index.js +6 -0
- package/lib/client/ui/menu/items/panels/AbstractUIMenuPanel.d.ts +17 -0
- package/lib/client/ui/menu/items/panels/AbstractUIMenuPanel.js +43 -0
- package/lib/client/ui/menu/items/panels/UIMenuColorPanel.d.ts +36 -0
- package/lib/client/ui/menu/items/panels/UIMenuColorPanel.js +211 -0
- package/lib/client/ui/menu/items/panels/UIMenuGridPanel.d.ts +40 -0
- package/lib/client/ui/menu/items/panels/UIMenuGridPanel.js +215 -0
- package/lib/client/ui/menu/items/panels/UIMenuPercentagePanel.d.ts +26 -0
- package/lib/client/ui/menu/items/panels/UIMenuPercentagePanel.js +115 -0
- package/lib/client/ui/menu/items/panels/UIMenuStatisticsPanel.d.ts +16 -0
- package/lib/client/ui/menu/items/panels/UIMenuStatisticsPanel.js +77 -0
- package/lib/client/ui/menu/items/panels/UIMenuStatisticsPanelItem.d.ts +13 -0
- package/lib/client/ui/menu/items/panels/UIMenuStatisticsPanelItem.js +32 -0
- package/lib/client/ui/menu/items/panels/index.d.ts +6 -0
- package/lib/client/ui/menu/items/panels/index.js +6 -0
- package/lib/client/ui/menu/modules/ListItem.d.ts +6 -0
- package/lib/client/ui/menu/modules/ListItem.js +8 -0
- package/lib/client/ui/menu/modules/index.d.ts +1 -0
- package/lib/client/ui/menu/modules/index.js +1 -0
- package/lib/client/utils/Animations.d.ts +19 -0
- package/lib/client/utils/Animations.js +55 -0
- package/lib/client/utils/Color.d.ts +15 -0
- package/lib/client/utils/Color.js +22 -0
- package/lib/client/utils/Crypto.d.ts +3 -0
- package/lib/client/utils/Crypto.js +25 -0
- package/lib/client/utils/LiteEvent.d.ts +13 -0
- package/lib/client/utils/LiteEvent.js +21 -0
- package/lib/client/utils/Maths.d.ts +4 -0
- package/lib/client/utils/Maths.js +10 -0
- package/lib/client/utils/Point.d.ts +9 -0
- package/lib/client/utils/Point.js +28 -0
- package/lib/client/utils/PointF.d.ts +12 -0
- package/lib/client/utils/PointF.js +11 -0
- package/lib/client/utils/Quaternion.d.ts +10 -0
- package/lib/client/utils/Quaternion.js +23 -0
- package/lib/client/utils/Size.d.ts +5 -0
- package/lib/client/utils/Size.js +6 -0
- package/lib/client/utils/String.d.ts +6 -0
- package/lib/client/utils/String.js +25 -0
- package/lib/client/utils/Vector2.d.ts +54 -0
- package/lib/client/utils/Vector2.js +106 -0
- package/lib/client/utils/Vector3.d.ts +69 -0
- package/lib/client/utils/Vector3.js +140 -0
- package/lib/client/utils/Vector4.d.ts +62 -0
- package/lib/client/utils/Vector4.js +124 -0
- package/lib/client/utils/enumValues.d.ts +12 -0
- package/lib/client/utils/enumValues.js +14 -0
- package/lib/client/utils/getStringFromUInt8Array.d.ts +8 -0
- package/lib/client/utils/getStringFromUInt8Array.js +10 -0
- package/lib/client/utils/getUInt32FromUint8Array.d.ts +8 -0
- package/lib/client/utils/getUInt32FromUint8Array.js +8 -0
- package/lib/client/utils/index.d.ts +10 -0
- package/lib/client/utils/index.js +10 -0
- package/lib/client/weapon/DlcWeaponData.d.ts +43 -0
- package/lib/client/weapon/DlcWeaponData.js +44 -0
- package/lib/client/weapon/Mk2WeaponHash.d.ts +18 -0
- package/lib/client/weapon/Mk2WeaponHash.js +25 -0
- package/lib/client/weapon/Weapon.d.ts +169 -0
- package/lib/client/weapon/Weapon.js +267 -0
- package/lib/client/weapon/WeaponAsset.d.ts +55 -0
- package/lib/client/weapon/WeaponAsset.js +83 -0
- package/lib/client/weapon/WeaponCollection.d.ts +90 -0
- package/lib/client/weapon/WeaponCollection.js +186 -0
- package/lib/client/weapon/WeaponDisplayNameByHash.d.ts +6 -0
- package/lib/client/weapon/WeaponDisplayNameByHash.js +75 -0
- package/lib/client/weapon/WeaponGroup.d.ts +18 -0
- package/lib/client/weapon/WeaponGroup.js +19 -0
- package/lib/client/weapon/WeaponHudStats.d.ts +27 -0
- package/lib/client/weapon/WeaponHudStats.js +38 -0
- package/lib/client/weapon/WeaponLivery.d.ts +13 -0
- package/lib/client/weapon/WeaponLivery.js +14 -0
- package/lib/client/weapon/WeaponLiveryColor.d.ts +34 -0
- package/lib/client/weapon/WeaponLiveryColor.js +35 -0
- package/lib/client/weapon/WeaponTint.d.ts +42 -0
- package/lib/client/weapon/WeaponTint.js +43 -0
- package/lib/client/weapon/index.d.ts +8 -0
- package/lib/client/weapon/index.js +8 -0
- package/lib/client/weaponComponent/ComponentAttachmentPoint.d.ts +18 -0
- package/lib/client/weaponComponent/ComponentAttachmentPoint.js +19 -0
- package/lib/client/weaponComponent/ComponentAttachmentPointByHash.d.ts +7 -0
- package/lib/client/weaponComponent/ComponentAttachmentPointByHash.js +309 -0
- package/lib/client/weaponComponent/ComponentDisplayNameByHash.d.ts +6 -0
- package/lib/client/weaponComponent/ComponentDisplayNameByHash.js +280 -0
- package/lib/client/weaponComponent/DlcWeaponComponentData.d.ts +40 -0
- package/lib/client/weaponComponent/DlcWeaponComponentData.js +44 -0
- package/lib/client/weaponComponent/InvalidWeaponComponent.d.ts +12 -0
- package/lib/client/weaponComponent/InvalidWeaponComponent.js +28 -0
- package/lib/client/weaponComponent/WeaponComponent.d.ts +81 -0
- package/lib/client/weaponComponent/WeaponComponent.js +119 -0
- package/lib/client/weaponComponent/WeaponComponentCollection.d.ts +108 -0
- package/lib/client/weaponComponent/WeaponComponentCollection.js +172 -0
- package/lib/client/weaponComponent/WeaponComponentHash.d.ts +671 -0
- package/lib/client/weaponComponent/WeaponComponentHash.js +887 -0
- package/lib/client/weaponComponent/WeaponComponentHashesByWeaponHash.d.ts +8 -0
- package/lib/client/weaponComponent/WeaponComponentHashesByWeaponHash.js +823 -0
- package/lib/client/weaponComponent/WeaponComponentHudStats.d.ts +27 -0
- package/lib/client/weaponComponent/WeaponComponentHudStats.js +34 -0
- package/lib/client/weaponComponent/index.d.ts +5 -0
- package/lib/client/weaponComponent/index.js +5 -0
- package/lib/common/Convar.d.ts +8 -0
- package/lib/common/Convar.js +20 -0
- package/lib/common/Kvp.d.ts +91 -0
- package/lib/common/Kvp.js +161 -0
- package/lib/common/Resource.d.ts +14 -0
- package/lib/common/Resource.js +35 -0
- package/lib/common/index.d.ts +5 -0
- package/lib/common/index.js +5 -0
- package/lib/common/types.d.ts +6 -0
- package/lib/common/types.js +1 -0
- package/lib/common/utils/Color.d.ts +10 -0
- package/lib/common/utils/Color.js +17 -0
- package/lib/common/utils/Maths.d.ts +4 -0
- package/lib/common/utils/Maths.js +10 -0
- package/lib/common/utils/PointF.d.ts +12 -0
- package/lib/common/utils/PointF.js +11 -0
- package/lib/common/utils/Quaternion.d.ts +10 -0
- package/lib/common/utils/Quaternion.js +23 -0
- package/lib/common/utils/Vector2.d.ts +58 -0
- package/lib/common/utils/Vector2.js +113 -0
- package/lib/common/utils/Vector3.d.ts +73 -0
- package/lib/common/utils/Vector3.js +147 -0
- package/lib/common/utils/Vector4.d.ts +66 -0
- package/lib/common/utils/Vector4.js +131 -0
- package/lib/common/utils/cleanPlayerName.d.ts +6 -0
- package/lib/common/utils/cleanPlayerName.js +27 -0
- package/lib/common/utils/enumValues.d.ts +12 -0
- package/lib/common/utils/enumValues.js +14 -0
- package/lib/common/utils/getStringFromUInt8Array.d.ts +8 -0
- package/lib/common/utils/getStringFromUInt8Array.js +10 -0
- package/lib/common/utils/getUInt32FromUint8Array.d.ts +8 -0
- package/lib/common/utils/getUInt32FromUint8Array.js +8 -0
- package/lib/common/utils/index.d.ts +12 -0
- package/lib/common/utils/index.js +12 -0
- package/lib/server/Anticheat.d.ts +0 -0
- package/lib/server/Anticheat.js +25 -0
- package/lib/server/Events.d.ts +35 -0
- package/lib/server/Events.js +102 -0
- package/lib/server/Game.d.ts +56 -0
- package/lib/server/Game.js +86 -0
- package/lib/server/cfx/StateBagChangeHandler.d.ts +9 -0
- package/lib/server/cfx/StateBagChangeHandler.js +4 -0
- package/lib/server/cfx/index.d.ts +7 -0
- package/lib/server/cfx/index.js +1 -0
- package/lib/server/entities/BaseEntity.d.ts +115 -0
- package/lib/server/entities/BaseEntity.js +161 -0
- package/lib/server/entities/Entity.d.ts +18 -0
- package/lib/server/entities/Entity.js +22 -0
- package/lib/server/entities/Ped.d.ts +87 -0
- package/lib/server/entities/Ped.js +122 -0
- package/lib/server/entities/Player.d.ts +163 -0
- package/lib/server/entities/Player.js +235 -0
- package/lib/server/entities/Prop.d.ts +32 -0
- package/lib/server/entities/Prop.js +42 -0
- package/lib/server/entities/Vehicle.d.ts +230 -0
- package/lib/server/entities/Vehicle.js +331 -0
- package/lib/server/entities/index.d.ts +5 -0
- package/lib/server/entities/index.js +5 -0
- package/lib/server/enum/ClassTypes.d.ts +11 -0
- package/lib/server/enum/ClassTypes.js +12 -0
- package/lib/server/enum/PopulationType.d.ts +13 -0
- package/lib/server/enum/PopulationType.js +14 -0
- package/lib/server/enum/VehicleLockStatus.d.ts +9 -0
- package/lib/server/enum/VehicleLockStatus.js +10 -0
- package/lib/server/enum/VehicleType.d.ts +10 -0
- package/lib/server/enum/VehicleType.js +11 -0
- package/lib/server/enum/eEntityType.d.ts +5 -0
- package/lib/server/enum/eEntityType.js +6 -0
- package/lib/server/enum/index.d.ts +5 -0
- package/lib/server/enum/index.js +5 -0
- package/lib/server/index.d.ts +7 -0
- package/lib/server/index.js +7 -0
- package/lib/server/type/Anticheat.d.ts +471 -0
- package/lib/server/type/Anticheat.js +160 -0
- package/lib/server/type/Hash.d.ts +3 -0
- package/lib/server/type/Hash.js +2 -0
- package/lib/server/utils/index.d.ts +1 -0
- package/lib/server/utils/index.js +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,44 @@
|
|
|
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()();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WeaponComponent } from './WeaponComponent';
|
|
2
|
+
import { WeaponComponentHash } from './WeaponComponentHash';
|
|
3
|
+
import { WeaponHash } from '../hashes';
|
|
4
|
+
import { ComponentAttachmentPoint } from './ComponentAttachmentPoint';
|
|
5
|
+
export declare class InvalidWeaponComponent extends WeaponComponent {
|
|
6
|
+
constructor();
|
|
7
|
+
get Active(): boolean;
|
|
8
|
+
set Active(value: boolean);
|
|
9
|
+
get DisplayName(): string;
|
|
10
|
+
get LocalizedName(): string;
|
|
11
|
+
static getAttachmentPoint(hash: WeaponHash, componentHash: WeaponComponentHash): ComponentAttachmentPoint;
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Ped } from '../models';
|
|
2
|
+
import { Weapon } from '../weapon';
|
|
3
|
+
import { WeaponComponentHash } from './WeaponComponentHash';
|
|
4
|
+
import { WeaponHash } from '../hashes';
|
|
5
|
+
import { ComponentAttachmentPoint } from './ComponentAttachmentPoint';
|
|
6
|
+
import { WeaponComponentHudStats } from './WeaponComponentHudStats';
|
|
7
|
+
/**
|
|
8
|
+
* ped weapon component on weapon
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare class WeaponComponent {
|
|
12
|
+
protected readonly owner: Ped;
|
|
13
|
+
protected readonly weapon: Weapon;
|
|
14
|
+
protected readonly componentHash: WeaponComponentHash;
|
|
15
|
+
constructor(owner: Ped, weapon: Weapon, componentHash: WeaponComponentHash);
|
|
16
|
+
/**
|
|
17
|
+
* Check WeaponComponent is invalid or not
|
|
18
|
+
*
|
|
19
|
+
* @constructor
|
|
20
|
+
*/
|
|
21
|
+
get IsInvalid(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* get component hash
|
|
24
|
+
*
|
|
25
|
+
* @constructor
|
|
26
|
+
*/
|
|
27
|
+
get ComponentHash(): WeaponComponentHash;
|
|
28
|
+
/**
|
|
29
|
+
* check ped has weapon component
|
|
30
|
+
*
|
|
31
|
+
* @constructor
|
|
32
|
+
*/
|
|
33
|
+
get Active(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* give weapon component to ped
|
|
36
|
+
*
|
|
37
|
+
* @param value
|
|
38
|
+
* @constructor
|
|
39
|
+
*/
|
|
40
|
+
set Active(value: boolean);
|
|
41
|
+
/**
|
|
42
|
+
* get component display name / label
|
|
43
|
+
*
|
|
44
|
+
* @constructor
|
|
45
|
+
*/
|
|
46
|
+
get DisplayName(): string;
|
|
47
|
+
/**
|
|
48
|
+
* get component localized name
|
|
49
|
+
*
|
|
50
|
+
* @constructor
|
|
51
|
+
*/
|
|
52
|
+
get LocalizedName(): string;
|
|
53
|
+
/**
|
|
54
|
+
* get component attachment point
|
|
55
|
+
*
|
|
56
|
+
* @constructor
|
|
57
|
+
*/
|
|
58
|
+
get AttachmentPoint(): ComponentAttachmentPoint;
|
|
59
|
+
/**
|
|
60
|
+
* get component hud stats
|
|
61
|
+
*
|
|
62
|
+
* @constructor
|
|
63
|
+
*/
|
|
64
|
+
get HudStats(): WeaponComponentHudStats;
|
|
65
|
+
/**
|
|
66
|
+
* get component display name / label by hash
|
|
67
|
+
*
|
|
68
|
+
* @param hash
|
|
69
|
+
* @param componentHash
|
|
70
|
+
* @constructor
|
|
71
|
+
*/
|
|
72
|
+
static getComponentDisplayNameFromHash(hash: WeaponHash, componentHash: WeaponComponentHash): string;
|
|
73
|
+
/**
|
|
74
|
+
* get component attachment point by WeaponHash and WeaponComponentHash
|
|
75
|
+
*
|
|
76
|
+
* @param weaponHash
|
|
77
|
+
* @param componentHash
|
|
78
|
+
* @constructor
|
|
79
|
+
*/
|
|
80
|
+
static getAttachmentPoint(weaponHash: WeaponHash, componentHash: WeaponComponentHash): ComponentAttachmentPoint;
|
|
81
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
constructor(owner, weapon, componentHash) {
|
|
14
|
+
this.owner = owner;
|
|
15
|
+
this.weapon = weapon;
|
|
16
|
+
this.componentHash = componentHash;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Check WeaponComponent is invalid or not
|
|
20
|
+
*
|
|
21
|
+
* @constructor
|
|
22
|
+
*/
|
|
23
|
+
get IsInvalid() {
|
|
24
|
+
return this.componentHash === WeaponComponentHash.Invalid;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* get component hash
|
|
28
|
+
*
|
|
29
|
+
* @constructor
|
|
30
|
+
*/
|
|
31
|
+
get ComponentHash() {
|
|
32
|
+
return this.componentHash;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* check ped has weapon component
|
|
36
|
+
*
|
|
37
|
+
* @constructor
|
|
38
|
+
*/
|
|
39
|
+
get Active() {
|
|
40
|
+
return HasPedGotWeaponComponent(this.owner.Handle, this.weapon.Hash, this.componentHash);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* give weapon component to ped
|
|
44
|
+
*
|
|
45
|
+
* @param value
|
|
46
|
+
* @constructor
|
|
47
|
+
*/
|
|
48
|
+
set Active(value) {
|
|
49
|
+
if (value) {
|
|
50
|
+
GiveWeaponComponentToPed(this.owner.Handle, this.weapon.Hash, this.componentHash);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
RemoveWeaponComponentFromPed(this.owner.Handle, this.weapon.Hash, this.componentHash);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* get component display name / label
|
|
58
|
+
*
|
|
59
|
+
* @constructor
|
|
60
|
+
*/
|
|
61
|
+
get DisplayName() {
|
|
62
|
+
return WeaponComponent.getComponentDisplayNameFromHash(this.weapon.Hash, this.componentHash);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* get component localized name
|
|
66
|
+
*
|
|
67
|
+
* @constructor
|
|
68
|
+
*/
|
|
69
|
+
get LocalizedName() {
|
|
70
|
+
return Game.getGXTEntry(this.DisplayName);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* get component attachment point
|
|
74
|
+
*
|
|
75
|
+
* @constructor
|
|
76
|
+
*/
|
|
77
|
+
get AttachmentPoint() {
|
|
78
|
+
return WeaponComponent.getAttachmentPoint(this.weapon.Hash, this.componentHash);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* get component hud stats
|
|
82
|
+
*
|
|
83
|
+
* @constructor
|
|
84
|
+
*/
|
|
85
|
+
get HudStats() {
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
87
|
+
return WeaponComponentHudStats.get(this.componentHash);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* get component display name / label by hash
|
|
91
|
+
*
|
|
92
|
+
* @param hash
|
|
93
|
+
* @param componentHash
|
|
94
|
+
* @constructor
|
|
95
|
+
*/
|
|
96
|
+
static getComponentDisplayNameFromHash(hash, componentHash) {
|
|
97
|
+
if (!hash) {
|
|
98
|
+
return 'WCT_INVALID';
|
|
99
|
+
}
|
|
100
|
+
return ComponentDisplayNameByHash.get(componentHash) ?? 'WCT_INVALID';
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* get component attachment point by WeaponHash and WeaponComponentHash
|
|
104
|
+
*
|
|
105
|
+
* @param weaponHash
|
|
106
|
+
* @param componentHash
|
|
107
|
+
* @constructor
|
|
108
|
+
*/
|
|
109
|
+
static getAttachmentPoint(weaponHash, componentHash) {
|
|
110
|
+
const componentHashes = WeaponComponentHashesByWeaponHash.get(weaponHash);
|
|
111
|
+
if (!componentHashes) {
|
|
112
|
+
return ComponentAttachmentPoint.Invalid;
|
|
113
|
+
}
|
|
114
|
+
if (componentHashes.every(x => x !== componentHash)) {
|
|
115
|
+
return ComponentAttachmentPoint.Invalid;
|
|
116
|
+
}
|
|
117
|
+
return ComponentAttachmentPointByHash.get(componentHash) ?? ComponentAttachmentPoint.Invalid;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Ped } from '../models';
|
|
2
|
+
import { Weapon } from '../weapon';
|
|
3
|
+
import { WeaponComponentHash } from './WeaponComponentHash';
|
|
4
|
+
import { WeaponComponent } from './WeaponComponent';
|
|
5
|
+
/**
|
|
6
|
+
* ped weapon components on weapon
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export declare class WeaponComponentCollection implements Iterable<WeaponComponent> {
|
|
10
|
+
private readonly owner;
|
|
11
|
+
private readonly weapon;
|
|
12
|
+
private readonly components;
|
|
13
|
+
private readonly invalidComponent;
|
|
14
|
+
constructor(owner: Ped, weapon: Weapon);
|
|
15
|
+
[Symbol.iterator](): Iterator<WeaponComponent>;
|
|
16
|
+
/**
|
|
17
|
+
* get component
|
|
18
|
+
*
|
|
19
|
+
* @param componentHash
|
|
20
|
+
*/
|
|
21
|
+
get(componentHash: WeaponComponentHash): WeaponComponent;
|
|
22
|
+
/**
|
|
23
|
+
* get current weapon component count
|
|
24
|
+
*
|
|
25
|
+
* @constructor
|
|
26
|
+
*/
|
|
27
|
+
get Count(): number;
|
|
28
|
+
/**
|
|
29
|
+
* get clip component
|
|
30
|
+
*
|
|
31
|
+
* @param index - index of component
|
|
32
|
+
*/
|
|
33
|
+
getClipComponent(index: number): WeaponComponent;
|
|
34
|
+
/**
|
|
35
|
+
* get clip variation count
|
|
36
|
+
*
|
|
37
|
+
* @constructor
|
|
38
|
+
*/
|
|
39
|
+
get ClipVariationsCount(): number;
|
|
40
|
+
/**
|
|
41
|
+
* get scope component
|
|
42
|
+
*
|
|
43
|
+
* @param index - index of component
|
|
44
|
+
*/
|
|
45
|
+
getScopeComponent(index: number): WeaponComponent;
|
|
46
|
+
/**
|
|
47
|
+
* get scope variation count
|
|
48
|
+
*
|
|
49
|
+
* @constructor
|
|
50
|
+
*/
|
|
51
|
+
get ScopeVariationsCount(): number;
|
|
52
|
+
/**
|
|
53
|
+
* get suppressor component
|
|
54
|
+
*
|
|
55
|
+
*/
|
|
56
|
+
getSuppressorComponent(): WeaponComponent;
|
|
57
|
+
/**
|
|
58
|
+
* get flash light component
|
|
59
|
+
*
|
|
60
|
+
*/
|
|
61
|
+
getFlashLightComponent(): WeaponComponent;
|
|
62
|
+
/**
|
|
63
|
+
* get luxury finish component
|
|
64
|
+
*
|
|
65
|
+
*/
|
|
66
|
+
getLuxuryFinishComponent(): WeaponComponent;
|
|
67
|
+
/**
|
|
68
|
+
* get Mk2 camo component
|
|
69
|
+
*
|
|
70
|
+
* @param index - index of component
|
|
71
|
+
*/
|
|
72
|
+
getMk2CamoComponent(index: number): WeaponComponent;
|
|
73
|
+
/**
|
|
74
|
+
* get Mk2 barrel component
|
|
75
|
+
*
|
|
76
|
+
* @param index - index of component
|
|
77
|
+
*/
|
|
78
|
+
getMk2BarrelComponent(index: number): WeaponComponent;
|
|
79
|
+
/**
|
|
80
|
+
* Create component object and add to collection
|
|
81
|
+
*
|
|
82
|
+
* @param hash
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
private createAndAddComponent;
|
|
86
|
+
/**
|
|
87
|
+
* get all WeaponComponentHash belongs to weapon
|
|
88
|
+
*
|
|
89
|
+
* @constructor
|
|
90
|
+
* @private
|
|
91
|
+
*/
|
|
92
|
+
private get AllWeaponComponentHashes();
|
|
93
|
+
/**
|
|
94
|
+
* get components belongs to attachmentPoints
|
|
95
|
+
*
|
|
96
|
+
* @param attachmentPoints
|
|
97
|
+
* @private
|
|
98
|
+
*/
|
|
99
|
+
private getComponentHashesByAttachmentPoints;
|
|
100
|
+
/**
|
|
101
|
+
* get component by index and attachmentPoints
|
|
102
|
+
*
|
|
103
|
+
* @param index - component index
|
|
104
|
+
* @param attachmentPoints - attachmentPoints to search
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
107
|
+
private getAnyComponentByAttachmentPoints;
|
|
108
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
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
|
+
constructor(owner, weapon) {
|
|
12
|
+
this.components = new Map();
|
|
13
|
+
this.invalidComponent = new InvalidWeaponComponent();
|
|
14
|
+
this.owner = owner;
|
|
15
|
+
this.weapon = weapon;
|
|
16
|
+
}
|
|
17
|
+
[Symbol.iterator]() {
|
|
18
|
+
let pointer = 0;
|
|
19
|
+
const components = Array.from(this.components.values());
|
|
20
|
+
return {
|
|
21
|
+
next() {
|
|
22
|
+
if (pointer < components.length) {
|
|
23
|
+
return { done: false, value: components[pointer++] };
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return { done: true, value: null };
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* get component
|
|
33
|
+
*
|
|
34
|
+
* @param componentHash
|
|
35
|
+
*/
|
|
36
|
+
get(componentHash) {
|
|
37
|
+
if (this.AllWeaponComponentHashes.some(x => x === componentHash)) {
|
|
38
|
+
let component = this.components.get(componentHash);
|
|
39
|
+
if (!component) {
|
|
40
|
+
component = this.createAndAddComponent(componentHash);
|
|
41
|
+
}
|
|
42
|
+
return component;
|
|
43
|
+
}
|
|
44
|
+
return this.invalidComponent;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* get current weapon component count
|
|
48
|
+
*
|
|
49
|
+
* @constructor
|
|
50
|
+
*/
|
|
51
|
+
get Count() {
|
|
52
|
+
return this.components.size;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* get clip component
|
|
56
|
+
*
|
|
57
|
+
* @param index - index of component
|
|
58
|
+
*/
|
|
59
|
+
getClipComponent(index) {
|
|
60
|
+
return this.getAnyComponentByAttachmentPoints(index, ComponentAttachmentPoint.Clip, ComponentAttachmentPoint.Clip2);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* get clip variation count
|
|
64
|
+
*
|
|
65
|
+
* @constructor
|
|
66
|
+
*/
|
|
67
|
+
get ClipVariationsCount() {
|
|
68
|
+
return this.getComponentHashesByAttachmentPoints(ComponentAttachmentPoint.Clip, ComponentAttachmentPoint.Clip2).length;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* get scope component
|
|
72
|
+
*
|
|
73
|
+
* @param index - index of component
|
|
74
|
+
*/
|
|
75
|
+
getScopeComponent(index) {
|
|
76
|
+
return this.getAnyComponentByAttachmentPoints(index, ComponentAttachmentPoint.Scope, ComponentAttachmentPoint.Scope2);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* get scope variation count
|
|
80
|
+
*
|
|
81
|
+
* @constructor
|
|
82
|
+
*/
|
|
83
|
+
get ScopeVariationsCount() {
|
|
84
|
+
return this.getComponentHashesByAttachmentPoints(ComponentAttachmentPoint.Scope, ComponentAttachmentPoint.Scope2).length;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* get suppressor component
|
|
88
|
+
*
|
|
89
|
+
*/
|
|
90
|
+
getSuppressorComponent() {
|
|
91
|
+
return this.getAnyComponentByAttachmentPoints(undefined, ComponentAttachmentPoint.Supp, ComponentAttachmentPoint.Supp2);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* get flash light component
|
|
95
|
+
*
|
|
96
|
+
*/
|
|
97
|
+
getFlashLightComponent() {
|
|
98
|
+
return this.getAnyComponentByAttachmentPoints(undefined, ComponentAttachmentPoint.FlashLaser, ComponentAttachmentPoint.FlashLaser2);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* get luxury finish component
|
|
102
|
+
*
|
|
103
|
+
*/
|
|
104
|
+
getLuxuryFinishComponent() {
|
|
105
|
+
return this.getAnyComponentByAttachmentPoints(undefined, ComponentAttachmentPoint.GunRoot);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* get Mk2 camo component
|
|
109
|
+
*
|
|
110
|
+
* @param index - index of component
|
|
111
|
+
*/
|
|
112
|
+
getMk2CamoComponent(index) {
|
|
113
|
+
return this.getAnyComponentByAttachmentPoints(index, ComponentAttachmentPoint.GunRoot);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* get Mk2 barrel component
|
|
117
|
+
*
|
|
118
|
+
* @param index - index of component
|
|
119
|
+
*/
|
|
120
|
+
getMk2BarrelComponent(index) {
|
|
121
|
+
return this.getAnyComponentByAttachmentPoints(index, ComponentAttachmentPoint.Barrel);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Create component object and add to collection
|
|
125
|
+
*
|
|
126
|
+
* @param hash
|
|
127
|
+
* @private
|
|
128
|
+
*/
|
|
129
|
+
createAndAddComponent(hash) {
|
|
130
|
+
const uintHash = hash >>> 0;
|
|
131
|
+
console.log('createAndAdd', hash, uintHash);
|
|
132
|
+
console.log('about to create', this.owner, this.weapon, uintHash);
|
|
133
|
+
const component = new WeaponComponent(this.owner, this.weapon, uintHash);
|
|
134
|
+
this.components.set(uintHash, component);
|
|
135
|
+
return component;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* get all WeaponComponentHash belongs to weapon
|
|
139
|
+
*
|
|
140
|
+
* @constructor
|
|
141
|
+
* @private
|
|
142
|
+
*/
|
|
143
|
+
get AllWeaponComponentHashes() {
|
|
144
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
145
|
+
return WeaponComponentHashesByWeaponHash.get(this.weapon.Hash);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* get components belongs to attachmentPoints
|
|
149
|
+
*
|
|
150
|
+
* @param attachmentPoints
|
|
151
|
+
* @private
|
|
152
|
+
*/
|
|
153
|
+
getComponentHashesByAttachmentPoints(...attachmentPoints) {
|
|
154
|
+
return this.AllWeaponComponentHashes.filter(hash => attachmentPoints.some(attachmentPoint => ComponentAttachmentPointByHash.get(hash) === attachmentPoint));
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* get component by index and attachmentPoints
|
|
158
|
+
*
|
|
159
|
+
* @param index - component index
|
|
160
|
+
* @param attachmentPoints - attachmentPoints to search
|
|
161
|
+
* @private
|
|
162
|
+
*/
|
|
163
|
+
getAnyComponentByAttachmentPoints(index, ...attachmentPoints) {
|
|
164
|
+
const hashes = this.getComponentHashesByAttachmentPoints(...attachmentPoints);
|
|
165
|
+
if (index === undefined) {
|
|
166
|
+
return this.get(hashes[0]) ?? this.invalidComponent;
|
|
167
|
+
}
|
|
168
|
+
return 0 <= index && index <= hashes.length - 1
|
|
169
|
+
? this.get(hashes[index])
|
|
170
|
+
: this.invalidComponent;
|
|
171
|
+
}
|
|
172
|
+
}
|