@armoury/fivem-framework-client 0.0.0-stage → 1.0.7

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 (87) hide show
  1. package/dist/cjs/client/client-action-points.js +179 -0
  2. package/dist/cjs/client/client-entities.js +287 -0
  3. package/dist/cjs/client/client-hud.controller.js +17 -0
  4. package/dist/cjs/client/client-ui.controller.js +91 -0
  5. package/dist/cjs/client/client.base.js +72 -0
  6. package/dist/cjs/client/client.controller.js +28 -0
  7. package/dist/cjs/client/constants/color.mappings.js +91 -0
  8. package/dist/cjs/client/index.js +45 -0
  9. package/dist/cjs/client/interfaces/client-ui.interface.js +2 -0
  10. package/dist/cjs/client/models/action-point.model.js +2 -0
  11. package/dist/cjs/client/models/blip.model.js +2 -0
  12. package/dist/cjs/client/models/index.js +21 -0
  13. package/dist/cjs/client/models/marker.model.js +2 -0
  14. package/dist/cjs/client/models/ui-button.model.js +2 -0
  15. package/dist/cjs/client/models/ui-dialog.model.js +2 -0
  16. package/dist/cjs/client/services/client-action-points.service.js +158 -0
  17. package/dist/cjs/client/services/client-blips.service.js +80 -0
  18. package/dist/cjs/client/services/client-checkpoints.service.js +41 -0
  19. package/dist/cjs/client/services/client-hud.service.js +25 -0
  20. package/dist/cjs/client/services/client-markers.service.js +62 -0
  21. package/dist/cjs/client/services/client-peds.service.js +104 -0
  22. package/dist/cjs/client/services/client-session.service.js +24 -0
  23. package/dist/cjs/client/services/client-ticks.service.js +77 -0
  24. package/dist/cjs/client/services/client-translate.service.js +41 -0
  25. package/dist/cjs/client/services/client-ui.service.js +112 -0
  26. package/dist/cjs/client/services/client-vehicles.service.js +66 -0
  27. package/dist/cjs/client/services/client-waypoints.service.js +72 -0
  28. package/dist/cjs/client/services/index.js +28 -0
  29. package/dist/esm/client/client-action-points.js +176 -0
  30. package/dist/esm/client/client-entities.js +284 -0
  31. package/dist/esm/client/client-hud.controller.js +13 -0
  32. package/dist/esm/client/client-ui.controller.js +84 -0
  33. package/dist/esm/client/client.base.js +68 -0
  34. package/dist/esm/client/client.controller.js +24 -0
  35. package/dist/esm/client/constants/color.mappings.js +88 -0
  36. package/dist/esm/client/index.js +27 -0
  37. package/dist/esm/client/interfaces/client-ui.interface.js +1 -0
  38. package/dist/esm/client/models/action-point.model.js +1 -0
  39. package/dist/esm/client/models/blip.model.js +1 -0
  40. package/dist/esm/client/models/index.js +5 -0
  41. package/dist/esm/client/models/marker.model.js +1 -0
  42. package/dist/esm/client/models/ui-button.model.js +1 -0
  43. package/dist/esm/client/models/ui-dialog.model.js +1 -0
  44. package/dist/esm/client/services/client-action-points.service.js +155 -0
  45. package/dist/esm/client/services/client-blips.service.js +77 -0
  46. package/dist/esm/client/services/client-checkpoints.service.js +38 -0
  47. package/dist/esm/client/services/client-hud.service.js +22 -0
  48. package/dist/esm/client/services/client-markers.service.js +59 -0
  49. package/dist/esm/client/services/client-peds.service.js +101 -0
  50. package/dist/esm/client/services/client-session.service.js +21 -0
  51. package/dist/esm/client/services/client-ticks.service.js +74 -0
  52. package/dist/esm/client/services/client-translate.service.js +38 -0
  53. package/dist/esm/client/services/client-ui.service.js +109 -0
  54. package/dist/esm/client/services/client-vehicles.service.js +63 -0
  55. package/dist/esm/client/services/client-waypoints.service.js +69 -0
  56. package/dist/esm/client/services/index.js +12 -0
  57. package/dist/types/ambient.declarations.d.ts +62840 -0
  58. package/dist/types/client/client-action-points.d.ts +30 -0
  59. package/dist/types/client/client-entities.d.ts +43 -0
  60. package/dist/types/client/client-hud.controller.d.ts +4 -0
  61. package/dist/types/client/client-ui.controller.d.ts +19 -0
  62. package/dist/types/client/client.base.d.ts +22 -0
  63. package/dist/types/client/client.controller.d.ts +12 -0
  64. package/dist/types/client/constants/color.mappings.d.ts +3 -0
  65. package/dist/types/client/index.d.ts +10 -0
  66. package/dist/types/client/interfaces/client-ui.interface.d.ts +4 -0
  67. package/dist/types/client/models/action-point.model.d.ts +10 -0
  68. package/dist/types/client/models/blip.model.d.ts +14 -0
  69. package/dist/types/client/models/index.d.ts +5 -0
  70. package/dist/types/client/models/marker.model.d.ts +22 -0
  71. package/dist/types/client/models/ui-button.model.d.ts +8 -0
  72. package/dist/types/client/models/ui-dialog.model.d.ts +9 -0
  73. package/dist/types/client/services/client-action-points.service.d.ts +29 -0
  74. package/dist/types/client/services/client-blips.service.d.ts +10 -0
  75. package/dist/types/client/services/client-checkpoints.service.d.ts +7 -0
  76. package/dist/types/client/services/client-hud.service.d.ts +3 -0
  77. package/dist/types/client/services/client-markers.service.d.ts +11 -0
  78. package/dist/types/client/services/client-peds.service.d.ts +10 -0
  79. package/dist/types/client/services/client-session.service.d.ts +3 -0
  80. package/dist/types/client/services/client-ticks.service.d.ts +21 -0
  81. package/dist/types/client/services/client-translate.service.d.ts +13 -0
  82. package/dist/types/client/services/client-ui.service.d.ts +19 -0
  83. package/dist/types/client/services/client-vehicles.service.d.ts +8 -0
  84. package/dist/types/client/services/client-waypoints.service.d.ts +13 -0
  85. package/dist/types/client/services/index.d.ts +12 -0
  86. package/package.json +30 -5
  87. package/README.md +0 -3
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.COLOR_MAPPINGS = void 0;
4
+ exports.COLOR_MAPPINGS = {
5
+ 0: [255, 255, 255],
6
+ 1: [224, 50, 50],
7
+ 2: [93, 189, 113],
8
+ 3: [93, 182, 229],
9
+ 4: [255, 255, 255],
10
+ 5: [238, 198, 78],
11
+ 6: [194, 80, 80],
12
+ 7: [156, 110, 175],
13
+ 8: [254, 122, 195],
14
+ 9: [245, 157, 121],
15
+ 10: [177, 143, 131],
16
+ 11: [141, 206, 167],
17
+ 12: [112, 168, 174],
18
+ 13: [211, 209, 231],
19
+ 14: [143, 126, 152],
20
+ 15: [106, 196, 191],
21
+ 16: [213, 195, 152],
22
+ 17: [234, 142, 80],
23
+ 18: [151, 202, 233],
24
+ 19: [178, 98, 135],
25
+ 20: [143, 141, 121],
26
+ 21: [166, 117, 94],
27
+ 22: [175, 168, 168],
28
+ 23: [231, 141, 154],
29
+ 24: [187, 214, 91],
30
+ 25: [12, 123, 86],
31
+ 26: [122, 195, 254],
32
+ 27: [171, 60, 230],
33
+ 28: [205, 168, 12],
34
+ 29: [69, 97, 171],
35
+ 30: [41, 165, 184],
36
+ 31: [184, 155, 123],
37
+ 32: [200, 224, 254],
38
+ 33: [240, 240, 150],
39
+ 34: [237, 140, 161],
40
+ 35: [249, 138, 138],
41
+ 36: [251, 238, 165],
42
+ 37: [255, 255, 255],
43
+ 38: [40, 96, 160],
44
+ 39: [145, 131, 112],
45
+ 40: [76, 76, 76],
46
+ 41: [242, 157, 157],
47
+ 42: [108, 183, 214],
48
+ 43: [175, 237, 174],
49
+ 44: [255, 167, 95],
50
+ 45: [241, 241, 241],
51
+ 46: [236, 240, 41],
52
+ 47: [255, 154, 24],
53
+ 48: [246, 68, 165],
54
+ 49: [224, 58, 58],
55
+ 50: [138, 109, 227],
56
+ 51: [255, 127, 70],
57
+ 52: [49, 96, 65],
58
+ 53: [179, 221, 243],
59
+ 54: [58, 100, 121],
60
+ 55: [160, 160, 160],
61
+ 56: [132, 114, 50],
62
+ 57: [101, 185, 231],
63
+ 58: [75, 65, 117],
64
+ 59: [225, 59, 59],
65
+ 60: [240, 203, 88],
66
+ 61: [205, 63, 152],
67
+ 62: [207, 207, 207],
68
+ 63: [39, 106, 159],
69
+ 64: [216, 123, 27],
70
+ 65: [142, 131, 147],
71
+ 66: [240, 203, 87],
72
+ 67: [101, 185, 231],
73
+ 68: [101, 185, 231],
74
+ 69: [121, 205, 121],
75
+ 70: [239, 202, 87],
76
+ 71: [239, 202, 87],
77
+ 72: [61, 61, 61],
78
+ 73: [239, 202, 87],
79
+ 74: [73, 168, 231],
80
+ 75: [224, 50, 50],
81
+ 76: [120, 35, 35],
82
+ 77: [101, 185, 231],
83
+ 78: [58, 100, 121],
84
+ 79: [224, 50, 50],
85
+ 80: [101, 185, 231],
86
+ 81: [242, 164, 12],
87
+ 82: [164, 204, 170],
88
+ 83: [168, 84, 242],
89
+ 84: [101, 185, 231],
90
+ 85: [61, 61, 61]
91
+ };
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ /// <reference path = "../ambient.declarations.d.ts" />
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.CLIENT_PROVIDERS = void 0;
19
+ exports.Client_Init = Client_Init;
20
+ require("reflect-metadata");
21
+ const injection_js_1 = require("injection-js");
22
+ const services_1 = require("./services");
23
+ const fivem_framework_common_1 = require("@armoury/fivem-framework-common");
24
+ exports.CLIENT_PROVIDERS = [
25
+ services_1.ClientActionPointsService,
26
+ services_1.ClientBlipsService,
27
+ services_1.ClientCheckpointsService,
28
+ services_1.ClientHudService,
29
+ services_1.ClientMarkersService,
30
+ services_1.ClientPedsService,
31
+ services_1.ClientSessionService,
32
+ services_1.ClientTicksService,
33
+ services_1.ClientVehiclesService,
34
+ services_1.ClientUIService,
35
+ services_1.ClientWaypointsService,
36
+ ];
37
+ function Client_Init(_class, ...providers) {
38
+ const mainInjector = injection_js_1.ReflectiveInjector.resolveAndCreate(exports.CLIENT_PROVIDERS);
39
+ const injector = injection_js_1.ReflectiveInjector.resolveAndCreate([...providers, _class], mainInjector);
40
+ const instance = injector.get(_class);
41
+ (0, fivem_framework_common_1.Decorate)(instance, _class.prototype, [...exports.CLIENT_PROVIDERS, ...providers], fivem_framework_common_1.DecorationType.CLIENT);
42
+ return instance;
43
+ }
44
+ __exportStar(require("./services"), exports);
45
+ __exportStar(require("@armoury/fivem-framework-common"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./action-point.model"), exports);
18
+ __exportStar(require("./blip.model"), exports);
19
+ __exportStar(require("./marker.model"), exports);
20
+ __exportStar(require("./ui-button.model"), exports);
21
+ __exportStar(require("./ui-dialog.model"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ClientActionPointsService = void 0;
16
+ const injection_js_1 = require("injection-js");
17
+ const client_ticks_service_1 = require("./client-ticks.service");
18
+ const fivem_framework_common_1 = require("@armoury/fivem-framework-common");
19
+ // TODO: Lower chunk radius and make chunk-checker check adjacent chunks as well
20
+ let ClientActionPointsService = class ClientActionPointsService {
21
+ get actionPoints() {
22
+ return this._actionPoints;
23
+ }
24
+ get cachedPlayerPosition() {
25
+ return this._cachedPlayerPosition;
26
+ }
27
+ constructor(_ticksService) {
28
+ this._ticksService = _ticksService;
29
+ this.chunkRadius = 80;
30
+ this._actionPoints = {};
31
+ this._cachedPlayerPosition = [NaN, NaN];
32
+ this._cachedPlayerRoundedPosition = [NaN, NaN];
33
+ this._cachedIsPlayerInAnyVehicle = false;
34
+ }
35
+ /** Creates one or multiple Action Points. Action points DO NOT include markers and/or blips.
36
+ * They only contain the logic executed when a position is met.
37
+ */
38
+ create(...actionPoints) {
39
+ actionPoints.forEach((actionPoint) => {
40
+ this.createActionPoint(actionPoint);
41
+ });
42
+ }
43
+ createActionPoint(actionPoint) {
44
+ const nearestX = this.roundToNearest(actionPoint.pos[0], this.chunkRadius);
45
+ const nearestY = this.roundToNearest(actionPoint.pos[1], this.chunkRadius);
46
+ if (!this._actionPoints[nearestX]) {
47
+ this._actionPoints[nearestX] = {};
48
+ }
49
+ if (!this.actionPoints[nearestX][nearestY]) {
50
+ this._actionPoints[nearestX][nearestY] = [];
51
+ }
52
+ this._actionPoints[nearestX][nearestY].push(actionPoint);
53
+ }
54
+ remove(actionPoint) {
55
+ var _a, _b;
56
+ if ((_b = (_a = this._actionPoints[this.roundToNearest(actionPoint.pos[0], this.chunkRadius)]) === null || _a === void 0 ? void 0 : _a[this.roundToNearest(actionPoint.pos[1], this.chunkRadius)]) === null || _b === void 0 ? void 0 : _b.length) {
57
+ this._actionPoints[this.roundToNearest(actionPoint.pos[0], this.chunkRadius)][this.roundToNearest(actionPoint.pos[1], this.chunkRadius)] =
58
+ this._actionPoints[this.roundToNearest(actionPoint.pos[0], this.chunkRadius)][this.roundToNearest(actionPoint.pos[1], this.chunkRadius)].filter((_actionPoint) => _actionPoint.id != actionPoint.id);
59
+ }
60
+ }
61
+ removeById(id) {
62
+ Object.keys(this._actionPoints).forEach((posXAsStr) => {
63
+ const posX = Number(posXAsStr);
64
+ Object.keys(this._actionPoints[posX]).forEach((posYAsStr) => {
65
+ const posY = Number(posYAsStr);
66
+ this._actionPoints[posX][posY] =
67
+ this._actionPoints[posX][posY].filter((_actionPoint) => _actionPoint.id != id);
68
+ });
69
+ });
70
+ }
71
+ removeAll() {
72
+ this._actionPoints = {};
73
+ this._ticksService.remove(`${Cfx.Client.GetCurrentResourceName()}_actionpoints`);
74
+ }
75
+ existsAtPosition(posX, posY, posZ) {
76
+ const roundedPosX = this.roundToNearest(posX, this.chunkRadius);
77
+ const roundedPosY = this.roundToNearest(posY, this.chunkRadius);
78
+ if (!this.actionPoints[roundedPosX] || !this.actionPoints[roundedPosX][roundedPosY]) {
79
+ return false;
80
+ }
81
+ if (this.actionPoints[roundedPosX][roundedPosY].find((actionPoint) => actionPoint.pos[0] == posX
82
+ && actionPoint.pos[1] == posY
83
+ && actionPoint.pos[2] == posZ)) {
84
+ return true;
85
+ }
86
+ return false;
87
+ }
88
+ onThreadTriggered(optimizationType) {
89
+ var _a, _b;
90
+ if (optimizationType === 'chunk-checker') {
91
+ this._cachedPlayerPosition = Cfx.Client.GetEntityCoords(Cfx.Client.PlayerPedId(), true);
92
+ const [nearestX, nearestY] = [this.roundToNearest(this._cachedPlayerPosition[0], this.chunkRadius), this.roundToNearest(this._cachedPlayerPosition[1], this.chunkRadius)];
93
+ if (this._cachedPlayerRoundedPosition[0] == nearestX && this._cachedPlayerRoundedPosition[1] == nearestY) {
94
+ return;
95
+ }
96
+ this._cachedPlayerRoundedPosition = [nearestX, nearestY];
97
+ this._cachedIsPlayerInAnyVehicle = Cfx.Client.IsPedInAnyVehicle(Cfx.Client.PlayerPedId(), false);
98
+ if ((_b = (_a = this._actionPoints[this._cachedPlayerRoundedPosition[0]]) === null || _a === void 0 ? void 0 : _a[this._cachedPlayerRoundedPosition[1]]) === null || _b === void 0 ? void 0 : _b.length) {
99
+ this._ticksService.addUnique({
100
+ id: `${Cfx.Client.GetCurrentResourceName()}_actionpoints`,
101
+ function: (() => {
102
+ var _a, _b, _c, _d;
103
+ for (let i = 0; i < ((_b = (_a = this._actionPoints[this._cachedPlayerRoundedPosition[0]]) === null || _a === void 0 ? void 0 : _a[this._cachedPlayerRoundedPosition[1]]) === null || _b === void 0 ? void 0 : _b.length); i++) {
104
+ const _actionPoint = (_c = this._actionPoints[this._cachedPlayerRoundedPosition[0]]) === null || _c === void 0 ? void 0 : _c[this._cachedPlayerRoundedPosition[1]][i];
105
+ if ((0, fivem_framework_common_1.calculateDistance)([_actionPoint.pos[0], _actionPoint.pos[1], _actionPoint.pos[2], this._cachedPlayerPosition[0], this._cachedPlayerPosition[1], _actionPoint.pos[2]]) <= (_actionPoint.range || 1.0) + (this._cachedIsPlayerInAnyVehicle && !_actionPoint.onfootOnly ? 5 : 0)) {
106
+ const actionPassed = (!_actionPoint.onceIf || _actionPoint.onceIf()) && (!_actionPoint.onfootOnly || !Cfx.Client.IsPedInAnyVehicle(Cfx.Client.PlayerPedId(), false)) && (!_actionPoint.inVehicleOnly || Cfx.Client.IsPedInAnyVehicle(Cfx.Client.PlayerPedId(), false));
107
+ if (actionPassed) {
108
+ _actionPoint.action();
109
+ }
110
+ if ((_actionPoint.once || _actionPoint.onceIf) && actionPassed) {
111
+ (_d = this._actionPoints[this._cachedPlayerRoundedPosition[0]]) === null || _d === void 0 ? void 0 : _d[this._cachedPlayerRoundedPosition[1]].splice(i, 1);
112
+ i--;
113
+ }
114
+ }
115
+ }
116
+ })
117
+ });
118
+ }
119
+ else {
120
+ this._ticksService.remove(`${Cfx.Client.GetCurrentResourceName()}_actionpoints`);
121
+ }
122
+ }
123
+ }
124
+ debug_ActionPoints() {
125
+ var _a, _b;
126
+ let totalActionPoints = 0;
127
+ const currentAreaActionPoints = ((_b = (_a = this.actionPoints[this.roundToNearest(this._cachedPlayerPosition[0], this.chunkRadius)]) === null || _a === void 0 ? void 0 : _a[this.roundToNearest(this._cachedPlayerPosition[1], this.chunkRadius)]) === null || _b === void 0 ? void 0 : _b.length) || 0;
128
+ Object.keys(this.actionPoints).forEach((posXAsStr) => {
129
+ const posX = Number(posXAsStr);
130
+ Object.keys(this.actionPoints[posX]).forEach((posYAsStr) => {
131
+ const posY = Number(posYAsStr);
132
+ totalActionPoints += this.actionPoints[posX][posY].length;
133
+ });
134
+ });
135
+ console.log(`Total action points: ${totalActionPoints}. Action points in this area: ${currentAreaActionPoints}`);
136
+ }
137
+ roundToNearest(num, multiple) {
138
+ return Math.round(num / multiple) * multiple;
139
+ }
140
+ };
141
+ exports.ClientActionPointsService = ClientActionPointsService;
142
+ __decorate([
143
+ (0, fivem_framework_common_1.EventListener)({ eventName: 'armoury:thread-triggerer' }),
144
+ __metadata("design:type", Function),
145
+ __metadata("design:paramtypes", [String]),
146
+ __metadata("design:returntype", void 0)
147
+ ], ClientActionPointsService.prototype, "onThreadTriggered", null);
148
+ __decorate([
149
+ (0, fivem_framework_common_1.Command)({ suffix: `_${Cfx.Client.GetCurrentResourceName()}` }),
150
+ __metadata("design:type", Function),
151
+ __metadata("design:paramtypes", []),
152
+ __metadata("design:returntype", void 0)
153
+ ], ClientActionPointsService.prototype, "debug_ActionPoints", null);
154
+ exports.ClientActionPointsService = ClientActionPointsService = __decorate([
155
+ (0, injection_js_1.Injectable)(),
156
+ __param(0, (0, injection_js_1.Inject)(client_ticks_service_1.ClientTicksService)),
157
+ __metadata("design:paramtypes", [client_ticks_service_1.ClientTicksService])
158
+ ], ClientActionPointsService);
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ClientBlipsService = void 0;
10
+ const injection_js_1 = require("injection-js");
11
+ let ClientBlipsService = class ClientBlipsService {
12
+ constructor() {
13
+ this._blips = [];
14
+ // @EventListener({ eventName: `${Cfx.Client.GetCurrentResourceName()}:refresh-virtual-world` })
15
+ // protected onRefreshPlayersInVirtualWorld(): void {
16
+ // const activePlayers: number[] = Cfx.Client.GetActivePlayers();
17
+ //
18
+ // activePlayers.forEach((activePlayer: number) => {
19
+ // const playerServerId: number = Cfx.Client.GetPlayerServerId(activePlayer);
20
+ // if (this.getPlayerInfo('virtualWorld') === this.getPlayerInfo('virtualWorld', playerServerId)) {
21
+ // Cfx.Client.NetworkConcealPlayer(activePlayer, false, false);
22
+ // } else {
23
+ // Cfx.Client.NetworkConcealPlayer(activePlayer, true, false);
24
+ // }
25
+ // });
26
+ // }
27
+ }
28
+ get blips() {
29
+ return this._blips;
30
+ }
31
+ // TODO: Why is createMultiple() not calling create()?
32
+ createMultiple(...blips) {
33
+ const _blips = blips.map((blip) => (Object.assign(Object.assign({}, blip), { instance: null })));
34
+ this._blips.push(..._blips);
35
+ this.refresh();
36
+ }
37
+ create(blip) {
38
+ var _a;
39
+ const _blip = (!blip.type || blip.type === 'coords'
40
+ ? Cfx.Client.AddBlipForCoord(blip.pos[0], blip.pos[1], blip.pos[2])
41
+ : (blip.type === 'range'
42
+ ? Cfx.Client.AddBlipForRadius(blip.pos[0], blip.pos[1], blip.pos[2], blip.scale || 1.0)
43
+ : Cfx.Client.AddBlipForEntity((_a = blip.entityId) !== null && _a !== void 0 ? _a : Cfx.Client.PlayerPedId())));
44
+ if (!blip.type || blip.type !== 'range') {
45
+ Cfx.Client.SetBlipScale(_blip, blip.scale || 1.0);
46
+ }
47
+ Cfx.Client.SetBlipSprite(_blip, blip.id);
48
+ Cfx.Client.SetBlipDisplay(_blip, 4);
49
+ Cfx.Client.SetBlipColour(_blip, blip.color);
50
+ Cfx.Client.SetBlipAlpha(_blip, blip.alpha || 255);
51
+ Cfx.Client.SetBlipAsShortRange(_blip, !blip.longRange);
52
+ Cfx.Client.BeginTextCommandSetBlipName('STRING');
53
+ Cfx.Client.AddTextComponentString(blip.title);
54
+ Cfx.Client.EndTextCommandSetBlipName(_blip);
55
+ return _blip;
56
+ }
57
+ clear(blipId) {
58
+ this._blips = this._blips.filter((_blip) => _blip.instance !== blipId);
59
+ if (Cfx.Client.DoesBlipExist(blipId)) {
60
+ Cfx.Client.RemoveBlip(blipId);
61
+ }
62
+ }
63
+ clearAll() {
64
+ this._blips.forEach((blip) => {
65
+ Cfx.Client.RemoveBlip(blip.instance);
66
+ });
67
+ this._blips = [];
68
+ }
69
+ refresh() {
70
+ this.blips.forEach((blip) => {
71
+ if (!blip.instance) {
72
+ blip.instance = this.create(blip);
73
+ }
74
+ });
75
+ }
76
+ };
77
+ exports.ClientBlipsService = ClientBlipsService;
78
+ exports.ClientBlipsService = ClientBlipsService = __decorate([
79
+ (0, injection_js_1.Injectable)()
80
+ ], ClientBlipsService);
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ClientCheckpointsService = void 0;
10
+ const injection_js_1 = require("injection-js");
11
+ let ClientCheckpointsService = class ClientCheckpointsService {
12
+ constructor() {
13
+ this._checkpoints = new Map();
14
+ }
15
+ get checkpoints() {
16
+ return this._checkpoints;
17
+ }
18
+ create(type, posX1, posY1, posZ1, posX2, posY2, posZ2, diameter, red, green, blue, alpha, reserved) {
19
+ const checkpoint = Cfx.Client.CreateCheckpoint(type, posX1, posY1, posZ1, posX2, posY2, posZ2, diameter, red, green, blue, alpha, reserved);
20
+ this._checkpoints.set(checkpoint, [posX1, posY1, posZ1, posX2, posY2, posZ2]);
21
+ return checkpoint;
22
+ }
23
+ clear(checkpoint) {
24
+ Cfx.Client.DeleteCheckpoint(checkpoint);
25
+ if (this._checkpoints.has(checkpoint)) {
26
+ this._checkpoints.delete(checkpoint);
27
+ }
28
+ }
29
+ clearByPosition(pos) {
30
+ const checkpoint = Array.from(this._checkpoints.keys()).find((_checkpoint) => Math.floor(this._checkpoints.get(_checkpoint)[0]) === Math.floor(pos[0])
31
+ && Math.floor(this._checkpoints.get(_checkpoint)[1]) === Math.floor(pos[1])
32
+ && Math.floor(this._checkpoints.get(_checkpoint)[2]) === Math.floor(pos[2]));
33
+ if (checkpoint) {
34
+ this.clear(checkpoint);
35
+ }
36
+ }
37
+ };
38
+ exports.ClientCheckpointsService = ClientCheckpointsService;
39
+ exports.ClientCheckpointsService = ClientCheckpointsService = __decorate([
40
+ (0, injection_js_1.Injectable)()
41
+ ], ClientCheckpointsService);
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ClientHudService = void 0;
10
+ const injection_js_1 = require("injection-js");
11
+ let ClientHudService = class ClientHudService {
12
+ addToFeed(feedItemLength = 8000, ...texts) {
13
+ texts.forEach((text, index) => {
14
+ setTimeout(() => {
15
+ Cfx.Client.BeginTextCommandThefeedPost('STRING');
16
+ Cfx.Client.AddTextComponentSubstringPlayerName(text);
17
+ Cfx.Client.EndTextCommandThefeedPostTicker(false, true);
18
+ }, index * feedItemLength);
19
+ });
20
+ }
21
+ };
22
+ exports.ClientHudService = ClientHudService;
23
+ exports.ClientHudService = ClientHudService = __decorate([
24
+ (0, injection_js_1.Injectable)()
25
+ ], ClientHudService);
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ClientMarkersService = void 0;
16
+ const injection_js_1 = require("injection-js");
17
+ const client_action_points_service_1 = require("./client-action-points.service");
18
+ const fivem_framework_common_1 = require("@armoury/fivem-framework-common");
19
+ let ClientMarkersService = class ClientMarkersService {
20
+ get markers() {
21
+ return this._markers;
22
+ }
23
+ constructor(_actionPoints) {
24
+ this._actionPoints = _actionPoints;
25
+ this._markers = [];
26
+ }
27
+ /** Defines permanent markers. Handles draw-per-tick automatically. */
28
+ create(...markers) {
29
+ const _markers = markers.map((marker) => (Object.assign(Object.assign({}, marker), { instance: null })));
30
+ this._markers.push(..._markers);
31
+ this._actionPoints.create(...markers.map((marker) => ({
32
+ id: `${Cfx.Client.GetCurrentResourceName()}_marker_${marker.pos[0]}_${marker.pos[1]}`,
33
+ pos: marker.pos,
34
+ range: marker.renderDistance,
35
+ action: async () => {
36
+ var _a, _b, _c, _d, _e, _f, _g;
37
+ if (marker.textureDict && !Cfx.Client.HasStreamedTextureDictLoaded(marker.textureDict)) {
38
+ Cfx.Client.RequestStreamedTextureDict(marker.textureDict, true);
39
+ while (!Cfx.Client.HasStreamedTextureDictLoaded(marker.textureDict)) {
40
+ await (0, fivem_framework_common_1.Delay)(100);
41
+ }
42
+ }
43
+ Cfx.Client.DrawMarker(marker.marker, marker.pos[0], marker.pos[1], marker.pos[2], 0.0, 0.0, 0.0, ((_a = marker.rotation) === null || _a === void 0 ? void 0 : _a[0]) || 0.0, ((_b = marker.rotation) === null || _b === void 0 ? void 0 : _b[1]) || 0.0, ((_c = marker.rotation) === null || _c === void 0 ? void 0 : _c[2]) || 0.0, marker.scale, marker.scale, marker.scale, marker.rgba[0], marker.rgba[1], marker.rgba[2], marker.rgba[3], false, true, 2, false, (marker.textureDict || null), (marker.textureName || null), false);
44
+ if (marker.underlyingCircle) {
45
+ Cfx.Client.DrawMarker(marker.underlyingCircle.marker, marker.pos[0], marker.pos[1], marker.pos[2] - 0.9, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, marker.underlyingCircle.scale, marker.underlyingCircle.scale, marker.underlyingCircle.scale, ((_d = marker.underlyingCircle.rgba) === null || _d === void 0 ? void 0 : _d[0]) || marker.rgba[0], ((_e = marker.underlyingCircle.rgba) === null || _e === void 0 ? void 0 : _e[1]) || marker.rgba[1], ((_f = marker.underlyingCircle.rgba) === null || _f === void 0 ? void 0 : _f[2]) || marker.rgba[2], ((_g = marker.underlyingCircle.rgba) === null || _g === void 0 ? void 0 : _g[3]) || marker.rgba[3], false, true, 2, false, null, null, false);
46
+ }
47
+ }
48
+ })));
49
+ }
50
+ clearAll() {
51
+ this.markers.forEach((_marker) => {
52
+ this._actionPoints.removeById(`${Cfx.Client.GetCurrentResourceName()}_marker_${_marker.pos[0]}_${_marker.pos[1]}`);
53
+ });
54
+ this._markers = [];
55
+ }
56
+ };
57
+ exports.ClientMarkersService = ClientMarkersService;
58
+ exports.ClientMarkersService = ClientMarkersService = __decorate([
59
+ (0, injection_js_1.Injectable)(),
60
+ __param(0, (0, injection_js_1.Inject)(client_action_points_service_1.ClientActionPointsService)),
61
+ __metadata("design:paramtypes", [client_action_points_service_1.ClientActionPointsService])
62
+ ], ClientMarkersService);
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ClientPedsService = void 0;
13
+ const injection_js_1 = require("injection-js");
14
+ const fivem_framework_common_1 = require("@armoury/fivem-framework-common");
15
+ let ClientPedsService = class ClientPedsService {
16
+ get peds() {
17
+ return this._peds;
18
+ }
19
+ // TODO: Use $onInit
20
+ constructor() {
21
+ this._peds = [];
22
+ Cfx.Client.onNet('onResourceStop', (resourceName) => {
23
+ if (resourceName === Cfx.Client.GetCurrentResourceName()) {
24
+ this._peds.forEach((ped) => {
25
+ this.remove(ped);
26
+ });
27
+ this._peds = [];
28
+ }
29
+ });
30
+ }
31
+ remove(ped) {
32
+ if (Cfx.Client.DoesEntityExist(ped)) {
33
+ Cfx.Client.DeleteEntity(ped);
34
+ }
35
+ if (this._peds.indexOf(ped) > -1) {
36
+ this._peds.splice(this._peds.indexOf(ped), 1);
37
+ }
38
+ }
39
+ async createInsideVehicleAsync(vehicle, pedType, modelHash, seat, isNetwork, bScriptHostPed) {
40
+ let attempts = 0;
41
+ Cfx.Client.RequestModel(modelHash);
42
+ while (!Cfx.Client.HasModelLoaded(modelHash)) {
43
+ if (attempts > 10) {
44
+ return 0;
45
+ }
46
+ await (0, fivem_framework_common_1.Delay)(100);
47
+ attempts++;
48
+ }
49
+ const createdPed = Cfx.Client.CreatePedInsideVehicle(vehicle, pedType, modelHash, seat, isNetwork, bScriptHostPed);
50
+ if (createdPed) {
51
+ this._peds.push(createdPed);
52
+ }
53
+ return createdPed;
54
+ }
55
+ async createAsync(pedType, modelHash, x, y, z, heading, isNetwork, bScriptHostPed) {
56
+ let attempts = 0;
57
+ Cfx.Client.RequestModel(modelHash);
58
+ while (!Cfx.Client.HasModelLoaded(modelHash)) {
59
+ if (attempts > 10) {
60
+ return 0;
61
+ }
62
+ await (0, fivem_framework_common_1.Delay)(100);
63
+ attempts++;
64
+ }
65
+ const createdPed = Cfx.Client.CreatePed(pedType, modelHash, x, y, z, heading, isNetwork, bScriptHostPed);
66
+ if (createdPed) {
67
+ this._peds.push(createdPed);
68
+ }
69
+ return createdPed;
70
+ }
71
+ async playAnim(ped, animationDict, animationName, duration, flag = 0, blendInSpeed = 8.0, blendOutSpeed = 8.0) {
72
+ let attempts = 0;
73
+ Cfx.Client.RequestAnimDict(animationDict);
74
+ while (!Cfx.Client.HasAnimDictLoaded(animationDict)) {
75
+ if (attempts > 10) {
76
+ return;
77
+ }
78
+ await (0, fivem_framework_common_1.Delay)(100);
79
+ attempts++;
80
+ }
81
+ if (Cfx.Client.HasAnimDictLoaded(animationDict)) {
82
+ Cfx.Client.TaskPlayAnim(ped, animationDict, animationName, blendInSpeed, blendOutSpeed, duration, flag, 0, false, false, false);
83
+ }
84
+ }
85
+ async setModelAsync(ped, modelHash) {
86
+ let attempts = 0;
87
+ Cfx.Client.RequestModel(modelHash);
88
+ while (!Cfx.Client.HasModelLoaded(modelHash)) {
89
+ if (attempts > 10) {
90
+ return false;
91
+ }
92
+ await (0, fivem_framework_common_1.Delay)(100);
93
+ attempts++;
94
+ }
95
+ Cfx.Client.SetPlayerModel(ped, modelHash);
96
+ Cfx.Client.SetModelAsNoLongerNeeded(modelHash);
97
+ return true;
98
+ }
99
+ };
100
+ exports.ClientPedsService = ClientPedsService;
101
+ exports.ClientPedsService = ClientPedsService = __decorate([
102
+ (0, injection_js_1.Injectable)(),
103
+ __metadata("design:paramtypes", [])
104
+ ], ClientPedsService);