@kbve/laser 0.0.6

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 (56) hide show
  1. package/README.md +11 -0
  2. package/package.json +43 -0
  3. package/src/index.d.ts +17 -0
  4. package/src/index.js +34 -0
  5. package/src/index.js.map +1 -0
  6. package/src/lib/animations/TypewriterComponent.d.ts +8 -0
  7. package/src/lib/animations/TypewriterComponent.js +53 -0
  8. package/src/lib/animations/TypewriterComponent.js.map +1 -0
  9. package/src/lib/eventhandler.d.ts +31 -0
  10. package/src/lib/eventhandler.js +45 -0
  11. package/src/lib/eventhandler.js.map +1 -0
  12. package/src/lib/icon/CollapseIcon.d.ts +4 -0
  13. package/src/lib/icon/CollapseIcon.js +10 -0
  14. package/src/lib/icon/CollapseIcon.js.map +1 -0
  15. package/src/lib/icon/ExpandIcon.d.ts +4 -0
  16. package/src/lib/icon/ExpandIcon.js +10 -0
  17. package/src/lib/icon/ExpandIcon.js.map +1 -0
  18. package/src/lib/laser.d.ts +1 -0
  19. package/src/lib/laser.js +8 -0
  20. package/src/lib/laser.js.map +1 -0
  21. package/src/lib/localdb.d.ts +55 -0
  22. package/src/lib/localdb.js +591 -0
  23. package/src/lib/localdb.js.map +1 -0
  24. package/src/lib/minigame/dice/MinigameDice.d.ts +4 -0
  25. package/src/lib/minigame/dice/MinigameDice.js +85 -0
  26. package/src/lib/minigame/dice/MinigameDice.js.map +1 -0
  27. package/src/lib/phaser/monster/bird.d.ts +7 -0
  28. package/src/lib/phaser/monster/bird.js +44 -0
  29. package/src/lib/phaser/monster/bird.js.map +1 -0
  30. package/src/lib/phaser/npc/chatbubble.d.ts +10 -0
  31. package/src/lib/phaser/npc/chatbubble.js +78 -0
  32. package/src/lib/phaser/npc/chatbubble.js.map +1 -0
  33. package/src/lib/phaser/npc/npcdatabase.d.ts +56 -0
  34. package/src/lib/phaser/npc/npcdatabase.js +497 -0
  35. package/src/lib/phaser/npc/npcdatabase.js.map +1 -0
  36. package/src/lib/phaser/npc/npchandler.d.ts +20 -0
  37. package/src/lib/phaser/npc/npchandler.js +114 -0
  38. package/src/lib/phaser/npc/npchandler.js.map +1 -0
  39. package/src/lib/phaser/npc/tooltipmenu.d.ts +17 -0
  40. package/src/lib/phaser/npc/tooltipmenu.js +68 -0
  41. package/src/lib/phaser/npc/tooltipmenu.js.map +1 -0
  42. package/src/lib/phaser/player/playercontroller.d.ts +24 -0
  43. package/src/lib/phaser/player/playercontroller.js +219 -0
  44. package/src/lib/phaser/player/playercontroller.js.map +1 -0
  45. package/src/lib/quadtree.d.ts +37 -0
  46. package/src/lib/quadtree.js +123 -0
  47. package/src/lib/quadtree.js.map +1 -0
  48. package/src/lib/utils/debug.d.ts +8 -0
  49. package/src/lib/utils/debug.js +46 -0
  50. package/src/lib/utils/debug.js.map +1 -0
  51. package/src/lib/utils/ulid.d.ts +1 -0
  52. package/src/lib/utils/ulid.js +38 -0
  53. package/src/lib/utils/ulid.js.map +1 -0
  54. package/src/types.d.ts +355 -0
  55. package/src/types.js +9 -0
  56. package/src/types.js.map +1 -0
