@reldens/skills 0.35.0 → 0.37.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 CHANGED
@@ -3,17 +3,25 @@
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.
8
- The package base features can be used in both server or client side, but we additionally provide some server specific
9
- functions like storage models, SQL scripts for installation, sender and receiver support for communication between
10
- the server and the client.
6
+ The idea behind this package is to provide a comprehensive skills and experience system that can be attached to any target owner.
7
+ This opinionated yet flexible implementation includes class paths, leveling systems, skill trees, and experience management with full event-driven architecture.
8
+
9
+ The package offers both client and server-side functionality, including automatic level progression, skill validation, damage calculations, physical attacks, effects system, and complete database integration.
11
10
 
12
11
 
13
12
  ---
14
13
 
15
14
  ## Features
16
15
 
16
+ - **Level Sets & Experience System**: Automatic level progression with configurable experience requirements and level-based modifiers
17
+ - **Class Paths & Skill Trees**: Skill progression with level-dependent skill unlocked and custom labeling
18
+ - **Multiple Skill Types**: Base skills, attacks with damage calculation, effects, physical attacks with collision detection
19
+ - **Combat Mechanics**: Critical hits, dodge calculations, range validation, and damage/defense property systems
20
+ - **Real-time Communication**: Built-in sender/receiver architecture for server-client synchronization
21
+ - **Database Integration**: Complete storage models, migrations, and SQL scripts for persistent data
22
+ - **Event-Driven Architecture**: Comprehensive event system for custom logic integration and multiplayer broadcasting
23
+ - **Modular Design**: Flexible configuration with custom conditions, modifiers, and extensible skill logic
24
+
17
25
  Need something specific?
18
26
 
19
27
  [Request a feature here: https://www.reldens.com/features-request](https://www.reldens.com/features-request)
package/lib/class-path.js CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  const LevelsSet = require('./levels-set');
8
8
  const SkillsEvents = require('./skills-events');
9
- const { ErrorManager, sc } = require('@reldens/utils');
9
+ const { Logger, sc } = require('@reldens/utils');
10
10
 
11
11
  class ClassPath extends LevelsSet
12
12
  {
@@ -15,7 +15,8 @@ class ClassPath extends LevelsSet
15
15
  {
16
16
  await super.init(props);
17
17
  if(!sc.hasOwn(props, 'key')){
18
- ErrorManager.error('Undefined key for class path.');
18
+ Logger.critical('Undefined key for class path.');
19
+ return false;
19
20
  }
20
21
  // key is the code for class-path itself and label y the name that can be used for display:
21
22
  this.key = props.key;
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  const SkillConst = require('../constants');
8
- const { ErrorManager, Logger, sc } = require('@reldens/utils');
8
+ const { Logger, sc } = require('@reldens/utils');
9
9
 
10
10
  class Receiver
11
11
  {
@@ -13,10 +13,12 @@ class Receiver
13
13
  constructor(props)
14
14
  {
15
15
  if(!sc.hasOwn(props, 'owner')){
16
- ErrorManager.error('Undefined owner.');
16
+ Logger.critical('Undefined owner.');
17
+ return false;
17
18
  }
18
19
  if(typeof props.owner.getPosition !== 'function'){
19
- ErrorManager.error('Undefined owner position method.');
20
+ Logger.critical('Undefined owner position method.');
21
+ return false;
20
22
  }
21
23
  this.actions = sc.get(props, 'actions', {});
22
24
  if(!sc.hasOwn(props, 'avoidDefaults') || !props['avoidDefaults']){
package/lib/level.js CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  */
6
6
 
7
- const { ErrorManager, Logger, sc } = require('@reldens/utils');
7
+ const { Logger, sc } = require('@reldens/utils');
8
8
 
9
9
  class Level
10
10
  {
@@ -13,7 +13,8 @@ class Level
13
13
  {
14
14
  // @NOTE: Level.key will be a unique value in the Levels class and the value must be an integer.
15
15
  if(!sc.hasOwn(props, 'key') || isNaN(props.key)){
16
- ErrorManager.error('Invalid Level key.');
16
+ Logger.critical('Invalid Level key.');
17
+ return false;
17
18
  }
18
19
  if(!sc.hasOwn(props, 'modifiers') || 0 >= props.modifiers.length){
19
20
  Logger.warning('Level modifiers were not specified.', 'Level ID:', props.id, ' - Key:', props.key);
package/lib/levels-set.js CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  const SkillsEvents = require('./skills-events');
8
8
  const Level = require('./level');
9
- const { EventsManagerSingleton, ErrorManager, Logger, sc } = require('@reldens/utils');
9
+ const { EventsManagerSingleton, Logger, sc } = require('@reldens/utils');
10
10
 
11
11
  class LevelsSet
12
12
  {
@@ -20,11 +20,13 @@ class LevelsSet
20
20
  setOwner(props)
21
21
  {
22
22
  if(!sc.hasOwn(props, 'owner')){
23
- ErrorManager.error('Undefined owner for levels.');
23
+ Logger.critical('Undefined owner for levels.');
24
+ return false;
24
25
  }
25
26
  // @NOTE: getPosition must return an object with x and y props, like {x: 123, y: 456}.
26
27
  if(typeof props.owner.getPosition !== 'function'){
27
- ErrorManager.error('Undefined owner position method.');
28
+ Logger.critical('Undefined owner position method.');
29
+ return false;
28
30
  }
29
31
  this.owner = props.owner;
30
32
  this.ownerIdProperty = sc.hasOwn(props, 'ownerIdProperty') ? props.ownerIdProperty : 'id';
@@ -33,13 +35,16 @@ class LevelsSet
33
35
  async init(props)
34
36
  {
35
37
  if(!sc.hasOwn(this, 'owner')){
36
- ErrorManager.error('Undefined owner for levels.');
38
+ Logger.critical('Undefined owner for levels.');
39
+ return false;
37
40
  }
38
41
  if(typeof this.owner.getPosition !== 'function'){
39
- ErrorManager.error('Undefined owner position method.');
42
+ Logger.critical('Undefined owner position method.');
43
+ return false;
40
44
  }
41
45
  if(!sc.hasOwn(props, 'levels') || !Object.keys(props.levels).length){
42
- ErrorManager.error('Levels were not specified.');
46
+ Logger.critical('Levels were not specified.');
47
+ return false;
43
48
  }
44
49
  // fireEvent has to be executed after the owner was set since it will call the owner data to relate the events:
45
50
  await this.fireEvent(SkillsEvents.INIT_LEVEL_SET_START, this);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reldens/skills",
3
3
  "scope": "@reldens",
4
- "version": "0.35.0",
4
+ "version": "0.37.0",
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.27.0",
44
- "@reldens/storage": "^0.32.0",
45
- "@reldens/utils": "^0.40.0"
43
+ "@reldens/modifiers": "^0.30.0",
44
+ "@reldens/storage": "^0.64.0",
45
+ "@reldens/utils": "^0.52.0"
46
46
  }
47
47
  }