@rpgjs/server 4.0.0-beta.8 → 4.0.0-rc.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.
Files changed (79) hide show
  1. package/lib/Game/Map.d.ts +10 -1
  2. package/lib/Game/Map.js +38 -4
  3. package/lib/Game/Map.js.map +1 -1
  4. package/lib/Gui/DialogGui.js +2 -2
  5. package/lib/Gui/MenuGui.js +3 -3
  6. package/lib/Gui/MenuGui.js.map +1 -1
  7. package/lib/Gui/NotificationGui.js +1 -1
  8. package/lib/Gui/ShopGui.js +1 -1
  9. package/lib/Gui/index.js +5 -5
  10. package/lib/Player/BattleManager.d.ts +5 -5
  11. package/lib/Player/BattleManager.js +12 -11
  12. package/lib/Player/BattleManager.js.map +1 -1
  13. package/lib/Player/ClassManager.d.ts +11 -4
  14. package/lib/Player/ClassManager.js +9 -5
  15. package/lib/Player/ClassManager.js.map +1 -1
  16. package/lib/Player/EffectManager.d.ts +2 -2
  17. package/lib/Player/EffectManager.js +7 -7
  18. package/lib/Player/EffectManager.js.map +1 -1
  19. package/lib/Player/ElementManager.d.ts +4 -1
  20. package/lib/Player/ElementManager.js +1 -1
  21. package/lib/Player/ElementManager.js.map +1 -1
  22. package/lib/Player/GuiManager.js +1 -1
  23. package/lib/Player/ItemManager.d.ts +21 -0
  24. package/lib/Player/ItemManager.js +27 -6
  25. package/lib/Player/ItemManager.js.map +1 -1
  26. package/lib/Player/MoveManager.js +27 -14
  27. package/lib/Player/MoveManager.js.map +1 -1
  28. package/lib/Player/ParameterManager.d.ts +2 -1
  29. package/lib/Player/ParameterManager.js +16 -5
  30. package/lib/Player/ParameterManager.js.map +1 -1
  31. package/lib/Player/Player.d.ts +13 -5
  32. package/lib/Player/Player.js +56 -19
  33. package/lib/Player/Player.js.map +1 -1
  34. package/lib/Player/SkillManager.d.ts +13 -8
  35. package/lib/Player/SkillManager.js +19 -12
  36. package/lib/Player/SkillManager.js.map +1 -1
  37. package/lib/Player/StateManager.d.ts +11 -6
  38. package/lib/Player/StateManager.js +23 -8
  39. package/lib/Player/StateManager.js.map +1 -1
  40. package/lib/RpgServer.d.ts +42 -2
  41. package/lib/Scenes/Map.d.ts +2 -0
  42. package/lib/Scenes/Map.js +7 -4
  43. package/lib/Scenes/Map.js.map +1 -1
  44. package/lib/decorators/event.js +1 -1
  45. package/lib/decorators/map.js +1 -1
  46. package/lib/entry-point.js +2 -2
  47. package/lib/express/api.js +3 -3
  48. package/lib/express/server.js +8 -4
  49. package/lib/express/server.js.map +1 -1
  50. package/lib/index.d.ts +1 -0
  51. package/lib/index.js +15 -14
  52. package/lib/index.js.map +1 -1
  53. package/lib/logs/index.js +4 -4
  54. package/lib/logs/item.js +1 -1
  55. package/lib/logs/skill.js +1 -1
  56. package/lib/logs/state.js +1 -1
  57. package/lib/models/Item.d.ts +1 -1
  58. package/lib/server.d.ts +2 -5
  59. package/lib/server.js +12 -11
  60. package/lib/server.js.map +1 -1
  61. package/package.json +9 -8
  62. package/src/Game/Map.ts +37 -4
  63. package/src/Gui/MenuGui.ts +3 -3
  64. package/src/Player/BattleManager.ts +10 -9
  65. package/src/Player/ClassManager.ts +13 -7
  66. package/src/Player/EffectManager.ts +6 -5
  67. package/src/Player/ElementManager.ts +4 -1
  68. package/src/Player/ItemManager.ts +47 -26
  69. package/src/Player/MoveManager.ts +35 -15
  70. package/src/Player/ParameterManager.ts +18 -7
  71. package/src/Player/Player.ts +44 -5
  72. package/src/Player/SkillManager.ts +23 -14
  73. package/src/Player/StateManager.ts +30 -11
  74. package/src/RpgServer.ts +42 -2
  75. package/src/Scenes/Map.ts +3 -0
  76. package/src/express/server.ts +9 -3
  77. package/src/index.ts +8 -7
  78. package/src/models/Item.ts +1 -1
  79. package/src/server.ts +10 -7
