-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.html
799 lines (730 loc) · 26.2 KB
/
index.html
1
2
3
4
5
6
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
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
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
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
<!doctype html>
<html>
<script>
var Immolate = {
onRuntimeInitialized: function() {
if (instantAnalysis) {
performAnalysis();
}
}
};
// Helper function for vectors
function asVector(arr) {
var vectorInt = new Module.VectorStr();
for (var i = 0; i < arr.length; i++) {
vectorInt.push_back(arr[i]);
}
return vectorInt;
}
</script>
<script src="immolate.js"></script>
<script src="UI.js" defer></script>
<style>
@font-face {
font-family: 'm6x11';
src: url('/m6x11plus.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
body, h1, p {
margin: 0;
padding: 0;
}
body {
font-family: "m6x11", Arial, sans-serif;
line-height: 1.6;
color: #333;
background-color: #a0c3ac;
}
h1 {
text-align: center;
font-weight: normal;
padding: 2rem 0;
background-color: #006025;
color: #ffffff;
}
h2 {
text-align: center;
font-weight: normal;
background-color: #006025;
color: #ffffff;
}
p {
max-width: 600px;
margin: 2rem auto;
padding: 0 1rem;
text-align: center;
font-size: 1.2em;
}
label {
font-size: 1.2em;
}
.container {
display: flex;
justify-content: space-around;
margin-top: 20px;
}
.input-section {
flex: 1;
padding: 20px;
background-color: #f5f5f5;
border-radius: 5px;
}
.output-section {
flex: 1;
padding: 20px;
background-color: #f5f5f5;
border-radius: 5px;
}
textarea {
width: 100%;
resize: vertical;
}
/* Change the font and background color */
select {
font-family: "m6x11", sans-serif;
font-size: 1em;
background-color: #f2f2f2;
color: #333;
}
button {
font-family: "m6x11", sans-serif;
font-size: 1.5em;
background-color: #f2f2f2;
color: #333;
}
/* Remove the default arrow and add custom styling */
select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-image: url('path/to/custom-arrow.png');
background-repeat: no-repeat;
background-position: right 8px center;
padding-right: 25px; /* Adjust as needed to accommodate the custom arrow */
}
/* Add border and padding */
select {
border: 1px solid #ccc;
padding: 6px 10px;
border-radius: 4px;
}
button {
border: 1px solid #ccc;
padding: 6px 10px;
border-radius: 4px;
}
/* Style the dropdown options */
select option {
background-color: #fff;
color: #333;
padding: 6px 10px;
}
/* Change the font and background color */
input {
font-family: "m6x11", sans-serif;
font-size: 1em;
background-color: #f2f2f2;
color: #333;
}
/* Add border, padding, and rounded corners */
input {
border: 1px solid #ccc;
padding: 6px 10px;
border-radius: 4px;
}
/* Style the focused input box */
input:focus {
outline: none;
border-color: #6495ed;
box-shadow: 0 0 5px rgba(100, 149, 237, 0.5);
}
/* Style the number input box */
input[type="number"] {
width: 60px; /* Adjust as needed */
}
/* Style the text input box */
input[type="text"] {
width: 200px; /* Adjust as needed */
}
input[id="seed"] {
width: 80px; /* Adjust as needed */
}
#checkboxesOverlay {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.4);
}
#checkboxesPopup {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 75%;
}
.checkbox-column {
float: left;
width: 16.66%;
box-sizing: border-box;
padding: 0 10px;
}
.checkbox-column label {
display: block;
margin-bottom: 5px;
}
.clearfix::after {
content: "";
clear: both;
display: table;
}
</style>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Soul</title>
</head>
<body>
<h1>The Soul</h1>
<div class="container">
<div class="input-section">
<h2>Settings</h2>
<label for="seed">Seed:</label>
<input type="text" id="seed" maxlength="8" pattern="[A-Z1-9]{1,8}" required>
<br>
<label for="ante">Max Ante:</label>
<input type="number" id="ante" min="1" max="999" value="8" required>
<br>
<label for="cardsPerAnte">Cards per Ante:</label>
<input type="text" id="cardsPerAnte" value = "15,50,50,50,50,50,50,50" required>
<br>
<label for="deck">Deck:</label>
<select id="deck" required>
<option value="Red Deck">Red Deck</option>
<option value="Blue Deck">Blue Deck</option>
<option value="Yellow Deck">Yellow Deck</option>
<option value="Green Deck">Green Deck</option>
<option value="Black Deck">Black Deck</option>
<option value="Magic Deck">Magic Deck</option>
<option value="Nebula Deck">Nebula Deck</option>
<option value="Ghost Deck">Ghost Deck</option>
<option value="Abandoned Deck">Abandoned Deck</option>
<option value="Checkered Deck">Checkered Deck</option>
<option value="Zodiac Deck">Zodiac Deck</option>
<option value="Painted Deck">Painted Deck</option>
<option value="Anaglyph Deck">Anaglyph Deck</option>
<option value="Plasma Deck">Plasma Deck</option>
<option value="Erratic Deck">Erratic Deck</option>
<!-- Add deck options here -->
</select>
<br>
<label for="stake">Stake:</label>
<select id="stake" required>
<option value="White Stake">White Stake</option>
<option value="Red Stake">Red Stake</option>
<option value="Green Stake">Green Stake</option>
<option value="Black Stake">Black Stake</option>
<option value="Blue Stake">Blue Stake</option>
<option value="Purple Stake">Purple Stake</option>
<option value="Orange Stake">Orange Stake</option>
<option value="Gold Stake">Gold Stake</option>
<!-- Add stake options here -->
</select>
<br>
<label for="version">Version:</label>
<select id="version" required>
<option value="10106">1.0.1f</option>
<option value="10103">1.0.1c</option>
<option value="10014">1.0.0n</option>
<!-- Add version options here -->
</select>
<br>
<button id="openCheckboxesBtn">Modify Unlocks</button>
<div id="checkboxesOverlay">
<div id="checkboxesPopup">
<h2>Unlocked Items</h2>
<div id="checkboxesContainer" class="clearfix"></div>
<button id="submitBtn">Submit</button>
<button id="unlockBtn">Unlock All</button>
<button id="lockBtn">Lock All</button>
</div>
</div>
<br>
<button id="analyzeButton">Analyze</button>
<button id="copyButton">Copy Link</button>
</div>
<div class="output-section">
<h2>Output</h2>
<textarea id="outputBox" rows="16" readonly></textarea>
<br>
<button id="downloadButton" style="font-size: 1em">Download</button>
</div>
</div>
</body>
<script>
//Unlocks stuff
// Option values
const options = ["Negative Tag",
"Foil Tag",
"Holographic Tag",
"Polychrome Tag",
"Rare Tag",
"Golden Ticket",
"Mr. Bones",
"Acrobat",
"Sock and Buskin",
"Swashbuckler",
"Troubadour",
"Certificate",
"Smeared Joker",
"Throwback",
"Hanging Chad",
"Rough Gem",
"Bloodstone",
"Arrowhead",
"Onyx Agate",
"Glass Joker",
"Showman",
"Flower Pot",
"Blueprint",
"Wee Joker",
"Merry Andy",
"Oops! All 6s",
"The Idol",
"Seeing Double",
"Matador",
"Hit the Road",
"The Duo",
"The Trio",
"The Family",
"The Order",
"The Tribe",
"Stuntman",
"Invisible Joker",
"Brainstorm",
"Satellite",
"Shoot the Moon",
"Driver's License",
"Cartomancer",
"Astronomer",
"Burnt Joker",
"Bootstraps",
"Overstock Plus",
"Liquidation",
"Glow Up",
"Reroll Glut",
"Omen Globe",
"Observatory",
"Nacho Tong",
"Recyclomancy",
"Tarot Tycoon",
"Planet Tycoon",
"Money Tree",
"Antimatter",
"Illusion",
"Petroglyph",
"Retcon",
"Palette"]
selectedOptions = Array(61).fill(true);
// Get references to elements
const openCheckboxesBtn = document.getElementById('openCheckboxesBtn');
const checkboxesOverlay = document.getElementById('checkboxesOverlay');
const checkboxesPopup = document.getElementById('checkboxesPopup');
const checkboxesContainer = document.getElementById('checkboxesContainer');
const submitBtn = document.getElementById('submitBtn');
const lockBtn = document.getElementById('lockBtn');
const unlockBtn = document.getElementById('unlockBtn');
// Function to create checkboxes
function createCheckboxes() {
checkboxesContainer.innerHTML = '';
const numColumns = 6;
const optionsPerColumn = Math.ceil(options.length / numColumns);
for (let i = 0; i < numColumns; i++) {
const columnDiv = document.createElement('div');
columnDiv.classList.add('checkbox-column');
for (let j = i * optionsPerColumn; j < (i + 1) * optionsPerColumn && j < options.length; j++) {
const checkbox = document.createElement('input');
checkbox.type = 'checkbox';
checkbox.value = options[j];
checkbox.checked = selectedOptions[j]; // Set checkboxes as selected by default
const label = document.createElement('label');
label.textContent = options[j];
label.prepend(checkbox);
columnDiv.appendChild(label);
}
checkboxesContainer.appendChild(columnDiv);
}
}
// Function to handle checkbox selections
function handleSubmit() {
const checkboxes = checkboxesContainer.querySelectorAll('input[type="checkbox"]');
selectedOptions = [];
checkboxes.forEach(checkbox => {
selectedOptions.push(checkbox.checked);
});
console.log('Selected Options:', selectedOptions);
// Do something with the selected options
closeOverlay();
}
function handleLock() {
const checkboxes = checkboxesContainer.querySelectorAll('input[type="checkbox"]');
selectedOptions = [];
checkboxes.forEach(checkbox => {
checkbox.checked = false
});
}
function handleUnlock() {
const checkboxes = checkboxesContainer.querySelectorAll('input[type="checkbox"]');
selectedOptions = [];
checkboxes.forEach(checkbox => {
checkbox.checked = true
});
}
// Function to open the checkbox overlay
function openOverlay() {
createCheckboxes();
checkboxesOverlay.style.display = 'block';
}
// Function to close the checkbox overlay
function closeOverlay() {
checkboxesOverlay.style.display = 'none';
}
// Event listeners
openCheckboxesBtn.addEventListener('click', openOverlay);
window.addEventListener('click', (event) => {
if (event.target == checkboxesOverlay) {
closeOverlay();
}
});
submitBtn.addEventListener('click', handleSubmit);
lockBtn.addEventListener('click', handleLock);
unlockBtn.addEventListener('click', handleUnlock);
instantAnalysis = false;
const anteInput = document.getElementById('ante');
const cardsPerAnteInput = document.getElementById('cardsPerAnte');
const deckSelect = document.getElementById('deck');
const stakeSelect = document.getElementById('stake');
const versionSelect = document.getElementById('version');
const seedInput = document.getElementById('seed');
const analyzeButton = document.getElementById('analyzeButton');
const copyLinkButton = document.getElementById('copyButton');
const downloadButton = document.getElementById('downloadButton');
const outputBox = document.getElementById('outputBox');
// Add event listener for the "Copy Link" button
copyLinkButton.addEventListener('click', copyLink);
function copyLink() {
const baseUrl = window.location.origin + window.location.pathname;
const params = new URLSearchParams();
// Hash the unlocks
// Convert the array of booleans to a binary string
const binaryString = selectedOptions.map(unlock => unlock ? '1' : '0').join('');
// Convert the binary string to a byte array
const byteArray = [];
for (let i = 0; i < binaryString.length; i += 8) {
const byte = parseInt(binaryString.substr(i, 8), 2);
byteArray.push(byte);
}
// Pad the byte array with a null byte if necessary
if (binaryString.length % 8 !== 0) {
const paddingBits = '0'.repeat(8 - (binaryString.length % 8));
const paddingByte = parseInt(`${binaryString.slice(-binaryString.length % 8)}${paddingBits}`, 2);
byteArray.push(paddingByte);
}
// Encode the byte array to base64
const base64Unlocks = btoa(String.fromCharCode.apply(null, byteArray));
// Add non-default input values as URL parameters
if (anteInput.value !== '8') params.append('ante', anteInput.value);
if (cardsPerAnteInput.value !== '15,50,50,50,50,50,50,50') params.append('cardsPerAnte', cardsPerAnteInput.value);
if (deckSelect.value !== 'Red Deck') params.append('deck', deckSelect.value);
if (stakeSelect.value !== 'White Stake') params.append('stake', stakeSelect.value);
if (versionSelect.value != '10106') params.append('version', versionSelect.value);
if (seedInput.value !== '') params.append('seed', seedInput.value);
if (base64Unlocks != '/////////x/4') params.append('unlocks', base64Unlocks);
const url = `${baseUrl}?${params.toString()}`;
// Copy the URL to the clipboard
navigator.clipboard.writeText(url)
.then(() => {
alert('Link copied to clipboard!');
})
.catch((err) => {
console.error('Failed to copy link: ', err);
});
}
downloadButton.addEventListener('click', () => {
const filename = seedInput.value + "_analysis.txt";
const content = outputBox.value;
const blob = new Blob([content], { type: 'text/plain' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = filename;
a.click();
URL.revokeObjectURL(url);
});
// Add event listener to the "Analysis" button
analyzeButton.addEventListener('click', performAnalysis);
function performAnalysis() {
// Get input values
const ante = parseInt(anteInput.value, 10);
const cardsPerAnte = cardsPerAnteInput.value.split(',').map(Number);
const deck = deckSelect.value;
const stake = stakeSelect.value;
const version = parseInt(versionSelect.value);
const seed = seedInput.value.toUpperCase().replace(/0/g, 'O');
output = "";
// It's analysis time!
var inst = new Immolate.Instance(seed);
inst.params = new Immolate.InstParams(deck, stake, false, version);
inst.initLocks(1, false, false);
inst.lock("Overstock Plus");
inst.lock("Liquidation");
inst.lock("Glow Up");
inst.lock("Reroll Glut");
inst.lock("Omen Globe");
inst.lock("Observatory");
inst.lock("Nacho Tong");
inst.lock("Recyclomancy");
inst.lock("Tarot Tycoon");
inst.lock("Planet Tycoon");
inst.lock("Money Tree");
inst.lock("Antimatter");
inst.lock("Illusion");
inst.lock("Petroglyph");
inst.lock("Retcon");
inst.lock("Palette");
for (let i = 0; i < options.length; i++) {
if (selectedOptions[i] == false) inst.lock(options[i]);
}
inst.setStake(stake);
inst.setDeck(deck);
var ghostDeck = (deck == "Ghost Deck");
for (let a = 1; a <= ante; a++) {
inst.initUnlocks(a, false);
output += "==ANTE " + a + "==\n"
output += "Boss: " + inst.nextBoss(a) + "\n";
var voucher = inst.nextVoucher(a);
output += "Voucher: " + voucher + "\n";
inst.lock(voucher);
// Unlock next level voucher
for (let i = 0; i < Immolate.VOUCHERS.size(); i+=2) {
if (Immolate.VOUCHERS.get(i) == voucher) {
// Only unlock it if it's unlockable
if (selectedOptions[options.indexOf(Immolate.VOUCHERS.get(i+1))]) {
inst.unlock(Immolate.VOUCHERS.get(i+1));
};
};
};
output += "Tags: " + inst.nextTag(a) + ", " + inst.nextTag(a) + "\n";
output += "Shop Queue: \n";
for (let q = 1; q <= cardsPerAnte[a-1]; q++) {
output += q + ") ";
var item = inst.nextShopItem(a);
if (item.type == "Joker") {
if (item.jokerData.stickers.eternal) output += "Eternal ";
if (item.jokerData.stickers.perishable) output += "Perishable ";
if (item.jokerData.stickers.rental) output += "Rental ";
if (item.jokerData.edition != "No Edition") output += item.jokerData.edition + " ";
}
output += item.item + "\n";
item.delete();
}
output += "\nPacks: \n";
var numPacks = (a == 1) ? 4 : 6;
for (let p = 1; p <= numPacks; p++) {
var pack = inst.nextPack(a);
output += pack + " - ";
var packInfo = Immolate.packInfo(pack);
if (packInfo.type == "Celestial Pack") {
var cards = inst.nextCelestialPack(packInfo.size, a);
for (let c = 0; c < packInfo.size; c++) {
output += cards.get(c);
output += (c + 1 != packInfo.size) ? ", " : "";
}
cards.delete();
}
if (packInfo.type == "Arcana Pack") {
var cards = inst.nextArcanaPack(packInfo.size, a);
for (let c = 0; c < packInfo.size; c++) {
output += cards.get(c);
output += (c + 1 != packInfo.size) ? ", " : "";
}
cards.delete();
}
if (packInfo.type == "Spectral Pack") {
var cards = inst.nextSpectralPack(packInfo.size, a);
for (let c = 0; c < packInfo.size; c++) {
output += cards.get(c);
output += (c + 1 != packInfo.size) ? ", " : "";
}
cards.delete();
}
if (packInfo.type == "Buffoon Pack") {
var cards = inst.nextBuffoonPack(packInfo.size, a);
for (let c = 0; c < packInfo.size; c++) {
var joker = cards.get(c);
if (joker.stickers.eternal) output += "Eternal ";
if (joker.stickers.perishable) output += "Perishable ";
if (joker.stickers.rental) output += "Rental ";
if (joker.edition != "No Edition") output += joker.edition + " ";
output += joker.joker;
joker.delete();
output += (c + 1 != packInfo.size) ? ", " : "";
}
cards.delete();
}
if (packInfo.type == "Standard Pack") {
var cards = inst.nextStandardPack(packInfo.size, a);
for (let c = 0; c < packInfo.size; c++) {
var card = cards.get(c);
if (card.seal != "No Seal") output += card.seal + " ";
if (card.edition != "No Edition") output += card.edition + " ";
if (card.enhancement != "No Enhancement") output += card.enhancement + " ";
var rank = card.base[2];
if (rank == "T") output += "10";
else if (rank == "J") output += "Jack";
else if (rank == "Q") output += "Queen";
else if (rank == "K") output += "King";
else if (rank == "A") output += "Ace";
else output += rank;
output += " of ";
var suit = card.base[0];
if (suit == "C") output += "Clubs";
else if (suit == "S") output += "Spades";
else if (suit == "D") output += "Diamonds";
else if (suit == "H") output += "Hearts";
card.delete();
output += (c + 1 != packInfo.size) ? ", " : "";
}
cards.delete();
}
output += "\n";
}
output += "\n";
};
inst.delete();
// Update output box with analysis result
outputBox.value = output;
}
window.addEventListener('DOMContentLoaded', () => {
const seedInput = document.getElementById('seed');
const cardsPerAnteInput = document.getElementById('cardsPerAnte');
const anteInput = document.getElementById('ante');
const deckInput = document.getElementById('deck');
const stakeInput = document.getElementById('stake');
const versionInput = document.getElementById('version');
// Get seed value from URL parameters
const urlParams = new URLSearchParams(window.location.search);
const urlSeed = urlParams.get('seed');
const urlAnte = urlParams.get('ante');
const urlCardsPerAnte = urlParams.get('cardsPerAnte');
const urlDeck = urlParams.get('deck');
const urlStake = urlParams.get('stake');
const urlVersion = urlParams.get('version');
const urlUnlocks = urlParams.get('unlocks');
if (urlUnlocks) {
// Decode the base64 string
const binaryString = atob(urlUnlocks)
.split('')
.map(char => char.charCodeAt(0).toString(2).padStart(8, '0'))
.join('');
// Remove the padding byte (if present)
const paddingLength = binaryString.length % 8;
const unpadded = paddingLength > 0 ? binaryString.slice(0, -paddingLength) : binaryString;
// Convert the binary string back to an array of booleans
const decodedUnlocks = unpadded.split('').map(bit => bit === '1');
selectedOptions = decodedUnlocks;
}
// Set default seed value
if (urlAnte) {
anteInput.value = urlAnte;
anteInput.value = Math.min(anteInput.value, 999);
anteInput.value = Math.max(anteInput.value, 1);
cardsPerAnteInput.value = "15,50,50,50,50,50,50,50";
var input = cardsPerAnteInput.value.split(',').map(Number);
var fixedInput = []
for (let i = 0; i < anteInput.value; i++) {
if (input.length < i) {
fixedInput.push(0);
} else {
fixedInput.push(input[i]);
}
if (fixedInput[i] == undefined) fixedInput[i] = 0;
if (isNaN(fixedInput[i])) fixedInput[i] = 0;
}
cardsPerAnteInput.value = fixedInput;
}
if (urlCardsPerAnte) {
cardsPerAnteInput.value = urlCardsPerAnte;
var input = cardsPerAnteInput.value.split(',').map(Number);
var fixedInput = []
for (let i = 0; i < anteInput.value; i++) {
if (input.length < i) {
fixedInput.push(0);
} else {
fixedInput.push(input[i]);
}
if (fixedInput[i] == undefined) fixedInput[i] = 0;
if (isNaN(fixedInput[i])) fixedInput[i] = 0;
}
cardsPerAnteInput.value = fixedInput;
}
if (urlDeck) {
deckInput.value = urlDeck;
}
if (urlStake) {
stakeInput.value = urlStake;
}
if (urlSeed) {
seedInput.value = filterSeed(urlSeed);
instantAnalysis = true;
}
if (urlVersion) {
versionInput.value = urlVersion;
}
// Add event listener for input event
seedInput.addEventListener('input', () => {
seedInput.value = filterSeed(seedInput.value);
});
anteInput.addEventListener('input', () => {
anteInput.value = Math.min(anteInput.value, 999);
anteInput.value = Math.max(anteInput.value, 1);
var input = cardsPerAnteInput.value.split(',').map(Number);
var fixedInput = []
for (let i = 0; i < anteInput.value; i++) {
if (input.length < i) {
fixedInput.push(0);
} else {
fixedInput.push(input[i]);
}
if (fixedInput[i] == undefined) fixedInput[i] = 0;
if (isNaN(fixedInput[i])) fixedInput[i] = 0;
}
cardsPerAnteInput.value = fixedInput;
});
cardsPerAnteInput.addEventListener('input', () => {
var input = cardsPerAnteInput.value.split(',').map(Number);
var fixedInput = []
for (let i = 0; i < anteInput.value; i++) {
if (input.length < i) {
fixedInput.push(0);
} else {
fixedInput.push(input[i]);
}
if (fixedInput[i] == undefined) fixedInput[i] = 0;
if (isNaN(fixedInput[i])) fixedInput[i] = 0;
}
cardsPerAnteInput.value = fixedInput;
});
function filterSeed(seed) {
const filteredSeed = seed.replace(/[^A-Za-z0-9]/g, '').toUpperCase().replace(/0/g, 'O');
// Truncate the seed if it's longer than 8 characters
return filteredSeed.slice(0, 8);
}
});
</script>
</html>