@rpgjs/server 4.0.0-beta.9 → 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.
- package/lib/Game/Map.d.ts +10 -1
- package/lib/Game/Map.js +38 -4
- package/lib/Game/Map.js.map +1 -1
- package/lib/Gui/DialogGui.js +2 -2
- package/lib/Gui/MenuGui.js +3 -3
- package/lib/Gui/MenuGui.js.map +1 -1
- package/lib/Gui/NotificationGui.js +1 -1
- package/lib/Gui/ShopGui.js +1 -1
- package/lib/Gui/index.js +5 -5
- package/lib/Player/BattleManager.d.ts +5 -5
- package/lib/Player/BattleManager.js +12 -11
- package/lib/Player/BattleManager.js.map +1 -1
- package/lib/Player/ClassManager.d.ts +11 -4
- package/lib/Player/ClassManager.js +9 -5
- package/lib/Player/ClassManager.js.map +1 -1
- package/lib/Player/EffectManager.d.ts +2 -2
- package/lib/Player/EffectManager.js +7 -7
- package/lib/Player/EffectManager.js.map +1 -1
- package/lib/Player/ElementManager.d.ts +4 -1
- package/lib/Player/ElementManager.js +1 -1
- package/lib/Player/ElementManager.js.map +1 -1
- package/lib/Player/GuiManager.js +1 -1
- package/lib/Player/ItemManager.d.ts +21 -0
- package/lib/Player/ItemManager.js +27 -6
- package/lib/Player/ItemManager.js.map +1 -1
- package/lib/Player/MoveManager.js +27 -14
- package/lib/Player/MoveManager.js.map +1 -1
- package/lib/Player/ParameterManager.d.ts +2 -1
- package/lib/Player/ParameterManager.js +16 -5
- package/lib/Player/ParameterManager.js.map +1 -1
- package/lib/Player/Player.d.ts +13 -5
- package/lib/Player/Player.js +56 -19
- package/lib/Player/Player.js.map +1 -1
- package/lib/Player/SkillManager.d.ts +13 -8
- package/lib/Player/SkillManager.js +19 -12
- package/lib/Player/SkillManager.js.map +1 -1
- package/lib/Player/StateManager.d.ts +11 -6
- package/lib/Player/StateManager.js +23 -8
- package/lib/Player/StateManager.js.map +1 -1
- package/lib/RpgServer.d.ts +42 -2
- package/lib/Scenes/Map.d.ts +2 -0
- package/lib/Scenes/Map.js +7 -4
- package/lib/Scenes/Map.js.map +1 -1
- package/lib/decorators/event.js +1 -1
- package/lib/decorators/map.js +1 -1
- package/lib/entry-point.js +2 -2
- package/lib/express/api.js +3 -3
- package/lib/express/server.js +8 -4
- package/lib/express/server.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +15 -14
- package/lib/index.js.map +1 -1
- package/lib/logs/index.js +4 -4
- package/lib/logs/item.js +1 -1
- package/lib/logs/skill.js +1 -1
- package/lib/logs/state.js +1 -1
- package/lib/models/Item.d.ts +1 -1
- package/lib/server.d.ts +2 -5
- package/lib/server.js +12 -11
- package/lib/server.js.map +1 -1
- package/package.json +8 -7
- package/src/Game/Map.ts +37 -4
- package/src/Gui/MenuGui.ts +3 -3
- package/src/Player/BattleManager.ts +10 -9
- package/src/Player/ClassManager.ts +13 -7
- package/src/Player/EffectManager.ts +6 -5
- package/src/Player/ElementManager.ts +4 -1
- package/src/Player/ItemManager.ts +47 -26
- package/src/Player/MoveManager.ts +35 -15
- package/src/Player/ParameterManager.ts +18 -7
- package/src/Player/Player.ts +44 -5
- package/src/Player/SkillManager.ts +23 -14
- package/src/Player/StateManager.ts +30 -11
- package/src/RpgServer.ts +42 -2
- package/src/Scenes/Map.ts +3 -0
- package/src/express/server.ts +9 -3
- package/src/index.ts +8 -7
- package/src/models/Item.ts +1 -1
- package/src/server.ts +10 -7
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Utils } from '@rpgjs/common';
|
|
2
2
|
import { Effect } from '@rpgjs/database';
|
|
3
|
-
import { SkillLog } from '../logs
|
|
4
|
-
import { StateManager } from './StateManager
|
|
5
|
-
import { EffectManager } from './EffectManager
|
|
6
|
-
import { ParameterManager } from './ParameterManager
|
|
7
|
-
import { INT } from '../presets
|
|
3
|
+
import { SkillLog } from '../logs';
|
|
4
|
+
import { StateManager } from './StateManager';
|
|
5
|
+
import { EffectManager } from './EffectManager';
|
|
6
|
+
import { ParameterManager } from './ParameterManager';
|
|
7
|
+
import { INT } from '../presets';
|
|
8
8
|
const { isArray, isString, isInstanceOf, applyMixins } = Utils;
|
|
9
9
|
export class SkillManager {
|
|
10
10
|
_getSkillIndex(skillClass) {
|
|
@@ -12,6 +12,9 @@ export class SkillManager {
|
|
|
12
12
|
if (isString(skill)) {
|
|
13
13
|
return skill.id == skillClass;
|
|
14
14
|
}
|
|
15
|
+
if (isString(skillClass)) {
|
|
16
|
+
return skillClass == skill.id || skill;
|
|
17
|
+
}
|
|
15
18
|
return isInstanceOf(skill, skillClass);
|
|
16
19
|
});
|
|
17
20
|
}
|
|
@@ -25,13 +28,13 @@ export class SkillManager {
|
|
|
25
28
|
*
|
|
26
29
|
* @title Get Skill
|
|
27
30
|
* @method player.getSkill(skillClass)
|
|
28
|
-
* @param {SkillClass} skillClass
|
|
31
|
+
* @param {SkillClass | string} skillClass or data id
|
|
29
32
|
* @returns {instance of SkillClass | null}
|
|
30
33
|
* @memberof SkillManager
|
|
31
34
|
*/
|
|
32
35
|
getSkill(skillClass) {
|
|
33
36
|
const index = this._getSkillIndex(skillClass);
|
|
34
|
-
return this.skills[index];
|
|
37
|
+
return this.skills[index] ?? null;
|
|
35
38
|
}
|
|
36
39
|
/**
|
|
37
40
|
* Learn a skill. Attributes the coefficient 1 to the parameter INT (intelligence) if cd is not present on the class.
|
|
@@ -46,11 +49,13 @@ export class SkillManager {
|
|
|
46
49
|
*
|
|
47
50
|
* @title Learn Skill
|
|
48
51
|
* @method player.learnSkill(skillClass)
|
|
49
|
-
* @param {SkillClass} skillClass
|
|
52
|
+
* @param {SkillClass | string} skillClass or data id
|
|
50
53
|
* @returns {instance of SkillClass}
|
|
51
54
|
* @memberof SkillManager
|
|
52
55
|
*/
|
|
53
56
|
learnSkill(skillClass) {
|
|
57
|
+
if (isString(skillClass))
|
|
58
|
+
skillClass = this.databaseById(skillClass);
|
|
54
59
|
const instance = new skillClass();
|
|
55
60
|
if (!instance.coefficient)
|
|
56
61
|
instance.coefficient = {
|
|
@@ -78,7 +83,7 @@ export class SkillManager {
|
|
|
78
83
|
*
|
|
79
84
|
* @title Forget Skill
|
|
80
85
|
* @method player.learnSkill(skillClass)
|
|
81
|
-
* @param {SkillClass} skillClass
|
|
86
|
+
* @param {SkillClass | string} skillClass or data id
|
|
82
87
|
* @throws {SkillLog} notLearned
|
|
83
88
|
* If trying to forget a skill not learned
|
|
84
89
|
* ```
|
|
@@ -91,12 +96,14 @@ export class SkillManager {
|
|
|
91
96
|
* @memberof SkillManager
|
|
92
97
|
*/
|
|
93
98
|
forgetSkill(skillClass) {
|
|
99
|
+
if (isString(skillClass))
|
|
100
|
+
skillClass = this.databaseById(skillClass);
|
|
94
101
|
const index = this._getSkillIndex(skillClass);
|
|
95
102
|
if (index == -1) {
|
|
96
103
|
throw SkillLog.notLearned(skillClass);
|
|
97
104
|
}
|
|
98
|
-
this.skills.splice(index, 1);
|
|
99
105
|
const instance = this.skills[index];
|
|
106
|
+
this.skills.splice(index, 1);
|
|
100
107
|
this['execMethod']('onForget', [this], instance);
|
|
101
108
|
return instance;
|
|
102
109
|
}
|
|
@@ -134,7 +141,7 @@ export class SkillManager {
|
|
|
134
141
|
*
|
|
135
142
|
* @title Use Skill
|
|
136
143
|
* @method player.useSkill(skillClass,otherPlayer)
|
|
137
|
-
* @param {SkillClass} skillClass
|
|
144
|
+
* @param {SkillClass | string} skillClass or data id
|
|
138
145
|
* @param {Array<RpgPlayer> | RpgPlayer} [otherPlayer]
|
|
139
146
|
* @throws {SkillLog} restriction
|
|
140
147
|
* If the player has the `Effect.CAN_NOT_SKILL` effect
|
|
@@ -187,7 +194,7 @@ export class SkillManager {
|
|
|
187
194
|
throw SkillLog.notEnoughSp(skillClass, skill.spCost, this.sp);
|
|
188
195
|
}
|
|
189
196
|
this.sp -= (skill.spCost / (this.hasEffect(Effect.HALF_SP_COST) ? 2 : 1));
|
|
190
|
-
const hitRate = skill.hitRate
|
|
197
|
+
const hitRate = skill.hitRate ?? 1;
|
|
191
198
|
if (Math.random() > hitRate) {
|
|
192
199
|
this['execMethod']('onUseFailed', [this, otherPlayer], skill);
|
|
193
200
|
throw SkillLog.chanceToUseFailed(skillClass);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkillManager.js","sourceRoot":"","sources":["../../src/Player/SkillManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAO,eAAe,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EACH,GAAG,EACN,MAAM,YAAY,CAAA;AAEnB,MAAM,EACF,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,WAAW,EACd,GAAG,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"SkillManager.js","sourceRoot":"","sources":["../../src/Player/SkillManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAO,eAAe,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EACH,GAAG,EACN,MAAM,YAAY,CAAA;AAEnB,MAAM,EACF,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,WAAW,EACd,GAAG,KAAK,CAAA;AAIT,MAAM,OAAO,YAAY;IAIb,cAAc,CAAC,UA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OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,CAAA;QAClC,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,EAAE;YACzB,IAAI,CAAC,YAAY,CAAC,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,CAAA;YAC7D,MAAM,QAAQ,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAA;SAC/C;QACD,IAAI,WAAW,EAAE;YACb,IAAI,OAAO,GAAQ,WAAW,CAAA;YAC9B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gBACnB,OAAO,GAAG,CAAC,WAAW,CAAC,CAAA;aAC1B;YACD,KAAK,IAAI,MAAM,IAAI,OAAO,EAAE;gBACxB,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;gBAC/B,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;aAClC;SACJ;QACD,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,CAAA;QACvD,OAAO,KAAK,CAAA;IAChB,CAAC;CACJ;AAED,WAAW,CAAC,YAAY,EAAE,CAAC,gBAAgB,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC,CAAA"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ItemFixture } from './ItemFixture';
|
|
2
2
|
import { RpgPlayer } from './Player';
|
|
3
|
+
type StateClass = {
|
|
4
|
+
new (...args: any[]): any;
|
|
5
|
+
};
|
|
3
6
|
export declare class StateManager {
|
|
4
7
|
states: any[];
|
|
5
8
|
_statesEfficiency: {
|
|
@@ -102,11 +105,11 @@ export declare class StateManager {
|
|
|
102
105
|
*
|
|
103
106
|
* @title Get State
|
|
104
107
|
* @method player.getState(stateClass)
|
|
105
|
-
* @param {StateClass} stateClass
|
|
108
|
+
* @param {StateClass | string} stateClass or state id
|
|
106
109
|
* @returns {instance of StateClass | null}
|
|
107
110
|
* @memberof StateManager
|
|
108
111
|
*/
|
|
109
|
-
getState(stateClass:
|
|
112
|
+
getState(stateClass: StateClass | string): any;
|
|
110
113
|
/**
|
|
111
114
|
* Adds a state to the player. Set the chance between 0 and 1 that the state can apply
|
|
112
115
|
* ```ts
|
|
@@ -122,7 +125,7 @@ export declare class StateManager {
|
|
|
122
125
|
*
|
|
123
126
|
* @title Add State
|
|
124
127
|
* @method player.addState(stateClass,chance=1)
|
|
125
|
-
* @param {StateClass} stateClass
|
|
128
|
+
* @param {StateClass | string} stateClass state class or state id
|
|
126
129
|
* @param {number} [chance] 1 by default
|
|
127
130
|
* @throws {StateLog} addFailed
|
|
128
131
|
* If the chance to add the state has failed (defined with the `chance` param)
|
|
@@ -136,7 +139,7 @@ export declare class StateManager {
|
|
|
136
139
|
* @memberof StateManager
|
|
137
140
|
* @todo
|
|
138
141
|
*/
|
|
139
|
-
addState(stateClass:
|
|
142
|
+
addState(stateClass: StateClass | string, chance?: number): object | null;
|
|
140
143
|
/**
|
|
141
144
|
* Remove a state to the player. Set the chance between 0 and 1 that the state can be removed
|
|
142
145
|
* ```ts
|
|
@@ -152,7 +155,7 @@ export declare class StateManager {
|
|
|
152
155
|
*
|
|
153
156
|
* @title Remove State
|
|
154
157
|
* @method player.removeState(stateClass,chance=1)
|
|
155
|
-
* @param {StateClass} stateClass
|
|
158
|
+
* @param {StateClass|string} stateClass class state or state id
|
|
156
159
|
* @param {number} [chance] 1 by default
|
|
157
160
|
* @throws {StateLog} removeFailed
|
|
158
161
|
* If the chance to remove the state has failed (defined with the `chance` param)
|
|
@@ -173,8 +176,10 @@ export declare class StateManager {
|
|
|
173
176
|
* @returns {instance of StateClass}
|
|
174
177
|
* @memberof StateManager
|
|
175
178
|
*/
|
|
176
|
-
removeState(stateClass:
|
|
179
|
+
removeState(stateClass: StateClass | string, chance?: number): void;
|
|
177
180
|
private findStateEfficiency;
|
|
178
181
|
}
|
|
179
182
|
export interface StateManager extends ItemFixture {
|
|
183
|
+
databaseById(stateClass: any): any;
|
|
180
184
|
}
|
|
185
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Utils } from '@rpgjs/common';
|
|
2
|
-
import { ItemFixture } from './ItemFixture
|
|
3
|
-
import { StateLog } from '../logs/state
|
|
4
|
-
const { isInstanceOf, applyMixins } = Utils;
|
|
2
|
+
import { ItemFixture } from './ItemFixture';
|
|
3
|
+
import { StateLog } from '../logs/state';
|
|
4
|
+
const { isInstanceOf, applyMixins, isString } = Utils;
|
|
5
5
|
export class StateManager {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.states = [];
|
|
@@ -107,12 +107,19 @@ export class StateManager {
|
|
|
107
107
|
*
|
|
108
108
|
* @title Get State
|
|
109
109
|
* @method player.getState(stateClass)
|
|
110
|
-
* @param {StateClass} stateClass
|
|
110
|
+
* @param {StateClass | string} stateClass or state id
|
|
111
111
|
* @returns {instance of StateClass | null}
|
|
112
112
|
* @memberof StateManager
|
|
113
113
|
*/
|
|
114
114
|
getState(stateClass) {
|
|
115
|
-
|
|
115
|
+
if (isString(stateClass))
|
|
116
|
+
stateClass = this.databaseById(stateClass);
|
|
117
|
+
return this.states.find((state) => {
|
|
118
|
+
if (isString(stateClass)) {
|
|
119
|
+
return state.id == stateClass;
|
|
120
|
+
}
|
|
121
|
+
return isInstanceOf(state, stateClass);
|
|
122
|
+
});
|
|
116
123
|
}
|
|
117
124
|
/**
|
|
118
125
|
* Adds a state to the player. Set the chance between 0 and 1 that the state can apply
|
|
@@ -129,7 +136,7 @@ export class StateManager {
|
|
|
129
136
|
*
|
|
130
137
|
* @title Add State
|
|
131
138
|
* @method player.addState(stateClass,chance=1)
|
|
132
|
-
* @param {StateClass} stateClass
|
|
139
|
+
* @param {StateClass | string} stateClass state class or state id
|
|
133
140
|
* @param {number} [chance] 1 by default
|
|
134
141
|
* @throws {StateLog} addFailed
|
|
135
142
|
* If the chance to add the state has failed (defined with the `chance` param)
|
|
@@ -145,6 +152,9 @@ export class StateManager {
|
|
|
145
152
|
*/
|
|
146
153
|
addState(stateClass, chance = 1) {
|
|
147
154
|
const state = this.getState(stateClass);
|
|
155
|
+
if (isString(stateClass)) {
|
|
156
|
+
stateClass = this.databaseById(stateClass);
|
|
157
|
+
}
|
|
148
158
|
if (!state) {
|
|
149
159
|
if (Math.random() > chance) {
|
|
150
160
|
throw StateLog.addFailed(stateClass);
|
|
@@ -172,7 +182,7 @@ export class StateManager {
|
|
|
172
182
|
*
|
|
173
183
|
* @title Remove State
|
|
174
184
|
* @method player.removeState(stateClass,chance=1)
|
|
175
|
-
* @param {StateClass} stateClass
|
|
185
|
+
* @param {StateClass|string} stateClass class state or state id
|
|
176
186
|
* @param {number} [chance] 1 by default
|
|
177
187
|
* @throws {StateLog} removeFailed
|
|
178
188
|
* If the chance to remove the state has failed (defined with the `chance` param)
|
|
@@ -194,7 +204,12 @@ export class StateManager {
|
|
|
194
204
|
* @memberof StateManager
|
|
195
205
|
*/
|
|
196
206
|
removeState(stateClass, chance = 1) {
|
|
197
|
-
const index = this.states.findIndex(state =>
|
|
207
|
+
const index = this.states.findIndex((state) => {
|
|
208
|
+
if (isString(stateClass)) {
|
|
209
|
+
return state.id == stateClass;
|
|
210
|
+
}
|
|
211
|
+
return isInstanceOf(state, stateClass);
|
|
212
|
+
});
|
|
198
213
|
if (index != -1) {
|
|
199
214
|
if (Math.random() > chance) {
|
|
200
215
|
throw StateLog.removeFailed(stateClass);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateManager.js","sourceRoot":"","sources":["../../src/Player/StateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAO,eAAe,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,EACF,YAAY,EACZ,WAAW,
|
|
1
|
+
{"version":3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A;aAChC;YACD,OAAO,YAAY,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;QAC1C,CAAC,CAAC,CAAA;QACF,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE;YACb,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE;gBACxB,MAAM,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,CAAA;aAC1C;YACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;SAC/B;aACI;YACD,MAAM,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;SACxC;IACL,CAAC;IAEO,mBAAmB,CAAC,UAAU;QAClC,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAA;IACrF,CAAC;CACJ;AAED,WAAW,CAAC,YAAY,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA"}
|
package/lib/RpgServer.d.ts
CHANGED
|
@@ -131,7 +131,6 @@ export interface RpgPlayerHooks {
|
|
|
131
131
|
* When the player increases one level
|
|
132
132
|
*
|
|
133
133
|
* @prop { (player: RpgPlayer, nbLevel: number) => any } [onLevelUp]
|
|
134
|
-
* @stability 1
|
|
135
134
|
* @memberof RpgPlayerHooks
|
|
136
135
|
*/
|
|
137
136
|
onLevelUp?: (player: RpgPlayer, nbLevel: number) => any;
|
|
@@ -139,7 +138,6 @@ export interface RpgPlayerHooks {
|
|
|
139
138
|
* When the player's HP drops to 0
|
|
140
139
|
*
|
|
141
140
|
* @prop { (player: RpgPlayer) => any } [onDead]
|
|
142
|
-
* @stability 1
|
|
143
141
|
* @memberof RpgPlayerHooks
|
|
144
142
|
*/
|
|
145
143
|
onDead?: (player: RpgPlayer) => any;
|
|
@@ -184,6 +182,48 @@ export interface RpgPlayerHooks {
|
|
|
184
182
|
canChangeMap?: (player: RpgPlayer, nextMap: RpgClassMap<RpgMap>) => boolean | Promise<boolean>;
|
|
185
183
|
}
|
|
186
184
|
export interface RpgServer {
|
|
185
|
+
/**
|
|
186
|
+
* Add hooks to the player or engine. All modules can listen to the hook
|
|
187
|
+
*
|
|
188
|
+
* @prop { { player: string[], engine: string[] } } [hooks]
|
|
189
|
+
* @memberof RpgServer
|
|
190
|
+
* @since 4.0.0
|
|
191
|
+
* @stability 1
|
|
192
|
+
* @example
|
|
193
|
+
*
|
|
194
|
+
* ```ts
|
|
195
|
+
* import { RpgServer, RpgModule } from '@rpgjs/server'
|
|
196
|
+
*
|
|
197
|
+
* @RpgModule<RpgServer>({
|
|
198
|
+
* hooks: {
|
|
199
|
+
* player: ['onAuth']
|
|
200
|
+
* }
|
|
201
|
+
* })
|
|
202
|
+
* class RpgServerEngine { }
|
|
203
|
+
* ```
|
|
204
|
+
*
|
|
205
|
+
* Emit the hook:
|
|
206
|
+
*
|
|
207
|
+
* ```ts
|
|
208
|
+
* server.module.emit('server.player.onAuth', player)
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
* And listen to the hook:
|
|
212
|
+
*
|
|
213
|
+
* ```ts
|
|
214
|
+
* import { RpgPlayerHooks, RpgPlayer } from '@rpgjs/server'
|
|
215
|
+
*
|
|
216
|
+
* const player: RpgPlayerHooks = {
|
|
217
|
+
* onAuth(player: RpgPlayer) {
|
|
218
|
+
* console.log('player is authenticated')
|
|
219
|
+
* }
|
|
220
|
+
* }
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
hooks?: {
|
|
224
|
+
player?: string[];
|
|
225
|
+
engine?: string[];
|
|
226
|
+
};
|
|
187
227
|
/**
|
|
188
228
|
* Adding sub-modules
|
|
189
229
|
*
|
package/lib/Scenes/Map.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export declare class SceneMap {
|
|
|
23
23
|
constructor(sceneMapObject: SceneMapObject, server: RpgServerEngine);
|
|
24
24
|
/**
|
|
25
25
|
* Returns an array of RpgClassMap objects that represent maps with static properties.
|
|
26
|
+
*
|
|
27
|
+
* @method sceneMap.getMaps()
|
|
26
28
|
* @returns {RpgClassMap<RpgMap>[]} Array of RpgClassMap objects.
|
|
27
29
|
* @since 4.0.0
|
|
28
30
|
* @example
|
package/lib/Scenes/Map.js
CHANGED
|
@@ -7,10 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { HookServer, RpgCommonMap, RpgPlugin, Utils } from '@rpgjs/common';
|
|
8
8
|
import { World } from 'simple-room';
|
|
9
9
|
import { isTiledFormat } from '@rpgjs/tiled';
|
|
10
|
-
import { MapData } from '../decorators/map
|
|
11
|
-
import { RpgMap } from '../Game/Map
|
|
12
|
-
import { RpgWorldMaps } from '../Game/WorldMaps
|
|
13
|
-
import { RpgPlayer } from '../Player/Player
|
|
10
|
+
import { MapData } from '../decorators/map';
|
|
11
|
+
import { RpgMap } from '../Game/Map';
|
|
12
|
+
import { RpgWorldMaps } from '../Game/WorldMaps';
|
|
13
|
+
import { RpgPlayer } from '../Player/Player';
|
|
14
14
|
class SceneMap {
|
|
15
15
|
constructor(sceneMapObject, server) {
|
|
16
16
|
this.server = server;
|
|
@@ -34,6 +34,8 @@ class SceneMap {
|
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* Returns an array of RpgClassMap objects that represent maps with static properties.
|
|
37
|
+
*
|
|
38
|
+
* @method sceneMap.getMaps()
|
|
37
39
|
* @returns {RpgClassMap<RpgMap>[]} Array of RpgClassMap objects.
|
|
38
40
|
* @since 4.0.0
|
|
39
41
|
* @example
|
|
@@ -254,6 +256,7 @@ class SceneMap {
|
|
|
254
256
|
World.joinRoom(mapId, player.id);
|
|
255
257
|
player = World.getUser(player.id);
|
|
256
258
|
if (player) {
|
|
259
|
+
mapInstance.loadCommonEvents(this.server.inputOptions.events, player);
|
|
257
260
|
player.createDynamicEvent(mapInstance._events, false);
|
|
258
261
|
await player.execMethod('onJoinMap', [mapInstance]);
|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AC,EAAE,CAAC,CAAA;QAEhC,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAc,CAAA;QAE9C,IAAI,MAAM,EAAE;YACR,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;YACrE,MAAM,CAAC,kBAAkB,CAAM,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;YAC1D,MAAM,MAAM,CAAC,UAAU,CAAC,WAAW,EAAO,CAAC,WAAW,CAAC,CAAC,CAAA;SAC3D;QAED,OAAO,WAAW,CAAA;IACtB,CAAC;;AAxRe,WAAE,GAAW,KAAK,AAAhB,CAAgB;SADzB,QAAQ"}
|
package/lib/decorators/event.js
CHANGED
package/lib/decorators/map.js
CHANGED
package/lib/entry-point.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RpgCommonGame, HookServer, loadModules, GameSide, RpgPlugin } from '@rpgjs/common';
|
|
2
|
-
import { RpgServerEngine } from './server
|
|
3
|
-
import { RpgMatchMaker } from './MatchMaker
|
|
2
|
+
import { RpgServerEngine } from './server';
|
|
3
|
+
import { RpgMatchMaker } from './MatchMaker';
|
|
4
4
|
export default async function (modules, options) {
|
|
5
5
|
const gameEngine = new RpgCommonGame(GameSide.Server);
|
|
6
6
|
if (!options.globalConfig)
|
package/lib/express/api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
|
-
import { Query } from '../Query
|
|
3
|
-
import { NotAuthorized } from './errors/NotAuthorized
|
|
4
|
-
import { NotFound } from './errors/NotFound
|
|
2
|
+
import { Query } from '../Query';
|
|
3
|
+
import { NotAuthorized } from './errors/NotAuthorized';
|
|
4
|
+
import { NotFound } from './errors/NotFound';
|
|
5
5
|
export function api(rpgServer) {
|
|
6
6
|
const router = new Router();
|
|
7
7
|
router.use((req, res, next) => {
|
package/lib/express/server.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import http from 'http';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import express from 'express';
|
|
4
|
+
import cors from 'cors';
|
|
4
5
|
import { Server } from 'socket.io';
|
|
5
|
-
import entryPoint from '../entry-point
|
|
6
|
+
import entryPoint from '../entry-point';
|
|
6
7
|
import PrettyError from 'pretty-error';
|
|
7
|
-
import { api } from './api
|
|
8
|
-
import { Query } from '../Query
|
|
8
|
+
import { api } from './api';
|
|
9
|
+
import { Query } from '../Query';
|
|
9
10
|
export function expressServer(modules, options) {
|
|
10
11
|
return new Promise((resolve, reject) => {
|
|
11
12
|
const envs = options.envs || {};
|
|
@@ -34,11 +35,13 @@ export function expressServer(modules, options) {
|
|
|
34
35
|
limit: '50mb'
|
|
35
36
|
}));
|
|
36
37
|
}
|
|
38
|
+
app.use(cors());
|
|
37
39
|
if (staticEnabled) {
|
|
38
40
|
app.use('/', express.static(path.join(dirname, '..', staticDirectory, 'client')));
|
|
39
41
|
}
|
|
42
|
+
let rpgGame;
|
|
40
43
|
async function start() {
|
|
41
|
-
|
|
44
|
+
rpgGame = await entryPoint(modules, { io, ...options });
|
|
42
45
|
rpgGame.app = app;
|
|
43
46
|
rpgGame.start();
|
|
44
47
|
app.use('/api', api(rpgGame));
|
|
@@ -67,6 +70,7 @@ export function expressServer(modules, options) {
|
|
|
67
70
|
Query.getPlayers().forEach(player => {
|
|
68
71
|
player.gameReload();
|
|
69
72
|
});
|
|
73
|
+
rpgGame.stop();
|
|
70
74
|
});
|
|
71
75
|
}
|
|
72
76
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/express/server.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;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C,CAAC;SACN;IACL,CAAC,CAAC,CAAA;AACN,CAAC"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export { default as entryPoint } from './entry-point
|
|
1
|
+
export { default as entryPoint } from './entry-point';
|
|
2
2
|
export { Direction, Input, Control, RpgPlugin, HookServer, HookClient, RpgModule, RpgShape, ShapePositioning, AbstractObject } from '@rpgjs/common';
|
|
3
|
-
export { EventData } from './decorators/event
|
|
4
|
-
export { MapData } from './decorators/map
|
|
5
|
-
export { RpgPlayer, RpgEvent, EventMode } from './Player/Player
|
|
6
|
-
export { RpgMap } from './Game/Map
|
|
7
|
-
export { RpgWorldMaps } from './Game/WorldMaps
|
|
8
|
-
export { Query, Query as RpgWorld } from './Query
|
|
9
|
-
export { default as Monitor } from './Monitor
|
|
10
|
-
export * as Presets from './presets
|
|
11
|
-
export { Move, Frequency, Speed } from './Player/MoveManager
|
|
12
|
-
export { RpgServerEngine } from './server
|
|
13
|
-
export { SceneMap as RpgSceneMap } from './Scenes/Map
|
|
14
|
-
export { RpgMatchMaker } from './MatchMaker
|
|
15
|
-
export { Components } from './Player/ComponentManager
|
|
3
|
+
export { EventData } from './decorators/event';
|
|
4
|
+
export { MapData } from './decorators/map';
|
|
5
|
+
export { RpgPlayer, RpgEvent, EventMode } from './Player/Player';
|
|
6
|
+
export { RpgMap } from './Game/Map';
|
|
7
|
+
export { RpgWorldMaps } from './Game/WorldMaps';
|
|
8
|
+
export { Query, Query as RpgWorld } from './Query';
|
|
9
|
+
export { default as Monitor } from './Monitor';
|
|
10
|
+
export * as Presets from './presets';
|
|
11
|
+
export { Move, Frequency, Speed } from './Player/MoveManager';
|
|
12
|
+
export { RpgServerEngine } from './server';
|
|
13
|
+
export { SceneMap as RpgSceneMap } from './Scenes/Map';
|
|
14
|
+
export { RpgMatchMaker } from './MatchMaker';
|
|
15
|
+
export { Components } from './Player/ComponentManager';
|
|
16
|
+
export { Gui } from './Gui/Gui';
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EACH,SAAS,EACT,KAAK,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACjB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAe,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EACH,SAAS,EACT,KAAK,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACjB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAe,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA"}
|
package/lib/logs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ItemLog } from './item
|
|
2
|
-
import { SkillLog } from './skill
|
|
3
|
-
import { StateLog } from './state
|
|
4
|
-
import { Log } from './log
|
|
1
|
+
import { ItemLog } from './item';
|
|
2
|
+
import { SkillLog } from './skill';
|
|
3
|
+
import { StateLog } from './state';
|
|
4
|
+
import { Log } from './log';
|
|
5
5
|
export { ItemLog, SkillLog, StateLog, Log };
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/lib/logs/item.js
CHANGED
package/lib/logs/skill.js
CHANGED
package/lib/logs/state.js
CHANGED
package/lib/models/Item.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ItemOptions } from '@rpgjs/database';
|
|
2
2
|
import { RpgPlayer } from '../Player/Player';
|
|
3
3
|
export interface ItemModel extends ItemOptions {
|
|
4
|
-
id
|
|
4
|
+
id?: string;
|
|
5
5
|
equipped?: boolean;
|
|
6
6
|
onUseFailed?: (player: RpgPlayer) => {};
|
|
7
7
|
onUse?: (player: RpgPlayer) => {};
|
package/lib/server.d.ts
CHANGED
|
@@ -127,12 +127,9 @@ export declare class RpgServerEngine {
|
|
|
127
127
|
* @memberof RpgServerEngine
|
|
128
128
|
*/
|
|
129
129
|
get sceneMap(): SceneMap;
|
|
130
|
+
get module(): import("@rpgjs/common/lib/Plugin").PluginSystem;
|
|
130
131
|
sendToPlayer(currentPlayer: any, eventName: any, data: any): void;
|
|
131
132
|
private onPlayerConnected;
|
|
132
|
-
/**
|
|
133
|
-
*
|
|
134
|
-
* @param {string} socketId - The socketId of the player that disconnected
|
|
135
|
-
* @param {string} playerId - The playerId of the player that disconnected
|
|
136
|
-
*/
|
|
137
133
|
private onPlayerDisconnected;
|
|
134
|
+
stop(): void;
|
|
138
135
|
}
|