@firestone-hs/content-craetor-input 0.0.2

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.
@@ -0,0 +1,876 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processBgsHero = void 0;
4
+ const aws_lambda_utils_1 = require("@firestone-hs/aws-lambda-utils");
5
+ const zlib_1 = require("zlib");
6
+ const utils_1 = require("../utils");
7
+ const bucket = 'static.zerotoheroes.com';
8
+ const fileKey = 'hearthstone/data/battlegrounds-strategies/bgs-hero-strategies.gz.json';
9
+ const processBgsHero = async (input, bgPatch, allCards) => {
10
+ const author = input.author;
11
+ console.debug('processing', author);
12
+ const existing = await loadExistingInfo();
13
+ const result = existing.heroes;
14
+ for (const cardTip of input.data) {
15
+ let existingCardTip = result.find((t) => t.cardId === cardTip.cardId);
16
+ if (!existingCardTip) {
17
+ existingCardTip = {
18
+ cardId: cardTip.cardId,
19
+ name: allCards.getCard(cardTip.cardId)?.name,
20
+ tips: [],
21
+ };
22
+ result.push(existingCardTip);
23
+ }
24
+ if (!!cardTip.tip?.length) {
25
+ let existingTip = existingCardTip.tips.find((t) => t.author === author);
26
+ if (!existingTip) {
27
+ existingTip = {
28
+ author: author,
29
+ };
30
+ existingCardTip.tips.push(existingTip);
31
+ }
32
+ existingTip.language = 'enUS';
33
+ if (!(0, utils_1.deepEqual)(existingTip.summary, cardTip.tip) ||
34
+ (cardTip.patchNumber && existingTip.patch !== cardTip.patchNumber)) {
35
+ existingTip.summary = cardTip.tip;
36
+ existingTip.date = new Date().toISOString().substring(0, 10);
37
+ existingTip.patch = bgPatch.number;
38
+ }
39
+ }
40
+ else {
41
+ existingCardTip.tips = existingCardTip.tips.filter((t) => t.author !== author);
42
+ }
43
+ }
44
+ console.debug('built aggregated tips', result);
45
+ await saveInfo({
46
+ heroes: result,
47
+ curves: existing.curves,
48
+ });
49
+ console.debug('saved aggregated tips');
50
+ };
51
+ exports.processBgsHero = processBgsHero;
52
+ const loadExistingInfo = async () => {
53
+ const s3 = new aws_lambda_utils_1.S3();
54
+ const asString = await s3.readGzipContent(bucket, fileKey, 5);
55
+ if (!asString) {
56
+ return { heroes: [], curves: JSON.parse(curvesString) };
57
+ }
58
+ return JSON.parse(asString);
59
+ };
60
+ const saveInfo = async (info) => {
61
+ const s3 = new aws_lambda_utils_1.S3();
62
+ await s3.writeFile((0, zlib_1.gzipSync)(JSON.stringify(info)), bucket, fileKey, 'application/json', 'gzip');
63
+ };
64
+ const curvesString = `
65
+ [
66
+ {
67
+ "id": "basic",
68
+ "name": "Basic Curve",
69
+ "notes": "Stronger with a token start, turn 4 shop RNG weakness. No heropower requirement.",
70
+ "steps": [
71
+ {
72
+ "turn": 1,
73
+ "actions": ["buy"]
74
+ },
75
+ {
76
+ "turn": 2,
77
+ "actions": [
78
+ {
79
+ "type": "level",
80
+ "param": 2
81
+ }
82
+ ]
83
+ },
84
+ {
85
+ "turn": 3,
86
+ "actions": ["sell", "buy", "buy"]
87
+ },
88
+ {
89
+ "turn": 4,
90
+ "actions": ["buy", "buy"]
91
+ },
92
+ {
93
+ "turn": 5,
94
+ "actions": [
95
+ "buy",
96
+ {
97
+ "type": "level",
98
+ "param": 3
99
+ }
100
+ ]
101
+ },
102
+ {
103
+ "turn": 6,
104
+ "actions": ["buy", "buy", "roll", "roll"]
105
+ },
106
+ {
107
+ "turn": 7,
108
+ "actions": [
109
+ {
110
+ "type": "level",
111
+ "param": 4
112
+ },
113
+ "roll",
114
+ "buy"
115
+ ]
116
+ }
117
+ ]
118
+ },
119
+ {
120
+ "id": "fast-basic",
121
+ "name": "Fast Basic Curve",
122
+ "notes": "Stronger with a token start, turn 4 shop RNG weakness. No heropower requirement.",
123
+ "steps": [
124
+ {
125
+ "turn": 1,
126
+ "actions": ["buy"]
127
+ },
128
+ {
129
+ "turn": 2,
130
+ "actions": [
131
+ {
132
+ "type": "level",
133
+ "param": 2
134
+ }
135
+ ]
136
+ },
137
+ {
138
+ "turn": 3,
139
+ "actions": ["sell", "buy", "buy"]
140
+ },
141
+ {
142
+ "turn": 4,
143
+ "actions": ["buy", "buy"]
144
+ },
145
+ {
146
+ "turn": 5,
147
+ "actions": [
148
+ "buy",
149
+ {
150
+ "type": "level",
151
+ "param": 3
152
+ }
153
+ ]
154
+ },
155
+ {
156
+ "turn": 6,
157
+ "actions": [
158
+ {
159
+ "type": "level",
160
+ "param": 4
161
+ },
162
+ "roll"
163
+ ]
164
+ }
165
+ ]
166
+ },
167
+ {
168
+ "id": "jeef",
169
+ "name": "Jeef Curve",
170
+ "notes": "Uses tier 1 economy and strong pairs for a flexible start to the game with its variations.",
171
+ "steps": [
172
+ {
173
+ "turn": 1,
174
+ "actions": ["buy"]
175
+ },
176
+ {
177
+ "turn": 2,
178
+ "actions": ["buy", "roll"]
179
+ },
180
+ {
181
+ "turn": 3,
182
+ "actions": [
183
+ {
184
+ "type": "level",
185
+ "param": 2
186
+ },
187
+ "buy",
188
+ "sell"
189
+ ]
190
+ },
191
+ {
192
+ "turn": 4,
193
+ "actions": [
194
+ {
195
+ "type": "level",
196
+ "param": 3
197
+ }
198
+ ]
199
+ },
200
+ {
201
+ "turn": 5,
202
+ "actions": ["buy", "buy", "roll"]
203
+ },
204
+ {
205
+ "turn": 6,
206
+ "actions": [
207
+ {
208
+ "type": "level",
209
+ "param": 4
210
+ },
211
+ "buy",
212
+ "sell"
213
+ ]
214
+ }
215
+ ]
216
+ },
217
+ {
218
+ "id": "fast-jeef",
219
+ "name": "Fast Jeef Curve",
220
+ "notes": "Uses tier 1 economy and strong pairs for a flexible start to the game with its variations. Pushes levels quickly.",
221
+ "steps": [
222
+ {
223
+ "turn": 1,
224
+ "actions": ["buy"]
225
+ },
226
+ {
227
+ "turn": 2,
228
+ "actions": ["buy", "roll"]
229
+ },
230
+ {
231
+ "turn": 3,
232
+ "actions": [
233
+ {
234
+ "type": "level",
235
+ "param": 2
236
+ },
237
+ "buy",
238
+ "sell"
239
+ ]
240
+ },
241
+ {
242
+ "turn": 4,
243
+ "actions": [
244
+ {
245
+ "type": "level",
246
+ "param": 3
247
+ }
248
+ ]
249
+ },
250
+ {
251
+ "turn": 5,
252
+ "actions": [
253
+ {
254
+ "type": "level",
255
+ "param": 4
256
+ }
257
+ ]
258
+ },
259
+ {
260
+ "turn": 6,
261
+ "actions": ["buy", "buy", "roll", "roll"]
262
+ }
263
+ ]
264
+ },
265
+ {
266
+ "id": "slow-jeef",
267
+ "name": "Slow Jeef Curve",
268
+ "notes": "Uses tier 1 economy and strong pairs for a flexible start to the game with its variations. Stays on tier 2 to solidify the board.",
269
+ "steps": [
270
+ {
271
+ "turn": 1,
272
+ "actions": ["buy"]
273
+ },
274
+ {
275
+ "turn": 2,
276
+ "actions": ["buy", "roll"]
277
+ },
278
+ {
279
+ "turn": 3,
280
+ "actions": [
281
+ {
282
+ "type": "level",
283
+ "param": 2
284
+ },
285
+ "buy",
286
+ "sell"
287
+ ]
288
+ },
289
+ {
290
+ "turn": 4,
291
+ "actions": ["buy", "buy"]
292
+ },
293
+ {
294
+ "turn": 5,
295
+ "actions": [
296
+ {
297
+ "type": "level",
298
+ "param": 3
299
+ },
300
+ "buy",
301
+ "sell"
302
+ ]
303
+ },
304
+ {
305
+ "turn": 6,
306
+ "actions": [
307
+ {
308
+ "type": "level",
309
+ "param": 3
310
+ },
311
+ "roll"
312
+ ]
313
+ }
314
+ ]
315
+ },
316
+ {
317
+ "id": "warrior",
318
+ "name": "Warrior Curve",
319
+ "notes": "A highly valueable line if tier 1 economy and forced triples are strong.",
320
+ "steps": [
321
+ {
322
+ "turn": 1,
323
+ "actions": ["buy"]
324
+ },
325
+ {
326
+ "turn": 2,
327
+ "actions": ["buy", "roll"]
328
+ },
329
+ {
330
+ "turn": 3,
331
+ "actions": ["buy", "sell", "buy"]
332
+ },
333
+ {
334
+ "turn": 4,
335
+ "actions": ["buy", "buy"]
336
+ },
337
+ {
338
+ "turn": 5,
339
+ "actions": [
340
+ "sell",
341
+ {
342
+ "type": "level",
343
+ "param": 2
344
+ },
345
+ {
346
+ "type": "level",
347
+ "param": 3
348
+ }
349
+ ]
350
+ },
351
+ {
352
+ "turn": 6,
353
+ "actions": [
354
+ {
355
+ "type": "level",
356
+ "param": 4
357
+ },
358
+ "roll"
359
+ ]
360
+ }
361
+ ]
362
+ },
363
+ {
364
+ "id": "extended-warrior",
365
+ "name": "Extended Warrior Curve",
366
+ "notes": "A highly valueable line if tier 1 economy and forced triples are strong. This variant is a fallback option in case a triple hasn't shown up yet playing regular warrior curve.",
367
+ "steps": [
368
+ {
369
+ "turn": 1,
370
+ "actions": ["buy"]
371
+ },
372
+ {
373
+ "turn": 2,
374
+ "actions": ["buy", "roll"]
375
+ },
376
+ {
377
+ "turn": 3,
378
+ "actions": ["buy", "sell", "buy"]
379
+ },
380
+ {
381
+ "turn": 4,
382
+ "actions": ["buy", "buy"]
383
+ },
384
+ {
385
+ "turn": 5,
386
+ "actions": ["buy", "buy", "roll"]
387
+ },
388
+ {
389
+ "turn": 6,
390
+ "actions": [
391
+ {
392
+ "type": "level",
393
+ "param": 2
394
+ },
395
+ {
396
+ "type": "level",
397
+ "param": 3
398
+ },
399
+ "roll"
400
+ ]
401
+ },
402
+ {
403
+ "turn": 7,
404
+ "actions": [
405
+ {
406
+ "type": "level",
407
+ "param": 4
408
+ },
409
+ "roll"
410
+ ]
411
+ }
412
+ ]
413
+ },
414
+ {
415
+ "id": "basic-yogg",
416
+ "name": "Basic Yogg Curve",
417
+ "notes": "Uses a 2-cost heropower to get to tier 3 faster.",
418
+ "steps": [
419
+ {
420
+ "turn": 1,
421
+ "actions": ["hero-power", "roll"]
422
+ },
423
+ {
424
+ "turn": 2,
425
+ "actions": [
426
+ {
427
+ "type": "level",
428
+ "param": 2
429
+ }
430
+ ]
431
+ },
432
+ {
433
+ "turn": 3,
434
+ "actions": ["hero-power", "buy"]
435
+ },
436
+ {
437
+ "turn": 4,
438
+ "actions": [
439
+ {
440
+ "type": "level",
441
+ "param": 3
442
+ },
443
+ "sell",
444
+ "hero-power"
445
+ ]
446
+ },
447
+ {
448
+ "turn": 5,
449
+ "actions": ["hero-power", "sell", "buy", "buy"]
450
+ },
451
+ {
452
+ "turn": 6,
453
+ "actions": [
454
+ {
455
+ "type": "level",
456
+ "param": 4
457
+ },
458
+ "hero-power"
459
+ ]
460
+ }
461
+ ]
462
+ },
463
+ {
464
+ "id": "aggro-yogg",
465
+ "name": "Aggro Yogg Curve",
466
+ "notes": "Uses a 2-cost heropower to get good tier 1s on board before leveling to 3 faster",
467
+ "steps": [
468
+ {
469
+ "turn": 1,
470
+ "actions": ["hero-power", "roll"]
471
+ },
472
+ {
473
+ "turn": 2,
474
+ "actions": ["buy", "sell", "hero-power"]
475
+ },
476
+ {
477
+ "turn": 3,
478
+ "actions": [
479
+ {
480
+ "type": "level",
481
+ "param": 2
482
+ },
483
+ "hero-power"
484
+ ]
485
+ },
486
+ {
487
+ "turn": 4,
488
+ "actions": ["hero-power", "roll", "buy"]
489
+ },
490
+ {
491
+ "turn": 5,
492
+ "actions": [
493
+ {
494
+ "type": "level",
495
+ "param": 3
496
+ },
497
+ "hero-power"
498
+ ]
499
+ },
500
+ {
501
+ "turn": 6,
502
+ "actions": [
503
+ {
504
+ "type": "level",
505
+ "param": 4
506
+ },
507
+ "hero-power"
508
+ ]
509
+ }
510
+ ]
511
+ },
512
+ {
513
+ "id": "rafaam",
514
+ "name": "Rafaam Curve",
515
+ "notes": "Clean leveling using 1-cost heropower, 2-cost heropower with economy, or tavern tippers",
516
+ "steps": [
517
+ {
518
+ "turn": 1,
519
+ "actions": ["buy"]
520
+ },
521
+ {
522
+ "turn": 2,
523
+ "actions": ["buy", "hero-power"]
524
+ },
525
+ {
526
+ "turn": 3,
527
+ "actions": ["buy", "roll", "hero-power"]
528
+ },
529
+ {
530
+ "turn": 4,
531
+ "actions": [
532
+ {
533
+ "type": "level",
534
+ "param": 2
535
+ },
536
+ "buy",
537
+ "hero-power"
538
+ ]
539
+ },
540
+ {
541
+ "turn": 5,
542
+ "actions": [
543
+ {
544
+ "type": "level",
545
+ "param": 3
546
+ },
547
+ "hero-power"
548
+ ]
549
+ },
550
+ {
551
+ "turn": 6,
552
+ "actions": [
553
+ {
554
+ "type": "level",
555
+ "param": 4
556
+ },
557
+ "hero-power"
558
+ ]
559
+ }
560
+ ]
561
+ },
562
+ {
563
+ "id": "slow-rafaam",
564
+ "name": "Slow Rafaam Curve",
565
+ "notes": "Clean leveling using 1-cost heropower, 2-cost heropower with economy, or tavern tippers. Cut off on tier 2 to get stronger",
566
+ "steps": [
567
+ {
568
+ "turn": 1,
569
+ "actions": ["buy"]
570
+ },
571
+ {
572
+ "turn": 2,
573
+ "actions": ["buy", "hero-power"]
574
+ },
575
+ {
576
+ "turn": 3,
577
+ "actions": ["buy", "roll", "hero-power"]
578
+ },
579
+ {
580
+ "turn": 4,
581
+ "actions": [
582
+ {
583
+ "type": "level",
584
+ "param": 2
585
+ },
586
+ "buy",
587
+ "hero-power"
588
+ ]
589
+ },
590
+ {
591
+ "turn": 5,
592
+ "actions": ["buy", "buy", "hero-power"]
593
+ },
594
+ {
595
+ "turn": 6,
596
+ "actions": [
597
+ {
598
+ "type": "level",
599
+ "param": 3
600
+ },
601
+ "buy"
602
+ ]
603
+ },
604
+ {
605
+ "turn": 7,
606
+ "actions": [
607
+ {
608
+ "type": "level",
609
+ "param": 4
610
+ }
611
+ ]
612
+ }
613
+ ]
614
+ },
615
+ {
616
+ "id": "3-on-3",
617
+ "name": "3 on 3 (Level on 8)",
618
+ "notes": "Sacrifices early health to get very fast access to tier 3 minions, then pushes levels",
619
+ "steps": [
620
+ {
621
+ "turn": 1,
622
+ "actions": ["buy"]
623
+ },
624
+ {
625
+ "turn": 2,
626
+ "actions": [
627
+ {
628
+ "type": "level",
629
+ "param": 2
630
+ }
631
+ ]
632
+ },
633
+ {
634
+ "turn": 3,
635
+ "actions": [
636
+ "sell",
637
+ {
638
+ "type": "level",
639
+ "param": 3
640
+ }
641
+ ]
642
+ },
643
+ {
644
+ "turn": 4,
645
+ "actions": ["buy", "buy"]
646
+ },
647
+ {
648
+ "turn": 5,
649
+ "actions": ["buy", "buy", "roll"]
650
+ },
651
+ {
652
+ "turn": 6,
653
+ "actions": [
654
+ "buy",
655
+ {
656
+ "type": "level",
657
+ "param": 4
658
+ }
659
+ ]
660
+ },
661
+ {
662
+ "turn": 7,
663
+ "actions": ["buy", "buy", "roll", "roll", "roll"]
664
+ }
665
+ ]
666
+ },
667
+ {
668
+ "id": "3-on-3-bis",
669
+ "name": "3 on 3 (Level on 9)",
670
+ "notes": "Sacrifices early health to fill the board with tier 3 minions",
671
+ "steps": [
672
+ {
673
+ "turn": 1,
674
+ "actions": ["buy"]
675
+ },
676
+ {
677
+ "turn": 2,
678
+ "actions": [
679
+ {
680
+ "type": "level",
681
+ "param": 2
682
+ }
683
+ ]
684
+ },
685
+ {
686
+ "turn": 3,
687
+ "actions": [
688
+ "sell",
689
+ {
690
+ "type": "level",
691
+ "param": 3
692
+ }
693
+ ]
694
+ },
695
+ {
696
+ "turn": 4,
697
+ "actions": ["buy", "buy"]
698
+ },
699
+ {
700
+ "turn": 5,
701
+ "actions": ["buy", "buy", "roll"]
702
+ },
703
+ {
704
+ "turn": 6,
705
+ "actions": ["buy", "buy", "roll", "roll"]
706
+ },
707
+ {
708
+ "turn": 7,
709
+ "actions": [
710
+ {
711
+ "type": "level",
712
+ "param": 4
713
+ },
714
+ "roll",
715
+ "roll",
716
+ "buy"
717
+ ]
718
+ }
719
+ ]
720
+ },
721
+ {
722
+ "id": "4-on-4",
723
+ "name": "4 on 4",
724
+ "notes": "Sacrifices early health to get very fast access to tier 3 minions. A fallback option in case of a bad shop after 3 on 3; requires economy",
725
+ "steps": [
726
+ {
727
+ "turn": 1,
728
+ "actions": ["buy-token"]
729
+ },
730
+ {
731
+ "turn": 2,
732
+ "actions": [
733
+ {
734
+ "type": "level",
735
+ "param": 2
736
+ }
737
+ ]
738
+ },
739
+ {
740
+ "turn": 3,
741
+ "actions": [
742
+ "sell",
743
+ {
744
+ "type": "level",
745
+ "param": 3
746
+ }
747
+ ]
748
+ },
749
+ {
750
+ "turn": 4,
751
+ "actions": [
752
+ "sell",
753
+ {
754
+ "type": "level",
755
+ "param": 4
756
+ }
757
+ ]
758
+ },
759
+ {
760
+ "turn": 5,
761
+ "actions": ["buy", "buy", "roll"]
762
+ },
763
+ {
764
+ "turn": 6,
765
+ "actions": ["buy", "buy", "roll", "roll"]
766
+ },
767
+ {
768
+ "turn": 7,
769
+ "actions": ["buy", "buy", "roll", "roll", "roll"]
770
+ }
771
+ ]
772
+ },
773
+ {
774
+ "id": "toki",
775
+ "name": "Toki Curve",
776
+ "notes": "A way to use 1 cost heropowers that don't provide tempo",
777
+ "steps": [
778
+ {
779
+ "turn": 1,
780
+ "actions": ["buy-token"]
781
+ },
782
+ {
783
+ "turn": 2,
784
+ "actions": [
785
+ {
786
+ "type": "level",
787
+ "param": 2
788
+ }
789
+ ]
790
+ },
791
+ {
792
+ "turn": 3,
793
+ "actions": ["sell", "buy", "buy"]
794
+ },
795
+ {
796
+ "turn": 4,
797
+ "actions": [
798
+ {
799
+ "type": "level",
800
+ "param": 3
801
+ },
802
+ "hero-power"
803
+ ]
804
+ },
805
+ {
806
+ "turn": 5,
807
+ "actions": ["hero-power", "buy", "buy"]
808
+ },
809
+ {
810
+ "turn": 6,
811
+ "actions": ["roll", "buy", "roll", "buy"]
812
+ },
813
+ {
814
+ "turn": 7,
815
+ "actions": [
816
+ {
817
+ "type": "level",
818
+ "param": 7
819
+ }
820
+ ]
821
+ }
822
+ ]
823
+ },
824
+ {
825
+ "id": "pocky",
826
+ "name": "Pocky Curve",
827
+ "notes": "A very niche use for 1 cost heropowers",
828
+ "steps": [
829
+ {
830
+ "turn": 1,
831
+ "actions": ["buy-token"]
832
+ },
833
+ {
834
+ "turn": 2,
835
+ "actions": [
836
+ {
837
+ "type": "level",
838
+ "param": 2
839
+ }
840
+ ]
841
+ },
842
+ {
843
+ "turn": 3,
844
+ "actions": ["buy", "hero-power", "roll"]
845
+ },
846
+ {
847
+ "turn": 4,
848
+ "actions": [
849
+ {
850
+ "type": "level",
851
+ "param": 3
852
+ },
853
+ "sell",
854
+ "hero-power"
855
+ ]
856
+ },
857
+ {
858
+ "turn": 5,
859
+ "actions": ["buy", "buy", "hero-power"]
860
+ },
861
+ {
862
+ "turn": 6,
863
+ "actions": [
864
+ {
865
+ "type": "level",
866
+ "param": 4
867
+ },
868
+ "roll",
869
+ "buy"
870
+ ]
871
+ }
872
+ ]
873
+ }
874
+ ]
875
+ `;
876
+ //# sourceMappingURL=bgs-heroes.js.map