@reldens/skills 0.10.0-beta.32 → 0.11.0
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/README.md +2 -2
- package/lib/server/data-server-validator.js +30 -30
- package/lib/server/storage/models/mikro-orm/class-path-level-labels-model.js +86 -0
- package/lib/server/storage/models/mikro-orm/class-path-level-skills-model.js +98 -0
- package/lib/server/storage/models/mikro-orm/class-path-model.js +105 -0
- package/lib/server/storage/models/mikro-orm/level-model.js +88 -0
- package/lib/server/storage/models/mikro-orm/level-modifiers-model.js +119 -0
- package/lib/server/storage/models/mikro-orm/levels-set-model.js +79 -0
- package/lib/server/storage/models/mikro-orm/owners-class-path-model.js +79 -0
- package/lib/server/storage/models/mikro-orm/registered-models-mikro-orm.js +39 -0
- package/lib/server/storage/models/mikro-orm/skill-attack-model.js +156 -0
- package/lib/server/storage/models/mikro-orm/skill-group-relation-model.js +82 -0
- package/lib/server/storage/models/mikro-orm/skill-model.js +236 -0
- package/lib/server/storage/models/mikro-orm/skill-owner-conditions-model.js +83 -0
- package/lib/server/storage/models/mikro-orm/skill-owner-effects-model.js +119 -0
- package/lib/server/storage/models/mikro-orm/skill-physical-data-model.js +83 -0
- package/lib/server/storage/models/mikro-orm/skill-target-effects-model.js +125 -0
- package/lib/server/storage/models/mikro-orm/skills-groups-model.js +77 -0
- package/lib/server/storage/models/objection-js/level-model.js +3 -3
- package/lib/server/storage/models/objection-js/level-modifiers-model.js +3 -3
- package/lib/server/storage/models/objection-js/registered-models-objection-js.js +4 -4
- package/lib/server/storage/models/objection-js/{skill-attack.js → skill-attack-model.js} +0 -0
- package/lib/server/storage/models/objection-js/{skill-group-relation.js → skill-group-relation-model.js} +0 -0
- package/lib/server/storage/models/objection-js/skill-model.js +2 -2
- package/lib/server/storage/models/objection-js/skills-groups-model.js +2 -2
- package/lib/server/storage/models-manager.js +13 -13
- package/migrations/production/reldens-skills-install.sql +125 -123
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
# Reldens - Skills
|
|
4
4
|
|
|
5
5
|
## About
|
|
6
|
-
The idea behind this package is to provide a skills and experience systems so you can relate these to a target owner.
|
|
7
|
-
Note, though it is an opined implementation it provides a lot of flexibility and it could be implemented on any project.
|
|
6
|
+
The idea behind this package is to provide a skills and experience systems, so you can relate these to a target owner.
|
|
7
|
+
Note, though it is an opined implementation it provides a lot of flexibility, and it could be implemented on any project.
|
|
8
8
|
The package base features can be used in both server or client side, but we additionally provide some server specific
|
|
9
9
|
functions like storage models, SQL scripts for installation, sender and receiver support for communication between
|
|
10
10
|
the server and the client.
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Reldens - Skills - DataServerValidator
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const { ErrorManager, sc } = require('@reldens/utils');
|
|
8
|
-
|
|
9
|
-
class DataServerValidator
|
|
10
|
-
{
|
|
11
|
-
|
|
12
|
-
static getValidDataServer(props)
|
|
13
|
-
{
|
|
14
|
-
// @TODO - BETA - When moving to ES or TS dataServer will be typed and an interface.
|
|
15
|
-
let dataServer = sc.get(props, 'dataServer', false);
|
|
16
|
-
if(false === dataServer){
|
|
17
|
-
ErrorManager.error('Data Server instance not found.', props);
|
|
18
|
-
}
|
|
19
|
-
if('function' !== typeof dataServer.connect || 'function' !== typeof dataServer.generateEntities){
|
|
20
|
-
ErrorManager.error(
|
|
21
|
-
'Data Server property found but the instance required methods are not available.',
|
|
22
|
-
dataServer
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
return dataServer;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
module.exports.DataServerValidator = DataServerValidator;
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Reldens - Skills - DataServerValidator
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { ErrorManager, sc } = require('@reldens/utils');
|
|
8
|
+
|
|
9
|
+
class DataServerValidator
|
|
10
|
+
{
|
|
11
|
+
|
|
12
|
+
static getValidDataServer(props)
|
|
13
|
+
{
|
|
14
|
+
// @TODO - BETA - When moving to ES or TS dataServer will be typed and an interface.
|
|
15
|
+
let dataServer = sc.get(props, 'dataServer', false);
|
|
16
|
+
if(false === dataServer){
|
|
17
|
+
ErrorManager.error('Data Server instance not found.', props);
|
|
18
|
+
}
|
|
19
|
+
if('function' !== typeof dataServer.connect || 'function' !== typeof dataServer.generateEntities){
|
|
20
|
+
ErrorManager.error(
|
|
21
|
+
'Data Server property found but the instance required methods are not available.',
|
|
22
|
+
dataServer
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
return dataServer;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports.DataServerValidator = DataServerValidator;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Reldens - Skills - ClassPathLevelLabelsModel
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { MikroOrmCore } = require('@reldens/storage');
|
|
8
|
+
const { EntitySchema } = MikroOrmCore;
|
|
9
|
+
|
|
10
|
+
class ClassPathLevelLabelsModel
|
|
11
|
+
{
|
|
12
|
+
|
|
13
|
+
beforeDestroyCalled = 0;
|
|
14
|
+
afterDestroyCalled = 0;
|
|
15
|
+
|
|
16
|
+
constructor(class_path_id, level_id, label)
|
|
17
|
+
{
|
|
18
|
+
this.class_path_id = class_path_id;
|
|
19
|
+
this.level_id = level_id;
|
|
20
|
+
this.label = label;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static createByProps(props)
|
|
24
|
+
{
|
|
25
|
+
const {class_path_id, level_id, label} = props;
|
|
26
|
+
return new this(class_path_id, level_id, label);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static relationMappings()
|
|
30
|
+
{
|
|
31
|
+
return {
|
|
32
|
+
class_path: {
|
|
33
|
+
type: 'ClassPathModel',
|
|
34
|
+
entityName: 'classPath',
|
|
35
|
+
reference: 'm:1',
|
|
36
|
+
join: {
|
|
37
|
+
from: 'class_path_id',
|
|
38
|
+
to: 'id'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
label_level: {
|
|
42
|
+
type: 'LevelModel',
|
|
43
|
+
entityName: 'level',
|
|
44
|
+
reference: 'm:1',
|
|
45
|
+
join: {
|
|
46
|
+
from: 'level_id',
|
|
47
|
+
to: 'id'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const schema = new EntitySchema({
|
|
56
|
+
class: ClassPathLevelLabelsModel,
|
|
57
|
+
properties: {
|
|
58
|
+
_id: {
|
|
59
|
+
primary: true,
|
|
60
|
+
type: 'ObjectID'
|
|
61
|
+
},
|
|
62
|
+
id: {
|
|
63
|
+
type: 'string',
|
|
64
|
+
serializedPrimaryKey: true
|
|
65
|
+
},
|
|
66
|
+
class_path_id: {
|
|
67
|
+
type: 'ClassPathModel',
|
|
68
|
+
reference: 'm:1',
|
|
69
|
+
nullable: true
|
|
70
|
+
},
|
|
71
|
+
level_id: {
|
|
72
|
+
type: 'LevelModel',
|
|
73
|
+
reference: 'm:1',
|
|
74
|
+
nullable: true
|
|
75
|
+
},
|
|
76
|
+
label: {
|
|
77
|
+
type: 'string'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
module.exports = {
|
|
83
|
+
ClassPathLevelLabelsModel,
|
|
84
|
+
entity: ClassPathLevelLabelsModel,
|
|
85
|
+
schema
|
|
86
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Reldens - Skills - ClassPathLevelSkillsModel
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { MikroOrmCore } = require('@reldens/storage');
|
|
8
|
+
const { EntitySchema } = MikroOrmCore;
|
|
9
|
+
|
|
10
|
+
class ClassPathLevelSkillsModel
|
|
11
|
+
{
|
|
12
|
+
|
|
13
|
+
beforeDestroyCalled = 0;
|
|
14
|
+
afterDestroyCalled = 0;
|
|
15
|
+
|
|
16
|
+
constructor(class_path_id, level_id, skill_id)
|
|
17
|
+
{
|
|
18
|
+
this.class_path_id = class_path_id;
|
|
19
|
+
this.level_id = level_id;
|
|
20
|
+
this.skill_id = skill_id;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static createByProps(props)
|
|
24
|
+
{
|
|
25
|
+
const {class_path_id, level_id, skill_id} = props;
|
|
26
|
+
return new this(class_path_id, level_id, skill_id);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static relationMappings()
|
|
30
|
+
{
|
|
31
|
+
return {
|
|
32
|
+
class_path: {
|
|
33
|
+
type: 'ClassPathModel',
|
|
34
|
+
entityName: 'classPath',
|
|
35
|
+
reference: 'm:1',
|
|
36
|
+
join: {
|
|
37
|
+
from: 'class_path_id',
|
|
38
|
+
to: 'id'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
class_path_level: {
|
|
42
|
+
type: 'LevelModel',
|
|
43
|
+
entityName: 'level',
|
|
44
|
+
reference: 'm:1',
|
|
45
|
+
join: {
|
|
46
|
+
from: 'level_id',
|
|
47
|
+
to: 'id'
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
class_path_level_skill: {
|
|
51
|
+
type: 'LevelModel',
|
|
52
|
+
entityName: 'level',
|
|
53
|
+
reference: 'm:1',
|
|
54
|
+
join: {
|
|
55
|
+
from: 'level_id',
|
|
56
|
+
to: 'id'
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const schema = new EntitySchema({
|
|
65
|
+
class: ClassPathLevelSkillsModel,
|
|
66
|
+
properties: {
|
|
67
|
+
_id: {
|
|
68
|
+
primary: true,
|
|
69
|
+
type: 'ObjectID'
|
|
70
|
+
},
|
|
71
|
+
id: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
serializedPrimaryKey: true
|
|
74
|
+
},
|
|
75
|
+
class_path_id: {
|
|
76
|
+
type: 'ClassPathModel',
|
|
77
|
+
reference: 'm:1',
|
|
78
|
+
nullable: true
|
|
79
|
+
},
|
|
80
|
+
level_id: {
|
|
81
|
+
type: 'LevelModel',
|
|
82
|
+
reference: 'm:1',
|
|
83
|
+
nullable: true
|
|
84
|
+
},
|
|
85
|
+
skill_id: {
|
|
86
|
+
type: 'SkillModel',
|
|
87
|
+
reference: 'm:1',
|
|
88
|
+
nullable: true
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
module.exports = {
|
|
95
|
+
ClassPathLevelSkillsModel,
|
|
96
|
+
entity: ClassPathLevelSkillsModel,
|
|
97
|
+
schema
|
|
98
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Reldens - Skills - ClassPathModel
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
const { MikroOrmCore } = require('@reldens/storage');
|
|
7
|
+
const { EntitySchema } = MikroOrmCore;
|
|
8
|
+
|
|
9
|
+
class ClassPathModel
|
|
10
|
+
{
|
|
11
|
+
|
|
12
|
+
beforeDestroyCalled = 0;
|
|
13
|
+
afterDestroyCalled = 0;
|
|
14
|
+
|
|
15
|
+
constructor(key, label, levels_set_id)
|
|
16
|
+
{
|
|
17
|
+
this.key = key;
|
|
18
|
+
this.label = label;
|
|
19
|
+
this.levels_set_id = levels_set_id;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static createByProps(props)
|
|
23
|
+
{
|
|
24
|
+
const {key, label, levels_set_id} = props;
|
|
25
|
+
return new this(key, label, levels_set_id);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static relationMappings()
|
|
29
|
+
{
|
|
30
|
+
return {
|
|
31
|
+
skills_levels_set: {
|
|
32
|
+
type: 'LevelsSetModel',
|
|
33
|
+
entityName: 'levelsSet',
|
|
34
|
+
reference: 'm:1',
|
|
35
|
+
join: {
|
|
36
|
+
from: 'levels_set_id',
|
|
37
|
+
to: 'id'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
skills_class_path_level_labels: {
|
|
41
|
+
type: 'ClassPathLevelLabelsModel',
|
|
42
|
+
entityName: 'classPathLevelLabels',
|
|
43
|
+
reference: '1:m',
|
|
44
|
+
join: {
|
|
45
|
+
from: 'id',
|
|
46
|
+
to: 'class_path_id'
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
skills_class_path_level_skills: {
|
|
50
|
+
type: 'ClassPathLevelSkillsModel',
|
|
51
|
+
entityName: 'classPathLevelSkills',
|
|
52
|
+
reference: '1:m',
|
|
53
|
+
join: {
|
|
54
|
+
from: 'id',
|
|
55
|
+
to: 'class_path_id'
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
class_path_for_owner: {
|
|
59
|
+
type: 'OwnersClassPathModel',
|
|
60
|
+
entityName: 'ownersClassPath',
|
|
61
|
+
reference: '1:m',
|
|
62
|
+
join: {
|
|
63
|
+
from: 'id',
|
|
64
|
+
to: 'class_path_id'
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const schema = new EntitySchema({
|
|
73
|
+
class: ClassPathModel,
|
|
74
|
+
properties: {
|
|
75
|
+
_id: {
|
|
76
|
+
primary: true,
|
|
77
|
+
type: 'ObjectID'
|
|
78
|
+
},
|
|
79
|
+
id: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
serializedPrimaryKey: true
|
|
82
|
+
},
|
|
83
|
+
key: {
|
|
84
|
+
type: 'string'
|
|
85
|
+
},
|
|
86
|
+
label: {
|
|
87
|
+
type: 'string'
|
|
88
|
+
},
|
|
89
|
+
levels_set_id: {
|
|
90
|
+
type: 'LevelsSetModel',
|
|
91
|
+
reference: 'm:1',
|
|
92
|
+
nullable: true
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
module.exports = {
|
|
98
|
+
ClassPathModel,
|
|
99
|
+
entity: ClassPathModel,
|
|
100
|
+
schema,
|
|
101
|
+
fullPathData: async (options = {}, driver) => {
|
|
102
|
+
// @TODO - BETA - Fix, this is un-tested, the fullPathData method will be removed.
|
|
103
|
+
return await driver.loadAllWithRelations();
|
|
104
|
+
}
|
|
105
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Reldens - Skills - LevelModel
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { MikroOrmCore } = require('@reldens/storage');
|
|
8
|
+
const { EntitySchema } = MikroOrmCore;
|
|
9
|
+
|
|
10
|
+
class LevelModel
|
|
11
|
+
{
|
|
12
|
+
|
|
13
|
+
beforeDestroyCalled = 0;
|
|
14
|
+
afterDestroyCalled = 0;
|
|
15
|
+
|
|
16
|
+
constructor(key, label, required_experience, levels_set_id)
|
|
17
|
+
{
|
|
18
|
+
this.key = key;
|
|
19
|
+
this.label = label;
|
|
20
|
+
this.required_experience = required_experience;
|
|
21
|
+
this.levels_set_id = levels_set_id;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static createByProps(props)
|
|
25
|
+
{
|
|
26
|
+
const {key, label, required_experience, levels_set_id} = props;
|
|
27
|
+
return new this(key, label, required_experience, levels_set_id);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static relationMappings()
|
|
31
|
+
{
|
|
32
|
+
return {
|
|
33
|
+
level_set: {
|
|
34
|
+
type: 'LevelsSetModel',
|
|
35
|
+
entityName: 'levelsSet',
|
|
36
|
+
reference: 'm:1',
|
|
37
|
+
join: {
|
|
38
|
+
from: 'level_set_id',
|
|
39
|
+
to: 'id'
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
level_modifiers: {
|
|
43
|
+
type: 'LevelModifiersModel',
|
|
44
|
+
entityName: 'levelModifiers',
|
|
45
|
+
reference: '1:m',
|
|
46
|
+
join: {
|
|
47
|
+
from: 'id',
|
|
48
|
+
to: 'level_id'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const schema = new EntitySchema({
|
|
57
|
+
class: LevelModel,
|
|
58
|
+
properties: {
|
|
59
|
+
_id: {
|
|
60
|
+
primary: true,
|
|
61
|
+
type: 'ObjectID'
|
|
62
|
+
},
|
|
63
|
+
id: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
serializedPrimaryKey: true
|
|
66
|
+
},
|
|
67
|
+
key: {
|
|
68
|
+
type: 'string'
|
|
69
|
+
},
|
|
70
|
+
label: {
|
|
71
|
+
type: 'string'
|
|
72
|
+
},
|
|
73
|
+
required_experience: {
|
|
74
|
+
type: 'number'
|
|
75
|
+
},
|
|
76
|
+
levels_set_id: {
|
|
77
|
+
type: 'LevelsSetModel',
|
|
78
|
+
reference: 'm:1',
|
|
79
|
+
nullable: true
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
module.exports = {
|
|
85
|
+
LevelModel,
|
|
86
|
+
entity: LevelModel,
|
|
87
|
+
schema
|
|
88
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Reldens - Skills - LevelModifiersModel
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { MikroOrmCore } = require('@reldens/storage');
|
|
8
|
+
const { EntitySchema } = MikroOrmCore;
|
|
9
|
+
|
|
10
|
+
class LevelModifiersModel
|
|
11
|
+
{
|
|
12
|
+
|
|
13
|
+
beforeDestroyCalled = 0;
|
|
14
|
+
afterDestroyCalled = 0;
|
|
15
|
+
|
|
16
|
+
constructor(level_id, key, property_key, operation, value, minValue, maxValue, minProperty, maxProperty)
|
|
17
|
+
{
|
|
18
|
+
this.level_id = level_id;
|
|
19
|
+
this.key = key;
|
|
20
|
+
this.property_key = property_key;
|
|
21
|
+
this.operation = operation;
|
|
22
|
+
this.value = value;
|
|
23
|
+
this.minValue = minValue;
|
|
24
|
+
this.maxValue = maxValue;
|
|
25
|
+
this.minProperty = minProperty;
|
|
26
|
+
this.maxProperty = maxProperty;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static createByProps(props)
|
|
30
|
+
{
|
|
31
|
+
const {
|
|
32
|
+
level_id,
|
|
33
|
+
key,
|
|
34
|
+
property_key,
|
|
35
|
+
operation,
|
|
36
|
+
value,
|
|
37
|
+
minValue,
|
|
38
|
+
maxValue,
|
|
39
|
+
minProperty,
|
|
40
|
+
maxProperty
|
|
41
|
+
} = props;
|
|
42
|
+
return new LevelModifiersModel(
|
|
43
|
+
level_id,
|
|
44
|
+
key,
|
|
45
|
+
property_key,
|
|
46
|
+
operation,
|
|
47
|
+
value,
|
|
48
|
+
minValue,
|
|
49
|
+
maxValue,
|
|
50
|
+
minProperty,
|
|
51
|
+
maxProperty
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static relationMappings()
|
|
56
|
+
{
|
|
57
|
+
return {
|
|
58
|
+
level_owner: {
|
|
59
|
+
type: 'LevelModel',
|
|
60
|
+
entityName: 'level',
|
|
61
|
+
reference: 'm:1',
|
|
62
|
+
join: {
|
|
63
|
+
from: 'level_id',
|
|
64
|
+
to: 'id'
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const schema = new EntitySchema({
|
|
73
|
+
class: LevelModifiersModel,
|
|
74
|
+
properties: {
|
|
75
|
+
_id: {
|
|
76
|
+
primary: true,
|
|
77
|
+
type: 'ObjectID'
|
|
78
|
+
},
|
|
79
|
+
id: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
serializedPrimaryKey: true
|
|
82
|
+
},
|
|
83
|
+
level_id: {
|
|
84
|
+
reference: 'm:1',
|
|
85
|
+
type: 'LevelModel',
|
|
86
|
+
nullable: true
|
|
87
|
+
},
|
|
88
|
+
key: {
|
|
89
|
+
type: 'string'
|
|
90
|
+
},
|
|
91
|
+
property_key: {
|
|
92
|
+
type: 'string'
|
|
93
|
+
},
|
|
94
|
+
operation: {
|
|
95
|
+
type: 'number'
|
|
96
|
+
},
|
|
97
|
+
value: {
|
|
98
|
+
type: 'string'
|
|
99
|
+
},
|
|
100
|
+
minValue: {
|
|
101
|
+
type: 'string'
|
|
102
|
+
},
|
|
103
|
+
maxValue: {
|
|
104
|
+
type: 'string'
|
|
105
|
+
},
|
|
106
|
+
minProperty: {
|
|
107
|
+
type: 'string'
|
|
108
|
+
},
|
|
109
|
+
maxProperty: {
|
|
110
|
+
type: 'string'
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
module.exports = {
|
|
116
|
+
LevelModifiersModel,
|
|
117
|
+
entity: LevelModifiersModel,
|
|
118
|
+
schema
|
|
119
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Reldens - Skills - LevelsSetModel
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { MikroOrmCore } = require('@reldens/storage');
|
|
8
|
+
const { EntitySchema } = MikroOrmCore;
|
|
9
|
+
|
|
10
|
+
class LevelsSetModel
|
|
11
|
+
{
|
|
12
|
+
|
|
13
|
+
beforeDestroyCalled = 0;
|
|
14
|
+
afterDestroyCalled = 0;
|
|
15
|
+
|
|
16
|
+
constructor(autoFillRanges, autoFillExperienceMultiplier)
|
|
17
|
+
{
|
|
18
|
+
this.autoFillRanges = autoFillRanges;
|
|
19
|
+
this.autoFillExperienceMultiplier = autoFillExperienceMultiplier;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static createByProps(props)
|
|
23
|
+
{
|
|
24
|
+
const {autoFillRanges, autoFillExperienceMultiplier} = props;
|
|
25
|
+
return new this(autoFillRanges, autoFillExperienceMultiplier);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static relationMappings()
|
|
29
|
+
{
|
|
30
|
+
return {
|
|
31
|
+
class_path_id: {
|
|
32
|
+
type: 'ClassPathModel',
|
|
33
|
+
entityName: 'classPath',
|
|
34
|
+
reference: 'm:1',
|
|
35
|
+
join: {
|
|
36
|
+
from: 'id',
|
|
37
|
+
to: 'levels_set_id'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
skills_levels_set_levels: {
|
|
41
|
+
type: 'LevelModel',
|
|
42
|
+
entityName: 'level',
|
|
43
|
+
reference: '1:m',
|
|
44
|
+
join: {
|
|
45
|
+
from: 'id',
|
|
46
|
+
to: 'level_set_id'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const schema = new EntitySchema({
|
|
55
|
+
class: LevelsSetModel,
|
|
56
|
+
properties: {
|
|
57
|
+
_id: {
|
|
58
|
+
primary: true,
|
|
59
|
+
type: 'ObjectID'
|
|
60
|
+
},
|
|
61
|
+
id: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
serializedPrimaryKey: true
|
|
64
|
+
},
|
|
65
|
+
autoFillRanges: {
|
|
66
|
+
type: 'boolean',
|
|
67
|
+
isRequired: true
|
|
68
|
+
},
|
|
69
|
+
autoFillExperienceMultiplier: {
|
|
70
|
+
type: 'boolean'
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
module.exports = {
|
|
76
|
+
LevelsSetModel,
|
|
77
|
+
entity: LevelsSetModel,
|
|
78
|
+
schema
|
|
79
|
+
};
|