-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMH - Consolidated Map Colour Coder.user.js
890 lines (854 loc) · 38.9 KB
/
MH - Consolidated Map Colour Coder.user.js
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
// ==UserScript==
// @name MH - Consolidated Map Colour Coder
// @description Colour code your maps
// @author Chromatical
// @version 1.2.13
// @match https://www.mousehuntgame.com/*
// @match https://apps.facebook.com/mousehunt/*
// @icon https://www.google.com/s2/favicons?domain=mousehuntgame.com
// @grant none
// @namespace https://greasyfork.org/users/748165
// ==/UserScript==
//Which style to apply
var applyThisStyle;
$(document).ajaxComplete(async(event,xhr,options) => {
if (options.url == "https://www.mousehuntgame.com/managers/ajax/board/board.php"){
$("#chro-madcoder-settings-button")[0] ? null : addButtons();
process();
//Event listener to change map
var allMap = $(".treasureMapRootView-tab");
for (var i=0;i<allMap.length;i++){
allMap[i].addEventListener("click", function(){
applyThisStyle = undefined;
process()
})
}
var goal = $(".treasureMapRootView-subTab")[0];
goal.addEventListener("click",function(){
process();
})
}
})
//Initial loading of preset
$(document).ready(function(){
var styles = localStorage.getItem("Chro-mapcoder-styles")
styles? null : loadPreset()
});
function process(){
//Check whether there is this style
var styleCheck = localStorage.getItem("Chro-mapcoder-styles")
if (styleCheck){
var parsedStyleCheck = JSON.parse(styleCheck);
const mapName = $(".treasureMapView-mapMenu-rewardName")[0].innerText.replace(/Rare /g,'');
for (var i=0; i<parsedStyleCheck.length;i++){
if (mapName.includes(parsedStyleCheck[i][0])){
applyThisStyle = parsedStyleCheck[i];
}
}
applyThisStyle == undefined? applyThisStyle = [mapName,[]] : null;
colourise();
}
}
function colourise(){
var map = applyThisStyle;
//Reset borders
document
.querySelectorAll("#mapcoder-master-div")
.forEach(el=> el.remove());
//Highlight uncaught only?
const isChecked = localStorage.getItem("highlightPref") === "uncaught-only" ? true : false;
//Where to insert
var insertDiv = $(".treasureMapView-leftBlock .treasureMapView-block-content")[0]
//Highlight Div
const masterDiv = insertDiv.insertAdjacentElement("afterbegin", createElement("div",{
attrs:{
id: "mapcoder-master-div"
},
css:{
"display": "inline-flex",
"margin-bottom": "10px",
"width": "100%",
"text-align": "center",
"line-height": "1.5",
"overflow": "hidden"
}
}));
//All the mice are listed here
var allList = $(".treasureMapView-goals-group-goal")
//Reset to white background
for (var a=0;a<allList.length;a++){
allList[a].style.backgroundColor = "white"
};
var caughtList = [];
var uncaughtList = [];
for (var i=0;i<allList.length;i++){
var mouseName = $(".treasureMapView-goals-group-goal-name")[i].innerText
if (allList[i].className.includes("complete")){
caughtList.push(mouseName)
} else {
uncaughtList.push(mouseName)
}
}
//Applying styles
map[1].forEach(el=>{
var groupName = el[0]
var colour = el[1]
var miceGroupList = [];
el[2].forEach(mice =>{
miceGroupList.push(mice)
})
var count = 0;
for (var i=0;i<allList.length;i++){
for (var j=0; j<miceGroupList.length; j++){
if (allList[i].innerText == miceGroupList[j]){
if (uncaughtList.indexOf(allList[i].innerText)>-1){
count++
allList[i].style.backgroundColor = colour;
break;
}
if (caughtList.indexOf(allList[i].innerText)>-1){
isChecked == true? null: allList[i].style.backgroundColor = colour
break;
}
}
}
}
const smallDiv = createElement("div",{
props: {
class: "mapcoder-highlight-group-div",
innerText: groupName + "\n" + count
},
css: {
"width": "auto",
"padding": "5px",
"font-weight": "bold",
"font-size": "12.5px",
backgroundColor: clr(colour)
}
})
function clr(colour){
var clr;
count > 0? clr = colour: clr = "grey";
return clr
};
masterDiv.appendChild(smallDiv);
})
//Check if you actually have that style
if(map[1][1]){
if ($(".treasureMapView-goals-groups")[1]){
if ($(".treasureMapView-goals-groups")[1].innerText.includes("Missing")){
filter($(".treasureMapView-goals-groups")[0].children[1]);
filter($(".treasureMapView-goals-groups")[1].children[1]);
} else {
filter($(".treasureMapView-goals-groups")[0].children[1]);
}
};
function filter(oriUnfiltered){
var countA = oriUnfiltered.getElementsByTagName("a");
var unfiltered = document.createElement("div")
while (countA.length > 0){
var clone = countA[0].cloneNode(true);
unfiltered.appendChild(clone);
oriUnfiltered.removeChild(countA[0])
}
var countB = unfiltered.getElementsByTagName("a").length;
for (var q =0; q<map[1].length;q++){
for (var r=0; r<countB; r++){
if ((rgbToHex(unfiltered.getElementsByTagName("a")[r].style.backgroundColor)).toUpperCase() == map[1][q][1].toUpperCase()){
var cloneX = unfiltered.getElementsByTagName("a")[r].cloneNode(true);
oriUnfiltered.appendChild(cloneX);
}
}
}
}
}
//RGB componenets ---------------
function componentToHex(c) {
var hex = c.toString(16);
return hex.length == 1 ? "0" + hex : hex;
};
function rgbToHex(colour) {
if (colour.includes("rgb")){
var coloursplit = colour.split("rgb(")[1].split(")")[0].split(", ");
var result = "#" + componentToHex(Number(coloursplit[0])) + componentToHex(Number(coloursplit[1])) + componentToHex(Number(coloursplit[2]));
} else {
result = colour
};
return result;
};
}
function addButtons(){
var spot = $(".treasureMapRootView-subTabRow.treasureMapRootView-padding")[0]
const settingsButton = spot.appendChild(createElement("img",{
attrs:{
id: "chro-madcoder-settings-button",
src: "https://www.mousehuntgame.com/images/ui/hgbar/icon_preferences.png?asset_cache_version=2"
},
css: {
//fontSize: "10px",
height: "20px",
width: "20px",
marginLeft: "5px"
//padding: "0"
},
action: {
click(){settings()}
}
}))
}
function settings(){
document
.querySelectorAll("#chro-mapcode-settings")
.forEach(el=> el.remove())
const mainDiv = document.body.appendChild(createElement("div",{
attrs: {
id: "chro-mapcode-settings-div",
},
css: {
backgroundColor : "#F5F5F5",
position: "fixed",
zIndex: "9999",
left: "35vw",
top: "20vh",
border: "solid 2px #696969",
borderRadius: "20px",
padding: "10px",
textAlign: "center",
fontSize: "12px",
},
children: [buttonDiv(),content()]
}))
function buttonDiv(){
const buttonDiv = createElement("div",{
attrs: {
id: "chro-mapcoder-settings-header-div"
},
children:[
createElement("div",{
props:{
innerText: "Settings"
},
css:{
float: "left",
paddingTop: "4px",
marginLeft: "52px",
fontWeight: "bold"
}
}),
createElement("button",{
attrs:{
id: "mapcoder-close-button"
},
props:{
innerText: "x"
},
css:{
float: "right"
},
action:{
click(){close(buttonDiv)}
}
})]
})
function close(div){
document.body.removeChild($("#chro-mapcode-settings-div")[0])
};
return buttonDiv
}
function content(){
const content = createElement("div",{
attrs:{
id: "chro-mapcode-content-div"
},
css: {
paddingTop: "25px",
width: "175px"
},
children:[checkHighlight(),addManualStyle(),removeManualStyle(),loadPresetStyle()]
})
return content
}
//Highlight --- uncaught mice or all--------------
function checkHighlight(){
var isChecked = localStorage.getItem("highlightPref") == "uncaught-only" ? true : false;
var isCheckedStr = isChecked ? "checked" : "";
const highlight = createElement("tr",{
children:[
createElement("label",{
attrs:{
for: "chro-mapcoder-highlight-box"
},
props:{
innerText: "Highlight uncaught mice only"
}
}),
createElement("input",{
attrs:{
type: "checkbox",
id: "chro-check-box",
name: "chro-mopcoder-highlight-box",
},
action:{
click(){changeCheck()}
},
props:{
checked:isChecked
}
})]
})
function changeCheck(){
var check = $("#chro-check-box")[0];
if (check.checked == true){
localStorage.setItem("highlightPref","uncaught-only");
isCheckedStr = "checked"
} else {
localStorage.setItem("highlightPref","all");
isCheckedStr = ""
}
colourise();
};
return highlight
}
//Check highlight end--------------------------------
//Add manual style begins-----------------------------------------------------------------------
function addManualStyle(){
const manualButton = createElement("button",{
attrs:{
id:"chro-mapcode-manual-style-button"
},
props: {
innerText: "Add Mice Group"
},
css: {
marginTop: "5px"
},
action:{
click(){addManual()}
}
})
function addManual(){
document
.querySelectorAll("#chro-mapcode-pickstyle-div")
.forEach(el=> el.remove())
const mainDiv = document.body.appendChild(createElement("div",{
attrs: {
id: "chro-mapcode-pickstyle-div",
},
css: {
backgroundColor : "#F5F5F5",
position: "fixed",
zIndex: "9999",
left: "35vw",
top: "20vh",
border: "solid 2px #696969",
borderRadius: "20px",
padding: "10px",
textAlign: "center",
fontSize: "12px",
},
children: [manualBox()]
}))
function manualBox(){
const manualBox = createElement("div",{
children: [table(),selected(),buttons()]
})
function table(){
const table = createElement("table",{
css: {
borderSpacing: "1em 2px"
},
children:[
createElement("tr",{
children:[
createElement("td",{
children:[
createElement("label",{
attrs:{
id: "chro-mapcoder-manual-label",
for: "chro-mapcoder-manual-input"
},
props:{
innerText: "Group Name:"
}
})]
}),
createElement("td",{
children:[
createElement("input",{
attrs:{
id: "chro-mapcoder-manual-input",
type: "text",
size: "10"
}
})]
})]
}),
createElement("tr",{
children:[
createElement("td",{
children:[
createElement("label",{
attrs:{
id: "chro-mapcoder-manual-colour-label",
for: "chro-mapcoder-manual-colour-input"
},
props:{
innerText: "Colour:"
}
})]
}),
createElement("td",{
children: [
createElement("input",{
attrs:{
id:"chro-mapcoder-manual-colour-input",
type: "text",
size: "10"
}
})]
})]
})]
})
return table
}
function selected(){
const selected = createElement("div",{
attrs:{
id: "chro-mapcoder-selected-mice"
},
props:{
innerText: "Selected Mice:"
}
})
return selected
}
function buttons(){
const buttons = createElement("div",{
children:[
createElement("button",{
attrs:{
id:"chro-mapcoder-manual-confirm-btn"
},
props:{
innerText: "Confirm"
},
action:{
click(){add()}
}
}),
createElement("button",{
attrs:{
id: "chro-mapcoder-manual-cancel-btn"
},
props:{
innerText: "Cancel"
},
action:{
click(){close()}
}
})]
})
//Close function
function close(){
document.body.removeChild($("#chro-mapcode-pickstyle-div")[0]);
for (var i=0; i <allSpans.length; i++){
allSpans[i].removeEventListener("click",listen)
}
}
//Add mice to list function
function add(){
var groupName = $("#chro-mapcoder-manual-input")[0].value
var colour = $("#chro-mapcoder-manual-colour-input")[0].value
var addList = [];
var miceList = $("#chro-mapcoder-selected-mice")[0].children
for (var i=0;i<miceList.length;i++){
addList.push(miceList[i].innerText);
}
//Gettings styles from localStorage
const data = localStorage.getItem("Chro-mapcoder-styles")
if (data){var parsedData = JSON.parse(data)}
//Checking whether the blanks are filled
var map;
if (groupName && colour && addList.length > 0 && parsedData){
for (var j=0;j<parsedData.length;j++){
if ($(".treasureMapView-mapMenu-rewardName")[0].innerText == (parsedData[j][0])){
map = parsedData[j]
}
}
//If there is no existing map, add a new mao
if (map == undefined){
parsedData.push(applyThisStyle)
var last = parsedData.length-1
map = parsedData[last]
}
//Check whether there is same group name, if yes, delete
for (var k=0;k<map[1].length;k++){
if (map[1][k][0] == groupName){
map[1].splice(k,1)
}
}
//Adding the group to the map
map[1].push([groupName,colour,addList]);
localStorage.setItem("Chro-mapcoder-styles",JSON.stringify(parsedData))
//Resetting the boxes
$("#chro-mapcoder-manual-input")[0].value = "";
$("#chro-mapcoder-manual-colour-input")[0].value = "";
addList = [];
var target = $("#chro-mapcoder-selected-mice")[0]
while (target.firstChild){
target.removeChild(target.firstChild)
}
//for some it considers inner text as child node;
$("#chro-mapcoder-selected-mice")[0].innerText = "Selected Mice:";
//remove previous elements
document
.querySelectorAll("#mapcoder-master-div")
.forEach(el=> el.remove())
//colourise it again
applyThisStyle = map;
colourise();
}
}
return buttons
}
return manualBox
}
var allSpans = $(".treasureMapView-goals-group-goal")
var current = [];
for (var i=0; i <allSpans.length; i++){
//Remove event listener
allSpans[i].addEventListener("click",listen,false)
}
//Listening function, highlights
function listen(){
var mouseName = this.children[0].children[1].innerText;
var target = $("#chro-mapcoder-selected-mice")[0]
if (current.indexOf(mouseName)<0){
//Highlight background to become light blue
this.style.backgroundColor = "#00EEEE";
this.style.fontWeight = "bold"
current.push(mouseName);
target.appendChild(createElement("div",{
props:{
innerText: mouseName
}
}));
} else if (current.indexOf(mouseName)>=0){
this.style.backgroundColor = "white";
this.style.fontWeight = "";
var x = current.indexOf(mouseName);
current.splice(x,1);
if (target.children.length !== 0){
const {children} = target;
for (var j=0; j<children.length; j++){
if (children[j].innerText == mouseName){
target.removeChild(children[j])
}
}
}
}
}
}
return manualButton
}
//Add Manual Style Ends------------------------------------------------------
//Remove Manual Style Begins-------------------------------------------------
function removeManualStyle(){
const removeManualButton = createElement("button",{
attrs:{
id:"chro-mapcode-manual-remove-button"
},
props: {
innerText: "Remove Mice Group"
},
css: {
marginTop: "5px"
},
action:{
click(){removeGroup()}
}
})
//Remove whichever group
function removeGroup(){
//Stop button starts---------------------------------------------------
const stopButton = document.body.appendChild(createElement("div",{
attrs:{
id: "chro-mapcode-cancel-div1"
},
css: {
backgroundColor : "#F5F5F5",
position: "fixed",
zIndex: "9999",
left: "30vw",
top: "35vh",
border: "solid 2px #696969",
borderRadius: "20px",
padding: "10px",
textAlign: "center",
fontSize: "12px",
},
children:[
createElement("button",{
attrs:{
id: "chro-mapcode-remove-div"
},
props:{
innerText: "Stop Removing"
},
action:{
click(){stop()}
}
})]
}))
function stop(){
const masterDiv = $("#mapcoder-master-div")[0];
for (var i=0;i<masterDiv.children.length;i++){
masterDiv.children[i].removeEventListener("click",remove,false)
};
document.body.removeChild($("#chro-mapcode-cancel-div1")[0]);
}
//Listen to events
const masterDiv = $("#mapcoder-master-div")[0]
for (var i=0;i<masterDiv.children.length;i++){
masterDiv.children[i].addEventListener("click",remove,false);
masterDiv.children[i].style.cursor = "pointer"
}
function remove(){
var selected = this;
const removeBox = document.body.appendChild(createElement("div",{
attrs:{
id: "chro-mapcode-remove-div"
},
css: {
backgroundColor : "#F5F5F5",
position: "fixed",
zIndex: "9999",
left: "40vw",
top: "40vh",
border: "solid 2px #696969",
borderRadius: "20px",
padding: "10px",
textAlign: "center",
fontSize: "12px",
},
props:{
innerText: "Remove this group?"
},
children:[
createElement("div",{
attrs:{
id: "Chro-mapcode-remove-stop-div"
},
children:[
createElement("button",{
attrs:{
id: "Chro-mapcode-remove-confirm-button"
},
props:{
innerText: "Confirm"
},
action:{
click(){removeGroup1(selected);document.body.removeChild(removeBox)}
}
}),
createElement("button",{
attrs:{
id: "Chro-mapcode-remove-cancel-button"
},
props:{
innerText: "Cancel"
},
action:{
click(){document.body.removeChild(removeBox)}
}
})]
})]
}))
function removeGroup1(selected){
var groupName = selected.innerHTML.split("<br>")[0]
console.log(groupName);
//Gettings styles from localStorage
const data = localStorage.getItem("Chro-mapcoder-styles")
if (data){var parsedData = JSON.parse(data)}
for (var j=0;j<parsedData.length;j++){
if ($(".treasureMapView-mapMenu-rewardName")[0].innerText.includes(parsedData[j][0])){
var map = parsedData[j]
}
}
for (var k=0;k<map[1].length;k++){
if (map[1][k][0] == groupName){
map[1].splice(k,1)
}
}
//Restyle it
localStorage.setItem("Chro-mapcoder-styles",JSON.stringify(parsedData))
//remove previous elements
document
.querySelectorAll("#mapcoder-master-div")
.forEach(el=> el.remove());
//ReColour
applyThisStyle = map
colourise();
}
}
return masterDiv
}
return removeManualButton
}
//Remove button ends ----------------------------------------------------------------------
//Load preset button begins----------------------
function loadPresetStyle(){
const presetButton = createElement("button",{
attrs:{
id:"chro-mapcode-preset-button"
},
props: {
innerText: "Reset All Presets"
},
css: {
marginTop: "5px"
},
action:{
click(){loadPreset()}
}
})
return presetButton
}
dragElement(mainDiv,mainDiv);
}
function loadPreset(){
alert("Preset styles loaded, reload map to load styles");
localStorage.setItem("Chro-mapcoder-styles",JSON.stringify([
//Follow this style
["Queso Canyon Grand Tour Treasure Chest",[
["KSS","#6699CC",["Kalor'ignis of the Geyser","Stormsurge the Vile Tempest"]], //blue
["CinBrut","#99ff66",["Bruticus the Blazing","Cinderstorm"]], //green
["BE 3","#ff6666",["Ignatia","Smoldersnap","Bearded Elder"]], //red
["SizM","yellow",["Sizzle Pup","Mild Spicekin"]],
["Pressure","#cc99ff",["Pyrehyde","Steam Sailor","Vaporior","Warming Wyvern"]], //purple
["QR", "#00cc44",["Pump Raider","Tiny Saboteur","Croquet Crusher","Sleepy Merchant"]], //darker green
["Corky", "orange",["Fuzzy Drake","Rambunctious Rain Rumbler","Horned Cork Hoarder","Cork Defender","Burly Bruiser","Corky the Collector"]],
["PP", "#99ffff",["Old Spice Collector","Spice Farmer","Spice Sovereign","Spice Raider","Granny Spice","Spice Finder","Spice Seer","Spice Reaper"]], //cyan
["CQ", "pink",["Rubble Rouser","Rubble Rummager","Tiny Toppler","Ore Chipper","Chip Chiseler","Grampa Golem","Nachore Golem","Fiery Crusher",]],
["Boss", "silver",["Inferna, The Engulfed","Nachous, The Molten","Queen Quesada","Emberstone Scaled","Corkataur",]]
]],
["Sky Pirate Treasure Chest",[
["LP","#c97c49",["Skydiver","Skygreaser","Launchpad Labourer","Cloud Miner"]],
["Ward","#ffffff",["Warden of Rain","Warden of Wind","Warden of Frost","Warden of Fog"]],
["Phys","#59e031",["Ground Gavaleer","Sky Swordsman","Herc","Sky Squire","Paragon of Strength"]],
["Shadow","#8f75e2",["Paragon of Shadow","Astrological Astronomer","Overcaster","Stratocaster","Shadow Sage"]],
["Tact","#fff935",["Paragon of Tactics","Worried Wayfinder","Gyrologer","Seasoned Islandographer","Captain Cloudkicker"]],
["Arc","#0be496",["Paragon of Arcane","Sky Glass Sorcerer","Sky Glass Glazier","Sky Dancer","Sky Highborne"]],
["Forg","#338838",["Paragon of Forgotten","Spry Sky Explorer","Spry Sky Seer","Cumulost","Spheric Diviner"]],
["Hydro","#5d9fce",["Paragon of Water","Nimbomancer","Sky Surfer","Cute Cloud Conjurer","Mist Maker"]],
["Draco","#f06a60",["Paragon of Dragons","Tiny Dragonfly","Lancer Guard","Dragonbreather","Regal Spearman"]],
["Law","#f9a645",["Paragon of the Lawless","Devious Gentleman","Stack of Thieves","Lawbender","Agent M"]],
["Pirate","#ECA4A6",["Suave Pirate","Cutthroat Pirate","Cutthroat Cannoneer","Scarlet Revenger","Mairitime Pirate"]]
]],
["Empyrean Sky Palace Treasure Chest",[
["LP","#c97c49",["Skydiver","Skygreaser","Launchpad Labourer","Cloud Miner"]],
["Ward","#ffffff",["Warden of Rain","Warden of Wind","Warden of Frost","Warden of Fog"]],
["Phys","#59e031",["Ground Gavaleer","Sky Swordsman","Herc","Sky Squire","Paragon of Strength","Glamorous Gladiator"]],
["Shad","#8f75e2",["Paragon of Shadow","Astrological Astronomer","Overcaster","Stratocaster","Shadow Sage","Zealous Academic"]],
["Tact","#fff935",["Paragon of Tactics","Worried Wayfinder","Gyrologer","Seasoned Islandographer","Captain Cloudkicker","Rocketeer"]],
["Arc","#0be496",["Paragon of Arcane","Sky Glass Sorcerer","Sky Glass Glazier","Sky Dancer","Sky Highborne","Sky Glider"]],
["Forg","#338838",["Paragon of Forgotten","Spry Sky Explorer","Spry Sky Seer","Cumulost","Spheric Diviner","Forgotten Elder"]],
["Hyd","#5d9fce",["Paragon of Water","Nimbomancer","Sky Surfer","Cute Cloud Conjurer","Mist Maker","Cloud Strider"]],
["Drac","#f06a60",["Paragon of Dragons","Tiny Dragonfly","Lancer Guard","Dragonbreather","Regal Spearman","Empyrean Javelineer"]],
["Law","#f9a645",["Paragon of the Lawless","Devious Gentleman","Stack of Thieves","Lawbender","Agent M","Aristo-Cat Burglar"]],
["Pir","#ECA4A6",["Suave Pirate","Cutthroat Pirate","Cutthroat Cannoneer","Scarlet Revenger","Mairitime Pirate", "Admiral Cloudbeard"]],
["Rich","#E3E024",["Richard the Rich"]],
["SP","#7DDBDA",["Fortuitous Fool","Empyrean Appraiser","Empyrean Geologist","Consumed Charm Tinkerer","Empyrean Empress", "Peggy the Plunderer"]]
]],
["Halloween Treat Treasure Chest",[
["Standard","#fff935",["Grey Recluse","Cobweb","Teenage Vampire","Zombot Unipire","Candy Cat","Candy Goblin","Shortcut","Tricky Witch","Sugar Rush"]],
["Jack O","#f9a645",["Spirit Light","Gourdborg","Pumpkin Hoarder","Trick","Treat","Wild Chainsaw","Maize Harvester"]]
]],
["Halloween Trick Treasure Chest",[
["Bone","#bfbfbf",["Creepy Marionette","Dire Lycan","Grave Robber","Hollowhead","Mousataur Priestess","Sandmouse","Titanic Brain-Taker","Tomb Exhumer"]],
["Polter","#5d9fce",["Admiral Arrrgh","Captain Cannonball","Ghost Pirate Queen","Gourd Ghoul","Scorned Pirate","Spectral Butler","Spectral Swashbuckler"]],
["Scream","#5ae031",["Baba Gaga","Bonbon Gummy Globlin","Hollowed","Hollowed Minion","Swamp Thang"]]
]],
["Nice Treasure Chest",[
["Std","#fff935",["Hoarder","Gingerbread"]],
["SB","#f7f6f6",["Mouse of Winter Past","Mouse of Winter Present","Mouse of Winter Future","Scrooge"]],
["PP","#ba6900",["Builder","Snow Golem Jockey","Nice Knitting","Glacia Ice Fist","Borean Commander","Frigid Foreman","Great Winter Hunt Impostor","Naughty Nougat","Snow Golem Jockey","Snow Scavenger","Ridiculous Sweater","Stuck Snowball","Iceberg Sculptor","Shorts-All-Year","Great Giftnapper"]],
["Winter","#dedede",["Snowflake"]],
["LISC","#4882d1",["Snow Golem Architect"]]
]],
["Naughty Treasure Chest",[
["PP","#c97c49",["Builder","Snow Golem Jockey","Nice Knitting","Glacia Ice Fist","Borean Commander","Frigid Foreman","Great Winter Hunt Impostor","Naughty Nougat","Snow Golem Jockey","Snow Scavenger","Ridiculous Sweater","Stuck Snowball","Iceberg Sculptor","Shorts-All-Year","Great Giftnapper"]],
["Sports","#df74f7",["Sporty Ski Instructor","Young Prodigy Racer","Toboggan Technician","Free Skiing","Nitro Racer","Rainbow Racer","Double Black Diamond Racer","Black Diamond Racer"]],
["Toys","#f06a60",["Nutcracker","Toy","Slay Ride","Squeaker Claws","Destructoy","Toy Tinkerer","Mad Elf","Elf"]],
["Orna","#5ae031",["Christmas Tree","Stocking","Candy Cane","Ornament","Missile Toe","Wreath Thief","Ribbon","Snowglobe"]],
["Snow","#4fcaff",["Snow Fort","Snowball Hoarder","S.N.O.W. Golem","Snow Sorceress","Reinbo","Tundra Huntress","Snowblower","Snow Boulder"]],
["Firewks","#cd87ff",["Frightened Flying Fireworks","New Year's","Party Head"]],
["Glazy","#fcaf35",["Glazy","Joy"]],
["LISC","#4882d1",["Snow Golem Architect"]],
["Boss","#999999",["Ol' King Coal"]]
]],
["Birthday Treasure Chest",[
["Std","#ab846a",["Birthday","Buckethead","Present","Pintail","Dinosuit","Sleepwalker","Terrible Twos"]],
["SB","#e8e4e7",["Cheesy Party"]],
["Mixing","#1ec7b6",["Force Fighter Blue","Force Fighter Green","Force Fighter Pink","Force Fighter Red","Force Fighter Yellow","Super FighterBot MegaSupreme"]],
["Break","#e98eb5",["Breakdancer","Fete Fromager","Dance Party","El Flamenco","Para Para Dancer"]],
["Pump","#e3ac30",["Reality Restitch","Time Punk","Time Tailor","Time Thief","Space Party-Time Plumber"]],
["QA","#6c71c6",["Cupcake Candle Thief","Cupcake Cutie","Sprinkly Sweet Cupcake Cook","Cupcake Camo","Cupcake Runner"]],
["FRC","#a9edf9",["Factory Technician"]],
["Vince","#cd87ff",["Vincent, The Magnificent"]]
]],
["Fort Rox Treasure Chest",[
["Day","yellow",["Meteorite Snacker","Mining Materials Manager","Mischievous Meteorite Miner","Hardworking Hauler","Meteorite Miner","Meteorite Mover"]],
["Dawn","silver",["Dawn Guardian","Monster of the Meteor"]],
["Special","pink",["Nightmancer","Nightfire"]],
["Shadow","orange",["Night Shift Materials Manager","Werehauler","Wealthy Werewarrior","Mischievous Wereminer","Alpha Weremouse","Wereminer","Reveling Lycanthrope"]],
["Arcane","#6699CC",["Hypnotized Gunslinger","Arcane Summoner","Night Watcher","Cursed Taskmaster","Meteorite Golem","Meteorite Mystic"]] //blue
]],
]))
}
function createElement(tagName, config = {}){
const el = document.createElement(tagName);
if (config.attrs) Object.entries(config.attrs).forEach(([attr, val]) => el.setAttribute(attr, val));
if (config.props) Object.entries(config.props).forEach(([prop, val]) => el[prop] = val);
if (config.css) Object.entries(config.css).forEach(([prop, val]) => el.style[prop] = val);
if (config.children) config.children.forEach(child => el.append(child));
if (config.action) Object.entries(config.action).forEach(([prop,val]) => el.addEventListener(prop,()=>{val()}));
return el;
};
function dragElement(elmnt,dragEl) {
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
/*if (elmnt.firstElementChild) {
// if present, the header is where you move the DIV from:
elmnt.firstElementChild.onmousedown = dragMouseDown;
} else {*/
// otherwise, move the DIV from anywhere inside the DIV:
dragEl.onmousedown = dragMouseDown;
//}
function dragMouseDown(e) {
e = e || window.event;
e.preventDefault();
// get the mouse cursor position at startup:
pos3 = e.clientX;
pos4 = e.clientY;
document.onmouseup = closeDragElement;
// call a function whenever the cursor moves:
document.onmousemove = elementDrag;
}
function elementDrag(e) {
e = e || window.event;
e.preventDefault();
// calculate the new cursor position:
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
// set the element's new position:
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
}
function closeDragElement() {
// stop moving when mouse button is released:
document.onmouseup = null;
document.onmousemove = null;
}
}