@armoury/fivem-roleplay-gamemode-common 1.0.39 → 1.0.46

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.
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./models"), exports);
18
+ __exportStar(require("./stub"), exports);
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.House = void 0;
4
4
  var House = /** @class */ (function () {
5
- function House(id, owner, entrance, exit, originalValue, sellingPrice, rentPrice, requiredLevel) {
5
+ function House(id, owner, entrance, exit, originalValue, address, sellingPrice, rentPrice, requiredLevel, metadata) {
6
6
  if (sellingPrice === void 0) { sellingPrice = 0; }
7
7
  if (rentPrice === void 0) { rentPrice = 0; }
8
8
  if (requiredLevel === void 0) { requiredLevel = 1; }
@@ -11,10 +11,28 @@ var House = /** @class */ (function () {
11
11
  this.entrance = entrance;
12
12
  this.exit = exit;
13
13
  this.originalValue = originalValue;
14
+ this.address = address;
14
15
  this.sellingPrice = sellingPrice;
15
16
  this.rentPrice = rentPrice;
16
17
  this.requiredLevel = requiredLevel;
18
+ this.metadata = metadata;
19
+ metadata = {
20
+ isOwned: owner != null,
21
+ tenants: 0, // TODO: Implement this
22
+ maxTenants: 10, // TODO: Implement this
23
+ acceptsTenants: true, // TODO: Implement this
24
+ address: address,
25
+ };
17
26
  }
27
+ House.toStub = function (house) {
28
+ return {
29
+ id: house.id,
30
+ sellingPrice: house.sellingPrice,
31
+ rentPrice: house.rentPrice,
32
+ requiredLevel: house.requiredLevel,
33
+ metadata: house.metadata,
34
+ };
35
+ };
18
36
  return House;
19
37
  }());
20
38
  exports.House = House;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +1,2 @@
1
1
  export * from './models';
2
+ export * from './stub';
@@ -1,5 +1,5 @@
1
1
  var House = /** @class */ (function () {
2
- function House(id, owner, entrance, exit, originalValue, sellingPrice, rentPrice, requiredLevel) {
2
+ function House(id, owner, entrance, exit, originalValue, address, sellingPrice, rentPrice, requiredLevel, metadata) {
3
3
  if (sellingPrice === void 0) { sellingPrice = 0; }
4
4
  if (rentPrice === void 0) { rentPrice = 0; }
5
5
  if (requiredLevel === void 0) { requiredLevel = 1; }
@@ -8,10 +8,28 @@ var House = /** @class */ (function () {
8
8
  this.entrance = entrance;
9
9
  this.exit = exit;
10
10
  this.originalValue = originalValue;
11
+ this.address = address;
11
12
  this.sellingPrice = sellingPrice;
12
13
  this.rentPrice = rentPrice;
13
14
  this.requiredLevel = requiredLevel;
15
+ this.metadata = metadata;
16
+ metadata = {
17
+ isOwned: owner != null,
18
+ tenants: 0, // TODO: Implement this
19
+ maxTenants: 10, // TODO: Implement this
20
+ acceptsTenants: true, // TODO: Implement this
21
+ address: address,
22
+ };
14
23
  }
24
+ House.toStub = function (house) {
25
+ return {
26
+ id: house.id,
27
+ sellingPrice: house.sellingPrice,
28
+ rentPrice: house.rentPrice,
29
+ requiredLevel: house.requiredLevel,
30
+ metadata: house.metadata,
31
+ };
32
+ };
15
33
  return House;
16
34
  }());
17
35
  export { House };
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,2 @@
1
1
  export * from './models';
2
+ export * from './stub';
@@ -1,3 +1,4 @@
1
+ import type { Stub } from '@armoury/fivem-framework-common';
1
2
  export interface House {
2
3
  readonly id: number;
3
4
  readonly owner: number | null;
@@ -7,6 +8,7 @@ export interface House {
7
8
  readonly sellingPrice: number;
8
9
  readonly rentPrice: number;
9
10
  readonly requiredLevel: number;
11
+ readonly metadata?: HouseMetadata;
10
12
  }
11
13
  export declare class House {
12
14
  readonly id: number;
@@ -14,10 +16,20 @@ export declare class House {
14
16
  readonly entrance: Position;
15
17
  readonly exit: Position;
16
18
  readonly originalValue: number;
19
+ readonly address: string;
17
20
  readonly sellingPrice: number;
18
21
  readonly rentPrice: number;
19
22
  readonly requiredLevel: number;
20
- constructor(id: number, owner: number | null, entrance: Position, exit: Position, originalValue: number, sellingPrice?: number, rentPrice?: number, requiredLevel?: number);
23
+ readonly metadata?: HouseMetadata;
24
+ constructor(id: number, owner: number | null, entrance: Position, exit: Position, originalValue: number, address: string, sellingPrice?: number, rentPrice?: number, requiredLevel?: number, metadata?: HouseMetadata);
25
+ static toStub(house: House): Stub<House>;
26
+ }
27
+ export interface HouseMetadata {
28
+ isOwned?: boolean;
29
+ tenants?: number;
30
+ maxTenants?: number;
31
+ acceptsTenants?: boolean;
32
+ address?: string;
21
33
  }
22
34
  type Position = {
23
35
  x: number;
@@ -0,0 +1,15 @@
1
+ import type { House, HouseMetadata } from './models/house/house';
2
+ declare module '@armoury/fivem-framework-common' {
3
+ interface StubFieldRegistry {
4
+ House: {
5
+ model: House;
6
+ fields: {
7
+ sellingPrice: number;
8
+ rentPrice: number;
9
+ requiredLevel: number;
10
+ metadata?: HouseMetadata;
11
+ };
12
+ };
13
+ }
14
+ }
15
+ export type { Stub } from '@armoury/fivem-framework-common';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armoury/fivem-roleplay-gamemode-common",
3
- "version": "1.0.39",
3
+ "version": "1.0.46",
4
4
  "description": "Shared APIs for the Armoury FiveM roleplay gamemode",
5
5
  "main": "dist/cjs/shared/index.js",
6
6
  "module": "dist/esm/shared/index.js",
@@ -13,6 +13,9 @@
13
13
  }
14
14
  },
15
15
  "files": ["dist"],
16
+ "peerDependencies": {
17
+ "@armoury/fivem-framework-common": "^1.0.46"
18
+ },
16
19
  "scripts": {
17
20
  "build": "npm run build:cjs && npm run build:esm && npm run build:types",
18
21
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -22,4 +25,4 @@
22
25
  "publishConfig": {
23
26
  "access": "public"
24
27
  }
25
- }
28
+ }