@rpgjs/server 3.0.0-beta.3 → 3.0.0-beta.6

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/Game/Map.d.ts CHANGED
@@ -1,32 +1,109 @@
1
- import { RpgCommonMap } 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
3
  import { EventMode, RpgEvent } from '../Event';
5
4
  import { RpgPlayer } from '../Player/Player';
6
- declare type EventOption = {
5
+ import { RpgServerEngine } from '../server';
6
+ export declare type EventPosOption = {
7
7
  x: number;
8
8
  y: number;
9
+ z?: number;
9
10
  event: EventOptions;
10
- } | EventOptions;
11
+ };
12
+ export declare type EventOption = EventPosOption | EventOptions;
11
13
  export declare class RpgMap extends RpgCommonMap {
12
14
  private _server;
13
15
  _events: EventOption[];
14
- id: any;
16
+ /**
17
+ * @title map id
18
+ * @readonly
19
+ * @prop {string} [id]
20
+ * @memberof Map
21
+ * */
22
+ readonly id: string;
15
23
  file: any;
24
+ /**
25
+ * @title event list
26
+ * @prop { { [eventId: string]: RpgEvent } } [events]
27
+ * @memberof Map
28
+ * */
16
29
  events: {
17
30
  [eventId: string]: RpgEvent;
18
31
  };
19
- kWorld: Kompute;
20
- entityManager: any;
21
- constructor(_server: any);
32
+ constructor(_server: RpgServerEngine);
22
33
  load(): Promise<void>;
23
- get game(): any;
34
+ get game(): RpgCommonGame;
24
35
  onLoad(): void;
25
36
  onJoin(player: RpgPlayer): void;
26
37
  onLeave(player: RpgPlayer): void;
27
38
  autoLoadEvent(): void;
28
- getEventShape(eventName: string): any | null;
29
- createEvent(obj: EventOption, mode: EventMode, shape?: any): RpgEvent | null;
39
+ /**
40
+ * Edit a tile on the map. All players on the map will see the modified tile
41
+ *
42
+ *
43
+ * @title Change Tile in map
44
+ * @since 3.0.0-beta.4
45
+ * @method map.setTile(x,y,layer,tileInfo)
46
+ * @param {number} x Position X
47
+ * @param {number} y Position Y
48
+ * @param {string | ((layer: any) => boolean)} layer Name of the layer where you want to put a tile. OYou can also put a function that will act as a filter. The first parameter is the layer and you return a boolean to indicate if you modify the tile of this layer or not
49
+ * @param {object} tileInfo Object with the following properties:
50
+ * - {number} gid: The tile number in tileset (from 1)
51
+ * - {object} properties Property of the tile. You own object. To set a collision, set the `collision:true` property
52
+ * @example
53
+ * ```ts
54
+ * map.setTile(15, 18, 'mylayer', { gid: 2 })
55
+ * ```
56
+ * @returns {void}
57
+ * @memberof Map
58
+ */
59
+ setTile(x: number, y: number, layerFilter: string | ((layer: any) => boolean), tileInfo: {
60
+ gid: number;
61
+ properties?: object;
62
+ }): any;
63
+ getEventShape(eventName: string): RpgShape | undefined;
64
+ /**
65
+ * Dynamically create an event in Shared mode
66
+ *
67
+ * ```ts
68
+ * @EventData({
69
+ * name: 'EV-1'
70
+ * })
71
+ * class MyEvent extends RpgEvent {
72
+ * onAction() {
73
+ * console.log('ok')
74
+ * }
75
+ * }
76
+ *
77
+ * map.createDynamicEvent({
78
+ * x: 100,
79
+ * y: 100,
80
+ * event: MyEvent
81
+ * })
82
+ * ```
83
+ *
84
+ * You can also put an array of objects to create several events at once
85
+ *
86
+ * @title Create Dynamic Event
87
+ * @since 3.0.0-beta.4
88
+ * @method map.createDynamicEvent(eventObj|eventObj[])
89
+ * @param { { x: number, y: number, z?: number, event: eventClass } } eventsList
90
+ * @returns { { [eventId: string]: RpgEvent } }
91
+ * @memberof Map
92
+ */
93
+ createDynamicEvent(eventsList: EventPosOption | EventPosOption[]): {
94
+ [eventId: string]: RpgEvent;
95
+ };
96
+ /**
97
+ * Removes an event from the map. Returns false if the event is not found
98
+ * @title Remove Event
99
+ * @since 3.0.0-beta.4
100
+ * @method map.removeEvent(eventId)
101
+ * @param {string} eventId Event Name
102
+ * @returns {boolean}
103
+ * @memberof Map
104
+ */
105
+ removeEvent(eventId: string): boolean;
106
+ createEvent(obj: EventPosOption, mode: EventMode, shape?: any): RpgEvent | null;
30
107
  createEvents(eventsList: EventOption[], mode: EventMode): {
31
108
  [eventId: string]: RpgEvent;
32
109
  };
@@ -37,4 +114,3 @@ export interface RpgMap {
37
114
  sounds: string[];
38
115
  $setSchema: (schema: any) => void;
39
116
  }
40
- export {};
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,7 +15,6 @@ 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
18
  const Event_1 = require("../Event");
39
19
  const MoveManager_1 = require("../Player/MoveManager");
40
20
  class AutoEvent extends Event_1.RpgEvent {
@@ -72,27 +52,30 @@ class RpgMap extends common_1.RpgCommonMap {
72
52
  constructor(_server) {
73
53
  super();
74
54
  this._server = _server;
55
+ /**
56
+ * @title event list
57
+ * @prop { { [eventId: string]: RpgEvent } } [events]
58
+ * @memberof Map
59
+ * */
75
60
  this.events = {};
76
- this.entityManager = new YUKA.EntityManager();
77
61
  }
78
62
  load() {
79
63
  const _super = Object.create(null, {
80
64
  load: { get: () => super.load }
81
65
  });
66
+ var _a;
82
67
  return __awaiter(this, void 0, void 0, function* () {
83
68
  if (common_1.RpgCommonMap.buffer.has(this.id)) {
84
69
  return;
85
70
  }
86
71
  const data = yield this.parseFile();
87
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
+ });
88
77
  common_1.RpgCommonMap.buffer.set(this.id, this);
89
- //this.kWorld = new Kompute.World(data.width * data.tileWidth, data.height * data.tileHeight, 1000, 32)
90
- this.events = this.createEvents(this._events, Event_1.EventMode.Shared);
91
- // TODO
92
- // this.autoLoadEvent()
93
- for (let key in this.events) {
94
- this.events[key].execMethod('onInit');
95
- }
78
+ this.createDynamicEvent(this._events);
96
79
  this.onLoad();
97
80
  });
98
81
  }
@@ -101,17 +84,15 @@ class RpgMap extends common_1.RpgCommonMap {
101
84
  }
102
85
  onLoad() { }
103
86
  onJoin(player) {
104
- this.entityManager.add(player.steerable);
105
87
  }
106
88
  onLeave(player) {
107
- player.stopBehavior();
108
- this.entityManager.remove(player.steerable);
109
89
  this.getShapes().forEach(shape => shape.out(player));
110
- const events = this.game.world.getObjectsOfGroup(this.id, player);
90
+ const events = Object.values(this.game.world.getObjectsOfGroup(this.id, player));
111
91
  for (let event of events) {
112
92
  player.getShapes().forEach(shape => shape.out(event));
113
93
  event.getShapes().forEach(shape => shape.out(player));
114
94
  }
95
+ this.grid.clearObjectInCells(player.id);
115
96
  }
116
97
  autoLoadEvent() {
117
98
  this.getShapes().forEach(shape => {
@@ -135,28 +116,112 @@ class RpgMap extends common_1.RpgCommonMap {
135
116
  }
136
117
  });
137
118
  }
119
+ /**
120
+ * Edit a tile on the map. All players on the map will see the modified tile
121
+ *
122
+ *
123
+ * @title Change Tile in map
124
+ * @since 3.0.0-beta.4
125
+ * @method map.setTile(x,y,layer,tileInfo)
126
+ * @param {number} x Position X
127
+ * @param {number} y Position Y
128
+ * @param {string | ((layer: any) => boolean)} layer Name of the layer where you want to put a tile. OYou can also put a function that will act as a filter. The first parameter is the layer and you return a boolean to indicate if you modify the tile of this layer or not
129
+ * @param {object} tileInfo Object with the following properties:
130
+ * - {number} gid: The tile number in tileset (from 1)
131
+ * - {object} properties Property of the tile. You own object. To set a collision, set the `collision:true` property
132
+ * @example
133
+ * ```ts
134
+ * map.setTile(15, 18, 'mylayer', { gid: 2 })
135
+ * ```
136
+ * @returns {void}
137
+ * @memberof Map
138
+ */
139
+ setTile(x, y, layerFilter, tileInfo) {
140
+ const tiles = super.setTile(x, y, layerFilter, tileInfo);
141
+ const players = Object.values(this['users']);
142
+ for (let player of players) {
143
+ player.emit('changeTile', tiles);
144
+ }
145
+ return tiles;
146
+ }
138
147
  // TODO: return type
139
148
  getEventShape(eventName) {
140
149
  return this.getShapes().find(shape => shape.name == eventName);
141
150
  }
151
+ /**
152
+ * Dynamically create an event in Shared mode
153
+ *
154
+ * ```ts
155
+ * @EventData({
156
+ * name: 'EV-1'
157
+ * })
158
+ * class MyEvent extends RpgEvent {
159
+ * onAction() {
160
+ * console.log('ok')
161
+ * }
162
+ * }
163
+ *
164
+ * map.createDynamicEvent({
165
+ * x: 100,
166
+ * y: 100,
167
+ * event: MyEvent
168
+ * })
169
+ * ```
170
+ *
171
+ * You can also put an array of objects to create several events at once
172
+ *
173
+ * @title Create Dynamic Event
174
+ * @since 3.0.0-beta.4
175
+ * @method map.createDynamicEvent(eventObj|eventObj[])
176
+ * @param { { x: number, y: number, z?: number, event: eventClass } } eventsList
177
+ * @returns { { [eventId: string]: RpgEvent } }
178
+ * @memberof Map
179
+ */
180
+ createDynamicEvent(eventsList) {
181
+ if (!eventsList)
182
+ return {};
183
+ if (!common_1.Utils.isArray(eventsList)) {
184
+ eventsList = [eventsList];
185
+ }
186
+ const events = this.createEvents(eventsList, Event_1.EventMode.Shared);
187
+ for (let key in events) {
188
+ this.events[key] = events[key];
189
+ this.events[key].execMethod('onInit');
190
+ }
191
+ return events;
192
+ }
193
+ /**
194
+ * Removes an event from the map. Returns false if the event is not found
195
+ * @title Remove Event
196
+ * @since 3.0.0-beta.4
197
+ * @method map.removeEvent(eventId)
198
+ * @param {string} eventId Event Name
199
+ * @returns {boolean}
200
+ * @memberof Map
201
+ */
202
+ removeEvent(eventId) {
203
+ if (!this.events[eventId])
204
+ return false;
205
+ delete this.events[eventId];
206
+ return true;
207
+ }
142
208
  createEvent(obj, mode, shape) {
143
209
  let event, position;
144
210
  // We retrieve the information of the event ([Event] or [{event: Event, x: number, y: number}])
145
- if (obj['x'] === undefined) {
211
+ if (obj.x === undefined) {
146
212
  event = obj;
147
213
  }
148
214
  else {
149
- event = obj['event'];
150
- position = { x: obj['x'], y: obj['y'] };
215
+ event = obj.event;
216
+ position = { x: obj.x, y: obj.y, z: 0 };
151
217
  }
152
218
  // The event is ignored if the mode is different.
153
219
  if (event.mode != mode) {
154
220
  return null;
155
221
  }
156
222
  // Create an instance of RpgEvent and assign its options
157
- const ev = this.game.addEvent(event, mode == Event_1.EventMode.Shared);
223
+ const ev = this.game.addEvent(event);
158
224
  const _shape = shape || this.getEventShape(ev.name);
159
- this.entityManager.add(ev.steerable);
160
225
  ev.width = event.width || this.tileWidth;
161
226
  ev.height = event.height || this.tileHeight;
162
227
  if (_shape && _shape.properties)
@@ -1 +1 @@
1
- {"version":3,"file":"Map.js","sourceRoot":"","sources":["../../src/Game/Map.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAoD;AAEpD,4CAAmB;AACnB,2CAA4B;AAE5B,oCAA8C;AAC9C,uDAA4C;AAS5C,MAAM,SAAU,SAAQ,gBAAQ;IAI5B,MAAM;QACF,MAAM,EAAE,O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- 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,WAAsB,EAAE,KAAU;QAO1C,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,EAAE;YACxB,MAAM,MAAM,GAAG,EAAE,CAAA;YACjB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;gBACjC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;YACF,uBACI,CAAC,aAAG,CAAC,EAAE,MAAM,CAAC,GAAG,EACjB,CAAC,cAAI,CAAC,EAAE,MAAM,CAAC,IAAI,EACnB,CAAC,cAAI,CAAC,EAAE,MAAM,CAAC,IAAI,IAChB,MAAM,EACZ;QACL,CAAC,CAAA;QACD,IAAI,MAAM,GAAG,CAAC,EAAE,EAAE,CAAA;QAClB,IAAI,QAAQ,GAAG,KAAK,CAAA;QACpB,IAAI,KAAK,GAAG,KAAK,CAAA;QACjB,IAAI,UAAU,GAAG,KAAK,CAAA;QACtB,IAAI,iBAAiB,GAAG,KAAK,CAAA;QAC7B,MAAM,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAA;QACpC,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;QAC7B,IAAI,KAAK,EAAE;YACP,EAAE,GA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C,KAAK,CAAC,EAAE;YAC9B,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAA;YACpC,IAAI,EAAE,EAAE;gBACJ,IAAI,SAAS,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;gBAC1C,IAAI,MAAM,IAAI,SAAS,EAAE;oBACrB,KAAK,GAAG,IAAI,CAAA;iBACf;gBACD,MAAM,GAAG,SAAS,CAAA;aACrB;SACJ;QACD,IAAI,IAAI,CAAC,SAAS,CAAC,iBAAM,CAAC,WAAW,CAAC,EAAE;YACpC,MAAM,IAAI,CAAC,CAAA;SACd;QACD,IAAI,CAAC,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"}
@@ -93,7 +93,7 @@ export declare class ElementManager extends ItemFixture {
93
93
  * @readonly
94
94
  * @memberof ElementManager
95
95
  * */
96
- get elements(): unknown[];
96
+ get elements(): any[];
97
97
  coefficientElements(otherPlayer: RpgPlayer): number;
98
98
  }
99
99
  export interface ElementManager {
@@ -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,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U;QAC/B,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAClB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;SAC1B;IACL,CAAC;IAEO,YAAY,CAAC,OAAgC,EAAE,OAAgB;QACnE,IAAI,CAAC,cAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACzB,OAAO,GAAG,CAAC,OAAO,CAAgB,CAAA;SACrC;QACD,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACrB,OAAO,EAAG,OAAuB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1D,OAAO;SACV,CAAC,CAAA;IACN,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;SAqBK;IACL,eAAe,CAAC,OAAiC;QAC7C,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
  }