package/lib/server.js CHANGED
@@ -4,10 +4,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { SceneMap } from './Scenes/Map.js';
8
- import { RpgPlayer } from './Player/Player.js';
9
- import { Query } from './Query.js';
10
- import { DAMAGE_SKILL, DAMAGE_PHYSIC, DAMAGE_CRITICAL, COEFFICIENT_ELEMENTS } from './presets/index.js';
7
+ import { SceneMap } from './Scenes/Map';
8
+ import { RpgPlayer } from './Player/Player';
9
+ import { Query } from './Query';
10
+ import { DAMAGE_SKILL, DAMAGE_PHYSIC, DAMAGE_CRITICAL, COEFFICIENT_ELEMENTS } from './presets';
11
11
  import { World } from 'simple-room';
12
12
  import { Utils, RpgPlugin, Scheduler, HookServer, DefaultInput } from '@rpgjs/common';
13
13
  import { Actor, Armor, Class, Item, Skill, State, Weapon } from '@rpgjs/database';
@@ -335,6 +335,9 @@ export class RpgServerEngine {
335
335
  get sceneMap() {
336
336
  return this.getScene(SceneMap.id);
337
337
  }
338
+ get module() {
339
+ return RpgPlugin;
340
+ }
338
341
  sendToPlayer(currentPlayer, eventName, data) {
339
342
  currentPlayer._socket.emit(eventName, data);
340
343
  }
@@ -356,7 +359,7 @@ export class RpgServerEngine {
356
359
  }
357
360
  });
358
361
  socket.on('disconnect', () => {
359
- this.onPlayerDisconnected(socket.id, playerId);
362
+ this.onPlayerDisconnected(playerId);
360
363
  });
361
364
  this.world.setUser(player, socket);
362
365
  player.server = this;
@@ -373,15 +376,13 @@ export class RpgServerEngine {
373
376
  RpgPlugin.emit(HookServer.ScalabilityPlayerConnected, player);
374
377
  }
375
378
  }
376
- /**
377
- *
378
- * @param {string} socketId - The socketId of the player that disconnected
379
- * @param {string} playerId - The playerId of the player that disconnected
380
- */
381
- onPlayerDisconnected(socketId, playerId) {
379
+ onPlayerDisconnected(playerId) {
382
380
  const player = World.getUser(playerId);
383
381
  player.execMethod('onDisconnected');
384
382
  this.world.disconnectUser(playerId);
385
383
  }
384
+ stop() {
385
+ this.scheduler.stop();
386
+ }
386
387
  }
387
388
  //# sourceMappingURL=server.js.map
package/lib/server.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAC9F,OAAO,EAAE,KAAK,EAAc,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAiB,YAAY,EAAE,MAAM,eAAe,CAAA;AAGpG,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAiB,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEjG,MAAM,OAAO,eAAe;IAgDxB;;;;;OAKG;IACH,YAAmB,EAAE,EAAS,UAAyB,EAAS,YAAY;QAAzD,OAAE,GAAF,EAAE,CAAA;QAAS,eAAU,GAAV,UAAU,CAAe;QAAS,iBAAY,GAAZ,YAAY,CAAA;QA5C5E;;;;;WAKG;QACI,aAAQ,GAAQ,EAAE,CAAA;QAEzB;;;;;;aAMK;QACE,iBAAY,GAAQ,EAAE,CAAA;QAEtB,eAAU,GAAW,QAAQ,CAAA;QAEpC;;;;;WAKG;QACI,mBAAc,GAAQ,EAAE,CAAA;QAExB,aAAQ,GAAW,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,KAAK,CAAC,WAAW,EAAE,CAAA;QAE9D,WAAM,GAAqB,IAAI,GAAG,EAAE,CAAA;QAClC,mBAAc,GAAW,CAAC,CAAA;QAC5B,cAAS,GAAc,IAAI,SAAS,EAAE,CAA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0-beta.8",
3
+ "version": "4.0.0-rc.1",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
- "types": "./lib/express/index.d.ts",
6
+ "types": "./lib/index.d.ts",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -26,21 +26,22 @@
26
26
  "author": "Samuel Ronce",
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
- "@rpgjs/common": "^4.0.0-beta.8",
30
- "@rpgjs/database": "^4.0.0-beta.8",
31
- "@rpgjs/tiled": "^4.0.0-beta.8",
32
- "@rpgjs/types": "^4.0.0-beta.8",
29
+ "@rpgjs/common": "^4.0.0-rc.1",
30
+ "@rpgjs/database": "^4.0.0-rc.1",
31
+ "@rpgjs/tiled": "^4.0.0-rc.1",
32
+ "@rpgjs/types": "^4.0.0-rc.1",
33
33
  "axios": "^1.3.6",