package/src/types.d.ts ADDED
@@ -0,0 +1,355 @@
1
+ export interface IPlayerStats {
2
+ username: string;
3
+ health: string;
4
+ mana: string;
5
+ energy: string;
6
+ maxHealth: string;
7
+ maxMana: string;
8
+ maxEnergy: string;
9
+ armour: string;
10
+ agility: string;
11
+ strength: string;
12
+ intelligence: string;
13
+ experience: string;
14
+ reputation: string;
15
+ faith: string;
16
+ }
17
+ export interface IconProps {
18
+ styleClass?: string;
19
+ size?: number;
20
+ color?: string;
21
+ onClick?: () => void;
22
+ [key: string]: any;
23
+ }
24
+ export interface UserGenericMenu {
25
+ id: string | null;
26
+ position: {
27
+ x: number;
28
+ y: number;
29
+ };
30
+ }
31
+ export interface UserSettings {
32
+ tooltipItem: UserGenericMenu;
33
+ submenuItem: UserGenericMenu;
34
+ tooltipNPC: UserGenericMenu;
35
+ isStatsMenuCollapsed: boolean;
36
+ isSettingsMenuCollapsed: boolean;
37
+ debugMode: boolean;
38
+ }
39
+ export interface IStatBoost extends Partial<IPlayerStats> {
40
+ duration: number;
41
+ expiry?: number;
42
+ }
43
+ export interface IPlayerState {
44
+ inCombat: boolean;
45
+ isDead: boolean;
46
+ isResting: boolean;
47
+ activeBoosts: Record<string, IStatBoost>;
48
+ }
49
+ export interface IObject {
50
+ id: string;
51
+ name: string;
52
+ type: string;
53
+ category?: string;
54
+ description?: string;
55
+ img?: string;
56
+ bonuses?: {
57
+ armor?: string;
58
+ intelligence?: string;
59
+ health?: string;
60
+ mana?: string;
61
+ energy?: string;
62
+ [key: string]: string | undefined;
63
+ };
64
+ durability?: string;
65
+ weight?: string;
66
+ equipped?: boolean;
67
+ consumable?: boolean;
68
+ cooldown?: string;
69
+ slug?: string;
70
+ craftingMaterials?: string[];
71
+ rarity?: string;
72
+ }
73
+ export interface IConsumable extends IObject {
74
+ type: 'food' | 'scroll' | 'drink' | 'potion';
75
+ effects: {
76
+ health?: number;
77
+ mana?: number;
78
+ energy?: number;
79
+ [key: string]: number | undefined;
80
+ };
81
+ boost?: IStatBoost;
82
+ duration?: number;
83
+ action?: string;
84
+ }
85
+ export interface ItemAction {
86
+ actionEvent: 'consume' | 'equip' | 'unequip' | 'discard' | 'view';
87
+ actionDetails?: string;
88
+ }
89
+ export interface IObjectAction extends ItemAction {
90
+ itemId: string;
91
+ itemObject: IObject;
92
+ actionId: string;
93
+ }
94
+ export interface IEquipment extends IObject {
95
+ type: 'head' | 'body' | 'legs' | 'feet' | 'hands' | 'weapon' | 'shield' | 'accessory';
96
+ bonuses?: {
97
+ armor?: string;
98
+ intelligence?: string;
99
+ health?: string;
100
+ mana?: string;
101
+ [key: string]: string | undefined;
102
+ };
103
+ durability?: string;
104
+ weight?: string;
105
+ }
106
+ export interface IPlayerInventory {
107
+ backpack: string[];
108
+ equipment: {
109
+ head: string | null;
110
+ body: string | null;
111
+ legs: string | null;
112
+ feet: string | null;
113
+ hands: string | null;
114
+ weapon: string | null;
115
+ shield: string | null;
116
+ accessory: string | null;
117
+ };
118
+ }
119
+ export interface IPlayerData {
120
+ stats: IPlayerStats;
121
+ inventory: IPlayerInventory;
122
+ state: IPlayerState;
123
+ }
124
+ export interface NotificationType {
125
+ type: 'caution' | 'warning' | 'danger' | 'success' | 'info';
126
+ color: string;
127
+ imgUrl: string;
128
+ }
129
+ export interface INotification {
130
+ id: number;
131
+ title: string;
132
+ message: string;
133
+ notificationType: NotificationType;
134
+ }
135
+ /**
136
+ *
137
+ * IQuest - Slay 15 Goblins in the Castle and kill their leader.
138
+ * - IJournal 1 - Go to the Castle
139
+ * - ITask (1) -> (is X, Y Zone within Castle)
140
+ * - IJournal 2 - KIll 15 Goblins
141
+ * - ITask (15) -> Kill a Goblin
142
+ * - IJournal 3 - Slay The Goblin Leader
143
+ * - ITask (1) -> Kill Goblin Leader
144
+ *
145
+ */
146
+ export interface ITask<T = any> {
147
+ id: string;
148
+ name: string;
149
+ description: string;
150
+ isComplete: boolean;
151
+ action: T;
152
+ }
153
+ export interface IJournal<T = any> {
154
+ id: string;
155
+ title: string;
156
+ tasks: ITask<T>[];
157
+ isComplete: boolean;
158
+ }
159
+ export interface IQuest<T = any> {
160
+ id: string;
161
+ title: string;
162
+ description: string;
163
+ journals: IJournal<T>[];
164
+ isComplete: boolean;
165
+ reward: string;
166
+ }
167
+ export interface ItemActionEventData {
168
+ itemId: string;
169
+ action: ItemAction['actionEvent'];
170
+ }
171
+ export interface PlayerViewItem {
172
+ itemId: string;
173
+ }
174
+ export interface NotificationEventData {
175
+ title: string;
176
+ message: string;
177
+ notificationType: NotificationType;
178
+ }
179
+ export interface PlayerRewardEvent {
180
+ message: string;
181
+ item: IObject;
182
+ }
183
+ export interface PlayerCombatDamage {
184
+ damage: string;
185
+ }
186
+ export interface PlayerStealEventData<T = any> {
187
+ npcId: string;
188
+ npcName: string;
189
+ data?: T;
190
+ }
191
+ export interface NPCInteractionEventData<T = any> {
192
+ npcId: string;
193
+ npcName: string;
194
+ actions: string[];
195
+ data?: T;
196
+ coords: {
197
+ x: number;
198
+ y: number;
199
+ };
200
+ }
201
+ export interface NPCMessageEventData {
202
+ npcId: string;
203
+ npcName: string;
204
+ message: string;
205
+ }
206
+ export interface PlayerMoveEventData {
207
+ x: number;
208
+ y: number;
209
+ }
210
+ export interface OpenModalEventData {
211
+ message: string;
212
+ }
213
+ export interface PlayerEventData extends IPlayerData {
214
+ account: string;
215
+ }
216
+ export interface SceneTransitionEventData {
217
+ newSceneKey: string;
218
+ additionalInfo?: string;
219
+ }
220
+ export interface CharacterEventData {
221
+ message: string;
222
+ character_name?: string;
223
+ character_image?: string;
224
+ background_image?: string;
225
+ }
226
+ export interface WASMEventData {
227
+ result: {
228
+ value: number;
229
+ description: string;
230
+ };
231
+ }
232
+ export interface GameEvent {
233
+ type: 'levelUp' | 'itemFound';
234
+ payload: {
235
+ level?: number;
236
+ item?: string;
237
+ };
238
+ }
239
+ export interface TaskCompletionEventData {
240
+ taskId: string;
241
+ isComplete: boolean;
242
+ }
243
+ export interface MinigameDiceProps {
244
+ styleClass?: string;
245
+ textures: DiceTextures;
246
+ diceCount: number;
247
+ }
248
+ export type GameMode = 'Idle' | 'Dice' | 'Slot' | 'War';
249
+ export interface DiceAction {
250
+ type: 'ROLL_DICE';
251
+ diceValues: number[];
252
+ isRolling: boolean;
253
+ }
254
+ export interface SlotAction {
255
+ type: 'SPIN_SLOT';
256
+ slotValues: number[];
257
+ }
258
+ export interface WarAction {
259
+ type: 'PLAY_WAR';
260
+ playerCard: string;
261
+ opponentCard: string;
262
+ }
263
+ export type MinigameAction = DiceAction | SlotAction | WarAction;
264
+ export interface DiceTextures {
265
+ side1: string;
266
+ side2: string;
267
+ side3: string;
268
+ side4: string;
269
+ side5: string;
270
+ side6: string;
271
+ }
272
+ export interface SlotTextures {
273
+ reel1: string;
274
+ reel2: string;
275
+ reel3: string;
276
+ }
277
+ export interface WarTextures {
278
+ cardBack: string;
279
+ playerCards: {
280
+ [key: string]: string;
281
+ };
282
+ opponentCards: {
283
+ [key: string]: string;
284
+ };
285
+ }
286
+ export type MinigameTextures = DiceTextures | SlotTextures | WarTextures;
287
+ export interface MinigameState {
288
+ gamemode: GameMode;
289
+ action: MinigameAction;
290
+ textures: MinigameTextures;
291
+ }
292
+ export interface DiceRollResultEventData {
293
+ diceValues: number[];
294
+ }
295
+ export declare function isDiceAction(action: MinigameAction): action is DiceAction;
296
+ export interface INPCPosition {
297
+ x: number;
298
+ y: number;
299
+ }
300
+ export interface INPCData {
301
+ id: string;
302
+ name: string;
303
+ spriteKey: string;
304
+ walkingAnimationMapping: number;
305
+ startPosition: INPCPosition;
306
+ speed: number;
307
+ scale: number;
308
+ slug: string;
309
+ actions: NPCAction[];
310
+ effects?: string[];
311
+ stats?: IPlayerStats;
312
+ spriteImageId?: string;
313
+ avatarImageId?: string;
314
+ dialogues?: INPCDialogue[];
315
+ }
316
+ export interface ISprite {
317
+ id: string;
318
+ spriteName: string;
319
+ assetLocation: string;
320
+ frameWidth: number;
321
+ frameHeight: number;
322
+ scale?: number;
323
+ spriteData?: Blob;
324
+ slug: string;
325
+ }
326
+ export interface IAvatar {
327
+ id: string;
328
+ avatarName: string;
329
+ avatarLocation: string;
330
+ avatarData: Blob;
331
+ slug: string;
332
+ }
333
+ export type NPCAction = 'talk' | 'quest' | 'trade' | 'combat' | 'heal' | 'steal' | 'lore';
334
+ export interface INPCDialogue {
335
+ dialogueId: string;
336
+ read: boolean;
337
+ priority: number;
338
+ }
339
+ export interface IDialogueObject {
340
+ id: string;
341
+ title: string;
342
+ message: string;
343
+ playerResponse?: string;
344
+ actions?: string[];
345
+ options?: string[];
346
+ style?: string;
347
+ backgroundImage?: string;
348
+ }
349
+ export interface NPCDialogueEventData {
350
+ npcId: string;
351
+ dialogue: IDialogueObject & {
352
+ priority: number;
353
+ read: boolean;
354
+ };
355
+ }
package/src/types.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDiceAction = void 0;
4
+ // Type Guards
5
+ function isDiceAction(action) {
6
+ return action.type === 'ROLL_DICE';
7
+ }
8
+ exports.isDiceAction = isDiceAction;
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../packages/laser/src/types.ts"],"names":[],"mappings":";;;AAmWA,cAAc;AAEd,SAAgB,YAAY,CAAC,MAAsB;IACjD,OAAO,MAAM,CAAC,IAAI,KAAK,WAAW,CAAC;AACrC,CAAC;AAFD,oCAEC"}