@kbve/laser 0.1.2 → 0.1.5
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/laser.es.js +2387 -870
- package/package.json +1 -1
package/laser.es.js
CHANGED
|
@@ -1,872 +1,2389 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Canvas as
|
|
5
|
-
import { query as
|
|
1
|
+
import { createContext as e, forwardRef as t, useContext as n, useEffect as r, useImperativeHandle as i, useMemo as a, useRef as o, useState as s, useSyncExternalStore as c } from "react";
|
|
2
|
+
import l from "phaser";
|
|
3
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
4
|
+
import { Canvas as ee, useFrame as p } from "@react-three/fiber";
|
|
5
|
+
import { query as m } from "bitecs";
|
|
6
|
+
import { RAPIER as h, createRapierPhysics as g } from "@phaserjs/rapier-connector";
|
|
6
7
|
export * from "bitecs";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
function
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
function
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
);
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
function
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
8
|
+
//#region \0rolldown/runtime.js
|
|
9
|
+
var _ = Object.defineProperty, v = Object.getOwnPropertyDescriptor, te = Object.getOwnPropertyNames, ne = Object.prototype.hasOwnProperty, re = (e, t) => {
|
|
10
|
+
let n = {};
|
|
11
|
+
for (var r in e) _(n, r, {
|
|
12
|
+
get: e[r],
|
|
13
|
+
enumerable: !0
|
|
14
|
+
});
|
|
15
|
+
return t || _(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
16
|
+
}, ie = (e, t, n, r) => {
|
|
17
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = te(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !ne.call(e, s) && s !== n && _(e, s, {
|
|
18
|
+
get: ((e) => t[e]).bind(null, s),
|
|
19
|
+
enumerable: !(r = v(t, s)) || r.enumerable
|
|
20
|
+
});
|
|
21
|
+
return e;
|
|
22
|
+
}, ae = (e, t, n) => (ie(e, t, "default"), n && ie(n, t, "default")), y = class {
|
|
23
|
+
handlers = /* @__PURE__ */ new Map();
|
|
24
|
+
errorHandlers = /* @__PURE__ */ new Set();
|
|
25
|
+
history = [];
|
|
26
|
+
trace = !1;
|
|
27
|
+
historySize = 0;
|
|
28
|
+
on(e, t) {
|
|
29
|
+
let n = this.handlers.get(e);
|
|
30
|
+
return n || (n = /* @__PURE__ */ new Set(), this.handlers.set(e, n)), n.add(t), () => {
|
|
31
|
+
n.delete(t);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
once(e, t) {
|
|
35
|
+
let n = this.on(e, ((e) => {
|
|
36
|
+
n(), t(e);
|
|
37
|
+
}));
|
|
38
|
+
return n;
|
|
39
|
+
}
|
|
40
|
+
off(e, t) {
|
|
41
|
+
this.handlers.get(e)?.delete(t);
|
|
42
|
+
}
|
|
43
|
+
emit(e, t) {
|
|
44
|
+
(this.trace || this.historySize > 0) && this.record(e, t);
|
|
45
|
+
let n = this.handlers.get(e);
|
|
46
|
+
if (n) for (let r of [...n]) try {
|
|
47
|
+
r(t);
|
|
48
|
+
} catch (n) {
|
|
49
|
+
this.reportError(n, String(e), t);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
onError(e) {
|
|
53
|
+
return this.errorHandlers.add(e), () => {
|
|
54
|
+
this.errorHandlers.delete(e);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
setDebug(e) {
|
|
58
|
+
e.trace !== void 0 && (this.trace = e.trace), e.historySize !== void 0 && (this.historySize = Math.max(0, e.historySize), this.history.length > this.historySize && this.history.splice(0, this.history.length - this.historySize));
|
|
59
|
+
}
|
|
60
|
+
getHistory() {
|
|
61
|
+
return this.history;
|
|
62
|
+
}
|
|
63
|
+
dumpHistory() {
|
|
64
|
+
console.table(this.history.map((e) => ({
|
|
65
|
+
event: e.event,
|
|
66
|
+
time: new Date(e.time).toISOString().slice(11, 23),
|
|
67
|
+
data: e.data
|
|
68
|
+
})));
|
|
69
|
+
}
|
|
70
|
+
listenerCount(e) {
|
|
71
|
+
return this.handlers.get(e)?.size ?? 0;
|
|
72
|
+
}
|
|
73
|
+
eventNames() {
|
|
74
|
+
return [...this.handlers.keys()];
|
|
75
|
+
}
|
|
76
|
+
clear() {
|
|
77
|
+
this.handlers.clear(), this.history.length = 0;
|
|
78
|
+
}
|
|
79
|
+
record(e, t) {
|
|
80
|
+
this.trace && console.debug(`[laser] ${String(e)}`, t), this.historySize > 0 && (this.history.push({
|
|
81
|
+
event: String(e),
|
|
82
|
+
data: t,
|
|
83
|
+
time: Date.now()
|
|
84
|
+
}), this.history.length > this.historySize && this.history.shift());
|
|
85
|
+
}
|
|
86
|
+
reportError(e, t, n) {
|
|
87
|
+
if (this.errorHandlers.size > 0) for (let r of this.errorHandlers) try {
|
|
88
|
+
r(e, t, n);
|
|
89
|
+
} catch {}
|
|
90
|
+
else console.error(`[laser] handler for "${t}" threw:`, e);
|
|
91
|
+
}
|
|
92
|
+
}, b = new y();
|
|
93
|
+
typeof globalThis < "u" && (globalThis.laserEvents = b);
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region packages/npm/laser/src/lib/core/invariant.ts
|
|
96
|
+
var oe = "laser:invariant", se = /* @__PURE__ */ new Map(), ce = /* @__PURE__ */ new Map(), le = 1e3;
|
|
97
|
+
function ue(e) {
|
|
98
|
+
le = Math.max(0, e);
|
|
99
|
+
}
|
|
100
|
+
function de(e, t, n) {
|
|
101
|
+
if (e) return !0;
|
|
102
|
+
let r = Date.now(), i = (se.get(t) ?? 0) + 1;
|
|
103
|
+
return se.set(t, i), r - (ce.get(t) ?? -Infinity) >= le && (ce.set(t, r), console.error(`[invariant] ${t}${i > 1 ? ` (x${i})` : ""}`, n), b.emit(oe, {
|
|
104
|
+
msg: t,
|
|
105
|
+
ctx: n,
|
|
106
|
+
count: i,
|
|
107
|
+
time: r
|
|
108
|
+
})), !1;
|
|
109
|
+
}
|
|
110
|
+
function fe() {
|
|
111
|
+
se.clear(), ce.clear();
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region packages/npm/laser/src/lib/spatial/quadtree.ts
|
|
115
|
+
var pe = class e {
|
|
116
|
+
bounds;
|
|
117
|
+
capacity;
|
|
118
|
+
points;
|
|
119
|
+
divided;
|
|
120
|
+
cache;
|
|
121
|
+
northeast;
|
|
122
|
+
northwest;
|
|
123
|
+
southeast;
|
|
124
|
+
southwest;
|
|
125
|
+
constructor(e, t = 4) {
|
|
126
|
+
this.bounds = e, this.capacity = t, this.points = [], this.divided = !1, this.cache = /* @__PURE__ */ new Map();
|
|
127
|
+
}
|
|
128
|
+
subdivide() {
|
|
129
|
+
let { xMin: t, yMin: n, xMax: r, yMax: i } = this.bounds, a = (r - t) / 2, o = (i - n) / 2, s = t, c = n;
|
|
130
|
+
this.northeast = new e({
|
|
131
|
+
xMin: s + a,
|
|
132
|
+
xMax: s + 2 * a,
|
|
133
|
+
yMin: n,
|
|
134
|
+
yMax: c + o
|
|
135
|
+
}, this.capacity), this.northwest = new e({
|
|
136
|
+
xMin: t,
|
|
137
|
+
xMax: s + a,
|
|
138
|
+
yMin: n,
|
|
139
|
+
yMax: c + o
|
|
140
|
+
}, this.capacity), this.southeast = new e({
|
|
141
|
+
xMin: s + a,
|
|
142
|
+
xMax: s + 2 * a,
|
|
143
|
+
yMin: c + o,
|
|
144
|
+
yMax: c + 2 * o
|
|
145
|
+
}, this.capacity), this.southwest = new e({
|
|
146
|
+
xMin: t,
|
|
147
|
+
xMax: s + a,
|
|
148
|
+
yMin: c + o,
|
|
149
|
+
yMax: c + 2 * o
|
|
150
|
+
}, this.capacity), this.divided = !0;
|
|
151
|
+
}
|
|
152
|
+
insert(e) {
|
|
153
|
+
return this.contains(e.bounds) ? this.points.length < this.capacity ? (this.points.push(e), !0) : (this.divided || this.subdivide(), !!(this.northeast?.insert(e) || this.northwest?.insert(e) || this.southeast?.insert(e) || this.southwest?.insert(e))) : !1;
|
|
154
|
+
}
|
|
155
|
+
contains(e) {
|
|
156
|
+
let { xMin: t, yMin: n, xMax: r, yMax: i } = this.bounds;
|
|
157
|
+
return e.xMin >= t && e.xMax <= r && e.yMin >= n && e.yMax <= i;
|
|
158
|
+
}
|
|
159
|
+
queryRange(e, t = []) {
|
|
160
|
+
if (!this.intersects(e)) return t;
|
|
161
|
+
for (let n of this.points) this.isWithinBounds(n.bounds, e) && t.push(n);
|
|
162
|
+
return this.divided && (this.northwest?.queryRange(e, t), this.northeast?.queryRange(e, t), this.southwest?.queryRange(e, t), this.southeast?.queryRange(e, t)), t;
|
|
163
|
+
}
|
|
164
|
+
query(e, t = []) {
|
|
165
|
+
let n = `${e.x},${e.y}`, r = this.cache.get(n);
|
|
166
|
+
if (r) return r;
|
|
167
|
+
if (!this.intersects({
|
|
168
|
+
xMin: e.x,
|
|
169
|
+
xMax: e.x,
|
|
170
|
+
yMin: e.y,
|
|
171
|
+
yMax: e.y
|
|
172
|
+
})) return t;
|
|
173
|
+
for (let n of this.points) this.isWithinRange(e, n.bounds) && t.push(n);
|
|
174
|
+
return this.divided && (this.northwest?.query(e, t), this.northeast?.query(e, t), this.southwest?.query(e, t), this.southeast?.query(e, t)), this.cache.set(n, t), t;
|
|
175
|
+
}
|
|
176
|
+
intersects(e) {
|
|
177
|
+
let { xMin: t, yMin: n, xMax: r, yMax: i } = this.bounds;
|
|
178
|
+
return !(e.xMin > r || e.xMax < t || e.yMin > i || e.yMax < n);
|
|
179
|
+
}
|
|
180
|
+
isWithinBounds(e, t) {
|
|
181
|
+
return e.xMax >= t.xMin && e.xMin <= t.xMax && e.yMax >= t.yMin && e.yMin <= t.yMax;
|
|
182
|
+
}
|
|
183
|
+
isWithinRange(e, t) {
|
|
184
|
+
return e.x >= t.xMin && e.x <= t.xMax && e.y >= t.yMin && e.y <= t.yMax;
|
|
185
|
+
}
|
|
186
|
+
}, x = e(null);
|
|
187
|
+
function me() {
|
|
188
|
+
let e = n(x);
|
|
189
|
+
if (!e) throw Error("usePhaserGame must be used within a <PhaserGame> component");
|
|
190
|
+
return e;
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region packages/npm/laser/src/lib/phaser/PhaserGame.tsx
|
|
194
|
+
var he = t(function({ config: e, onReady: t, onDestroy: n, className: c, style: u, children: ee }, p) {
|
|
195
|
+
let m = o(null), h = o(null), g = o(null), [_, v] = s("idle");
|
|
196
|
+
i(p, () => ({
|
|
197
|
+
game: h.current,
|
|
198
|
+
status: _
|
|
199
|
+
}), [_]), r(() => {
|
|
200
|
+
if (!m.current) return;
|
|
201
|
+
let r = m.current;
|
|
202
|
+
if (g.current !== null && (window.clearTimeout(g.current), g.current = null), h.current) {
|
|
203
|
+
let e = h.current.canvas;
|
|
204
|
+
return e && e.parentElement !== r && r.appendChild(e), v(h.current.isBooted ? "running" : "booting"), o;
|
|
205
|
+
}
|
|
206
|
+
v("booting");
|
|
207
|
+
let i = {
|
|
208
|
+
type: l.AUTO,
|
|
209
|
+
width: e.width ?? 800,
|
|
210
|
+
height: e.height ?? 600,
|
|
211
|
+
parent: r,
|
|
212
|
+
scene: e.scenes,
|
|
213
|
+
backgroundColor: e.backgroundColor,
|
|
214
|
+
transparent: e.transparent,
|
|
215
|
+
...e.physics && { physics: e.physics },
|
|
216
|
+
...e.plugins && { plugins: e.plugins },
|
|
217
|
+
...e.scale && { scale: e.scale },
|
|
218
|
+
...e.input && { input: e.input },
|
|
219
|
+
...e.render || e.pixelArt ? { render: e.pixelArt ? {
|
|
220
|
+
pixelArt: !0,
|
|
221
|
+
antialias: !1,
|
|
222
|
+
...e.render
|
|
223
|
+
} : e.render } : {},
|
|
224
|
+
...e.dom && { dom: e.dom },
|
|
225
|
+
...e.audio && { audio: e.audio },
|
|
226
|
+
...e.callbacks && { callbacks: e.callbacks },
|
|
227
|
+
...e.fps && { fps: e.fps }
|
|
228
|
+
}, a = new l.Game(i);
|
|
229
|
+
return h.current = a, a.events.once("ready", () => {
|
|
230
|
+
h.current === a && (v("running"), b.emit("game:ready", { game: a }), t?.(a));
|
|
231
|
+
}), o;
|
|
232
|
+
function o() {
|
|
233
|
+
g.current = window.setTimeout(() => {
|
|
234
|
+
g.current = null;
|
|
235
|
+
let e = h.current;
|
|
236
|
+
e && (v("destroyed"), b.emit("game:destroy", void 0), n?.(), e.destroy(!0), h.current = null);
|
|
237
|
+
}, 0);
|
|
238
|
+
}
|
|
239
|
+
}, [
|
|
240
|
+
e,
|
|
241
|
+
t,
|
|
242
|
+
n
|
|
243
|
+
]);
|
|
244
|
+
let te = a(() => ({
|
|
245
|
+
game: h.current,
|
|
246
|
+
status: _
|
|
247
|
+
}), [_]);
|
|
248
|
+
return /* @__PURE__ */ f(x.Provider, {
|
|
249
|
+
value: te,
|
|
250
|
+
children: [/* @__PURE__ */ d("div", {
|
|
251
|
+
ref: m,
|
|
252
|
+
className: c,
|
|
253
|
+
style: u
|
|
254
|
+
}), ee]
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region packages/npm/laser/src/lib/phaser/use-phaser-event.ts
|
|
259
|
+
function ge(e, t, n) {
|
|
260
|
+
let { game: i } = me(), a = o(t);
|
|
261
|
+
a.current = t, r(() => {
|
|
262
|
+
if (!i) return;
|
|
263
|
+
let t = (...e) => a.current(...e);
|
|
264
|
+
if (n) {
|
|
265
|
+
let r = i.scene.getScene(n);
|
|
266
|
+
if (r) return r.events.on(e, t), () => {
|
|
267
|
+
r.events.off(e, t);
|
|
268
|
+
};
|
|
269
|
+
} else return i.events.on(e, t), () => {
|
|
270
|
+
i.events.off(e, t);
|
|
271
|
+
};
|
|
272
|
+
}, [
|
|
273
|
+
i,
|
|
274
|
+
e,
|
|
275
|
+
n
|
|
276
|
+
]);
|
|
277
|
+
}
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region packages/npm/laser/src/lib/phaser/virtual-joystick.ts
|
|
280
|
+
var _e = class {
|
|
281
|
+
scene;
|
|
282
|
+
base;
|
|
283
|
+
thumb;
|
|
284
|
+
radius;
|
|
285
|
+
deadZone;
|
|
286
|
+
_direction = null;
|
|
287
|
+
_isActive = !1;
|
|
288
|
+
fixed;
|
|
289
|
+
activePointer = null;
|
|
290
|
+
constructor(e, t) {
|
|
291
|
+
this.scene = e, this.radius = t?.radius ?? 60, this.deadZone = t?.deadZone ?? .25, this.fixed = t?.fixed ?? !0;
|
|
292
|
+
let n = t?.x ?? 120, r = t?.y ?? e.scale.height - 120;
|
|
293
|
+
this.base = e.add.circle(n, r, this.radius, t?.baseColor ?? 8947848, t?.baseAlpha ?? .35).setDepth(100).setScrollFactor(0), this.thumb = e.add.circle(n, r, this.radius * .4, t?.thumbColor ?? 16777215, t?.thumbAlpha ?? .5).setDepth(101).setScrollFactor(0), this.setupInput();
|
|
294
|
+
}
|
|
295
|
+
setupInput() {
|
|
296
|
+
this.scene.input.on("pointerdown", (e) => {
|
|
297
|
+
if (this.activePointer) return;
|
|
298
|
+
let t = e.x - this.base.x, n = e.y - this.base.y, r = Math.sqrt(t * t + n * n);
|
|
299
|
+
this.fixed && r > this.radius * 2 || (this.fixed || (this.base.setPosition(e.x, e.y), this.thumb.setPosition(e.x, e.y)), this.activePointer = e, this._isActive = !0);
|
|
300
|
+
}), this.scene.input.on("pointermove", (e) => {
|
|
301
|
+
e === this.activePointer && this.updateThumb(e.x, e.y);
|
|
302
|
+
}), this.scene.input.on("pointerup", (e) => {
|
|
303
|
+
e === this.activePointer && this.resetThumb();
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
updateThumb(e, t) {
|
|
307
|
+
let n = e - this.base.x, r = t - this.base.y, i = Math.sqrt(n * n + r * r), a = Math.min(i, this.radius), o = Math.atan2(r, n);
|
|
308
|
+
if (this.thumb.setPosition(this.base.x + Math.cos(o) * a, this.base.y + Math.sin(o) * a), a / this.radius < this.deadZone) {
|
|
309
|
+
this._direction = null;
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
this._direction = this.angleToDirection(o);
|
|
313
|
+
}
|
|
314
|
+
angleToDirection(e) {
|
|
315
|
+
let t = e * 180 / Math.PI;
|
|
316
|
+
return t < 0 && (t += 360), t >= 337.5 || t < 22.5 ? "right" : t >= 22.5 && t < 67.5 ? "down-right" : t >= 67.5 && t < 112.5 ? "down" : t >= 112.5 && t < 157.5 ? "down-left" : t >= 157.5 && t < 202.5 ? "left" : t >= 202.5 && t < 247.5 ? "up-left" : t >= 247.5 && t < 292.5 ? "up" : "up-right";
|
|
317
|
+
}
|
|
318
|
+
resetThumb() {
|
|
319
|
+
this.thumb.setPosition(this.base.x, this.base.y), this._direction = null, this._isActive = !1, this.activePointer = null;
|
|
320
|
+
}
|
|
321
|
+
get direction() {
|
|
322
|
+
return this._direction;
|
|
323
|
+
}
|
|
324
|
+
get isActive() {
|
|
325
|
+
return this._isActive;
|
|
326
|
+
}
|
|
327
|
+
setVisible(e) {
|
|
328
|
+
return this.base.setVisible(e), this.thumb.setVisible(e), this;
|
|
329
|
+
}
|
|
330
|
+
destroy() {
|
|
331
|
+
this.base.destroy(), this.thumb.destroy();
|
|
332
|
+
}
|
|
333
|
+
}, ve = class {
|
|
334
|
+
scene;
|
|
335
|
+
gridEngine;
|
|
336
|
+
quadtree;
|
|
337
|
+
cursor;
|
|
338
|
+
wasdKeys;
|
|
339
|
+
tooltip;
|
|
340
|
+
tileSize;
|
|
341
|
+
playerId;
|
|
342
|
+
joystick = null;
|
|
343
|
+
constructor(e, t, n, r) {
|
|
344
|
+
if (this.scene = e, this.gridEngine = t, this.quadtree = n, this.tileSize = r?.tileSize ?? 48, this.playerId = r?.playerId ?? "player", this.cursor = this.scene.input.keyboard?.createCursorKeys(), this.initializeWASDKeys(), this.tooltip = this.scene.add.text(0, 0, "Press [F]", {
|
|
345
|
+
font: "16px Arial",
|
|
346
|
+
backgroundColor: "#000000"
|
|
347
|
+
}).setDepth(4).setPadding(3, 2, 2, 3).setVisible(!1), r?.joystick) {
|
|
348
|
+
let t = typeof r.joystick == "object" ? r.joystick : void 0;
|
|
349
|
+
this.joystick = new _e(e, t);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
initializeWASDKeys() {
|
|
353
|
+
let e = this.scene.input.keyboard;
|
|
354
|
+
e && (this.wasdKeys = {
|
|
355
|
+
W: e.addKey(l.Input.Keyboard.KeyCodes.W),
|
|
356
|
+
A: e.addKey(l.Input.Keyboard.KeyCodes.A),
|
|
357
|
+
S: e.addKey(l.Input.Keyboard.KeyCodes.S),
|
|
358
|
+
D: e.addKey(l.Input.Keyboard.KeyCodes.D)
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
checkForNearbyObjects() {
|
|
362
|
+
let e = this.gridEngine.getPosition(this.playerId), t = e.x * this.tileSize, n = e.y * this.tileSize, r = this.quadtree.query(e);
|
|
363
|
+
r.length > 0 ? (this.tooltip.setPosition(t, n - 60).setVisible(!0), b.emit("player:nearby", {
|
|
364
|
+
position: e,
|
|
365
|
+
ranges: r
|
|
366
|
+
})) : this.tooltip.setVisible(!1);
|
|
367
|
+
}
|
|
368
|
+
getPlayerPosition() {
|
|
369
|
+
return this.gridEngine.getPosition(this.playerId);
|
|
370
|
+
}
|
|
371
|
+
handleMovement() {
|
|
372
|
+
if (this.scene.input.keyboard?.addKey("F").isDown) {
|
|
373
|
+
let e = this.gridEngine.getPosition(this.playerId), t = this.quadtree.query(e);
|
|
374
|
+
if (t.length > 0) {
|
|
375
|
+
b.emit("player:interact", {
|
|
376
|
+
position: e,
|
|
377
|
+
ranges: t
|
|
378
|
+
});
|
|
379
|
+
for (let e of t) e.action();
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if (this.joystick?.isActive && this.joystick.direction) {
|
|
383
|
+
this.gridEngine.move(this.playerId, this.joystick.direction), this.checkForNearbyObjects();
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (!this.cursor) {
|
|
387
|
+
this.checkForNearbyObjects();
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
let e = this.cursor, t = this.wasdKeys;
|
|
391
|
+
(e.left.isDown || t.A.isDown) && (e.up.isDown || t.W.isDown) ? this.gridEngine.move(this.playerId, "up-left") : (e.left.isDown || t.A.isDown) && (e.down.isDown || t.S.isDown) ? this.gridEngine.move(this.playerId, "down-left") : (e.right.isDown || t.D.isDown) && (e.up.isDown || t.W.isDown) ? this.gridEngine.move(this.playerId, "up-right") : (e.right.isDown || t.D.isDown) && (e.down.isDown || t.S.isDown) ? this.gridEngine.move(this.playerId, "down-right") : e.left.isDown || t.A.isDown ? this.gridEngine.move(this.playerId, "left") : e.right.isDown || t.D.isDown ? this.gridEngine.move(this.playerId, "right") : e.up.isDown || t.W.isDown ? this.gridEngine.move(this.playerId, "up") : (e.down.isDown || t.S.isDown) && this.gridEngine.move(this.playerId, "down"), this.checkForNearbyObjects();
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
//#endregion
|
|
395
|
+
//#region packages/npm/laser/src/lib/phaser/entity-fx.ts
|
|
396
|
+
function ye(e, t, n = 16739179) {
|
|
397
|
+
t.setTint(16777215).setTintMode(l.TintModes.FILL), e.time.delayedCall(60, () => t.setTint(n)), e.time.delayedCall(180, () => {
|
|
398
|
+
t.clearTint(), t.setTintMode(l.TintModes.MULTIPLY);
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
function be(e, t, n, r, i, a) {
|
|
402
|
+
let o = e.add.text(t, n, r, {
|
|
403
|
+
fontFamily: "monospace",
|
|
404
|
+
fontSize: "14px",
|
|
405
|
+
color: i,
|
|
406
|
+
stroke: "#000000",
|
|
407
|
+
strokeThickness: 3
|
|
408
|
+
}).setOrigin(.5, 1).setDepth(a);
|
|
409
|
+
return e.tweens.add({
|
|
410
|
+
targets: o,
|
|
411
|
+
y: n - 28,
|
|
412
|
+
alpha: 0,
|
|
413
|
+
duration: 900,
|
|
414
|
+
ease: "Cubic.easeOut",
|
|
415
|
+
onComplete: () => o.destroy()
|
|
416
|
+
}), o;
|
|
417
|
+
}
|
|
418
|
+
function xe(e, t, n, r, i, a = 26) {
|
|
419
|
+
let o = Math.max(0, Math.min(1, r / i));
|
|
420
|
+
e.clear(), e.fillStyle(0, .6), e.fillRect(t - a / 2, n, a, 4), e.fillStyle(o > .5 ? 4906624 : o > .25 ? 16498468 : 16281969, 1), e.fillRect(t - a / 2 + .5, n + .5, (a - 1) * o, 3);
|
|
421
|
+
}
|
|
422
|
+
function Se(e, t, n, r, i, a, o = 26) {
|
|
423
|
+
return e.setPosition(t, n), a && a.hp === r && a.maxHp === i ? {
|
|
424
|
+
drawn: !1,
|
|
425
|
+
cache: a
|
|
426
|
+
} : (xe(e, 0, 0, r, i, o), {
|
|
427
|
+
drawn: !0,
|
|
428
|
+
cache: {
|
|
429
|
+
hp: r,
|
|
430
|
+
maxHp: i
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
function Ce(e, { min: t = .6, max: n = 2.2, step: r = .2 } = {}) {
|
|
435
|
+
let i = (r) => {
|
|
436
|
+
let i = e.cameras.main;
|
|
437
|
+
i.setZoom(l.Math.Clamp(i.zoom + r, t, n));
|
|
438
|
+
};
|
|
439
|
+
e.input.keyboard?.on("keydown-PLUS", () => i(r)), e.input.keyboard?.on("keydown-MINUS", () => i(-r)), e.input.on("wheel", (e, t, n, a) => i(a > 0 ? -r * .75 : r * .75));
|
|
440
|
+
}
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region packages/npm/laser/src/lib/webgl/context-guard.ts
|
|
443
|
+
function we() {
|
|
444
|
+
try {
|
|
445
|
+
if (typeof window > "u" || !window.WebGLRenderingContext) return !1;
|
|
446
|
+
let e = document.createElement("canvas"), t = e.getContext("webgl2") || e.getContext("webgl");
|
|
447
|
+
return t ? (t.getExtension("WEBGL_lose_context")?.loseContext(), !0) : !1;
|
|
448
|
+
} catch {
|
|
449
|
+
return !1;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
function S(e, t) {
|
|
453
|
+
let n = {
|
|
454
|
+
kind: e,
|
|
455
|
+
...t
|
|
456
|
+
};
|
|
457
|
+
e === "restored" ? console.info("[laser/webgl] context restored", n) : console.warn(`[laser/webgl] context ${e}`, n);
|
|
458
|
+
try {
|
|
459
|
+
window.dispatchEvent(new CustomEvent("kbve:webgl", { detail: n }));
|
|
460
|
+
} catch {}
|
|
461
|
+
}
|
|
462
|
+
function C(e, { onLost: t, onRestored: n }) {
|
|
463
|
+
let r = (e) => {
|
|
464
|
+
e.preventDefault(), S("lost"), t();
|
|
465
|
+
}, i = () => {
|
|
466
|
+
S("restored"), n();
|
|
467
|
+
};
|
|
468
|
+
return e.addEventListener("webglcontextlost", r, !1), e.addEventListener("webglcontextrestored", i, !1), () => {
|
|
469
|
+
e.removeEventListener("webglcontextlost", r), e.removeEventListener("webglcontextrestored", i);
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
//#endregion
|
|
473
|
+
//#region packages/npm/laser/src/lib/phaser/gpu-sprite-layer.ts
|
|
474
|
+
function w(e, t, n) {
|
|
475
|
+
if (e.renderer.type !== l.WEBGL) return null;
|
|
476
|
+
let r = e.add.spriteGPULayer(t, n.size);
|
|
477
|
+
n.depth !== void 0 && r.setDepth(n.depth), n.alpha !== void 0 && r.setAlpha(n.alpha), n.blendMode !== void 0 && r.setBlendMode(n.blendMode), n.visible !== void 0 && r.setVisible(n.visible);
|
|
478
|
+
let i = C(e.game.canvas, {
|
|
479
|
+
onLost: () => void 0,
|
|
480
|
+
onRestored: () => r.setAllSegmentsNeedUpdate()
|
|
481
|
+
});
|
|
482
|
+
return {
|
|
483
|
+
layer: r,
|
|
484
|
+
dispose() {
|
|
485
|
+
i(), r.destroy();
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
function T(e, t, n) {
|
|
490
|
+
let r = {};
|
|
491
|
+
for (let i = 0; i < t; i++) n(r, i), e.layer.addMember(r);
|
|
492
|
+
}
|
|
493
|
+
//#endregion
|
|
494
|
+
//#region packages/npm/laser/src/lib/phaser/ambient-dust.ts
|
|
495
|
+
function E(e, t, n) {
|
|
496
|
+
let r = n() * t.width, i = n() * t.height, a = 4 + n() * 10, o = 4e3 + n() * 5e3, s = .5 + n() * 1.1, c = .35 + n() * .35, l = 2500 + n() * 3500, u = {
|
|
497
|
+
x: r,
|
|
498
|
+
y: {
|
|
499
|
+
base: i,
|
|
500
|
+
amplitude: a,
|
|
501
|
+
duration: o,
|
|
502
|
+
ease: "Sine.easeInOut",
|
|
503
|
+
loop: !0,
|
|
504
|
+
yoyo: !0
|
|
505
|
+
},
|
|
506
|
+
scaleX: s,
|
|
507
|
+
scaleY: s,
|
|
508
|
+
alpha: {
|
|
509
|
+
base: c,
|
|
510
|
+
amplitude: .25,
|
|
511
|
+
duration: l,
|
|
512
|
+
ease: "Sine.easeInOut",
|
|
513
|
+
loop: !0,
|
|
514
|
+
yoyo: !0
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
return t.scrollFactor !== void 0 && (u.scrollFactorX = t.scrollFactor, u.scrollFactorY = t.scrollFactor), u;
|
|
518
|
+
}
|
|
519
|
+
function Te(e, t, n, r) {
|
|
520
|
+
if (e.textures.exists(t)) return;
|
|
521
|
+
let i = n * 2, a = e.make.graphics({
|
|
522
|
+
x: 0,
|
|
523
|
+
y: 0
|
|
524
|
+
}, !1);
|
|
525
|
+
a.fillStyle(r, 1), a.fillCircle(n, n, n), a.generateTexture(t, i, i), a.destroy();
|
|
526
|
+
}
|
|
527
|
+
function Ee(e, t, n = Math.random) {
|
|
528
|
+
if (e.renderer.type !== l.WEBGL) return null;
|
|
529
|
+
let r = t.textureKey ?? "laser-dust-mote";
|
|
530
|
+
Te(e, r, t.radius ?? 2, t.color ?? 16777215);
|
|
531
|
+
let i = w(e, r, {
|
|
532
|
+
size: t.count,
|
|
533
|
+
depth: t.depth,
|
|
534
|
+
alpha: t.alpha,
|
|
535
|
+
blendMode: t.blendMode
|
|
536
|
+
});
|
|
537
|
+
return i ? (T(i, t.count, (e, r) => Object.assign(e, E(r, t, n))), i) : null;
|
|
538
|
+
}
|
|
539
|
+
//#endregion
|
|
540
|
+
//#region packages/npm/laser/src/lib/phaser/object-pool.ts
|
|
541
|
+
var D = class {
|
|
542
|
+
idle = [];
|
|
543
|
+
constructor(e) {
|
|
544
|
+
this.make = e;
|
|
545
|
+
}
|
|
546
|
+
acquire() {
|
|
547
|
+
let e = this.idle.pop() ?? this.make();
|
|
548
|
+
return e.setActive(!0).setVisible(!0), e;
|
|
549
|
+
}
|
|
550
|
+
release(e) {
|
|
551
|
+
e.setActive(!1).setVisible(!1), this.idle.push(e);
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region packages/npm/laser/src/lib/phaser/keyboard-map.ts
|
|
556
|
+
function De(e, t) {
|
|
557
|
+
let n = e.input.keyboard;
|
|
558
|
+
if (!n) return null;
|
|
559
|
+
let r = n.createCursorKeys(), i = {};
|
|
560
|
+
for (let e of Object.keys(t)) i[e] = n.addKey(t[e], !1);
|
|
561
|
+
return {
|
|
562
|
+
cursors: r,
|
|
563
|
+
keys: i
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
//#endregion
|
|
567
|
+
//#region packages/npm/laser/src/lib/phaser/arrow-projectile.ts
|
|
568
|
+
function Oe(e, { width: t = 7, height: n = 2, depth: r = 0 } = {}) {
|
|
569
|
+
return new D(() => {
|
|
570
|
+
let i = e.add.rectangle(0, 0, t, n, 16777215);
|
|
571
|
+
return i.setOrigin(.5, .5), i.setDepth(r), i;
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
function ke(e, t, n) {
|
|
575
|
+
let r = t.acquire();
|
|
576
|
+
return r.setPosition(n.fromX, n.fromY), r.setFillStyle(n.color), r.setRotation(Math.atan2(n.toY - n.fromY, n.toX - n.fromX)), e.tweens.add({
|
|
577
|
+
targets: r,
|
|
578
|
+
x: n.toX,
|
|
579
|
+
y: n.toY,
|
|
580
|
+
duration: n.duration ?? 140,
|
|
581
|
+
onComplete: () => t.release(r)
|
|
582
|
+
}), r;
|
|
583
|
+
}
|
|
584
|
+
//#endregion
|
|
585
|
+
//#region packages/npm/laser/src/lib/tile/path.ts
|
|
586
|
+
function Ae(e, t, n, r = 64) {
|
|
587
|
+
if (e.x === t.x && e.y === t.y || n(t.x, t.y)) return [];
|
|
588
|
+
let i = (e, t) => `${e},${t}`, a = /* @__PURE__ */ new Map();
|
|
589
|
+
a.set(i(e.x, e.y), null);
|
|
590
|
+
let o = [e], s = [
|
|
591
|
+
[0, -1],
|
|
592
|
+
[0, 1],
|
|
593
|
+
[-1, 0],
|
|
594
|
+
[1, 0]
|
|
595
|
+
], c = (r * 2 + 1) ** 2, l = 0, u = !1;
|
|
596
|
+
for (; o.length;) {
|
|
597
|
+
if (++l > c) return [];
|
|
598
|
+
let e = o.shift();
|
|
599
|
+
if (e.x === t.x && e.y === t.y) {
|
|
600
|
+
u = !0;
|
|
601
|
+
break;
|
|
602
|
+
}
|
|
603
|
+
for (let [t, r] of s) {
|
|
604
|
+
let s = e.x + t, c = e.y + r, l = i(s, c);
|
|
605
|
+
a.has(l) || n(s, c) || (a.set(l, i(e.x, e.y)), o.push({
|
|
606
|
+
x: s,
|
|
607
|
+
y: c
|
|
608
|
+
}));
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
if (!u) return [];
|
|
612
|
+
let d = [], f = i(t.x, t.y);
|
|
613
|
+
for (; f && f !== i(e.x, e.y);) {
|
|
614
|
+
let [e, t] = f.split(",").map(Number);
|
|
615
|
+
if (d.push({
|
|
616
|
+
x: e,
|
|
617
|
+
y: t
|
|
618
|
+
}), f = a.get(f) ?? null, d.length > r) return [];
|
|
619
|
+
}
|
|
620
|
+
return d.reverse(), d;
|
|
621
|
+
}
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region packages/npm/laser/src/lib/phaser/monsters/bird.ts
|
|
624
|
+
function je(e) {
|
|
625
|
+
return +e[e.length - 1];
|
|
626
|
+
}
|
|
627
|
+
function Me(e) {
|
|
628
|
+
return e.startsWith("monster_bird_") && !e.startsWith("monster_bird_shadow");
|
|
629
|
+
}
|
|
630
|
+
function Ne(e, t, n, r, i) {
|
|
631
|
+
let a = [];
|
|
632
|
+
for (let o = 0; o < 10; o++) {
|
|
633
|
+
let o = e.add.sprite(0, 0, "monster_bird");
|
|
634
|
+
o.setCrop(t, n, r, i), o.scale = 3, a.push(o);
|
|
635
|
+
}
|
|
636
|
+
return a;
|
|
637
|
+
}
|
|
638
|
+
function Pe(e) {
|
|
639
|
+
return Ne(e, 0, 0, 61, 47);
|
|
640
|
+
}
|
|
641
|
+
function Fe(e) {
|
|
642
|
+
return Ne(e, 22, 47, 16, 10);
|
|
643
|
+
}
|
|
644
|
+
function Ie(e) {
|
|
645
|
+
e.anims.create({
|
|
646
|
+
key: "bird",
|
|
647
|
+
frames: e.anims.generateFrameNumbers("monster_bird", {
|
|
648
|
+
start: 0,
|
|
649
|
+
end: 2
|
|
650
|
+
}),
|
|
651
|
+
frameRate: 10,
|
|
652
|
+
repeat: -1,
|
|
653
|
+
yoyo: !0
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
//#endregion
|
|
657
|
+
//#region packages/npm/laser/src/lib/r3f/components/Stage.tsx
|
|
658
|
+
var Le = ({ children: e, className: t, ...n }) => /* @__PURE__ */ f(ee, {
|
|
659
|
+
camera: { position: [
|
|
660
|
+
0,
|
|
661
|
+
0,
|
|
662
|
+
5
|
|
663
|
+
] },
|
|
664
|
+
...n,
|
|
665
|
+
className: t,
|
|
666
|
+
children: [/* @__PURE__ */ d("ambientLight", { intensity: 1.5 }), e]
|
|
667
|
+
});
|
|
668
|
+
//#endregion
|
|
669
|
+
//#region packages/npm/laser/src/lib/r3f/hooks/use-game-loop.ts
|
|
670
|
+
function Re(e) {
|
|
671
|
+
let t = o(e);
|
|
672
|
+
t.current = e, p((e, n) => {
|
|
673
|
+
t.current(n, e.clock.elapsedTime);
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
//#endregion
|
|
677
|
+
//#region packages/npm/laser/src/lib/ecs/bitecs.ts
|
|
678
|
+
var O = /* @__PURE__ */ re({});
|
|
679
|
+
import * as ze from "bitecs";
|
|
680
|
+
ae(O, ze);
|
|
681
|
+
//#endregion
|
|
682
|
+
//#region packages/npm/laser/src/lib/ecs/helpers.ts
|
|
683
|
+
function k(e, t) {
|
|
684
|
+
return (e & 65535) * 65536 + (t & 65535);
|
|
685
|
+
}
|
|
686
|
+
function* A(e, t, n, r, i, a) {
|
|
687
|
+
let o = a * a;
|
|
688
|
+
for (let a of m(e, t)) {
|
|
689
|
+
let e = n.x[a] - r, t = n.y[a] - i;
|
|
690
|
+
e * e + t * t <= o && (yield a);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
function Be(e, t, n, r, i, a) {
|
|
694
|
+
let o = a * a, s = -1, c = o;
|
|
695
|
+
for (let a of m(e, t)) {
|
|
696
|
+
let e = n.x[a] - r, t = n.y[a] - i, o = e * e + t * t;
|
|
697
|
+
o <= c && (c = o, s = a);
|
|
698
|
+
}
|
|
699
|
+
return s >= 0 ? s : null;
|
|
700
|
+
}
|
|
701
|
+
var j = class {
|
|
702
|
+
map = /* @__PURE__ */ new Map();
|
|
703
|
+
set(e, t) {
|
|
704
|
+
this.map.set(e, t);
|
|
705
|
+
}
|
|
706
|
+
get(e) {
|
|
707
|
+
return this.map.get(e);
|
|
708
|
+
}
|
|
709
|
+
delete(e) {
|
|
710
|
+
let t = this.map.get(e);
|
|
711
|
+
return this.map.delete(e), t;
|
|
712
|
+
}
|
|
713
|
+
has(e) {
|
|
714
|
+
return this.map.has(e);
|
|
715
|
+
}
|
|
716
|
+
values() {
|
|
717
|
+
return this.map.values();
|
|
718
|
+
}
|
|
719
|
+
entries() {
|
|
720
|
+
return this.map.entries();
|
|
721
|
+
}
|
|
722
|
+
clear() {
|
|
723
|
+
this.map.clear();
|
|
724
|
+
}
|
|
725
|
+
get size() {
|
|
726
|
+
return this.map.size;
|
|
727
|
+
}
|
|
728
|
+
}, M = 4096, N = {
|
|
729
|
+
x: new Int32Array(M),
|
|
730
|
+
y: new Int32Array(M)
|
|
731
|
+
}, P = {
|
|
732
|
+
hp: new Float32Array(M),
|
|
733
|
+
maxHp: new Float32Array(M)
|
|
734
|
+
}, F = { value: new Int32Array(M) }, I = { slot: new Int32Array(M) }, L = { value: new Uint8Array(M) }, R = {
|
|
735
|
+
host: new Int32Array(M),
|
|
736
|
+
kind: new Uint8Array(M)
|
|
737
|
+
}, Ve = {}, He = {}, Ue = {}, We = {}, z = {}, B = {
|
|
738
|
+
Player: 0,
|
|
739
|
+
Npc: 1,
|
|
740
|
+
Item: 2,
|
|
741
|
+
Env: 3
|
|
742
|
+
}, Ge = [], Ke = class {
|
|
743
|
+
world = (0, O.createWorld)();
|
|
744
|
+
toEid = /* @__PURE__ */ new Map();
|
|
745
|
+
toServer = /* @__PURE__ */ new Map();
|
|
746
|
+
sideRefs = new j();
|
|
747
|
+
effectsMap = /* @__PURE__ */ new Map();
|
|
748
|
+
byTile = /* @__PURE__ */ new Map();
|
|
749
|
+
indexAdd(e, t, n) {
|
|
750
|
+
let r = k(t, n), i = this.byTile.get(r);
|
|
751
|
+
i || this.byTile.set(r, i = /* @__PURE__ */ new Set()), i.add(e);
|
|
752
|
+
}
|
|
753
|
+
indexRemove(e, t, n) {
|
|
754
|
+
let r = k(t, n), i = this.byTile.get(r);
|
|
755
|
+
i && (i.delete(e), i.size === 0 && this.byTile.delete(r));
|
|
756
|
+
}
|
|
757
|
+
tagFor(e) {
|
|
758
|
+
return e === B.Player ? Ve : e === B.Npc ? He : e === B.Env ? We : Ue;
|
|
759
|
+
}
|
|
760
|
+
has(e) {
|
|
761
|
+
return this.toEid.has(e);
|
|
762
|
+
}
|
|
763
|
+
size() {
|
|
764
|
+
return this.toEid.size;
|
|
765
|
+
}
|
|
766
|
+
spawn(e, t, n) {
|
|
767
|
+
let r = (0, O.addEntity)(this.world);
|
|
768
|
+
return (0, O.addComponent)(this.world, r, N), (0, O.addComponent)(this.world, r, P), (0, O.addComponent)(this.world, r, F), (0, O.addComponent)(this.world, r, I), (0, O.addComponent)(this.world, r, L), (0, O.addComponent)(this.world, r, R), (0, O.addComponent)(this.world, r, this.tagFor(t.cat)), t.hostile && (0, O.addComponent)(this.world, r, z), N.x[r] = t.tile.x, N.y[r] = t.tile.y, P.hp[r] = t.hp, P.maxHp[r] = t.maxHp, F.value[r] = t.kind, I.slot[r] = t.owner, L.value[r] = 1, R.host[r] = 0, R.kind[r] = 0, this.toEid.set(e, r), this.toServer.set(r, e), this.sideRefs.set(r, n), this.indexAdd(r, t.tile.x, t.tile.y), t.effects && this.effectsMap.set(e, t.effects), r;
|
|
769
|
+
}
|
|
770
|
+
update(e, t) {
|
|
771
|
+
let n = this.toEid.get(e);
|
|
772
|
+
if (n !== void 0) {
|
|
773
|
+
if (t.tile) {
|
|
774
|
+
let e = N.x[n], r = N.y[n];
|
|
775
|
+
(t.tile.x !== e || t.tile.y !== r) && (this.indexRemove(n, e, r), this.indexAdd(n, t.tile.x, t.tile.y)), N.x[n] = t.tile.x, N.y[n] = t.tile.y;
|
|
776
|
+
}
|
|
777
|
+
t.hp !== void 0 && (P.hp[n] = t.hp), t.maxHp !== void 0 && (P.maxHp[n] = t.maxHp), t.effects !== void 0 && (t.effects.length ? this.effectsMap.set(e, t.effects) : this.effectsMap.delete(e));
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
despawn(e) {
|
|
781
|
+
let t = this.toEid.get(e);
|
|
782
|
+
if (t === void 0) return;
|
|
783
|
+
let n = this.sideRefs.delete(t);
|
|
784
|
+
return this.indexRemove(t, N.x[t], N.y[t]), R.host[t] = 0, R.kind[t] = 0, (0, O.removeEntity)(this.world, t), this.toEid.delete(e), this.toServer.delete(t), this.effectsMap.delete(e), n;
|
|
785
|
+
}
|
|
786
|
+
refs(e) {
|
|
787
|
+
let t = this.toEid.get(e);
|
|
788
|
+
return t === void 0 ? void 0 : this.sideRefs.get(t);
|
|
789
|
+
}
|
|
790
|
+
eid(e) {
|
|
791
|
+
return this.toEid.get(e);
|
|
792
|
+
}
|
|
793
|
+
tile(e) {
|
|
794
|
+
let t = this.toEid.get(e);
|
|
795
|
+
return t === void 0 ? null : {
|
|
796
|
+
x: N.x[t],
|
|
797
|
+
y: N.y[t]
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
hp(e) {
|
|
801
|
+
let t = this.toEid.get(e);
|
|
802
|
+
return t === void 0 ? 0 : P.hp[t];
|
|
803
|
+
}
|
|
804
|
+
maxHp(e) {
|
|
805
|
+
let t = this.toEid.get(e);
|
|
806
|
+
return t === void 0 ? 0 : P.maxHp[t];
|
|
807
|
+
}
|
|
808
|
+
kind(e) {
|
|
809
|
+
let t = this.toEid.get(e);
|
|
810
|
+
return t === void 0 ? -1 : F.value[t];
|
|
811
|
+
}
|
|
812
|
+
owner(e) {
|
|
813
|
+
let t = this.toEid.get(e);
|
|
814
|
+
return t === void 0 ? -1 : I.slot[t];
|
|
815
|
+
}
|
|
816
|
+
setPossession(e, t, n) {
|
|
817
|
+
let r = this.toEid.get(e);
|
|
818
|
+
r !== void 0 && (R.host[r] = t, R.kind[r] = n);
|
|
819
|
+
}
|
|
820
|
+
possessionHost(e) {
|
|
821
|
+
let t = this.toEid.get(e);
|
|
822
|
+
return t === void 0 ? 0 : R.host[t];
|
|
823
|
+
}
|
|
824
|
+
possessionKind(e) {
|
|
825
|
+
let t = this.toEid.get(e);
|
|
826
|
+
return t === void 0 ? 0 : R.kind[t];
|
|
827
|
+
}
|
|
828
|
+
effects(e) {
|
|
829
|
+
return this.effectsMap.get(e) ?? Ge;
|
|
830
|
+
}
|
|
831
|
+
*entries() {
|
|
832
|
+
for (let [e, t] of this.toEid) {
|
|
833
|
+
let n = this.sideRefs.get(t);
|
|
834
|
+
n !== void 0 && (yield [
|
|
835
|
+
e,
|
|
836
|
+
t,
|
|
837
|
+
n
|
|
838
|
+
]);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
at(e, t, n) {
|
|
842
|
+
let r = this.byTile.get(k(e, t));
|
|
843
|
+
if (!r) return null;
|
|
844
|
+
for (let e of r) {
|
|
845
|
+
let t = this.toServer.get(e);
|
|
846
|
+
if (t === void 0 || t === n) continue;
|
|
847
|
+
let r = this.sideRefs.get(e);
|
|
848
|
+
if (r !== void 0) return {
|
|
849
|
+
serverEid: t,
|
|
850
|
+
eid: e,
|
|
851
|
+
refs: r
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
return null;
|
|
855
|
+
}
|
|
856
|
+
hostilesInRange(e, t, n) {
|
|
857
|
+
let r = 0;
|
|
858
|
+
for (let i of A(this.world, [N, z], N, e, t, n)) r += 1;
|
|
859
|
+
return r;
|
|
860
|
+
}
|
|
861
|
+
serverIdsWith(e) {
|
|
862
|
+
let t = this.tagFor(e), n = [];
|
|
863
|
+
for (let e of (0, O.query)(this.world, [t])) {
|
|
864
|
+
let t = this.toServer.get(e);
|
|
865
|
+
t !== void 0 && n.push(t);
|
|
866
|
+
}
|
|
867
|
+
return n;
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
//#endregion
|
|
871
|
+
//#region packages/npm/laser/src/lib/determ/index.ts
|
|
872
|
+
function V(e) {
|
|
873
|
+
return (e.charCodeAt(0) << 24 | e.charCodeAt(1) << 16 | e.charCodeAt(2) << 8 | e.charCodeAt(3)) >>> 0;
|
|
874
|
+
}
|
|
875
|
+
var qe = {
|
|
876
|
+
COMBAT: V("COMB"),
|
|
877
|
+
DUNGEON: V("DUNG"),
|
|
878
|
+
WANDER: V("WAND"),
|
|
879
|
+
LOOT: V("LOOT"),
|
|
880
|
+
TREE: V("TREE"),
|
|
881
|
+
BUSH: V("BUSH")
|
|
882
|
+
};
|
|
883
|
+
function Je(e) {
|
|
884
|
+
let t = e >>> 0;
|
|
885
|
+
return () => {
|
|
886
|
+
t = t + 1831565813 >>> 0;
|
|
887
|
+
let e = t;
|
|
888
|
+
return e = Math.imul(e ^ e >>> 15, e | 1) >>> 0, e = (e ^ e + (Math.imul(e ^ e >>> 7, e | 61) >>> 0)) >>> 0, (e ^ e >>> 14) >>> 0;
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
function Ye(e) {
|
|
892
|
+
let t = 2166136261;
|
|
893
|
+
for (let n of e) {
|
|
894
|
+
let e = n >>> 0;
|
|
895
|
+
for (let n = 0; n < 32; n += 8) t = (t ^ e >>> n & 255) >>> 0, t = Math.imul(t, 16777619) >>> 0;
|
|
896
|
+
}
|
|
897
|
+
return t >>> 0;
|
|
898
|
+
}
|
|
899
|
+
function Xe(e, t, n = []) {
|
|
900
|
+
return Je(Ye([
|
|
901
|
+
e,
|
|
902
|
+
t,
|
|
903
|
+
...n
|
|
904
|
+
]));
|
|
905
|
+
}
|
|
906
|
+
function Ze(e, t, n = []) {
|
|
907
|
+
return Xe(e, t, n)() % 100;
|
|
908
|
+
}
|
|
909
|
+
//#endregion
|
|
910
|
+
//#region packages/npm/laser/src/lib/combat/index.ts
|
|
911
|
+
var Qe = {
|
|
912
|
+
Adjacent: 0,
|
|
913
|
+
Line: 1,
|
|
914
|
+
Aoe: 2
|
|
915
|
+
}, $e = 1, et = 8;
|
|
916
|
+
function tt(e, t) {
|
|
917
|
+
return Math.max(Math.abs(e.x - t.x), Math.abs(e.y - t.y));
|
|
918
|
+
}
|
|
919
|
+
function nt(e, t, n) {
|
|
920
|
+
return tt(e, t) <= n;
|
|
921
|
+
}
|
|
922
|
+
function rt(e, t, n, r) {
|
|
923
|
+
let i = [], a = e.x, o = e.y, s = Math.abs(t.x - a), c = -Math.abs(t.y - o), l = a < t.x ? 1 : -1, u = o < t.y ? 1 : -1, d = s + c, f = 0;
|
|
924
|
+
for (; !(a === t.x && o === t.y);) {
|
|
925
|
+
let e = 2 * d;
|
|
926
|
+
e >= c && (d += c, a += l), e <= s && (d += s, o += u), f++;
|
|
927
|
+
let t = {
|
|
928
|
+
x: a,
|
|
929
|
+
y: o
|
|
930
|
+
};
|
|
931
|
+
if (i.push(t), r(t) || f >= n) break;
|
|
932
|
+
}
|
|
933
|
+
return i;
|
|
934
|
+
}
|
|
935
|
+
function it(e, t) {
|
|
936
|
+
let n = [];
|
|
937
|
+
for (let r = -t; r <= t; r++) for (let i = -t; i <= t; i++) n.push({
|
|
938
|
+
x: e.x + i,
|
|
939
|
+
y: e.y + r
|
|
940
|
+
});
|
|
941
|
+
return n;
|
|
942
|
+
}
|
|
943
|
+
//#endregion
|
|
944
|
+
//#region packages/npm/laser/src/lib/net/connection.ts
|
|
945
|
+
var at = 1e3, ot = 15e3;
|
|
946
|
+
function st(e, t, n) {
|
|
947
|
+
let r = t.trim();
|
|
948
|
+
return n ? e === 1e3 ? "disconnected" : r || `server dropped connection (code ${e})` : e === 1006 ? "cannot reach server — down or rejected" : r || `connection refused (code ${e})`;
|
|
949
|
+
}
|
|
950
|
+
var H = class {
|
|
951
|
+
ws = null;
|
|
952
|
+
closed = !1;
|
|
953
|
+
attempts = 0;
|
|
954
|
+
everOpened = !1;
|
|
955
|
+
timer = 0;
|
|
956
|
+
state = {
|
|
957
|
+
status: "connecting",
|
|
958
|
+
attempts: 0
|
|
959
|
+
};
|
|
960
|
+
opts;
|
|
961
|
+
handlers;
|
|
962
|
+
constructor(e, t) {
|
|
963
|
+
this.opts = {
|
|
964
|
+
maxAttempts: 0,
|
|
965
|
+
baseDelayMs: at,
|
|
966
|
+
maxDelayMs: ot,
|
|
967
|
+
closeReason: st,
|
|
968
|
+
...e
|
|
969
|
+
}, this.handlers = t;
|
|
970
|
+
}
|
|
971
|
+
getState() {
|
|
972
|
+
return this.state;
|
|
973
|
+
}
|
|
974
|
+
isOpen() {
|
|
975
|
+
return this.ws?.readyState === WebSocket.OPEN;
|
|
976
|
+
}
|
|
977
|
+
send(e) {
|
|
978
|
+
this.isOpen() && this.ws.send(e);
|
|
979
|
+
}
|
|
980
|
+
connect() {
|
|
981
|
+
if (this.ws) return;
|
|
982
|
+
this.closed = !1, this.everOpened = !1, this.setState({
|
|
983
|
+
status: this.attempts === 0 ? "connecting" : "reconnecting",
|
|
984
|
+
attempts: this.attempts,
|
|
985
|
+
reason: this.state.reason
|
|
986
|
+
});
|
|
987
|
+
let e = typeof this.opts.url == "function" ? this.opts.url() : this.opts.url, t = new WebSocket(e);
|
|
988
|
+
t.binaryType = "arraybuffer", this.ws = t, t.addEventListener("open", () => {
|
|
989
|
+
this.attempts = 0, this.everOpened = !0, this.setState({
|
|
990
|
+
status: "connected",
|
|
991
|
+
attempts: 0
|
|
992
|
+
}), this.handlers.onOpen?.(t);
|
|
993
|
+
}), t.addEventListener("message", (e) => this.handlers.onMessage?.(e)), t.addEventListener("close", (e) => {
|
|
994
|
+
this.ws = null;
|
|
995
|
+
let t = this.opts.closeReason(e.code, e.reason, this.everOpened);
|
|
996
|
+
if (this.closed) {
|
|
997
|
+
this.setState({
|
|
998
|
+
status: "closed",
|
|
999
|
+
attempts: this.attempts
|
|
1000
|
+
});
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
if (this.opts.shouldReconnect && !this.opts.shouldReconnect()) {
|
|
1004
|
+
this.setState({
|
|
1005
|
+
status: "closed",
|
|
1006
|
+
attempts: this.attempts,
|
|
1007
|
+
reason: t
|
|
1008
|
+
});
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
if (this.attempts += 1, this.opts.maxAttempts > 0 && this.attempts > this.opts.maxAttempts) {
|
|
1012
|
+
this.setState({
|
|
1013
|
+
status: "closed",
|
|
1014
|
+
attempts: this.attempts,
|
|
1015
|
+
reason: t
|
|
1016
|
+
});
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
1019
|
+
let n = Math.min(this.opts.baseDelayMs * 2 ** (this.attempts - 1), this.opts.maxDelayMs);
|
|
1020
|
+
this.setState({
|
|
1021
|
+
status: "reconnecting",
|
|
1022
|
+
attempts: this.attempts,
|
|
1023
|
+
reason: t,
|
|
1024
|
+
nextRetryMs: n
|
|
1025
|
+
}), this.timer = window.setTimeout(() => this.connect(), n);
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
close() {
|
|
1029
|
+
this.closed = !0, window.clearTimeout(this.timer), this.ws?.close(), this.ws = null, this.setState({
|
|
1030
|
+
status: "closed",
|
|
1031
|
+
attempts: this.attempts
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
setState(e) {
|
|
1035
|
+
this.state = e, this.handlers.onState?.(e);
|
|
1036
|
+
}
|
|
1037
|
+
}, ct = 15, lt = 1, ut = 2, dt = 3, ft = 4, pt = 1, mt = 2, ht = 3, gt = 5, _t = 6, vt = 7, yt = 8, bt = 9, xt = 10, St = 11, Ct = 12, wt = 13, Tt = 0, Et = 1, Dt = 2, Ot = 3, kt = 0, At = 1, jt = 2, Mt = 3, Nt = 4, Pt = 5, Ft = 6, It = 7, Lt = 8, Rt = 9, zt = 10, Bt = 11, Vt = 12, Ht = [
|
|
1038
|
+
"none",
|
|
1039
|
+
"fire",
|
|
1040
|
+
"ice",
|
|
1041
|
+
"lightning",
|
|
1042
|
+
"poison",
|
|
1043
|
+
"shadow",
|
|
1044
|
+
"holy",
|
|
1045
|
+
"arcane",
|
|
1046
|
+
"earth",
|
|
1047
|
+
"wind",
|
|
1048
|
+
"nature",
|
|
1049
|
+
"light"
|
|
1050
|
+
], Ut = 3, Wt = 4, Gt = 0, Kt = 1, qt = 2, Jt = [
|
|
1051
|
+
"spades",
|
|
1052
|
+
"hearts",
|
|
1053
|
+
"diamonds",
|
|
1054
|
+
"clubs"
|
|
1055
|
+
], Yt = [
|
|
1056
|
+
"A",
|
|
1057
|
+
"2",
|
|
1058
|
+
"3",
|
|
1059
|
+
"4",
|
|
1060
|
+
"5",
|
|
1061
|
+
"6",
|
|
1062
|
+
"7",
|
|
1063
|
+
"8",
|
|
1064
|
+
"9",
|
|
1065
|
+
"10",
|
|
1066
|
+
"J",
|
|
1067
|
+
"Q",
|
|
1068
|
+
"K"
|
|
1069
|
+
], Xt = [
|
|
1070
|
+
11,
|
|
1071
|
+
2,
|
|
1072
|
+
3,
|
|
1073
|
+
4,
|
|
1074
|
+
5,
|
|
1075
|
+
6,
|
|
1076
|
+
7,
|
|
1077
|
+
8,
|
|
1078
|
+
9,
|
|
1079
|
+
10,
|
|
1080
|
+
10,
|
|
1081
|
+
10,
|
|
1082
|
+
10
|
|
1083
|
+
];
|
|
1084
|
+
function Zt(e) {
|
|
1085
|
+
let t = e & 15, n = e >> 4 & 3;
|
|
1086
|
+
return {
|
|
1087
|
+
suit: Jt[n],
|
|
1088
|
+
rank: Yt[t],
|
|
1089
|
+
points: Xt[t],
|
|
1090
|
+
red: n === 1 || n === 2
|
|
1091
|
+
};
|
|
1092
|
+
}
|
|
1093
|
+
var U = (1n << 64n) - 1n;
|
|
1094
|
+
function Qt(e) {
|
|
1095
|
+
return e = (e ^ e >> 30n) * 13787848793156543929n & U, e = (e ^ e >> 27n) * 10723151780598845931n & U, e ^ e >> 31n;
|
|
1096
|
+
}
|
|
1097
|
+
function $t(e) {
|
|
1098
|
+
let t = [];
|
|
1099
|
+
for (let e = 0; e < 4; e++) for (let e = 0; e < 4; e++) for (let n = 0; n < 13; n++) t.push(e << 4 | n);
|
|
1100
|
+
let n = BigInt(e) & U;
|
|
1101
|
+
for (let e = t.length - 1; e > 0; e--) {
|
|
1102
|
+
n = n + 11400714819323198485n & U;
|
|
1103
|
+
let r = Number(Qt(n) % BigInt(e + 1)), i = t[e];
|
|
1104
|
+
t[e] = t[r], t[r] = i;
|
|
1105
|
+
}
|
|
1106
|
+
return t;
|
|
1107
|
+
}
|
|
1108
|
+
async function en(e, t) {
|
|
1109
|
+
let n = BigInt(e) & U, r = new Uint8Array(8);
|
|
1110
|
+
for (let e = 0; e < 8; e++) r[e] = Number(n & 255n), n >>= 8n;
|
|
1111
|
+
let i = await crypto.subtle.digest("SHA-256", r);
|
|
1112
|
+
return Array.from(new Uint8Array(i)).map((e) => e.toString(16).padStart(2, "0")).join("") === t;
|
|
1113
|
+
}
|
|
1114
|
+
var tn = 65535;
|
|
1115
|
+
function nn(e) {
|
|
1116
|
+
try {
|
|
1117
|
+
return JSON.parse(new TextDecoder().decode(Uint8Array.from(e)));
|
|
1118
|
+
} catch {
|
|
1119
|
+
return null;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
function rn(e, t) {
|
|
1123
|
+
return { JoinMatch: {
|
|
1124
|
+
protocol: 15,
|
|
1125
|
+
jwt: e,
|
|
1126
|
+
kbve_username: t
|
|
1127
|
+
} };
|
|
1128
|
+
}
|
|
1129
|
+
function an(e, t) {
|
|
1130
|
+
return { Frame: {
|
|
1131
|
+
client_tick: e,
|
|
1132
|
+
inputs: t
|
|
1133
|
+
} };
|
|
1134
|
+
}
|
|
1135
|
+
//#endregion
|
|
1136
|
+
//#region packages/npm/laser/src/lib/net/postcard.ts
|
|
1137
|
+
var on = class {
|
|
1138
|
+
buf = [];
|
|
1139
|
+
u8(e) {
|
|
1140
|
+
this.buf.push(e & 255);
|
|
1141
|
+
}
|
|
1142
|
+
i8(e) {
|
|
1143
|
+
this.buf.push(e & 255);
|
|
1144
|
+
}
|
|
1145
|
+
bool(e) {
|
|
1146
|
+
this.buf.push(+!!e);
|
|
1147
|
+
}
|
|
1148
|
+
varU32(e) {
|
|
1149
|
+
let t = e >>> 0;
|
|
1150
|
+
for (; t >= 128;) this.buf.push(t & 127 | 128), t >>>= 7;
|
|
1151
|
+
this.buf.push(t);
|
|
1152
|
+
}
|
|
1153
|
+
varU64(e) {
|
|
1154
|
+
let t = BigInt.asUintN(64, e);
|
|
1155
|
+
for (; t >= 128n;) this.buf.push(Number(t & 127n | 128n)), t >>= 7n;
|
|
1156
|
+
this.buf.push(Number(t));
|
|
1157
|
+
}
|
|
1158
|
+
varI32(e) {
|
|
1159
|
+
this.varU32((e << 1 ^ e >> 31) >>> 0);
|
|
1160
|
+
}
|
|
1161
|
+
varI64(e) {
|
|
1162
|
+
this.varU64(BigInt.asUintN(64, e << 1n ^ e >> 63n));
|
|
1163
|
+
}
|
|
1164
|
+
u16(e) {
|
|
1165
|
+
this.varU32(e & 65535);
|
|
1166
|
+
}
|
|
1167
|
+
u32(e) {
|
|
1168
|
+
this.varU32(e);
|
|
1169
|
+
}
|
|
1170
|
+
i16(e) {
|
|
1171
|
+
this.varI32(e);
|
|
1172
|
+
}
|
|
1173
|
+
i32(e) {
|
|
1174
|
+
this.varI32(e);
|
|
1175
|
+
}
|
|
1176
|
+
string(e) {
|
|
1177
|
+
let t = new TextEncoder().encode(e);
|
|
1178
|
+
this.varU32(t.length);
|
|
1179
|
+
for (let e of t) this.buf.push(e);
|
|
1180
|
+
}
|
|
1181
|
+
seqLen(e) {
|
|
1182
|
+
this.varU32(e);
|
|
1183
|
+
}
|
|
1184
|
+
option(e) {
|
|
1185
|
+
this.buf.push(+!!e);
|
|
1186
|
+
}
|
|
1187
|
+
variant(e) {
|
|
1188
|
+
this.varU32(e);
|
|
1189
|
+
}
|
|
1190
|
+
bytes() {
|
|
1191
|
+
return Uint8Array.from(this.buf);
|
|
1192
|
+
}
|
|
1193
|
+
}, W = class {
|
|
1194
|
+
off = 0;
|
|
1195
|
+
constructor(e) {
|
|
1196
|
+
this.data = e;
|
|
1197
|
+
}
|
|
1198
|
+
next() {
|
|
1199
|
+
return this.data[this.off++];
|
|
1200
|
+
}
|
|
1201
|
+
u8() {
|
|
1202
|
+
return this.next();
|
|
1203
|
+
}
|
|
1204
|
+
i8() {
|
|
1205
|
+
let e = this.next();
|
|
1206
|
+
return e < 128 ? e : e - 256;
|
|
1207
|
+
}
|
|
1208
|
+
bool() {
|
|
1209
|
+
return this.next() !== 0;
|
|
1210
|
+
}
|
|
1211
|
+
varU32() {
|
|
1212
|
+
let e = 0, t = 0, n;
|
|
1213
|
+
do
|
|
1214
|
+
n = this.next(), e |= (n & 127) << t, t += 7;
|
|
1215
|
+
while (n & 128);
|
|
1216
|
+
return e >>> 0;
|
|
1217
|
+
}
|
|
1218
|
+
varU64() {
|
|
1219
|
+
let e = 0n, t = 0n, n;
|
|
1220
|
+
do
|
|
1221
|
+
n = this.next(), e |= BigInt(n & 127) << t, t += 7n;
|
|
1222
|
+
while (n & 128);
|
|
1223
|
+
return e;
|
|
1224
|
+
}
|
|
1225
|
+
varI32() {
|
|
1226
|
+
let e = this.varU32();
|
|
1227
|
+
return e >>> 1 ^ -(e & 1);
|
|
1228
|
+
}
|
|
1229
|
+
varI64() {
|
|
1230
|
+
let e = this.varU64();
|
|
1231
|
+
return e >> 1n ^ -(e & 1n);
|
|
1232
|
+
}
|
|
1233
|
+
u16() {
|
|
1234
|
+
return this.varU32();
|
|
1235
|
+
}
|
|
1236
|
+
u32() {
|
|
1237
|
+
return this.varU32();
|
|
1238
|
+
}
|
|
1239
|
+
i16() {
|
|
1240
|
+
return this.varI32();
|
|
1241
|
+
}
|
|
1242
|
+
i32() {
|
|
1243
|
+
return this.varI32();
|
|
1244
|
+
}
|
|
1245
|
+
string() {
|
|
1246
|
+
let e = this.varU32(), t = this.data.subarray(this.off, this.off + e);
|
|
1247
|
+
return this.off += e, new TextDecoder().decode(t);
|
|
1248
|
+
}
|
|
1249
|
+
seqLen() {
|
|
1250
|
+
return this.varU32();
|
|
1251
|
+
}
|
|
1252
|
+
option() {
|
|
1253
|
+
return this.next() !== 0;
|
|
1254
|
+
}
|
|
1255
|
+
variant() {
|
|
1256
|
+
return this.varU32();
|
|
1257
|
+
}
|
|
1258
|
+
remaining() {
|
|
1259
|
+
return this.data.length - this.off;
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
function sn(e) {
|
|
1263
|
+
let t = [], n = t.length;
|
|
1264
|
+
t.push(0);
|
|
1265
|
+
let r = 1;
|
|
1266
|
+
for (let i of e) i === 0 ? (t[n] = r, n = t.length, t.push(0), r = 1) : (t.push(i), r += 1, r === 255 && (t[n] = r, n = t.length, t.push(0), r = 1));
|
|
1267
|
+
return t[n] = r, t.push(0), Uint8Array.from(t);
|
|
1268
|
+
}
|
|
1269
|
+
function cn(e) {
|
|
1270
|
+
let t = [], n = 0;
|
|
1271
|
+
for (; n < e.length;) {
|
|
1272
|
+
let r = e[n++];
|
|
1273
|
+
if (r === 0) break;
|
|
1274
|
+
for (let i = 1; i < r && n < e.length; i++) t.push(e[n++]);
|
|
1275
|
+
r !== 255 && n < e.length && e[n] !== 0 && t.push(0);
|
|
1276
|
+
}
|
|
1277
|
+
return Uint8Array.from(t);
|
|
1278
|
+
}
|
|
1279
|
+
//#endregion
|
|
1280
|
+
//#region packages/npm/laser/src/lib/net/postcard-wire.ts
|
|
1281
|
+
var ln = {
|
|
1282
|
+
Up: 0,
|
|
1283
|
+
Down: 1,
|
|
1284
|
+
Left: 2,
|
|
1285
|
+
Right: 3
|
|
1286
|
+
}, un = {
|
|
1287
|
+
Down: 0,
|
|
1288
|
+
Up: 1,
|
|
1289
|
+
Left: 2,
|
|
1290
|
+
Right: 3
|
|
1291
|
+
}, dn = {
|
|
1292
|
+
Hit: 0,
|
|
1293
|
+
Stand: 1,
|
|
1294
|
+
Double: 2,
|
|
1295
|
+
Split: 3,
|
|
1296
|
+
Surrender: 4
|
|
1297
|
+
};
|
|
1298
|
+
function G(e, t) {
|
|
1299
|
+
e.i32(t.x), e.i32(t.y);
|
|
1300
|
+
}
|
|
1301
|
+
function fn(e, t) {
|
|
1302
|
+
t == null ? e.option(!1) : (e.option(!0), e.u32(t));
|
|
1303
|
+
}
|
|
1304
|
+
function pn(e, t) {
|
|
1305
|
+
if (typeof t == "string") {
|
|
1306
|
+
switch (t) {
|
|
1307
|
+
case "Leave": return e.variant(13);
|
|
1308
|
+
case "TradeAccept": return e.variant(15);
|
|
1309
|
+
case "TradeCancel": return e.variant(16);
|
|
1310
|
+
case "LeaveTable": return e.variant(20);
|
|
1311
|
+
case "ExitShip": return e.variant(26);
|
|
1312
|
+
case "LaunchSpace": return e.variant(29);
|
|
1313
|
+
case "ReturnSpace": return e.variant(30);
|
|
1314
|
+
case "SimPetBattle": return e.variant(31);
|
|
1315
|
+
}
|
|
1316
|
+
return;
|
|
1317
|
+
}
|
|
1318
|
+
if ("Step" in t) e.variant(0), e.variant(ln[t.Step.dir]);
|
|
1319
|
+
else if ("Move" in t) {
|
|
1320
|
+
let n = t.Move;
|
|
1321
|
+
e.variant(1), e.u32(n.seq), e.i8(n.mx), e.i8(n.my), e.bool(n.run), e.u32(n.tick);
|
|
1322
|
+
} else if ("MoveTo" in t) e.variant(2), G(e, t.MoveTo.tile);
|
|
1323
|
+
else if ("Face" in t) e.variant(3), e.variant(un[t.Face.facing]);
|
|
1324
|
+
else if ("Action" in t) e.variant(4), e.u16(t.Action.id), fn(e, t.Action.target);
|
|
1325
|
+
else if ("CastSpell" in t) e.variant(5), e.string(t.CastSpell.spell_ref), fn(e, t.CastSpell.target);
|
|
1326
|
+
else if ("UseItem" in t) e.variant(6), e.string(t.UseItem.item_ref);
|
|
1327
|
+
else if ("DropItem" in t) e.variant(7), e.string(t.DropItem.item_ref), e.u32(t.DropItem.qty);
|
|
1328
|
+
else if ("MoveItem" in t) e.variant(8), e.u32(t.MoveItem.from), e.u32(t.MoveItem.to);
|
|
1329
|
+
else if ("EquipItem" in t) e.variant(9), e.string(t.EquipItem.item_ref);
|
|
1330
|
+
else if ("PlaceItem" in t) e.variant(10), e.string(t.PlaceItem.item_ref), G(e, t.PlaceItem.tile), e.u8(t.PlaceItem.rot & 3);
|
|
1331
|
+
else if ("PickupObject" in t) e.variant(11), G(e, t.PickupObject.tile);
|
|
1332
|
+
else if ("Heartbeat" in t) e.variant(12), e.u32(t.Heartbeat.client_tick);
|
|
1333
|
+
else if ("TradeOffer" in t) {
|
|
1334
|
+
e.variant(14), e.u32(t.TradeOffer.target), e.seqLen(t.TradeOffer.items.length);
|
|
1335
|
+
for (let [n, r] of t.TradeOffer.items) e.string(n), e.u32(r);
|
|
1336
|
+
} else "BuyItem" in t ? (e.variant(17), e.u32(t.BuyItem.npc), e.string(t.BuyItem.item_ref), e.u32(t.BuyItem.qty)) : "SellItem" in t ? (e.variant(18), e.u32(t.SellItem.npc), e.string(t.SellItem.item_ref), e.u32(t.SellItem.qty)) : "JoinTable" in t ? (e.variant(19), e.string(t.JoinTable.table_ref)) : "PlaceBet" in t ? (e.variant(21), e.u32(t.PlaceBet.amount)) : "BjAction" in t ? (e.variant(22), e.variant(dn[t.BjAction.kind])) : "Insure" in t ? (e.variant(23), e.u32(t.Insure.amount)) : "Fell" in t ? (e.variant(24), G(e, t.Fell.tile)) : "EnterShip" in t ? (e.variant(25), e.u32(t.EnterShip.ship)) : "ExitShip" in t ? e.variant(26) : "OpenCorpse" in t ? (e.variant(27), e.u32(t.OpenCorpse.corpse)) : "TakeFromCorpse" in t ? (e.variant(28), e.u32(t.TakeFromCorpse.corpse), e.u32(t.TakeFromCorpse.slot)) : "PetTurn" in t && (e.variant(32), e.u8(t.PetTurn.action), e.u8(t.PetTurn.arg));
|
|
1337
|
+
}
|
|
1338
|
+
var mn = [
|
|
1339
|
+
"Down",
|
|
1340
|
+
"Up",
|
|
1341
|
+
"Left",
|
|
1342
|
+
"Right"
|
|
1343
|
+
], hn = [
|
|
1344
|
+
"Poison",
|
|
1345
|
+
"Regen",
|
|
1346
|
+
"Haste",
|
|
1347
|
+
"Burn"
|
|
1348
|
+
];
|
|
1349
|
+
function K(e) {
|
|
1350
|
+
return {
|
|
1351
|
+
x: e.i32(),
|
|
1352
|
+
y: e.i32()
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
function gn(e) {
|
|
1356
|
+
return {
|
|
1357
|
+
kind: e.u16(),
|
|
1358
|
+
ref: e.string(),
|
|
1359
|
+
cat: e.u8()
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
function _n(e) {
|
|
1363
|
+
return {
|
|
1364
|
+
kind: hn[e.variant()],
|
|
1365
|
+
remaining: e.u16()
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
function vn(e) {
|
|
1369
|
+
return {
|
|
1370
|
+
slot: e.u16(),
|
|
1371
|
+
kbve_username: e.string(),
|
|
1372
|
+
connected: e.bool()
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1375
|
+
function yn(e) {
|
|
1376
|
+
let t = e.u32(), n = e.u16(), r = e.u16(), i = K(e), a = mn[e.variant()], o = e.u8(), s = e.i32(), c = e.i32(), l = e.i16(), u = e.i16(), d = e.u32(), f = e.i32(), ee = e.i32(), p = e.bool(), m = e.i32(), h = [];
|
|
1377
|
+
for (let t = e.seqLen(); t > 0; t--) h.push(_n(e));
|
|
1378
|
+
return {
|
|
1379
|
+
eid: t,
|
|
1380
|
+
kind: n,
|
|
1381
|
+
owner: r,
|
|
1382
|
+
tile: i,
|
|
1383
|
+
facing: a,
|
|
1384
|
+
sub: o,
|
|
1385
|
+
qx: s,
|
|
1386
|
+
qy: c,
|
|
1387
|
+
qvx: l,
|
|
1388
|
+
qvy: u,
|
|
1389
|
+
input_ack: d,
|
|
1390
|
+
hp: f,
|
|
1391
|
+
max_hp: ee,
|
|
1392
|
+
destroyed: p,
|
|
1393
|
+
z: m,
|
|
1394
|
+
effects: h,
|
|
1395
|
+
piloting: e.u32()
|
|
1396
|
+
};
|
|
1397
|
+
}
|
|
1398
|
+
function bn(e) {
|
|
1399
|
+
let t = e.u32(), n = e.u32(), r = e.u32(), i = [];
|
|
1400
|
+
for (let t = e.seqLen(); t > 0; t--) i.push(vn(e));
|
|
1401
|
+
let a = [];
|
|
1402
|
+
for (let t = e.seqLen(); t > 0; t--) a.push(yn(e));
|
|
1403
|
+
return {
|
|
1404
|
+
tick: t,
|
|
1405
|
+
server_time_ms: n,
|
|
1406
|
+
input_ack: r,
|
|
1407
|
+
players: i,
|
|
1408
|
+
entities: a,
|
|
1409
|
+
keyframe: e.bool()
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
function xn(e) {
|
|
1413
|
+
let t = new W(cn(e)), n = t.variant();
|
|
1414
|
+
switch (n) {
|
|
1415
|
+
case 0: {
|
|
1416
|
+
let e = t.u32(), n = t.u16(), r = Number(t.varU64()), i = [];
|
|
1417
|
+
for (let e = t.seqLen(); e > 0; e--) i.push(gn(t));
|
|
1418
|
+
return { Welcome: {
|
|
1419
|
+
protocol: e,
|
|
1420
|
+
your_slot: n,
|
|
1421
|
+
seed: r,
|
|
1422
|
+
registry: i
|
|
1423
|
+
} };
|
|
1424
|
+
}
|
|
1425
|
+
case 1: return { Snapshot: bn(t) };
|
|
1426
|
+
case 2: {
|
|
1427
|
+
let e = t.u16(), n = t.u16(), r = [];
|
|
1428
|
+
for (let e = t.seqLen(); e > 0; e--) r.push(t.u8());
|
|
1429
|
+
return { Ephemeral: {
|
|
1430
|
+
kind: e,
|
|
1431
|
+
to: n,
|
|
1432
|
+
payload: r
|
|
1433
|
+
} };
|
|
1434
|
+
}
|
|
1435
|
+
case 3: return { Reject: { reason: t.string() } };
|
|
1436
|
+
default: throw Error(`postcard: unknown ServerEvent variant ${n}`);
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
function Sn(e) {
|
|
1440
|
+
return {
|
|
1441
|
+
attacker: e.u32(),
|
|
1442
|
+
from: K(e),
|
|
1443
|
+
to: K(e),
|
|
1444
|
+
kind: e.string(),
|
|
1445
|
+
hit: e.bool()
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
function Cn(e) {
|
|
1449
|
+
return Sn(new W(Uint8Array.from(e)));
|
|
1450
|
+
}
|
|
1451
|
+
function wn(e) {
|
|
1452
|
+
return {
|
|
1453
|
+
z: e.i32(),
|
|
1454
|
+
tile: K(e)
|
|
1455
|
+
};
|
|
1456
|
+
}
|
|
1457
|
+
function Tn(e) {
|
|
1458
|
+
return wn(new W(Uint8Array.from(e)));
|
|
1459
|
+
}
|
|
1460
|
+
function En(e) {
|
|
1461
|
+
return {
|
|
1462
|
+
item_ref: e.string(),
|
|
1463
|
+
count: e.u32()
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
function Dn(e) {
|
|
1467
|
+
return En(new W(Uint8Array.from(e)));
|
|
1468
|
+
}
|
|
1469
|
+
function q(e) {
|
|
1470
|
+
return {
|
|
1471
|
+
species_ref: e.string(),
|
|
1472
|
+
nickname: e.string(),
|
|
1473
|
+
level: e.u32(),
|
|
1474
|
+
hp: e.i32(),
|
|
1475
|
+
max_hp: e.i32()
|
|
1476
|
+
};
|
|
1477
|
+
}
|
|
1478
|
+
function On(e) {
|
|
1479
|
+
return {
|
|
1480
|
+
kind: e.u8(),
|
|
1481
|
+
side: e.u8(),
|
|
1482
|
+
value: e.i32(),
|
|
1483
|
+
hp: e.i32(),
|
|
1484
|
+
flag: e.u8(),
|
|
1485
|
+
text: e.string()
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
function kn(e) {
|
|
1489
|
+
let t = new W(Uint8Array.from(e)), n = [];
|
|
1490
|
+
for (let e = t.seqLen(); e > 0; e--) n.push(q(t));
|
|
1491
|
+
let r = [];
|
|
1492
|
+
for (let e = t.seqLen(); e > 0; e--) r.push(q(t));
|
|
1493
|
+
let i = [];
|
|
1494
|
+
for (let e = t.seqLen(); e > 0; e--) i.push(On(t));
|
|
1495
|
+
return {
|
|
1496
|
+
player: n,
|
|
1497
|
+
enemy: r,
|
|
1498
|
+
events: i,
|
|
1499
|
+
outcome: t.string()
|
|
1500
|
+
};
|
|
1501
|
+
}
|
|
1502
|
+
function An(e) {
|
|
1503
|
+
return {
|
|
1504
|
+
slot: e.u8(),
|
|
1505
|
+
name: e.string(),
|
|
1506
|
+
element: e.string(),
|
|
1507
|
+
category: e.u8(),
|
|
1508
|
+
power: e.i32(),
|
|
1509
|
+
accuracy: e.u32(),
|
|
1510
|
+
pp: e.u32(),
|
|
1511
|
+
max_pp: e.u32()
|
|
1512
|
+
};
|
|
1513
|
+
}
|
|
1514
|
+
function jn(e) {
|
|
1515
|
+
let t = new W(Uint8Array.from(e)), n = [];
|
|
1516
|
+
for (let e = t.seqLen(); e > 0; e--) n.push(q(t));
|
|
1517
|
+
let r = [];
|
|
1518
|
+
for (let e = t.seqLen(); e > 0; e--) r.push(q(t));
|
|
1519
|
+
let i = t.u8(), a = t.u8(), o = [];
|
|
1520
|
+
for (let e = t.seqLen(); e > 0; e--) o.push(An(t));
|
|
1521
|
+
let s = [];
|
|
1522
|
+
for (let e = t.seqLen(); e > 0; e--) s.push(On(t));
|
|
1523
|
+
return {
|
|
1524
|
+
player: n,
|
|
1525
|
+
enemy: r,
|
|
1526
|
+
p_active: i,
|
|
1527
|
+
e_active: a,
|
|
1528
|
+
moves: o,
|
|
1529
|
+
events: s,
|
|
1530
|
+
outcome: t.string(),
|
|
1531
|
+
awaiting: t.bool(),
|
|
1532
|
+
can_run: t.bool()
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
function Mn(e) {
|
|
1536
|
+
let t = new W(Uint8Array.from(e)), n = t.u32(), r = [];
|
|
1537
|
+
for (let e = t.seqLen(); e > 0; e--) r.push([t.string(), t.u32()]);
|
|
1538
|
+
return {
|
|
1539
|
+
corpse: n,
|
|
1540
|
+
items: r
|
|
1541
|
+
};
|
|
1542
|
+
}
|
|
1543
|
+
function Nn(e) {
|
|
1544
|
+
return {
|
|
1545
|
+
item_ref: e.string(),
|
|
1546
|
+
heal: e.i32()
|
|
1547
|
+
};
|
|
1548
|
+
}
|
|
1549
|
+
function Pn(e) {
|
|
1550
|
+
return Nn(new W(Uint8Array.from(e)));
|
|
1551
|
+
}
|
|
1552
|
+
function J(e) {
|
|
1553
|
+
return e.option() ? e.string() : null;
|
|
1554
|
+
}
|
|
1555
|
+
function Fn(e) {
|
|
1556
|
+
return {
|
|
1557
|
+
attacker: e.u32(),
|
|
1558
|
+
target: e.u32(),
|
|
1559
|
+
target_ref: J(e),
|
|
1560
|
+
dmg: e.i32(),
|
|
1561
|
+
crit: e.bool(),
|
|
1562
|
+
died: e.bool()
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1565
|
+
function In(e) {
|
|
1566
|
+
return Fn(new W(Uint8Array.from(e)));
|
|
1567
|
+
}
|
|
1568
|
+
function Ln(e) {
|
|
1569
|
+
return {
|
|
1570
|
+
item_ref: J(e),
|
|
1571
|
+
slot: e.string(),
|
|
1572
|
+
attack: e.i32(),
|
|
1573
|
+
defense: e.i32()
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
function Rn(e) {
|
|
1577
|
+
return Ln(new W(Uint8Array.from(e)));
|
|
1578
|
+
}
|
|
1579
|
+
function zn(e) {
|
|
1580
|
+
return {
|
|
1581
|
+
level: e.i32(),
|
|
1582
|
+
xp: e.i32(),
|
|
1583
|
+
xp_next: e.i32(),
|
|
1584
|
+
max_hp: e.i32(),
|
|
1585
|
+
attack: e.i32(),
|
|
1586
|
+
kills: e.u32(),
|
|
1587
|
+
mp: e.i32(),
|
|
1588
|
+
max_mp: e.i32()
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
function Bn(e) {
|
|
1592
|
+
return zn(new W(Uint8Array.from(e)));
|
|
1593
|
+
}
|
|
1594
|
+
function Vn(e) {
|
|
1595
|
+
return {
|
|
1596
|
+
item_ref: e.string(),
|
|
1597
|
+
tile: K(e),
|
|
1598
|
+
ok: e.bool(),
|
|
1599
|
+
reason: J(e) ?? void 0
|
|
1600
|
+
};
|
|
1601
|
+
}
|
|
1602
|
+
function Hn(e) {
|
|
1603
|
+
return Vn(new W(Uint8Array.from(e)));
|
|
1604
|
+
}
|
|
1605
|
+
function Un(e) {
|
|
1606
|
+
let t = [];
|
|
1607
|
+
for (let n = e.seqLen(); n > 0; n--) {
|
|
1608
|
+
let n = e.string(), r = e.string(), i = e.u32();
|
|
1609
|
+
t.push({
|
|
1610
|
+
id: n,
|
|
1611
|
+
ref: r,
|
|
1612
|
+
count: i
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1615
|
+
return { items: t };
|
|
1616
|
+
}
|
|
1617
|
+
function Wn(e) {
|
|
1618
|
+
return Un(new W(Uint8Array.from(e)));
|
|
1619
|
+
}
|
|
1620
|
+
function Gn(e) {
|
|
1621
|
+
return {
|
|
1622
|
+
action: e.string(),
|
|
1623
|
+
item_ref: e.string(),
|
|
1624
|
+
qty: e.u32(),
|
|
1625
|
+
ok: e.bool(),
|
|
1626
|
+
reason: e.string(),
|
|
1627
|
+
balance: e.u32()
|
|
1628
|
+
};
|
|
1629
|
+
}
|
|
1630
|
+
function Kn(e) {
|
|
1631
|
+
return Gn(new W(Uint8Array.from(e)));
|
|
1632
|
+
}
|
|
1633
|
+
function qn(e) {
|
|
1634
|
+
let t = [];
|
|
1635
|
+
for (let n = e.seqLen(); n > 0; n--) t.push(e.u8());
|
|
1636
|
+
return {
|
|
1637
|
+
cards: t,
|
|
1638
|
+
bet: e.u32(),
|
|
1639
|
+
value: e.u32(),
|
|
1640
|
+
soft: e.bool(),
|
|
1641
|
+
doubled: e.bool(),
|
|
1642
|
+
surrendered: e.bool(),
|
|
1643
|
+
done: e.bool(),
|
|
1644
|
+
outcome: J(e)
|
|
1645
|
+
};
|
|
1646
|
+
}
|
|
1647
|
+
function Jn(e) {
|
|
1648
|
+
let t = e.u16(), n = e.string(), r = e.u32(), i = e.u32(), a = [];
|
|
1649
|
+
for (let t = e.seqLen(); t > 0; t--) a.push(qn(e));
|
|
1650
|
+
return {
|
|
1651
|
+
slot: t,
|
|
1652
|
+
username: n,
|
|
1653
|
+
bet: r,
|
|
1654
|
+
insurance: i,
|
|
1655
|
+
hands: a,
|
|
1656
|
+
disconnected: e.bool()
|
|
1657
|
+
};
|
|
1658
|
+
}
|
|
1659
|
+
function Yn(e) {
|
|
1660
|
+
let t = e.string(), n = e.string(), r = [];
|
|
1661
|
+
for (let t = e.seqLen(); t > 0; t--) r.push(Jn(e));
|
|
1662
|
+
let i = [];
|
|
1663
|
+
for (let t = e.seqLen(); t > 0; t--) i.push(e.u8());
|
|
1664
|
+
return {
|
|
1665
|
+
table_ref: t,
|
|
1666
|
+
phase: n,
|
|
1667
|
+
seats: r,
|
|
1668
|
+
dealer_hand: i,
|
|
1669
|
+
dealer_hidden: e.bool(),
|
|
1670
|
+
active_slot: e.option() ? e.u16() : null,
|
|
1671
|
+
active_hand: e.option() ? e.u32() : null,
|
|
1672
|
+
your_balance: e.u32(),
|
|
1673
|
+
deadline_ms: e.u32(),
|
|
1674
|
+
commitment: e.string(),
|
|
1675
|
+
seed: J(e)
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
function Xn(e) {
|
|
1679
|
+
return Yn(new W(Uint8Array.from(e)));
|
|
1680
|
+
}
|
|
1681
|
+
function Zn(e) {
|
|
1682
|
+
let t = new on();
|
|
1683
|
+
if ("JoinMatch" in e) t.variant(0), t.u32(e.JoinMatch.protocol), t.string(e.JoinMatch.jwt), t.string(e.JoinMatch.kbve_username);
|
|
1684
|
+
else {
|
|
1685
|
+
t.variant(1);
|
|
1686
|
+
let n = e.Frame;
|
|
1687
|
+
t.u32(n.client_tick), t.seqLen(n.inputs.length);
|
|
1688
|
+
for (let e of n.inputs) pn(t, e);
|
|
1689
|
+
}
|
|
1690
|
+
return sn(t.bytes());
|
|
1691
|
+
}
|
|
1692
|
+
//#endregion
|
|
1693
|
+
//#region packages/npm/laser/src/lib/net/game-client.ts
|
|
1694
|
+
var Qn = class {
|
|
1695
|
+
clientTick = 0;
|
|
1696
|
+
moveSeq = 0;
|
|
1697
|
+
unackedMoves = [];
|
|
1698
|
+
terminal = !1;
|
|
1699
|
+
bus = new y();
|
|
1700
|
+
opts;
|
|
1701
|
+
socket;
|
|
1702
|
+
constructor(e) {
|
|
1703
|
+
this.opts = e, this.socket = new H({
|
|
1704
|
+
url: e.url,
|
|
1705
|
+
maxAttempts: e.maxReconnects ?? 3,
|
|
1706
|
+
baseDelayMs: 1500,
|
|
1707
|
+
shouldReconnect: () => !this.terminal
|
|
1708
|
+
}, {
|
|
1709
|
+
onOpen: () => {
|
|
1710
|
+
this.send(rn(this.opts.jwt, this.opts.kbveUsername)), this.bus.emit("open", void 0);
|
|
1711
|
+
},
|
|
1712
|
+
onMessage: (e) => this.handleMessage(e),
|
|
1713
|
+
onState: (e) => {
|
|
1714
|
+
this.bus.emit("state", e), e.status === "closed" && this.bus.emit("close", void 0);
|
|
1715
|
+
}
|
|
1716
|
+
});
|
|
1717
|
+
}
|
|
1718
|
+
on(e, t) {
|
|
1719
|
+
return this.bus.on(e, t);
|
|
1720
|
+
}
|
|
1721
|
+
getState() {
|
|
1722
|
+
return this.socket.getState();
|
|
1723
|
+
}
|
|
1724
|
+
connect() {
|
|
1725
|
+
this.socket.connect();
|
|
1726
|
+
}
|
|
1727
|
+
markTerminal() {
|
|
1728
|
+
this.terminal = !0;
|
|
1729
|
+
}
|
|
1730
|
+
handleMessage(e) {
|
|
1731
|
+
if (!(e.data instanceof ArrayBuffer)) return;
|
|
1732
|
+
let t;
|
|
1733
|
+
try {
|
|
1734
|
+
t = xn(new Uint8Array(e.data));
|
|
1735
|
+
} catch {
|
|
1736
|
+
return;
|
|
1737
|
+
}
|
|
1738
|
+
"Welcome" in t ? this.bus.emit("welcome", t.Welcome) : "Snapshot" in t ? this.bus.emit("snapshot", t.Snapshot) : "Ephemeral" in t ? this.handleEphemeral(t.Ephemeral) : "Reject" in t && (this.terminal = !0, this.bus.emit("reject", t.Reject.reason));
|
|
1739
|
+
}
|
|
1740
|
+
handleEphemeral(e) {
|
|
1741
|
+
if (this.bus.emit("ephemeral", e), e.kind === 1) {
|
|
1742
|
+
let t = Wn(e.payload);
|
|
1743
|
+
t && this.bus.emit("inventory", t);
|
|
1744
|
+
} else if (e.kind === 2) {
|
|
1745
|
+
let t = In(e.payload);
|
|
1746
|
+
t && this.bus.emit("combat", t);
|
|
1747
|
+
} else if (e.kind === 12) {
|
|
1748
|
+
let t = Cn(e.payload);
|
|
1749
|
+
t && this.bus.emit("projectile", t);
|
|
1750
|
+
} else if (e.kind === 13) {
|
|
1751
|
+
let t = Tn(e.payload);
|
|
1752
|
+
t && this.bus.emit("floor", t);
|
|
1753
|
+
} else if (e.kind === 3) {
|
|
1754
|
+
let t = Dn(e.payload);
|
|
1755
|
+
t && this.bus.emit("pickup", t);
|
|
1756
|
+
} else if (e.kind === 16) {
|
|
1757
|
+
let t = Mn(e.payload);
|
|
1758
|
+
t && this.bus.emit("corpse", t);
|
|
1759
|
+
} else if (e.kind === 5) {
|
|
1760
|
+
let t = Pn(e.payload);
|
|
1761
|
+
t && this.bus.emit("itemUsed", t);
|
|
1762
|
+
} else if (e.kind === 14) {
|
|
1763
|
+
let t = Hn(e.payload);
|
|
1764
|
+
t && this.bus.emit("itemPlaced", t);
|
|
1765
|
+
} else if (e.kind === 6) {
|
|
1766
|
+
let t = Rn(e.payload);
|
|
1767
|
+
t && this.bus.emit("equipped", t);
|
|
1768
|
+
} else if (e.kind === 7) {
|
|
1769
|
+
let t = Bn(e.payload);
|
|
1770
|
+
t && this.bus.emit("stats", t);
|
|
1771
|
+
} else if (e.kind === 10) {
|
|
1772
|
+
let t = Kn(e.payload);
|
|
1773
|
+
t && this.bus.emit("shop", t);
|
|
1774
|
+
} else if (e.kind === 11) {
|
|
1775
|
+
let t = Xn(e.payload);
|
|
1776
|
+
t && this.bus.emit("blackjackState", t);
|
|
1777
|
+
} else if (e.kind === 18) {
|
|
1778
|
+
let t = kn(e.payload);
|
|
1779
|
+
t && this.bus.emit("petBattleReplay", t);
|
|
1780
|
+
} else if (e.kind === 19) {
|
|
1781
|
+
let t = jn(e.payload);
|
|
1782
|
+
t && this.bus.emit("petBattleState", t);
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
send(e) {
|
|
1786
|
+
this.socket.send(Zn(e));
|
|
1787
|
+
}
|
|
1788
|
+
sendInputs(e) {
|
|
1789
|
+
!this.socket.isOpen() || e.length === 0 || (this.clientTick += 1, this.send(an(this.clientTick, e)));
|
|
1790
|
+
}
|
|
1791
|
+
move(e, t, n, r) {
|
|
1792
|
+
this.moveSeq += 1;
|
|
1793
|
+
let i = this.moveSeq;
|
|
1794
|
+
return this.unackedMoves.push({
|
|
1795
|
+
seq: i,
|
|
1796
|
+
mx: e,
|
|
1797
|
+
my: t,
|
|
1798
|
+
run: n
|
|
1799
|
+
}), this.unackedMoves.length > 256 && this.unackedMoves.shift(), this.sendInputs([{ Move: {
|
|
1800
|
+
seq: i,
|
|
1801
|
+
mx: e,
|
|
1802
|
+
my: t,
|
|
1803
|
+
run: n,
|
|
1804
|
+
tick: r
|
|
1805
|
+
} }]), i;
|
|
1806
|
+
}
|
|
1807
|
+
ackMoves(e) {
|
|
1808
|
+
return e > 0 && (this.unackedMoves = this.unackedMoves.filter((t) => t.seq > e)), this.unackedMoves;
|
|
1809
|
+
}
|
|
1810
|
+
action(e, t) {
|
|
1811
|
+
this.sendInputs([{ Action: {
|
|
1812
|
+
id: e,
|
|
1813
|
+
target: t
|
|
1814
|
+
} }]);
|
|
1815
|
+
}
|
|
1816
|
+
heartbeat() {
|
|
1817
|
+
this.sendInputs([{ Heartbeat: { client_tick: this.clientTick } }]);
|
|
1818
|
+
}
|
|
1819
|
+
useItem(e) {
|
|
1820
|
+
this.sendInputs([{ UseItem: { item_ref: e } }]);
|
|
1821
|
+
}
|
|
1822
|
+
simPetBattle() {
|
|
1823
|
+
this.sendInputs(["SimPetBattle"]);
|
|
1824
|
+
}
|
|
1825
|
+
petTurn(e, t) {
|
|
1826
|
+
this.sendInputs([{ PetTurn: {
|
|
1827
|
+
action: e,
|
|
1828
|
+
arg: t
|
|
1829
|
+
} }]);
|
|
1830
|
+
}
|
|
1831
|
+
castSpell(e, t) {
|
|
1832
|
+
this.sendInputs([{ CastSpell: {
|
|
1833
|
+
spell_ref: e,
|
|
1834
|
+
target: t
|
|
1835
|
+
} }]);
|
|
1836
|
+
}
|
|
1837
|
+
dropItem(e, t) {
|
|
1838
|
+
this.sendInputs([{ DropItem: {
|
|
1839
|
+
item_ref: e,
|
|
1840
|
+
qty: t
|
|
1841
|
+
} }]);
|
|
1842
|
+
}
|
|
1843
|
+
moveItem(e, t) {
|
|
1844
|
+
this.sendInputs([{ MoveItem: {
|
|
1845
|
+
from: e,
|
|
1846
|
+
to: t
|
|
1847
|
+
} }]);
|
|
1848
|
+
}
|
|
1849
|
+
equipItem(e) {
|
|
1850
|
+
this.sendInputs([{ EquipItem: { item_ref: e } }]);
|
|
1851
|
+
}
|
|
1852
|
+
enterShip(e) {
|
|
1853
|
+
this.sendInputs([{ EnterShip: { ship: e } }]);
|
|
1854
|
+
}
|
|
1855
|
+
exitShip() {
|
|
1856
|
+
this.sendInputs(["ExitShip"]);
|
|
1857
|
+
}
|
|
1858
|
+
launchSpace() {
|
|
1859
|
+
this.sendInputs(["LaunchSpace"]);
|
|
1860
|
+
}
|
|
1861
|
+
returnSpace() {
|
|
1862
|
+
this.sendInputs(["ReturnSpace"]);
|
|
1863
|
+
}
|
|
1864
|
+
placeItem(e, t, n = 0) {
|
|
1865
|
+
this.sendInputs([{ PlaceItem: {
|
|
1866
|
+
item_ref: e,
|
|
1867
|
+
tile: t,
|
|
1868
|
+
rot: n
|
|
1869
|
+
} }]);
|
|
1870
|
+
}
|
|
1871
|
+
openCorpse(e) {
|
|
1872
|
+
this.sendInputs([{ OpenCorpse: { corpse: e } }]);
|
|
1873
|
+
}
|
|
1874
|
+
takeFromCorpse(e, t) {
|
|
1875
|
+
this.sendInputs([{ TakeFromCorpse: {
|
|
1876
|
+
corpse: e,
|
|
1877
|
+
slot: t
|
|
1878
|
+
} }]);
|
|
1879
|
+
}
|
|
1880
|
+
pickupObject(e) {
|
|
1881
|
+
this.sendInputs([{ PickupObject: { tile: e } }]);
|
|
1882
|
+
}
|
|
1883
|
+
fell(e) {
|
|
1884
|
+
this.sendInputs([{ Fell: { tile: e } }]);
|
|
1885
|
+
}
|
|
1886
|
+
buyItem(e, t, n) {
|
|
1887
|
+
this.sendInputs([{ BuyItem: {
|
|
1888
|
+
npc: e,
|
|
1889
|
+
item_ref: t,
|
|
1890
|
+
qty: n
|
|
1891
|
+
} }]);
|
|
1892
|
+
}
|
|
1893
|
+
sellItem(e, t, n) {
|
|
1894
|
+
this.sendInputs([{ SellItem: {
|
|
1895
|
+
npc: e,
|
|
1896
|
+
item_ref: t,
|
|
1897
|
+
qty: n
|
|
1898
|
+
} }]);
|
|
1899
|
+
}
|
|
1900
|
+
joinTable(e) {
|
|
1901
|
+
this.sendInputs([{ JoinTable: { table_ref: e } }]);
|
|
1902
|
+
}
|
|
1903
|
+
leaveTable() {
|
|
1904
|
+
this.sendInputs(["LeaveTable"]);
|
|
1905
|
+
}
|
|
1906
|
+
placeBet(e) {
|
|
1907
|
+
this.sendInputs([{ PlaceBet: { amount: e } }]);
|
|
1908
|
+
}
|
|
1909
|
+
bjAction(e) {
|
|
1910
|
+
this.sendInputs([{ BjAction: { kind: e } }]);
|
|
1911
|
+
}
|
|
1912
|
+
insure(e) {
|
|
1913
|
+
this.sendInputs([{ Insure: { amount: e } }]);
|
|
1914
|
+
}
|
|
1915
|
+
face(e) {
|
|
1916
|
+
this.sendInputs([{ Face: { facing: e } }]);
|
|
1917
|
+
}
|
|
1918
|
+
close() {
|
|
1919
|
+
this.sendInputs(["Leave"]), this.socket.close();
|
|
1920
|
+
}
|
|
1921
|
+
}, $n = "chat", er = class {
|
|
1922
|
+
bus = new y();
|
|
1923
|
+
opts;
|
|
1924
|
+
socket;
|
|
1925
|
+
constructor(e) {
|
|
1926
|
+
this.opts = e, this.socket = new H({
|
|
1927
|
+
url: () => {
|
|
1928
|
+
let e = this.opts.url.includes("?") ? "&" : "?";
|
|
1929
|
+
return `${this.opts.url}${e}game=${encodeURIComponent(this.opts.game)}&token=${encodeURIComponent(this.opts.jwt)}`;
|
|
1930
|
+
},
|
|
1931
|
+
shouldReconnect: () => !!this.opts.jwt
|
|
1932
|
+
}, {
|
|
1933
|
+
onOpen: () => this.bus.emit("open", void 0),
|
|
1934
|
+
onMessage: (e) => this.handleMessage(e),
|
|
1935
|
+
onState: (e) => {
|
|
1936
|
+
this.bus.emit("status", e), e.status === "closed" && this.bus.emit("close", void 0);
|
|
1937
|
+
}
|
|
1938
|
+
});
|
|
1939
|
+
}
|
|
1940
|
+
on(e, t) {
|
|
1941
|
+
return this.bus.on(e, t);
|
|
1942
|
+
}
|
|
1943
|
+
getState() {
|
|
1944
|
+
return this.socket.getState();
|
|
1945
|
+
}
|
|
1946
|
+
connect() {
|
|
1947
|
+
if (!this.opts.jwt) {
|
|
1948
|
+
this.bus.emit("status", {
|
|
1949
|
+
status: "closed",
|
|
1950
|
+
attempts: 0,
|
|
1951
|
+
reason: "missing auth token"
|
|
1952
|
+
});
|
|
1953
|
+
return;
|
|
1954
|
+
}
|
|
1955
|
+
this.socket.connect();
|
|
1956
|
+
}
|
|
1957
|
+
handleMessage(e) {
|
|
1958
|
+
let t;
|
|
1959
|
+
try {
|
|
1960
|
+
t = JSON.parse(typeof e.data == "string" ? e.data : String(e.data));
|
|
1961
|
+
} catch {
|
|
1962
|
+
return;
|
|
1963
|
+
}
|
|
1964
|
+
t.kind === "chat" && (t.channel && t.channel !== this.opts.channel || this.bus.emit("message", {
|
|
1965
|
+
from: t.sender,
|
|
1966
|
+
text: t.content
|
|
1967
|
+
}));
|
|
1968
|
+
}
|
|
1969
|
+
send(e) {
|
|
1970
|
+
let t = e.trim().slice(0, 200);
|
|
1971
|
+
if (!t || !this.socket.isOpen()) return;
|
|
1972
|
+
let n = {
|
|
1973
|
+
kind: $n,
|
|
1974
|
+
sender: "",
|
|
1975
|
+
platform: "",
|
|
1976
|
+
channel: this.opts.channel,
|
|
1977
|
+
content: t
|
|
1978
|
+
};
|
|
1979
|
+
this.socket.send(JSON.stringify(n)), this.bus.emit("message", {
|
|
1980
|
+
from: this.opts.nick || "you",
|
|
1981
|
+
text: t
|
|
1982
|
+
});
|
|
1983
|
+
}
|
|
1984
|
+
close() {
|
|
1985
|
+
this.socket.close();
|
|
1986
|
+
}
|
|
872
1987
|
};
|
|
1988
|
+
//#endregion
|
|
1989
|
+
//#region packages/npm/laser/src/lib/auth/game-auth.ts
|
|
1990
|
+
function Y(e) {
|
|
1991
|
+
try {
|
|
1992
|
+
let t = e.split(".")[1], n = atob(t.replace(/-/g, "+").replace(/_/g, "/"));
|
|
1993
|
+
return JSON.parse(n).kbve_username ?? "";
|
|
1994
|
+
} catch {
|
|
1995
|
+
return "";
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
function tr(e) {
|
|
1999
|
+
let t = null;
|
|
2000
|
+
return {
|
|
2001
|
+
get() {
|
|
2002
|
+
return t;
|
|
2003
|
+
},
|
|
2004
|
+
set(e) {
|
|
2005
|
+
t = e;
|
|
2006
|
+
},
|
|
2007
|
+
clear() {
|
|
2008
|
+
t = null;
|
|
2009
|
+
},
|
|
2010
|
+
async build() {
|
|
2011
|
+
let n = (await e.source.getSession())?.access_token ?? "";
|
|
2012
|
+
return n ? (t = {
|
|
2013
|
+
wsUrl: e.resolveWsUrl(),
|
|
2014
|
+
jwt: n,
|
|
2015
|
+
username: Y(n)
|
|
2016
|
+
}, t) : null;
|
|
2017
|
+
}
|
|
2018
|
+
};
|
|
2019
|
+
}
|
|
2020
|
+
function nr(e, t) {
|
|
2021
|
+
return () => {
|
|
2022
|
+
let n = typeof e == "string" ? e : void 0;
|
|
2023
|
+
return n && n.length > 0 ? n : t;
|
|
2024
|
+
};
|
|
2025
|
+
}
|
|
2026
|
+
function rr(e, t) {
|
|
2027
|
+
return t ? new er({
|
|
2028
|
+
url: e.resolveUrl(),
|
|
2029
|
+
jwt: t,
|
|
2030
|
+
game: e.game,
|
|
2031
|
+
channel: e.channel,
|
|
2032
|
+
nick: Y(t)
|
|
2033
|
+
}) : null;
|
|
2034
|
+
}
|
|
2035
|
+
//#endregion
|
|
2036
|
+
//#region packages/npm/laser/src/lib/embed/external.ts
|
|
2037
|
+
var X = null;
|
|
2038
|
+
function ir(e) {
|
|
2039
|
+
X = e;
|
|
2040
|
+
}
|
|
2041
|
+
function ar() {
|
|
2042
|
+
return X;
|
|
2043
|
+
}
|
|
2044
|
+
function or(e) {
|
|
2045
|
+
if (X) {
|
|
2046
|
+
X(e);
|
|
2047
|
+
return;
|
|
2048
|
+
}
|
|
2049
|
+
typeof window < "u" && window.open(e, "_blank", "noopener,noreferrer");
|
|
2050
|
+
}
|
|
2051
|
+
function sr(e) {
|
|
2052
|
+
return (t) => {
|
|
2053
|
+
X && (t.preventDefault(), X(e));
|
|
2054
|
+
};
|
|
2055
|
+
}
|
|
2056
|
+
//#endregion
|
|
2057
|
+
//#region packages/npm/laser/src/lib/embed/discord-external.ts
|
|
2058
|
+
function cr(e) {
|
|
2059
|
+
ir((t) => {
|
|
2060
|
+
e.commands.openExternalLink({ url: t }).catch(() => void 0);
|
|
2061
|
+
});
|
|
2062
|
+
}
|
|
2063
|
+
function lr(e) {
|
|
2064
|
+
e.commands.encourageHardwareAcceleration().catch(() => void 0);
|
|
2065
|
+
}
|
|
2066
|
+
//#endregion
|
|
2067
|
+
//#region packages/npm/laser/src/lib/ads/AdCard.tsx
|
|
2068
|
+
var ur = "#6ea8ff";
|
|
2069
|
+
function dr({ creative: e, onOpen: t, style: n, className: r }) {
|
|
2070
|
+
let i = e.accent ?? ur;
|
|
2071
|
+
return /* @__PURE__ */ f("a", {
|
|
2072
|
+
href: e.url,
|
|
2073
|
+
target: "_blank",
|
|
2074
|
+
rel: "noopener noreferrer",
|
|
2075
|
+
className: r,
|
|
2076
|
+
onClick: t ? (n) => {
|
|
2077
|
+
n.preventDefault(), t(e);
|
|
2078
|
+
} : void 0,
|
|
2079
|
+
style: {
|
|
2080
|
+
display: "flex",
|
|
2081
|
+
alignItems: "center",
|
|
2082
|
+
gap: "12px",
|
|
2083
|
+
maxWidth: "320px",
|
|
2084
|
+
padding: "10px 14px",
|
|
2085
|
+
borderRadius: "8px",
|
|
2086
|
+
border: `1px solid ${i}59`,
|
|
2087
|
+
background: "linear-gradient(135deg, rgba(20,26,40,0.9), rgba(34,24,48,0.9))",
|
|
2088
|
+
textDecoration: "none",
|
|
2089
|
+
color: "#e6ebf5",
|
|
2090
|
+
boxShadow: "0 4px 18px rgba(0,0,0,0.45)",
|
|
2091
|
+
...n
|
|
2092
|
+
},
|
|
2093
|
+
children: [/* @__PURE__ */ d("span", {
|
|
2094
|
+
"aria-hidden": "true",
|
|
2095
|
+
style: {
|
|
2096
|
+
flex: "0 0 auto",
|
|
2097
|
+
width: "38px",
|
|
2098
|
+
height: "38px",
|
|
2099
|
+
borderRadius: "8px",
|
|
2100
|
+
overflow: "hidden",
|
|
2101
|
+
display: "flex",
|
|
2102
|
+
alignItems: "center",
|
|
2103
|
+
justifyContent: "center",
|
|
2104
|
+
fontSize: "20px",
|
|
2105
|
+
background: `radial-gradient(120% 120% at 30% 20%, ${i}, #7c3aed)`
|
|
2106
|
+
},
|
|
2107
|
+
children: e.imageUrl ? /* @__PURE__ */ d("img", {
|
|
2108
|
+
src: e.imageUrl,
|
|
2109
|
+
alt: "",
|
|
2110
|
+
style: {
|
|
2111
|
+
width: "100%",
|
|
2112
|
+
height: "100%",
|
|
2113
|
+
objectFit: "cover"
|
|
2114
|
+
},
|
|
2115
|
+
onError: (e) => {
|
|
2116
|
+
e.currentTarget.style.display = "none";
|
|
2117
|
+
}
|
|
2118
|
+
}) : e.icon ?? "★"
|
|
2119
|
+
}), /* @__PURE__ */ f("span", {
|
|
2120
|
+
style: {
|
|
2121
|
+
display: "flex",
|
|
2122
|
+
flexDirection: "column",
|
|
2123
|
+
gap: "2px",
|
|
2124
|
+
minWidth: 0
|
|
2125
|
+
},
|
|
2126
|
+
children: [
|
|
2127
|
+
e.eyebrow ? /* @__PURE__ */ d("span", {
|
|
2128
|
+
style: {
|
|
2129
|
+
fontSize: "9px",
|
|
2130
|
+
letterSpacing: 1.4,
|
|
2131
|
+
textTransform: "uppercase",
|
|
2132
|
+
color: "#9fb3d8"
|
|
2133
|
+
},
|
|
2134
|
+
children: e.eyebrow
|
|
2135
|
+
}) : null,
|
|
2136
|
+
/* @__PURE__ */ f("span", {
|
|
2137
|
+
style: {
|
|
2138
|
+
fontSize: "13px",
|
|
2139
|
+
fontWeight: 700
|
|
2140
|
+
},
|
|
2141
|
+
children: [e.title, e.highlight ? /* @__PURE__ */ f(u, { children: [" ", /* @__PURE__ */ d("span", {
|
|
2142
|
+
style: { color: i === ur ? "#fcd34d" : i },
|
|
2143
|
+
children: e.highlight
|
|
2144
|
+
})] }) : null]
|
|
2145
|
+
}),
|
|
2146
|
+
e.body ? /* @__PURE__ */ d("span", {
|
|
2147
|
+
style: {
|
|
2148
|
+
fontSize: "11px",
|
|
2149
|
+
color: "#9fb3d8"
|
|
2150
|
+
},
|
|
2151
|
+
children: e.body
|
|
2152
|
+
}) : null
|
|
2153
|
+
]
|
|
2154
|
+
})]
|
|
2155
|
+
});
|
|
2156
|
+
}
|
|
2157
|
+
//#endregion
|
|
2158
|
+
//#region packages/npm/laser/src/lib/ads/registry.ts
|
|
2159
|
+
function Z(e, t = Math.random) {
|
|
2160
|
+
if (e.length === 0) return null;
|
|
2161
|
+
let n = e.map((e) => e.weight == null ? 1 : Math.max(0, e.weight)), r = n.reduce((e, t) => e + t, 0);
|
|
2162
|
+
if (r <= 0) return null;
|
|
2163
|
+
let i = t() * r;
|
|
2164
|
+
for (let t = 0; t < e.length; t++) if (i -= n[t], i < 0) return e[t];
|
|
2165
|
+
return e[e.length - 1];
|
|
2166
|
+
}
|
|
2167
|
+
var fr = class {
|
|
2168
|
+
ads = /* @__PURE__ */ new Map();
|
|
2169
|
+
register(...e) {
|
|
2170
|
+
for (let t of e) this.ads.set(t.id, t);
|
|
2171
|
+
return this;
|
|
2172
|
+
}
|
|
2173
|
+
remove(e) {
|
|
2174
|
+
return this.ads.delete(e), this;
|
|
2175
|
+
}
|
|
2176
|
+
clear() {
|
|
2177
|
+
return this.ads.clear(), this;
|
|
2178
|
+
}
|
|
2179
|
+
list() {
|
|
2180
|
+
return [...this.ads.values()];
|
|
2181
|
+
}
|
|
2182
|
+
pick(e = Math.random) {
|
|
2183
|
+
return Z(this.list(), e);
|
|
2184
|
+
}
|
|
2185
|
+
}, pr = new fr(), mr = /\{(\w+)\}/g;
|
|
2186
|
+
function hr(e, t) {
|
|
2187
|
+
return t ? e.replace(mr, (e, n) => {
|
|
2188
|
+
let r = t[n];
|
|
2189
|
+
return r === void 0 ? e : String(r);
|
|
2190
|
+
}) : e;
|
|
2191
|
+
}
|
|
2192
|
+
var Q = class {
|
|
2193
|
+
locale;
|
|
2194
|
+
fallback;
|
|
2195
|
+
bundles = /* @__PURE__ */ new Map();
|
|
2196
|
+
listeners = /* @__PURE__ */ new Set();
|
|
2197
|
+
constructor(e = {}) {
|
|
2198
|
+
if (this.locale = e.locale ?? "en", this.fallback = e.fallbackLocale ?? "en", e.messages) for (let [t, n] of Object.entries(e.messages)) this.bundles.set(t, { ...n });
|
|
2199
|
+
}
|
|
2200
|
+
getLocale() {
|
|
2201
|
+
return this.locale;
|
|
2202
|
+
}
|
|
2203
|
+
setLocale(e) {
|
|
2204
|
+
e !== this.locale && (this.locale = e, this.emit());
|
|
2205
|
+
}
|
|
2206
|
+
getLocales() {
|
|
2207
|
+
return [...this.bundles.keys()];
|
|
2208
|
+
}
|
|
2209
|
+
add(e, t) {
|
|
2210
|
+
let n = this.bundles.get(e);
|
|
2211
|
+
this.bundles.set(e, n ? {
|
|
2212
|
+
...n,
|
|
2213
|
+
...t
|
|
2214
|
+
} : { ...t }), this.emit();
|
|
2215
|
+
}
|
|
2216
|
+
has(e, t = this.locale) {
|
|
2217
|
+
return this.bundles.get(t)?.[e] !== void 0 || this.bundles.get(this.fallback)?.[e] !== void 0;
|
|
2218
|
+
}
|
|
2219
|
+
t(e, t) {
|
|
2220
|
+
let n = this.bundles.get(this.locale)?.[e];
|
|
2221
|
+
if (n !== void 0) return hr(n, t);
|
|
2222
|
+
let r = this.bundles.get(this.fallback)?.[e];
|
|
2223
|
+
return r === void 0 ? e : hr(r, t);
|
|
2224
|
+
}
|
|
2225
|
+
subscribe(e) {
|
|
2226
|
+
return this.listeners.add(e), () => {
|
|
2227
|
+
this.listeners.delete(e);
|
|
2228
|
+
};
|
|
2229
|
+
}
|
|
2230
|
+
emit() {
|
|
2231
|
+
this.listeners.forEach((e) => e());
|
|
2232
|
+
}
|
|
2233
|
+
}, $ = new Q(), gr = e($);
|
|
2234
|
+
function _r({ store: e = $, children: t }) {
|
|
2235
|
+
return /* @__PURE__ */ d(gr.Provider, {
|
|
2236
|
+
value: e,
|
|
2237
|
+
children: t
|
|
2238
|
+
});
|
|
2239
|
+
}
|
|
2240
|
+
function vr() {
|
|
2241
|
+
let e = n(gr), t = c((t) => e.subscribe(t), () => e.getLocale(), () => e.getLocale());
|
|
2242
|
+
return a(() => ({
|
|
2243
|
+
t: (t, n) => e.t(t, n),
|
|
2244
|
+
locale: t,
|
|
2245
|
+
setLocale: (t) => e.setLocale(t),
|
|
2246
|
+
store: e
|
|
2247
|
+
}), [e, t]);
|
|
2248
|
+
}
|
|
2249
|
+
ae(/* @__PURE__ */ re({
|
|
2250
|
+
ACTION_ATTACK: () => 1,
|
|
2251
|
+
ACTION_LOOT: () => 4,
|
|
2252
|
+
ACTION_PICKUP: () => 2,
|
|
2253
|
+
ACTION_SHOOT: () => 3,
|
|
2254
|
+
Active: () => L,
|
|
2255
|
+
AdCard: () => dr,
|
|
2256
|
+
AdRegistry: () => fr,
|
|
2257
|
+
AttackShape: () => Qe,
|
|
2258
|
+
BOW_RANGE: () => 8,
|
|
2259
|
+
Cat: () => B,
|
|
2260
|
+
Domain: () => qe,
|
|
2261
|
+
ELEMENT_NAMES: () => Ht,
|
|
2262
|
+
EPHEMERAL_BLACKJACK: () => 11,
|
|
2263
|
+
EPHEMERAL_COMBAT: () => 2,
|
|
2264
|
+
EPHEMERAL_EQUIPPED: () => 6,
|
|
2265
|
+
EPHEMERAL_FLOOR: () => 13,
|
|
2266
|
+
EPHEMERAL_INVENTORY: () => 1,
|
|
2267
|
+
EPHEMERAL_ITEM_USED: () => 5,
|
|
2268
|
+
EPHEMERAL_PICKUP: () => 3,
|
|
2269
|
+
EPHEMERAL_PROJECTILE: () => 12,
|
|
2270
|
+
EPHEMERAL_SHOP: () => 10,
|
|
2271
|
+
EPHEMERAL_STATS: () => 7,
|
|
2272
|
+
EPHEMERAL_STATUS: () => 8,
|
|
2273
|
+
EPHEMERAL_TRADE: () => 9,
|
|
2274
|
+
EntityStore: () => Ke,
|
|
2275
|
+
EnvTag: () => We,
|
|
2276
|
+
GameClient: () => Qn,
|
|
2277
|
+
GameObjectPool: () => D,
|
|
2278
|
+
Health: () => P,
|
|
2279
|
+
I18nProvider: () => _r,
|
|
2280
|
+
I18nStore: () => Q,
|
|
2281
|
+
INVARIANT_EVENT: () => oe,
|
|
2282
|
+
ItemTag: () => Ue,
|
|
2283
|
+
KIND_CAT_ITEM: () => 2,
|
|
2284
|
+
KIND_CAT_NPC: () => 1,
|
|
2285
|
+
KIND_CAT_PLAYER: () => 0,
|
|
2286
|
+
Kind: () => F,
|
|
2287
|
+
LaserEventBus: () => y,
|
|
2288
|
+
MAX_ENTITIES: () => M,
|
|
2289
|
+
MELEE_RANGE: () => 1,
|
|
2290
|
+
MonsterTag: () => z,
|
|
2291
|
+
NpcTag: () => He,
|
|
2292
|
+
OWNER_NONE: () => tn,
|
|
2293
|
+
Owner: () => I,
|
|
2294
|
+
PB_DAMAGE: () => 1,
|
|
2295
|
+
PB_FAINT: () => 3,
|
|
2296
|
+
PB_HEAL: () => 7,
|
|
2297
|
+
PB_INFO: () => 12,
|
|
2298
|
+
PB_MISS: () => 2,
|
|
2299
|
+
PB_NOPP: () => 9,
|
|
2300
|
+
PB_PARALYZED: () => 10,
|
|
2301
|
+
PB_STAT: () => 8,
|
|
2302
|
+
PB_STATUS: () => 5,
|
|
2303
|
+
PB_STATUS_DMG: () => 6,
|
|
2304
|
+
PB_SWAP: () => 4,
|
|
2305
|
+
PB_TURN: () => 11,
|
|
2306
|
+
PB_USED: () => 0,
|
|
2307
|
+
PB_USED_CATEGORY_MASK: () => 3,
|
|
2308
|
+
PB_USED_RANGED: () => 4,
|
|
2309
|
+
PET_ACT_ITEM: () => 2,
|
|
2310
|
+
PET_ACT_MOVE: () => 0,
|
|
2311
|
+
PET_ACT_RUN: () => 3,
|
|
2312
|
+
PET_ACT_SWAP: () => 1,
|
|
2313
|
+
PROTOCOL_VERSION: () => 15,
|
|
2314
|
+
PhaserContext: () => x,
|
|
2315
|
+
PhaserGame: () => he,
|
|
2316
|
+
PlayerController: () => ve,
|
|
2317
|
+
PlayerTag: () => Ve,
|
|
2318
|
+
Position: () => N,
|
|
2319
|
+
Possession: () => R,
|
|
2320
|
+
Quadtree: () => pe,
|
|
2321
|
+
RAPIER: () => h,
|
|
2322
|
+
RealmChatClient: () => er,
|
|
2323
|
+
ReconnectingSocket: () => H,
|
|
2324
|
+
SideMap: () => j,
|
|
2325
|
+
Stage: () => Le,
|
|
2326
|
+
VirtualJoystick: () => _e,
|
|
2327
|
+
animateArrowProjectile: () => ke,
|
|
2328
|
+
aoeTiles: () => it,
|
|
2329
|
+
attachCameraZoom: () => Ce,
|
|
2330
|
+
bjShoeOrder: () => $t,
|
|
2331
|
+
createArrowPool: () => Oe,
|
|
2332
|
+
createBirdAnimation: () => Ie,
|
|
2333
|
+
createBirdSprites: () => Pe,
|
|
2334
|
+
createChatClient: () => rr,
|
|
2335
|
+
createDustMoteLayer: () => Ee,
|
|
2336
|
+
createGpuSpriteLayer: () => w,
|
|
2337
|
+
createNetConfig: () => tr,
|
|
2338
|
+
createRapierPhysics: () => g,
|
|
2339
|
+
createShadowSprites: () => Fe,
|
|
2340
|
+
decodeCard: () => Zt,
|
|
2341
|
+
decodeEphemeralPayload: () => nn,
|
|
2342
|
+
defaultCloseReason: () => st,
|
|
2343
|
+
drawHealthBar: () => xe,
|
|
2344
|
+
drawHealthBarCached: () => Se,
|
|
2345
|
+
dustMemberAt: () => E,
|
|
2346
|
+
encourageHardwareAcceleration: () => lr,
|
|
2347
|
+
findTilePath: () => Ae,
|
|
2348
|
+
flashEntity: () => ye,
|
|
2349
|
+
floatingText: () => be,
|
|
2350
|
+
getBirdNum: () => je,
|
|
2351
|
+
getExternalOpener: () => ar,
|
|
2352
|
+
inRangeAdjacent: () => nt,
|
|
2353
|
+
inputFrame: () => an,
|
|
2354
|
+
installDiscordExternal: () => cr,
|
|
2355
|
+
installWebGLContextGuard: () => C,
|
|
2356
|
+
invariant: () => de,
|
|
2357
|
+
isBird: () => Me,
|
|
2358
|
+
isWebGLAvailable: () => we,
|
|
2359
|
+
joinFrame: () => rn,
|
|
2360
|
+
laserAds: () => pr,
|
|
2361
|
+
laserEvents: () => b,
|
|
2362
|
+
laserI18n: () => $,
|
|
2363
|
+
lineCast: () => rt,
|
|
2364
|
+
makeWsResolver: () => nr,
|
|
2365
|
+
mix32: () => Ye,
|
|
2366
|
+
mulberry32: () => Je,
|
|
2367
|
+
nearestInRange: () => Be,
|
|
2368
|
+
onExternalClick: () => sr,
|
|
2369
|
+
openExternal: () => or,
|
|
2370
|
+
packTile: () => k,
|
|
2371
|
+
pickAd: () => Z,
|
|
2372
|
+
populateGpuSpriteLayer: () => T,
|
|
2373
|
+
queryInRange: () => A,
|
|
2374
|
+
reportWebGLEvent: () => S,
|
|
2375
|
+
resetInvariants: () => fe,
|
|
2376
|
+
rollPct: () => Ze,
|
|
2377
|
+
setExternalOpener: () => ir,
|
|
2378
|
+
setInvariantThrottle: () => ue,
|
|
2379
|
+
setupKeyboardMap: () => De,
|
|
2380
|
+
stream: () => Xe,
|
|
2381
|
+
useGameLoop: () => Re,
|
|
2382
|
+
usePhaserEvent: () => ge,
|
|
2383
|
+
usePhaserGame: () => me,
|
|
2384
|
+
useTranslation: () => vr,
|
|
2385
|
+
usernameFromToken: () => Y,
|
|
2386
|
+
verifyBlackjackCommitment: () => en
|
|
2387
|
+
}), O);
|
|
2388
|
+
//#endregion
|
|
2389
|
+
export { lt as ACTION_ATTACK, ft as ACTION_LOOT, ut as ACTION_PICKUP, dt as ACTION_SHOOT, L as Active, dr as AdCard, fr as AdRegistry, Qe as AttackShape, et as BOW_RANGE, B as Cat, qe as Domain, Ht as ELEMENT_NAMES, St as EPHEMERAL_BLACKJACK, mt as EPHEMERAL_COMBAT, _t as EPHEMERAL_EQUIPPED, wt as EPHEMERAL_FLOOR, pt as EPHEMERAL_INVENTORY, gt as EPHEMERAL_ITEM_USED, ht as EPHEMERAL_PICKUP, Ct as EPHEMERAL_PROJECTILE, xt as EPHEMERAL_SHOP, vt as EPHEMERAL_STATS, yt as EPHEMERAL_STATUS, bt as EPHEMERAL_TRADE, Ke as EntityStore, We as EnvTag, Qn as GameClient, D as GameObjectPool, P as Health, _r as I18nProvider, Q as I18nStore, oe as INVARIANT_EVENT, Ue as ItemTag, qt as KIND_CAT_ITEM, Kt as KIND_CAT_NPC, Gt as KIND_CAT_PLAYER, F as Kind, y as LaserEventBus, M as MAX_ENTITIES, $e as MELEE_RANGE, z as MonsterTag, He as NpcTag, tn as OWNER_NONE, I as Owner, At as PB_DAMAGE, Mt as PB_FAINT, It as PB_HEAL, Vt as PB_INFO, jt as PB_MISS, Rt as PB_NOPP, zt as PB_PARALYZED, Lt as PB_STAT, Pt as PB_STATUS, Ft as PB_STATUS_DMG, Nt as PB_SWAP, Bt as PB_TURN, kt as PB_USED, Ut as PB_USED_CATEGORY_MASK, Wt as PB_USED_RANGED, Dt as PET_ACT_ITEM, Tt as PET_ACT_MOVE, Ot as PET_ACT_RUN, Et as PET_ACT_SWAP, ct as PROTOCOL_VERSION, x as PhaserContext, he as PhaserGame, ve as PlayerController, Ve as PlayerTag, N as Position, R as Possession, pe as Quadtree, h as RAPIER, er as RealmChatClient, H as ReconnectingSocket, j as SideMap, Le as Stage, _e as VirtualJoystick, ke as animateArrowProjectile, it as aoeTiles, Ce as attachCameraZoom, $t as bjShoeOrder, Oe as createArrowPool, Ie as createBirdAnimation, Pe as createBirdSprites, rr as createChatClient, Ee as createDustMoteLayer, w as createGpuSpriteLayer, tr as createNetConfig, g as createRapierPhysics, Fe as createShadowSprites, Zt as decodeCard, nn as decodeEphemeralPayload, st as defaultCloseReason, xe as drawHealthBar, Se as drawHealthBarCached, E as dustMemberAt, lr as encourageHardwareAcceleration, Ae as findTilePath, ye as flashEntity, be as floatingText, je as getBirdNum, ar as getExternalOpener, nt as inRangeAdjacent, an as inputFrame, cr as installDiscordExternal, C as installWebGLContextGuard, de as invariant, Me as isBird, we as isWebGLAvailable, rn as joinFrame, pr as laserAds, b as laserEvents, $ as laserI18n, rt as lineCast, nr as makeWsResolver, Ye as mix32, Je as mulberry32, Be as nearestInRange, sr as onExternalClick, or as openExternal, k as packTile, Z as pickAd, T as populateGpuSpriteLayer, A as queryInRange, S as reportWebGLEvent, fe as resetInvariants, Ze as rollPct, ir as setExternalOpener, ue as setInvariantThrottle, De as setupKeyboardMap, Xe as stream, Re as useGameLoop, ge as usePhaserEvent, me as usePhaserGame, vr as useTranslation, Y as usernameFromToken, en as verifyBlackjackCommitment };
|