34
+ "cors": "^2.8.5",
34
35
  "express": "^4.18.2",
35
36
  "lodash.merge": "^4.6.2",
36
37
  "pathfinding": "^0.4.18",
37
38
  "pretty-error": "^4.0.0",
38
39
  "rxjs": "7.8.0",
39
40
  "sat": "^0.9.0",
40
- "simple-room": "^2.0.4",
41
+ "simple-room": "^2.3.1",
41
42
  "socket.io": "^4.6.1"
42
43
  },
43
- "gitHead": "0041f92ace39bfad245b79bab0969aa115715556",
44
+ "gitHead": "11ef47d2e4c982de49aa6c155ab43bf4695d142e",
44
45
  "devDependencies": {
45
46
  "typescript": "^5.0.4"
46
47
  },
package/src/Game/Map.ts CHANGED
@@ -6,7 +6,7 @@ import { Move } from '../Player/MoveManager'
6
6
  import { RpgServerEngine } from '../server'
7
7
  import { Observable } from 'rxjs'
8
8
  import path from 'path'
9
- import { HitBox, MovingHitbox, Position } from '@rpgjs/types'
9
+ import { HitBox, MovingHitbox, PlayerType, Position } from '@rpgjs/types'
10
10
  import { World } from 'simple-room'
11
11
 
12
12
  export type EventPosOption = {
@@ -237,7 +237,16 @@ export class RpgMap extends RpgCommonMap {
237
237
  this.removeObject(player)
238
238
  }
239
239
 
240
- private loadCommonEvents(commonEvents: RpgClassEvent<RpgEvent>[]) {
240
+ /**
241
+ * Loads common events onto the game map.
242
+ *
243
+ * @private
244
+ * @param {RpgClassEvent<RpgEvent>[]} commonEvents - An array of common events to load.
245
+ * @param {RpgPlayer} [player] - The player instance on which to create the dynamic events. If not provided, the function will use the current instance.
246
+ * @returns {void}
247
+ */
248
+ // @internal
249
+ loadCommonEvents(commonEvents: RpgClassEvent<RpgEvent>[], player?: RpgPlayer) {
241
250
  let events: EventPosOption[] = []
242
251
  this.getShapes().forEach(shape => {
243
252
  const findEvent = commonEvents.find(event => event._name == shape.name)
@@ -248,8 +257,14 @@ export class RpgMap extends RpgCommonMap {
248
257
  y,
249
258
  event: findEvent
250
259
  })
251
- })
252
- this.createDynamicEvent(events)
260
+ });
261
+ if (player) {
262
+ player.createDynamicEvent(events, false)
263
+ }
264
+ else {
265
+ this.createDynamicEvent(events)
266
+ }
267
+
253
268
  }
254
269
 
255
270
  // TODO
@@ -372,6 +387,22 @@ export class RpgMap extends RpgCommonMap {
372
387
  return this.events[eventId] as T
373
388
  }
374
389
 
