@armoury/fivem-roleplay-gamemode-common 1.0.54 → 1.0.56
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/dist/cjs/shared/models/account/account.js +3 -4
- package/dist/cjs/shared/models/businesses/business.model.js +3 -4
- package/dist/cjs/shared/models/character/character.js +3 -4
- package/dist/cjs/shared/models/house/house.js +13 -22
- package/dist/cjs/shared/models/items/deprecated/clothing/clothing-item.js +23 -47
- package/dist/cjs/shared/models/items/deprecated/errors/item-error-base.js +5 -24
- package/dist/cjs/shared/models/items/deprecated/errors/item-errors.js +9 -28
- package/dist/cjs/shared/models/items/deprecated/errors/item-stash-error-base.js +5 -24
- package/dist/cjs/shared/models/items/deprecated/item-stash.model.js +45 -75
- package/dist/cjs/shared/models/items/deprecated/item.model.js +6 -7
- package/dist/cjs/shared/models/items/deprecated/items-base/number-item.js +22 -51
- package/dist/cjs/shared/models/items/deprecated/stashes-base/generic-stash.js +5 -25
- package/dist/cjs/shared/models/items/deprecated/stashes-base/infinite-stash.js +10 -30
- package/dist/cjs/shared/models/items/deprecated/weapons/weapon-item.js +26 -63
- package/dist/cjs/shared/models/persistable/persistable.js +3 -5
- package/dist/cjs/shared/models/stash/stash.js +4 -7
- package/dist/esm/shared/models/account/account.js +3 -5
- package/dist/esm/shared/models/businesses/business.model.js +3 -5
- package/dist/esm/shared/models/character/character.js +3 -5
- package/dist/esm/shared/models/house/house.js +13 -23
- package/dist/esm/shared/models/items/deprecated/clothing/clothing-item.js +22 -47
- package/dist/esm/shared/models/items/deprecated/errors/item-error-base.js +5 -25
- package/dist/esm/shared/models/items/deprecated/errors/item-errors.js +8 -29
- package/dist/esm/shared/models/items/deprecated/errors/item-stash-error-base.js +5 -25
- package/dist/esm/shared/models/items/deprecated/item-stash.model.js +44 -75
- package/dist/esm/shared/models/items/deprecated/item.model.js +6 -8
- package/dist/esm/shared/models/items/deprecated/items-base/number-item.js +21 -51
- package/dist/esm/shared/models/items/deprecated/stashes-base/generic-stash.js +4 -25
- package/dist/esm/shared/models/items/deprecated/stashes-base/infinite-stash.js +9 -30
- package/dist/esm/shared/models/items/deprecated/weapons/weapon-item.js +25 -63
- package/dist/esm/shared/models/persistable/persistable.js +3 -6
- package/dist/esm/shared/models/stash/stash.js +4 -8
- package/package.json +28 -28
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
|
7
|
+
this.fullyOccupiesSlot = fullyOccupiesSlot ?? false;
|
|
8
8
|
}
|
|
9
|
-
|
|
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
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
12
|
+
}
|
|
13
|
+
consume(amount) {
|
|
41
14
|
return this.add(-amount);
|
|
42
|
-
}
|
|
43
|
-
|
|
15
|
+
}
|
|
16
|
+
empty() {
|
|
44
17
|
this.value = 0;
|
|
45
18
|
return this;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
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
|
-
|
|
18
|
-
|
|
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
|
-
|
|
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
|
-
|
|
18
|
-
|
|
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
|
-
|
|
26
|
-
|
|
5
|
+
}
|
|
6
|
+
consume(_item, _amount) { }
|
|
7
|
+
has(_itemIdentifier) {
|
|
27
8
|
return true;
|
|
28
|
-
}
|
|
29
|
-
|
|
9
|
+
}
|
|
10
|
+
deserialize(serialized) {
|
|
30
11
|
throw new Error("Method not implemented.");
|
|
31
|
-
}
|
|
32
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
15
|
+
}
|
|
16
|
+
consume(amount) {
|
|
52
17
|
return this.add(-amount);
|
|
53
|
-
}
|
|
54
|
-
|
|
18
|
+
}
|
|
19
|
+
empty() {
|
|
55
20
|
return this.add(-this.value.ammo);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
70
|
-
}(Item));
|
|
71
|
-
export { WeaponItem };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
10
|
-
}());
|
|
11
|
-
export { Persistable };
|
|
8
|
+
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.56",
|
|
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
|
+
}
|