Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
3812 lines (3402 loc) · 168 KB
/
Copy pathscript.js
File metadata and controls
3812 lines (3402 loc) · 168 KB
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
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
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
const eggs = [
{ name: "Common Egg", Pets: [ { name: "King Doggy (Secret)", baseOdds: 100000000 } ], world: "1" },
{ name: "Spikey Egg", Pets: [ { name: "Emerald Golem", baseOdds: 200 } ], world: "1" },
{ name: "Magma Egg", Pets: [ { name: "Inferno Dragon", baseOdds: 400 } ], world: "1" },
{ name: "Crystal Egg", Pets: [ { name: "Unicorn", baseOdds: 400 }, { name: "Flying Pig", baseOdds: 1000 } ], world: "1" },
{ name: "Lunar Egg", Pets: [ { name: "Lunar Serpent", baseOdds: 400 }, { name: "Electra", baseOdds: 1000 } ], world: "1" },
{ name: "Void Egg", Pets: [ { name: "Dark Phoenix", baseOdds: 2000 }, { name: "Neon Elemental", baseOdds: 5000 }, { name: "NULLVoid", baseOdds: 1000000 } ], world: "1" },
{ name: "Hell Egg", Pets: [ { name: "Inferno Cube", baseOdds: 4000 }, { name: "Virus", baseOdds: 50000 } ], world: "1" },
{ name: "Nightmare Egg", Pets: [ { name: "Green Hydra", baseOdds: 25000 }, { name: "Demonic Hydra", baseOdds: 100000 }, { name: "The Overlord (Secret)", baseOdds: 50000000 } ], world: "1" },
{ name: "Rainbow Egg", Pets: [ { name: "Hexarium", baseOdds: 100000 }, { name: "Rainbow Shock", baseOdds: 200000 } ], world: "1" },
{ name: "Mining Egg", Pets: [ { name: "Crystal Unicorn", baseOdds: 200 }, { name: "Stone Gargoyle", baseOdds: 20000 }, { name: "Giant Cave Mole (Secret)", baseOdds: 500000000 } ], world: "2" },
{ name: "Cyber Egg", Pets: [ { name: "Cyborg Phoenix", baseOdds: 2500 }, { name: "Space Invader", baseOdds: 50000 }, { name: "Bionic Shard", baseOdds: 666667 }, { name: "Mech Robot (Secret)", baseOdds: 66666667 } ], world: "2" },
{ name: "Neon Egg", Pets: [ { name: "Neon Wyvern", baseOdds: 3333 }, { name: "Neon Wire Eye", baseOdds: 66667 }, { name: "Equalizer", baseOdds: 833333 }, { name: "Hyperwave Kitty (Secret)", baseOdds: 125000000 } ], world: "2" },
{ name: "Chance Egg", Pets: [ { name: "Ring Master", baseOdds: 100000 }, { name: "Royal Guardian (Secret)", baseOdds: 200000000 } ], world: "1" },
{ name: "Icy Egg", Pets: [ { name: "Marshmallow", baseOdds: 2000 }, { name: "Minty Serpent", baseOdds: 66667 }, { name: "Ice Winged Hydra", baseOdds: 833333 }, { name: "Giant Pearl (Secret)", baseOdds: 125000000 } ], world: "3" },
{ name: "Vine Egg", Pets: [ { name: "Thorn Dragon", baseOdds: 4000 }, { name: "Flower Pot", baseOdds: 100000 }, { name: "Lovely Lotus", baseOdds: 1000000 }, { name: "Earth Champion (Secret)", baseOdds: 500000000 }, { name: "Dark Champion (Secret)", baseOdds: 500000000 }, { name: "Fire Champion (Secret)", baseOdds: 500000000 }, { name: "Sky Champion (Secret)", baseOdds: 500000000 } ], world: "3" },
{ name: "Lava Egg", Pets: [ { name: "Magma Cube", baseOdds: 4000 }, { name: "Night Dweller", baseOdds: 100000 }, { name: "Fire King", baseOdds: 1333333 }, { name: "Hellshard (Secret)", baseOdds: 1000000000 } ], world: "3" },
{ name: "Secret Egg", Pets: [ { name: "Gigantic Spitty (Infinity)", baseOdds: 40000000000 } ], world: "1" },
{ name: "Atlantis Egg", Pets: [ { name: "Angler Fish", baseOdds: 4000 }, { name: "Jellyfish", baseOdds: 200000 }, { name: "Atlantis Guardian", baseOdds: 2000000 }, { name: "Tidal God (Secret)", baseOdds: 250000000 } ], world: "3" },
{ name: "Classic Egg", Pets: [ { name: "Classic Unicorn", baseOdds: 4000 }, { name: "Classic Dominus", baseOdds: 200000 }, { name: "Classic Noob", baseOdds: 2000000 }, { name: "Classic Overlord (Secret)", baseOdds: 100000000 } ], world: "3" },
{ name: "Royal Egg", Pets: [ { name: "Royal Inferno Dragon", baseOdds: 1000 }, { name: "Prince Slime", baseOdds: 5000 }, { name: "Royalty", baseOdds: 20000 }, { name: "Royal Dogcat (Secret)", baseOdds: 400000 } ], world: "1" },
{ name: "Spotted Egg", Pets: [ { name: "QUE FOFO FACE GOD (Infinity)", baseOdds: 1000000000000 } ], world: "1" },
{ name: "Super Egg", Pets: [ { name: "Super Unicorn", baseOdds: 100000 }, { name: "Super Crescent Empress", baseOdds: 1000000 }, { name: "The Superlord (Secret)", baseOdds: 100000000 }, { name: "SUPER BIG ROUND (Secret)", baseOdds: 1000000000 }, { name: "Super Radiant One (Secret)", baseOdds: 10000000000 }, { name: "Super Leviathan (Infinity)", baseOdds: 200000000000 } ], world: "1" },
{ name: "OG Rift Egg", Pets: [ { name: "OG Sky Imp", baseOdds: 20000 }, { name: "OG Advocate", baseOdds: 1000000 }, { name: "OG Glitch", baseOdds: 10000000 }, { name: "OG Easter Spirit (Secret)", baseOdds: 500000000 }, { name: "OG Angelic Skull (Secret)", baseOdds: 2000000000 }, { name: "OG Guardian Skull (Secret)", baseOdds: 2000000000 }, { name: "OG King Skull (Secret)", baseOdds: 2000000000 }, { name: "OG Sinister Skull (Secret)", baseOdds: 2000000000 }, { name: "OG Wolf Skull (Secret)", baseOdds: 2000000000 } ], world: "1" },
{ name: "Moon Egg", Pets: [ { name: "Moonglow Serpent", baseOdds: 20000 }, { name: "Moonglow Axolotl", baseOdds: 1000000 }, { name: "Moonglow Elemental", baseOdds: 10000000 }, { name: "Everlasting Moonglow (Secret)", baseOdds: 5000000000 }, { name: "Moon Goddess (Secret)", baseOdds: 1000000000 }, { name: "Selenic Paladin (Secret)", baseOdds: 10000000000 } ], world: "limited" },
{ name: "Lunar New Years Egg", Pets: [ { name: "Ardent Lantern", baseOdds: 10000 }, { name: "Silly Wushi", baseOdds: 66667 }, { name: "Crimson Blossom", baseOdds: 4000000 }, { name: "Fortuitous Overlord (Secret)", baseOdds: 1000000000 }, { name: "Golden Tokage (Secret)", baseOdds: 2000000000 }, { name: "Fortune Star (Secret)", baseOdds: 10000000000 }, { name: "Chinese Dragon (Infinity)", baseOdds: 66666666667 } ], world: "limited" },
{ name: "Petal Egg", Pets: [ { name: "Fire Ant", baseOdds: 50000 }, { name: "Flower Queen", baseOdds: 400000 }, { name: "Spring Shard (Secret)", baseOdds: 200000000 }, { name: "Spring Duality (Secret)", baseOdds: 1000000000 } ], world: "1" }
];
const bounty_overrides = {
'Sea Chime': 500000000,
'Auronium': 1000000000,
'Giant Snowman': 50000000
};
function getBountyOverrideByName(petName) {
if (!petName) return null;
const normalized = String(petName).replace(/\(.*?\)/g, '').trim().toLowerCase();
for (const key of Object.keys(bounty_overrides || {})) {
if (!key) continue;
const kNorm = String(key).replace(/\(.*?\)/g, '').trim().toLowerCase();
if (kNorm === normalized) return bounty_overrides[key];
}
return null;
}
const FESTIVE_POTION_MAP = {
'I': { luck: 50, shiny: 50, mythic: 25 },
'II': { luck: 100, shiny: 100, mythic: 75 },
'III': { luck: 150, shiny: 150, mythic: 100 },
'IV': { luck: 250, shiny: 175, mythic: 125 },
'VALENTINE': { luck: 250, shiny: 200, mythic: 200 },
'DUALITY': { luck: 150, shiny: 150, mythic: 150 }
};
const EVENT_UPGRADES = {
"circus-luck": {
1: { luck: 0.1 },
2: { luck: 0.15 },
3: { luck: 0.2 },
4: { luck: 0.25 }
},
"circus-secret-luck": {
1: { secretLuck: 0.01 },
2: { secretLuck: 0.02 },
3: { secretLuck: 0.03 },
4: { secretLuck: 0.05 }
},
"circus-infinity-luck": {
1: { infinityLuck: 0.01 },
2: { infinityLuck: 0.02 },
3: { infinityLuck: 0.03 },
4: { infinityLuck: 0.05 }
}
};
function isCircusEggFn(egg) {
if (!egg) return false;
const world = (egg.world || '').toString().toLowerCase();
const name = (egg.name || '').toString().toLowerCase();
const idx = (egg.index || '').toString().toLowerCase();
if (world === 'limited1') return true;
if (idx && idx.indexOf('circus') !== -1) return true;
const circusKeywords = ['circus','clown','carnival','jester','cotton candy','balloon','bigtop','ringmaster'];
for (const k of circusKeywords) { if (name && name.indexOf(k) !== -1) return true; }
if (world === 'limited' && (idx.indexOf('circus') !== -1 || circusKeywords.some(k => name.indexOf(k) !== -1))) return true;
return false;
}
function openFloatingPanel(panel, button) {
if (!panel || !button) return;
if (panel.classList && panel.classList.contains('open')) return;
panel._origParent = panel.parentNode;
panel._nextSibling = panel.nextSibling;
panel._button = button;
document.body.appendChild(panel);
panel.style.position = 'absolute';
panel.style.zIndex = '30000';
panel.classList && panel.classList.add('open');
panel.style.display = 'block';
function updatePos() {
try {
const rect = button.getBoundingClientRect();
const left = rect.left + (window.scrollX || window.pageXOffset);
const top = rect.bottom + (window.scrollY || window.pageYOffset) + 6;
panel.style.left = `${left}px`;
panel.style.top = `${top}px`;
} catch (e) {}
}
panel._updatePosHandler = updatePos;
window.addEventListener('scroll', updatePos, true);
window.addEventListener('resize', updatePos);
updatePos();
}
function closeFloatingPanel(panel) {
if (!panel) return;
panel.classList && panel.classList.remove('open');
try {
if (panel._updatePosHandler) {
window.removeEventListener('scroll', panel._updatePosHandler, true);
window.removeEventListener('resize', panel._updatePosHandler);
panel._updatePosHandler = null;
}
if (panel._origParent) {
if (panel._nextSibling) panel._origParent.insertBefore(panel, panel._nextSibling);
else panel._origParent.appendChild(panel);
}
} catch (e) {}
panel._origParent = null; panel._nextSibling = null; panel._button = null;
panel.style.position = 'absolute';
panel.style.left = '';
panel.style.top = '';
panel.style.zIndex = '40';
panel.style.display = 'none';
}
let selectedWorld = null;
let selectedEgg = null;
let lastSearchValue = '';
const eggList = document.getElementById("egg-list");
let lastNormalWorld = null;
function renderEggs() {
if (window && window._openBountyOnLoad) {
return;
}
animateEggList(() => {
eggList.innerHTML = '';
const eggsJson = window.eggsJson || [];
const searchBarRow = document.getElementById('search-bar-row');
const worldsSidebar = document.querySelector('.worlds-sidebar')
const searchInput = document.getElementById('search-bar');
if (searchInput) lastSearchValue = searchInput.value;
document.querySelectorAll('.world-icon-btn').forEach(btn => {
btn.classList.remove('selected');
if (selectedWorld) {
if (
(selectedWorld === '1' && btn.classList.contains('overworld')) ||
(selectedWorld === '2' && btn.classList.contains('minigame')) ||
(selectedWorld === '3' && btn.classList.contains('seas')) ||
(selectedWorld === 'limited' && btn.classList.contains('limited')) ||
(selectedWorld === 'infinity' && btn.classList.contains('infinity'))
) {
btn.classList.add('selected');
}
}
});
if (selectedEgg) {
if (searchBarRow) searchBarRow.classList.add('hide-search-bar-row');
if (worldsSidebar) worldsSidebar.style.display = 'none';
const egg = eggs.find(e => e.name === selectedEgg);
console.debug('[DEBUG] selectedEgg:', selectedEgg, 'foundEgg:', egg);
const jsonEgg = eggsJson.find(e => e.name === (egg && egg.name));
const canSpawnAsRift = jsonEgg && jsonEgg.canSpawnAsRift;
animateEggDetails(() => createEggDetailsView(egg, canSpawnAsRift));
return;
}
if (searchBarRow) searchBarRow.classList.remove('hide-search-bar-row');
if (worldsSidebar) worldsSidebar.style.display = '';
let filteredEggs = eggs;
let searchTerm = '';
if (searchInput && searchInput.value.trim() !== '') {
searchTerm = searchInput.value.trim().toLowerCase();
filteredEggs = filteredEggs.filter(egg =>
egg.name.toLowerCase().includes(searchTerm) ||
egg.Pets.some(pet => pet.name.toLowerCase().includes(searchTerm))
);
}
if (selectedWorld) {
if (selectedWorld === 'limited') {
filteredEggs = filteredEggs.filter(egg => egg.world === 'limited' || egg.world === 'limitedH' || egg.world === 'limited1');
} else {
filteredEggs = filteredEggs.filter(egg => egg.world === selectedWorld);
}
}
if (filteredEggs.length === 0) {
const noResults = document.createElement('div');
noResults.style.textAlign = 'center';
noResults.style.margin = '32px 0';
noResults.style.fontSize = '1.3em';
noResults.style.opacity = '0.7';
noResults.textContent = 'No eggs found that match the query';
eggList.appendChild(noResults);
return;
}
filteredEggs.forEach(egg => {
createEggGridItem(egg);
});
});
}
async function fetchEggsData() {
const resp = await fetch('Data/eggs.json');
const eggsJson = await resp.json();
let riftSet = new Set();
try {
const r = await fetch('Data/rifts.txt');
if (r && r.ok) {
const txt = await r.text();
riftSet = new Set(txt.split(/\r?\n/).map(l => l.trim()).filter(Boolean));
}
} catch (e) {
}
if (Array.isArray(eggsJson)) {
for (const egg of eggsJson) {
try {
const isRift = !riftSet.has(egg.name);
egg.rift = isRift;
egg.canSpawnAsRift = isRift;
} catch (e) {
}
}
}
return eggsJson;
}
function selectWorld(world) {
const eggList = document.getElementById("egg-list");
if (selectedWorld === world) {
selectedWorld = null;
selectedEgg = null;
animateEggList(() => renderEggs());
return;
}
if (["1", "2", "3", "limited"].includes(world)) {
lastNormalWorld = world;
}
selectedWorld = world;
selectedEgg = null;
if (world === "infinity") {
selectedEgg = "Infinity Egg";
}
animateEggList(() => renderEggs());
}
function animateEggList(callback) {
const eggList = document.getElementById("egg-list");
eggList.classList.add("fading");
setTimeout(() => {
eggList.innerHTML = '';
callback();
eggList.classList.remove("fading");
}, 200);
}
function animateEggDetails(callback) {
const layout = document.querySelector(".egg-details-layout");
if (layout) {
layout.classList.add("fading");
setTimeout(() => {
callback();
layout.classList.remove("fading");
}, 200);
} else {
callback();
}
}
function createEggGridItem(egg) {
const card = document.createElement("div");
card.className = "egg-card";
card.setAttribute("data-world", egg.world);
card.style.cursor = "pointer";
card.onclick = () => {
selectedEgg = egg.name;
renderEggs();
};
const eggHeader = document.createElement("div");
eggHeader.className = "egg-header";
const eggImg = getEggImagePath(egg);
eggHeader.innerHTML = `<img src="${eggImg}" alt="${egg.name}" style="width: 56px; height: 56px;" onerror="this.src='Images/eggs/Placeholder_egg.webp'" />
<h2>${egg.name}</h2>`;
card.appendChild(eggHeader);
eggList.appendChild(card);
}
let infinityEggData = null;
let selectedInfinityWorld = "1";
async function loadInfinityEggData() {
if (infinityEggData) return infinityEggData;
const res = await fetch("Data/infinity_egg.json");
infinityEggData = await res.json();
return infinityEggData;
}
function parseChanceString(chance) {
const API_SCALE = 100;
if (chance === null || chance === undefined) return null;
if (typeof chance === 'number') {
if (isFinite(chance) && chance > 0 && chance < 1) return Math.max(1, Math.round((1 / chance) * API_SCALE));
if (isFinite(chance) && chance >= 1) return Math.round(chance);
return null;
}
if (typeof chance === 'string') {
const s = chance.trim().toLowerCase();
if (/^[\d.+-]*e[+-]?\d+$/i.test(s) || /^0?\.?\d+$/.test(s) || /^\d+(\.\d+)?$/.test(s)) {
const n = Number(s);
if (isFinite(n) && n > 0 && n < 1) return Math.max(1, Math.round((1 / n) * API_SCALE));
if (isFinite(n) && n >= 1) return Math.round(n);
}
const m = s.match(/1\/\s*([\d,.]+)\s*([mb]?)/i) || s.match(/1\s*(?:in|\/)\s*([\d,.]+)\s*([mb]?)/i);
if (!m) return null;
let num = m[1].replace(/[,]/g, '');
let val = Number(num);
const suffix = (m[2] || '').toLowerCase();
if (suffix === 'm') val = val * 1_000_000;
if (suffix === 'b') val = val * 1_000_000_000;
if (!isFinite(val) || val <= 0) return null;
return Math.round(val);
}
return null;
}
function secondsUntilNextUTCDate() {
const now = new Date();
const next = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() + 1, 0, 0, 0));
return Math.max(0, Math.floor((next.getTime() - now.getTime()) / 1000));
}
function formatOneInShort(oneIn) {
if (!isFinite(oneIn) || oneIn === Infinity) return '∞';
const n = Math.round(oneIn);
return `1 in ${n.toLocaleString()}`;
}
async function createBountyDetailsView() {
const bounties = await fetchBounties();
const todayLabel = formatUTCDateToLabel(new Date());
const todays = (bounties || []).find(b => b.Time === todayLabel) || (bounties && bounties[0]) || null;
let applyBountyFunc = null;
const searchBarRow = document.getElementById('search-bar-row');
if (searchBarRow) searchBarRow.classList.add('hide-search-bar-row');
const worldsSidebar = document.querySelector('.worlds-sidebar');
if (worldsSidebar) worldsSidebar.style.display = 'none';
const oldDiv = document.getElementById('bounty-divider');
if (oldDiv && oldDiv.parentNode) oldDiv.parentNode.removeChild(oldDiv);
eggList.innerHTML = '';
const backBtn = document.createElement("button");
backBtn.className = "egg-back-btn";
backBtn.style.position = "absolute";
backBtn.style.left = "20px";
backBtn.style.top = "140px";
backBtn.style.background = "none";
backBtn.style.border = "none";
backBtn.style.padding = "10px";
backBtn.style.zIndex = "20";
backBtn.style.cursor = "pointer";
backBtn.innerHTML = `<img src="Images/Icons/back.ico" alt="Back" style="width:32px;height:32px;vertical-align:middle;">`;
backBtn.onclick = () => {
selectedEgg = null;
if (selectedWorld === "infinity") {
selectedWorld = lastNormalWorld || null;
}
const searchInput = document.getElementById('search-bar');
if (searchInput) searchInput.value = lastSearchValue;
renderEggs();
};
const layout = document.createElement('div');
layout.className = 'egg-details-layout';
layout.style.position = 'relative';
const left = document.createElement('div');
left.className = 'egg-details-left';
const middle = document.createElement('div');
middle.className = 'egg-details-middle';
const right = document.createElement('div');
right.className = 'egg-details-right';
right.style.display = 'flex';
right.style.flexDirection = 'column';
right.style.alignItems = 'flex-start';
right.style.flex = '1 1 0%';
right.style.boxSizing = 'border-box';
const petIconWrap = document.createElement('div');
petIconWrap.style.display = 'flex';
petIconWrap.style.justifyContent = 'center';
petIconWrap.style.alignItems = 'center';
petIconWrap.style.marginTop = '-8px';
petIconWrap.style.marginBottom = '8px';
const petImg = document.createElement('img');
let currentBounty = todays;
const petNameVal = safeVal(currentBounty && currentBounty.Pet) || 'Unknown';
petImg.src = getPetIconByName(petNameVal) || 'Images/pets/Doggy.webp';
petImg.onerror = () => { petImg.src = 'Images/Pets/Doggy.webp'; };
petImg.alt = petNameVal;
petImg.style.width = '150px';
petImg.style.height = '150px';
petImg.style.objectFit = 'contain';
petImg.style.borderRadius = '12px';
petImg.style.boxShadow = '0 6px 24px rgba(0,0,0,0.22)';
petIconWrap.appendChild(petImg);
left.appendChild(petIconWrap);
const infoWrap = document.createElement('div');
infoWrap.style.textAlign = 'center';
infoWrap.style.margin = '8px 6px';
const nameEl = document.createElement('div');
nameEl.style.fontWeight = '700';
nameEl.style.fontSize = '1.4rem';
nameEl.textContent = petNameVal;
infoWrap.appendChild(nameEl);
const chanceText = (currentBounty && currentBounty.Chance) ? currentBounty.Chance : 'Unknown';
const chanceEl = document.createElement('div');
chanceEl.style.color = 'var(--main-text)';
chanceEl.style.marginTop = '6px';
chanceEl.style.fontWeight = '700';
try {
const parsed = parseChanceString(chanceText);
chanceEl.textContent = parsed ? `Chance (base): ${formatOneInShort(parsed)}` : `Chance (base): ${chanceText}`; if (parsed) chanceEl.title = `Exact: 1/${parsed.toLocaleString()}`;
} catch (e) { chanceEl.textContent = `Chance (base): ${chanceText}`; }
infoWrap.appendChild(chanceEl);
const eggText = safeVal(currentBounty && currentBounty.Egg) || 'Unknown Egg';
const eggEl = document.createElement('div');
eggEl.style.marginTop = '6px';
eggEl.innerHTML = `Egg: <strong>${eggText}</strong>`;
infoWrap.appendChild(eggEl);
const jsonEgg = (window.eggsJson || []).find(e => e.name === eggText) || null;
const eggCanSpawnAsRift = !!(jsonEgg && jsonEgg.canSpawnAsRift);
const timerEl = document.createElement('div');
timerEl.style.marginTop = '8px';
timerEl.style.fontWeight = '600';
timerEl.id = 'bounty-timer';
const timerLabelEl = document.createElement('div');
timerLabelEl.style.fontWeight = '700';
timerLabelEl.style.marginBottom = '4px';
timerLabelEl.textContent = '';
const timerValueEl = document.createElement('div');
timerValueEl.style.whiteSpace = 'pre';
timerValueEl.textContent = '';
timerEl.appendChild(timerLabelEl);
timerEl.appendChild(timerValueEl);
infoWrap.appendChild(timerEl);
const hr = document.createElement('hr');
hr.style.margin = '12px 0';
hr.style.border = 'none';
hr.style.borderTop = '1px solid var(--table-border)';
infoWrap.appendChild(hr);
const upcomingWrap = document.createElement('div');
upcomingWrap.style.display = 'flex';
upcomingWrap.style.flexDirection = 'column';
upcomingWrap.style.gap = '12px';
upcomingWrap.style.marginTop = '8px';
upcomingWrap.id = 'bounty-upcoming-wrap';
function parseApiDateToUTC(dateStr) {
if (!dateStr) return null;
const s = dateStr.trim();
const isoMatch = s.match(/^(\d{4})[-\/](\d{2})[-\/](\d{2})/);
if (isoMatch) {
const y = parseInt(isoMatch[1], 10);
const m = parseInt(isoMatch[2], 10) - 1;
const d = parseInt(isoMatch[3], 10);
if (!isNaN(y) && !isNaN(m) && !isNaN(d)) return new Date(Date.UTC(y, m, d, 0, 0, 0));
}
const parts = s.split(' ');
if (parts.length < 3) return null;
const day = parseInt(parts[0], 10);
const monthName = parts[1];
const year = parseInt(parts[2], 10);
const months = { January:0, February:1, March:2, April:3, May:4, June:5, July:6, August:7, September:8, October:9, November:10, December:11 };
const m = months[monthName];
if (isNaN(day) || isNaN(year) || m === undefined) return null;
return new Date(Date.UTC(year, m, day, 0, 0, 0));
}
function formatShortLabel(timeStr) {
const d = parseApiDateToUTC(timeStr);
if (!d) return timeStr || '';
const months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
const day = d.getUTCDate();
const suffix = (n => (n%10===1 && n!==11)?'st':(n%10===2 && n!==12)?'nd':(n%10===3 && n!==13)?'rd':'th')(day);
return `${months[d.getUTCMonth()]} ${day}${suffix}`;
}
const todayUTC = new Date(Date.UTC(new Date().getUTCFullYear(), new Date().getUTCMonth(), new Date().getUTCDate(), 0,0,0));
const filteredBounties = (bounties || []).map(b => {
const d = parseApiDateToUTC(b.Time);
return { raw: b, date: d };
}).sort((a, b) => {
if (!a.date && !b.date) return 0;
if (!a.date) return 1;
if (!b.date) return -1;
return a.date.getTime() - b.date.getTime();
}).map(x => x.raw);
let timerInterval = null;
function updateTimer() {
try {
const selectedIdxRaw = layout.dataset.selectedBountyIndex;
const selectedIdx = Number(selectedIdxRaw || '');
let prefix = 'Next bounty in: ';
let secs = secondsUntilNextUTCDate();
if (!Number.isNaN(selectedIdx) && selectedIdxRaw !== '' && filteredBounties && filteredBounties.length > selectedIdx) {
const b = filteredBounties[selectedIdx];
if (!b || !b.Time) {
try { timerLabelEl.textContent = 'Time until this bounty:'; } catch (e) {}
try { timerValueEl.textContent = 'Loading...'; } catch (e) {}
return;
}
const target = parseApiDateToUTC(b.Time);
if (!target) {
try { timerLabelEl.textContent = 'Time until this bounty:'; } catch (e) {}
try { timerValueEl.textContent = 'Loading...'; } catch (e) {}
return;
}
const now = Date.now();
const diff = Math.max(0, Math.floor((target.getTime() - now) / 1000));
secs = diff;
const today = new Date(Date.UTC(new Date().getUTCFullYear(), new Date().getUTCMonth(), new Date().getUTCDate(), 0,0,0));
if (target.getTime() >= today.getTime()) {
const isToday = (target.getTime() === today.getTime());
if (isToday) {
secs = secondsUntilNextUTCDate();
prefix = 'Next bounty in: ';
} else {
prefix = 'Time until this bounty: ';
}
}
}
if (!isFinite(secs) || secs < 0) {
try { timerLabelEl.textContent = 'Time until this bounty:'; } catch (e) {}
try { timerValueEl.textContent = 'Loading...'; } catch (e) {}
return;
}
const days = Math.floor(secs / 86400);
const hours = Math.floor((secs % 86400) / 3600);
const minutes = Math.floor((secs % 3600) / 60);
const seconds = secs % 60;
const p = n => String(n).padStart(2, '0');
try { timerLabelEl.textContent = prefix.trim(); } catch (e) {}
try {
if (days > 0) {
timerValueEl.textContent = `${days}d ${p(hours)}:${p(minutes)}:${p(seconds)}`;
} else {
timerValueEl.textContent = `${p(hours)}:${p(minutes)}:${p(seconds)}`;
}
} catch (e) {}
} catch (e) {
try { timerLabelEl.textContent = 'Time until this bounty:'; } catch (e) {}
try { timerValueEl.textContent = 'Loading...'; } catch (e) {}
}
}
updateTimer();
timerInterval = setInterval(updateTimer, 1000);
let upcomingPage = 0;
const pageSize = 5;
const PLACEHOLDER_EGG_IMAGE = 'Images/eggs/Placeholder.webp';
function safeVal(v) {
if (v === null || v === undefined) return null;
const s = String(v).trim();
if (s === '' || s === '?' ) return null;
return s;
}
function renderUpcomingPage() {
upcomingWrap.innerHTML = '';
const start = upcomingPage * pageSize;
const pageItems = filteredBounties.slice(start, start + pageSize);
function normalizeName(n) {
return (n || '').replace(/\(.*?\)/g, '').trim().toLowerCase();
}
if ((!layout.dataset.selectedBountyIndex || layout.dataset.selectedBountyIndex === '') && filteredBounties.length > 0) {
let defaultIdx = -1;
if (todays) {
defaultIdx = filteredBounties.findIndex(b => b.Time === todays.Time && normalizeName(b.Pet) === normalizeName(todays.Pet));
}
if (defaultIdx === -1) defaultIdx = 0;
layout.dataset.selectedBountyIndex = String(defaultIdx);
layout.dataset.selectedPetName = filteredBounties[defaultIdx] ? filteredBounties[defaultIdx].Pet : '';
}
applyBountyFunc = (b, index) => {
currentBounty = b;
try { timerLabelEl.textContent = 'Time until this bounty:'; } catch (e) {}
try { timerValueEl.textContent = 'Loading...'; } catch (e) {}
const layoutEl = document.querySelector('.egg-details-layout');
if (layoutEl) {
layoutEl.dataset.selectedBountyIndex = index || '';
layoutEl.dataset.selectedPetName = safeVal(b && b.Pet) || '';
updateUpcomingGlow();
}
const petNameSafe = safeVal(b && b.Pet) || 'Unknown';
petImg.src = getPetIconByName(petNameSafe) || 'Images/pets/Doggy.webp';
petImg.alt = petNameSafe;
nameEl.textContent = petNameSafe;
try {
const parsed = parseChanceString(b && b.Chance);
chanceEl.textContent = parsed ? `Chance (base): ${formatOneInShort(parsed)}` : `Chance (base): ${safeVal(b && b.Chance) || 'Unknown'}`;
if (parsed) chanceEl.title = `Exact: 1/${parsed.toLocaleString()}`;
} catch (e) { chanceEl.textContent = `Chance (base): ${safeVal(b && b.Chance) || 'Unknown'}`; }
const targetEggRaw = safeVal(b && b.Egg);
const targetEggName = targetEggRaw || 'Unknown Egg';
eggImg.src = targetEggRaw ? getEggImagePath(targetEggName) : PLACEHOLDER_EGG_IMAGE;
eggImg.alt = targetEggName;
eggNameUnder.textContent = targetEggName;
try { eggEl.innerHTML = `Egg: <strong>${targetEggName}</strong>`; } catch (e) {}
let newBountyBaseOdds = parseChanceString(b && b.Chance);
try {
const override = getBountyOverrideByName(b && b.Pet);
if (override) {
newBountyBaseOdds = override;
try { chanceEl.textContent = `Chance (base): ${formatOneInShort(newBountyBaseOdds)}`; } catch (e) {}
}
} catch (e) {}
const newBountyPetObj = { name: (safeVal(b && b.Pet) || 'Unknown') + ' (Bounty)', baseOdds: newBountyBaseOdds || 0, icon: getPetIconByName(b && b.Pet) };
const selectedEggObj = eggs.find(e => e.name === targetEggName) || (window.eggsJson || []).find(e => e.name === targetEggName) || null;
const selectedPetsList = selectedEggObj && Array.isArray(selectedEggObj.Pets) ? selectedEggObj.Pets.slice() : [];
combinedEggForTable.name = targetEggName;
combinedEggForTable.Pets = [];
if (newBountyBaseOdds) combinedEggForTable.Pets.push(newBountyPetObj);
combinedEggForTable.Pets = combinedEggForTable.Pets.concat(selectedPetsList);
combinedEggForTable.secretBountyRotation = !!((selectedPetsList || []).some(p => /(Secret|Infinity)/i.test(p && p.name)));
const selectedJsonEgg = (window.eggsJson || []).find(e => e.name === targetEggName) || null;
const selectedCanSpawnAsRift = !!(selectedJsonEgg && selectedJsonEgg.canSpawnAsRift);
if (petsCard && petsCard.parentNode) petsCard.parentNode.removeChild(petsCard);
petsCard = createEggPetInfoCard(combinedEggForTable, selectedCanSpawnAsRift);
petsCard.style.marginTop = '18px';
petsCard.style.boxSizing = 'border-box';
petsCard.style.overflow = 'visible';
petsCard.style.display = 'block';
petsCard.style.width = '100%';
petsCard.style.minWidth = '0';
petsCard.style.alignSelf = 'stretch';
right.appendChild(petsCard);
try {
const existingControls = middle.querySelector('.controls');
const newControls = createEggSettings(combinedEggForTable, selectedCanSpawnAsRift);
newControls.style.marginTop = '8px';
newControls.style.alignSelf = 'flex-start';
newControls.style.width = '100%';
if (existingControls && existingControls.parentNode) existingControls.parentNode.replaceChild(newControls, existingControls);
else middle.appendChild(newControls);
} catch (e) {}
};
function updateUpcomingGlow() {
const selectedIndex = String(layout.dataset.selectedBountyIndex || '');
upcomingWrap.querySelectorAll('.bounty-upcoming-btn').forEach(btn => {
if (btn.dataset.bountyIndex && btn.dataset.bountyIndex === selectedIndex) {
btn.style.boxShadow = '0 0 12px #FBE7BD, 0 6px 24px rgba(0,0,0,0.12)';
btn.style.transition = 'box-shadow 180ms ease';
} else {
btn.style.boxShadow = 'none';
}
});
}
if (!pageItems.length) {
const none = document.createElement('div');
none.style.opacity = '0.8';
none.textContent = 'No upcoming bounties';
upcomingWrap.appendChild(none);
} else {
pageItems.forEach((b, localIdx) => {
const btn = document.createElement('button');
btn.className = 'bounty-upcoming-btn';
btn.style.display = 'flex';
btn.style.alignItems = 'center';
btn.style.gap = '12px';
btn.style.padding = '8px 12px';
btn.style.borderRadius = '12px';
btn.style.border = '1px solid var(--table-border)';
btn.style.background = 'var(--egg-card-bg)';
btn.style.cursor = 'pointer';
btn.style.color = 'var(--main-text)';
btn.style.font = 'inherit';
const icon = document.createElement('img');
const petSafe = safeVal(b && b.Pet) || 'Unknown';
icon.src = getPetIconByName(petSafe) || PLACEHOLDER_EGG_IMAGE;
icon.onerror = () => { icon.src = PLACEHOLDER_EGG_IMAGE; };
icon.alt = petSafe;
icon.style.width = '36px';
icon.style.height = '36px';
icon.style.objectFit = 'contain';
icon.style.borderRadius = '6px';
icon.style.border = '1px solid transparent';
const globalIndex = String(filteredBounties.indexOf(b));
btn.dataset.bountyIndex = globalIndex;
btn.dataset.petName = petSafe || '';
btn.style.boxShadow = 'none';
const textWrap = document.createElement('div');
textWrap.style.display = 'flex';
textWrap.style.flexDirection = 'column';
textWrap.style.alignItems = 'flex-start';
const petSpan = document.createElement('div');
petSpan.textContent = safeVal(b && b.Pet) || 'Unknown';
petSpan.style.fontWeight = '600';
petSpan.style.fontSize = '0.95rem';
const dateSpan = document.createElement('div');
dateSpan.textContent = (b && b.Time) ? formatShortLabel(b.Time) : 'Unknown';
dateSpan.style.opacity = '0.85';
dateSpan.style.fontSize = '0.85rem';
textWrap.appendChild(petSpan);
textWrap.appendChild(dateSpan);
btn.appendChild(icon);
btn.appendChild(textWrap);
btn.addEventListener('click', () => {
if (typeof applyBountyFunc === 'function') {
applyBountyFunc(b, btn.dataset.bountyIndex);
} else {
currentBounty = b;
const layoutEl = document.querySelector('.egg-details-layout');
if (layoutEl) {
layoutEl.dataset.selectedBountyIndex = btn.dataset.bountyIndex || '';
layoutEl.dataset.selectedPetName = safeVal(b && b.Pet) || '';
updateUpcomingGlow();
}
try { timerLabelEl.textContent = 'Time until this bounty:'; } catch (e) {}
try { timerValueEl.textContent = 'Loading...'; } catch (e) {}
const petNameSafe = safeVal(b && b.Pet) || 'Unknown';
petImg.src = getPetIconByName(petNameSafe) || 'Images/pets/Doggy.webp';
petImg.alt = petNameSafe;
nameEl.textContent = petNameSafe;
try {
const parsed = parseChanceString(b && b.Chance);
chanceEl.textContent = parsed ? `Chance (base): ${formatOneInShort(parsed)}` : `Chance (base): ${safeVal(b && b.Chance) || 'Unknown'}`;
if (parsed) chanceEl.title = `Exact: 1/${parsed.toLocaleString()}`;
} catch (e) { chanceEl.textContent = `Chance (base): ${safeVal(b && b.Chance) || 'Unknown'}`; }
const targetEggRaw = safeVal(b && b.Egg);
const targetEggName = targetEggRaw || eggText || 'Unknown Egg';
eggImg.src = targetEggRaw ? getEggImagePath(targetEggName) : PLACEHOLDER_EGG_IMAGE;
eggImg.alt = targetEggName;
eggNameUnder.textContent = targetEggName;
let newBountyBaseOdds = parseChanceString(b && b.Chance);
try {
const override = getBountyOverrideByName(b && b.Pet);
if (override) {
newBountyBaseOdds = override;
try { chanceEl.textContent = `Chance (base): ${formatOneInShort(newBountyBaseOdds)}`; } catch (e) {}
}
} catch (e) {}
const newBountyPetObj = { name: (safeVal(b && b.Pet) || 'Unknown') + ' (Bounty)', baseOdds: newBountyBaseOdds || 0, icon: getPetIconByName(b && b.Pet) };
const selectedPetsList = selectedEggObj && Array.isArray(selectedEggObj.Pets) ? selectedEggObj.Pets.slice() : [];
combinedEggForTable.name = targetEggName;
combinedEggForTable.Pets = [];
if (newBountyBaseOdds) combinedEggForTable.Pets.push(newBountyPetObj);
combinedEggForTable.Pets = combinedEggForTable.Pets.concat(selectedPetsList);
combinedEggForTable.secretBountyRotation = !!((selectedPetsList || []).some(p => /(Secret|Infinity)/i.test(p && p.name)));
const selectedJsonEgg = (window.eggsJson || []).find(e => e.name === targetEggName) || null;
const selectedCanSpawnAsRift = !!(selectedJsonEgg && selectedJsonEgg.canSpawnAsRift);
if (petsCard && petsCard.parentNode) petsCard.parentNode.removeChild(petsCard);
petsCard = createEggPetInfoCard(combinedEggForTable, selectedCanSpawnAsRift);
petsCard.style.marginTop = '18px';
petsCard.style.boxSizing = 'border-box';
petsCard.style.overflow = 'visible';
petsCard.style.display = 'block';
petsCard.style.width = '100%';
petsCard.style.minWidth = '0';
petsCard.style.alignSelf = 'stretch';
right.appendChild(petsCard);
try {
const existingControls = middle.querySelector('.controls');
const newControls = createEggSettings(combinedEggForTable, selectedCanSpawnAsRift);
newControls.style.marginTop = '8px';
newControls.style.alignSelf = 'flex-start';
newControls.style.width = '100%';
if (existingControls && existingControls.parentNode) existingControls.parentNode.replaceChild(newControls, existingControls);
else middle.appendChild(newControls);
} catch (e) {}
}
});
upcomingWrap.appendChild(btn);
});
}
const navWrap = document.createElement('div');
navWrap.style.display = 'flex';
navWrap.style.justifyContent = 'space-between';
navWrap.style.marginTop = '8px';
if (upcomingPage > 0) {
const backPageBtn = document.createElement('button');
backPageBtn.textContent = 'Back';
backPageBtn.style.padding = '6px 10px';
backPageBtn.style.borderRadius = '8px';
backPageBtn.style.border = '1px solid var(--table-border)';
backPageBtn.style.background = 'var(--controls-bg)';
backPageBtn.style.cursor = 'pointer';
backPageBtn.style.color = '#ffffff';
backPageBtn.style.fontFamily = document.body.style.fontFamily || 'inherit';
backPageBtn.onclick = () => { upcomingPage = Math.max(0, upcomingPage - 1); renderUpcomingPage(); };
navWrap.appendChild(backPageBtn);
} else {
const spacer = document.createElement('div'); navWrap.appendChild(spacer);
}
const moreExists = (upcomingPage + 1) * pageSize < filteredBounties.length;
if (moreExists) {
const loadMoreBtn = document.createElement('button');
loadMoreBtn.textContent = 'Load more';
loadMoreBtn.style.padding = '6px 10px';
loadMoreBtn.style.borderRadius = '8px';
loadMoreBtn.style.border = '1px solid var(--table-border)';
loadMoreBtn.style.background = 'var(--controls-bg)';
loadMoreBtn.style.cursor = 'pointer';
loadMoreBtn.style.color = '#ffffff';
loadMoreBtn.style.fontFamily = document.body.style.fontFamily || 'inherit';
loadMoreBtn.onclick = () => { upcomingPage++; renderUpcomingPage(); };
navWrap.appendChild(loadMoreBtn);
}
upcomingWrap.appendChild(navWrap);
updateUpcomingGlow();
}
renderUpcomingPage();
try {
const selIdx = layout.dataset.selectedBountyIndex || '';
if (selIdx !== '' && filteredBounties[Number(selIdx)]) {
if (typeof applyBountyFunc === 'function') applyBountyFunc(filteredBounties[Number(selIdx)], selIdx);
}
} catch (e) {}
infoWrap.appendChild(upcomingWrap);
left.appendChild(infoWrap);
const eggIconWrap = document.createElement('div');
eggIconWrap.style.display = 'flex';
eggIconWrap.style.flexDirection = 'column';
eggIconWrap.style.justifyContent = 'flex-start';
eggIconWrap.style.alignItems = 'flex-start';
eggIconWrap.style.marginTop = '8px';
eggIconWrap.style.marginLeft = '8px';
const eggImg = document.createElement('img');
eggImg.src = safeVal(currentBounty && currentBounty.Egg) ? getEggImagePath(eggText) : PLACEHOLDER_EGG_IMAGE;
eggImg.onerror = () => { eggImg.src = PLACEHOLDER_EGG_IMAGE; };
eggImg.alt = eggText;
eggImg.style.width = '160px';
eggImg.style.height = '160px';
eggImg.style.objectFit = 'contain';
eggImg.style.borderRadius = '8px';
eggImg.style.boxShadow = '0 6px 20px rgba(0,0,0,0.15)';
eggIconWrap.appendChild(eggImg);
const eggNameUnder = document.createElement('div');
eggNameUnder.style.textAlign = 'left';
eggNameUnder.style.fontSize = '1.4rem';
eggNameUnder.style.fontWeight = '700';
eggNameUnder.style.marginTop = '8px';
eggNameUnder.textContent = eggText;
eggIconWrap.appendChild(eggNameUnder);
middle.appendChild(eggIconWrap);
const fakeEggForControls = { name: 'Bounty', Pets: [], world: 'bounty', secretBountyRotation: false };
const controlsEl = createEggSettings(fakeEggForControls, eggCanSpawnAsRift);
controlsEl.style.marginTop = '8px';
controlsEl.style.alignSelf = 'flex-start';
controlsEl.style.width = '100%';
middle.appendChild(controlsEl);
const eggObj = eggs.find(e => e.name === eggText) || (window.eggsJson || []).find(e => e.name === eggText) || null;
const petsList = eggObj && Array.isArray(eggObj.Pets) ? eggObj.Pets.slice() : [];
let bountyBaseOdds = parseChanceString(chanceText);
const bountyNameKey = (currentBounty && currentBounty.Pet) ? currentBounty.Pet : petNameVal;
try {
const override = getBountyOverrideByName(bountyNameKey);
if (override) {
bountyBaseOdds = override;
try { chanceEl.textContent = `Chance (base): ${formatOneInShort(bountyBaseOdds)}`; } catch (e) {}
}
} catch (e) {}
const bountyPetObj = { name: (currentBounty && currentBounty.Pet ? currentBounty.Pet : petNameVal) + ' (Bounty)', baseOdds: bountyBaseOdds || 0, icon: getPetIconByName(currentBounty ? currentBounty.Pet : petNameVal) };
const combinedEggForTable = { name: eggText, Pets: [], secretBountyRotation: true };
if (bountyBaseOdds) combinedEggForTable.Pets.push(bountyPetObj);
combinedEggForTable.Pets = combinedEggForTable.Pets.concat(petsList);
let petsCard = createEggPetInfoCard(combinedEggForTable, false);
petsCard.style.marginTop = '18px';
petsCard.style.boxSizing = 'border-box';
petsCard.style.overflow = 'visible';
petsCard.style.display = 'block';
petsCard.style.width = '100%';
petsCard.style.minWidth = '0';
petsCard.style.alignSelf = 'stretch';
right.appendChild(petsCard);
try {
const existingControls = middle.querySelector('.controls');
const newControls = createEggSettings(combinedEggForTable, eggCanSpawnAsRift);
newControls.style.marginTop = '8px';
newControls.style.alignSelf = 'flex-start';
newControls.style.width = '100%';
if (existingControls && existingControls.parentNode) existingControls.parentNode.replaceChild(newControls, existingControls);
else middle.appendChild(newControls);
} catch (e) {}
layout.appendChild(left);
layout.appendChild(middle);
layout.appendChild(right);
const diag = document.createElement('div');
diag.id = 'layout-divider';
Object.assign(diag.style, {
position: 'absolute',
width: '2px',
background: 'var(--table-border)',
top: '0',
opacity: '0.9',
pointerEvents: 'none',
zIndex: '1'
});
layout.appendChild(diag);
[left, middle, right].forEach(col => {
col.style.position = 'relative';
col.style.zIndex = '2';
});