@reldens/skills 0.5.0-beta.6 → 0.10.0-beta.22

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.
@@ -18,8 +18,8 @@ class Receiver
18
18
  if(typeof props.owner.getPosition !== 'function'){
19
19
  ErrorManager.error('Undefined owner position method.');
20
20
  }
21
- this.actions = sc.hasOwn(props, 'actions') ? props.actions : {};
22
- if(!sc.hasOwn(props, 'avoidDefaults') || !props.avoidDefaults){
21
+ this.actions = sc.getDef(props, 'actions', {});
22
+ if(!sc.hasOwn(props, 'avoidDefaults') || !props['avoidDefaults']){
23
23
  this.setDefaultMethods();
24
24
  }
25
25
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  *
3
- * Reldens - Skills - DataServerSetter
3
+ * Reldens - Skills - DataServerValidator
4
4
  *
5
5
  */
6
6
 
@@ -4,9 +4,9 @@
4
4
  *
5
5
  */
6
6
 
7
- const { ErrorManager } = require('@reldens/utils');
8
7
  const SkillsConst = require('../constants');
9
8
  const SkillsEvents = require('../skills-events');
9
+ const { ErrorManager } = require('@reldens/utils');
10
10
 
11
11
  class Sender
12
12
  {
@@ -19,21 +19,25 @@ class ModelsManager
19
19
  this.events = (props && sc.hasOwn(props, 'events')) ? props.events : EventsManagerSingleton;
20
20
  }
21
21
 
22
+ getEntity(entityName)
23
+ {
24
+ return this.dataServer.entityManager.get(entityName);
25
+ }
26
+
22
27
  async loadOwnerClassPath(ownerId)
23
28
  {
24
- return this.dataServer.entityManager.get('ownersClassPath')
25
- .loadOneByWithRelations('owner_id', ownerId, '[owner_full_class_path]');
29
+ return this.getEntity('ownersClassPath').loadOneByWithRelations('owner_id', ownerId, '[owner_full_class_path]');
26
30
  }
27
31
 
28
32
  async updateLevel(levelsSet)
29
33
  {
30
- return this.dataServer.entityManager.get('ownersClassClassPath')
34
+ return this.getEntity('ownersClassClassPath')
31
35
  .updateBy('owner_id', levelsSet.getOwnerId(), {currentLevel: levelsSet.currentLevel})
32
36
  }
33
37
 
34
38
  async updateExperience(levelsSet)
35
39
  {
36
- return this.dataServer.entityManager.get('ownersClassClassPath')
40
+ return this.getEntity('ownersClassClassPath')
37
41
  .updateBy('owner_id', levelsSet.getOwnerId(), {currentExp: levelsSet.currentExp})
38
42
  }
39
43
 
@@ -44,7 +48,7 @@ class ModelsManager
44
48
  // @TODO - BETA - Replace relations by constants on the registered-entities definition.
45
49
  // This way we will be able to use the get method, save the entity in a variable and call the relations
46
50
  // list from it.
47
- let skillsModels = await this.dataServer.entityManager.get('skill').loadAllWithRelations([
51
+ let skillsModels = await this.getEntity('skill').loadAllWithRelations([
48
52
  'skill_owner_conditions',
49
53
  'skill_owner_effects',
50
54
  'skill_target_effects'
@@ -69,7 +73,7 @@ class ModelsManager
69
73
  async prepareClassPathInstancesList(classPathClasses)
70
74
  {
71
75
  let result = {};
72
- let classPathModels = await this.dataServer.entityManager.get('classPath').executeCustomQuery('fullPathData');
76
+ let classPathModels = await this.getEntity('classPath').executeCustomQuery('fullPathData');
73
77
  if(sc.isArray(classPathModels) && classPathModels.length){
74
78
  let classPathsById = {};
75
79
  let classPathsByKey = {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reldens/skills",
3
3
  "scope": "@reldens",
4
- "version": "0.5.0-beta.6",
4
+ "version": "0.10.0-beta.22",
5
5
  "description": "Reldens - Skills",
6
6
  "author": "Damian A. Pastorini",
7
7
  "license": "MIT",
@@ -40,8 +40,8 @@
40
40
  "url": "https://github.com/damian-pastorini/reldens-skills/issues"
41
41
  },
42
42
  "dependencies": {
43
- "@reldens/modifiers": "^0.4.7",
44
- "@reldens/storage": "^0.5.0-beta.12",
45
- "@reldens/utils": "^0.4.6"
43
+ "@reldens/modifiers": "^0.5.0",
44
+ "@reldens/storage": "^0.10.0-beta.22",
45
+ "@reldens/utils": "^0.5.0"
46
46
  }
47
47
  }