390
+ /**
391
+ * Get Event in current map by name
392
+ * @title Get Event By Name
393
+ * @since 4.0.0
394
+ * @method map.getEventByName(eventName)
395
+ * @param {string} eventName Event Name
396
+ * @returns {RpgEvent | undefined}
397
+ * @memberof Map
398
+ */
399
+ getEventByName<T extends RpgEvent>(eventName: string): T | undefined {
400
+ const events = Object.keys(this.events)
401
+ const key = events.find(key => this.events[key].name == eventName)
402
+ if (!key) return
403
+ return this.events[key] as T
404
+ }
405
+
375
406
  /**
376
407
  * Removes an event from the map. Returns false if the event is not found
377
408
  * @title Remove Event
@@ -442,6 +473,8 @@ export class RpgMap extends RpgCommonMap {
442
473
  }
443
474
  object._destroy$.next()
444
475
  object._destroy$.complete()
476
+ // force RXJS, close subject. TODO: avoid this
477
+ if (object.type != PlayerType.Player) object._destroy$['_closed'] = true
445
478
  this.grid.clearObjectInCells(object.id)
446
479
  for (let playerId in this.players) {
447
480
  if (object.id == playerId) continue
@@ -11,11 +11,11 @@ export class MenuGui extends Gui implements IGui {
11
11
  open() {
12
12
  this.on('useItem', (id) => {
13
13
  try {
14
- // this.player.useItem(id)
14
+ this.player.useItem(id)
15
15
  this.player.syncChanges()
16
16
  }
17
- catch (err) {
18
- console.log(err)
17
+ catch (err: any) {
18
+ this.player.showNotification(err.msg)
19
19
  }
20
20
  })
21
21
  return super.open('', {
@@ -18,30 +18,30 @@ const {
18
18
  export class BattleManager {
19
19
 
20
20
  /**
21
- * Apply damage. Player will lose HP. the `otherPlayer` parameter is the other player, the one who attacks.
21
+ * Apply damage. Player will lose HP. the `attackerPlayer` parameter is the other player, the one who attacks.
22
22
  *
23
23
  * If you don't set the skill parameter, it will be a physical attack.
24
24
  * The attack formula is already defined but you can customize it in the server options
25
25
  *
26
26
  * ```ts
27
- * player.applyDamage(otherPlayer) // returns { damage: number }
27
+ * player.applyDamage(attackerPlayer) // returns { damage: number }
28
28
  * ```
29
29
  *
30
30
  * @title Apply Damage
31
- * @method player.applyDamage(otherPlayer,skill)
32
- * @param {RpgPlayer} otherPlayer The attacking player
31
+ * @method player.applyDamage(attackerPlayer,skill)
32
+ * @param {RpgPlayer} attackerPlayer The attacking player
33
33
  * @param {any} [skill]
34
34
  * @returns {object}
35
35
  * @memberof BattleManager
36
36
  * */
