@rpgjs/server 5.0.0-alpha.2 → 5.0.0-alpha.20

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.
Files changed (53) hide show
  1. package/dist/Gui/DialogGui.d.ts +4 -0
  2. package/dist/Gui/index.d.ts +1 -0
  3. package/dist/Player/BattleManager.d.ts +32 -22
  4. package/dist/Player/ClassManager.d.ts +31 -18
  5. package/dist/Player/ComponentManager.d.ts +123 -0
  6. package/dist/Player/Components.d.ts +345 -0
  7. package/dist/Player/EffectManager.d.ts +40 -0
  8. package/dist/Player/ElementManager.d.ts +31 -0
  9. package/dist/Player/GoldManager.d.ts +22 -0
  10. package/dist/Player/GuiManager.d.ts +176 -0
  11. package/dist/Player/ItemFixture.d.ts +6 -0
  12. package/dist/Player/ItemManager.d.ts +164 -10
  13. package/dist/Player/MoveManager.d.ts +32 -44
  14. package/dist/Player/ParameterManager.d.ts +343 -14
  15. package/dist/Player/Player.d.ts +266 -8
  16. package/dist/Player/SkillManager.d.ts +27 -19
  17. package/dist/Player/StateManager.d.ts +28 -35
  18. package/dist/Player/VariableManager.d.ts +30 -0
  19. package/dist/RpgServer.d.ts +227 -1
  20. package/dist/decorators/event.d.ts +46 -0
  21. package/dist/decorators/map.d.ts +177 -0
  22. package/dist/index.d.ts +4 -0
  23. package/dist/index.js +17436 -18167
  24. package/dist/index.js.map +1 -1
  25. package/dist/rooms/map.d.ts +486 -8
  26. package/package.json +17 -15
  27. package/src/Gui/DialogGui.ts +7 -2
  28. package/src/Gui/index.ts +3 -1
  29. package/src/Player/BattleManager.ts +97 -38
  30. package/src/Player/ClassManager.ts +95 -35
  31. package/src/Player/ComponentManager.ts +425 -19
  32. package/src/Player/Components.ts +380 -0
  33. package/src/Player/EffectManager.ts +110 -27
  34. package/src/Player/ElementManager.ts +126 -25
  35. package/src/Player/GoldManager.ts +32 -35
  36. package/src/Player/GuiManager.ts +187 -140
  37. package/src/Player/ItemFixture.ts +4 -5
  38. package/src/Player/ItemManager.ts +363 -48
  39. package/src/Player/MoveManager.ts +323 -308
  40. package/src/Player/ParameterManager.ts +499 -99
  41. package/src/Player/Player.ts +719 -80
  42. package/src/Player/SkillManager.ts +44 -23
  43. package/src/Player/StateManager.ts +210 -95
  44. package/src/Player/VariableManager.ts +180 -48
  45. package/src/RpgServer.ts +236 -1
  46. package/src/core/context.ts +1 -0
  47. package/src/decorators/event.ts +61 -0
  48. package/src/decorators/map.ts +198 -0
  49. package/src/index.ts +5 -1
  50. package/src/module.ts +24 -0
  51. package/src/rooms/map.ts +1054 -54
  52. package/dist/Player/Event.d.ts +0 -0
  53. package/src/Player/Event.ts +0 -0
