@armoury/fivem-roleplay-gamemode-common 1.0.54 → 1.0.55

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 (33) hide show
  1. package/dist/cjs/shared/models/account/account.js +3 -4
  2. package/dist/cjs/shared/models/businesses/business.model.js +3 -4
  3. package/dist/cjs/shared/models/character/character.js +3 -4
  4. package/dist/cjs/shared/models/house/house.js +13 -22
  5. package/dist/cjs/shared/models/items/deprecated/clothing/clothing-item.js +23 -47
  6. package/dist/cjs/shared/models/items/deprecated/errors/item-error-base.js +5 -24
  7. package/dist/cjs/shared/models/items/deprecated/errors/item-errors.js +9 -28
  8. package/dist/cjs/shared/models/items/deprecated/errors/item-stash-error-base.js +5 -24
  9. package/dist/cjs/shared/models/items/deprecated/item-stash.model.js +45 -75
  10. package/dist/cjs/shared/models/items/deprecated/item.model.js +6 -7
  11. package/dist/cjs/shared/models/items/deprecated/items-base/number-item.js +22 -51
  12. package/dist/cjs/shared/models/items/deprecated/stashes-base/generic-stash.js +5 -25
  13. package/dist/cjs/shared/models/items/deprecated/stashes-base/infinite-stash.js +10 -30
  14. package/dist/cjs/shared/models/items/deprecated/weapons/weapon-item.js +26 -63
  15. package/dist/cjs/shared/models/persistable/persistable.js +3 -5
  16. package/dist/cjs/shared/models/stash/stash.js +4 -7
  17. package/dist/esm/shared/models/account/account.js +3 -5
  18. package/dist/esm/shared/models/businesses/business.model.js +3 -5
  19. package/dist/esm/shared/models/character/character.js +3 -5
  20. package/dist/esm/shared/models/house/house.js +13 -23
  21. package/dist/esm/shared/models/items/deprecated/clothing/clothing-item.js +22 -47
  22. package/dist/esm/shared/models/items/deprecated/errors/item-error-base.js +5 -25
  23. package/dist/esm/shared/models/items/deprecated/errors/item-errors.js +8 -29
  24. package/dist/esm/shared/models/items/deprecated/errors/item-stash-error-base.js +5 -25
  25. package/dist/esm/shared/models/items/deprecated/item-stash.model.js +44 -75
  26. package/dist/esm/shared/models/items/deprecated/item.model.js +6 -8
  27. package/dist/esm/shared/models/items/deprecated/items-base/number-item.js +21 -51
  28. package/dist/esm/shared/models/items/deprecated/stashes-base/generic-stash.js +4 -25
  29. package/dist/esm/shared/models/items/deprecated/stashes-base/infinite-stash.js +9 -30
  30. package/dist/esm/shared/models/items/deprecated/weapons/weapon-item.js +25 -63
  31. package/dist/esm/shared/models/persistable/persistable.js +3 -6
  32. package/dist/esm/shared/models/stash/stash.js +4 -8
  33. package/package.json +28 -28