37
- applyDamage(otherPlayer: RpgPlayer, skill?: any): {
37
+ applyDamage(attackerPlayer: RpgPlayer, skill?: any): {
38
38
  damage: number,
39
39
  critical: boolean,
40
40
  elementVulnerable: boolean,
41
41
  guard: boolean,
42
42
  superGuard: boolean
43
43
  } {
44
- const getParam = (player) => {
44
+ const getParam = (player: RpgPlayer) => {
45
45
  const params = {}
46
46
  this.parameters.forEach((val, key) => {
47
47
  params[key] = player.param[key]
@@ -58,8 +58,8 @@ export class BattleManager {
58
58
  let guard = false
59
59
  let superGuard = false
60
60
  let elementVulnerable = false
61
- const paramA = getParam(otherPlayer)
62
- const paramB = getParam(this)
61
+ const paramA = getParam(attackerPlayer)
62
+ const paramB = getParam(<any>this)
63
63
  if (skill) {
64
64
  fn = this.getFormulas('damageSkill')
65
65
  if (!fn) {
@@ -73,7 +73,7 @@ export class BattleManager {
73
73
  throw new Error('Physic Formulas not exists')
74
74
  }
75
75
  damage = fn(paramA, paramB)
76
- const coef = this.coefficientElements(otherPlayer)
76
+ const coef = this.coefficientElements(attackerPlayer)
77
77
  if (coef >= 2) {
78
78
  elementVulnerable = true
79
79
  }
@@ -99,6 +99,7 @@ export class BattleManager {
99
99
  }
100
100
  if (this.hasEffect(Effect.SUPER_GUARD)) {
101
101
  damage /= 4
102
+ superGuard = true
102
103
  }
103
104
  this.hp -= damage
104
105
  return {
@@ -3,9 +3,13 @@ import { ParameterManager } from './ParameterManager'
3
3
  import { ItemManager } from './ItemManager'
4
4
 
5
5
  const {
6
- applyMixins
6
+ applyMixins,
7
+ isString
7
8
  } = Utils
8
9
 
10
+ type ClassClass = { new(...args: any[]) }
11
+ type ActorClass = { new(...args: any[]) }
12
+
9
13
  export class ClassManager {
10
14
 
11
15
  _class: any
@@ -21,12 +25,13 @@ export class ClassManager {
21
25
  *
22
26
  * @title Set Class
23
27
  * @method player.setClass(ClassClass)
24
- * @param {ClassClass} class
28
+ * @param {ClassClass} class class or id
25
29
  * @returns {instance of ClassClass}
26
30
  * @memberof ClassManager
27
31
  * */
28
- setClass(_class) {
29
- this._class = new _class()
32
+ setClass(_class: ClassClass | string) {
33
+ if (isString(_class)) _class = this.databaseById(_class)
34
+ this._class = new (_class as ClassClass)()
30
35
  this['execMethod']('onSet', [this], this._class)
31
36
  return this._class
32
37
  }
@@ -42,12 +47,13 @@ export class ClassManager {
42
47
  *
43
48
  * @title Set Actor
44
49
  * @method player.setActor(ActorClass)
45
- * @param {ActorClass} actorClass
50
+ * @param {ActorClass} actorClass actor class or id
46
51
  * @returns {instance of ActorClass}
47
52
  * @memberof ClassManager
48
53
  * */
49
- setActor(actorClass) {
50
- const actor = new actorClass()
54
+ setActor(actorClass: ActorClass | string) {
55
+ if (isString(actorClass)) actorClass = this.databaseById(actorClass)
56
+ const actor = new (actorClass as ActorClass)()
51
57
  this.name = actor.name
52
58
  this.initialLevel = actor.initialLevel
53
59
  this.finalLevel = actor.finalLevel
@@ -4,6 +4,7 @@ import { ParameterManager } from './ParameterManager'
4
4
 
5
5
  import {
6
6
  MAXHP,
7
+ MAXSP
7
8
  } from '../presets'
8
9
 
9
10
  const {
@@ -22,19 +23,19 @@ export class EffectManager {
22
23
  this.hp += item.hpValue
23
24
  }
24
25
  if (item.hpRate) {
25
- this.hp += this.param[MAXHP] / item.hpRate
26
+ this.hp += this.param[MAXHP] * item.hpRate
26
27
  }
27
28
  if (item.spValue) {
28
- this.sp += item.hpValue
29
+ this.sp += item.spValue
29
30
  }
30
31
  if (item.spRate) {
31
- this.sp += this.param[MAXHP] / item.hpRate
32
+ this.sp += this.param[MAXSP] * item.spRate
32
33
  }
33
34
  }
34
35
 
35
36
  /**
36
37
  * ```ts
37
- * import { Effect } from '@rpgjs/server'
38
+ * import { Effect } from '@rpgjs/database'
38
39
  *
39
40
  * const bool = player.hasEffect(Effect.CAN_NOT_SKILL)
40
41
  * ```
@@ -75,7 +76,7 @@ export class EffectManager {
75
76
  * Assigns effects to the player. If you give a array, it does not change the effects of the player's states and armor/weapons equipped.
76
77
  *
77
78
  * ```ts
78
- * import { Effect } from '@rpgjs/server'
79
+ * import { Effect } from '@rpgjs/database'
79
80
  *
80
81
  * player.effects = [Effect.CAN_NOT_SKILL]
81
82
  * ```
@@ -101,7 +101,10 @@ export class ElementManager extends ItemFixture {
101
101
  * @readonly
102
102
  * @memberof ElementManager
103
103
  * */
104
- get elements() {
104
+ get elements(): {
105
+ rate: number,
106
+ element: string
107
+ }[] {
105
108
  let elements: any = []
106
109
  for (let item of this.equipments) {
107
110
  if (item.elements) {
@@ -1,4 +1,4 @@
1
- import { Utils } from '@rpgjs/common'
1
+ import { Utils } from '@rpgjs/common'
2
2
  import { Effect, ItemOptions } from '@rpgjs/database'
3
3
  import { ItemLog } from '../logs'
4
4
  import { ItemModel } from '../models/Item'
@@ -6,43 +6,43 @@ import { EffectManager } from './EffectManager'
6
6
  import { GoldManager } from './GoldManager'
7
7
  import { StateManager } from './StateManager'
8
8
 
9
- import {
9
+ import {
10
10
  ATK,
11
11
  PDEF,
12
12
  SDEF
13
13
  } from '../presets'
14
14
 
15
- const {
16
- isString,
15
+ const {
16
+ isString,
17
17
  isInstanceOf,
18
18
  applyMixins
19
19
  } = Utils
20
20
 
21
21
  type ItemClass = { new(...args: any[]), price?: number, _type?: string }
22
- type Inventory = { nb: number, item: ItemModel }
22
+ type Inventory = { nb: number, item: ItemModel }
23
23
 
24
24
  export class ItemManager {
25
25
 
26
26
  items: Inventory[]
27
27
  equipments: ItemModel[] = []
28
-
29
- /**
30
- * Retrieves the information of an object: the number and the instance
31
- * @title Get Item
32
- * @method player.getItem(itemClass)
33
- * @param {ItemClass | string} itemClass Identifier of the object if the parameter is a string
34
- * @returns {{ nb: number, item: instance of ItemClass }}
35
- * @memberof ItemManager
36
- * @example
37
- *
38
- * ```ts
39
- * import Potion from 'your-database/potion'
40
- *
41
- * player.addItem(Potion, 5)
42
- * const inventory = player.getItem(Potion)
43
- * console.log(inventory) // { nb: 5, item: <instance of Potion> }
44
- * ```
45
- */
28
+
29
+ /**
30
+ * Retrieves the information of an object: the number and the instance
31
+ * @title Get Item
32
+ * @method player.getItem(itemClass)
33
+ * @param {ItemClass | string} itemClass Identifier of the object if the parameter is a string
34
+ * @returns {{ nb: number, item: instance of ItemClass }}
35
+ * @memberof ItemManager
36
+ * @example
37
+ *
38
+ * ```ts
39
+ * import Potion from 'your-database/potion'
40
+ *
41
+ * player.addItem(Potion, 5)
42
+ * const inventory = player.getItem(Potion)
43
+ * console.log(inventory) // { nb: 5, item: <instance of Potion> }
44
+ * ```
45
+ */
46
46
  getItem(itemClass: ItemClass | string): Inventory {
47
47
  const index: number = this._getItemIndex(itemClass)
48
48
  return this.items[index]
@@ -281,9 +281,9 @@ export class ItemManager {
281
281
  this.gold += (ItemClass.price / 2) * nbToSell
282
282
  this.removeItem(ItemClass, nbToSell)
283
283
  return inventory
284
- }
284
+ }
285
285
 
286
- private getParamItem(name) {
286
+ private getParamItem(name: string): number {
287
287
  let nb = 0
288
288
  for (let item of this.equipments) {
289
289
  nb += item[name] || 0
@@ -296,14 +296,35 @@ export class ItemManager {
296
296
  return nb
297
297
  }
298
298
 
299
+ /**
300
+ * recover the attack sum of items equipped on the player.
301
+ *
302
+ * @title Get the player's attack
303
+ * @prop {number} player.atk
304
+ * @memberof ItemManager
305
+ */
299
306
  get atk(): number {
300
307
  return this.getParamItem(ATK)
301
308
  }
302
309
 
310
+ /**
311
+ * recover the physic defense sum of items equipped on the player.
312
+ *
313
+ * @title Get the player's pdef
314
+ * @prop {number} player.pdef
315
+ * @memberof ItemManager
316
+ */
303
317
  get pdef(): number {
304
318
  return this.getParamItem(PDEF)
305
319
  }
306
320
 
321
+ /**
322
+ * recover the skill defense sum of items equipped on the player.
323
+ *
324
+ * @title Get the player's sdef
325
+ * @prop {number} player.sdef
326
+ * @memberof ItemManager
327
+ */
307
328
  get sdef(): number {
308
329
  return this.getParamItem(SDEF)
309
330
  }
@@ -381,7 +402,7 @@ export class ItemManager {
381
402
  if (item.consumable === false) {
382
403
  throw ItemLog.notUseItem(itemClass)
383
404
  }
384
- const hitRate = item.hitRate || 1
405
+ const hitRate = item.hitRate ?? 1
385
406
  if (Math.random() > hitRate) {
386
407
  this.removeItem(itemClass)
387
408
  this['execMethod']('onUseFailed', [this], item)
@@ -1,7 +1,7 @@
1
1
  import { Direction, LiteralDirection, RpgShape, Vector2d } from '@rpgjs/common'
2
2
  import { Utils } from '@rpgjs/common'
3
3
  import { Behavior, ClientMode, MoveMode, MoveTo, PositionXY, SocketEvents, SocketMethods, Tick } from '@rpgjs/types'
4
- import { Observable, Subscription, takeUntil, Subject } from 'rxjs'
4
+ import { Observable, Subscription, takeUntil, Subject, tap, switchMap, of, from, debounceTime } from 'rxjs'
5
5
  import { RpgServerEngine } from '../server'
6
6
  import { RpgEvent, RpgPlayer } from './Player'
7
7
 
@@ -444,20 +444,28 @@ export class MoveManager {
444
444
  this._finishRoute = resolve
445
445
  routes = routes.map((route: any) => {
446
446
  if (isFunction(route)) {
447
- return route(this, this.getCurrentMap())
447
+ const map = this.getCurrentMap()
448
+ if (!map) {
449
+ return undefined
450
+ }
451
+ return route(this, map)
448
452
  }
449
453
  return route
450
454
  })
451
455
  routes = arrayFlat(routes)
452
- const move = () => {
456
+ const move = (): Observable<any> => {
453
457
  // If movement continues while the player no longer exists or is no longer on the map
454
458
  if (!this) {
455
- return
459
+ return of(null)
460
+ }
461
+ // if map not exists
462
+ if (!this.getCurrentMap()) {
463
+ return of(null)
456
464
  }
457
465
  if (count >= this['nbPixelInTile']) {
458
466
  if (frequence < this.frequency) {
459
467
  frequence++
460
- return
468
+ return of(null)
461
469
  }
462
470
  }
463
471
 
@@ -468,37 +476,49 @@ export class MoveManager {
468
476
 
469
477
  if (route === undefined) {
470
478
  this.breakRoutes()
471
- return
479
+ return of(null)
472
480
  }
473
481
 
482
+ let ob$ = new Observable()
483
+
474
484
  switch (route) {
475
485
  case Direction.Left:
476
486
  case Direction.Down:
477
487
  case Direction.Right:
478
488
  case Direction.Up:
479
- this.moveByDirection(route, 1)
489
+ ob$ = from(this.moveByDirection(route, 1))
480
490
  break
481
491
  case 'turn-' + Direction.Left:
482
- this.changeDirection(Direction.Left)
492
+ ob$ = of(this.changeDirection(Direction.Left))
483
493
  break
484
494
  case 'turn-' + Direction.Right:
485
- this.changeDirection(Direction.Right)
495
+ ob$ = of(this.changeDirection(Direction.Right))
486
496
  break
487
497
  case 'turn-' + Direction.Up:
488
- this.changeDirection(Direction.Up)
498
+ ob$ = of(this.changeDirection(Direction.Up))
489
499
  break
490
500
  case 'turn-' + Direction.Down:
491
- this.changeDirection(Direction.Down)
501
+ ob$ = of(this.changeDirection(Direction.Down))
492
502
  break
493
503
  }
494
504
 
495
- routes.shift()
505
+ return ob$.pipe(
506
+ tap(() => {
507
+ routes.shift()
508
+ })
509
+ )
496
510
  }
497
511
  this.movingSubscription = this.server.tick
498
512
  .pipe(
499
- takeUntil(this._destroy$)
513
+ takeUntil(
514
+ this._destroy$.pipe(
515
+ tap(() => {
516
+ this.breakRoutes(true)
517
+ })
518
+ )),
519
+ switchMap(move)
500
520
  )
501
- .subscribe(move)
521
+ .subscribe()
502
522
  })
503
523
  }
504
524
 
@@ -550,7 +570,7 @@ export class MoveManager {
550
570
  */
551
571
  breakRoutes(force: boolean = false): void {
552
572
  if (this._finishRoute) {
553
- this.movingSubscription.unsubscribe()
573
+ this.movingSubscription?.unsubscribe()
554
574
  this._finishRoute(force)
555
575
  }
556
576
  }