@rpgjs/server 4.3.0 → 5.0.0-alpha.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 → dist}/Gui/DialogGui.d.ts +1 -2
- package/{lib → dist}/Gui/Gui.d.ts +1 -2
- package/dist/Player/BattleManager.d.ts +22 -0
- package/dist/Player/ClassManager.d.ts +18 -0
- package/dist/Player/Event.d.ts +0 -0
- package/dist/Player/ItemManager.d.ts +17 -0
- package/dist/Player/MoveManager.d.ts +177 -0
- package/dist/Player/ParameterManager.d.ts +42 -0
- package/dist/Player/Player.d.ts +73 -0
- package/dist/Player/SkillManager.d.ts +23 -0
- package/dist/Player/StateManager.d.ts +39 -0
- package/{lib → dist}/RpgServer.d.ts +32 -15
- package/dist/RpgServerEngine.d.ts +5 -0
- package/dist/core/context.d.ts +2 -0
- package/dist/core/inject.d.ts +5 -0
- package/dist/core/setup.d.ts +6 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +29673 -0
- package/dist/index.js.map +1 -0
- package/dist/module.d.ts +2 -0
- package/dist/rooms/lobby.d.ts +6 -0
- package/dist/rooms/map.d.ts +110 -0
- package/package.json +15 -37
- package/src/Gui/DialogGui.ts +3 -4
- package/src/Gui/Gui.ts +4 -6
- package/src/Player/BattleManager.ts +108 -99
- package/src/Player/ClassManager.ts +47 -46
- package/src/Player/ComponentManager.ts +26 -535
- package/src/Player/EffectManager.ts +44 -59
- package/src/Player/ElementManager.ts +70 -72
- package/src/Player/Event.ts +0 -0
- package/src/Player/GoldManager.ts +24 -6
- package/src/Player/GuiManager.ts +106 -97
- package/src/Player/ItemFixture.ts +22 -17
- package/src/Player/ItemManager.ts +234 -225
- package/src/Player/MoveManager.ts +1047 -457
- package/src/Player/ParameterManager.ts +59 -37
- package/src/Player/Player.ts +272 -1058
- package/src/Player/SkillManager.ts +146 -137
- package/src/Player/StateManager.ts +124 -98
- package/src/Player/VariableManager.ts +23 -3
- package/src/RpgServer.ts +36 -12
- package/src/RpgServerEngine.ts +7 -0
- package/src/core/context.ts +3 -0
- package/src/core/inject.ts +17 -0
- package/src/core/setup.ts +20 -0
- package/src/index.ts +9 -31
- package/src/module.ts +32 -0
- package/src/presets/index.ts +1 -3
- package/src/rooms/lobby.ts +24 -0
- package/src/rooms/map.ts +311 -0
- package/tsconfig.json +26 -23
- package/vite.config.ts +21 -0
- package/CHANGELOG.md +0 -174
- package/LICENSE +0 -19
- package/browser/manifest.json +0 -7
- package/browser/rpg.server.js +0 -22379
- package/browser/rpg.server.umd.cjs +0 -22410
- package/lib/Game/EventManager.d.ts +0 -54
- package/lib/Game/EventManager.js +0 -107
- package/lib/Game/EventManager.js.map +0 -1
- package/lib/Game/Map.d.ts +0 -191
- package/lib/Game/Map.js +0 -419
- package/lib/Game/Map.js.map +0 -1
- package/lib/Game/WorldMaps.d.ts +0 -17
- package/lib/Game/WorldMaps.js +0 -28
- package/lib/Game/WorldMaps.js.map +0 -1
- package/lib/Gui/DialogGui.js +0 -57
- package/lib/Gui/DialogGui.js.map +0 -1
- package/lib/Gui/Gui.js +0 -37
- package/lib/Gui/Gui.js.map +0 -1
- package/lib/Gui/MenuGui.js +0 -23
- package/lib/Gui/MenuGui.js.map +0 -1
- package/lib/Gui/NotificationGui.js +0 -8
- package/lib/Gui/NotificationGui.js.map +0 -1
- package/lib/Gui/ShopGui.js +0 -40
- package/lib/Gui/ShopGui.js.map +0 -1
- package/lib/Gui/index.js +0 -7
- package/lib/Gui/index.js.map +0 -1
- package/lib/Interfaces/Gui.d.ts +0 -4
- package/lib/Interfaces/Gui.js +0 -2
- package/lib/Interfaces/Gui.js.map +0 -1
- package/lib/Interfaces/StateStore.d.ts +0 -5
- package/lib/Interfaces/StateStore.js +0 -2
- package/lib/Interfaces/StateStore.js.map +0 -1
- package/lib/MatchMaker.d.ts +0 -24
- package/lib/MatchMaker.js +0 -42
- package/lib/MatchMaker.js.map +0 -1
- package/lib/Monitor/index.d.ts +0 -17
- package/lib/Monitor/index.js +0 -72
- package/lib/Monitor/index.js.map +0 -1
- package/lib/Player/BattleManager.d.ts +0 -36
- package/lib/Player/BattleManager.js +0 -101
- package/lib/Player/BattleManager.js.map +0 -1
- package/lib/Player/ClassManager.d.ts +0 -47
- package/lib/Player/ClassManager.js +0 -65
- package/lib/Player/ClassManager.js.map +0 -1
- package/lib/Player/ComponentManager.d.ts +0 -397
- package/lib/Player/ComponentManager.js +0 -505
- package/lib/Player/ComponentManager.js.map +0 -1
- package/lib/Player/EffectManager.d.ts +0 -46
- package/lib/Player/EffectManager.js +0 -75
- package/lib/Player/EffectManager.js.map +0 -1
- package/lib/Player/ElementManager.d.ts +0 -108
- package/lib/Player/ElementManager.js +0 -120
- package/lib/Player/ElementManager.js.map +0 -1
- package/lib/Player/GoldManager.d.ts +0 -17
- package/lib/Player/GoldManager.js +0 -27
- package/lib/Player/GoldManager.js.map +0 -1
- package/lib/Player/GuiManager.d.ts +0 -247
- package/lib/Player/GuiManager.js +0 -291
- package/lib/Player/GuiManager.js.map +0 -1
- package/lib/Player/ItemFixture.d.ts +0 -7
- package/lib/Player/ItemFixture.js +0 -19
- package/lib/Player/ItemFixture.js.map +0 -1
- package/lib/Player/ItemManager.d.ts +0 -331
- package/lib/Player/ItemManager.js +0 -475
- package/lib/Player/ItemManager.js.map +0 -1
- package/lib/Player/MoveManager.d.ts +0 -333
- package/lib/Player/MoveManager.js +0 -450
- package/lib/Player/MoveManager.js.map +0 -1
- package/lib/Player/ParameterManager.d.ts +0 -316
- package/lib/Player/ParameterManager.js +0 -408
- package/lib/Player/ParameterManager.js.map +0 -1
- package/lib/Player/Player.d.ts +0 -828
- package/lib/Player/Player.js +0 -927
- package/lib/Player/Player.js.map +0 -1
- package/lib/Player/SkillManager.d.ts +0 -163
- package/lib/Player/SkillManager.js +0 -223
- package/lib/Player/SkillManager.js.map +0 -1
- package/lib/Player/StateManager.d.ts +0 -185
- package/lib/Player/StateManager.js +0 -228
- package/lib/Player/StateManager.js.map +0 -1
- package/lib/Player/VariableManager.d.ts +0 -46
- package/lib/Player/VariableManager.js +0 -52
- package/lib/Player/VariableManager.js.map +0 -1
- package/lib/Query.d.ts +0 -127
- package/lib/Query.js +0 -159
- package/lib/Query.js.map +0 -1
- package/lib/RpgServer.js +0 -2
- package/lib/RpgServer.js.map +0 -1
- package/lib/Scenes/Map.d.ts +0 -136
- package/lib/Scenes/Map.js +0 -273
- package/lib/Scenes/Map.js.map +0 -1
- package/lib/decorators/event.d.ts +0 -43
- package/lib/decorators/event.js +0 -13
- package/lib/decorators/event.js.map +0 -1
- package/lib/decorators/map.d.ts +0 -178
- package/lib/decorators/map.js +0 -43
- package/lib/decorators/map.js.map +0 -1
- package/lib/entry-point.d.ts +0 -34
- package/lib/entry-point.js +0 -70
- package/lib/entry-point.js.map +0 -1
- package/lib/express/api.d.ts +0 -3
- package/lib/express/api.js +0 -105
- package/lib/express/api.js.map +0 -1
- package/lib/express/errors/NotAuthorized.d.ts +0 -4
- package/lib/express/errors/NotAuthorized.js +0 -7
- package/lib/express/errors/NotAuthorized.js.map +0 -1
- package/lib/express/errors/NotFound.d.ts +0 -4
- package/lib/express/errors/NotFound.js +0 -7
- package/lib/express/errors/NotFound.js.map +0 -1
- package/lib/express/server.d.ts +0 -18
- package/lib/express/server.js +0 -70
- package/lib/express/server.js.map +0 -1
- package/lib/index.d.ts +0 -20
- package/lib/index.js +0 -19
- package/lib/index.js.map +0 -1
- package/lib/inject.d.ts +0 -22
- package/lib/inject.js +0 -29
- package/lib/inject.js.map +0 -1
- package/lib/logs/index.js +0 -6
- package/lib/logs/index.js.map +0 -1
- package/lib/logs/item.js +0 -34
- package/lib/logs/item.js.map +0 -1
- package/lib/logs/log.js +0 -7
- package/lib/logs/log.js.map +0 -1
- package/lib/logs/skill.js +0 -19
- package/lib/logs/skill.js.map +0 -1
- package/lib/logs/state.js +0 -13
- package/lib/logs/state.js.map +0 -1
- package/lib/models/Item.d.ts +0 -10
- package/lib/models/Item.js +0 -2
- package/lib/models/Item.js.map +0 -1
- package/lib/presets/index.js +0 -65
- package/lib/presets/index.js.map +0 -1
- package/lib/server.d.ts +0 -137
- package/lib/server.js +0 -443
- package/lib/server.js.map +0 -1
- package/rpg.toml +0 -14
- package/src/Game/EventManager.ts +0 -125
- package/src/Game/Map.ts +0 -500
- package/src/Game/WorldMaps.ts +0 -45
- package/src/Interfaces/Gui.ts +0 -4
- package/src/Interfaces/StateStore.ts +0 -5
- package/src/MatchMaker.ts +0 -65
- package/src/Monitor/index.ts +0 -78
- package/src/Query.ts +0 -172
- package/src/Scenes/Map.ts +0 -310
- package/src/decorators/event.ts +0 -58
- package/src/decorators/map.ts +0 -226
- package/src/entry-point.ts +0 -111
- package/src/express/api.ts +0 -118
- package/src/express/errors/NotAuthorized.ts +0 -6
- package/src/express/errors/NotFound.ts +0 -6
- package/src/express/server.ts +0 -94
- package/src/inject.ts +0 -33
- package/src/models/Item.ts +0 -11
- package/src/server.ts +0 -459
- /package/{lib → dist}/Gui/MenuGui.d.ts +0 -0
- /package/{lib → dist}/Gui/NotificationGui.d.ts +0 -0
- /package/{lib → dist}/Gui/ShopGui.d.ts +0 -0
- /package/{lib → dist}/Gui/index.d.ts +0 -0
- /package/{lib → dist}/logs/index.d.ts +0 -0
- /package/{lib → dist}/logs/item.d.ts +0 -0
- /package/{lib → dist}/logs/log.d.ts +0 -0
- /package/{lib → dist}/logs/skill.d.ts +0 -0
- /package/{lib → dist}/logs/state.d.ts +0 -0
- /package/{lib → dist}/presets/index.d.ts +0 -0
package/lib/Player/GuiManager.js
DELETED
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import { Utils } from '@rpgjs/common';
|
|
2
|
-
import { Gui, DialogGui, MenuGui, ShopGui, NotificationGui } from '../Gui/index.js';
|
|
3
|
-
export class GuiManager {
|
|
4
|
-
/**
|
|
5
|
-
* Show a text. This is a graphical interface already built. Opens the GUI named `rpg-dialog`
|
|
6
|
-
*
|
|
7
|
-
* ```ts
|
|
8
|
-
* player.showText('Hello World')
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
* The method returns a promise. It is resolved when the dialog box is closed.
|
|
12
|
-
*
|
|
13
|
-
* ```ts
|
|
14
|
-
* await player.showText('Hello World')
|
|
15
|
-
* // dialog box is closed, then ...
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* **Option: position**
|
|
19
|
-
*
|
|
20
|
-
* You can define how the dialog box is displayed:
|
|
21
|
-
* - top
|
|
22
|
-
* - middle
|
|
23
|
-
* - bottom
|
|
24
|
-
*
|
|
25
|
-
* (bottom by default)
|
|
26
|
-
*
|
|
27
|
-
* ```ts
|
|
28
|
-
* player.showText('Hello World', {
|
|
29
|
-
* position: 'top'
|
|
30
|
-
* })
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* **Option: fullWidth**
|
|
34
|
-
*
|
|
35
|
-
* `boolean` (true by default)
|
|
36
|
-
*
|
|
37
|
-
* Indicate that the dialog box will take the full width of the screen.
|
|
38
|
-
*
|
|
39
|
-
* ```ts
|
|
40
|
-
* player.showText('Hello World', {
|
|
41
|
-
* fullWidth: true
|
|
42
|
-
* })
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* **Option: autoClose**
|
|
46
|
-
*
|
|
47
|
-
* `boolean` (false by default)
|
|
48
|
-
*
|
|
49
|
-
* If false, the user will have to press Enter to close the dialog box.
|
|
50
|
-
*
|
|
51
|
-
* ```ts
|
|
52
|
-
* player.showText('Hello World', {
|
|
53
|
-
* autoClose: true
|
|
54
|
-
* })
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* **Option: typewriterEffect**
|
|
58
|
-
*
|
|
59
|
-
* `boolean` (true by default)
|
|
60
|
-
*
|
|
61
|
-
* Performs a typewriter effect
|
|
62
|
-
*
|
|
63
|
-
* ```ts
|
|
64
|
-
* player.showText('Hello World', {
|
|
65
|
-
* typewriterEffect: false
|
|
66
|
-
* })
|
|
67
|
-
* ```
|
|
68
|
-
*
|
|
69
|
-
* **Option: talkWith**
|
|
70
|
-
*
|
|
71
|
-
* `RpgPlayer` (nothing by default)
|
|
72
|
-
*
|
|
73
|
-
* If you specify the event or another player, the other player will stop his or her movement and look in the player's direction.
|
|
74
|
-
*
|
|
75
|
-
* ```ts
|
|
76
|
-
* // Code in an event
|
|
77
|
-
* player.showText('Hello World', {
|
|
78
|
-
* talkWith: this
|
|
79
|
-
* })
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* @title Show Text
|
|
83
|
-
* @method player.showText(text,options)
|
|
84
|
-
* @param {string} text
|
|
85
|
-
* @param {object} [options] the different options, see usage below
|
|
86
|
-
* @returns {Promise}
|
|
87
|
-
* @memberof GuiManager
|
|
88
|
-
*/
|
|
89
|
-
showText(msg, options = {}) {
|
|
90
|
-
const gui = new DialogGui(this);
|
|
91
|
-
this._gui[gui.id] = gui;
|
|
92
|
-
return gui.openDialog(msg, options);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Shows a dialog box with a choice. Opens the GUI named `rpg-dialog`
|
|
96
|
-
*
|
|
97
|
-
* ```ts
|
|
98
|
-
* const choice = await player.showChoices('What color do you prefer?', [
|
|
99
|
-
* { text: 'Black', value: 'black' },
|
|
100
|
-
* { text: 'Rather the blue', value: 'blue' },
|
|
101
|
-
* { text: 'I don\'t have a preference!', value: 'none' }
|
|
102
|
-
* ])
|
|
103
|
-
*
|
|
104
|
-
* // If the player selects the first
|
|
105
|
-
* console.log(choice) // { text: 'Black', value: 'black' }
|
|
106
|
-
* ```
|
|
107
|
-
*
|
|
108
|
-
* @title Show Choices
|
|
109
|
-
* @method player.showChoices(text,choices)
|
|
110
|
-
* @param {string} text
|
|
111
|
-
* @param {Array<{ text: string, value: any }>} choices
|
|
112
|
-
* @param {object} [options] Same options as the openDialog method
|
|
113
|
-
* @returns {Promise<Choice | null>}
|
|
114
|
-
* @memberof GuiManager
|
|
115
|
-
*/
|
|
116
|
-
showChoices(msg, choices, options) {
|
|
117
|
-
return this
|
|
118
|
-
.showText(msg, {
|
|
119
|
-
choices,
|
|
120
|
-
...options
|
|
121
|
-
})
|
|
122
|
-
.then((indexSelected) => {
|
|
123
|
-
if (!choices[indexSelected])
|
|
124
|
-
return null;
|
|
125
|
-
return choices[indexSelected];
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Displays a notification . Opens the GUI named `rpg-notification`
|
|
130
|
-
*
|
|
131
|
-
* @title Displays a notification
|
|
132
|
-
* @method player.showNotification()
|
|
133
|
-
* @param {string} message - The message to display in the notification
|
|
134
|
-
* @param {object} options - An object containing options for the notification
|
|
135
|
-
* @param {number} options.time - The time to display the notification for (in ms). Default: 2000ms
|
|
136
|
-
* @param {string} options.icon - The icon to display in the notification. Put the identifier of the spritesheet (defined on the client side)
|
|
137
|
-
* @param {string} options.sound - The sound to play when the notification is shown. Set the sound ID (defined on the client side)
|
|
138
|
-
* @returns {void}
|
|
139
|
-
* @memberof GuiManager
|
|
140
|
-
*/
|
|
141
|
-
showNotification(message, options = {}) {
|
|
142
|
-
const gui = new NotificationGui(this);
|
|
143
|
-
this._gui[gui.id] = gui;
|
|
144
|
-
const data = {
|
|
145
|
-
message,
|
|
146
|
-
...options
|
|
147
|
-
};
|
|
148
|
-
return gui.open(data);
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Calls main menu. Opens the GUI named `rpg-main-menu`
|
|
152
|
-
*
|
|
153
|
-
* @title Call Main Menu
|
|
154
|
-
* @method player.callMainMenu()
|
|
155
|
-
* @returns {void}
|
|
156
|
-
* @memberof GuiManager
|
|
157
|
-
*/
|
|
158
|
-
callMainMenu() {
|
|
159
|
-
const gui = new MenuGui(this);
|
|
160
|
-
this._gui[gui.id] = gui;
|
|
161
|
-
return gui.open();
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Calls shop menu. Opens the GUI named `rpg-shop`
|
|
165
|
-
*
|
|
166
|
-
* @title Call Shop Menu
|
|
167
|
-
* @method player.callShop()
|
|
168
|
-
* @returns {void}
|
|
169
|
-
* @memberof GuiManager
|
|
170
|
-
*/
|
|
171
|
-
callShop(items) {
|
|
172
|
-
const gui = new ShopGui(this);
|
|
173
|
-
this._gui[gui.id] = gui;
|
|
174
|
-
return gui.open(items);
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Call a custom Gui
|
|
178
|
-
|
|
179
|
-
* ```ts
|
|
180
|
-
* // Calls a client-side component, created with VueJS, named "inn".
|
|
181
|
-
* const gui = player.gui('inn')
|
|
182
|
-
*
|
|
183
|
-
* // You can wait for actions on the menu. It only works if the menu is open.
|
|
184
|
-
* gui.on('accept', () => {
|
|
185
|
-
* player.allRecovery()
|
|
186
|
-
* })
|
|
187
|
-
*
|
|
188
|
-
* // The GUI is opened by passing recoverable data on the client side.
|
|
189
|
-
* gui.open({ hello: 'world' })
|
|
190
|
-
* ```
|
|
191
|
-
*
|
|
192
|
-
* When opening the GUI, one can give options
|
|
193
|
-
*
|
|
194
|
-
* ```ts
|
|
195
|
-
* await gui.open({ hello: 'world' }, {
|
|
196
|
-
* waitingAction: true,
|
|
197
|
-
* blockPlayerInput: true
|
|
198
|
-
* })
|
|
199
|
-
* // After the GUI is closed
|
|
200
|
-
* ```
|
|
201
|
-
*
|
|
202
|
-
* - `blockPlayerInput`: while the GUI is open, the player can not move on the map
|
|
203
|
-
* - `waitingAction`: We explicitly wait until the GUI is closed for the promise to be resolved.
|
|
204
|
-
*
|
|
205
|
-
* @title Call custom GUI
|
|
206
|
-
* @method player.gui(guiId)
|
|
207
|
-
* @param {string} guiId
|
|
208
|
-
* @returns {Gui}
|
|
209
|
-
* @memberof GuiManager
|
|
210
|
-
*/
|
|
211
|
-
gui(guiId) {
|
|
212
|
-
const gui = new Gui(guiId, this);
|
|
213
|
-
this._gui[guiId] = gui;
|
|
214
|
-
return gui;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Closes the GUI and removes it from memory
|
|
218
|
-
*
|
|
219
|
-
* @title Close custom GUI
|
|
220
|
-
* @method player.removeGui(guiId,data)
|
|
221
|
-
* @param {string} guiId
|
|
222
|
-
* @param {object} [data] Passing data if you close the GUI
|
|
223
|
-
* @returns {Gui}
|
|
224
|
-
* @memberof GuiManager
|
|
225
|
-
*/
|
|
226
|
-
removeGui(guiId, data) {
|
|
227
|
-
if (this._gui[guiId]) {
|
|
228
|
-
this._gui[guiId].close(data);
|
|
229
|
-
delete this._gui[guiId];
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
_attachedGui(players, display) {
|
|
233
|
-
if (!Utils.isArray(players)) {
|
|
234
|
-
players = [players];
|
|
235
|
-
}
|
|
236
|
-
this.emit('gui.tooltip', {
|
|
237
|
-
players: players.map(player => player.id),
|
|
238
|
-
display
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Display the GUI attached to the players
|
|
243
|
-
*
|
|
244
|
-
* If you don't specify the players as parameters, it will display the GUI of the instance
|
|
245
|
-
* But you can specify which GUIs to display by specifying the players as the first parameter
|
|
246
|
-
*
|
|
247
|
-
* @title View to GUI attached
|
|
248
|
-
* @method player.showAttachedGui(players?)
|
|
249
|
-
* @param {RpgPlayer[] | RpgPlayer} [players] The GUIs attached to the players to display
|
|
250
|
-
* @since 3.0.0-beta.5
|
|
251
|
-
* @example
|
|
252
|
-
* ```ts
|
|
253
|
-
* player.showAttachedGui()
|
|
254
|
-
* ```
|
|
255
|
-
* ```ts
|
|
256
|
-
* player.showAttachedGui(aPlayer)
|
|
257
|
-
* ```
|
|
258
|
-
* ```ts
|
|
259
|
-
* player.showAttachedGui([player1, player2])
|
|
260
|
-
* ```
|
|
261
|
-
* @memberof GuiManager
|
|
262
|
-
* */
|
|
263
|
-
showAttachedGui(players) {
|
|
264
|
-
const _players = players || this;
|
|
265
|
-
this._attachedGui(_players, true);
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Hide the GUI attached to the players
|
|
269
|
-
*
|
|
270
|
-
* @title Hide to GUI attached
|
|
271
|
-
* @method player.hideAttachedGui(players?)
|
|
272
|
-
* @param {RpgPlayer[] | RpgPlayer} [players] The GUIs attached to the players to hide
|
|
273
|
-
* @since 3.0.0-beta.5
|
|
274
|
-
* @example
|
|
275
|
-
* ```ts
|
|
276
|
-
* player.hideAttachedGui()
|
|
277
|
-
* ```
|
|
278
|
-
* ```ts
|
|
279
|
-
* player.hideAttachedGui(aPlayer)
|
|
280
|
-
* ```
|
|
281
|
-
* ```ts
|
|
282
|
-
* player.hideAttachedGui([player1, player2])
|
|
283
|
-
* ```
|
|
284
|
-
* @memberof GuiManager
|
|
285
|
-
* */
|
|
286
|
-
hideAttachedGui(players) {
|
|
287
|
-
const _players = players || this;
|
|
288
|
-
this._attachedGui(_players, false);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
//# sourceMappingURL=GuiManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GuiManager.js","sourceRoot":"","sources":["../../src/Player/GuiManager.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export class ItemFixture {
|
|
2
|
-
getFeature(name, prop) {
|
|
3
|
-
const array = {};
|
|
4
|
-
for (let item of this.equipments) {
|
|
5
|
-
if (item[name]) {
|
|
6
|
-
for (let feature of item[name]) {
|
|
7
|
-
const { rate } = feature;
|
|
8
|
-
const instance = feature[prop];
|
|
9
|
-
const cache = array[instance.id];
|
|
10
|
-
if (cache && cache.rate >= rate)
|
|
11
|
-
continue;
|
|
12
|
-
array[instance.id] = feature;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return Object.values(array);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=ItemFixture.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ItemFixture.js","sourceRoot":"","sources":["../../src/Player/ItemFixture.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,WAAW;IACV,UAAU,CAAC,IAAI,EAAE,IAAI;QAC3B,MAAM,KAAK,GAAG,EAAE,CAAA;QAChB,KAAK,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;YAC9B,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE;gBACZ,KAAK,IAAI,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE;oBAC5B,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;oBACxB,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;oBAC9B,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;oBAChC,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,IAAI,IAAI;wBAAE,SAAQ;oBACzC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,OAAO,CAAA;iBAC/B;aACJ;SACJ;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAC/B,CAAC;CACJ"}
|
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
import { ItemClass, ItemInstance, WeaponClass, ArmorClass } from '@rpgjs/database';
|
|
2
|
-
import { EffectManager } from './EffectManager';
|
|
3
|
-
import { GoldManager } from './GoldManager';
|
|
4
|
-
import { StateManager } from './StateManager';
|
|
5
|
-
type Inventory = {
|
|
6
|
-
nb: number;
|
|
7
|
-
item: ItemInstance;
|
|
8
|
-
};
|
|
9
|
-
export declare class ItemManager {
|
|
10
|
-
items: Inventory[];
|
|
11
|
-
equipments: ItemInstance[];
|
|
12
|
-
/**
|
|
13
|
-
* Retrieves the information of an object: the number and the instance
|
|
14
|
-
* @title Get Item
|
|
15
|
-
* @method player.getItem(itemClass)
|
|
16
|
-
* @param {ItemClass | string} itemClass Identifier of the object if the parameter is a string
|
|
17
|
-
* @returns {{ nb: number, item: instance of ItemClass }}
|
|
18
|
-
* @memberof ItemManager
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* ```ts
|
|
22
|
-
* import Potion from 'your-database/potion'
|
|
23
|
-
*
|
|
24
|
-
* player.addItem(Potion, 5)
|
|
25
|
-
* const inventory = player.getItem(Potion)
|
|
26
|
-
* console.log(inventory) // { nb: 5, item: <instance of Potion> }
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
getItem(itemClass: ItemClass | string): Inventory;
|
|
30
|
-
/**
|
|
31
|
-
* Check if the player has the item in his inventory.
|
|
32
|
-
* @title Has Item
|
|
33
|
-
* @method player.hasItem(itemClass)
|
|
34
|
-
* @param {ItemClass | string} itemClass Identifier of the object if the parameter is a string
|
|
35
|
-
* @returns {boolean}
|
|
36
|
-
* @memberof ItemManager
|
|
37
|
-
* @example
|
|
38
|
-
*
|
|
39
|
-
* ```ts
|
|
40
|
-
* import Potion from 'your-database/potion'
|
|
41
|
-
*
|
|
42
|
-
* player.hasItem(Potion) // false
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
hasItem(itemClass: ItemClass | string): boolean;
|
|
46
|
-
_getItemIndex(itemClass: ItemClass | string): number;
|
|
47
|
-
/**
|
|
48
|
-
* Add an item in the player's inventory. You can give more than one by specifying `nb`
|
|
49
|
-
*
|
|
50
|
-
* `onAdd()` method is called on the ItemClass
|
|
51
|
-
*
|
|
52
|
-
* @title Add Item
|
|
53
|
-
* @method player.addItem(item,nb=1)
|
|
54
|
-
* @param {ItemClass} itemClass
|
|
55
|
-
* @param {number} [nb] Default 1
|
|
56
|
-
* @returns {{ nb: number, item: instance of ItemClass }}
|
|
57
|
-
* @memberof ItemManager
|
|
58
|
-
* @example
|
|
59
|
-
*
|
|
60
|
-
* ```ts
|
|
61
|
-
* import Potion from 'your-database/potion'
|
|
62
|
-
* player.addItem(Potion, 5)
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
addItem(itemClass: ItemClass | string, nb?: number): Inventory;
|
|
66
|
-
/**
|
|
67
|
-
* Deletes an item. Decreases the value `nb`. If the number falls to 0, then the item is removed from the inventory. The method then returns `undefined`
|
|
68
|
-
*
|
|
69
|
-
* `onRemove()` method is called on the ItemClass
|
|
70
|
-
*
|
|
71
|
-
* @title Remove Item
|
|
72
|
-
* @method player.removeItem(item,nb=1)
|
|
73
|
-
* @param {ItemClass | string} itemClass string is item id
|
|
74
|
-
* @param {number} [nb] Default 1
|
|
75
|
-
* @returns {{ nb: number, item: instance of ItemClass } | undefined}
|
|
76
|
-
* @throws {ItemLog} notInInventory
|
|
77
|
-
* If the object is not in the inventory, an exception is raised
|
|
78
|
-
* ```
|
|
79
|
-
* {
|
|
80
|
-
* id: ITEM_NOT_INVENTORY,
|
|
81
|
-
* msg: '...'
|
|
82
|
-
* }
|
|
83
|
-
* ```
|
|
84
|
-
* @memberof ItemManager
|
|
85
|
-
* @example
|
|
86
|
-
*
|
|
87
|
-
* ```ts
|
|
88
|
-
* import Potion from 'your-database/potion'
|
|
89
|
-
*
|
|
90
|
-
* try {
|
|
91
|
-
* player.removeItem(Potion, 5)
|
|
92
|
-
* }
|
|
93
|
-
* catch (err) {
|
|
94
|
-
* console.log(err)
|
|
95
|
-
* }
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
removeItem(itemClass: ItemClass | string, nb?: number): Inventory | undefined;
|
|
99
|
-
/**
|
|
100
|
-
* Purchases an item and reduces the amount of gold
|
|
101
|
-
*
|
|
102
|
-
* `onAdd()` method is called on the ItemClass
|
|
103
|
-
*
|
|
104
|
-
* @title Buy Item
|
|
105
|
-
* @method player.buyItem(item,nb=1)
|
|
106
|
-
* @param {ItemClass | string} itemClass string is item id
|
|
107
|
-
* @param {number} [nb] Default 1
|
|
108
|
-
* @returns {{ nb: number, item: instance of ItemClass }}
|
|
109
|
-
* @throws {ItemLog} haveNotPrice
|
|
110
|
-
* If you have not set a price on the item
|
|
111
|
-
* ```
|
|
112
|
-
* {
|
|
113
|
-
* id: NOT_PRICE,
|
|
114
|
-
* msg: '...'
|
|
115
|
-
* }
|
|
116
|
-
* ```
|
|
117
|
-
* @throws {ItemLog} notEnoughGold
|
|
118
|
-
* If the player does not have enough money
|
|
119
|
-
* ```
|
|
120
|
-
* {
|
|
121
|
-
* id: NOT_ENOUGH_GOLD,
|
|
122
|
-
* msg: '...'
|
|
123
|
-
* }
|
|
124
|
-
* ```
|
|
125
|
-
* @memberof ItemManager
|
|
126
|
-
* @example
|
|
127
|
-
*
|
|
128
|
-
* ```ts
|
|
129
|
-
* import Potion from 'your-database/potion'
|
|
130
|
-
*
|
|
131
|
-
* try {
|
|
132
|
-
* player.buyItem(Potion)
|
|
133
|
-
* }
|
|
134
|
-
* catch (err) {
|
|
135
|
-
* console.log(err)
|
|
136
|
-
* }
|
|
137
|
-
* ```
|
|
138
|
-
*/
|
|
139
|
-
buyItem(itemClass: ItemClass | string, nb?: number): Inventory;
|
|
140
|
-
/**
|
|
141
|
-
* Sell an item and the player wins the amount of the item divided by 2
|
|
142
|
-
*
|
|
143
|
-
* `onRemove()` method is called on the ItemClass
|
|
144
|
-
*
|
|
145
|
-
* @title Sell Item
|
|
146
|
-
* @method player.sellItem(item,nb=1)
|
|
147
|
-
* @param {ItemClass | string} itemClass string is item id
|
|
148
|
-
* @param {number} [nbToSell] Default 1
|
|
149
|
-
* @returns {{ nb: number, item: instance of ItemClass }}
|
|
150
|
-
* @throws {ItemLog} haveNotPrice
|
|
151
|
-
* If you have not set a price on the item
|
|
152
|
-
* ```
|
|
153
|
-
* {
|
|
154
|
-
* id: NOT_PRICE,
|
|
155
|
-
* msg: '...'
|
|
156
|
-
* }
|
|
157
|
-
* ```
|
|
158
|
-
* @throws {ItemLog} notInInventory
|
|
159
|
-
* If the object is not in the inventory, an exception is raised
|
|
160
|
-
* ```
|
|
161
|
-
* {
|
|
162
|
-
* id: ITEM_NOT_INVENTORY,
|
|
163
|
-
* msg: '...'
|
|
164
|
-
* }
|
|
165
|
-
* ```
|
|
166
|
-
* @throws {ItemLog} tooManyToSell
|
|
167
|
-
* If the number of items for sale exceeds the number of actual items in the inventory
|
|
168
|
-
* ```
|
|
169
|
-
* {
|
|
170
|
-
* id: TOO_MANY_ITEM_TO_SELL,
|
|
171
|
-
* msg: '...'
|
|
172
|
-
* }
|
|
173
|
-
* ```
|
|
174
|
-
* @memberof ItemManager
|
|
175
|
-
* @example
|
|
176
|
-
*
|
|
177
|
-
* ```ts
|
|
178
|
-
* import Potion from 'your-database/potion'
|
|
179
|
-
*
|
|
180
|
-
* try {
|
|
181
|
-
* player.addItem(Potion)
|
|
182
|
-
* player.sellItem(Potion)
|
|
183
|
-
* }
|
|
184
|
-
* catch (err) {
|
|
185
|
-
* console.log(err)
|
|
186
|
-
* }
|
|
187
|
-
* ```
|
|
188
|
-
*/
|
|
189
|
-
sellItem(itemClass: ItemClass | string, nbToSell?: number): Inventory;
|
|
190
|
-
private getParamItem;
|
|
191
|
-
/**
|
|
192
|
-
* recover the attack sum of items equipped on the player.
|
|
193
|
-
*
|
|
194
|
-
* @title Get the player's attack
|
|
195
|
-
* @prop {number} player.atk
|
|
196
|
-
* @memberof ItemManager
|
|
197
|
-
*/
|
|
198
|
-
get atk(): number;
|
|
199
|
-
/**
|
|
200
|
-
* recover the physic defense sum of items equipped on the player.
|
|
201
|
-
*
|
|
202
|
-
* @title Get the player's pdef
|
|
203
|
-
* @prop {number} player.pdef
|
|
204
|
-
* @memberof ItemManager
|
|
205
|
-
*/
|
|
206
|
-
get pdef(): number;
|
|
207
|
-
/**
|
|
208
|
-
* recover the skill defense sum of items equipped on the player.
|
|
209
|
-
*
|
|
210
|
-
* @title Get the player's sdef
|
|
211
|
-
* @prop {number} player.sdef
|
|
212
|
-
* @memberof ItemManager
|
|
213
|
-
*/
|
|
214
|
-
get sdef(): number;
|
|
215
|
-
/**
|
|
216
|
-
* Use an object. Applies effects and states. Removes the object from the inventory then
|
|
217
|
-
*
|
|
218
|
-
* `onUse()` method is called on the ItemClass (If the use has worked)
|
|
219
|
-
* `onRemove()` method is called on the ItemClass
|
|
220
|
-
*
|
|
221
|
-
* @title Use an Item
|
|
222
|
-
* @method player.useItem(item,nb=1)
|
|
223
|
-
* @param {ItemClass | string} itemClass string is item id
|
|
224
|
-
* @returns {{ nb: number, item: instance of ItemClass }}
|
|
225
|
-
* @throws {ItemLog} restriction
|
|
226
|
-
* If the player has the `Effect.CAN_NOT_ITEM` effect
|
|
227
|
-
* ```
|
|
228
|
-
* {
|
|
229
|
-
* id: RESTRICTION_ITEM,
|
|
230
|
-
* msg: '...'
|
|
231
|
-
* }
|
|
232
|
-
* ```
|
|
233
|
-
* @throws {ItemLog} notInInventory
|
|
234
|
-
* If the object is not in the inventory, an exception is raised
|
|
235
|
-
* ```
|
|
236
|
-
* {
|
|
237
|
-
* id: ITEM_NOT_INVENTORY,
|
|
238
|
-
* msg: '...'
|
|
239
|
-
* }
|
|
240
|
-
* ```
|
|
241
|
-
* @throws {ItemLog} notUseItem
|
|
242
|
-
* If the `consumable` property is on false
|
|
243
|
-
* ```
|
|
244
|
-
* {
|
|
245
|
-
* id: NOT_USE_ITEM,
|
|
246
|
-
* msg: '...'
|
|
247
|
-
* }
|
|
248
|
-
* ```
|
|
249
|
-
* @throws {ItemLog} chanceToUseFailed
|
|
250
|
-
* Chance to use the item has failed. Chances of use is defined with `ItemClass.hitRate`
|
|
251
|
-
* ```
|
|
252
|
-
* {
|
|
253
|
-
* id: USE_CHANCE_ITEM_FAILED,
|
|
254
|
-
* msg: '...'
|
|
255
|
-
* }
|
|
256
|
-
* ```
|
|
257
|
-
* > the item is still deleted from the inventory
|
|
258
|
-
*
|
|
259
|
-
* `onUseFailed()` method is called on the ItemClass
|
|
260
|
-
*
|
|
261
|
-
* @memberof ItemManager
|
|
262
|
-
* @example
|
|
263
|
-
*
|
|
264
|
-
* ```ts
|
|
265
|
-
* import Potion from 'your-database/potion'
|
|
266
|
-
*
|
|
267
|
-
* try {
|
|
268
|
-
* player.addItem(Potion)
|
|
269
|
-
* player.useItem(Potion)
|
|
270
|
-
* }
|
|
271
|
-
* catch (err) {
|
|
272
|
-
* console.log(err)
|
|
273
|
-
* }
|
|
274
|
-
* ```
|
|
275
|
-
*/
|
|
276
|
-
useItem(itemClass: ItemClass | string): Inventory;
|
|
277
|
-
/**
|
|
278
|
-
* Equips a weapon or armor on a player. Think first to add the item in the inventory with the `addItem()` method before equipping the item.
|
|
279
|
-
*
|
|
280
|
-
* `onEquip()` method is called on the ItemClass
|
|
281
|
-
*
|
|
282
|
-
* @title Equip Weapon or Armor
|
|
283
|
-
* @method player.equip(itemClass,equip=true)
|
|
284
|
-
* @param {ItemClass | string} itemClass string is item id
|
|
285
|
-
* @param {number} [equip] Equip the object if true or un-equipped if false
|
|
286
|
-
* @returns {void}
|
|
287
|
-
* @throws {ItemLog} notInInventory
|
|
288
|
-
* If the item is not in the inventory
|
|
289
|
-
* ```
|
|
290
|
-
{
|
|
291
|
-
id: ITEM_NOT_INVENTORY,
|
|
292
|
-
msg: '...'
|
|
293
|
-
}
|
|
294
|
-
```
|
|
295
|
-
* @throws {ItemLog} invalidToEquiped
|
|
296
|
-
If the item is not by a weapon or armor
|
|
297
|
-
```
|
|
298
|
-
{
|
|
299
|
-
id: INVALID_ITEM_TO_EQUIP,
|
|
300
|
-
msg: '...'
|
|
301
|
-
}
|
|
302
|
-
```
|
|
303
|
-
* @throws {ItemLog} isAlreadyEquiped
|
|
304
|
-
If the item Is already equipped
|
|
305
|
-
```
|
|
306
|
-
{
|
|
307
|
-
id: ITEM_ALREADY_EQUIPED,
|
|
308
|
-
msg: '...'
|
|
309
|
-
}
|
|
310
|
-
```
|
|
311
|
-
* @memberof ItemManager
|
|
312
|
-
* @example
|
|
313
|
-
*
|
|
314
|
-
* ```ts
|
|
315
|
-
* import Sword from 'your-database/sword'
|
|
316
|
-
*
|
|
317
|
-
* try {
|
|
318
|
-
* player.addItem(Sword)
|
|
319
|
-
* player.equip(Sword)
|
|
320
|
-
* }
|
|
321
|
-
* catch (err) {
|
|
322
|
-
* console.log(err)
|
|
323
|
-
* }
|
|
324
|
-
* ```
|
|
325
|
-
*/
|
|
326
|
-
equip(itemClass: WeaponClass | ArmorClass | string, equip?: boolean): void;
|
|
327
|
-
}
|
|
328
|
-
export interface ItemManager extends GoldManager, StateManager, EffectManager {
|
|
329
|
-
databaseById(itemClass: any): any;
|
|
330
|
-
}
|
|
331
|
-
export {};
|