@rpgjs/server 3.0.0-beta.4 → 3.0.0-beta.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.
package/lib/Event.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- import { RpgPlayer } from './Player/Player';
2
1
  export declare enum EventMode {
3
2
  Shared = "shared",
4
3
  Scenario = "scenario"
5
4
  }
6
- export declare class RpgEvent extends RpgPlayer {
5
+ export declare class RpgEvent {
7
6
  readonly type: string;
8
7
  properties: any;
9
8
  execMethod(methodName: string, methodData?: never[]): Promise<any>;
package/lib/Event.js CHANGED
@@ -17,9 +17,8 @@ var EventMode;
17
17
  EventMode["Shared"] = "shared";
18
18
  EventMode["Scenario"] = "scenario";
19
19
  })(EventMode = exports.EventMode || (exports.EventMode = {}));
20
- class RpgEvent extends Player_1.RpgPlayer {
20
+ class RpgEvent {
21
21
  constructor() {
22
- super(...arguments);
23
22
  this.type = 'event';
24
23
  this.properties = {};
25
24
  }
package/lib/Event.js.map CHANGED
@@ -1 +1 @@
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,G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,IAAI,EAAE,CAAA;aACT;YACD,OAAO,GAAG,CAAA;QACd,CAAC;KAAA;CACJ;AAxBD,4BAwBC"}
package/lib/Game/Map.d.ts CHANGED
@@ -1,8 +1,6 @@
1
- import { RpgCommonMap, RpgShape } from '@rpgjs/common';
2
- import * as Kompute from 'kompute/build/Kompute';
1
+ import { RpgCommonMap, RpgShape, RpgCommonGame } from '@rpgjs/common';
3
2
  import { EventOptions } from '../decorators/event';
4
- import { EventMode, RpgEvent } from '../Event';
5
- import { RpgPlayer } from '../Player/Player';
3
+ import { RpgPlayer, EventMode, RpgEvent } from '../Player/Player';
6
4
  import { RpgServerEngine } from '../server';
7
5
  export declare type EventPosOption = {
8
6
  x: number;
@@ -30,11 +28,9 @@ export declare class RpgMap extends RpgCommonMap {
30
28
  events: {
31
29
  [eventId: string]: RpgEvent;
32
30
  };
33
- kWorld: Kompute;
34
- entityManager: any;
35
31
  constructor(_server: RpgServerEngine);
36
32
  load(): Promise<void>;
37
- get game(): any;
33
+ get game(): RpgCommonGame;
38
34
  onLoad(): void;
39
35
  onJoin(player: RpgPlayer): void;
40
36
  onLeave(player: RpgPlayer): void;
@@ -96,6 +92,16 @@ export declare class RpgMap extends RpgCommonMap {
96
92
  createDynamicEvent(eventsList: EventPosOption | EventPosOption[]): {
97
93
  [eventId: string]: RpgEvent;
98
94
  };
95
+ /**
96
+ * Get Event in current map
97
+ * @title Get Event
98
+ * @since 3.0.0-beta.7
99
+ * @method map.getEvent(eventId)
100
+ * @param {string} eventId Event Id
101
+ * @returns {RpgEvent | undefined}
102
+ * @memberof Map
103
+ */
104
+ getEvent<T extends RpgEvent>(eventId: string): T | undefined;
99
105
  /**
100
106
  * Removes an event from the map. Returns false if the event is not found
101
107
  * @title Remove Event
package/lib/Game/Map.js CHANGED
@@ -1,23 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -34,10 +15,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
34
15
  exports.RpgMap = void 0;
35
16
  const common_1 = require("@rpgjs/common");
36
17
  const fs_1 = __importDefault(require("fs"));
37
- const YUKA = __importStar(require("yuka"));
38
- const Event_1 = require("../Event");
18
+ const Player_1 = require("../Player/Player");
39
19
  const MoveManager_1 = require("../Player/MoveManager");
40
- class AutoEvent extends Event_1.RpgEvent {
20
+ class AutoEvent extends Player_1.RpgEvent {
41
21
  onInit() {
42
22
  const { graphic, direction, speed, frequency, move } = this.properties;
43
23
  if (graphic) {
@@ -78,18 +58,22 @@ class RpgMap extends common_1.RpgCommonMap {
78
58
  * @memberof Map
79
59
  * */
80
60
  this.events = {};
81
- this.entityManager = new YUKA.EntityManager();
82
61
  }
83
62
  load() {
84
63
  const _super = Object.create(null, {
85
64
  load: { get: () => super.load }
86
65
  });
66
+ var _a;
87
67
  return __awaiter(this, void 0, void 0, function* () {
88
68
  if (common_1.RpgCommonMap.buffer.has(this.id)) {
89
69
  return;
90
70
  }
91
71
  const data = yield this.parseFile();
92
72
  _super.load.call(this, data);
73
+ (_a = this._server.workers) === null || _a === void 0 ? void 0 : _a.call('loadMap', {
74
+ id: this.id,
75
+ data
76
+ });
93
77
  common_1.RpgCommonMap.buffer.set(this.id, this);
94
78
  this.createDynamicEvent(this._events);
95
79
  this.onLoad();
@@ -100,24 +84,22 @@ class RpgMap extends common_1.RpgCommonMap {
100
84
  }
101
85
  onLoad() { }
102
86
  onJoin(player) {
103
- this.entityManager.add(player.steerable);
104
87
  }
105
88
  onLeave(player) {
106
- player.stopBehavior();
107
- this.entityManager.remove(player.steerable);
108
89
  this.getShapes().forEach(shape => shape.out(player));
109
- const events = this.game.world.getObjectsOfGroup(this.id, player);
90
+ const events = Object.values(this.game.world.getObjectsOfGroup(this.id, player));
110
91
  for (let event of events) {
111
92
  player.getShapes().forEach(shape => shape.out(event));
112
93
  event.getShapes().forEach(shape => shape.out(player));
113
94
  }
95
+ this.grid.clearObjectInCells(player.id);
114
96
  }
115
97
  autoLoadEvent() {
116
98
  this.getShapes().forEach(shape => {
117
99
  const { properties } = shape;
118
100
  const { x, y, pos, w, h } = shape.hitbox;
119
101
  if (shape.isEvent() && !this.events[shape.name]) {
120
- const mode = properties.mode || Event_1.EventMode.Shared;
102
+ const mode = properties.mode || Player_1.EventMode.Shared;
121
103
  AutoEvent.prototype['_name'] = shape.name;
122
104
  AutoEvent.mode = mode;
123
105
  AutoEvent.hitbox = {
@@ -201,12 +183,27 @@ class RpgMap extends common_1.RpgCommonMap {
201
183
  if (!common_1.Utils.isArray(eventsList)) {
202
184
  eventsList = [eventsList];
203
185
  }
204
- const events = this.createEvents(eventsList, Event_1.EventMode.Shared);
186
+ const events = this.createEvents(eventsList, Player_1.EventMode.Shared);
187
+ let ret = {};
205
188
  for (let key in events) {
206
189
  this.events[key] = events[key];
207
190
  this.events[key].execMethod('onInit');
191
+ // force to get Proxy object to sync with client
192
+ ret = Object.assign(Object.assign({}, ret), { [key]: this.events[key] });
208
193
  }
209
- return events;
194
+ return ret;
195
+ }
196
+ /**
197
+ * Get Event in current map
198
+ * @title Get Event
199
+ * @since 3.0.0-beta.7
200
+ * @method map.getEvent(eventId)
201
+ * @param {string} eventId Event Id
202
+ * @returns {RpgEvent | undefined}
203
+ * @memberof Map
204
+ */
205
+ getEvent(eventId) {
206
+ return this.events[eventId];
210
207
  }
211
208
  /**
212
209
  * Removes an event from the map. Returns false if the event is not found
@@ -238,9 +235,8 @@ class RpgMap extends common_1.RpgCommonMap {
238
235
  return null;
239
236
  }
240
237
  // Create an instance of RpgEvent and assign its options
241
- const ev = this.game.addEvent(event, mode == Event_1.EventMode.Shared);
238
+ const ev = this.game.addEvent(event);
242
239
  const _shape = shape || this.getEventShape(ev.name);
243
- this.entityManager.add(ev.steerable);
244
240
  ev.width = event.width || this.tileWidth;
245
241
  ev.height = event.height || this.tileHeight;
246
242
  if (_shape && _shape.properties)
@@ -1 +1 @@
1
- {"version":3,"file":"Map.js","sourceRoot":"","sources":["../../src/Game/Map.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA8D;AAE9D,4CAAmB;AACnB,2CAA4B;AAE5B,oCAA8C;AAC9C,uDAA4C;AAY5C,MAAM,SAAU,SAAQ,gBAAQ;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,C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AAK,CAAC,SAAS,EAAE,EAAE;YACnB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;iBAClB,IAAI,CAAC,GAAG,CAAC,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;AAxQD,wBAwQC"}
@@ -20,7 +20,7 @@ export declare class BattleManager {
20
20
  * @returns {object}
21
21
  * @memberof BattleManager
22
22
  * */
23
- applyDamage(otherPlayer: RpgPlayer, skill: any): {
23
+ applyDamage(otherPlayer: RpgPlayer, skill?: any): {
24
24
  damage: number;
25
25
  critical: boolean;
26
26
  elementVulnerable: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"BattleManager.js","sourceRoot":"","sources":["../../src/Player/BattleManager.ts"],"names":[],"mappings":";;;AAAA,0CAAsC;AACtC,yDAAqD;AAErD,wCAImB;AACnB,8CAAwC;AACxC,qDAAkD;AAClD,mDAAgD;AAEhD,MAAM,EACF,WAAW,EACd,GAAG,cAAK,CAAA;AAET,MAAa,aAAa;IAEtB;;;;;;;;;;;;;;;;SAgBK;IACL,WAAW,CAAC,WAA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C,EAAE,IAAI,MAAM,CAAA;QACjB,OAAO;YACH,MAAM;YACN,QAAQ;YACR,iBAAiB;YACjB,KAAK;YACL,UAAU;SACb,CAAA;IACL,CAAC;IAED,WAAW,CAAC,IAAY;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;IAC3C,CAAC;CACJ;AAlGD,sCAkGC;AAED,WAAW,CAAC,aAAa,EAAE,CAAC,mCAAgB,EAAE,+BAAc,EAAE,6BAAa,CAAC,CAAC,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { RpgPlayer } from './Player';
1
2
  import { Gui } from '../Gui';
2
3
  import { DialogOptions, Choice } from '../Gui/DialogGui';
3
4
  export declare class GuiManager {
@@ -196,4 +197,51 @@ export declare class GuiManager {
196
197
  * @memberof GuiManager
197
198
  */
198
199
  removeGui(guiId: string, data?: any): void;
200
+ private _attachedGui;
201
+ /**
202
+ * Display the GUI attached to the players
203
+ *
204
+ * If you don't specify the players as parameters, it will display the GUI of the instance
205
+ * But you can specify which GUIs to display by specifying the players as the first parameter
206
+ *
207
+ * @title View to GUI attached
208
+ * @method player.showAttachedGui(players?)
209
+ * @param {RpgPlayer[] | RpgPlayer} [players] The GUIs attached to the players to display
210
+ * @since 3.0.0-beta.5
211
+ * @example
212
+ * ```ts
213
+ * player.showAttachedGui()
214
+ * ```
215
+ * ```ts
216
+ * player.showAttachedGui(aPlayer)
217
+ * ```
218
+ * ```ts
219
+ * player.showAttachedGui([player1, player2])
220
+ * ```
221
+ * @memberof GuiManager
222
+ * */
223
+ showAttachedGui(players?: RpgPlayer[] | RpgPlayer): void;
224
+ /**
225
+ * Hide the GUI attached to the players
226
+ *
227
+ * @title Hide to GUI attached
228
+ * @method player.hideAttachedGui(players?)
229
+ * @param {RpgPlayer[] | RpgPlayer} [players] The GUIs attached to the players to hide
230
+ * @since 3.0.0-beta.5
231
+ * @example
232
+ * ```ts
233
+ * player.hideAttachedGui()
234
+ * ```
235
+ * ```ts
236
+ * player.hideAttachedGui(aPlayer)
237
+ * ```
238
+ * ```ts
239
+ * player.hideAttachedGui([player1, player2])
240
+ * ```
241
+ * @memberof GuiManager
242
+ * */
243
+ hideAttachedGui(players?: RpgPlayer[] | RpgPlayer): void;
244
+ }
245
+ export interface GuiManager {
246
+ emit: any;
199
247
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GuiManager = void 0;
4
+ const common_1 = require("@rpgjs/common");
4
5
  const Gui_1 = require("../Gui");
5
6
  class GuiManager {
6
7
  /**
@@ -225,6 +226,64 @@ class GuiManager {
225
226
  delete this._gui[guiId];
226
227
  }
227
228
  }
229
+ _attachedGui(players, display) {
230
+ if (!common_1.Utils.isArray(players)) {
231
+ players = [players];
232
+ }
233
+ this.emit('gui.tooltip', {
234
+ players: players.map(player => player.id),
235
+ display
236
+ });
237
+ }
238
+ /**
239
+ * Display the GUI attached to the players
240
+ *
241
+ * If you don't specify the players as parameters, it will display the GUI of the instance
242
+ * But you can specify which GUIs to display by specifying the players as the first parameter
243
+ *
244
+ * @title View to GUI attached
245
+ * @method player.showAttachedGui(players?)
246
+ * @param {RpgPlayer[] | RpgPlayer} [players] The GUIs attached to the players to display
247
+ * @since 3.0.0-beta.5
248
+ * @example
249
+ * ```ts
250
+ * player.showAttachedGui()
251
+ * ```
252
+ * ```ts
253
+ * player.showAttachedGui(aPlayer)
254
+ * ```
255
+ * ```ts
256
+ * player.showAttachedGui([player1, player2])
257
+ * ```
258
+ * @memberof GuiManager
259
+ * */
260
+ showAttachedGui(players) {
261
+ const _players = players || this;
262
+ this._attachedGui(_players, true);
263
+ }
264
+ /**
265
+ * Hide the GUI attached to the players
266
+ *
267
+ * @title Hide to GUI attached
268
+ * @method player.hideAttachedGui(players?)
269
+ * @param {RpgPlayer[] | RpgPlayer} [players] The GUIs attached to the players to hide
270
+ * @since 3.0.0-beta.5
271
+ * @example
272
+ * ```ts
273
+ * player.hideAttachedGui()
274
+ * ```
275
+ * ```ts
276
+ * player.hideAttachedGui(aPlayer)
277
+ * ```
278
+ * ```ts
279
+ * player.hideAttachedGui([player1, player2])
280
+ * ```
281
+ * @memberof GuiManager
282
+ * */
283
+ hideAttachedGui(players) {
284
+ const _players = players || this;
285
+ this._attachedGui(_players, false);
286
+ }
228
287
  }
229
288
  exports.GuiManager = GuiManager;
230
289
  //# sourceMappingURL=GuiManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GuiManager.js","sourceRoot":"","sources":["../../src/Player/GuiManager.ts"],"names":[],"mappings":";;;AAAA,gCAA0E;AAG1E,MAAa,UAAU;IAInB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoFG;IACH,QAAQ,CAAC,GAAW,EAAE,UAAyB,EAAE;QAC7C,MAAM,GAAG,GAAG,IAAI,eAAS,CAAM,IAAI,CAAC,CAAA;QACpC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAA;QACvB,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IACvC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,WAAW,CAAC,GAAW,EAAE,OAAiB,EAAE,OAAuB;QAC/D,OAAO,IAAI;aACN,QAAQ,CAAC,GAAG,kBACT,OAAO,IACJ,OAAO,EACZ;aACD,IAAI,CAAC,CAAC,aAAqB,EAAE,EAAE;YAC5B,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;gBAAE,OAAO,IAAI,CAAA;YACxC,OAAO,OAAO,CAAC,aAAa,CAAC,CAAA;QACjC,CAAC,CAAC,CAAA;IACV,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,OAAe,EAAE,UAA4D,EAAE;QAC5F,MAAM,GAAG,GAAG,IAAI,qBAAe,CAAM,IAAI,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MAAM,QAAQ,GAAG,OAAO,IAAI,IAAI,CAAA;QAChC,IAAI,CAAC,YAAY,CAAC,QAAuB,EAAE,IAAI,CAAC,CAAA;IACpD,CAAC;IAED;;;;;;;;;;;;;;;;;;SAkBK;IACL,eAAe,CAAC,OAAiC;QAC7C,MAAM,QAAQ,GAAG,OAAO,IAAI,IAAI,CAAA;QAChC,IAAI,CAAC,YAAY,CAAC,QAAuB,EAAE,KAAK,CAAC,CAAA;IACrD,CAAC;CACJ;AA1SD,gCA0SC"}
@@ -8,7 +8,7 @@ export declare enum Frequency {
8
8
  Lower = 400,
9
9
  Low = 200,
10
10
  High = 100,
11
- Highter = 50,
11
+ Higher = 50,
12
12
  Highest = 25,
13
13
  None = 0
14
14
  }
@@ -48,9 +48,9 @@ export declare enum Speed {
48
48
  * Move.turnTowardPlayer(player) | Turns in the direction of the designated player
49
49
  * @memberof Move
50
50
  * */
51
- export declare const Move: {
51
+ declare class MoveList {
52
52
  repeatMove(direction: Direction, repeat: number): Direction[];
53
- repeatTileMove(direction: Direction, repeat: number, propMap: string): CallbackTileMove;
53
+ private repeatTileMove;
54
54
  right(repeat?: number): Direction[];
55
55
  left(repeat?: number): Direction[];
56
56
  up(repeat?: number): Direction[];
@@ -62,12 +62,9 @@ export declare const Move: {
62
62
  tileUp(repeat?: number): CallbackTileMove;
63
63
  tileDown(repeat?: number): CallbackTileMove;
64
64
  tileRandom(repeat?: number): CallbackTileMove;
65
- _awayFromPlayerDirection(player: RpgPlayer, otherPlayer: RpgPlayer): string;
66
- _towardPlayerDirection(player: RpgPlayer, otherPlayer: RpgPlayer): string;
67
- _awayFromPlayer({ isTile, typeMov }: {
68
- isTile: boolean;
69
- typeMov: string;
70
- }, otherPlayer: RpgPlayer, repeat?: number): (player: RpgPlayer, map: any) => any;
65
+ private _awayFromPlayerDirection;
66
+ private _towardPlayerDirection;
67
+ private _awayFromPlayer;
71
68
  towardPlayer(player: RpgPlayer, repeat?: number): (player: RpgPlayer, map: any) => any;
72
69
  tileTowardPlayer(player: RpgPlayer, repeat?: number): (player: RpgPlayer, map: any) => any;
73
70
  awayFromPlayer(player: RpgPlayer, repeat?: number): CallbackTileMove;
@@ -79,7 +76,8 @@ export declare const Move: {
79
76
  turnRandom(): string;
80
77
  turnAwayFromPlayer(otherPlayer: RpgPlayer): CallbackTurnMove;
81
78
  turnTowardPlayer(otherPlayer: RpgPlayer): CallbackTurnMove;
82
- };
79
+ }
80
+ export declare const Move: MoveList;
83
81
  export declare class MoveManager {
84
82
  private movingInterval;
85
83
  private _infiniteRoutes;
@@ -175,7 +173,7 @@ export declare class MoveManager {
175
173
  * Frequency.Lower | 400
176
174
  * Frequency.Low | 200
177
175
  * Frequency.High | 100
178
- * Frequency.Highter | 50
176
+ * Frequency.Higher | 50
179
177
  * Frequency.Highest | 25
180
178
  * Frequency.None | 0
181
179
  * @default 0
@@ -290,7 +288,7 @@ export declare class MoveManager {
290
288
  replayRoutes(): void;
291
289
  }
292
290
  export interface MoveManager {
293
- moveByDirection: (direction: Direction) => boolean;
291
+ moveByDirection: (direction: Direction, deltaTimeInt: number) => boolean;
294
292
  changeDirection: (direction: Direction) => boolean;
295
293
  getCurrentMap: any;
296
294
  }
@@ -1,9 +1,18 @@
1
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
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.MoveManager = exports.Move = exports.Speed = exports.Frequency = void 0;
4
13
  const common_1 = require("@rpgjs/common");
5
14
  const common_2 = require("@rpgjs/common");
6
- const { arrayFlat, random, isFunction, capitalize, perlin } = common_2.Utils;
15
+ const { arrayFlat, random, isFunction, capitalize } = common_2.Utils;
7
16
  function wait(sec) {
8
17
  return new Promise((resolve) => {
9
18
  setTimeout(resolve, sec * 1000);
@@ -15,7 +24,7 @@ var Frequency;
15
24
  Frequency[Frequency["Lower"] = 400] = "Lower";
16
25
  Frequency[Frequency["Low"] = 200] = "Low";
17
26
  Frequency[Frequency["High"] = 100] = "High";
18
- Frequency[Frequency["Highter"] = 50] = "Highter";
27
+ Frequency[Frequency["Higher"] = 50] = "Higher";
19
28
  Frequency[Frequency["Highest"] = 25] = "Highest";
20
29
  Frequency[Frequency["None"] = 0] = "None";
21
30
  })(Frequency = exports.Frequency || (exports.Frequency = {}));
@@ -56,7 +65,7 @@ var Speed;
56
65
  * Move.turnTowardPlayer(player) | Turns in the direction of the designated player
57
66
  * @memberof Move
58
67
  * */
59
- exports.Move = new class {
68
+ class MoveList {
60
69
  repeatMove(direction, repeat) {
61
70
  return new Array(repeat).fill(direction);
62
71
  }
@@ -90,16 +99,16 @@ exports.Move = new class {
90
99
  ][random(0, 3)]);
91
100
  }
92
101
  tileRight(repeat = 1) {
93
- return this.repeatTileMove(common_1.Direction.Right, repeat, 'tileWidth');
102
+ return this.repeatTileMove('right', repeat, 'tileWidth');
94
103
  }
95
104
  tileLeft(repeat = 1) {
96
- return this.repeatTileMove(common_1.Direction.Left, repeat, 'tileWidth');
105
+ return this.repeatTileMove('left', repeat, 'tileWidth');
97
106
  }
98
107
  tileUp(repeat = 1) {
99
- return this.repeatTileMove(common_1.Direction.Up, repeat, 'tileHeight');
108
+ return this.repeatTileMove('up', repeat, 'tileHeight');
100
109
  }
101
110
  tileDown(repeat = 1) {
102
- return this.repeatTileMove(common_1.Direction.Down, repeat, 'tileHeight');
111
+ return this.repeatTileMove('down', repeat, 'tileHeight');
103
112
  }
104
113
  tileRandom(repeat = 1) {
105
114
  return (player, map) => {
@@ -121,7 +130,7 @@ exports.Move = new class {
121
130
  }
122
131
  _awayFromPlayerDirection(player, otherPlayer) {
123
132
  const directionOtherPlayer = otherPlayer.getDirection();
124
- let newDirection = '';
133
+ let newDirection = 0;
125
134
  switch (directionOtherPlayer) {
126
135
  case common_1.Direction.Left:
127
136
  case common_1.Direction.Right:
@@ -146,7 +155,7 @@ exports.Move = new class {
146
155
  }
147
156
  _towardPlayerDirection(player, otherPlayer) {
148
157
  const directionOtherPlayer = otherPlayer.getDirection();
149
- let newDirection = '';
158
+ let newDirection = 0;
150
159
  switch (directionOtherPlayer) {
151
160
  case common_1.Direction.Left:
152
161
  case common_1.Direction.Right:
@@ -170,9 +179,12 @@ exports.Move = new class {
170
179
  return newDirection;
171
180
  }
172
181
  _awayFromPlayer({ isTile, typeMov }, otherPlayer, repeat = 1) {
173
- const method = dir => this[isTile ? 'tile' + capitalize(dir) : dir](repeat);
182
+ const method = (dir) => {
183
+ const direction = common_1.LiteralDirection[dir];
184
+ return this[isTile ? 'tile' + capitalize(direction) : direction](repeat);
185
+ };
174
186
  return (player, map) => {
175
- let newDirection = '';
187
+ let newDirection = 0;
176
188
  switch (typeMov) {
177
189
  case 'away':
178
190
  newDirection = this._awayFromPlayerDirection(player, otherPlayer);
@@ -201,16 +213,16 @@ exports.Move = new class {
201
213
  return this._awayFromPlayer({ isTile: true, typeMov: 'away' }, player, repeat);
202
214
  }
203
215
  turnLeft() {
204
- return 'turn-left';
216
+ return 'turn-' + common_1.Direction.Left;
205
217
  }
206
218
  turnRight() {
207
- return 'turn-right';
219
+ return 'turn-' + common_1.Direction.Right;
208
220
  }
209
221
  turnUp() {
210
- return 'turn-up';
222
+ return 'turn-' + common_1.Direction.Up;
211
223
  }
212
224
  turnDown() {
213
- return 'turn-down';
225
+ return 'turn-' + common_1.Direction.Down;
214
226
  }
215
227
  turnRandom() {
216
228
  return [
@@ -232,7 +244,8 @@ exports.Move = new class {
232
244
  return 'turn-' + direction;
233
245
  };
234
246
  }
235
- };
247
+ }
248
+ exports.Move = new MoveList();
236
249
  class MoveManager {
237
250
  /**
238
251
  * Gives an itinerary.
@@ -285,7 +298,8 @@ class MoveManager {
285
298
  */
286
299
  moveRoutes(routes) {
287
300
  let count = 0;
288
- let frequence = this.frequency;
301
+ let frequence = 0;
302
+ this.breakRoutes(); // break previous route
289
303
  return new Promise((resolve) => {
290
304
  this._finishRoute = resolve;
291
305
  routes = routes.map((route) => {
@@ -295,8 +309,8 @@ class MoveManager {
295
309
  return route;
296
310
  });
297
311
  routes = arrayFlat(routes);
298
- const move = () => {
299
- if (count % this['nbPixelInTile'] == 0) {
312
+ const move = () => __awaiter(this, void 0, void 0, function* () {
313
+ if (count >= this['nbPixelInTile']) {
300
314
  if (frequence < this.frequency) {
301
315
  frequence++;
302
316
  return;
@@ -314,29 +328,23 @@ class MoveManager {
314
328
  case common_1.Direction.Down:
315
329
  case common_1.Direction.Right:
316
330
  case common_1.Direction.Up:
317
- this.moveByDirection(route);
331
+ yield this.moveByDirection(route, 1);
318
332
  break;
319
- case 'turn-left':
333
+ case 'turn-' + common_1.Direction.Left:
320
334
  this.changeDirection(common_1.Direction.Left);
321
335
  break;
322
- case 'turn-right':
336
+ case 'turn-' + common_1.Direction.Right:
323
337
  this.changeDirection(common_1.Direction.Right);
324
338
  break;
325
- case 'turn-up':
339
+ case 'turn-' + common_1.Direction.Up:
326
340
  this.changeDirection(common_1.Direction.Up);
327
341
  break;
328
- case 'turn-down':
342
+ case 'turn-' + common_1.Direction.Down:
329
343
  this.changeDirection(common_1.Direction.Down);
330
344
  break;
331
345
  }
332
346
  routes.shift();
333
- /*
334
- if (this.constructor['mode'] == EventMode.Scenario) {
335
- const room = World.getRoom(this['map'])
336
- if (room.$detectChanges) room.$detectChanges()
337
- }
338
- */
339
- };
347
+ });
340
348
  move();
341
349
  this.movingInterval = setInterval(move, 16);
342
350
  });