@@ -1,12 +1,12 @@
1
- var Item = /** @class */ (function () {
2
- function Item(identifier, weightPerUnit, fullyOccupiesSlot, value) {
1
+ export class Item {
2
+ constructor(identifier, weightPerUnit, fullyOccupiesSlot, value) {
3
3
  this.identifier = identifier;
4
4
  this.weightPerUnit = weightPerUnit;
5
5
  this.fullyOccupiesSlot = fullyOccupiesSlot;
6
6
  this.value = value;
7
- this.fullyOccupiesSlot = fullyOccupiesSlot !== null && fullyOccupiesSlot !== void 0 ? fullyOccupiesSlot : false;
7
+ this.fullyOccupiesSlot = fullyOccupiesSlot ?? false;
8
8
  }
9
- Item.prototype.toUI = function (slot) {
9
+ toUI(slot) {
10
10
  return ({
11
11
  image: this.identifier,
12
12
  type: 'item',
@@ -17,7 +17,5 @@ var Item = /** @class */ (function () {
17
17
  outline: '#878b9f',
18
18
  width: 65,
19
19
  });
20
- };
21
- return Item;
22
- }());
23
- export { Item };
20
+ }
21
+ }
@@ -1,61 +1,31 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
1
  import { Item } from "../item.model";
17
- var NumberItem = /** @class */ (function (_super) {
18
- __extends(NumberItem, _super);
19
- function NumberItem() {
20
- return _super !== null && _super.apply(this, arguments) || this;
2
+ export class NumberItem extends Item {
3
+ get amount() {
4
+ return this.value;
21
5
  }
22
- Object.defineProperty(NumberItem.prototype, "amount", {
23
- get: function () {
24
- return this.value;
25
- },
26
- enumerable: false,
27
- configurable: true
28
- });
29
- Object.defineProperty(NumberItem.prototype, "weight", {
30
- get: function () {
31
- return this.value * this.weightPerUnit;
32
- },
33
- enumerable: false,
34
- configurable: true
35
- });
36
- NumberItem.prototype.add = function (amount) {
6
+ get weight() {
7
+ return this.value * this.weightPerUnit;
8
+ }
9
+ add(amount) {
37
10
  this.value = Math.max(0, this.value + amount);
38
11
  return this;
39
- };
40
- NumberItem.prototype.consume = function (amount) {
12
+ }
13
+ consume(amount) {
41
14
  return this.add(-amount);
42
- };
43
- NumberItem.prototype.empty = function () {
15
+ }
16
+ empty() {
44
17
  this.value = 0;
45
18
  return this;
46
- };
47
- NumberItem.prototype.serialize = function () {
48
- var _a;
49
- return (_a = {},
50
- _a[this.identifier] = this.value,
51
- _a);
52
- };
53
- NumberItem.prototype.deserialize = function (serialized) {
54
- var _a = Object.entries(serialized)[0], identifier = _a[0], value = _a[1];
19
+ }
20
+ serialize() {
21
+ return ({
22
+ [this.identifier]: this.value
23
+ });
24
+ }
25
+ deserialize(serialized) {
26
+ const [identifier, value] = Object.entries(serialized)[0];
55
27
  this.identifier = identifier;
56
28
  this.value = value;
57
29
  return this;
58
- };
59
- return NumberItem;
60
- }(Item));
61
- export { NumberItem };
30
+ }
31
+ }
@@ -1,27 +1,6 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
1
  import { ItemStash } from "../item-stash.model";
17
- var GenericStash = /** @class */ (function (_super) {
18
- __extends(GenericStash, _super); /* implements IItemStash<IItemBase>*/
19
- function GenericStash() {
20
- return _super !== null && _super.apply(this, arguments) || this;
21
- }
22
- GenericStash.prototype.deserialize = function (serialized) {
2
+ export class GenericStash extends ItemStash /* implements IItemStash<IItemBase>*/ {
3
+ deserialize(serialized) {
23
4
  throw new Error("Method not implemented.");
24
- };
25
- return GenericStash;
26
- }(ItemStash));
27
- export { GenericStash };
5
+ }
6
+ }
@@ -1,34 +1,13 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
1
  import { ItemStash } from "../item-stash.model";
17
- var InfiniteStash = /** @class */ (function (_super) {
18
- __extends(InfiniteStash, _super); /* implements IItemStash<IItemBase>*/
19
- function InfiniteStash() {
20
- return _super !== null && _super.apply(this, arguments) || this;
21
- }
22
- InfiniteStash.prototype.add = function (_item, slot) {
2
+ export class InfiniteStash extends ItemStash /* implements IItemStash<IItemBase>*/ {
3
+ add(_item, slot) {
23
4
  return true;
24
- };
25
- InfiniteStash.prototype.consume = function (_item, _amount) { };
26
- InfiniteStash.prototype.has = function (_itemIdentifier) {
5
+ }
6
+ consume(_item, _amount) { }
7
+ has(_itemIdentifier) {
27
8
  return true;
28
- };
29
- InfiniteStash.prototype.deserialize = function (serialized) {
9
+ }
10
+ deserialize(serialized) {
30
11
  throw new Error("Method not implemented.");
31
- };
32
- return InfiniteStash;
33
- }(ItemStash));
34
- export { InfiniteStash };
12
+ }
13
+ }
@@ -1,71 +1,33 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var __assign = (this && this.__assign) || function () {
17
- __assign = Object.assign || function(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
- t[p] = s[p];
22
- }
23
- return t;
24
- };
25
- return __assign.apply(this, arguments);
26
- };
27
1
  import { Item } from "../item.model";
28
- var WeaponItem = /** @class */ (function (_super) {
29
- __extends(WeaponItem, _super);
30
- function WeaponItem() {
31
- return _super !== null && _super.apply(this, arguments) || this;
2
+ export class WeaponItem extends Item {
3
+ get amount() {
4
+ return this.value.ammo;
32
5
  }
33
- Object.defineProperty(WeaponItem.prototype, "amount", {
34
- get: function () {
35
- return this.value.ammo;
36
- },
37
- enumerable: false,
38
- configurable: true
39
- });
40
- Object.defineProperty(WeaponItem.prototype, "weight", {
41
- get: function () {
42
- return this.amount * this.weightPerUnit;
43
- },
44
- enumerable: false,
45
- configurable: true
46
- });
47
- WeaponItem.prototype.add = function (amount) {
48
- this.value = __assign(__assign({}, this.value), { ammo: Math.max(0, this.value.ammo + amount) });
6
+ get weight() {
7
+ return this.amount * this.weightPerUnit;
8
+ }
9
+ add(amount) {
10
+ this.value = {
11
+ ...this.value,
12
+ ammo: Math.max(0, this.value.ammo + amount)
13
+ };
49
14
  return this;
50
- };
51
- WeaponItem.prototype.consume = function (amount) {
15
+ }
16
+ consume(amount) {
52
17
  return this.add(-amount);
53
- };
54
- WeaponItem.prototype.empty = function () {
18
+ }
19
+ empty() {
55
20
  return this.add(-this.value.ammo);
56
- };
57
- WeaponItem.prototype.serialize = function () {
58
- var _a;
59
- return (_a = {},
60
- _a[this.identifier] = this.value,
61
- _a);
62
- };
63
- WeaponItem.prototype.deserialize = function (serialized) {
64
- var _a = Object.entries(serialized)[0], identifier = _a[0], value = _a[1];
21
+ }
22
+ serialize() {
23
+ return ({
24
+ [this.identifier]: this.value
25
+ });
26
+ }
27
+ deserialize(serialized) {
28
+ const [identifier, value] = Object.entries(serialized)[0];
65
29
  this.identifier = identifier;
66
30
  this.value = value;
67
31
  return this;
68
- };
69
- return WeaponItem;
70
- }(Item));
71
- export { WeaponItem };
32
+ }
33
+ }
@@ -1,11 +1,8 @@
1
- var Persistable = /** @class */ (function () {
2
- function Persistable(id, owner, position, rotation) {
3
- if (rotation === void 0) { rotation = { x: 0, y: 0, z: 0 }; }
1
+ export class Persistable {
2
+ constructor(id, owner, position, rotation = { x: 0, y: 0, z: 0 }) {
4
3
  this.id = id;
5
4
  this.owner = owner;
6
5
  this.position = position;
7
6
  this.rotation = rotation;
8
7
  }
9
- return Persistable;
10
- }());
11
- export { Persistable };
8
+ }
@@ -1,7 +1,5 @@
1
- var Stash = /** @class */ (function () {
2
- function Stash() {
3
- }
4
- Stash.toStub = function (stash) {
1
+ export class Stash {
2
+ static toStub(stash) {
5
3
  return {
6
4
  id: stash.id,
7
5
  maxSlots: stash.maxSlots,
@@ -9,7 +7,5 @@ var Stash = /** @class */ (function () {
9
7
  type: stash.type,
10
8
  slots: stash.slots,
11
9
  };
12
- };
13
- return Stash;
14
- }());
15
- export { Stash };
10
+ }
11
+ }
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "@armoury/fivem-roleplay-gamemode-common",
3
- "version": "1.0.54",
4
- "description": "Shared APIs for the Armoury FiveM roleplay gamemode",
5
- "main": "dist/cjs/shared/index.js",
6
- "module": "dist/esm/shared/index.js",
7
- "types": "dist/types/shared/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/types/shared/index.d.ts",
11
- "import": "./dist/esm/shared/index.js",
12
- "require": "./dist/cjs/shared/index.js"
13
- }
14
- },
15
- "files": ["dist"],
16
- "peerDependencies": {
17
- "@armoury/fivem-framework-common": "1.0.54"
18
- },
19
- "scripts": {
20
- "build": "npm run build:cjs && npm run build:esm && npm run build:types",
21
- "build:cjs": "tsc -p tsconfig.cjs.json",
22
- "build:esm": "tsc -p tsconfig.esm.json",
23
- "build:types": "tsc -p tsconfig.types.json"
24
- },
25
- "publishConfig": {
26
- "access": "public"
27
- }
28
- }
1
+ {
2
+ "name": "@armoury/fivem-roleplay-gamemode-common",
3
+ "version": "1.0.55",
4
+ "description": "Shared APIs for the Armoury FiveM roleplay gamemode",
5
+ "main": "dist/cjs/shared/index.js",
6
+ "module": "dist/esm/shared/index.js",
7
+ "types": "dist/types/shared/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/types/shared/index.d.ts",
11
+ "import": "./dist/esm/shared/index.js",
12
+ "require": "./dist/cjs/shared/index.js"
13
+ }
14
+ },
15
+ "files": ["dist"],
16
+ "peerDependencies": {
17
+ "@armoury/fivem-framework-common": "1.0.55"
18
+ },
19
+ "scripts": {
20
+ "build": "npm run build:cjs && npm run build:esm && npm run build:types",
21
+ "build:cjs": "tsc -p tsconfig.cjs.json",
22
+ "build:esm": "tsc -p tsconfig.esm.json",
23
+ "build:types": "tsc -p tsconfig.types.json"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ }
28
+ }