@rpgjs/server 3.0.0-beta.7 → 3.0.0-beta.9.1
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/lib/Event.d.ts +2 -1
- package/lib/Event.js +2 -1
- package/lib/Event.js.map +1 -1
- package/lib/Game/Map.d.ts +4 -7
- package/lib/Game/Map.js +6 -0
- package/lib/Game/Map.js.map +1 -1
- package/lib/Game/WorldMaps.d.ts +16 -0
- package/lib/Game/WorldMaps.js +33 -0
- package/lib/Game/WorldMaps.js.map +1 -0
- package/lib/Interfaces/StateStore.d.ts +5 -0
- package/lib/Interfaces/StateStore.js +3 -0
- package/lib/Interfaces/StateStore.js.map +1 -0
- package/lib/MatchMaker.d.ts +24 -0
- package/lib/MatchMaker.js +58 -0
- package/lib/MatchMaker.js.map +1 -0
- package/lib/Player/Player.d.ts +53 -18
- package/lib/Player/Player.js +145 -67
- package/lib/Player/Player.js.map +1 -1
- package/lib/RpgServer.d.ts +142 -5
- package/lib/Scenes/Map.d.ts +76 -7
- package/lib/Scenes/Map.js +129 -11
- package/lib/Scenes/Map.js.map +1 -1
- package/lib/decorators/map.d.ts +6 -3
- package/lib/decorators/map.js.map +1 -1
- package/lib/entry-point.d.ts +1 -1
- package/lib/entry-point.js +61 -27
- package/lib/entry-point.js.map +1 -1
- package/lib/index.d.ts +5 -1
- package/lib/index.js +7 -1
- package/lib/index.js.map +1 -1
- package/lib/server.d.ts +2 -0
- package/lib/server.js +23 -4
- package/lib/server.js.map +1 -1
- package/package.json +8 -5
- package/LICENSE +0 -19
package/lib/Event.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { RpgPlayer } from './Player/Player';
|
|
1
2
|
export declare enum EventMode {
|
|
2
3
|
Shared = "shared",
|
|
3
4
|
Scenario = "scenario"
|
|
4
5
|
}
|
|
5
|
-
export declare class RpgEvent {
|
|
6
|
+
export declare class RpgEvent extends RpgPlayer {
|
|
6
7
|
readonly type: string;
|
|
7
8
|
properties: any;
|
|
8
9
|
execMethod(methodName: string, methodData?: never[]): Promise<any>;
|
package/lib/Event.js
CHANGED
|
@@ -17,8 +17,9 @@ var EventMode;
|
|
|
17
17
|
EventMode["Shared"] = "shared";
|
|
18
18
|
EventMode["Scenario"] = "scenario";
|
|
19
19
|
})(EventMode = exports.EventMode || (exports.EventMode = {}));
|
|
20
|
-
class RpgEvent {
|
|
20
|
+
class RpgEvent extends Player_1.RpgPlayer {
|
|
21
21
|
constructor() {
|
|
22
|
+
super(...arguments);
|
|
22
23
|
this.type = 'event';
|
|
23
24
|
this.properties = {};
|
|
24
25
|
}
|
package/lib/Event.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../src/Event.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../src/Event.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA2C;AAC3C,0CAAiD;AAEjD,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,8BAAiB,CAAA;IACjB,kCAAqB,CAAA;AACzB,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB;AAED,MAAa,QAAS,SAAQ,kBAAS;IAAvC;;QAEoB,SAAI,GAAW,OAAO,CAAA;QACtC,eAAU,GAAQ,EAAE,CAAA;IAqBxB,CAAC;IAnBS,UAAU,CAAC,UAAkB,EAAE,UAAU,GAAG,EAAE;;YAChD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;gBACnB,OAAM;aACT;YACD,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,UAAU,CAAC,CAAA;YAC3C,MAAM,IAAI,GAAG,GAAG,EAAE;gBACd,MAAM,MAAM,GAAQ,UAAU,CAAC,CAAC,CAAC,CAAA;gBACjC,IAAI,MAAM,YAAY,kBAAS,EAAE;oBAC7B,MAAM,CAAC,WAAW,EAAE,CAAA;iBACvB;YACL,CAAC,CAAA;YACD,IAAI,cAAK,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;gBACtB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACjB;iBACI;gBACD,IAAI,EAAE,CAAA;aACT;YACD,OAAO,GAAG,CAAA;QACd,CAAC;KAAA;CACJ;AAxBD,4BAwBC"}
|
package/lib/Game/Map.d.ts
CHANGED
|
@@ -12,13 +12,6 @@ export declare type EventOption = EventPosOption | EventOptions;
|
|
|
12
12
|
export declare class RpgMap extends RpgCommonMap {
|
|
13
13
|
private _server;
|
|
14
14
|
_events: EventOption[];
|
|
15
|
-
/**
|
|
16
|
-
* @title map id
|
|
17
|
-
* @readonly
|
|
18
|
-
* @prop {string} [id]
|
|
19
|
-
* @memberof Map
|
|
20
|
-
* */
|
|
21
|
-
readonly id: string;
|
|
22
15
|
file: any;
|
|
23
16
|
/**
|
|
24
17
|
* @title event list
|
|
@@ -30,6 +23,7 @@ export declare class RpgMap extends RpgCommonMap {
|
|
|
30
23
|
};
|
|
31
24
|
constructor(_server: RpgServerEngine);
|
|
32
25
|
load(): Promise<void>;
|
|
26
|
+
private loadProperties;
|
|
33
27
|
get game(): RpgCommonGame;
|
|
34
28
|
onLoad(): void;
|
|
35
29
|
onJoin(player: RpgPlayer): void;
|
|
@@ -121,5 +115,8 @@ export declare class RpgMap extends RpgCommonMap {
|
|
|
121
115
|
}
|
|
122
116
|
export interface RpgMap {
|
|
123
117
|
sounds: string[];
|
|
118
|
+
$schema: any;
|
|
124
119
|
$setSchema: (schema: any) => void;
|
|
120
|
+
$patchSchema: (schema: any) => void;
|
|
121
|
+
$snapshotUser: (userId: string) => any;
|
|
125
122
|
}
|
package/lib/Game/Map.js
CHANGED
|
@@ -70,6 +70,7 @@ class RpgMap extends common_1.RpgCommonMap {
|
|
|
70
70
|
}
|
|
71
71
|
const data = yield this.parseFile();
|
|
72
72
|
_super.load.call(this, data);
|
|
73
|
+
this.loadProperties(data.properties);
|
|
73
74
|
(_a = this._server.workers) === null || _a === void 0 ? void 0 : _a.call('loadMap', {
|
|
74
75
|
id: this.id,
|
|
75
76
|
data
|
|
@@ -79,6 +80,11 @@ class RpgMap extends common_1.RpgCommonMap {
|
|
|
79
80
|
this.onLoad();
|
|
80
81
|
});
|
|
81
82
|
}
|
|
83
|
+
loadProperties(properties) {
|
|
84
|
+
for (let key in properties) {
|
|
85
|
+
this[key] = properties[key];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
82
88
|
get game() {
|
|
83
89
|
return this._server.gameEngine;
|
|
84
90
|
}
|
package/lib/Game/Map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Map.js","sourceRoot":"","sources":["../../src/Game/Map.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0CAA6E;AAC7E,4CAAmB;AAEnB,6CAAiE;AACjE,uDAA4C;AAW5C,MAAM,SAAU,SAAQ,iBAAQ;IAI5B,MAAM;QACF,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,UAAU,CAAA;QACtE,IAAI,OAAO,EAAE;YACT,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;SAC3B;QACD,IAAI,SAAS,EAAE;YACX,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAA;SAClC;QACD,IAAI,KAAK,EAAE;YACP,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;SACrB;QACD,IAAI,SAAS,EAAE;YACX,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;SAC7B;QACD,IAAI,IAAI,IAAI,QAAQ,EAAE;YAClB,IAAI,CAAC,iBAAiB,CAAC,CAAE,kBAAI,CAAC,UAAU,EAAE,CAAE,CAAC,CAAA;SAChD;IACL,CAAC;IAEK,QAAQ,CAAC,MAAiB;;YAC5B,MAAM,E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AAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAA;SAC/B;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,CAAA;QAErE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,YAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;gBACzC,IAAI,GAAG;oBAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;gBAC3B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;YAC7B,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACN,CAAC;IAED,OAAO,CAAC,MAAW;QACf,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;IAClC,CAAC;CACJ;AA1QD,wBA0QC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RpgCommonWorldMaps } from '@rpgjs/common';
|
|
2
|
+
import { TiledWorld, TiledMap, TiledWorldMap } from '@rpgjs/tiled';
|
|
3
|
+
import { SceneMap } from '../Scenes/Map';
|
|
4
|
+
export declare type RpgTiledWorldMap = {
|
|
5
|
+
id?: string;
|
|
6
|
+
fileName: string | TiledMap;
|
|
7
|
+
} & TiledWorldMap;
|
|
8
|
+
export declare type RpgTiledWorld = {
|
|
9
|
+
maps: RpgTiledWorldMap[];
|
|
10
|
+
} & TiledWorld;
|
|
11
|
+
export interface WorldMap extends RpgTiledWorld {
|
|
12
|
+
id?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class RpgWorldMaps extends RpgCommonWorldMaps {
|
|
15
|
+
load(world: WorldMap, sceneMap: SceneMap): this;
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RpgWorldMaps = void 0;
|
|
4
|
+
const common_1 = require("@rpgjs/common");
|
|
5
|
+
class RpgWorldMaps extends common_1.RpgCommonWorldMaps {
|
|
6
|
+
load(world, sceneMap) {
|
|
7
|
+
var _a;
|
|
8
|
+
for (let worldMap of world.maps) {
|
|
9
|
+
const { fileName } = worldMap;
|
|
10
|
+
let id, map;
|
|
11
|
+
if (worldMap.id) {
|
|
12
|
+
id = worldMap.id;
|
|
13
|
+
}
|
|
14
|
+
else if (common_1.Utils.isString(fileName)) {
|
|
15
|
+
id = common_1.Utils.extractId(fileName);
|
|
16
|
+
}
|
|
17
|
+
const create = () => sceneMap.createDynamicMap({
|
|
18
|
+
id,
|
|
19
|
+
file: fileName
|
|
20
|
+
});
|
|
21
|
+
if (!id) {
|
|
22
|
+
map = create();
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
map = (_a = sceneMap.getMapBydId(id)) !== null && _a !== void 0 ? _a : create();
|
|
26
|
+
}
|
|
27
|
+
this.addMap(worldMap, map);
|
|
28
|
+
}
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.RpgWorldMaps = RpgWorldMaps;
|
|
33
|
+
//# sourceMappingURL=WorldMaps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorldMaps.js","sourceRoot":"","sources":["../../src/Game/WorldMaps.ts"],"names":[],"mappings":";;;AAAA,0CAAyD;AAkBzD,MAAa,YAAa,SAAQ,2BAAkB;IAChD,IAAI,CAAC,KAAe,EAAE,QAAkB;;QACpC,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE;YAC7B,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAA;YAC7B,IAAI,EAAE,EAAE,GAAwB,CAAA;YAChC,IAAI,QAAQ,CAAC,EAAE,EAAE;gBACb,EAAE,GAAG,QAAQ,CAAC,EAAE,CAAA;aACnB;iBACI,IAAI,cAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;gBAC/B,EAAE,GAAG,cAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;aACjC;YACD,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;gBAC3C,EAAE;gBACF,IAAI,EAAE,QAAQ;aACjB,CAAC,CAAA;YACF,IAAI,CAAC,EAAE,EAAE;gBACL,GAAG,GAAG,MAAM,EAAE,CAAA;aACjB;iBACI;gBACD,GAAG,GAAG,MAAA,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,mCAAI,MAAM,EAAE,CAAA;aAC7C;YACD,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;SAC7B;QACD,OAAO,IAAI,CAAA;IACf,CAAC;CACJ;AAzBD,oCAyBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateStore.js","sourceRoot":"","sources":["../../src/Interfaces/StateStore.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RpgPlayer } from './Player/Player';
|
|
2
|
+
interface MatchMakerPayload {
|
|
3
|
+
playerId: string;
|
|
4
|
+
mapName: string;
|
|
5
|
+
}
|
|
6
|
+
export interface MatchMakerResponse {
|
|
7
|
+
url: string;
|
|
8
|
+
port: number;
|
|
9
|
+
serverId: string;
|
|
10
|
+
}
|
|
11
|
+
export interface MatchMakerOption {
|
|
12
|
+
endpoint?: string;
|
|
13
|
+
headers?: any;
|
|
14
|
+
callback?: (payload: MatchMakerPayload) => MatchMakerResponse;
|
|
15
|
+
}
|
|
16
|
+
export declare class RpgMatchMaker {
|
|
17
|
+
private options;
|
|
18
|
+
private endpoint?;
|
|
19
|
+
private headers?;
|
|
20
|
+
private callback?;
|
|
21
|
+
constructor(options: MatchMakerOption);
|
|
22
|
+
getServer(player: RpgPlayer): Promise<MatchMakerResponse | null>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.RpgMatchMaker = void 0;
|
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
|
17
|
+
const common_1 = require("@rpgjs/common");
|
|
18
|
+
class RpgMatchMaker {
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.options = options;
|
|
21
|
+
this.endpoint = options.endpoint;
|
|
22
|
+
this.headers = options.headers;
|
|
23
|
+
this.callback = options.callback;
|
|
24
|
+
}
|
|
25
|
+
getServer(player) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const currentServerId = player.server.serverId;
|
|
28
|
+
const payload = {
|
|
29
|
+
playerId: player.id,
|
|
30
|
+
mapName: player.map
|
|
31
|
+
};
|
|
32
|
+
let res = {};
|
|
33
|
+
if (this.callback) {
|
|
34
|
+
res = this.callback(payload);
|
|
35
|
+
if (common_1.Utils.isPromise(res)) {
|
|
36
|
+
res = yield res;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (this.endpoint) {
|
|
40
|
+
try {
|
|
41
|
+
res = yield axios_1.default.post(this.endpoint, payload, {
|
|
42
|
+
headers: this.headers
|
|
43
|
+
}).then(res => res.data);
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
console.log('There is a problem with the MatchMaker webservice.');
|
|
47
|
+
throw err;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (currentServerId == res.serverId) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return res;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.RpgMatchMaker = RpgMatchMaker;
|
|
58
|
+
//# sourceMappingURL=MatchMaker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatchMaker.js","sourceRoot":"","sources":["../src/MatchMaker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAAyB;AACzB,0CAAqC;AAoBrC,MAAa,aAAa;IAKtB,YAAoB,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;QACzC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QAC9B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IACpC,CAAC;IAEK,SAAS,CAAC,MAAiB;;YAC7B,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAA;YAC9C,MAAM,OAAO,GAAsB;gBAC/B,QAAQ,EAAE,MAAM,CAAC,EAAE;gBACnB,OAAO,EAAE,MAAM,CAAC,GAAG;aACtB,CAAA;YACD,IAAI,GAAG,GAAG,EAAwB,CAAA;YAClC,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACf,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;gBAC5B,IAAI,cAAK,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;oBACtB,GAAG,GAAG,MAAM,GAAG,CAAA;iBAClB;aACJ;YACD,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACf,IAAI;oBACA,GAAG,GAAG,MAAM,eAAK,CAAC,IAAI,CAAqB,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE;wBAC/D,OAAO,EAAE,IAAI,CAAC,OAAO;qBACxB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;iBAC3B;gBACD,OAAO,GAAG,EAAE;oBACR,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAA;oBACjE,MAAM,GAAG,CAAA;iBACZ;aACJ;YACD,IAAI,eAAe,IAAI,GAAG,CAAC,QAAQ,EAAE;gBACjC,OAAO,IAAI,CAAA;aACd;YACD,OAAO,GAAG,CAAA;QACd,CAAC;KAAA;CACJ;AAxCD,sCAwCC"}
|
package/lib/Player/Player.d.ts
CHANGED
|
@@ -27,12 +27,8 @@ export declare class RpgPlayer extends RpgCommonPlayer {
|
|
|
27
27
|
z: NumberConstructor;
|
|
28
28
|
};
|
|
29
29
|
direction: NumberConstructor;
|
|
30
|
-
teleported:
|
|
31
|
-
|
|
32
|
-
ellipse: BooleanConstructor;
|
|
33
|
-
height: NumberConstructor;
|
|
34
|
-
width: NumberConstructor;
|
|
35
|
-
type: StringConstructor;
|
|
30
|
+
teleported: {
|
|
31
|
+
$permanent: boolean;
|
|
36
32
|
};
|
|
37
33
|
param: ObjectConstructor;
|
|
38
34
|
hp: NumberConstructor;
|
|
@@ -80,6 +76,7 @@ export declare class RpgPlayer extends RpgCommonPlayer {
|
|
|
80
76
|
action: NumberConstructor;
|
|
81
77
|
map: StringConstructor;
|
|
82
78
|
speed: NumberConstructor;
|
|
79
|
+
frequency: NumberConstructor;
|
|
83
80
|
canMove: BooleanConstructor;
|
|
84
81
|
through: BooleanConstructor;
|
|
85
82
|
throughOtherPlayer: BooleanConstructor;
|
|
@@ -87,6 +84,23 @@ export declare class RpgPlayer extends RpgCommonPlayer {
|
|
|
87
84
|
height: NumberConstructor;
|
|
88
85
|
wHitbox: NumberConstructor;
|
|
89
86
|
hHitbox: NumberConstructor;
|
|
87
|
+
_statesEfficiency: {
|
|
88
|
+
rate: {
|
|
89
|
+
$syncWithClient: boolean;
|
|
90
|
+
};
|
|
91
|
+
state: {
|
|
92
|
+
$syncWithClient: boolean;
|
|
93
|
+
};
|
|
94
|
+
}[];
|
|
95
|
+
tmpPositions: {
|
|
96
|
+
$syncWithClient: boolean;
|
|
97
|
+
};
|
|
98
|
+
initialLevel: {
|
|
99
|
+
$syncWithClient: boolean;
|
|
100
|
+
};
|
|
101
|
+
finalLevel: {
|
|
102
|
+
$syncWithClient: boolean;
|
|
103
|
+
};
|
|
90
104
|
}[];
|
|
91
105
|
position: {
|
|
92
106
|
x: NumberConstructor;
|
|
@@ -94,12 +108,8 @@ export declare class RpgPlayer extends RpgCommonPlayer {
|
|
|
94
108
|
z: NumberConstructor;
|
|
95
109
|
};
|
|
96
110
|
direction: NumberConstructor;
|
|
97
|
-
teleported:
|
|
98
|
-
|
|
99
|
-
ellipse: BooleanConstructor;
|
|
100
|
-
height: NumberConstructor;
|
|
101
|
-
width: NumberConstructor;
|
|
102
|
-
type: StringConstructor;
|
|
111
|
+
teleported: {
|
|
112
|
+
$permanent: boolean;
|
|
103
113
|
};
|
|
104
114
|
param: ObjectConstructor;
|
|
105
115
|
hp: NumberConstructor;
|
|
@@ -147,6 +157,7 @@ export declare class RpgPlayer extends RpgCommonPlayer {
|
|
|
147
157
|
action: NumberConstructor;
|
|
148
158
|
map: StringConstructor;
|
|
149
159
|
speed: NumberConstructor;
|
|
160
|
+
frequency: NumberConstructor;
|
|
150
161
|
canMove: BooleanConstructor;
|
|
151
162
|
through: BooleanConstructor;
|
|
152
163
|
throughOtherPlayer: BooleanConstructor;
|
|
@@ -154,17 +165,37 @@ export declare class RpgPlayer extends RpgCommonPlayer {
|
|
|
154
165
|
height: NumberConstructor;
|
|
155
166
|
wHitbox: NumberConstructor;
|
|
156
167
|
hHitbox: NumberConstructor;
|
|
168
|
+
_statesEfficiency: {
|
|
169
|
+
rate: {
|
|
170
|
+
$syncWithClient: boolean;
|
|
171
|
+
};
|
|
172
|
+
state: {
|
|
173
|
+
$syncWithClient: boolean;
|
|
174
|
+
};
|
|
175
|
+
}[];
|
|
176
|
+
tmpPositions: {
|
|
177
|
+
$syncWithClient: boolean;
|
|
178
|
+
};
|
|
179
|
+
initialLevel: {
|
|
180
|
+
$syncWithClient: boolean;
|
|
181
|
+
};
|
|
182
|
+
finalLevel: {
|
|
183
|
+
$syncWithClient: boolean;
|
|
184
|
+
};
|
|
157
185
|
};
|
|
158
186
|
private _name;
|
|
159
187
|
events: any;
|
|
160
188
|
param: any;
|
|
161
189
|
_rooms: never[];
|
|
190
|
+
session: string | null;
|
|
162
191
|
prevMap: string;
|
|
192
|
+
private touchSide;
|
|
163
193
|
_lastFrame: number;
|
|
164
194
|
constructor(gameEngine: RpgCommonGame, playerId: string);
|
|
165
195
|
get otherPlayersCollision(): RpgPlayer[];
|
|
166
196
|
teleported: number;
|
|
167
197
|
_init(): void;
|
|
198
|
+
private get schema();
|
|
168
199
|
/**
|
|
169
200
|
* ```ts
|
|
170
201
|
* player.name = 'Link'
|
|
@@ -198,14 +229,15 @@ export declare class RpgPlayer extends RpgCommonPlayer {
|
|
|
198
229
|
* @method player.changeMap(mapId,positions)
|
|
199
230
|
* @param {string} mapId
|
|
200
231
|
* @param { {x: number, y: number, z?: number} | string } [positions]
|
|
201
|
-
* @returns {Promise<RpgMap>}
|
|
232
|
+
* @returns {Promise<RpgMap | null>} null if map not exists
|
|
202
233
|
* @memberof Player
|
|
203
234
|
*/
|
|
204
235
|
changeMap(mapId: string, positions?: {
|
|
205
236
|
x: number;
|
|
206
237
|
y: number;
|
|
207
238
|
z?: number;
|
|
208
|
-
} | string): Promise<RpgMap>;
|
|
239
|
+
} | string): Promise<RpgMap | null | boolean>;
|
|
240
|
+
autoChangeMap(nextPosition: Position): Promise<boolean>;
|
|
209
241
|
/**
|
|
210
242
|
* Dynamically create an event in Scenario mode on the current map
|
|
211
243
|
*
|
|
@@ -272,14 +304,14 @@ export declare class RpgPlayer extends RpgCommonPlayer {
|
|
|
272
304
|
* @title Teleport on the map
|
|
273
305
|
* @method player.teleport(positions)
|
|
274
306
|
* @param { {x: number, y: number, z?: number} | string } [positions]
|
|
275
|
-
* @returns { {x: number, y: number, z: number} }
|
|
307
|
+
* @returns {Promise<{ {x: number, y: number, z: number} }>}
|
|
276
308
|
* @memberof Player
|
|
277
309
|
*/
|
|
278
310
|
teleport(positions?: {
|
|
279
311
|
x: number;
|
|
280
312
|
y: number;
|
|
281
313
|
z?: number;
|
|
282
|
-
} | string): Position
|
|
314
|
+
} | string): Promise<Position>;
|
|
283
315
|
/**
|
|
284
316
|
* Load the saved data with the method save()
|
|
285
317
|
* If the player was on a map, it repositions the player on the map.
|
|
@@ -347,13 +379,16 @@ export declare class RpgPlayer extends RpgCommonPlayer {
|
|
|
347
379
|
/**
|
|
348
380
|
* Retrieves data from the current map
|
|
349
381
|
*
|
|
382
|
+
* returns null if the player is not assigned to a map
|
|
383
|
+
*
|
|
350
384
|
* @title Get Current Map
|
|
351
385
|
* @method player.getCurrentMap()
|
|
352
|
-
* @returns {RpgMap}
|
|
386
|
+
* @returns {RpgMap | null}
|
|
353
387
|
* @memberof Player
|
|
354
388
|
*/
|
|
355
|
-
getCurrentMap<T extends RpgMap = RpgMap>(): T;
|
|
389
|
+
getCurrentMap<T extends RpgMap = RpgMap>(): T | null;
|
|
356
390
|
loadScene(name: string, data: any): void;
|
|
391
|
+
changeServer(url: string, port: number): void;
|
|
357
392
|
private _getMap;
|
|
358
393
|
/**
|
|
359
394
|
* Calls the showAnimation() method on the client side to display an animation on the player
|