@rpgjs/server 4.2.2 → 5.0.0-alpha.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/{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 +34 -17
- 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 +16 -38
- 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 +38 -14
- 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 -163
- package/LICENSE +0 -19
- package/browser/manifest.json +0 -7
- package/browser/rpg.server.js +0 -22372
- package/browser/rpg.server.umd.cjs +0 -22403
- 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 -414
- 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 -16
- package/lib/express/server.js +0 -65
- 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 -495
- 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 -87
- 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
|
@@ -1,475 +0,0 @@
|
|
|
1
|
-
import { Utils } from '@rpgjs/common';
|
|
2
|
-
import { Effect, ClassHooks } from '@rpgjs/database';
|
|
3
|
-
import { ItemLog } from '../logs/index.js';
|
|
4
|
-
import { EffectManager } from './EffectManager.js';
|
|
5
|
-
import { GoldManager } from './GoldManager.js';
|
|
6
|
-
import { StateManager } from './StateManager.js';
|
|
7
|
-
import { ATK, PDEF, SDEF } from '../presets/index.js';
|
|
8
|
-
const { isString, isInstanceOf, applyMixins } = Utils;
|
|
9
|
-
export class ItemManager {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.equipments = [];
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Retrieves the information of an object: the number and the instance
|
|
15
|
-
* @title Get Item
|
|
16
|
-
* @method player.getItem(itemClass)
|
|
17
|
-
* @param {ItemClass | string} itemClass Identifier of the object if the parameter is a string
|
|
18
|
-
* @returns {{ nb: number, item: instance of ItemClass }}
|
|
19
|
-
* @memberof ItemManager
|
|
20
|
-
* @example
|
|
21
|
-
*
|
|
22
|
-
* ```ts
|
|
23
|
-
* import Potion from 'your-database/potion'
|
|
24
|
-
*
|
|
25
|
-
* player.addItem(Potion, 5)
|
|
26
|
-
* const inventory = player.getItem(Potion)
|
|
27
|
-
* console.log(inventory) // { nb: 5, item: <instance of Potion> }
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
getItem(itemClass) {
|
|
31
|
-
const index = this._getItemIndex(itemClass);
|
|
32
|
-
return this.items[index];
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Check if the player has the item in his inventory.
|
|
36
|
-
* @title Has Item
|
|
37
|
-
* @method player.hasItem(itemClass)
|
|
38
|
-
* @param {ItemClass | string} itemClass Identifier of the object if the parameter is a string
|
|
39
|
-
* @returns {boolean}
|
|
40
|
-
* @memberof ItemManager
|
|
41
|
-
* @example
|
|
42
|
-
*
|
|
43
|
-
* ```ts
|
|
44
|
-
* import Potion from 'your-database/potion'
|
|
45
|
-
*
|
|
46
|
-
* player.hasItem(Potion) // false
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
hasItem(itemClass) {
|
|
50
|
-
return !!this.getItem(itemClass);
|
|
51
|
-
}
|
|
52
|
-
_getItemIndex(itemClass) {
|
|
53
|
-
return this.items.findIndex((it) => {
|
|
54
|
-
if (isString(itemClass)) {
|
|
55
|
-
return it.item.id == itemClass;
|
|
56
|
-
}
|
|
57
|
-
return isInstanceOf(it.item, itemClass);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Add an item in the player's inventory. You can give more than one by specifying `nb`
|
|
62
|
-
*
|
|
63
|
-
* `onAdd()` method is called on the ItemClass
|
|
64
|
-
*
|
|
65
|
-
* @title Add Item
|
|
66
|
-
* @method player.addItem(item,nb=1)
|
|
67
|
-
* @param {ItemClass} itemClass
|
|
68
|
-
* @param {number} [nb] Default 1
|
|
69
|
-
* @returns {{ nb: number, item: instance of ItemClass }}
|
|
70
|
-
* @memberof ItemManager
|
|
71
|
-
* @example
|
|
72
|
-
*
|
|
73
|
-
* ```ts
|
|
74
|
-
* import Potion from 'your-database/potion'
|
|
75
|
-
* player.addItem(Potion, 5)
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
addItem(itemClass, nb = 1) {
|
|
79
|
-
if (isString(itemClass))
|
|
80
|
-
itemClass = this.databaseById(itemClass);
|
|
81
|
-
let itemIndex = this._getItemIndex(itemClass);
|
|
82
|
-
if (itemIndex != -1) {
|
|
83
|
-
this.items[itemIndex].nb += nb;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
const instance = new itemClass();
|
|
87
|
-
this.items.push({
|
|
88
|
-
item: instance,
|
|
89
|
-
nb
|
|
90
|
-
});
|
|
91
|
-
itemIndex = this.items.length - 1;
|
|
92
|
-
}
|
|
93
|
-
const { item } = this.items[itemIndex];
|
|
94
|
-
this['execMethod']('onAdd', [this], item);
|
|
95
|
-
return this.items[itemIndex];
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* 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`
|
|
99
|
-
*
|
|
100
|
-
* `onRemove()` method is called on the ItemClass
|
|
101
|
-
*
|
|
102
|
-
* @title Remove Item
|
|
103
|
-
* @method player.removeItem(item,nb=1)
|
|
104
|
-
* @param {ItemClass | string} itemClass string is item id
|
|
105
|
-
* @param {number} [nb] Default 1
|
|
106
|
-
* @returns {{ nb: number, item: instance of ItemClass } | undefined}
|
|
107
|
-
* @throws {ItemLog} notInInventory
|
|
108
|
-
* If the object is not in the inventory, an exception is raised
|
|
109
|
-
* ```
|
|
110
|
-
* {
|
|
111
|
-
* id: ITEM_NOT_INVENTORY,
|
|
112
|
-
* msg: '...'
|
|
113
|
-
* }
|
|
114
|
-
* ```
|
|
115
|
-
* @memberof ItemManager
|
|
116
|
-
* @example
|
|
117
|
-
*
|
|
118
|
-
* ```ts
|
|
119
|
-
* import Potion from 'your-database/potion'
|
|
120
|
-
*
|
|
121
|
-
* try {
|
|
122
|
-
* player.removeItem(Potion, 5)
|
|
123
|
-
* }
|
|
124
|
-
* catch (err) {
|
|
125
|
-
* console.log(err)
|
|
126
|
-
* }
|
|
127
|
-
* ```
|
|
128
|
-
*/
|
|
129
|
-
removeItem(itemClass, nb = 1) {
|
|
130
|
-
const itemIndex = this._getItemIndex(itemClass);
|
|
131
|
-
if (itemIndex == -1) {
|
|
132
|
-
throw ItemLog.notInInventory(itemClass);
|
|
133
|
-
}
|
|
134
|
-
const currentNb = this.items[itemIndex].nb;
|
|
135
|
-
const { item } = this.items[itemIndex];
|
|
136
|
-
if (currentNb - nb <= 0) {
|
|
137
|
-
this.items.splice(itemIndex, 1);
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
this.items[itemIndex].nb -= nb;
|
|
141
|
-
}
|
|
142
|
-
this['execMethod']('onRemove', [this], item);
|
|
143
|
-
return this.items[itemIndex];
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Purchases an item and reduces the amount of gold
|
|
147
|
-
*
|
|
148
|
-
* `onAdd()` method is called on the ItemClass
|
|
149
|
-
*
|
|
150
|
-
* @title Buy Item
|
|
151
|
-
* @method player.buyItem(item,nb=1)
|
|
152
|
-
* @param {ItemClass | string} itemClass string is item id
|
|
153
|
-
* @param {number} [nb] Default 1
|
|
154
|
-
* @returns {{ nb: number, item: instance of ItemClass }}
|
|
155
|
-
* @throws {ItemLog} haveNotPrice
|
|
156
|
-
* If you have not set a price on the item
|
|
157
|
-
* ```
|
|
158
|
-
* {
|
|
159
|
-
* id: NOT_PRICE,
|
|
160
|
-
* msg: '...'
|
|
161
|
-
* }
|
|
162
|
-
* ```
|
|
163
|
-
* @throws {ItemLog} notEnoughGold
|
|
164
|
-
* If the player does not have enough money
|
|
165
|
-
* ```
|
|
166
|
-
* {
|
|
167
|
-
* id: NOT_ENOUGH_GOLD,
|
|
168
|
-
* msg: '...'
|
|
169
|
-
* }
|
|
170
|
-
* ```
|
|
171
|
-
* @memberof ItemManager
|
|
172
|
-
* @example
|
|
173
|
-
*
|
|
174
|
-
* ```ts
|
|
175
|
-
* import Potion from 'your-database/potion'
|
|
176
|
-
*
|
|
177
|
-
* try {
|
|
178
|
-
* player.buyItem(Potion)
|
|
179
|
-
* }
|
|
180
|
-
* catch (err) {
|
|
181
|
-
* console.log(err)
|
|
182
|
-
* }
|
|
183
|
-
* ```
|
|
184
|
-
*/
|
|
185
|
-
buyItem(itemClass, nb = 1) {
|
|
186
|
-
if (isString(itemClass))
|
|
187
|
-
itemClass = this.databaseById(itemClass);
|
|
188
|
-
const ItemClass = itemClass;
|
|
189
|
-
if (!ItemClass.price) {
|
|
190
|
-
throw ItemLog.haveNotPrice(itemClass);
|
|
191
|
-
}
|
|
192
|
-
const totalPrice = nb * ItemClass.price;
|
|
193
|
-
if (this.gold < totalPrice) {
|
|
194
|
-
throw ItemLog.notEnoughGold(itemClass, nb);
|
|
195
|
-
}
|
|
196
|
-
this.gold -= totalPrice;
|
|
197
|
-
return this.addItem(ItemClass, nb);
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Sell an item and the player wins the amount of the item divided by 2
|
|
201
|
-
*
|
|
202
|
-
* `onRemove()` method is called on the ItemClass
|
|
203
|
-
*
|
|
204
|
-
* @title Sell Item
|
|
205
|
-
* @method player.sellItem(item,nb=1)
|
|
206
|
-
* @param {ItemClass | string} itemClass string is item id
|
|
207
|
-
* @param {number} [nbToSell] Default 1
|
|
208
|
-
* @returns {{ nb: number, item: instance of ItemClass }}
|
|
209
|
-
* @throws {ItemLog} haveNotPrice
|
|
210
|
-
* If you have not set a price on the item
|
|
211
|
-
* ```
|
|
212
|
-
* {
|
|
213
|
-
* id: NOT_PRICE,
|
|
214
|
-
* msg: '...'
|
|
215
|
-
* }
|
|
216
|
-
* ```
|
|
217
|
-
* @throws {ItemLog} notInInventory
|
|
218
|
-
* If the object is not in the inventory, an exception is raised
|
|
219
|
-
* ```
|
|
220
|
-
* {
|
|
221
|
-
* id: ITEM_NOT_INVENTORY,
|
|
222
|
-
* msg: '...'
|
|
223
|
-
* }
|
|
224
|
-
* ```
|
|
225
|
-
* @throws {ItemLog} tooManyToSell
|
|
226
|
-
* If the number of items for sale exceeds the number of actual items in the inventory
|
|
227
|
-
* ```
|
|
228
|
-
* {
|
|
229
|
-
* id: TOO_MANY_ITEM_TO_SELL,
|
|
230
|
-
* msg: '...'
|
|
231
|
-
* }
|
|
232
|
-
* ```
|
|
233
|
-
* @memberof ItemManager
|
|
234
|
-
* @example
|
|
235
|
-
*
|
|
236
|
-
* ```ts
|
|
237
|
-
* import Potion from 'your-database/potion'
|
|
238
|
-
*
|
|
239
|
-
* try {
|
|
240
|
-
* player.addItem(Potion)
|
|
241
|
-
* player.sellItem(Potion)
|
|
242
|
-
* }
|
|
243
|
-
* catch (err) {
|
|
244
|
-
* console.log(err)
|
|
245
|
-
* }
|
|
246
|
-
* ```
|
|
247
|
-
*/
|
|
248
|
-
sellItem(itemClass, nbToSell = 1) {
|
|
249
|
-
if (isString(itemClass))
|
|
250
|
-
itemClass = this.databaseById(itemClass);
|
|
251
|
-
const ItemClass = itemClass;
|
|
252
|
-
const inventory = this.getItem(ItemClass);
|
|
253
|
-
if (!inventory) {
|
|
254
|
-
throw ItemLog.notInInventory(itemClass);
|
|
255
|
-
}
|
|
256
|
-
const { item, nb } = inventory;
|
|
257
|
-
if (nb - nbToSell < 0) {
|
|
258
|
-
throw ItemLog.tooManyToSell(itemClass, nbToSell, nb);
|
|
259
|
-
}
|
|
260
|
-
if (!ItemClass.price) {
|
|
261
|
-
throw ItemLog.haveNotPrice(itemClass);
|
|
262
|
-
}
|
|
263
|
-
this.gold += (ItemClass.price / 2) * nbToSell;
|
|
264
|
-
this.removeItem(ItemClass, nbToSell);
|
|
265
|
-
return inventory;
|
|
266
|
-
}
|
|
267
|
-
getParamItem(name) {
|
|
268
|
-
let nb = 0;
|
|
269
|
-
for (let item of this.equipments) {
|
|
270
|
-
nb += item[name] || 0;
|
|
271
|
-
}
|
|
272
|
-
const modifier = this.paramsModifier[name];
|
|
273
|
-
if (modifier) {
|
|
274
|
-
if (modifier.value)
|
|
275
|
-
nb += modifier.value;
|
|
276
|
-
if (modifier.rate)
|
|
277
|
-
nb *= modifier.rate;
|
|
278
|
-
}
|
|
279
|
-
return nb;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* recover the attack sum of items equipped on the player.
|
|
283
|
-
*
|
|
284
|
-
* @title Get the player's attack
|
|
285
|
-
* @prop {number} player.atk
|
|
286
|
-
* @memberof ItemManager
|
|
287
|
-
*/
|
|
288
|
-
get atk() {
|
|
289
|
-
return this.getParamItem(ATK);
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* recover the physic defense sum of items equipped on the player.
|
|
293
|
-
*
|
|
294
|
-
* @title Get the player's pdef
|
|
295
|
-
* @prop {number} player.pdef
|
|
296
|
-
* @memberof ItemManager
|
|
297
|
-
*/
|
|
298
|
-
get pdef() {
|
|
299
|
-
return this.getParamItem(PDEF);
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* recover the skill defense sum of items equipped on the player.
|
|
303
|
-
*
|
|
304
|
-
* @title Get the player's sdef
|
|
305
|
-
* @prop {number} player.sdef
|
|
306
|
-
* @memberof ItemManager
|
|
307
|
-
*/
|
|
308
|
-
get sdef() {
|
|
309
|
-
return this.getParamItem(SDEF);
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Use an object. Applies effects and states. Removes the object from the inventory then
|
|
313
|
-
*
|
|
314
|
-
* `onUse()` method is called on the ItemClass (If the use has worked)
|
|
315
|
-
* `onRemove()` method is called on the ItemClass
|
|
316
|
-
*
|
|
317
|
-
* @title Use an Item
|
|
318
|
-
* @method player.useItem(item,nb=1)
|
|
319
|
-
* @param {ItemClass | string} itemClass string is item id
|
|
320
|
-
* @returns {{ nb: number, item: instance of ItemClass }}
|
|
321
|
-
* @throws {ItemLog} restriction
|
|
322
|
-
* If the player has the `Effect.CAN_NOT_ITEM` effect
|
|
323
|
-
* ```
|
|
324
|
-
* {
|
|
325
|
-
* id: RESTRICTION_ITEM,
|
|
326
|
-
* msg: '...'
|
|
327
|
-
* }
|
|
328
|
-
* ```
|
|
329
|
-
* @throws {ItemLog} notInInventory
|
|
330
|
-
* If the object is not in the inventory, an exception is raised
|
|
331
|
-
* ```
|
|
332
|
-
* {
|
|
333
|
-
* id: ITEM_NOT_INVENTORY,
|
|
334
|
-
* msg: '...'
|
|
335
|
-
* }
|
|
336
|
-
* ```
|
|
337
|
-
* @throws {ItemLog} notUseItem
|
|
338
|
-
* If the `consumable` property is on false
|
|
339
|
-
* ```
|
|
340
|
-
* {
|
|
341
|
-
* id: NOT_USE_ITEM,
|
|
342
|
-
* msg: '...'
|
|
343
|
-
* }
|
|
344
|
-
* ```
|
|
345
|
-
* @throws {ItemLog} chanceToUseFailed
|
|
346
|
-
* Chance to use the item has failed. Chances of use is defined with `ItemClass.hitRate`
|
|
347
|
-
* ```
|
|
348
|
-
* {
|
|
349
|
-
* id: USE_CHANCE_ITEM_FAILED,
|
|
350
|
-
* msg: '...'
|
|
351
|
-
* }
|
|
352
|
-
* ```
|
|
353
|
-
* > the item is still deleted from the inventory
|
|
354
|
-
*
|
|
355
|
-
* `onUseFailed()` method is called on the ItemClass
|
|
356
|
-
*
|
|
357
|
-
* @memberof ItemManager
|
|
358
|
-
* @example
|
|
359
|
-
*
|
|
360
|
-
* ```ts
|
|
361
|
-
* import Potion from 'your-database/potion'
|
|
362
|
-
*
|
|
363
|
-
* try {
|
|
364
|
-
* player.addItem(Potion)
|
|
365
|
-
* player.useItem(Potion)
|
|
366
|
-
* }
|
|
367
|
-
* catch (err) {
|
|
368
|
-
* console.log(err)
|
|
369
|
-
* }
|
|
370
|
-
* ```
|
|
371
|
-
*/
|
|
372
|
-
useItem(itemClass) {
|
|
373
|
-
const inventory = this.getItem(itemClass);
|
|
374
|
-
if (this.hasEffect(Effect.CAN_NOT_ITEM)) {
|
|
375
|
-
throw ItemLog.restriction(itemClass);
|
|
376
|
-
}
|
|
377
|
-
if (!inventory) {
|
|
378
|
-
throw ItemLog.notInInventory(itemClass);
|
|
379
|
-
}
|
|
380
|
-
const { item } = inventory;
|
|
381
|
-
if (item.consumable === false) {
|
|
382
|
-
throw ItemLog.notUseItem(itemClass);
|
|
383
|
-
}
|
|
384
|
-
const hitRate = item.hitRate ?? 1;
|
|
385
|
-
if (Math.random() > hitRate) {
|
|
386
|
-
this.removeItem(itemClass);
|
|
387
|
-
this['execMethod']('onUseFailed', [this], item);
|
|
388
|
-
throw ItemLog.chanceToUseFailed(itemClass);
|
|
389
|
-
}
|
|
390
|
-
this.applyEffect(item);
|
|
391
|
-
this.applyStates(this, item);
|
|
392
|
-
this['execMethod']('onUse', [this], item);
|
|
393
|
-
this.removeItem(itemClass);
|
|
394
|
-
return inventory;
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* 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.
|
|
398
|
-
*
|
|
399
|
-
* `onEquip()` method is called on the ItemClass
|
|
400
|
-
*
|
|
401
|
-
* @title Equip Weapon or Armor
|
|
402
|
-
* @method player.equip(itemClass,equip=true)
|
|
403
|
-
* @param {ItemClass | string} itemClass string is item id
|
|
404
|
-
* @param {number} [equip] Equip the object if true or un-equipped if false
|
|
405
|
-
* @returns {void}
|
|
406
|
-
* @throws {ItemLog} notInInventory
|
|
407
|
-
* If the item is not in the inventory
|
|
408
|
-
* ```
|
|
409
|
-
{
|
|
410
|
-
id: ITEM_NOT_INVENTORY,
|
|
411
|
-
msg: '...'
|
|
412
|
-
}
|
|
413
|
-
```
|
|
414
|
-
* @throws {ItemLog} invalidToEquiped
|
|
415
|
-
If the item is not by a weapon or armor
|
|
416
|
-
```
|
|
417
|
-
{
|
|
418
|
-
id: INVALID_ITEM_TO_EQUIP,
|
|
419
|
-
msg: '...'
|
|
420
|
-
}
|
|
421
|
-
```
|
|
422
|
-
* @throws {ItemLog} isAlreadyEquiped
|
|
423
|
-
If the item Is already equipped
|
|
424
|
-
```
|
|
425
|
-
{
|
|
426
|
-
id: ITEM_ALREADY_EQUIPED,
|
|
427
|
-
msg: '...'
|
|
428
|
-
}
|
|
429
|
-
```
|
|
430
|
-
* @memberof ItemManager
|
|
431
|
-
* @example
|
|
432
|
-
*
|
|
433
|
-
* ```ts
|
|
434
|
-
* import Sword from 'your-database/sword'
|
|
435
|
-
*
|
|
436
|
-
* try {
|
|
437
|
-
* player.addItem(Sword)
|
|
438
|
-
* player.equip(Sword)
|
|
439
|
-
* }
|
|
440
|
-
* catch (err) {
|
|
441
|
-
* console.log(err)
|
|
442
|
-
* }
|
|
443
|
-
* ```
|
|
444
|
-
*/
|
|
445
|
-
equip(itemClass, equip = true) {
|
|
446
|
-
const inventory = this.getItem(itemClass);
|
|
447
|
-
if (!inventory) {
|
|
448
|
-
throw ItemLog.notInInventory(itemClass);
|
|
449
|
-
}
|
|
450
|
-
if (itemClass._type == 'item') {
|
|
451
|
-
throw ItemLog.invalidToEquiped(itemClass);
|
|
452
|
-
}
|
|
453
|
-
if (this._class && this._class[ClassHooks.canEquip]) {
|
|
454
|
-
const canEquip = this['execMethodSync'](ClassHooks.canEquip, [inventory.item, this], this._class);
|
|
455
|
-
if (!canEquip) {
|
|
456
|
-
throw ItemLog.canNotEquip(itemClass);
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
const item = inventory.item;
|
|
460
|
-
if (item.equipped && equip) {
|
|
461
|
-
throw ItemLog.isAlreadyEquiped(itemClass);
|
|
462
|
-
}
|
|
463
|
-
item.equipped = equip;
|
|
464
|
-
if (!equip) {
|
|
465
|
-
const index = this.equipments.findIndex(it => it.id == item.id);
|
|
466
|
-
this.equipments.splice(index, 1);
|
|
467
|
-
}
|
|
468
|
-
else {
|
|
469
|
-
this.equipments.push(item);
|
|
470
|
-
}
|
|
471
|
-
this['execMethod']('onEquip', [this, equip], item);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
applyMixins(ItemManager, [GoldManager, StateManager, EffectManager]);
|
|
475
|
-
//# sourceMappingURL=ItemManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ItemManager.js","sourceRoot":"","sources":["../../src/Player/ItemManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAmF,MAAM,iBAAiB,CAAA;AACrI,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EACH,GAAG,EACH,IAAI,EACJ,IAAI,EACP,MAAM,YAAY,CAAA;AAEnB,MAAM,EACF,QAAQ,EACR,YAAY,EACZ,WAAW,EACd,GAAG,KAAK,CAAA;AAKT,MAAM,OAAO,WAAW;IAAxB;QAGI,eAAU,GAAmB,EAAE,CAAA;IAudnC,CAAC;IArdG;;;;;;;;;;;;;;;;MAgBE;IACF,OAAO,CAAC,SAA6B;QACjC,MAAM,KAAK,GAAW,IAAI,CAAC,aAAa,CAAC,SAAS,C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