@@ -1,42 +1,371 @@
1
- import { Constructor, RpgCommonPlayer } from '@rpgjs/common';
2
- export interface IWithParameterManager {
3
- parameters: Map<string, any>;
1
+ import { PlayerCtor } from '@rpgjs/common';
2
+ /**
3
+ * Interface for Parameter Manager functionality
4
+ *
5
+ * Provides comprehensive parameter management including health points (HP), skill points (SP),
6
+ * experience and level progression, custom parameters, and parameter modifiers.
7
+ */
8
+ export interface IParameterManager {
9
+ /**
10
+ * ```ts
11
+ * player.initialLevel = 5
12
+ * ```
13
+ *
14
+ * @title Set initial level
15
+ * @prop {number} player.initialLevel
16
+ * @default 1
17
+ * @memberof ParameterManager
18
+ * */
19
+ initialLevel: number;
20
+ /**
21
+ * ```ts
22
+ * player.finalLevel = 50
23
+ * ```
24
+ *
25
+ * @title Set final level
26
+ * @prop {number} player.finalLevel
27
+ * @default 99
28
+ * @memberof ParameterManager
29
+ * */
30
+ finalLevel: number;
31
+ /**
32
+ * With Object-based syntax, you can use following options:
33
+ * - `basis: number`
34
+ * - `extra: number`
35
+ * - `accelerationA: number`
36
+ * - `accelerationB: number`
37
+ * @title Change Experience Curve
38
+ * @prop {object} player.expCurve
39
+ * @default
40
+ * ```ts
41
+ * {
42
+ * basis: 30,
43
+ * extra: 20,
44
+ * accelerationA: 30,
45
+ * accelerationB: 30
46
+ * }
47
+ * ```
48
+ * @memberof ParameterManager
49
+ * */
50
+ expCurve: {
51
+ basis: number;
52
+ extra: number;
53
+ accelerationA: number;
54
+ accelerationB: number;
55
+ };
56
+ /**
57
+ * Changes the health points
58
+ * - Cannot exceed the MaxHP parameter
59
+ * - Cannot have a negative value
60
+ * - If the value is 0, a hook named `onDead()` is called in the RpgPlayer class.
61
+ *
62
+ * ```ts
63
+ * player.hp = 100
64
+ * ```
65
+ * @title Change HP
66
+ * @prop {number} player.hp
67
+ * @default MaxHPValue
68
+ * @memberof ParameterManager
69
+ * */
4
70
  hp: number;
71
+ /**
72
+ * Changes the skill points
73
+ * - Cannot exceed the MaxSP parameter
74
+ * - Cannot have a negative value
75
+ *
76
+ * ```ts
77
+ * player.sp = 200
78
+ * ```
79
+ * @title Change SP
80
+ * @prop {number} player.sp
81
+ * @default MaxSPValue
82
+ * @memberof ParameterManager
83
+ * */
5
84
  sp: number;
85
+ /**
86
+ * Changing the player's experience.
87
+ * ```ts
88
+ * player.exp += 100
89
+ * ```
90
+ *
91
+ * Levels are based on the experience curve.
92
+ *
93
+ * ```ts
94
+ * console.log(player.level) // 1
95
+ * console.log(player.expForNextlevel) // 150
96
+ * player.exp += 160
97
+ * console.log(player.level) // 2
98
+ * ```
99
+ *
100
+ * @title Change Experience
101
+ * @prop {number} player.exp
102
+ * @default 0
103
+ * @memberof ParameterManager
104
+ * */
6
105
  exp: number;
106
+ /**
107
+ * Changing the player's level.
108
+ *
109
+ * ```ts
110
+ * player.level += 1
111
+ * ```
112
+ *
113
+ * The level will be between the initial level given by the `initialLevel` and final level given by `finalLevel`
114
+ *
115
+ * ```ts
116
+ * player.finalLevel = 50
117
+ * player.level = 60
118
+ * console.log(player.level) // 50
119
+ * ```
120
+ *
121
+ * @title Change Level
122
+ * @prop {number} player.level
123
+ * @default 1
124
+ * @memberof ParameterManager
125
+ * */
7
126
  level: number;
8
- expForNextlevel: number;
9
- param: {
127
+ /**
128
+ * ```ts
129
+ * console.log(player.expForNextlevel) // 150
130
+ * ```
131
+ * @title Experience for next level ?
132
+ * @prop {number} player.expForNextlevel
133
+ * @readonly
134
+ * @memberof ParameterManager
135
+ * */
136
+ readonly expForNextlevel: number;
137
+ /**
138
+ * Read the value of a parameter. Put the name of the parameter.
139
+ *
140
+ * ```ts
141
+ * import { Presets } from '@rpgjs/server'
142
+ *
143
+ * const { MAXHP } = Presets
144
+ *
145
+ * console.log(player.param[MAXHP])
146
+ * ```
147
+ *
148
+ * > Possible to use the `player.getParamValue(name)` method instead
149
+ * @title Get Param Value
150
+ * @prop {object} player.param
151
+ * @readonly
152
+ * @memberof ParameterManager
153
+ * */
154
+ readonly param: {
10
155
  [key: string]: number;
11
156
  };
157
+ /**
158
+ * Direct parameter modifiers (reactive signal)
159
+ *
160
+ * > It is important that these parameters have been created beforehand with the `addParameter()` method.
161
+ * > By default, the following settings have been created:
162
+ * - maxhp
163
+ * - maxsp
164
+ * - str
165
+ * - int
166
+ * - dex
167
+ * - agi
168
+ *
169
+ * **Object Key**
170
+ *
171
+ * The key of the object is the name of the parameter
172
+ *
173
+ * > The good practice is to retrieve the name coming from a constant
174
+ *
175
+ * **Object Value**
176
+ *
177
+ * The value of the key is an object containing:
178
+ * ```
179
+ * {
180
+ * value: number,
181
+ * rate: number
182
+ * }
183
+ * ```
184
+ *
185
+ * - value: Adds a number to the parameter
186
+ * - rate: Adds a rate to the parameter
187
+ *
188
+ * > Note that you can put both (value and rate)
189
+ *
190
+ * This property uses reactive signals - changes automatically trigger parameter recalculation.
191
+ * The final parameter values in `param` include aggregated modifiers from equipment, states, etc.
192
+ *
193
+ * @prop {Object} [paramsModifier]
194
+ * @example
195
+ *
196
+ * ```ts
197
+ * import { Presets } from '@rpgjs/server'
198
+ *
199
+ * const { MAXHP } = Presets
200
+ *
201
+ * // Set direct modifiers (reactive)
202
+ * player.paramsModifier = {
203
+ * [MAXHP]: {
204
+ * value: 100
205
+ * }
206
+ * }
207
+ *
208
+ * // Parameters automatically recalculate
209
+ * console.log(player.param[MAXHP]); // Updated value
210
+ * ```
211
+ *
212
+ * @title Set Parameters Modifier
213
+ * @prop {object} paramsModifier
214
+ * @memberof ParameterManager
215
+ * */
12
216
  paramsModifier: {
13
217
  [key: string]: {
14
218
  value?: number;
15
219
  rate?: number;
16
220
  };
17
221
  };
222
+ /**
223
+ * Get or set the parameters object
224
+ *
225
+ * @prop {object} parameters
226
+ * @memberof ParameterManager
227
+ */
228
+ parameters: {
229
+ [key: string]: {
230
+ start: number;
231
+ end: number;
232
+ };
233
+ };
234
+ /**
235
+ * Get the value of a specific parameter by name
236
+ *
237
+ * @deprecated Use `player.param[name]` instead for better reactivity
238
+ * @param name - The name of the parameter to get
239
+ * @returns The calculated parameter value
240
+ *
241
+ * @example
242
+ * ```ts
243
+ * import { Presets } from '@rpgjs/server'
244
+ *
245
+ * const { MAXHP } = Presets
246
+ *
247
+ * // Preferred way (reactive)
248
+ * const maxHp = player.param[MAXHP];
249
+ *
250
+ * // Legacy way (still works)
251
+ * const maxHp = player.getParamValue(MAXHP);
252
+ * ```
253
+ */
254
+ getParamValue(name: string): number;
255
+ /**
256
+ * Give a new parameter. Give a start value and an end value.
257
+ * The start value will be set to the level set at `player.initialLevel` and the end value will be linked to the level set at `player.finalLevel`.
258
+ *
259
+ * ```ts
260
+ * const SPEED = 'speed'
261
+ *
262
+ * player.addParameter(SPEED, {
263
+ * start: 10,
264
+ * end: 100
265
+ * })
266
+ *
267
+ * player.param[SPEED] // 10
268
+ * player.level += 5
269
+ * player.param[SPEED] // 14
270
+ * ```
271
+ *
272
+ * @title Add custom parameters
273
+ * @method player.addParameter(name,curve)
274
+ * @param {string} name - The name of the parameter
275
+ * @param {object} curve - Scheme of the object: { start: number, end: number }
276
+ * @returns {void}
277
+ * @memberof ParameterManager
278
+ * */
279
+ addParameter(name: string, curve: {
280
+ start: number;
281
+ end: number;
282
+ }): void;
283
+ /**
284
+ * Gives back in percentage of health points to skill points
285
+ *
286
+ * ```ts
287
+ * import { Presets } from '@rpgjs/server'
288
+ *
289
+ * const { MAXHP } = Presets
290
+ *
291
+ * console.log(player.param[MAXHP]) // 800
292
+ * player.hp = 100
293
+ * player.recovery({ hp: 0.5 }) // = 800 * 0.5
294
+ * console.log(player.hp) // 400
295
+ * ```
296
+ *
297
+ * @title Recovery HP and/or SP
298
+ * @method player.recovery(params)
299
+ * @param {object} params - Scheme of the object: { hp: number, sp: number }. The values of the numbers must be in 0 and 1
300
+ * @returns {void}
301
+ * @memberof ParameterManager
302
+ * */
303
+ recovery(params: {
304
+ hp?: number;
305
+ sp?: number;
306
+ }): void;
307
+ /**
308
+ * restores all HP and SP
309
+ *
310
+ * ```ts
311
+ * import { Presets } from '@rpgjs/server'
312
+ *
313
+ * const { MAXHP, MAXSP } = Presets
314
+ *
315
+ * console.log(player.param[MAXHP], player.param[MAXSP]) // 800, 230
316
+ * player.hp = 100
317
+ * player.sp = 0
318
+ * player.allRecovery()
319
+ * console.log(player.hp, player.sp) // 800, 230
320
+ * ```
321
+ *
322
+ * @title All Recovery
323
+ * @method player.allRecovery()
324
+ * @returns {void}
325
+ * @memberof ParameterManager
326
+ * */
327
+ allRecovery(): void;
18
328
  }
19
329
  /**
20
- * Mixin that adds parameter management functionality to a player class.
330
+ * Parameter Manager Mixin with Reactive Signals
331
+ *
332
+ * Provides comprehensive parameter management functionality using reactive signals from `@signe/reactive`.
333
+ * This mixin handles health points (HP), skill points (SP), experience and level progression,
334
+ * custom parameters, and parameter modifiers with automatic reactivity.
21
335
  *
22
- * This mixin provides comprehensive parameter management including:
23
- * - Health Points (HP) and Skill Points (SP) management
24
- * - Experience and level progression system
25
- * - Custom parameter creation and modification
26
- * - Parameter modifiers for temporary stat changes
336
+ * **Key Features:**
337
+ * - **Reactive Parameters**: All parameters automatically recalculate when level or modifiers change
338
+ * - 🚀 **Performance Optimized**: Uses computed signals to avoid unnecessary recalculations
339
+ * - 🔄 **Real-time Updates**: Changes propagate automatically throughout the system
340
+ * - 🎯 **Type Safe**: Full TypeScript support with proper type inference
27
341
  *
28
342
  * @template TBase - The base class constructor type
29
- * @param Base - The base class to extend
30
- * @returns A new class that extends the base with parameter management capabilities
343
+ * @param Base - The base class to extend with parameter management
344
+ * @returns Extended class with reactive parameter management methods
31
345
  *
32
346
  * @example
33
347
  * ```ts
34
348
  * class MyPlayer extends WithParameterManager(BasePlayer) {
35
349
  * constructor() {
36
350
  * super();
351
+ *
352
+ * // Add custom parameters
37
353
  * this.addParameter('strength', { start: 10, end: 100 });
354
+ * this.addParameter('magic', { start: 5, end: 80 });
38
355
  * }
39
356
  * }
357
+ *
358
+ * const player = new MyPlayer();
359
+ *
360
+ * // Reactive parameter updates
361
+ * player.level = 5;
362
+ * console.log(player.param.strength); // Automatically calculated for level 5
363
+ *
364
+ * // Reactive modifiers
365
+ * player.paramsModifier = {
366
+ * [MAXHP]: { value: 100, rate: 1.2 }
367
+ * };
368
+ * console.log(player.param[MAXHP]); // Automatically includes modifiers
40
369
  * ```
41
370
  */
42
- export declare function WithParameterManager<TBase extends Constructor<RpgCommonPlayer>>(Base: TBase): TBase & Constructor<IWithParameterManager>;
371
+ export declare function WithParameterManager<TBase extends PlayerCtor>(Base: TBase): TBase;
@@ -1,4 +1,4 @@
1
- import { RpgCommonPlayer, ShowAnimationParams, Constructor, ZoneOptions } from '@rpgjs/common';
1
+ import { Hooks, RpgCommonPlayer, Constructor, Direction, AttachShapeOptions, RpgShape } from '@rpgjs/common';
2
2
  import { IComponentManager } from './ComponentManager';
3
3
  import { RpgMap } from '../rooms/map';
4
4
  import { Context } from '@signe/di';
@@ -6,19 +6,66 @@ import { IGuiManager } from './GuiManager';
6
6
  import { MockConnection } from '@signe/room';
7
7
  import { IMoveManager } from './MoveManager';
8
8
  import { IGoldManager } from './GoldManager';
9
- import { IWithVariableManager } from './VariableManager';
10
- import { IWithParameterManager } from './ParameterManager';
11
- import { IWithSkillManager } from './SkillManager';
9
+ import { IVariableManager } from './VariableManager';
10
+ import { IParameterManager } from './ParameterManager';
11
+ import { IItemManager } from './ItemManager';
12
+ import { IEffectManager } from './EffectManager';
13
+ import { IElementManager } from './ElementManager';
14
+ import { ISkillManager } from './SkillManager';
15
+ import { IBattleManager } from './BattleManager';
16
+ import { IClassManager } from './ClassManager';
17
+ import { IStateManager } from './StateManager';
12
18
  declare const RpgPlayer_base: Constructor<RpgCommonPlayer>;
13
19
  /**
14
20
  * RPG Player class with component management capabilities
21
+ *
22
+ * Combines all player mixins to provide a complete player implementation
23
+ * with graphics, movement, inventory, skills, and battle capabilities.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * // Create a new player
28
+ * const player = new RpgPlayer();
29
+ *
30
+ * // Set player graphics
31
+ * player.setGraphic("hero");
32
+ *
33
+ * // Add parameters and items
34
+ * player.addParameter("strength", { start: 10, end: 100 });
35
+ * player.addItem(sword);
36
+ * ```
15
37
  */
16
38
  export declare class RpgPlayer extends RpgPlayer_base {
17
39
  map: RpgMap | null;
18
40
  context?: Context;
19
41
  conn: MockConnection | null;
42
+ touchSide: boolean;
43
+ /** Internal: Shapes attached to this player */
44
+ private _attachedShapes;
45
+ /** Internal: Shapes where this player is currently located */
46
+ private _inShapes;
47
+ /** Last processed client input timestamp for reconciliation */
48
+ lastProcessedInputTs: number;
49
+ /** Last processed client input frame for reconciliation with server tick */
50
+ _lastFramePositions: {
51
+ frame: number;
52
+ position: {
53
+ x: number;
54
+ y: number;
55
+ direction: Direction;
56
+ };
57
+ serverTick?: number;
58
+ } | null;
59
+ frames: {
60
+ x: number;
61
+ y: number;
62
+ ts: number;
63
+ }[];
20
64
  events: import('@signe/reactive').WritableArraySignal<RpgEvent[]>;
21
65
  constructor();
66
+ _onInit(): void;
67
+ get hooks(): Hooks;
68
+ applyFrames(): void;
22
69
  execMethod(method: string, methodData?: any[], target?: any): Promise<any>;
23
70
  /**
24
71
  * Change the map for this player
@@ -41,13 +88,63 @@ export declare class RpgPlayer extends RpgPlayer_base {
41
88
  y: number;
42
89
  z?: number;
43
90
  } | string): Promise<any | null | boolean>;
91
+ /**
92
+ * Auto change map when player touches map borders
93
+ *
94
+ * This method checks if the player touches the current map borders
95
+ * and automatically performs a change to the adjacent map if it exists.
96
+ *
97
+ * @param nextPosition - The next position of the player
98
+ * @returns Promise<boolean> - true if a map change occurred
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * // Called automatically by the movement system
103
+ * const changed = await player.autoChangeMap({ x: newX, y: newY });
104
+ * if (changed) {
105
+ * console.log('Player changed map automatically');
106
+ * }
107
+ * ```
108
+ */
109
+ autoChangeMap(nextPosition: {
110
+ x: number;
111
+ y: number;
112
+ }, forcedDirection?: any): Promise<boolean>;
44
113
  teleport(positions: {
45
114
  x: number;
46
115
  y: number;
47
116
  }): Promise<false | undefined>;
48
117
  getCurrentMap<T extends RpgMap = RpgMap>(): T | null;
49
118
  emit(type: string, value?: any): void;
50
- showAnimation(params: ShowAnimationParams): void;
119
+ save(): Promise<string>;
120
+ load(snapshot: string): Promise<void>;
121
+ /**
122
+ * Set the current animation of the player's sprite
123
+ *
124
+ * This method changes the animation state of the player's current sprite.
125
+ * It's used to trigger character animations like attack, skill, or custom movements.
126
+ * When `nbTimes` is set to a finite number, the animation will play that many times
127
+ * before returning to the previous animation state.
128
+ *
129
+ * @param animationName - The name of the animation to play (e.g., 'attack', 'skill', 'walk')
130
+ * @param nbTimes - Number of times to repeat the animation (default: Infinity for continuous)
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * // Set continuous walk animation
135
+ * player.setAnimation('walk');
136
+ *
137
+ * // Play attack animation 3 times then return to previous state
138
+ * player.setAnimation('attack', 3);
139
+ *
140
+ * // Play skill animation once
141
+ * player.setAnimation('skill', 1);
142
+ *
143
+ * // Set idle/stand animation
144
+ * player.setAnimation('stand');
145
+ * ```
146
+ */
147
+ setAnimation(animationName: string, nbTimes?: number): void;
51
148
  /**
52
149
  * Run the change detection cycle. Normally, as soon as a hook is called in a class, the cycle is started. But you can start it manually
53
150
  * The method calls the `onChanges` method on events and synchronizes all map data with the client.
@@ -60,14 +157,175 @@ export declare class RpgPlayer extends RpgPlayer_base {
60
157
  syncChanges(): void;
61
158
  databaseById(id: string): any;
62
159
  private _eventChanges;
63
- attachShape(id: string, options: ZoneOptions): void;
64
- broadcastEffect(id: string, params: any): void;
160
+ /**
161
+ * Attach a zone shape to this player using the physic zone system
162
+ *
163
+ * This method creates a zone attached to the player's entity in the physics engine.
164
+ * The zone can be circular or cone-shaped and will detect other entities (players/events)
165
+ * entering or exiting the zone.
166
+ *
167
+ * @param id - Optional zone identifier. If not provided, a unique ID will be generated
168
+ * @param options - Zone configuration options
169
+ *
170
+ * @example
171
+ * ```ts
172
+ * // Create a circular detection zone
173
+ * player.attachShape("vision", {
174
+ * radius: 150,
175
+ * angle: 360,
176
+ * });
177
+ *
178
+ * // Create a cone-shaped vision zone
179
+ * player.attachShape("vision", {
180
+ * radius: 200,
181
+ * angle: 120,
182
+ * direction: Direction.Right,
183
+ * limitedByWalls: true,
184
+ * });
185
+ *
186
+ * // Create a zone with width/height (radius calculated automatically)
187
+ * player.attachShape({
188
+ * width: 100,
189
+ * height: 100,
190
+ * positioning: "center",
191
+ * });
192
+ * ```
193
+ */
194
+ attachShape(idOrOptions: string | AttachShapeOptions, options?: AttachShapeOptions): RpgShape | undefined;
195
+ /**
196
+ * Get all shapes attached to this player
197
+ *
198
+ * Returns all shapes that were created using `attachShape()` on this player.
199
+ *
200
+ * @returns Array of RpgShape instances attached to this player
201
+ *
202
+ * @example
203
+ * ```ts
204
+ * player.attachShape("vision", { radius: 150 });
205
+ * player.attachShape("detection", { radius: 100 });
206
+ *
207
+ * const shapes = player.getShapes();
208
+ * console.log(shapes.length); // 2
209
+ * ```
210
+ */
211
+ getShapes(): RpgShape[];
212
+ /**
213
+ * Get all shapes where this player is currently located
214
+ *
215
+ * Returns all shapes (from any player/event) where this player is currently inside.
216
+ * This is updated automatically when the player enters or exits shapes.
217
+ *
218
+ * @returns Array of RpgShape instances where this player is located
219
+ *
220
+ * @example
221
+ * ```ts
222
+ * // Another player has a detection zone
223
+ * otherPlayer.attachShape("detection", { radius: 200 });
224
+ *
225
+ * // Check if this player is in any shape
226
+ * const inShapes = player.getInShapes();
227
+ * if (inShapes.length > 0) {
228
+ * console.log("Player is being detected!");
229
+ * }
230
+ * ```
231
+ */
232
+ getInShapes(): RpgShape[];
233
+ /**
234
+ * Show a temporary component animation on this player
235
+ *
236
+ * This method broadcasts a component animation to all clients, allowing
237
+ * temporary visual effects like hit indicators, spell effects, or status animations
238
+ * to be displayed on the player.
239
+ *
240
+ * @param id - The ID of the component animation to display
241
+ * @param params - Parameters to pass to the component animation
242
+ *
243
+ * @example
244
+ * ```ts
245
+ * // Show a hit animation with damage text
246
+ * player.showComponentAnimation("hit", {
247
+ * text: "150",
248
+ * color: "red"
249
+ * });
250
+ *
251
+ * // Show a heal animation
252
+ * player.showComponentAnimation("heal", {
253
+ * amount: 50
254
+ * });
255
+ * ```
256
+ */
257
+ showComponentAnimation(id: string, params?: any): void;
65
258
  showHit(text: string): void;
259
+ /**
260
+ * Play a sound on the client side for this player only
261
+ *
262
+ * This method emits an event to play a sound only for this specific player.
263
+ * The sound must be defined on the client side (in the client module configuration).
264
+ *
265
+ * ## Design
266
+ *
267
+ * The sound is sent only to this player's client connection, making it ideal
268
+ * for personal feedback sounds like UI interactions, notifications, or personal
269
+ * achievements. For map-wide sounds that all players should hear, use `map.playSound()` instead.
270
+ *
271
+ * @param soundId - Sound identifier, defined on the client side
272
+ * @param options - Optional sound configuration
273
+ * @param options.volume - Volume level (0.0 to 1.0, default: 1.0)
274
+ * @param options.loop - Whether the sound should loop (default: false)
275
+ *
276
+ * @example
277
+ * ```ts
278
+ * // Play a sound for this player only (default behavior)
279
+ * player.playSound("item-pickup");
280
+ *
281
+ * // Play a sound with volume and loop
282
+ * player.playSound("background-music", {
283
+ * volume: 0.5,
284
+ * loop: true
285
+ * });
286
+ *
287
+ * // Play a notification sound at low volume
288
+ * player.playSound("notification", { volume: 0.3 });
289
+ * ```
290
+ */
291
+ playSound(soundId: string, options?: {
292
+ volume?: number;
293
+ loop?: boolean;
294
+ }): void;
295
+ /**
296
+ * Stop a sound that is currently playing for this player
297
+ *
298
+ * This method stops a sound that was previously started with `playSound()`.
299
+ * The sound must be defined on the client side.
300
+ *
301
+ * @param soundId - Sound identifier to stop
302
+ *
303
+ * @example
304
+ * ```ts
305
+ * // Start a looping background music
306
+ * player.playSound("background-music", { loop: true });
307
+ *
308
+ * // Later, stop it
309
+ * player.stopSound("background-music");
310
+ * ```
311
+ */
312
+ stopSound(soundId: string): void;
313
+ /**
314
+ * Set the sync schema for the map
315
+ * @param schema - The schema to set
316
+ */
317
+ setSync(schema: any): void;
66
318
  }
67
319
  export declare class RpgEvent extends RpgPlayer {
68
320
  execMethod(methodName: string, methodData?: any[], instance?: this): Promise<any>;
69
321
  remove(): void;
70
322
  }
71
- export interface RpgPlayer extends RpgCommonPlayer, IComponentManager, IGuiManager, IMoveManager, IGoldManager, IWithVariableManager, IWithParameterManager, IWithSkillManager {
323
+ /**
324
+ * Interface extension for RpgPlayer
325
+ *
326
+ * Extends the RpgPlayer class with additional interfaces from mixins.
327
+ * This provides proper TypeScript support for all mixin methods and properties.
328
+ */
329
+ export interface RpgPlayer extends IVariableManager, IMoveManager, IGoldManager, IComponentManager, IGuiManager, IItemManager, IEffectManager, IParameterManager, IElementManager, ISkillManager, IBattleManager, IClassManager, IStateManager {
72
330
  }
73
331
  export {};