@nativewrappers/fivem 0.0.80 → 0.0.82
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/Audio.d.ts +2 -2
- package/Audio.js +99 -0
- package/Blip.d.ts +4 -3
- package/Blip.js +113 -0
- package/Camera.d.ts +3 -3
- package/Camera.js +190 -0
- package/Checkpoint.d.ts +2 -2
- package/Checkpoint.js +51 -0
- package/Events.js +80 -0
- package/Game.d.ts +10 -3
- package/Game.js +478 -0
- package/GameplayCamera.d.ts +2 -2
- package/GameplayCamera.js +152 -0
- package/Model.js +210 -0
- package/NetworkedScene.d.ts +2 -1
- package/NetworkedScene.js +50 -0
- package/ParticleEffect.d.ts +4 -3
- package/ParticleEffect.js +128 -0
- package/ParticleEffectAsset.d.ts +2 -2
- package/ParticleEffectAsset.js +133 -0
- package/Pickup.d.ts +1 -1
- package/Pickup.js +27 -0
- package/Raycast.d.ts +5 -3
- package/Raycast.js +132 -0
- package/RelationshipGroup.d.ts +1 -1
- package/RelationshipGroup.js +72 -0
- package/Rope.d.ts +1 -1
- package/Rope.js +149 -0
- package/TaskSequence.js +52 -0
- package/Tasks.d.ts +8 -3
- package/Tasks.js +334 -0
- package/World.d.ts +13 -4
- package/World.js +945 -0
- package/cfx/StateBagChangeHandler.js +0 -0
- package/cfx/index.d.ts +1 -1
- package/cfx/index.js +4 -0
- package/common/Command.js +111 -0
- package/common/Convar.js +58 -0
- package/common/GlobalData.js +16 -0
- package/common/Kvp.js +137 -0
- package/common/Resource.js +54 -0
- package/common/decors/Events.js +170 -0
- package/common/net/NetworkedMap.js +225 -0
- package/common/types.js +0 -0
- package/common/utils/ClassTypes.js +15 -0
- package/common/utils/Color.js +33 -0
- package/common/utils/Delay.d.ts +1 -0
- package/common/utils/Delay.js +6 -0
- package/common/utils/Maths.js +18 -0
- package/common/utils/Point.d.ts +9 -0
- package/common/utils/Point.js +36 -0
- package/common/utils/PointF.d.ts +1 -1
- package/common/utils/PointF.js +18 -0
- package/common/utils/Quaternion.d.ts +1 -1
- package/common/utils/Quaternion.js +33 -0
- package/common/utils/Vector.js +589 -0
- package/common/utils/cleanPlayerName.js +17 -0
- package/common/utils/enumValues.js +20 -0
- package/common/utils/getStringFromUInt8Array.js +6 -0
- package/common/utils/getUInt32FromUint8Array.js +6 -0
- package/enums/Alignment.js +9 -0
- package/enums/AnimationFlags.js +38 -0
- package/enums/AudioFlag.js +41 -0
- package/enums/BadgeStyle.js +186 -0
- package/enums/Blip.js +229 -0
- package/enums/Bone.js +105 -0
- package/enums/CameraShake.js +17 -0
- package/enums/CameraTypes.js +11 -0
- package/enums/CheckboxStyle.js +8 -0
- package/enums/Checkpoint.js +68 -0
- package/enums/CloudHat.js +27 -0
- package/enums/Control.js +364 -0
- package/enums/CursorSprite.js +18 -0
- package/enums/Driving.js +38 -0
- package/enums/ExplosionType.js +45 -0
- package/enums/FiringPattern.js +23 -0
- package/enums/Font.js +11 -0
- package/enums/ForceType.js +12 -0
- package/enums/Gender.js +8 -0
- package/enums/HelmetType.js +9 -0
- package/enums/HudColor.js +187 -0
- package/enums/HudComponent.js +57 -0
- package/enums/InputMode.js +8 -0
- package/enums/InvertAxis.js +10 -0
- package/enums/Language.js +18 -0
- package/enums/LeaveVehicleFlags.js +14 -0
- package/enums/LoadingSpinnerType.js +11 -0
- package/enums/MarkerType.js +48 -0
- package/enums/MenuAlignment.js +8 -0
- package/enums/NotificationType.js +14 -0
- package/enums/Parachute.js +19 -0
- package/enums/PickupType.js +77 -0
- package/enums/RadioStation.js +28 -0
- package/enums/RagdollType.js +10 -0
- package/enums/RaycastEnums.js +33 -0
- package/enums/Relationship.js +13 -0
- package/enums/RopeType.js +9 -0
- package/enums/ScreenEffect.js +87 -0
- package/enums/SpeechModifier.js +43 -0
- package/enums/Vehicle.js +396 -0
- package/enums/Weather.js +22 -0
- package/enums/ZoneID.js +95 -0
- package/hashes/MaterialHash.js +220 -0
- package/hashes/PedHash.js +728 -0
- package/hashes/VehicleHash.js +526 -0
- package/hashes/WeaponHash.js +155 -0
- package/hashes/WeatherTypeHash.js +22 -0
- package/index.js +166 -18794
- package/interfaces/Dimensions.d.ts +1 -1
- package/interfaces/Dimensions.js +0 -0
- package/models/BaseEntity.d.ts +10 -8
- package/models/BaseEntity.js +576 -0
- package/models/Entity.d.ts +0 -1
- package/models/Entity.js +0 -0
- package/models/EntityBone.d.ts +1 -1
- package/models/EntityBone.js +32 -0
- package/models/EntityBoneCollection.d.ts +1 -1
- package/models/EntityBoneCollection.js +27 -0
- package/models/Ped.d.ts +13 -5
- package/models/Ped.js +711 -0
- package/models/PedBone.d.ts +3 -2
- package/models/PedBone.js +18 -0
- package/models/PedBoneCollection.d.ts +3 -1
- package/models/PedBoneCollection.js +31 -0
- package/models/Player.d.ts +4 -2
- package/models/Player.js +188 -0
- package/models/Prop.d.ts +1 -1
- package/models/Prop.js +34 -0
- package/models/Vehicle.d.ts +9 -4
- package/models/Vehicle.js +582 -0
- package/models/VehicleDoor.d.ts +1 -1
- package/models/VehicleDoor.js +52 -0
- package/models/VehicleDoorCollection.d.ts +1 -1
- package/models/VehicleDoorCollection.js +66 -0
- package/models/VehicleMod.d.ts +1 -1
- package/models/VehicleMod.js +43 -0
- package/models/VehicleModCollection.d.ts +2 -2
- package/models/VehicleModCollection.js +227 -0
- package/models/VehicleToggleMod.d.ts +1 -1
- package/models/VehicleToggleMod.js +37 -0
- package/models/VehicleWheel.js +31 -0
- package/models/VehicleWheelCollection.d.ts +1 -1
- package/models/VehicleWheelCollection.js +61 -0
- package/models/VehicleWindow.d.ts +1 -1
- package/models/VehicleWindow.js +43 -0
- package/models/VehicleWindowCollection.d.ts +1 -1
- package/models/VehicleWindowCollection.js +62 -0
- package/package.json +2 -2
- package/ui/Container.d.ts +4 -2
- package/ui/Container.js +39 -0
- package/ui/Effects.d.ts +1 -1
- package/ui/Effects.js +112 -0
- package/ui/Fading.js +74 -0
- package/ui/Hud.d.ts +3 -2
- package/ui/Hud.js +47 -0
- package/ui/InstructionalButtons.js +42 -0
- package/ui/LoadingPrompt.d.ts +1 -1
- package/ui/LoadingPrompt.js +37 -0
- package/ui/Notification.js +17 -0
- package/ui/Rectangle.d.ts +4 -2
- package/ui/Rectangle.js +46 -0
- package/ui/Scaleform.d.ts +2 -1
- package/ui/Scaleform.js +240 -0
- package/ui/Screen.d.ts +6 -3
- package/ui/Screen.js +83 -0
- package/ui/Sprite.d.ts +3 -1
- package/ui/Sprite.js +70 -0
- package/ui/Text.d.ts +6 -3
- package/ui/Text.js +119 -0
- package/ui/Timerbar.js +241 -0
- package/ui/interfaces/IButton.d.ts +1 -1
- package/ui/interfaces/IButton.js +0 -0
- package/ui/interfaces/IDrawable.d.ts +3 -1
- package/ui/interfaces/IDrawable.js +0 -0
- package/ui/menu/Menu.d.ts +9 -4
- package/ui/menu/Menu.js +830 -0
- package/ui/menu/MenuControl.js +20 -0
- package/ui/menu/MenuControls.js +17 -0
- package/ui/menu/MenuSettings.d.ts +1 -1
- package/ui/menu/MenuSettings.js +57 -0
- package/ui/menu/items/UIMenuCheckboxItem.d.ts +3 -3
- package/ui/menu/items/UIMenuCheckboxItem.js +70 -0
- package/ui/menu/items/UIMenuItem.d.ts +10 -4
- package/ui/menu/items/UIMenuItem.js +1103 -0
- package/ui/menu/items/UIMenuListItem.d.ts +3 -3
- package/ui/menu/items/UIMenuListItem.js +118 -0
- package/ui/menu/items/UIMenuSeparatorItem.d.ts +1 -1
- package/ui/menu/items/UIMenuSeparatorItem.js +37 -0
- package/ui/menu/items/UIMenuSliderItem.d.ts +4 -3
- package/ui/menu/items/UIMenuSliderItem.js +180 -0
- package/ui/menu/items/panels/AbstractUIMenuPanel.d.ts +4 -3
- package/ui/menu/items/panels/AbstractUIMenuPanel.js +49 -0
- package/ui/menu/items/panels/UIMenuColorPanel.d.ts +3 -3
- package/ui/menu/items/panels/UIMenuColorPanel.js +215 -0
- package/ui/menu/items/panels/UIMenuGridPanel.d.ts +3 -3
- package/ui/menu/items/panels/UIMenuGridPanel.js +216 -0
- package/ui/menu/items/panels/UIMenuPercentagePanel.d.ts +2 -2
- package/ui/menu/items/panels/UIMenuPercentagePanel.js +138 -0
- package/ui/menu/items/panels/UIMenuStatisticsPanel.d.ts +3 -2
- package/ui/menu/items/panels/UIMenuStatisticsPanel.js +88 -0
- package/ui/menu/items/panels/UIMenuStatisticsPanelItem.d.ts +2 -1
- package/ui/menu/items/panels/UIMenuStatisticsPanelItem.js +48 -0
- package/ui/menu/modules/ListItem.js +18 -0
- package/utils/Animations.js +43 -0
- package/utils/Crypto.js +33 -0
- package/utils/LiteEvent.js +25 -0
- package/utils/Maths.js +18 -0
- package/utils/Point.js +36 -0
- package/utils/Size.js +16 -0
- package/utils/String.d.ts +1 -1
- package/utils/String.js +35 -0
- package/weapon/DlcWeaponData.d.ts +1 -1
- package/weapon/DlcWeaponData.js +40 -0
- package/weapon/Mk2WeaponHash.js +18 -0
- package/weapon/Weapon.d.ts +7 -7
- package/weapon/Weapon.js +276 -0
- package/weapon/WeaponAsset.d.ts +1 -1
- package/weapon/WeaponAsset.js +87 -0
- package/weapon/WeaponCollection.d.ts +3 -2
- package/weapon/WeaponCollection.js +179 -0
- package/weapon/WeaponDisplayNameByHash.d.ts +1 -1
- package/weapon/WeaponDisplayNameByHash.js +73 -0
- package/weapon/WeaponGroup.js +22 -0
- package/weapon/WeaponHudStats.d.ts +1 -1
- package/weapon/WeaponHudStats.js +33 -0
- package/weapon/WeaponLivery.js +17 -0
- package/weapon/WeaponLiveryColor.js +38 -0
- package/weapon/WeaponTint.js +46 -0
- package/weaponComponent/ComponentAttachmentPoint.js +22 -0
- package/weaponComponent/ComponentAttachmentPointByHash.js +307 -0
- package/weaponComponent/ComponentDisplayNameByHash.js +278 -0
- package/weaponComponent/DlcWeaponComponentData.js +40 -0
- package/weaponComponent/InvalidWeaponComponent.d.ts +1 -1
- package/weaponComponent/InvalidWeaponComponent.js +31 -0
- package/weaponComponent/WeaponComponent.d.ts +4 -4
- package/weaponComponent/WeaponComponent.js +124 -0
- package/weaponComponent/WeaponComponentCollection.d.ts +2 -2
- package/weaponComponent/WeaponComponentCollection.js +187 -0
- package/weaponComponent/WeaponComponentHash.js +670 -0
- package/weaponComponent/WeaponComponentHashesByWeaponHash.d.ts +1 -1
- package/weaponComponent/WeaponComponentHashesByWeaponHash.js +864 -0
- package/weaponComponent/WeaponComponentHudStats.js +33 -0
- package/common/index.d.ts +0 -8
- package/common/utils/Vector2.d.ts +0 -1
- package/common/utils/Vector3.d.ts +0 -1
- package/common/utils/Vector4.d.ts +0 -1
- package/common/utils/index.d.ts +0 -12
- package/enums/index.d.ts +0 -42
- package/hashes/index.d.ts +0 -5
- package/index.d.ts +0 -25
- package/models/index.d.ts +0 -18
- package/ui/index.d.ts +0 -15
- package/ui/interfaces/index.d.ts +0 -2
- package/ui/menu/index.d.ts +0 -6
- package/ui/menu/items/index.d.ts +0 -6
- package/ui/menu/items/panels/index.d.ts +0 -6
- package/ui/menu/modules/index.d.ts +0 -1
- package/utils/PointF.d.ts +0 -7
- package/utils/Quaternion.d.ts +0 -10
- package/utils/enumValues.d.ts +0 -12
- package/utils/getStringFromUInt8Array.d.ts +0 -8
- package/utils/getUInt32FromUint8Array.d.ts +0 -8
- package/utils/index.d.ts +0 -9
- package/weapon/index.d.ts +0 -8
- package/weaponComponent/index.d.ts +0 -5
package/ui/Screen.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { Color } from "../common/utils/Color";
|
|
4
|
+
import { HudColor } from "fivem/enums/HudColor";
|
|
5
|
+
import { NotificationType } from "fivem/enums/NotificationType";
|
|
6
|
+
import { Size } from "fivem/utils/Size";
|
|
7
|
+
import { _String } from "fivem/utils/String";
|
|
8
|
+
import { Audio } from "../Audio";
|
|
9
|
+
import { Notification } from "./Notification";
|
|
10
|
+
class Screen {
|
|
11
|
+
static {
|
|
12
|
+
__name(this, "Screen");
|
|
13
|
+
}
|
|
14
|
+
static get Resolution() {
|
|
15
|
+
const [width, height] = GetScreenActiveResolution();
|
|
16
|
+
return new Size(width, height);
|
|
17
|
+
}
|
|
18
|
+
static get ScaledResolution() {
|
|
19
|
+
const height = this.Height;
|
|
20
|
+
return new Size(height * this.AspectRatio, height);
|
|
21
|
+
}
|
|
22
|
+
static get Width() {
|
|
23
|
+
return this.Resolution.width;
|
|
24
|
+
}
|
|
25
|
+
static get ScaledWidth() {
|
|
26
|
+
return this.Height * this.AspectRatio;
|
|
27
|
+
}
|
|
28
|
+
static get Height() {
|
|
29
|
+
return this.Resolution.height;
|
|
30
|
+
}
|
|
31
|
+
static get AspectRatio() {
|
|
32
|
+
return GetAspectRatio(false);
|
|
33
|
+
}
|
|
34
|
+
static showSubtitle(message, duration = 2500) {
|
|
35
|
+
const strings = _String.stringToArray(message);
|
|
36
|
+
BeginTextCommandPrint("CELL_EMAIL_BCON");
|
|
37
|
+
strings.forEach((element) => {
|
|
38
|
+
AddTextComponentSubstringPlayerName(element);
|
|
39
|
+
});
|
|
40
|
+
EndTextCommandPrint(duration, true);
|
|
41
|
+
}
|
|
42
|
+
static displayHelpTextThisFrame(message) {
|
|
43
|
+
const strings = _String.stringToArray(message);
|
|
44
|
+
BeginTextCommandDisplayHelp("CELL_EMAIL_BCON");
|
|
45
|
+
strings.forEach((element) => {
|
|
46
|
+
AddTextComponentSubstringPlayerName(element);
|
|
47
|
+
});
|
|
48
|
+
EndTextCommandDisplayHelp(0, false, false, -1);
|
|
49
|
+
}
|
|
50
|
+
static showNotification(message, blinking = false) {
|
|
51
|
+
const strings = _String.stringToArray(message);
|
|
52
|
+
SetNotificationTextEntry("CELL_EMAIL_BCON");
|
|
53
|
+
strings.forEach((element) => {
|
|
54
|
+
AddTextComponentSubstringPlayerName(element);
|
|
55
|
+
});
|
|
56
|
+
return new Notification(DrawNotification(blinking, true));
|
|
57
|
+
}
|
|
58
|
+
static showAdvancedNotification(message, title, subtitle, iconSet, icon, bgColor = HudColor.NONE, flashColor = Color.Transparent, blinking = false, type = NotificationType.Default, showInBrief = true, sound = true) {
|
|
59
|
+
const strings = _String.stringToArray(message);
|
|
60
|
+
SetNotificationTextEntry("CELL_EMAIL_BCON");
|
|
61
|
+
strings.forEach((element) => {
|
|
62
|
+
AddTextComponentSubstringPlayerName(element);
|
|
63
|
+
});
|
|
64
|
+
if (bgColor !== HudColor.NONE) {
|
|
65
|
+
SetNotificationBackgroundColor(Number(bgColor));
|
|
66
|
+
}
|
|
67
|
+
if (flashColor !== Color.Transparent && blinking) {
|
|
68
|
+
SetNotificationFlashColor(flashColor.r, flashColor.g, flashColor.b, flashColor.a);
|
|
69
|
+
}
|
|
70
|
+
if (sound) {
|
|
71
|
+
Audio.playSoundFrontEnd("DELETE", "HUD_DEATHMATCH_SOUNDSET");
|
|
72
|
+
}
|
|
73
|
+
SetNotificationMessage(iconSet, icon, true, Number(type), title, subtitle);
|
|
74
|
+
return new Notification(DrawNotification(blinking, showInBrief));
|
|
75
|
+
}
|
|
76
|
+
static worldToScreen(position, scaleWidth = false) {
|
|
77
|
+
const coords = GetScreenCoordFromWorldCoord(position.x, position.y, position.z);
|
|
78
|
+
return new Size(coords[1] * (scaleWidth ? this.ScaledWidth : this.Width), coords[2] * this.Height);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
Screen
|
|
83
|
+
};
|
package/ui/Sprite.d.ts
CHANGED
package/ui/Sprite.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { Color } from "../common/utils/Color";
|
|
4
|
+
import { Point } from "fivem/utils/Point";
|
|
5
|
+
import { Size } from "fivem/utils/Size";
|
|
6
|
+
import { Screen } from "./Screen";
|
|
7
|
+
class Sprite {
|
|
8
|
+
static {
|
|
9
|
+
__name(this, "Sprite");
|
|
10
|
+
}
|
|
11
|
+
textureName;
|
|
12
|
+
pos;
|
|
13
|
+
size;
|
|
14
|
+
heading;
|
|
15
|
+
color;
|
|
16
|
+
visible;
|
|
17
|
+
_textureDict;
|
|
18
|
+
constructor(textureDict, textureName, pos, size, heading = 0, color = Color.White) {
|
|
19
|
+
this._textureDict = textureDict;
|
|
20
|
+
this.textureName = textureName;
|
|
21
|
+
this.pos = pos || new Point();
|
|
22
|
+
this.size = size || new Size();
|
|
23
|
+
this.heading = heading || 0;
|
|
24
|
+
this.color = color || Color.White;
|
|
25
|
+
this.visible = true;
|
|
26
|
+
}
|
|
27
|
+
loadTextureDictionary() {
|
|
28
|
+
RequestStreamedTextureDict(this._textureDict, true);
|
|
29
|
+
const interval = setInterval(() => {
|
|
30
|
+
if (this.IsTextureDictionaryLoaded) {
|
|
31
|
+
clearInterval(interval);
|
|
32
|
+
}
|
|
33
|
+
}, 0);
|
|
34
|
+
}
|
|
35
|
+
set TextureDict(v) {
|
|
36
|
+
this._textureDict = v;
|
|
37
|
+
if (!this.IsTextureDictionaryLoaded) {
|
|
38
|
+
this.loadTextureDictionary();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
get TextureDict() {
|
|
42
|
+
return this._textureDict;
|
|
43
|
+
}
|
|
44
|
+
get IsTextureDictionaryLoaded() {
|
|
45
|
+
return HasStreamedTextureDictLoaded(this._textureDict);
|
|
46
|
+
}
|
|
47
|
+
draw(arg1, textureName, pos, size, heading, color, loadTexture = true, resolution) {
|
|
48
|
+
const textureDictionary = arg1 && typeof arg1 === "string" ? arg1 : this.TextureDict;
|
|
49
|
+
textureName = textureName || this.textureName;
|
|
50
|
+
pos = pos || this.pos;
|
|
51
|
+
size = size || this.size;
|
|
52
|
+
heading = heading || this.heading;
|
|
53
|
+
color = color || this.color;
|
|
54
|
+
if (loadTexture) {
|
|
55
|
+
if (!HasStreamedTextureDictLoaded(textureDictionary)) {
|
|
56
|
+
RequestStreamedTextureDict(textureDictionary, false);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
resolution = arg1 instanceof Size ? arg1 : resolution;
|
|
60
|
+
resolution = resolution || new Size(Screen.ScaledWidth, Screen.Height);
|
|
61
|
+
const w = size.width / resolution.width;
|
|
62
|
+
const h = size.height / resolution.height;
|
|
63
|
+
const x = pos.X / resolution.width + w * 0.5;
|
|
64
|
+
const y = pos.Y / resolution.height + h * 0.5;
|
|
65
|
+
DrawSprite(textureDictionary, textureName, x, y, w, h, heading, color.r, color.g, color.b, color.a);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
Sprite
|
|
70
|
+
};
|
package/ui/Text.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Color } from "../common/utils/Color";
|
|
2
|
+
import { Alignment } from "fivem/enums/Alignment";
|
|
3
|
+
import { Font } from "fivem/enums/Font";
|
|
4
|
+
import { Point } from "fivem/utils/Point";
|
|
5
|
+
import { Size } from "fivem/utils/Size";
|
|
6
|
+
import type { IDrawable } from "./interfaces/IDrawable";
|
|
4
7
|
export declare class Text implements IDrawable {
|
|
5
8
|
static draw(caption: string, pos: Point, scale?: number, color?: Color, font?: Font, alignment?: Alignment, dropShadow?: boolean, outline?: boolean, wordWrap?: Size, resolution?: Size): void;
|
|
6
9
|
static addLongString(str: string): void;
|
package/ui/Text.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { Color } from "../common/utils/Color";
|
|
4
|
+
import { Alignment } from "fivem/enums/Alignment";
|
|
5
|
+
import { Font } from "fivem/enums/Font";
|
|
6
|
+
import { Point } from "fivem/utils/Point";
|
|
7
|
+
import { Size } from "fivem/utils/Size";
|
|
8
|
+
import { Screen } from "./Screen";
|
|
9
|
+
class Text {
|
|
10
|
+
static {
|
|
11
|
+
__name(this, "Text");
|
|
12
|
+
}
|
|
13
|
+
static draw(caption, pos, scale = 1, color = Color.White, font = Font.ChaletLondon, alignment = Alignment.Left, dropShadow = false, outline = false, wordWrap, resolution) {
|
|
14
|
+
resolution = resolution || new Size(Screen.ScaledWidth, Screen.Height);
|
|
15
|
+
const x = pos.X / resolution.width;
|
|
16
|
+
const y = pos.Y / resolution.height;
|
|
17
|
+
SetTextFont(Number(font));
|
|
18
|
+
SetTextScale(1, scale);
|
|
19
|
+
SetTextColour(color.r, color.g, color.b, color.a);
|
|
20
|
+
if (dropShadow) {
|
|
21
|
+
SetTextDropshadow(2, 0, 0, 0, 0);
|
|
22
|
+
}
|
|
23
|
+
if (outline) {
|
|
24
|
+
SetTextOutline();
|
|
25
|
+
}
|
|
26
|
+
switch (alignment) {
|
|
27
|
+
case Alignment.Centered:
|
|
28
|
+
SetTextCentre(true);
|
|
29
|
+
break;
|
|
30
|
+
case Alignment.Right:
|
|
31
|
+
SetTextRightJustify(true);
|
|
32
|
+
if (!wordWrap) {
|
|
33
|
+
SetTextWrap(0, x);
|
|
34
|
+
}
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
if (wordWrap) {
|
|
38
|
+
SetTextWrap(x, (pos.X + wordWrap.width) / resolution.width);
|
|
39
|
+
}
|
|
40
|
+
SetTextEntry("STRING");
|
|
41
|
+
Text.addLongString(caption);
|
|
42
|
+
DrawText(x, y);
|
|
43
|
+
}
|
|
44
|
+
static addLongString(str) {
|
|
45
|
+
const strLen = 99;
|
|
46
|
+
for (let i = 0; i < str.length; i += strLen) {
|
|
47
|
+
const substr = str.substr(i, Math.min(strLen, str.length - i));
|
|
48
|
+
AddTextComponentSubstringPlayerName(substr);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
caption;
|
|
52
|
+
pos;
|
|
53
|
+
scale;
|
|
54
|
+
color;
|
|
55
|
+
font;
|
|
56
|
+
alignment;
|
|
57
|
+
dropShadow;
|
|
58
|
+
outline;
|
|
59
|
+
wordWrap;
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @param caption Text to display
|
|
63
|
+
* @param pos Position of text relative to alignment. In pixels.
|
|
64
|
+
* @param scale Size of text. Default 1.0
|
|
65
|
+
* @param color Color of text. Default black.
|
|
66
|
+
* @param font Font of text. Default Chalet London.
|
|
67
|
+
* @param alignment Alignment of text. Default Left.
|
|
68
|
+
* @param dropShadow
|
|
69
|
+
* @param outline
|
|
70
|
+
* @param wordWrap
|
|
71
|
+
*/
|
|
72
|
+
constructor(caption, pos, scale = 1, color = Color.White, font = Font.ChaletLondon, alignment = Alignment.Left, dropShadow = false, outline = false, wordWrap = new Size(500, 300)) {
|
|
73
|
+
this.caption = caption;
|
|
74
|
+
this.pos = pos;
|
|
75
|
+
this.scale = scale;
|
|
76
|
+
this.color = color;
|
|
77
|
+
this.font = font;
|
|
78
|
+
this.alignment = alignment;
|
|
79
|
+
this.dropShadow = dropShadow;
|
|
80
|
+
this.outline = outline;
|
|
81
|
+
this.wordWrap = wordWrap;
|
|
82
|
+
}
|
|
83
|
+
draw(arg1, arg2, scale, color, font, alignment, dropShadow, outline, wordWrap, resolution) {
|
|
84
|
+
resolution = arg2 instanceof Size ? arg2 : resolution;
|
|
85
|
+
if (scale === void 0) {
|
|
86
|
+
if (arg1 && arg1 instanceof Size) {
|
|
87
|
+
arg2 = new Point(this.pos.X + arg1.width, this.pos.Y + arg1.height);
|
|
88
|
+
} else {
|
|
89
|
+
arg2 = this.pos;
|
|
90
|
+
}
|
|
91
|
+
arg1 = this.caption;
|
|
92
|
+
scale = this.scale;
|
|
93
|
+
color = this.color;
|
|
94
|
+
font = this.font;
|
|
95
|
+
alignment = this.alignment;
|
|
96
|
+
dropShadow = this.dropShadow;
|
|
97
|
+
outline = this.outline;
|
|
98
|
+
wordWrap = this.wordWrap;
|
|
99
|
+
} else {
|
|
100
|
+
arg1 = arg1 || this.caption;
|
|
101
|
+
if (!arg2) {
|
|
102
|
+
arg2 = this.pos;
|
|
103
|
+
} else {
|
|
104
|
+
arg2 = arg2;
|
|
105
|
+
}
|
|
106
|
+
scale = scale !== void 0 && scale !== null ? scale : this.scale;
|
|
107
|
+
color = color || this.color;
|
|
108
|
+
font = font !== void 0 && font !== null ? font : this.font;
|
|
109
|
+
alignment = alignment !== void 0 && alignment !== null ? alignment : this.alignment;
|
|
110
|
+
dropShadow = typeof dropShadow === "boolean" ? dropShadow : dropShadow;
|
|
111
|
+
outline = typeof outline === "boolean" ? outline : outline;
|
|
112
|
+
wordWrap = wordWrap || this.wordWrap;
|
|
113
|
+
}
|
|
114
|
+
Text.draw(arg1, arg2, scale, color, font, alignment, dropShadow, outline, wordWrap, resolution);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export {
|
|
118
|
+
Text
|
|
119
|
+
};
|
package/ui/Timerbar.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { Color } from "../common/utils/Color";
|
|
4
|
+
import { HudComponent } from "fivem/enums/HudComponent";
|
|
5
|
+
import { Point } from "fivem/utils/Point";
|
|
6
|
+
import { Size } from "fivem/utils/Size";
|
|
7
|
+
import { Hud } from "./Hud";
|
|
8
|
+
import { LoadingPrompt } from "./LoadingPrompt";
|
|
9
|
+
import { Screen } from "./Screen";
|
|
10
|
+
import { Sprite } from "./Sprite";
|
|
11
|
+
const activeTimerBars = [];
|
|
12
|
+
const drawText = /* @__PURE__ */ __name((text, position, options) => {
|
|
13
|
+
options = {
|
|
14
|
+
...{
|
|
15
|
+
align: 1,
|
|
16
|
+
color: [255, 255, 255, 255],
|
|
17
|
+
font: 4,
|
|
18
|
+
outline: true,
|
|
19
|
+
scale: 0.3,
|
|
20
|
+
shadow: true
|
|
21
|
+
},
|
|
22
|
+
...options
|
|
23
|
+
};
|
|
24
|
+
const font = options.font;
|
|
25
|
+
const scale = options.scale;
|
|
26
|
+
const outline = options.outline;
|
|
27
|
+
const shadow = options.shadow;
|
|
28
|
+
const color = options.color;
|
|
29
|
+
const align = options.align;
|
|
30
|
+
SetTextEntry("CELL_EMAIL_BCON");
|
|
31
|
+
for (let i = 0; i < text.length; i += 99) {
|
|
32
|
+
const subStringText = text.substr(i, Math.min(99, text.length - i));
|
|
33
|
+
AddTextComponentSubstringPlayerName(subStringText);
|
|
34
|
+
}
|
|
35
|
+
SetTextFont(font);
|
|
36
|
+
SetTextScale(scale, scale);
|
|
37
|
+
SetTextColour(color[0], color[1], color[2], color[3]);
|
|
38
|
+
if (shadow) {
|
|
39
|
+
SetTextDropShadow();
|
|
40
|
+
}
|
|
41
|
+
if (outline) {
|
|
42
|
+
SetTextOutline();
|
|
43
|
+
}
|
|
44
|
+
switch (align) {
|
|
45
|
+
case 1: {
|
|
46
|
+
SetTextCentre(true);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
case 2: {
|
|
50
|
+
SetTextRightJustify(true);
|
|
51
|
+
SetTextWrap(0, position[0] || 0);
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
DrawText(position[0] || 0, position[1] || 0);
|
|
56
|
+
}, "drawText");
|
|
57
|
+
class Timerbar {
|
|
58
|
+
static {
|
|
59
|
+
__name(this, "Timerbar");
|
|
60
|
+
}
|
|
61
|
+
sprite;
|
|
62
|
+
title = "";
|
|
63
|
+
text = "";
|
|
64
|
+
useProgressBar = false;
|
|
65
|
+
usePlayerStyle = false;
|
|
66
|
+
isVisible = false;
|
|
67
|
+
pbarValue = 0;
|
|
68
|
+
textColor = [240, 240, 240, 255];
|
|
69
|
+
pbarBgColor = [155, 155, 155, 255];
|
|
70
|
+
pbarFgColor = [255, 255, 255, 255];
|
|
71
|
+
constructor(title, useProgressBar = false) {
|
|
72
|
+
this.title = title;
|
|
73
|
+
this.useProgressBar = useProgressBar;
|
|
74
|
+
this.text = "";
|
|
75
|
+
this.pbarValue = 0;
|
|
76
|
+
this.textColor = [240, 240, 240, 255];
|
|
77
|
+
this.pbarBgColor = [155, 155, 155, 255];
|
|
78
|
+
this.pbarFgColor = [255, 255, 255, 255];
|
|
79
|
+
this.usePlayerStyle = false;
|
|
80
|
+
const safeZone = GetSafeZoneSize();
|
|
81
|
+
const safeZoneX = (1 - safeZone) * 0.5;
|
|
82
|
+
const safeZoneY = (1 - safeZone) * 0.5;
|
|
83
|
+
this.sprite = new Sprite(
|
|
84
|
+
"timerbars",
|
|
85
|
+
"all_black_bg",
|
|
86
|
+
new Point(Screen.ScaledWidth * 0.918 - safeZoneX, Screen.Height * 0.984 - safeZoneY),
|
|
87
|
+
new Size(Screen.ScaledWidth * 0.165, Screen.Height * 0.035),
|
|
88
|
+
0,
|
|
89
|
+
new Color(255, 255, 255, 160)
|
|
90
|
+
);
|
|
91
|
+
if (!this.sprite.IsTextureDictionaryLoaded) {
|
|
92
|
+
this.sprite.loadTextureDictionary();
|
|
93
|
+
}
|
|
94
|
+
this.isVisible = true;
|
|
95
|
+
activeTimerBars.push(this);
|
|
96
|
+
}
|
|
97
|
+
get Title() {
|
|
98
|
+
return this.title;
|
|
99
|
+
}
|
|
100
|
+
set Title(value) {
|
|
101
|
+
this.title = value;
|
|
102
|
+
}
|
|
103
|
+
get Text() {
|
|
104
|
+
return this.text;
|
|
105
|
+
}
|
|
106
|
+
set Text(value) {
|
|
107
|
+
this.text = value;
|
|
108
|
+
}
|
|
109
|
+
get UseProgressBar() {
|
|
110
|
+
return this.useProgressBar;
|
|
111
|
+
}
|
|
112
|
+
get Progress() {
|
|
113
|
+
return this.pbarValue;
|
|
114
|
+
}
|
|
115
|
+
set Progress(value) {
|
|
116
|
+
this.pbarValue = value <= 0 ? 0 : value >= 1 ? 1 : value;
|
|
117
|
+
}
|
|
118
|
+
get Visible() {
|
|
119
|
+
return this.isVisible;
|
|
120
|
+
}
|
|
121
|
+
set Visible(value) {
|
|
122
|
+
const idx = activeTimerBars.indexOf(this);
|
|
123
|
+
if (value) {
|
|
124
|
+
if (idx !== -1) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
activeTimerBars.push(this);
|
|
128
|
+
} else {
|
|
129
|
+
if (idx === -1) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
activeTimerBars.splice(idx, 1);
|
|
133
|
+
}
|
|
134
|
+
this.isVisible = value;
|
|
135
|
+
}
|
|
136
|
+
get TextColor() {
|
|
137
|
+
return this.textColor;
|
|
138
|
+
}
|
|
139
|
+
set TextColor(value) {
|
|
140
|
+
if (Array.isArray(value)) {
|
|
141
|
+
this.textColor = value;
|
|
142
|
+
} else {
|
|
143
|
+
const result = GetHudColour(value);
|
|
144
|
+
this.textColor = [result[0], result[1], result[2], result[3]];
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
get ProgressbarBgColor() {
|
|
148
|
+
return this.pbarBgColor;
|
|
149
|
+
}
|
|
150
|
+
set ProgressbarBgColor(value) {
|
|
151
|
+
if (Array.isArray(value)) {
|
|
152
|
+
this.pbarBgColor = value;
|
|
153
|
+
} else {
|
|
154
|
+
const result = GetHudColour(value);
|
|
155
|
+
this.pbarBgColor = [result[0], result[1], result[2], result[3]];
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
get ProgressbarFgColor() {
|
|
159
|
+
return this.pbarFgColor;
|
|
160
|
+
}
|
|
161
|
+
set ProgressbarFgColor(value) {
|
|
162
|
+
if (Array.isArray(value)) {
|
|
163
|
+
this.pbarFgColor = value;
|
|
164
|
+
} else {
|
|
165
|
+
const result = GetHudColour(value);
|
|
166
|
+
this.pbarFgColor = [result[0], result[1], result[2], result[3]];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
set PlayerStyle(value) {
|
|
170
|
+
this.usePlayerStyle = value;
|
|
171
|
+
}
|
|
172
|
+
get PlayerStyle() {
|
|
173
|
+
return this.usePlayerStyle;
|
|
174
|
+
}
|
|
175
|
+
get Sprite() {
|
|
176
|
+
return this.sprite;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
setTick(() => {
|
|
180
|
+
if (activeTimerBars.length <= 0) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const safeZone = GetSafeZoneSize();
|
|
184
|
+
const safeZoneX = (1 - safeZone) * 0.5;
|
|
185
|
+
const safeZoneY = (1 - safeZone) * 0.5;
|
|
186
|
+
Hud.hideComponentThisFrame(HudComponent.AreaName);
|
|
187
|
+
Hud.hideComponentThisFrame(HudComponent.StreetName);
|
|
188
|
+
let loadingPromptOffset = 0;
|
|
189
|
+
if (LoadingPrompt.IsActive) {
|
|
190
|
+
loadingPromptOffset = 0.035 + 0.035 * 0.038 * 2;
|
|
191
|
+
}
|
|
192
|
+
activeTimerBars.forEach((timerbar) => {
|
|
193
|
+
const drawY = 0.984 - loadingPromptOffset - safeZoneY - activeTimerBars.indexOf(timerbar) * 0.038;
|
|
194
|
+
DrawSprite("timerbars", "all_black_bg", 0.918 - safeZoneX, drawY, 0.165, 0.035, 0, 255, 255, 255, 160);
|
|
195
|
+
drawText(timerbar.Title, [0.918 - safeZoneX + 0.012, drawY - 9e-3 - (timerbar.PlayerStyle ? 625e-5 : 0)], {
|
|
196
|
+
align: 2,
|
|
197
|
+
color: timerbar.TextColor,
|
|
198
|
+
font: timerbar.PlayerStyle ? 4 : 0,
|
|
199
|
+
outline: false,
|
|
200
|
+
scale: timerbar.PlayerStyle ? 0.465 : 0.3,
|
|
201
|
+
shadow: timerbar.PlayerStyle
|
|
202
|
+
});
|
|
203
|
+
if (timerbar.UseProgressBar) {
|
|
204
|
+
const pbarX = 0.918 - safeZoneX + 0.047;
|
|
205
|
+
const pbarY = drawY + 15e-4;
|
|
206
|
+
const width = 0.0616 * timerbar.Progress;
|
|
207
|
+
DrawRect(
|
|
208
|
+
pbarX,
|
|
209
|
+
pbarY,
|
|
210
|
+
0.0616,
|
|
211
|
+
0.0105,
|
|
212
|
+
typeof timerbar.ProgressbarBgColor === "number" ? timerbar.ProgressbarBgColor : timerbar.ProgressbarBgColor[0],
|
|
213
|
+
typeof timerbar.ProgressbarBgColor === "number" ? timerbar.ProgressbarBgColor : timerbar.ProgressbarBgColor[1],
|
|
214
|
+
typeof timerbar.ProgressbarBgColor === "number" ? timerbar.ProgressbarBgColor : timerbar.ProgressbarBgColor[2],
|
|
215
|
+
typeof timerbar.ProgressbarBgColor === "number" ? timerbar.ProgressbarBgColor : timerbar.ProgressbarBgColor[3]
|
|
216
|
+
);
|
|
217
|
+
DrawRect(
|
|
218
|
+
pbarX - 0.0616 / 2 + width / 2,
|
|
219
|
+
pbarY,
|
|
220
|
+
width,
|
|
221
|
+
0.0105,
|
|
222
|
+
typeof timerbar.ProgressbarFgColor === "number" ? timerbar.ProgressbarFgColor : timerbar.ProgressbarFgColor[0],
|
|
223
|
+
typeof timerbar.ProgressbarFgColor === "number" ? timerbar.ProgressbarFgColor : timerbar.ProgressbarFgColor[1],
|
|
224
|
+
typeof timerbar.ProgressbarFgColor === "number" ? timerbar.ProgressbarFgColor : timerbar.ProgressbarFgColor[2],
|
|
225
|
+
typeof timerbar.ProgressbarFgColor === "number" ? timerbar.ProgressbarFgColor : timerbar.ProgressbarFgColor[3]
|
|
226
|
+
);
|
|
227
|
+
} else {
|
|
228
|
+
drawText(timerbar.Text, [0.918 - safeZoneX + 0.0785, drawY + -0.0165], {
|
|
229
|
+
align: 2,
|
|
230
|
+
color: timerbar.TextColor,
|
|
231
|
+
font: 0,
|
|
232
|
+
outline: false,
|
|
233
|
+
scale: 0.425,
|
|
234
|
+
shadow: false
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
export {
|
|
240
|
+
Timerbar
|
|
241
|
+
};
|
|
File without changes
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { Color
|
|
1
|
+
import type { Color } from "../../common/utils/Color";
|
|
2
|
+
import type { Point } from "fivem/utils/Point";
|
|
3
|
+
import type { Size } from "fivem/utils/Size";
|
|
2
4
|
export interface IDrawable {
|
|
3
5
|
pos: Point;
|
|
4
6
|
size?: Size;
|
|
File without changes
|
package/ui/menu/Menu.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Font
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Color } from "../../common/utils/Color";
|
|
2
|
+
import { Font } from "fivem/enums/Font";
|
|
3
|
+
import { MenuAlignment } from "fivem/enums/MenuAlignment";
|
|
4
|
+
import { LiteEvent } from "fivem/utils/LiteEvent";
|
|
5
|
+
import { Point } from "fivem/utils/Point";
|
|
6
|
+
import { Size } from "fivem/utils/Size";
|
|
7
|
+
import { UIMenuItem } from "./items/UIMenuItem";
|
|
8
|
+
import { MenuControls } from "./MenuControls";
|
|
9
|
+
import { MenuSettings } from "./MenuSettings";
|
|
5
10
|
export declare class Menu {
|
|
6
11
|
static screenAspectRatio: number;
|
|
7
12
|
static screenHeight: number;
|