-
Notifications
You must be signed in to change notification settings - Fork 2
/
mousehunt_hamy.js
14146 lines (13128 loc) · 683 KB
/
mousehunt_hamy.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
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
// ==UserScript==
// @name MouseHunt AutoBot UPDATED
// @author Nevocaine, Gawz, nobodyrandom, Ooi Keng Siang, CnN
// @version 1.3.5
// @description Script automating MH horn sounding and gifting, functional as of 23/09/2020. Updating the outdated script by nobodyrandom, who adapted the original versions by Ooi and CnN. Latest inputs courtesy of pokem and KyleLowryAintNoSpotupShooter.
// @icon https://raw.githubusercontent.com/nobodyrandom/mhAutobot/master/resource/mice.png
// @require https://code.jquery.com/jquery-2.2.2.min.js
// @require https://greasyfork.org/scripts/7601-parse-db-min/code/Parse%20DB%20min.js?version=132819
// @require https://greasyfork.org/scripts/16046-ocrad/code/OCRAD.js?version=100053
// @require https://greasyfork.org/scripts/16036-mh-auto-kr-solver/code/MH%20Auto%20KR%20Solver.js?version=102270
// @namespace https://greasyfork.org/en/users/440271
// @license GPL-3.0+; http://www.gnu.org/copyleft/gpl.html
// @include http://mousehuntgame.com/*
// @include https://mousehuntgame.com/*
// @include http://www.mousehuntgame.com/*
// @include https://www.mousehuntgame.com/*
// @include http://apps.facebook.com/mousehunt/*
// @include https://apps.facebook.com/mousehunt/*
// @include http://hi5.com/friend/games/MouseHunt*
// @include http://mousehunt.hi5.hitgrab.com/*
// @grant unsafeWindow
// @grant GM_info
// @run-at document-end
// ==/UserScript==
// == Basic User Preference Setting (Begin) ==
// // The variable in this section contain basic option will normally edit by most user to suit their own preference
// // Reload MouseHunt page manually if edit this script while running it for immediate effect.
// // ERROR CHECKING ONLY: Script debug
var debug = true;
// // ERROR CHECKING ONLY: KR debug
var debugKR = false;
// // Extra delay time before sounding the horn. (in seconds)
// // Default: 10 - 360
var hornTimeDelayMin = 10;
var hornTimeDelayMax = 15;
// // Bot aggressively by ignore all safety measure such as check horn image visible before sounding it. (true/false)
// // Note: Highly recommended to turn off because it increase the chances of getting caught in botting.
// // Note: It will ignore the hornTimeDelayMin and hornTimeDelayMax.
// // Note: It may take a little bit extra of CPU processing power.
var aggressiveMode = false;
// // Enable trap check once an hour. (true/false)
var enableTrapCheck = true;
// // Trap check time different value (00 minutes - 45 minutes)
// // Note: Every player had different trap check time, set your trap check time here. It only take effect if enableTrapCheck = true;
// // Example: If you have XX:00 trap check time then set 00. If you have XX:45 trap check time, then set 45.
var trapCheckTimeDiff = 30;
// // Extra delay time to trap check. (in seconds)
// // Note: It only take effect if enableTrapCheck = true;
var checkTimeDelayMin = 15;
var checkTimeDelayMax = 15;
// // Play sound when encounter king's reward (true/false)
var isKingWarningSound = false;
// // Which sound to play when encountering king's reward (need to be .mp3)
var kingWarningSound = 'https://raw.githubusercontent.com/nobodyrandom/libs/master/resource/horn.mp3';
// // Which email to send KR notiff to (leave blank to disable feature)
var kingRewardEmail = '';
// // Which number to send SMS to
var kingRewardPhone = '';
// // Verification code sent to this number
var kingRewardPhoneVerify = '';
// // Play sound when no more cheese (true/false)
var isNoCheeseSound = false;
// // Reload the the page according to kingPauseTimeMax when encountering King Reward. (true/false)
// // Note: No matter how many time you refresh, the King's Reward won't go away unless you resolve it manually.
var reloadKingReward = false;
// // Duration of pausing the script before reload the King's Reward page (in seconds)
// // Note: It only take effect if reloadKingReward = true;
var kingPauseTimeMax = 18000;
// // Auto solve KR
var isAutoSolve = true;
// // Extra delay time before solving KR. (in seconds)
// // Default: 10 - 30
var krDelayMin = 10;
var krDelayMax = 15;
// // Time to start and stop solving KR. (in hours, 24-hour format)
// // Example: Script would not auto solve KR between 00:00 - 6:00 when krStopHour = 0 & krStartHour = 6;
// // To disable this feature, set both to the same value.
var krStopHour = 3;
var krStartHour = 3;
// // Extra delay time to start solving KR after krStartHour. (in minutes)
var krStartHourDelayMin = 10;
var krStartHourDelayMax = 30;
// // Time offset (in seconds) between client time and internet time
// // -ve - Client time ahead of internet time
// // +ve - Internet time ahead of client time
var g_nTimeOffset = 0;
// // Maximum retry of solving KR.
// // If KR solved more than this number, pls solve KR manually ASAP in order to prevent MH from caught in botting
var kingsRewardRetryMax = 3;
// // State to indicate whether to save KR image into localStorage or not
var saveKRImage = true;
// // Maximum number of KR image to be saved into localStorage
var maxSaveKRImage = 75;
// // The script will pause if player at different location that hunt location set before. (true/false)
// // Note: Make sure you set showTimerInPage to true in order to know what is happening.
var pauseAtInvalidLocation = false;
// // Time to wait after trap selector clicked (in second)
var secWait = 7;
// // Stop trap arming after X retry
var armTrapRetry = 3;
// // Maximum number of log to be saved into sessionStorage
var maxSaveLog = 750;
// // Popup on KR or not, the script will throw out an alert box if true.
var autoPopupKR = false;
// == Basic User Preference Setting (End) ==
// == Advance User Preference Setting (Begin) ==
// // The variable in this section contain some advance option that will change the script behavior.
// // Edit this variable only if you know what you are doing
// // Reload MouseHunt page manually if edit this script while running it for immediate effect.
// // Display timer and message in page title. (true/false)
var showTimerInTitle = true;
// // Embed a timer in page to show next hunter horn timer, highly recommended to turn on. (true/false)
// // Note: You may not access some option like pause at invalid location if you turn this off.
var showTimerInPage = true;
// // Display the last time the page did a refresh or reload. (true/false)
var showLastPageLoadTime = true;
// // Default time to reload the page when bot encounter error. (in seconds)
var errorReloadTime = 60;
// // Time interval for script timer to update the time. May affect timer accuracy if set too high value. (in seconds)
var timerRefreshInterval = 1;
// // Trap arming status
var LOADING = -1;
var NOT_FOUND = 0;
var ARMED = 1;
// // Trap List
var objTrapList = {
weapon: [],
base: [],
trinket: [],
bait: []
};
// // Trap Collection
var objTrapCollection = {
weapon: ["Chrome Celestial Dissonance", "Chrome Temporal Turbine", "Chrome Grand Arcanum ", "Rocket Propelled Gavel", "Timesplit Dissonance Weapon", "Meteor Prison Core", "Christmas Cactus", "Sprinkly Cupcake Surprise", "New Horizon", "New Year's Fireworks", "Holiday Hydro Hailstone", "Festive Forgotten Fir", "Interdimensional Crossbow", "Droid Archmagus", "Sandcastle Shard", "Crystal Mineral Crusher", "Biomolecular Re-atomizer", "Chrome Arcane Capturing Rod", "Law Laser", "Zugzwang's Ultimate Move", "2010 Blastoff", "2012 Big Boom", "500 Pound Spiked Crusher", "Ambrosial Portal", "Ambush", "Ancient Box", "Ancient Gauntlet", "Ancient Spear Gun", "Arcane Blast", "Arcane Capturing Rod Of Never Yielding Mystery", "Bandit Deflector", "Birthday Candle Kaboom", "Birthday Party Piñata Bonanza", "Blackstone Pass", "Bottomless Grave", "Brain Extractor", "Bubbles: The Party Crasher", "Cackle Lantern", "Candy Crusher", "Chesla's Revenge", "Christmas Cracker", "Chrome DeathBot", "Chrome DrillBot", "Chrome MonstroBot", "Chrome Nannybot", "Chrome Oasis Water Node", "Chrome Onyx Mallet", "Chrome Phantasmic Oasis", "Chrome RhinoBot", "Chrome Sphynx Wrath", "Chrome Tacky Glue", "Clockapult of Time", "Clockapult of Winter Past", "Clockwork Portal", "Crystal Crucible", "Crystal Tower", "Digby DrillBot", "Dimensional Chest", "Double Diamond Adventure", "Dragon Lance", "Dreaded Totem ", "Endless Labyrinth", "Engine Doubler", "Enraged RhinoBot", "Event Horizon", "Explosive Toboggan Ride", "Festive Gauntlet Crusher", "Fluffy DeathBot", "Focused Crystal Laser", "The Forgotten Art of Dance", "Forgotten Pressure Plate ", "Giant Speaker", "Gingerbread House Surprise", "Glacier Gatler", "Gorgon", "Grand Arcanum", "Grungy DeathBot", "Harpoon Gun", "Heat Bath", "High Tension Spring", "HitGrab Horsey", "HitGrab Rainbow Rockin' Horse", "HitGrab Rockin' Horse", "Horrific Venus Mouse", "Ice Blaster", "Ice Maiden", "Icy RhinoBot", "Infinite Labyrinth", "Isle Idol ", "Isle Idol", "Isle Idol ", "Kraken Chaos", "The Law Draw", "Maniacal Brain Extractor", "Mouse DeathBot", "Mouse Hot Tub", "Mouse Mary O'Nette", "Mouse Rocketine", "Mouse Trebuchet", "Multi-Crystal Laser", "Christmas Crystalabra", "Mutated Venus Mouse", "Mysteriously unYielding Null-Onyx Rampart of Cascading Amperes", "Mystic Pawn Pincher", "Nannybot", "Net Cannon", "Ninja Ambush", "Nutcracker Nuisance", "NVMRC Forcefield", "Oasis Water Node", "Obelisk of Incineration", "Obelisk of Slumber", "Obvious Ambush", "Onyx Mallet", "PartyBot", "Phantasmic Oasis", "Pneumatic Tube ", "Pumpkin Pummeler", "Reaper's Perch", "Rewers Riposte", "RhinoBot", "Rune Shark", "S.A.M. F.E.D. DN-5", "S.L.A.C.", "S.L.A.C. II", "S.U.P.E.R. Scum Scrubber", "Sandstorm MonstroBot", "Sandtail Sentinel", "School of Sharks", "Scum Scrubber", "Shrink Ray ", "Sinister Portal", "Snow Barrage", "Snowglobe", "Soul Catcher", "Soul Harvester", "Sphynx Wrath", "Stale Cupcake Golem", "Steam Laser Mk. I", "Steam Laser Mk. II", "Steam Laser Mk. II (Broken!)", "Steam Laser Mk. III", "Supply Grabber", "Swiss Army Mouse", "Tacky Glue ", "Tarannosaurus Rex", "Technic Pawn Pincher", "Temporal Turbine", "Terrifying Spider", "Thorned Venus Mouse", "Ultra MegaMouser MechaBot", "Veiled Vine", "Venus Mouse", "Warden Slayer", "Warpath Thrasher", "Wrapped Gift", "Zugzwang's First Move", "Zugzwang's Last Move", "Zurreal's Folly"],
base: ["Signature Series Denture Base", "Prestige Base", "Ancient Booster Base", "Ultimate Iceberg Base", "Clockwork Base", "Sprinkly Sweet Cupcake Birthday Base", "Dog Jade Base", "Rooster Jade Base", "2017 New Year's Base", "Aqua Base", "Attuned Enerchi Induction Base", "Bacon Base", "Bamboozler Base", "Birthday Cake Base", "Birthday Dragée Cake Base", "Bronze Tournament Base", "Candy Cane Base", "Carrot Birthday Cake Base", "Cheesecake Base", "Chocolate Birthday Cake Base", "Claw Shot Base", "Crushed Birthday Cake Base", "Cupcake Birthday Base", "Deep Freeze Base", "Dehydration Base", "Depth Charge Base", "Dragon Jade Base", "Eerie Base", "Eerier Base", "Enerchi Induction Base", "Explosive Base", "Extra Sweet Cupcake Birthday Base", "Fan Base", "Firecracker Base", "Fissure Base", "Fracture Base", "Gingerbread Base", "Golden Tournament Base", "Hearthstone Base", "Horse Jade Base", "Hothouse Base", "Jade Base", "Labyrinth Base", "Living Base", "Magma Base", "Magnet Base", "Minotaur Base", "Molten Shrapnel Base", "Monkey Jade Base", "Monolith Base", "Papyrus Base", "Physical Brace Base", "Polar Base", "Polluted Base", "Refined Pollutinum Base", "Remote Detonator Base", "Rift Base", "Runic Base", "Seasonal Base", "Sheep Jade Base", "Silver Tournament Base", "Skello-ton Base", "Snake Jade Base", "Soiled Base", "Spellbook Base", "Spiked Base", "Stone Base", "Tidal Base", "Tiki Base", "Tribal Base", "Tribal Kaboom Base", "Washboard Base", "Wooden Base", "Wooden Base with Target"],
bait: ["Magical Rancid Radioactive Blue Cheese", "Undead String Emmental", "Ancient String Cheese", "Runic String Cheese", "Sunrise Cheese", "Dumpling Cheese", "Crescent Cheese", "Ancient Cheese", "Arctic Asiago Cheese", "Ascended Cheese", "Brie Cheese", "Brie String Cheese", "Candy Corn Cheese", "Checkmate Cheese", "Cheddar Cheese", "Cherry Cheese", "Combat Cheese", "Creamy Havarti Cheese", "Crunchy Cheese", "Crunchy Havarti Cheese", "Cupcake Colby", "Dewthief Camembert", "Diamond Cheese", "Duskshade Camembert", "Extra Sweet Cupcake Colby", "Festive Feta", "Fishy Fromage", "Fusion Fondue", "Galleon Gouda", "Gauntlet Cheese Tier 2", "Gauntlet Cheese Tier 3", "Gauntlet Cheese Tier 4", "Gauntlet Cheese Tier 5", "Gauntlet Cheese Tier 6", "Gauntlet Cheese Tier 7", "Gauntlet Cheese Tier 8", "Gemstone Cheese", "Ghoulgonzola Cheese", "Gilded Cheese", "Gingerbread Cheese", "Glowing Gruyere Cheese", "Glutter Cheese", "Gnarled Cheese", "Gouda Cheese", "Graveblossom Camembert", "Grilled Cheese", "Gumbo Cheese", "Inferno Havarti Cheese", "Lactrodectus Lancashire Cheese", "Limelight Cheese", "Lunaria Camembert", "Magical Havarti Cheese", "Magical String Cheese", "Maki Cheese", "Maki String Cheese", "Marble Cheese", "Marble String Cheese", "Marshmallow Monterey", "Master Fusion Cheese", "Mineral Cheese", "Moon Cheese", "Mozzarella Cheese", "Null Onyx Gorgonzola", "Nutmeg Cheese", "Onyx Gorgonzola", "Polluted Parmesan Cheese", "Pungent Havarti Cheese", "Radioactive Blue Cheese", "Rancid Radioactive Blue Cheese", "Rift Combat Cheese", "Rift Glutter Cheese", "Rift Rumble Cheese", "Rift Susheese Cheese", "Riftiago Cheese", "Resonator Cheese", "Rockforth Cheese", "Rumble Cheese", "Runic Cheese", "Runny Cheese", "Seasoned Gouda", "Shell Cheese", "Snowball Bocconcini", "Spicy Havarti Cheese", "SUPER|brie+", "Susheese Cheese", "Sweet Havarti Cheese", "Swiss Cheese", "Swiss String Cheese", "Terre Ricotta Cheese", "Toxic Brie", "Toxic SUPER|brie+", "Undead Emmental", "Vanilla Stilton Cheese", "Vengeful Vanilla Stilton Cheese", "White Cheddar Cheese", "Wicked Gnarly Cheese"],
trinket: ["Rift Airship Charm", "Ultimate Wealth Charm", "Super Enerchi Charm", "Rift Charm", "Nightlight Charm", "Rift Wealth Charm", "Rift Extreme Luck Charm", "Rift Luck Charm", "Rift Super Luck Charm", "Rift Antiskele Charm", "Realm Ripper Charm", "Timesplit Charm", "Lucky Valentine Charm", "Festive Anchor Charm", "2014 Charm", "2015 Charm", "2016 Charm", "2017 Charm", "Airship Charm", "Amplifier Charm", "Ancient Charm", "Antiskele Charm", "Artisan Charm", "Athlete Charm", "Attraction Charm", "Baitkeep Charm", "Black Powder Charm", "Blue Double Sponge Charm", "Brain Charm", "Bravery Charm", "Cackle Charm", "Cactus Charm", "Candy Charm", "Champion Charm", "Cherry Charm", "Chrome Charm", "Clarity Charm", "Compass Magnet Charm", "Crucible Cloning Charm", "Cupcake Charm", "Dark Chocolate Charm", "Derr Power Charm", "Diamond Boost Charm", "Door Guard Charm", "Dragonbane Charm", "Dragonbreath Charm", "Dreaded Charm", "Dusty Coal Charm", "Eggscavator Charge Charm", "Eggstra Charge Charm", "Eggstra Charm", "Elub Power Charm", "EMP400 Charm", "Empowered Anchor Charm", "Enerchi Charm", "Extra Spooky Charm", "Extra Sweet Cupcake Charm", "Extreme Ancient Charm", "Extreme Attraction Charm", "Extreme Luck Charm", "Extreme Polluted Charm", "Extreme Power Charm", "Extreme Wealth Charm", "Festive Ultimate Luck Charm", "Festive Ultimate Power Charm", "Firecracker Charm", "First Ever Charm", "Flamebane Charm", "Forgotten Charm", "Freshness Charm", "Gargantua Guarantee Charm", "Gemstone Boost Charm", "Gilded Charm", "Glowing Gourd Charm", "Gnarled Charm", "Golden Anchor Charm", "Greasy Glob Charm", "Growth Charm", "Grub Salt Charm", "Grub Scent Charm", "Grubling Bonanza Charm", "Grubling Chow Charm", "Haunted Ultimate Luck Charm", "Horsepower Charm", "Hydro Charm", "Lantern Oil Charm", "Luck Charm", "Lucky Power Charm", "Lucky Rabbit Charm", "Magmatic Crystal Charm", "Mining Charm", "Mobile Charm", "Monger Charm", "Monkey Fling Charm", "Nanny Charm", "Nerg Power Charm", "Nightshade Farming Charm", "Nitropop Charm", "Oxygen Burst Charm", "Party Charm", "Polluted Charm", "Power Charm", "Prospector's Charm", "Rainbow Luck Charm", "Ramming Speed Charm", "Red Double Sponge Charm", "Red Sponge Charm", "Regal Charm", "Rift Power Charm", "Rift Ultimate Luck Charm", "Rift Ultimate Lucky Power Charm", "Rift Ultimate Power Charm", "Rift Vacuum Charm", "Roof Rack Charm", "Rook Crumble Charm", "Rotten Charm", "Safeguard Charm", "Scholar Charm", "Scientist's Charm", "Searcher Charm", "Shadow Charm", "Shamrock Charm", "Shattering Charm", "Sheriff's Badge Charm", "Shielding Charm", "Shine Charm", "Shortcut Charm", "Smart Water Jet Charm", "Snakebite Charm", "Snowball Charm", "Soap Charm", "Softserve Charm", "Spellbook Charm", "Spiked Anchor Charm", "Sponge Charm", "Spooky Charm", "Spore Charm", "Stagnant Charm", "Sticky Charm", "Striker Charm", "Super Ancient Charm", "Super Attraction Charm", "Super Brain Charm", "Super Cactus Charm", "Super Luck Charm", "Super Nightshade Farming Charm", "Super Polluted Charm", "Super Power Charm", "Super Regal Charm", "Super Rift Vacuum Charm", "Super Rotten Charm", "Super Salt Charm", "Super Soap Charm", "Super Spore Charm", "Super Warpath Archer Charm", "Super Warpath Cavalry Charm", "Super Warpath Commander's Charm", "Super Warpath Mage Charm", "Super Warpath Scout Charm", "Super Warpath Warrior Charm", "Super Wealth Charm", "Supply Schedule Charm", "Tarnished Charm", "Taunting Charm", "Treasure Trawling Charm", "Ultimate Anchor Charm", "Ultimate Ancient Charm", "Ultimate Attraction Charm", "Ultimate Charm", "Ultimate Luck Charm", "Ultimate Lucky Power Charm", "Ultimate Polluted Charm", "Ultimate Power Charm", "Ultimate Spore Charm", "Uncharged Scholar Charm", "Unstable Charm", "Valentine Charm", "Warpath Archer Charm", "Warpath Cavalry Charm", "Warpath Commander's Charm", "Warpath Mage Charm", "Warpath Scout Charm", "Warpath Warrior Charm", "Water Jet Charm", "Wax Charm", "Wealth Charm", "Wild Growth Charm", "Winter Builder Charm", "Winter Charm", "Winter Hoarder Charm", "Winter Miser Charm", "Winter Screw Charm", "Winter Spring Charm", "Winter Wood Charm", "Yellow Double Sponge Charm", "Yellow Sponge Charm"]
};
// // Best weapon/base/charm/bait pre-determined by user. Edit ur best weapon/base/charm/bait in ascending order. e.g. [best, better, good]
var objBestTrap = {
weapon: {
arcane: ['New Horizon', 'Infinite Winter Horizon', 'Event Horizon', 'Anniversary Arcane Capturing Rod Of Never Yielding Mystery', 'Chrome Grand Arcanum', 'Grand Arcanum', 'Chrome Arcane Capturing Rod Of Never Yielding Mystery', 'Droid Archmagus', 'Arcane Blast', 'Arcane Capturing Rod Of Never Yielding Mystery', 'Nutcracker Nuisance', 'Sprinkly Cupcake Surprise', 'Obelisk of Incineration', 'Obelisk of Slumber'],
draconic: ['Dragon Slayer Cannon', 'Chrome Storm Wrought Ballista', 'Storm Wrought Ballista', 'Dragonvine Ballista', 'Harrowing Holiday Harpoon Harp', 'Blazing Ember Spear', 'Dragon Lance', 'Cemetery Gate Grappler', 'Ice Maiden'],
forgotten: ['Infinite Labyrinth', 'Endless Labyrinth', 'Crystal Mineral Crusher', 'Crystal Crucible', 'Festive Forgotten Fir', 'Stale Cupcake Golem', 'Scarlet Ember Root', 'Tarannosaurus Rex', 'Father Winter\'s Timepiece', 'The Forgotten Art of Dance', 'Anniversary Ancient Box', 'Ancient Box ', 'Forgotten Pressure Plate'],
hydro: ['School of Sharks', 'Chrome Phantasmic Oasis', 'Rune Shark', 'Phantasmic Oasis', 'Queso Fount', 'Chrome Oasis Water Node', 'Paradise Falls', 'Oasis Water Node', 'Glacier Gatler', 'Holiday Hydro Hailstone', 'Steam Laser Mk. III', 'Steam Laser Mk. II', 'Double Diamond Adventure', 'Kraken Chaos', 'Explosive Toboggan Ride', 'S.U.P.E.R. Scum Scrubber', 'Steam Laser Mk. I', 'Heat Bath', 'Scum Scrubber', 'Ice Blaster', 'Ancient Spear Gun', 'Haunted Shipwreck', 'Bubbles The Party Crasher', 'Net Cannon', 'Harpoon Gun'],
law: ['Ember Prison Core', 'Meteor Prison Core', 'Judge Droid', 'The Law Draw', 'Surprise Party', 'Christmas Cactus', 'Law Laser', 'Engine Doubler', 'Bandit Deflector', 'Supply Grabber', 'S.L.A.C. II', 'S.L.A.C.'],
physical: ['Chrome MonstroBot', 'Sandstorm MonstroBot', 'Smoldering Stone Sentinel', 'Chrome RhinoBot', 'Sandtail Sentinel', 'New Year\'s Fireworks', 'Rocket Propelled Gavel', 'Warden Slayer', 'Enraged RhinoBot', 'Chrome Onyx Mallet', 'Icy RhinoBot', 'RhinoBot', 'Warpath Thrasher', 'Chrome DrillBot', 'Onyx Mallet', 'Digby DrillBot', 'Christmas Cracker', 'PartyBot', 'Chrome DeathBot', 'Birthday Party Piñata Bonanza', 'Anniversary DeathBot', 'Birthday Candle Kaboom', 'Fluffy DeathBot', 'Grungy DeathBot', 'Mouse DeathBot', 'Snowglobe', 'NVMRC Forcefield', 'Pneumatic Tube', 'Ultra MegaMouser MechaBot', 'HitGrab Rainbow Rockin Horse', 'HitGrab Rockin Horse', 'Swiss Army Mouse', 'Festive Gauntlet Crusher', 'Wrapped Gift', 'Ancient Gauntlet', 'Shrink Ray', 'Mouse Rocketine', 'Mouse Trebuchet', 'HitGrab Horsey', 'Mouse Mary O\'Nette', '500 Pound Spiked Crusher', 'High Tension Spring', 'Chrome Tacky Glue', 'Mouse Hot Tub', 'Tacky Glue'],
rift: ['Chrome Celestial Dissonance', 'Celestial Dissonance', 'Timesplit Dissonance', 'Mysteriously unYielding Null-Onyx Rampart of Cascading Amperes', 'Christmas Crystalabra', 'Wacky Inflatable Party People', 'Rift Glacier Gatler', 'Multi-Crystal Laser', 'Biomolecular Re-atomizer', 'Focused Crystal Laser', 'Crystal Tower'],
shadow: ['Chrome Temporal Turbine', 'Temporal Turbine', 'Anniversary Reaper\'s Perch', 'Goldfrost Crossbow', 'Clockwork Portal', 'Interdimensional Crossbow', 'Reaper\'s Perch', 'Moonbeam Barrier', 'Admiral\'s Galleon', 'Candy Crusher', 'Maniacal Brain Extractor', 'Terrifying Spider', 'Sandcastle Shard', 'Soul Harvester', 'Cackle Lantern', 'Dreaded Totem', 'Clockapult of Winter Past', 'Clockapult of Time', 'Gorgon ', 'Creepy Coffin', 'Brain Extractor', 'Chrome Nannybot', 'Soul Catcher', 'Bottomless Grave', 'Pumpkin Pummeler', 'Ambrosial Portal', 'Sinister Portal'],
tactical: ['Chrome Sphynx Wrath', 'Gouging Geyserite', 'Sphynx Wrath', 'Anniversary Ambush', 'Dimensional Chest', 'Rewers Riposte', '2010 Blastoff ', '2012 Big Boom ', 'Well of Wisdom', 'Snow Barrage', 'Giant Speaker', 'Zugzwang\'s Ultimate Move', 'Veiled Vine', 'Chesla\'s Revenge', 'Zugzwang\'s First Move', 'Horrific Venus Mouse', 'S.A.M. F.E.D. DN-5', 'Thorned Venus Mouse', 'Obvious Ambush', 'Blackstone Pass', 'Ninja Ambush', 'Ambush', 'Zurreal\'s Folly', 'Mutated Venus Mouse', 'Gingerbread House Surprise', 'Zugzwang\'s Last Move', 'Venus Mouse', 'Mystic Pawn Pincher', 'Technic Pawn Pincher'],
},
base: {
luck: ['Signature Series Denture Base', 'Prestige Base', 'Minotaur Base', 'Clockwork Base', 'Overgrown Ember Stone Base', 'Fissure Base', 'Birthday Banana Cake Base', 'Rift Base', 'Treasure Seeker Base', 'Desert Seeker Base', '2020 New Year\'s Base', 'Hallowed Ground Base', 'Glowing Guardian Base', 'Deadwood Plank Base', 'Attuned Enerchi Induction Base', 'Depth Charge Base', 'Rat Jade Base', 'Pig Jade Base', 'Dog Jade Base', 'Rooster Jade Base', 'Monkey Jade Base', 'Sheep Jade Base', 'Horse Jade Base', 'Snake Jade Base', 'Dragon Jade Base', 'Eerier Base', 'Papyrus Base'],
power: ['Signature Series Denture Base', 'Prestige Base', 'Minotaur Base', 'Clockwork Base', 'Tidal Base', 'Golden Tournament Base', 'Spellbook Base']
}
};
// // Fiery Warpath Preference
var commanderCharm = ['Super Warpath Commander\'s', 'Warpath Commander\'s'];
var objPopulation = {
WARRIOR: 0,
SCOUT: 1,
ARCHER: 2,
CAVALRY: 3,
MAGE: 4,
ARTILLERY: 5,
name: ['Warrior', 'Scout', 'Archer', 'Cavalry', 'Mage', 'Artillery']
};
var g_arrFWSupportRetreat = [0, 10, 18, 26];
var g_fwStreakLength = 15;
var objDefaultFW = {
weapon: 'Sandtail Sentinel',
base: 'Physical Brace',
focusType: 'NORMAL',
priorities: 'HIGHEST',
cheese: new Array(g_fwStreakLength).fill('Gouda'),
charmType: new Array(g_fwStreakLength).fill('Warpath'),
special: new Array(g_fwStreakLength).fill('None'),
lastSoldierConfig: 'CONFIG_GOUDA',
includeArtillery: true,
disarmAfterSupportRetreat: false,
warden: {
before: {
weapon: '',
base: '',
trinket: '',
bait: ''
},
after: {
weapon: '',
base: '',
trinket: '',
bait: ''
}
}
};
// // Living Garden Preference
var bestLGBase = ['Living Base', 'Hothouse Base'];
var bestSalt = ['Super Salt', 'Grub Salt'];
var bestAnchor = ['Golden Anchor', 'Spiked Anchor', 'Empowered Anchor'];
var bestOxygen = ['Oxygen Burst', 'Empowered Anchor'];
var wasteCharm = ['Tarnished', 'Unstable', 'Wealth'];
var redSpongeCharm = ['Red Double', 'Red Sponge'];
var yellowSpongeCharm = ['Yellow Double', 'Yellow Sponge'];
var spongeCharm = ['Double Sponge', 'Sponge'];
// GES Preferences
var supplyDepotTrap = ['Meteor Prison Core Trap', 'Supply Grabber', 'S.L.A.C. II', 'The Law Draw', 'S.L.A.C.'];
var raiderRiverTrap = ['Meteor Prison Core Trap', 'Bandit Deflector', 'S.L.A.C. II', 'The Law Draw', 'S.L.A.C.'];
var daredevilCanyonTrap = ['Meteor Prison Core Trap', 'Engine Doubler', 'S.L.A.C. II', 'The Law Draw', 'S.L.A.C.'];
var coalCharm = ['Magmatic Crystal', 'Black Powder', 'Dusty Coal'];
//var chargeCharm = ['Eggstra Charge', 'Eggscavator'];
var scOxyBait = ['Fishy Fromage', 'Gouda'];
// // Sunken City Preference
// // DON'T edit this variable if you don't know what are you editing
var objSCZone = {
ZONE_NOT_DIVE: 0,
ZONE_DEFAULT: 1,
ZONE_CORAL: 2,
ZONE_SCALE: 3,
ZONE_BARNACLE: 4,
ZONE_TREASURE: 5,
ZONE_DANGER: 6,
ZONE_DANGER_PP: 7,
ZONE_OXYGEN: 8,
ZONE_BONUS: 9,
ZONE_DANGER_PP_LOTA: 10
};
var bestSCBase = ['Minotaur Base', 'Fissure Base', 'Depth Charge Base'];
// // Spring Egg Hunt
var chargeCharm = ['Eggstra Charge', 'Eggscavator'];
var chargeHigh = 17;
var chargeMedium = 12;
// // Labyrinth
var bestLabyBase = ['Minotaur Base', 'Labyrinth Base'];
var objCodename = {
FEALTY: "y",
TECH: "h",
SCHOLAR: "s",
TREASURY: "t",
FARMING: "f",
PLAIN: "p",
SUPERIOR: "s",
EPIC: "e",
SHORT: "s",
MEDIUM: "m",
LONG: "l"
};
var arrHallwayOrder = [
'sp', 'mp', 'lp',
'ss', 'ms', 'ls',
'se', 'me', 'le'];
var objDefaultLaby = {
districtFocus: 'None',
between0and14: ['lp'],
between15and59: ['sp', 'ls'],
between60and100: ['sp', 'ss', 'le'],
chooseOtherDoors: false,
typeOtherDoors: "SHORTEST_FEWEST",
securityDisarm: false,
lastHunt: 0,
armOtherBase: 'false',
disarmCompass: true,
nDeadEndClue: 0,
weaponFarming: 'Forgotten'
};
var objLength = {
SHORT: 0,
MEDIUM: 1,
LONG: 2
};
// // Furoma Rift
var objFRBattery = {
level: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
name: ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"],
capacity: [20, 45, 75, 120, 200, 310, 450, 615, 790, 975],
cumulative: [20, 65, 140, 260, 460, 770, 1220, 1835, 2625, 3600]
};
var g_arrHeirloom = []; // to be refresh once page reload
var g_objConstTrap = {
bait: {
ANY_HALLOWEEN: {
sort: 'any',
name: ['Ghoulgonzola', 'Candy Corn']
},
ANY_MASTER: {
sort: 'any',
name: ['Rift Glutter', 'Rift Combat', 'Rift Susheese']
},
ANY_LUNAR: {
sort: 'any',
name: ['Moon Cheese', 'Crescent Cheese']
},
ANY_FESTIVE_BRIE: {
sort: 'best',
name: ['Arctic Asiago', 'Nutmeg', 'Snowball Bocconcini', 'Festive Feta', 'Gingerbread', 'Brie Cheese']
},
ANY_FESTIVE_GOUDA: {
sort: 'best',
name: ['Arctic Asiago', 'Nutmeg', 'Snowball Bocconcini', 'Festive Feta', 'Gingerbread', 'Gouda']
},
ANY_FESTIVE_SB: {
sort: 'best',
name: ['Arctic Asiago', 'Nutmeg', 'Snowball Bocconcini', 'Festive Feta', 'Gingerbread', 'SUPER']
}
},
trinket: {
GAC_EAC: {
sort: 'best',
name: ['Golden Anchor', 'Empowered Anchor']
},
SAC_EAC: {
sort: 'best',
name: ['Spiked Anchor', 'Empowered Anchor']
},
UAC_EAC: {
sort: 'best',
name: ['Ultimate Anchor', 'Empowered Anchor']
},
'ANCHOR_FAC/EAC': {
sort: 'best',
name: ['Festive Anchor Charm', 'Empowered Anchor Charm']
}
}
};
// // Addon code (default: empty string)
var addonCode = "";
// == Advance User Preference Setting (End) ==
// WARNING - Do not modify the code below unless you know how to read and write the script.
// All global variable declaration and default value
var g_strHTTP = 'https';
var g_strVersion = scriptVersion = GM_info.script.version;
var g_strScriptHandler = "";
var fbPlatform = false;
var hiFivePlatform = false;
var mhPlatform = false;
var mhMobilePlatform = false;
var secureConnection = false;
var lastDateRecorded = new Date();
var hornTime = 900;
var hornTimeDelay = 0;
var checkTimeDelay = 0;
var isKingReward = false;
var lastKingRewardSumTime;
var baitQuantity = -1;
var huntLocation;
var currentLocation;
var today = new Date();
var checkTime = (today.getMinutes() >= trapCheckTimeDiff) ? 3600 + (trapCheckTimeDiff * 60) - (today.getMinutes() * 60 + today.getSeconds()) : (trapCheckTimeDiff * 60) - (today.getMinutes() * 60 + today.getSeconds());
today = undefined;
var hornRetryMax = 10;
var hornRetry = 0;
var nextActiveTime = 900;
var timerInterval = 2;
var checkMouseResult = null;
var armingQueue = [];
var dequeueingCTA = false;
var dequeueIntRunning = false;
var mouseList = [];
var eventLocation = "None";
var discharge = false;
var arming = false;
var g_arrArmingList = [];
var kingsRewardRetry = 0;
var keyKR = [];
var separator = "~";
// element in page
var titleElement;
var nextHornTimeElement;
var checkTimeElement;
var kingTimeElement;
var lastKingRewardSumTimeElement;
var optionElement;
var travelElement;
var hornButton = 'hornbutton';
var campButton = 'campbutton';
var header = 'header';
var hornReady = 'hornready';
var isNewUI = false;
// NOB vars
var NOBtickerTimout;
var NOBtickerInterval;
var NOBtraps = []; // Stores ALL traps, bases, cheese etc available to user
var NOBhuntsLeft = 0; // Temp for huntFor();
var NOBpage = false;
var mapRequestFailed = false;
var clockTicking = false;
var clockNeedOn = false;
var NOBadFree = false;
var LOCATION_TIMERS = [
['Seasonal Garden', {
first: 1283616000,
length: 288000,
breakdown: [1, 1, 1, 1],
name: ['Summer', 'Fall', 'Winter', 'Spring'],
color: ['Red', 'Orange', 'Blue', 'Green'],
effective: ['tactical', 'shadow', 'hydro', 'physical']
}],
['Balack\'s Cove', {
first: 1294680060,
length: 1200,
breakdown: [48, 3, 2, 3],
name: ['Low', 'Medium (in)', 'High', 'Medium (out)'],
color: ['Green', 'Orange', 'Red', 'Orange']
}],
['Forbidden Grove', {
first: 1285704000,
length: 14400,
breakdown: [4, 1],
name: ['Open', 'Closed'],
color: ['Green', 'Red']
}],
['Toxic Spill', {
first: 1503597600,
length: 3600,
breakdown: [15, 16, 18, 18, 24, 24, 24, 12, 12, 24, 24, 24, 18, 18, 16, 15],
name: ['Hero', 'Knight', 'Lord', 'Baron', 'Count', 'Duke', 'Grand Duke', 'Archduke', 'Archduke', 'Grand Duke', 'Duke', 'Count', 'Baron', 'Lord', 'Knight', 'Hero'],
color: ['Green', 'Green', 'Green', 'Green', 'Green', 'Green', 'Green', 'Green', 'Green', 'Green', 'Green', 'Green', 'Green', 'Green', 'Green', 'Green'],
effective: ['Rising', 'Rising', 'Rising', 'Rising', 'Rising', 'Rising', 'Rising', 'Rising', 'Falling', 'Falling', 'Falling', 'Falling', 'Falling', 'Falling', 'Falling', 'Falling']
}],
['Relic Hunter', {
url: 'http://horntracker.com/backend/relichunter.php?functionCall=relichunt'
}]
];
// console logging
function saveToSessionStorage() {
var i;
var str = "";
for (i = 0; i < arguments.length; i++) {
if (!isNullOrUndefined(arguments[i]) && typeof arguments[i] === 'object') { // if it is object
str += JSON.stringify(arguments[i]);
} else {
str += arguments[i];
}
if (i != arguments.length - 1)
str += " ";
}
var key = "";
var arrLog = [];
for (i = 0; i < window.sessionStorage.length; i++) {
key = window.sessionStorage.key(i);
if (key.indexOf("Log_") > -1)
arrLog.push(key);
}
if (arrLog.length > maxSaveLog) {
arrLog = arrLog.sort();
var count = Math.floor(maxSaveLog / 2);
for (i = 0; i < count; i++)
removeSessionStorage(arrLog[i]);
}
try {
setSessionStorage("Log_" + (performance.timing.navigationStart + performance.now()), str);
} catch (e) {
if (e.name == "QuotaExceededError") {
for (i = 0; i < window.sessionStorage.length; i++) {
key = window.sessionStorage.key(i);
if (key.indexOf('Log_') > -1)
removeSessionStorage(key);
}
saveToSessionStorage.apply(this, arguments);
}
}
}
console.plog = function () {
saveToSessionStorage.apply(this, arguments);
console.log.apply(console, arguments);
};
console.perror = function () {
saveToSessionStorage.apply(this, arguments);
console.error.apply(console, arguments);
};
console.pdebug = function () {
saveToSessionStorage.apply(this, arguments);
console.debug.apply(console, arguments);
};
// CNN KR SOLVER START
function FinalizePuzzleImageAnswer(answer) {
if (debug) console.log("RUN FinalizePuzzleImageAnswer()");
if (debug) console.log(answer);
var myFrame;
if (answer.length != 5) {
//Get a new puzzle
if (kingsRewardRetry >= kingsRewardRetryMax) {
kingsRewardRetry = 0;
setStorage("KingsRewardRetry", kingsRewardRetry);
var strTemp = 'Max ' + kingsRewardRetryMax + 'retries. Pls solve it manually ASAP.';
alert(strTemp);
displayTimer(strTemp, strTemp, strTemp);
console.perror(strTemp);
return;
} else {
++kingsRewardRetry;
setStorage("KingsRewardRetry", kingsRewardRetry);
var tagName = document.getElementsByTagName("a");
for (var i = 0; i < tagName.length; i++) {
if (tagName[i].innerText == "Click here to get a new one!") {
// TODO IMPORTANT: Find another time to fetch new puzzle
fireEvent(tagName[i], 'click');
myFrame = document.getElementById('myFrame');
if (!isNullOrUndefined(myFrame))
document.body.removeChild(myFrame);
window.setTimeout(function () {
CallKRSolver();
}, 6000);
return;
}
}
}
} else {
if (debug) console.log("Submitting captcha answer: " + answer);
//Submit answer
//var puzzleAns = document.getElementById("puzzle_answer");
var puzzleAns = document.getElementsByClassName("mousehuntPage-puzzle-form-code")[0];
if (!puzzleAns) {
if (debug) console.plog("puzzleAns: " + puzzleAns);
return;
}
puzzleAns.value = "";
puzzleAns.value = answer.toLowerCase();
//var puzzleSubmit = document.getElementById("puzzle_submit");
var puzzleSubmit = document.getElementsByClassName("mousehuntPage-puzzle-form-code-button")[0];
if (!puzzleSubmit) {
if (debug) console.plog("puzzleSubmit: " + puzzleSubmit);
return;
}
fireEvent(puzzleSubmit, 'click');
kingsRewardRetry = 0;
setStorage("KingsRewardRetry", kingsRewardRetry);
myFrame = document.getElementById('myFrame');
if (myFrame)
document.body.removeChild(myFrame);
window.setTimeout(function () {
CheckKRAnswerCorrectness();
}, 5000);
}
}
function receiveMessage(event) {
if (debug) console.debug("Event origin: " + event.origin);
if (!debugKR && !isAutoSolve)
return;
if (event.origin.indexOf("mhcdn") > -1 || event.origin.indexOf("mousehuntgame") > -1 || event.origin.indexOf("dropbox") > -1) {
if (event.data.indexOf("~") > -1) {
var result = event.data.substring(0, event.data.indexOf("~"));
if (saveKRImage) {
var processedImg = event.data.substring(event.data.indexOf("~") + 1, event.data.length);
var strKR = "KR" + separator;
strKR += Date.now() + separator;
strKR += result + separator;
strKR += "RETRY" + kingsRewardRetry;
try {
setStorage(strKR, processedImg);
} catch (e) {
console.perror('receiveMessage', e.message);
}
}
FinalizePuzzleImageAnswer(result);
} else if (event.data.indexOf("#") > -1) {
var value = event.data.substring(1, event.data.length);
setStorage("krCallBack", value);
} else if (event.data.indexOf('Log_') > -1)
console.plog(event.data.split('_')[1]);
else if (event.data.indexOf('MHAKRS_') > -1) {
var temp = event.data.split('_');
console.plog(temp[0], temp[1]);
setStorage(temp[0], temp[1]);
}
}
}
function CallKRSolver() {
if (debug) console.log("RUN CallKRSolver()");
var frame = document.createElement('iframe');
frame.setAttribute("id", "myFrame");
var img;
if (debugKR) {
//frame.src = "https://dl.dropboxusercontent.com/s/4u5msso39hfpo87/Capture.PNG";
//frame.src = "https://dl.dropboxusercontent.com/s/og73bcdsn2qod63/download%20%2810%29Ori.png";
frame.src = "https://dl.dropboxusercontent.com/s/ppg0l35h25phrx3/download%20(16).png";
} else {
//if (isNewUI) {
img = document.getElementsByClassName('mousehuntPage-puzzle-form-captcha-image')[0];
if (debug) console.log("Captcha Image fetched:")
if (debug) console.log(img);
frame.src = img.querySelector('img').src;
/*} else {
img = document.getElementById('puzzleImage');
frame.src = img.src;
}*/
}
document.body.appendChild(frame);
}
function CheckKRAnswerCorrectness() {
var puzzleForm = document.getElementsByClassName("mousehuntPage-puzzle-formContainer")[0];
if (puzzleForm.classList.contains("noPuzzle")) {
// KR is solved clicking continue now
location.reload(true)
resumeKRAfterSolved();
return;
}
var strTemp = '';
var codeError = document.getElementsByClassName("mousehuntPage-puzzle-form-code-error");
for (var i = 0; i < codeError.length; i++) {
if (codeError[i].innerText.toLowerCase().indexOf("incorrect claim code") > -1) {
if (kingsRewardRetry >= kingsRewardRetryMax) {
kingsRewardRetry = 0;
setStorage("KingsRewardRetry", kingsRewardRetry);
strTemp = 'Max ' + kingsRewardRetryMax + 'retries. Pls solve it manually ASAP.';
alert(strTemp);
displayTimer(strTemp, strTemp, strTemp);
console.perror(strTemp);
} else {
++kingsRewardRetry;
setStorage("KingsRewardRetry", kingsRewardRetry);
CallKRSolver();
}
return;
}
}
window.setTimeout(function () {
CheckKRAnswerCorrectness();
}, 1000);
}
function resumeKRAfterSolved() {
if (debug) console.log("RUN resumeKRAfterSolved()");
var resumeButton = document.getElementsByClassName("mousehuntPage-puzzle-form-complete-button")[0];
location.reload(true)
}
function addKREntries() {
var i, temp, maxLen, keyName;
var replaced = "";
var nTimezoneOffset = -(new Date().getTimezoneOffset()) * 60000;
var count = 1;
var strInnerHTML = '';
var selectViewKR = document.getElementById('viewKR');
if (selectViewKR.options.length > 0) {
// append keyKR for new KR entries under new UI
for (i = 0; i < window.localStorage.length; i++) {
keyName = window.localStorage.key(i);
if (keyName.indexOf("KR" + separator) > -1 && keyKR.indexOf(keyName) < 0)
keyKR.push(keyName);
}
}
maxLen = keyKR.length.toString().length;
for (i = 0; i < keyKR.length; i++) {
if (keyKR[i].indexOf("KR" + separator) > -1) {
temp = keyKR[i].split(separator);
temp.splice(0, 1);
temp[0] = parseInt(temp[0]);
if (Number.isNaN(temp[0]))
temp[0] = 0;
temp[0] += nTimezoneOffset;
temp[0] = (new Date(temp[0])).toISOString();
replaced = temp.join(" ");
temp = count.toString();
while (temp.length < maxLen) {
temp = '0' + temp;
}
replaced = temp + '. ' + replaced;
strInnerHTML += '<option value="' + keyKR[i] + '"' + ((i == keyKR.length - 1) ? ' selected' : '') + '>' + replaced + '</option>';
count++;
}
}
if (strInnerHTML !== '')
selectViewKR.innerHTML = strInnerHTML;
}
function setKREntriesColor() {
// set KR entries color
var i, nCurrent, nNext, strCurrent;
var selectViewKR = document.getElementById('viewKR');
for (i = 0; i < selectViewKR.children.length; i++) {
if (i < selectViewKR.children.length - 1) {
nCurrent = parseInt(selectViewKR.children[i].value.split('~')[1]);
nNext = parseInt(selectViewKR.children[i + 1].value.split('~')[1]);
if (Math.round((nNext - nCurrent) / 60000) < 2)
selectViewKR.children[i].style = 'color:red';
}
strCurrent = selectViewKR.children[i].value.split('~')[2];
if (strCurrent == strCurrent.toUpperCase() && selectViewKR.children[i].style.color != 'red') {
selectViewKR.children[i].style = 'color:magenta';
}
}
}
window.addEventListener("message", receiveMessage, false);
if (debugKR)
CallKRSolver();
// CNN KR SOLVER END
// start executing script
if (debug) console.log('STARTING SCRIPT - ver: ' + scriptVersion);
if (window.top != window.self) {
if (debug) console.log('In IFRAME - may cause firefox to error, location: ' + window.location.href);
//return;
} else {
if (debug) console.log('NOT IN IFRAME - will not work in fb MH');
}
var getMapPort;
try {
if (!isNullOrUndefined(chrome.runtime.id)) {
g_strScriptHandler = "Extensions";
g_strVersion = chrome.runtime.getManifest().version;
getMapPort = chrome.runtime.connect({name: 'map'});
getMapPort.onMessage.addListener(function (msg) {
console.log(msg);
if (msg.array.length > 0)
checkCaughtMouse(msg.obj, msg.array);
});
} else {
g_strScriptHandler = GM_info.scriptHandler + " " + GM_info.version;
g_strVersion = GM_info.script.version;
}
} catch (e) {
console.perror('Before exeScript', e.message);
getMapPort = undefined;
g_strVersion = undefined;
g_strScriptHandler = undefined;
}
exeScript();
function exeScript() {
if (debug) console.log('RUN %cexeScript()', 'color: #9cffbd');
browser = browserDetection();
try {
var titleElm = document.getElementById('titleElement');
if (titleElm) {
titleElm.parentNode.remove();
}
} catch (e) {
if (debug) console.log('No past title elements found.');
} finally {
titleElm = null;
}
try {
// check the trap check setting first
trapCheckTimeDiff = GetTrapCheckTime();
// check the trap check setting first
if (trapCheckTimeDiff == 60) {
trapCheckTimeDiff = 0;
} else if (trapCheckTimeDiff < 0 || trapCheckTimeDiff > 60) {
// invalid value, just disable the trap check
enableTrapCheck = false;
}
if (showTimerInTitle) {
// check if they are running in iFrame
if (window.location.href.indexOf("apps.facebook.com/mousehunt/") != -1) {
contentElement = document.getElementById('pagelet_canvas_content');
if (contentElement) {
breakFrameDivElement = document.createElement('div');
breakFrameDivElement.setAttribute('id', 'breakFrameDivElement');
breakFrameDivElement.innerHTML = "Timer cannot show on title page. You can <a href='http://www.mousehuntgame.com/canvas/'>run MouseHunt without iFrame (Facebook)</a> to enable timer on title page";
contentElement.parentNode.insertBefore(breakFrameDivElement, contentElement);
}
contentElement = undefined;
} else if (window.location.href.indexOf("hi5.com/friend/games/MouseHunt") != -1) {
contentElement = document.getElementById('apps-canvas-body');
if (contentElement) {
breakFrameDivElement = document.createElement('div');
breakFrameDivElement.setAttribute('id', 'breakFrameDivElement');
breakFrameDivElement.innerHTML = "Timer cannot show on title page. You can <a href='http://mousehunt.hi5.hitgrab.com/'>run MouseHunt without iFrame (Hi5)</a> to enable timer on title page";
contentElement.parentNode.insertBefore(breakFrameDivElement, contentElement);
}
contentElement = breakFrameDivElement = undefined;
}
}
// check user running this script from where
if (window.location.href.indexOf("mousehuntgame.com/canvas/") != -1) {
// from facebook
fbPlatform = true;
setStorage('Platform', 'FB');
} else if (window.location.href.indexOf("mousehuntgame.com") != -1) {
// need to check if it is running in mobile version
var version = getCookie("switch_to");
if (version !== null && version == "mobile") {
// from mousehunt game mobile version
mhMobilePlatform = true;
setStorage('Platform', 'MHMobile');
} else {
// from mousehunt game standard version
mhPlatform = true;
setStorage('Platform', 'MH');
}
version = undefined;
} else if (window.location.href.indexOf("mousehunt.hi5.hitgrab.com") != -1) {
// from hi5
hiFivePlatform = true;
setStorage('Platform', 'Hi5');
}
// check if user running in https secure connection, true/false
secureConnection = (window.location.href.indexOf("https://") > -1);
setStorage('HTTPS', secureConnection);
if (fbPlatform) {
if (window.location.href == "http://www.mousehuntgame.com/canvas/" ||
window.location.href == "http://www.mousehuntgame.com/canvas/#" ||
window.location.href == "https://www.mousehuntgame.com/canvas/" ||
window.location.href == "https://www.mousehuntgame.com/canvas/#" ||
window.location.href.indexOf("mousehuntgame.com/canvas/?") != -1) {
window.location.href == "https://www.mousehuntgame.com/" ||
window.location.href == "https://www.mousehuntgame.com/#" ||
window.location.href == "https://www.mousehuntgame.com/?switch_to=standard" ||
window.location.href == "https://www.mousehuntgame.com/index.php" ||
window.location.href == "https://www.mousehuntgame.com/camp.php" ||
window.location.href.indexOf("mousehuntgame.com/index.php") >= 0 ||
// page to execute the script!
// make sure all the preference already loaded
loadPreferenceSettingFromStorage();
// this is the page to execute the script
if (!checkIntroContainer() && retrieveDataFirst()) {
// embed a place where timer show
embedTimer(true);
// embed script to horn button
embedScript();
// start script action
action();
nobInit();
} else {
// fail to retrieve data, display error msg and reload the page
document.title = "Fail to retrieve data from page. Reloading in " + timeFormat(errorReloadTime);
window.setTimeout(function () {
reloadPage(false);
}, errorReloadTime * 1000);
}
} else {
// not in hunters camp, just show the title of autobot version
embedTimer(false);
nobInit();
}
} else if (mhPlatform) {
if (window.location.href == "http://www.mousehuntgame.com/" ||
window.location.href == "http://www.mousehuntgame.com/#" ||
window.location.href == "http://www.mousehuntgame.com/?switch_to=standard" ||
window.location.href == "https://www.mousehuntgame.com/" ||
window.location.href == "https://www.mousehuntgame.com/#" ||
window.location.href == "https://www.mousehuntgame.com/?switch_to=standard" ||
window.location.href == "https://www.mousehuntgame.com/index.php" ||
window.location.href == "https://www.mousehuntgame.com/camp.php" ||
window.location.href.indexOf("mousehuntgame.com/index.php") >= 0 ||
window.location.href.indexOf("mousehuntgame.com/camp.php") >= 0) {
// page to execute the script!
// make sure all the preference already loaded
loadPreferenceSettingFromStorage();
// this is the page to execute the script
if (!checkIntroContainer() && retrieveDataFirst()) {
// embed a place where timer show
embedTimer(true);
// embed script to horn button
embedScript();
// start script action
action();
nobInit();
} else {
// fail to retrieve data, display error msg and reload the page
document.title = "Fail to retrieve data from page. Reloading in " + timeFormat(errorReloadTime);
window.setTimeout(function () {
reloadPage(false);
}, errorReloadTime * 1000);
}
} else {
// not in hunters camp, just show the title of autobot version
embedTimer(false);
}
} else if (mhMobilePlatform) {
// execute at all page of mobile version
// page to execute the script!
// make sure all the preference already loaded
loadPreferenceSettingFromStorage();
// embed a place where timer show
embedTimer(false);
} else if (hiFivePlatform) {
if (window.location.href == "http://mousehunt.hi5.hitgrab.com/#" ||
window.location.href.indexOf("http://mousehunt.hi5.hitgrab.com/?") != -1 ||
window.location.href == "http://mousehunt.hi5.hitgrab.com/" ||
window.location.href.indexOf("http://mousehunt.hi5.hitgrab.com/turn.php") != -1 ||
window.location.href.indexOf("http://mousehunt.hi5.hitgrab.com/?newpuzzle") != -1 ||
window.location.href.indexOf("http://mousehunt.hi5.hitgrab.com/index.php") != -1) {
// page to execute the script!
// make sure all the preference already loaded
loadPreferenceSettingFromStorage();
// this is the page to execute the script
if (!checkIntroContainer() && retrieveDataFirst()) {
// embed a place where timer show
embedTimer(true);
// embed script to horn button
embedScript();
// start script action
action();
nobInit();
} else {
// fail to retrieve data, display error msg and reload the page
document.title = "Fail to retrieve data from page. Reloading in " + timeFormat(errorReloadTime);
window.setTimeout(function () {
reloadPage(false);
}, errorReloadTime * 1000);
}
} else {