2020 MouseHunt AutoBot

An advance user script to automate sounding the hunter horn in MouseHunt

Installer dette scriptet?
Skaperens foreslåtte skript

Du vil kanskje også like MH Auto KR Solver.

Installer dette scriptet
  1. // ==UserScript==
  2. // @name 2020 MouseHunt AutoBot
  3. // @author Ooi Keng Siang, CnN, Hunter12345, iJiB
  4. // @version 2020.09.24
  5. // @namespace http://ooiks.com/blog/mousehunt-autobot, https://devcnn.wordpress.com/
  6. // @description An advance user script to automate sounding the hunter horn in MouseHunt
  7. // @require https://code.jquery.com/jquery-2.2.2.min.js
  8. // @include http://mousehuntgame.com/*
  9. // @include https://mousehuntgame.com/*
  10. // @include http://www.mousehuntgame.com/*
  11. // @include https://www.mousehuntgame.com/*
  12. // @include http://apps.facebook.com/mousehunt/*
  13. // @include https://apps.facebook.com/mousehunt/*
  14. // @include http://hi5.com/friend/games/MouseHunt*
  15. // @include http://mousehunt.hi5.hitgrab.com/*
  16. // @grant unsafeWindow
  17. // @grant GM_info
  18. // ==/UserScript==
  19.  
  20. // == Basic User Preference Setting (Begin) ==
  21. // // The variable in this section contain basic option will normally edit by most user to suit their own preference
  22. // // Reload MouseHunt page manually if edit this script while running it for immediate effect.
  23.  
  24. // // Extra delay time before sounding the horn. (in seconds)
  25. // // Default: 5 - 180
  26. var hornTimeDelayMin = 10;
  27. var hornTimeDelayMax = 30;
  28.  
  29. // // Bot aggressively by ignore all safety measure such as check horn image visible before sounding it. (true/false)
  30. // // Note: Highly recommended to turn off because it increase the chances of getting caught in botting.
  31. // // Note: It will ignore the hornTimeDelayMin and hornTimeDelayMax.
  32. // // Note: It may take a little bit extra of CPU processing power.
  33. var aggressiveMode = false;
  34.  
  35. // // Enable trap check once an hour. (true/false)
  36. var enableTrapCheck = true;
  37.  
  38. // // Trap check time different value (00 minutes - 45 minutes)
  39. // // Note: Every player had different trap check time, set your trap check time here. It only take effect if enableTrapCheck = true;
  40. // // Example: If you have XX:00 trap check time then set 00. If you have XX:45 trap check time, then set 45.
  41. var trapCheckTimeDiff = 0;
  42.  
  43. // // Extra delay time to trap check. (in seconds)
  44. // // Note: It only take effect if enableTrapCheck = true;
  45. var checkTimeDelayMin = 5;
  46. var checkTimeDelayMax = 10;
  47.  
  48. // // Play sound when encounter king's reward (true/false)
  49. var isKingWarningSound = false;
  50.  
  51. // // Auto solve KR
  52. var isAutoSolve = false;
  53.  
  54. // // Extra delay time before solving KR. (in seconds)
  55. // // Default: 10 - 30
  56. var krDelayMin = 10;
  57. var krDelayMax = 30;
  58.  
  59. // // Time to start and stop solving KR. (in hours, 24-hour format)
  60. // // Example: Script would not auto solve KR between 00:00 - 6:00 when krStopHour = 0 & krStartHour = 6;
  61. // // To disable this feature, set both to the same value.
  62. var krStopHour = 0;
  63. var krStartHour = 6;
  64.  
  65. // // Extra delay time to start solving KR after krStartHour. (in minutes)
  66. var krStartHourDelayMin = 10;
  67. var krStartHourDelayMax = 30;
  68.  
  69. // // Time offset (in seconds) between client time and internet time
  70. // // -ve - Client time ahead of internet time
  71. // // +ve - Internet time ahead of client time
  72. var g_nTimeOffset = 0;
  73.  
  74. // // Maximum retry of solving KR.
  75. // // If KR solved more than this number, pls solve KR manually ASAP in order to prevent MH from caught in botting
  76. var kingsRewardRetryMax = 3;
  77.  
  78. // // State to indicate whether to save KR image into localStorage or not
  79. var saveKRImage = true;
  80.  
  81. // // Maximum number of KR image to be saved into localStorage
  82. var maxSaveKRImage = 75;
  83.  
  84. // // The script will pause if player at different location that hunt location set before. (true/false)
  85. // // Note: Make sure you set showTimerInPage to true in order to know what is happening.
  86. var pauseAtInvalidLocation = false;
  87.  
  88. // // Time to wait after trap selector clicked (in second)
  89. var secWait = 7;
  90.  
  91. // // Stop trap arming after X retry
  92. var armTrapRetry = 3;
  93.  
  94. // // Maximum number of log to be saved into sessionStorage
  95. var maxSaveLog = 750;
  96.  
  97. // == Basic User Preference Setting (End) ==
  98.  
  99.  
  100.  
  101.  
  102.  
  103. // == Advance User Preference Setting (Begin) ==
  104. // // The variable in this section contain some advance option that will change the script behavior.
  105. // // Edit this variable only if you know what you are doing
  106. // // Reload MouseHunt page manually if edit this script while running it for immediate effect.
  107.  
  108. // // Display timer and message in page title. (true/false)
  109. var showTimerInTitle = false;
  110.  
  111. // // Embed a timer in page to show next hunter horn timer, highly recommanded to turn on. (true/false)
  112. // // Note: You may not access some option like pause at invalid location if you turn this off.
  113. var showTimerInPage = true;
  114.  
  115. // // Display the last time the page did a refresh or reload. (true/false)
  116. var showLastPageLoadTime = true;
  117.  
  118. // // Default time to reload the page when bot encounter error. (in seconds)
  119. var errorReloadTime = 60;
  120.  
  121. // // Time interval for script timer to update the time. May affect timer accuracy if set too high value. (in seconds)
  122. var timerRefreshInterval = 1;
  123.  
  124. // // Trap arming status
  125. var LOADING = -1;
  126. var NOT_FOUND = 0;
  127. var ARMED = 1;
  128.  
  129. // // Trap List
  130. var objTrapList = {
  131. weapon : [],
  132. base : [],
  133. trinket : [],
  134. bait : []
  135. };
  136.  
  137. // // Trap Collection
  138. var objTrapCollection = {
  139. weapon: ["2010 Blastoff","2012 Big Boom","500 Pound Spiked Crusher","Admiral's Galleon","Ambrosial Portal","Ambush","Ancient Box","Ancient Gauntlet","Ancient Spear Gun","Anniversary Ambush","Anniversary Ancient Box","Anniversary Arcane Capturing Rod Of Never Yielding Mystery","Anniversary DeathBot","Anniversary Reaper's Perch","Arcane Blast","Arcane Capturing Rod Of Never Yielding Mystery","Bandit Deflector","Biomolecular Re-atomizer","Birthday Candle Kaboom","Birthday Party Piñata Bonanza","Blackstone Pass","Blazing Ember Spear","Bottomless Grave","Brain Extractor","Bubbles: The Party Crasher","Cackle Lantern","Candy Crusher","Celestial Dissonance","Cemetery Gate Grappler","Chesla's Revenge","Christmas Cactus","Chrome Celestial Dissonance","Christmas Cracker","Christmas Crystalabra","Chrome Arcane Capturing Rod","Chrome DeathBot","Chrome DrillBot","Chrome Grand Arcanum","Chrome MonstroBot","Chrome Nannybot","Chrome Oasis Water Node","Chrome Onyx Mallet","Chrome Phantasmic Oasis","Chrome RhinoBot","Chrome Sphynx Wrath","Chrome Storm Wrought Ballista","Chrome Tacky Glue","Chrome Temporal Turbine","Clockapult of Time","Clockapult of Winter Past","Clockwork Portal","Creepy Coffin","Crystal Crucible","Crystal Mineral Crusher","Crystal Tower","Digby DrillBot","Dimensional Chest","Double Diamond Adventure","Dragon Lance","Dragon Slayer Cannon","Dragonvine Ballista","Dreaded Totem","Droid Archmagus","Ember Prison Core" ,"Endless Labyrinth","Engine Doubler","Enraged RhinoBot","Event Horizon","Explosive Toboggan Ride","Father Winter's Timepiece","Festive Forgotten Fir","Festive Gauntlet Crusher","Fluffy DeathBot","Focused Crystal Laser","Forgotten Pressure Plate","Giant Speaker","Gingerbread House Surprise","Glacier Gatler","Goldfrost Crossbow","Golem Guardian Arcane","Golem Guardian Forgotten","Golem Guardian Hydro","Golem Guardian Physical","Golem Guardian Tactical","Golem Guardian","Gorgon","Gouging Geyserite","Grand Arcanum","Grungy DeathBot","Harpoon Gun","Harrowing Holiday Harpoon Harp","Haunted Shipwreck","Heat Bath","High Tension Spring","HitGrab Horsey","HitGrab Rainbow Rockin' Horse","HitGrab Rockin' Horse","Holiday Hydro Hailstone","Horrific Venus Mouse","Ice Blaster","Ice Maiden","Icy RhinoBot","Infinite Labyrinth","Infinite Winter Horizon","Interdimensional Crossbow","Isle Idol","Isle Idol","Isle Idol","Judge Droid","Kraken Chaos","Law Laser","Maniacal Brain Extractor","Meteor Prison Core","Mouse DeathBot","Mouse Hot Tub","Mouse Mary O'Nette","Mouse Rocketine","Mouse Trebuchet","Multi-Crystal Laser","Mutated Venus Mouse","Mysteriously unYielding Null-Onyx Rampart of Cascading Amperes","Mystic Pawn Pincher","Nannybot","Net Cannon","New Horizon","New Year's Fireworks","Ninja Ambush","Nutcracker Nuisance","NVMRC Forcefield","Oasis Water Node","Obelisk of Incineration","Obelisk of Slumber","Obvious Ambush","Onyx Mallet","Paradise Falls","PartyBot","Phantasmic Oasis","Pneumatic Tube","Pumpkin Pummeler","Queso Fount","Reaper's Perch","Rewers Riposte","RhinoBot","Rift Glacier Gatler","Rocket Propelled Gavel","Rune Shark","S.A.M. F.E.D. DN-5","S.L.A.C. II","S.L.A.C.","S.U.P.E.R. Scum Scrubber","Sandcastle Shard","Sandstorm MonstroBot","Sandtail Sentinel","Scarlet Ember Root","School of Sharks","Scum Scrubber","Shrink Ray","Sinister Portal","Smoldering Stone Sentinel","Snow Barrage","Snowglobe","Soul Catcher","Soul Harvester","Sphynx Wrath","Sprinkly Cupcake Surprise","Stale Cupcake Golem","Steam Laser Mk. I","Steam Laser Mk. II (Broken!)","Steam Laser Mk. II","Steam Laser Mk. III","Storm Wrought Ballista","Supply Grabber","Surprise Party","Swiss Army Mouse","Tacky Glue","Tarannosaurus Rex","Technic Pawn Pincher","Temporal Turbine","Terrifying Spider","The Forgotten Art of Dance","The Law Draw","Thorned Venus Mouse","Timesplit Dissonance","Ultra MegaMouser MechaBot","Veiled Vine","Venus Mouse","Wacky Inflatable Party People","Warden Slayer","Warpath Thrasher","Well of Wisdom","Wrapped Gift","Zugzwang's First Move","Zugzwang's Last Move","Zugzwang's Ultimate Move","Zurreal's Folly"],
  140. base: ["10 Layer Birthday Cake Base","2017 New Year's Base","2018 New Year's Base","2019 New Year's Base","2020 New Year's Base","Ancient Booster Base","Aqua Base","Attuned Enerchi Induction Base","Bacon Base","Bamboozler Base","Birthday Banana Cake Base","Birthday Cake Base","Birthday Dragée Cake Base","Black Widow Base","Bronze Tournament Base","Candy Cane Base","Carrot Birthday Cake Base","Cheesecake Base","Chocolate Birthday Cake Base","Claw Shot Base","Clockwork Base","Crushed Birthday Cake Base","Cupcake Birthday Base","Deadwood Plank Base","Deep Freeze Base","Dehydration Base","Denture Base","Depth Charge Base","Desert Heater Base","Dog Jade Base","Dragon Jade Base","Eerie Base","Eerier Base","Electromagnetic Meteorite Base","Enerchi Induction Base","Explosive Base","Extra Sweet Cupcake Birthday Base","Fan Base","Festive Winter Hunt Base","Firecracker Base","Fissure Base","Fracture Base","Furoma Base","Gingerbread Base","Glowing Golem Guardian Base","Golden Tournament Base","Hallowed Ground 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","Overgrown Ember Stone Base","Papyrus Base","Physical Brace Base","Pig Jade Base","Polar Base","Polluted Base","Prestige Base","Rat Jade Base","Refined Pollutinum Base","Remote Detonator Base","Rift Base","Rooster Jade Base","Runic Base","Seasonal Base","Sheep Jade Base","Silver Tournament Base","Skello-ton Base","Snake Jade Base","Soiled Base","Spellbook Base","Spiked Base","Sprinkly Sweet Cupcake Birthday Base","Stone Base","Tidal Base","Tiki Base","Treasure Seeker Base","Tribal Base","Tribal Kaboom Base","Ultimate Iceberg Base","Vegetation Base","Washboard Base","Wooden Base with Target","Wooden Base"],
  141. bait: ["Abominable Asiago","Ancient Cheese","Ancient String Cheese","Arctic Asiago Cheese","Ascended Cheese","Bland Queso","Brie Cheese","Brie String Cheese","Candy Corn Cheese","Checkmate Cheese","Chedd-Ore Cheese","Cheddar Cheese","Cherry Cheese","Coggy Colby Cheese","Combat Cheese","Creamy Havarti Cheese","Crescent Cheese","Crimson Cheese","Crunchy Cheese","Crunchy Havarti Cheese","Cupcake Colby","Dewthief Camembert","Diamond Cheese","Dragonvine Cheese","Dumpling Cheese","Duskshade Camembert","Extra Sweet Cupcake Colby","Festive Feta","Fishy Fromage","Flamin' Queso","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","Gauntlet String Cheese","Gemstone Cheese","Ghastly Galleon Gouda","Ghoulgonzola Cheese","Gilded Cheese","Gingerbread Cheese","Glazed Pecan Pecorino Cheese","Glowing Gruyere Cheese","Glutter Cheese","Gnarled Cheese","Gouda Cheese","Graveblossom Camembert","Grilled Cheese","Gumbo Cheese","Hot Queso","Inferno Havarti Cheese","Lactrodectus Lancashire Cheese","Limelight Cheese","Lockbox Limburger Cheese","Lunaria Camembert","Magical Havarti Cheese","Magical Rancid Radioactive Blue Cheese","Magical String Cheese","Maki Cheese","Maki String Cheese","Marble Cheese","Marble String Cheese","Marshmallow Monterey","Master Fusion Cheese","Medium Queso","Mild Queso","Mineral Cheese","Moon Cheese","Mozzarella Cheese","Nian Gao'da Cheese","Null Onyx Gorgonzola","Nutmeg Cheese","Onyx Gorgonzola","Pecan Pecorino Cheese","Polluted Parmesan Cheese","Pungent Havarti Cheese","Radioactive Blue Cheese","Rainy Cheese","Rancid Radioactive Blue Cheese","Resonator Cheese","Rewind Raclette","Rift Combat Cheese","Rift Glutter Cheese","Rift Rumble Cheese","Rift Susheese Cheese","Riftiago Cheese","Rockforth Cheese","Rumble Cheese","Runic Cheese","Runic String Cheese","Runny Cheese","Seasoned Gouda","Shell Cheese","Snowball Bocconcini","Spicy Havarti Cheese","Sunrise Cheese","SUPER|brie+","Susheese Cheese","Sweet Havarti Cheese","Swiss Cheese","Swiss String Cheese","Terre Ricotta Cheese","Toxic Brie","Toxic SUPER|brie+","Undead Emmental","Undead String Emmental","Vanilla Stilton Cheese","Vengeful Vanilla Stilton Cheese","White Cheddar Cheese","Wicked Gnarly Cheese","Wildfire Queso","Windy Cheese"],
  142. trinket: ["2014 Charm","2015 Charm","2016 Charm","2017 Charm","2018 Charm","2019 Charm","2020 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","Ember 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 Snowball Charm","Extreme Spooky Charm","Extreme Wealth Charm","Factory Repair Charm","Festive Anchor Charm","Festive Ultimate Luck Charm","Festive Ultimate Lucky Power Charm","Festive Ultimate Power Charm","Firecracker Charm","First Ever Charm","Flamebane Charm","Forgotten Charm","Freshness Charm","Gargantua Charm","Gemstone Boost Charm","Gift Wrapped Charm","Gilded Charm","Glowing Gourd Charm","Gnarled Charm","Golden Anchor Charm","Golem Guardian Charm","Greasy Glob Charm","Growth Charm","Grub Salt Charm","Grub Scent Charm","Grubling Bonanza Charm","Grubling Chow Charm","Haunted Ultimate Luck Charm","Horsepower Charm","Hunter's Horn Rewind Charm","Hydro Charm","Lantern Oil Charm","Let It Snow Charm","Luck Charm","Lucky Power Charm","Lucky Rabbit Charm","Lucky Valentine Charm","Magmatic Crystal Charm","Mining Charm","Mobile Charm","Monger Charm","Monkey Fling Charm","Nanny Charm","Nerg Power Charm","Nightlight Charm","Nightshade Farming Charm","Nitropop Charm","Oxygen Burst Charm","Party Charm","Pointy Charm","Polluted Charm","Power Charm","Prospector's Charm","Queso Pump Charm","Rainbow Luck Charm","Ramming Speed Charm","Reality Restitch Charm","Realm Ripper Charm","Red Double Sponge Charm","Red Sponge Charm","Regal Charm","Rift 2020 Charm","Rift Airship Charm","Rift Antiskele Charm","Rift Charm","Rift Extreme Luck Charm","Rift Extreme Power Charm","Rift Extreme Snowball Charm","Rift Luck Charm","Rift Power Charm","Rift Snowball Charm","Rift Spooky Charm","Rift Super Luck Charm","Rift Super Power Charm","Rift Super Snowball Charm","Rift Ultimate Luck Charm","Rift Ultimate Lucky Power Charm","Rift Ultimate Power Charm","Rift Ultimate Snowball Charm","Rift Vacuum Charm","Rift Wealth 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","Small Power 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","Stalemate Charm","Sticky Charm","Striker Charm","Super Ancient Charm","Super Attraction Charm","Super Brain Charm","Super Cactus Charm","Super Dragonbane Charm","Super Enerchi Charm","Super Lantern Oil Charm","Super Luck Charm","Super Nightshade Farming Charm","Super Polluted Charm","Super Power Charm","Super Queso Pump Charm","Super Regal Charm","Super Rift Vacuum Charm","Super Rotten Charm","Super Salt Charm","Super Snowball 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","Timesplit 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 Snowball Charm","Ultimate Spooky Charm","Ultimate Spore Charm","Ultimate Wealth 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"],
  143. }
  144.  
  145. // // Best weapon/base/charm/bait pre-determined by user. Edit ur best weapon/base/charm/bait in ascending order. e.g. [best, better, good]
  146. var objBestTrap = {
  147. weapon : {
  148. arcane : ['New Horizon','Infinite Winter Horizon','Event Horizon','Droid Archmagus','Chrome Grand Arcanum','Chrome Arcane Capturing Rod','Grand Arcanum','Anniversary Arcane Capturing Rod Of Never Yielding Mystery','Arcane Capturing Rod Of Nev','Sprinkly Cupcake Surprise','Arcane Blast'],
  149. draconic : ['Dragon Slayer Cannon','Chrome Storm Wrought Ballista','Storm Wrought Ballista','Dragonvine Ballista','Blazing Ember Spear','Ice Maiden','Harrowing Holiday Harpoon Harp','Dragon Lance'],
  150. forgotten : ['Infinite Labyrinth','Endless Labyrinth','Crystal Mineral Crusher','Crystal Crucible','Festive Forgotten Fir','Stale Cupcake Golem','Scarlet Ember Root','Tarannosaurus Rex','The Forgotten Art of Dance','Anniversary Ancient Box','Ancient Box'],
  151. hydro : ['Queso Fount','School of Sharks','Rune Shark','Chrome Phantasmic Oasis','Phantasmic Oasis','Bubbles: The Party Crasher','Chrome Oasis Water Node','Oasis Water Node','Haunted Shipwreck','Glacier Gatler','Steam Laser Mk. III','Steam Laser Mk. II'],
  152. law : ['Ember Prison Core','Meteor Prison Core','Judge Droid','Surprise Party','Christmas Cactus','Law Laser','Engine Doubler','Bandit Deflector','Supply Grabber','S.L.A.C. II','The Law Draw','S.L.A.C'],
  153. physical : ['Smoldering Stone Sentinel','Chrome MonstroBot','Sandstorm MonstroBot','Sandtail Sentinel','Rocket Propelled Gavel','Chrome RhinoBot','New Year\'s Fireworks','Warden Slayer','Enraged RhinoBot','Isle Idol','Chrome Onyx Mallet','RhinoBot'],
  154. rift : ['Chrome Celestial Dissonance','Celestial Dissonance','Timesplit Dissonance','Mysteriously unYielding','Focused Crystal Laser','Biomolecular Re-atomizer','Christmas Crystalabra','Multi-Crystal Laser','Crystal Tower'],
  155. shadow : ['Chrome Temporal Turbine','Temporal Turbine','Goldfrost Crossbow','Interdimensional Crossbow','Clockwork Portal','Anniversary Reaper\'s Perch','Reaper\'s Perch','Sandcastle Shard','Dreaded Totem','Maniacal Brain Extractor','Terrifying Spider'],
  156. tactical : ['Gouging Geyserite','Chrome Sphynx Wrath','Sphynx Wrath','Dimensional Chest','Chesla\'s Revenge','Zugzwang\'s Ultimate Move','Well of Wisdom','Isle Idol','Zugzwang\'s First Move','Veiled Vine','Horrific Venus Mouse','Thorned Venus Mouse','Blackstone Pass'], },
  157.  
  158. base : {
  159. luck : ['Minotaur Base','Glowing Golem Guardian Base','Fissure Base','Rift Base','Attuned Enerchi Induction Base','Monkey Jade Base','Sheep Jade Base','Depth Charge Base','Horse Jade Base','Snake Jade Base','Dragon Jade Base','Eerier Base','Papyrus Base'],
  160. power : ['Minotaur Base','Tidal Base','Golden Tournament Base','Spellbook Base']
  161. //power : ['Minotaur Base','Glowing Golem Guardian Base','Tidal Base','Golden Tournament Base','Spellbook Base']
  162. }
  163. };
  164.  
  165.  
  166. // // Fiery Warpath Preference
  167. var commanderCharm = ['Super Warpath Commander\'s', 'Warpath Commander\'s'];
  168. var objPopulation = {
  169. WARRIOR : 0,
  170. SCOUT : 1,
  171. ARCHER : 2,
  172. CAVALRY : 3,
  173. MAGE : 4,
  174. ARTILLERY : 5,
  175. name : ['Warrior', 'Scout', 'Archer', 'Cavalry', 'Mage', 'Artillery']
  176. };
  177. var g_arrFWSupportRetreat = [0, 10, 18, 26];
  178. var g_fwStreakLength = 15;
  179. var objDefaultFW = {
  180. weapon : 'Sandtail Sentinel',
  181. base : 'Physical Brace',
  182. focusType : 'NORMAL',
  183. priorities : 'HIGHEST',
  184. cheese : new Array(g_fwStreakLength).fill('Gouda'),
  185. charmType : new Array(g_fwStreakLength).fill('Warpath'),
  186. special : new Array(g_fwStreakLength).fill('None'),
  187. lastSoldierConfig : 'CONFIG_GOUDA',
  188. includeArtillery : true,
  189. disarmAfterSupportRetreat : false,
  190. warden : {
  191. before : {
  192. weapon : '',
  193. base : '',
  194. trinket : '',
  195. bait : ''
  196. },
  197. after : {
  198. weapon : '',
  199. base : '',
  200. trinket : '',
  201. bait : ''
  202. }
  203. }
  204. };
  205.  
  206. // // Living Garden Preference
  207. var bestLGBase = ['Living Base', 'Hothouse Base'];
  208. var bestSalt = ['Super Salt', 'Grub Salt'];
  209. var redSpongeCharm = ['Red Double', 'Red Sponge'];
  210. var yellowSpongeCharm = ['Yellow Double', 'Yellow Sponge'];
  211. var spongeCharm = ['Double Sponge', 'Sponge'];
  212.  
  213. // // Sunken City Preference
  214. // // DON'T edit this variable if you don't know what are you editing
  215. var objSCZone = {
  216. ZONE_NOT_DIVE : 0,
  217. ZONE_DEFAULT : 1,
  218. ZONE_CORAL : 2,
  219. ZONE_SCALE : 3,
  220. ZONE_BARNACLE : 4,
  221. ZONE_TREASURE : 5,
  222. ZONE_DANGER : 6,
  223. ZONE_DANGER_PP : 7,
  224. ZONE_OXYGEN : 8,
  225. ZONE_BONUS : 9,
  226. ZONE_DANGER_PP_LOTA : 10
  227. };
  228. var bestSCBase = ['Minotaur Base','Fissure Base','Depth Charge Base'];
  229.  
  230. // // Spring Egg Hunt
  231. var chargeCharm = ['Eggstra Charge', 'Eggscavator'];
  232. var chargeHigh = 17;
  233. var chargeMedium = 12;
  234.  
  235. // // Labyrinth
  236. var bestLabyBase = ['Minotaur Base', 'Labyrinth Base'];
  237. var objCodename = {
  238. FEALTY : "y",
  239. TECH : "h",
  240. SCHOLAR : "s",
  241. TREASURY : "t",
  242. FARMING : "f",
  243. PLAIN : "p",
  244. SUPERIOR : "s",
  245. EPIC : "e",
  246. SHORT : "s",
  247. MEDIUM : "m",
  248. LONG : "l"
  249. };
  250. var arrHallwayOrder = [
  251. 'sp','mp','lp',
  252. 'ss','ms','ls',
  253. 'se','me','le'];
  254. var objDefaultLaby = {
  255. districtFocus : 'None',
  256. between0and14 : ['lp'],
  257. between15and59 : ['sp','ls'],
  258. between60and100 : ['sp','ss','le'],
  259. chooseOtherDoors : false,
  260. typeOtherDoors : "SHORTEST_FEWEST",
  261. securityDisarm : false,
  262. lastHunt : 0,
  263. armOtherBase : 'false',
  264. disarmCompass : true,
  265. nDeadEndClue : 0,
  266. weaponFarming : 'Forgotten'
  267. };
  268. var objLength = {
  269. SHORT : 0,
  270. MEDIUM : 1,
  271. LONG : 2
  272. };
  273.  
  274. // // Furoma Rift
  275. var objFRBattery = {
  276. level : [1,2,3,4,5,6,7,8,9,10],
  277. name : ["one","two","three","four","five","six","seven","eight","nine","ten"],
  278. capacity : [20,45,75,120,200,310,450,615,790,975],
  279. cumulative : [20,65,140,260,460,770,1220,1835,2625,3600]
  280. };
  281.  
  282. var g_arrHeirloom = []; // to be refresh once page reload
  283.  
  284. var g_objConstTrap = {
  285. bait : {
  286. ANY_HALLOWEEN : {
  287. sort : 'any',
  288. name : ['Ghoulgonzola', 'Candy Corn']
  289. },
  290. ANY_MASTER : {
  291. sort : 'any',
  292. name : ['Rift Glutter', 'Rift Combat', 'Rift Susheese']
  293. },
  294. ANY_LUNAR : {
  295. sort : 'any',
  296. name : ['Moon Cheese', 'Crescent Cheese']
  297. },
  298. ANY_FESTIVE_BRIE : {
  299. sort : 'best',
  300. name : ['Arctic Asiago', 'Nutmeg', 'Snowball Bocconcini', 'Festive Feta', 'Gingerbread', 'Brie Cheese']
  301. },
  302. ANY_FESTIVE_GOUDA : {
  303. sort : 'best',
  304. name : ['Arctic Asiago', 'Nutmeg', 'Snowball Bocconcini', 'Festive Feta', 'Gingerbread', 'Gouda']
  305. },
  306. ANY_FESTIVE_SB : {
  307. sort : 'best',
  308. name : ['Arctic Asiago', 'Nutmeg', 'Snowball Bocconcini', 'Festive Feta', 'Gingerbread', 'SUPER']
  309. }
  310. },
  311. trinket : {
  312. GAC_EAC : {
  313. sort : 'best',
  314. name : ['Golden Anchor', 'Empowered Anchor']
  315. },
  316. SAC_EAC : {
  317. sort : 'best',
  318. name : ['Spiked Anchor', 'Empowered Anchor']
  319. },
  320. UAC_EAC : {
  321. sort : 'best',
  322. name : ['Ultimate Anchor', 'Empowered Anchor']
  323. },
  324. 'ANCHOR_FAC/EAC' : {
  325. sort : 'best',
  326. name : ['Festive Anchor Charm', 'Empowered Anchor Charm']
  327. }
  328. }
  329. };
  330.  
  331. // == Advance User Preference Setting (End) ==
  332.  
  333.  
  334.  
  335. // WARNING - Do not modify the code below unless you know how to read and write the script.
  336.  
  337. // All global variable declaration and default value
  338. var g_strVersion = "";
  339. var g_strScriptHandler = "";
  340. var fbPlatform = false;
  341. var hiFivePlatform = false;
  342. var mhPlatform = false;
  343. var mhMobilePlatform = false;
  344. var g_strHTTP = 'http';
  345. var lastDateRecorded = new Date();
  346. var hornTime = 900;
  347. var hornTimeDelay = 0;
  348. var checkTimeDelay = 0;
  349. var isKingReward = false;
  350. var lastKingRewardSumTime;
  351. var g_nBaitQuantity = -1;
  352. var huntLocation;
  353. var currentLocation;
  354. var today = new Date();
  355. var checkTime;
  356. var hornRetryMax = 10;
  357. var hornRetry = 0;
  358. var nextActiveTime = 900;
  359. var timerInterval = 2;
  360. var checkMouseResult = null;
  361. var mouseList = [];
  362. var discharge = false;
  363. var arming = false;
  364. var g_arrArmingList = [];
  365. var kingsRewardRetry = 0;
  366. var keyKR = [];
  367. var separator = "~";
  368.  
  369. // element in page
  370. var titleElement;
  371. var nextHornTimeElement;
  372. var checkTimeElement;
  373. var kingTimeElement;
  374. var lastKingRewardSumTimeElement;
  375. var optionElement;
  376. var travelElement;
  377. var g_strHornButton = 'mousehuntHud-huntersHorn-container';
  378. var g_strCampButton = 'mousehuntHud-campButton';
  379. var isNewUI = false;
  380. var debugKR = false;
  381.  
  382. // console logging
  383. function saveToSessionStorage(){
  384. var i;
  385. var str = "";
  386. for(i=0;i<arguments.length;i++){
  387. if(!isNullOrUndefined(arguments[i]) && typeof arguments[i] === 'object'){ // if it is object
  388. str += JSON.stringify(arguments[i]);
  389. }
  390. else
  391. str += arguments[i];
  392. if(i != arguments.length-1)
  393. str += " ";
  394. }
  395. var key = "";
  396. var arrLog = [];
  397. for(i=0;i<window.sessionStorage.length;i++){
  398. key = window.sessionStorage.key(i);
  399. if(key.indexOf("Log_") > -1)
  400. arrLog.push(key);
  401. }
  402. if (arrLog.length > maxSaveLog){
  403. arrLog = arrLog.sort();
  404. var count = Math.floor(maxSaveLog / 2);
  405. for(i=0;i<count;i++)
  406. removeSessionStorage(arrLog[i]);
  407. }
  408. try{
  409. setSessionStorage("Log_" + (performance.timing.navigationStart + performance.now()), str);
  410. }
  411. catch (e){
  412. if(e.name == "QuotaExceededError"){
  413. for(i=0;i<window.sessionStorage.length;i++){
  414. key = window.sessionStorage.key(i);
  415. if(key.indexOf('Log_') > -1)
  416. removeSessionStorage(key);
  417. }
  418. saveToSessionStorage.apply(this,arguments);
  419. }
  420. }
  421. }
  422. console.plog = function(){
  423. saveToSessionStorage.apply(this,arguments);
  424. console.log.apply(console,arguments);
  425. };
  426. console.perror = function(){
  427. saveToSessionStorage.apply(this,arguments);
  428. console.error.apply(console,arguments);
  429. };
  430. console.pdebug = function(){
  431. saveToSessionStorage.apply(this,arguments);
  432. console.debug.apply(console,arguments);
  433. };
  434.  
  435. function FinalizePuzzleImageAnswer(answer){
  436. var myFrame;
  437. if (answer.length != 5) {
  438. //Get a new puzzle
  439. if (kingsRewardRetry >= kingsRewardRetryMax) {
  440. kingsRewardRetry = 0;
  441. setStorage("KingsRewardRetry", kingsRewardRetry);
  442. var strTemp = 'Max ' + kingsRewardRetryMax + 'retries. Pls solve it manually ASAP.';
  443. alert(strTemp);
  444. displayTimer(strTemp, strTemp, strTemp);
  445. console.perror(strTemp);
  446. return;
  447. }
  448. else {
  449. ++kingsRewardRetry;
  450. setStorage("KingsRewardRetry", kingsRewardRetry);
  451. var tagName = document.getElementsByTagName("a");
  452. for (var i = 0; i < tagName.length; i++){
  453. if (tagName[i].innerText == "Click here to get a new one!"){
  454. fireEvent(tagName[i], 'click');
  455. if(isNewUI){
  456. myFrame = document.getElementById('myFrame');
  457. if(!isNullOrUndefined(myFrame))
  458. document.body.removeChild(myFrame);
  459. window.setTimeout(function () { CallKRSolver(); }, 6000);
  460. }
  461. return;
  462. }
  463. }
  464. }
  465. }
  466. else {
  467. //Submit answer
  468. var puzzleAns = document.getElementById("puzzle_answer");
  469. if (isNewUI) puzzleAns = document.getElementsByClassName("mousehuntPage-puzzle-form-code")[0];
  470. if (!puzzleAns){
  471. console.plog("puzzleAns:", puzzleAns);
  472. return;
  473. }
  474. puzzleAns.value = "";
  475. puzzleAns.value = answer.toLowerCase();
  476. var puzzleSubmit = document.getElementById("puzzle_submit");
  477. if (isNewUI) puzzleSubmit = document.getElementsByClassName("mousehuntPage-puzzle-form-code-button")[0];
  478. if (!puzzleSubmit){
  479. console.plog("puzzleSubmit:", puzzleSubmit);
  480. return;
  481. }
  482.  
  483. fireEvent(puzzleSubmit, 'click');
  484. kingsRewardRetry = 0;
  485. setStorage("KingsRewardRetry", kingsRewardRetry);
  486. myFrame = document.getElementById('myFrame');
  487. if (myFrame)
  488. document.body.removeChild(myFrame);
  489. window.setTimeout(function () { CheckKRAnswerCorrectness(); }, 5000);
  490. }
  491. }
  492.  
  493. function receiveMessage(event)
  494. {
  495. if(!debugKR && !isAutoSolve)
  496. return;
  497.  
  498. console.plog("Event origin:", event.origin);
  499. if (event.origin.indexOf("mhcdn") > -1 || event.origin.indexOf("mousehuntgame") > -1 || event.origin.indexOf("dropbox") > -1){
  500. if (event.data.indexOf("~") > -1){
  501. var result = event.data.substring(0, event.data.indexOf("~"));
  502. if (saveKRImage){
  503. var processedImg = event.data.substring(event.data.indexOf("~") + 1, event.data.length);
  504. var strKR = "KR" + separator;
  505. strKR += Date.now() + separator;
  506. strKR += result + separator;
  507. strKR += "RETRY" + kingsRewardRetry;
  508. try{
  509. setStorage(strKR, processedImg);
  510. }
  511. catch (e){
  512. console.perror('receiveMessage',e.message);
  513. }
  514. }
  515. FinalizePuzzleImageAnswer(result);
  516. }
  517. else if(event.data.indexOf("#")>-1){
  518. var value = event.data.substring(1, event.data.length);
  519. setStorage("krCallBack",value);
  520. }
  521. else if(event.data.indexOf('Log_')>-1)
  522. console.plog(event.data.split('_')[1]);
  523. else if(event.data.indexOf('MHAKRS_')>-1){
  524. var temp = event.data.split('_');
  525. console.plog(temp[0], temp[1]);
  526. setStorage(temp[0], temp[1]);
  527. }
  528. }
  529. }
  530.  
  531. window.addEventListener("message", receiveMessage, false);
  532. if (debugKR)
  533. CallKRSolver();
  534.  
  535. var getMapPort;
  536. try{
  537. if(!isNullOrUndefined(chrome.runtime.id)){
  538. g_strScriptHandler = "Extensions";
  539. g_strVersion = chrome.runtime.getManifest().version;
  540. getMapPort = chrome.runtime.connect({name: 'map'});
  541. getMapPort.onMessage.addListener(function(msg) {
  542. console.log(msg);
  543. if(msg.array.length > 0)
  544. checkCaughtMouse(msg.obj, msg.array);
  545. });
  546. }
  547. else{
  548. g_strScriptHandler = GM_info.scriptHandler + " " + GM_info.version;
  549. g_strVersion = GM_info.script.version;
  550. }
  551. }
  552. catch (e){
  553. console.perror('Before exeScript',e.message);
  554. getMapPort = undefined;
  555. g_strVersion = undefined;
  556. g_strScriptHandler = undefined;
  557. }
  558.  
  559. exeScript();
  560.  
  561. function exeScript() {
  562. console.plog("exeScript() Start");
  563. browser = browserDetection();
  564. if (!(browser == 'opera' || browser == 'chrome')){
  565. console.plog(browser + " not supported.");
  566. console.plog("exeScript() End");
  567. return;
  568. }
  569. setStorage('MHAB', g_strVersion);
  570. setStorage('ScriptHandler', g_strScriptHandler);
  571. // check the trap check setting first
  572. trapCheckTimeDiff = GetTrapCheckTime();
  573.  
  574. if (trapCheckTimeDiff == 60)
  575. trapCheckTimeDiff = 0;
  576. else if (trapCheckTimeDiff < 0 || trapCheckTimeDiff > 60) {
  577. // invalid value, just disable the trap check
  578. enableTrapCheck = false;
  579. }
  580.  
  581. if (showTimerInTitle) {
  582. // check if they are running in iFrame
  583. var contentElement = undefined;
  584. var breakFrameDivElement = undefined;
  585. if (window.location.href.indexOf("apps.facebook.com/mousehunt/") != -1) {
  586. contentElement = document.getElementById('pagelet_canvas_content');
  587. if (contentElement) {
  588. breakFrameDivElement = document.createElement('div');
  589. breakFrameDivElement.setAttribute('id', 'breakFrameDivElement');
  590. 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";
  591. contentElement.parentNode.insertBefore(breakFrameDivElement, contentElement);
  592. }
  593. contentElement = undefined;
  594. }
  595. else if (window.location.href.indexOf("hi5.com/friend/games/MouseHunt") != -1) {
  596. contentElement = document.getElementById('apps-canvas-body');
  597. if (contentElement) {
  598. breakFrameDivElement = document.createElement('div');
  599. breakFrameDivElement.setAttribute('id', 'breakFrameDivElement');
  600. 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";
  601. contentElement.parentNode.insertBefore(breakFrameDivElement, contentElement);
  602. }
  603. contentElement = undefined;
  604. }
  605. }
  606.  
  607. // check user running this script from where
  608. if (window.location.href.indexOf("mousehuntgame.com/canvas/") != -1) {
  609. // from facebook
  610. fbPlatform = true;
  611. setStorage('Platform', 'FB');
  612. }
  613. else if (window.location.href.indexOf("mousehuntgame.com") != -1) {
  614. // need to check if it is running in mobile version
  615. var version = getCookie("switch_to");
  616. if (version !== null && version == "mobile") {
  617. // from mousehunt game mobile version
  618. mhMobilePlatform = true;
  619. setStorage('Platform', 'MHMobile');
  620. }
  621. else {
  622. // from mousehunt game standard version
  623. mhPlatform = true;
  624. setStorage('Platform', 'MH');
  625. }
  626. version = undefined;
  627. }
  628. else if (window.location.href.indexOf("mousehunt.hi5.hitgrab.com") != -1) {
  629. // from hi5
  630. hiFivePlatform = true;
  631. setStorage('Platform', 'Hi5');
  632. }
  633.  
  634. // check if user running in https secure connection
  635. var bSecureConnection = (window.location.href.indexOf("https://") > -1);
  636. g_strHTTP = (bSecureConnection) ? 'https' : 'http';
  637. setStorage('HTTPS', bSecureConnection);
  638.  
  639. if (fbPlatform) {
  640. // alert("This script doesnt work under Facebook MH at this moment");
  641. // return;
  642. if (window.location.href == "http://www.mousehuntgame.com/canvas/" ||
  643. window.location.href == "http://www.mousehuntgame.com/canvas/#" ||
  644. window.location.href == "https://www.mousehuntgame.com/canvas/" ||
  645. window.location.href == "https://www.mousehuntgame.com/canvas/#" ||
  646. window.location.href.indexOf("mousehuntgame.com/canvas/index.php") != -1 ||
  647. window.location.href.indexOf("mousehuntgame.com/canvas/turn.php") != -1 ||
  648. window.location.href.indexOf("mousehuntgame.com/canvas/?newpuzzle") != -1 ||
  649. window.location.href.indexOf("mousehuntgame.com/canvas/?") != -1) {
  650. // page to execute the script!
  651.  
  652. // make sure all the preference already loaded
  653. loadPreferenceSettingFromStorage();
  654.  
  655. // this is the page to execute the script
  656. if (!checkIntroContainer() && retrieveDataFirst()) {
  657. // embed a place where timer show
  658. embedTimer(true);
  659.  
  660. // embed script to horn button
  661. embedScript();
  662.  
  663. // start script action
  664. action();
  665. }
  666. else {
  667. // fail to retrieve data, display error msg and reload the page
  668. document.title = "Fail to retrieve data from page. Reloading in " + timeFormat(errorReloadTime);
  669. window.setTimeout(function () { reloadPage(false); }, errorReloadTime * 1000);
  670. }
  671. }
  672. else {
  673. // not in huntcamp, just show the title of autobot version
  674. embedTimer(false);
  675. }
  676. }
  677. else if (mhPlatform) {
  678. if (window.location.href == "http://www.mousehuntgame.com/" ||
  679. window.location.href == "http://www.mousehuntgame.com/#" ||
  680. window.location.href == "http://www.mousehuntgame.com/?switch_to=standard" ||
  681. window.location.href == "https://www.mousehuntgame.com/" ||
  682. window.location.href == "https://www.mousehuntgame.com/#" ||
  683. window.location.href == "https://www.mousehuntgame.com/?switch_to=standard" ||
  684. window.location.href == "https://www.mousehuntgame.com/index.php" ||
  685. window.location.href == "https://www.mousehuntgame.com/camp.php" ||
  686. window.location.href.indexOf("mousehuntgame.com/index.php") >= 0 ||
  687. window.location.href.indexOf("mousehuntgame.com/camp.php") >= 0) {
  688. // page to execute the script!
  689.  
  690. // make sure all the preference already loaded
  691. loadPreferenceSettingFromStorage();
  692.  
  693. // this is the page to execute the script
  694. if (!checkIntroContainer() && retrieveDataFirst()) {
  695. // embed a place where timer show
  696. embedTimer(true);
  697.  
  698. // embed script to horn button
  699. embedScript();
  700.  
  701. // start script action
  702. action();
  703. }
  704. else {
  705. // fail to retrieve data, display error msg and reload the page
  706. document.title = "Fail to retrieve data from page. Reloading in " + timeFormat(errorReloadTime);
  707. window.setTimeout(function () { reloadPage(false); }, errorReloadTime * 1000);
  708. }
  709. }
  710. else {
  711. // not in huntcamp, just show the title of autobot version
  712. embedTimer(false);
  713. }
  714. }
  715. else if (mhMobilePlatform) {
  716. // execute at all page of mobile version
  717. // page to execute the script!
  718.  
  719. // make sure all the preference already loaded
  720. loadPreferenceSettingFromStorage();
  721.  
  722. // embed a place where timer show
  723. embedTimer(false);
  724. }
  725. else if (hiFivePlatform) {
  726. if (window.location.href == "http://mousehunt.hi5.hitgrab.com/#" ||
  727. window.location.href.indexOf("http://mousehunt.hi5.hitgrab.com/?") != -1 ||
  728. window.location.href == "http://mousehunt.hi5.hitgrab.com/" ||
  729. window.location.href.indexOf("http://mousehunt.hi5.hitgrab.com/turn.php") != -1 ||
  730. window.location.href.indexOf("http://mousehunt.hi5.hitgrab.com/?newpuzzle") != -1 ||
  731. window.location.href.indexOf("http://mousehunt.hi5.hitgrab.com/index.php") != -1) {
  732. // page to execute the script!
  733.  
  734. // make sure all the preference already loaded
  735. loadPreferenceSettingFromStorage();
  736.  
  737. // this is the page to execute the script
  738. if (!checkIntroContainer() && retrieveDataFirst()) {
  739. // embed a place where timer show
  740. embedTimer(true);
  741.  
  742. // embed script to horn button
  743. embedScript();
  744.  
  745. // start script action
  746. action();
  747. }
  748. else {
  749. // fail to retrieve data, display error msg and reload the page
  750. document.title = "Fail to retrieve data from page. Reloading in " + timeFormat(errorReloadTime);
  751. window.setTimeout(function () { reloadPage(false); }, errorReloadTime * 1000);
  752. }
  753. }
  754. else {
  755. // not in huntcamp, just show the title of autobot version
  756. embedTimer(false);
  757. }
  758. }
  759. console.plog("exeScript() End");
  760. }
  761.  
  762. function GetTrapCheckTime(){
  763. try {
  764. var passiveElement = document.getElementsByClassName('passive');
  765. if (passiveElement.length > 0) {
  766. var time = passiveElement[0].textContent;
  767. time = time.substr(time.indexOf('m -') - 4, 2);
  768. setStorage("TrapCheckTimeOffset", time);
  769. return parseInt(time);
  770. }
  771. else throw new Error('passiveElement not found');
  772. }
  773. catch (e) {
  774. console.perror('GetTrapCheckTime',e.message);
  775. var tempStorage = getStorage('TrapCheckTimeOffset');
  776. if (isNullOrUndefined(tempStorage)) {
  777. tempStorage = 0;
  778. setStorage("TrapCheckTimeOffset", tempStorage);
  779. }
  780. return parseInt(tempStorage);
  781. }
  782. }
  783.  
  784. function checkIntroContainer() {
  785. var gotIntroContainerDiv = false;
  786.  
  787. var introContainerDiv = document.getElementById('introContainer');
  788. if (introContainerDiv) {
  789. introContainerDiv = undefined;
  790. gotIntroContainerDiv = true;
  791. }
  792. else {
  793. gotIntroContainerDiv = false;
  794. }
  795.  
  796. try {
  797. return (gotIntroContainerDiv);
  798. }
  799. finally {
  800. gotIntroContainerDiv = undefined;
  801. }
  802. }
  803.  
  804. function notifyMe(notice, icon, body) {
  805. // Let's check if the browser supports notifications
  806. if (!("Notification" in window)) {
  807. alert("This browser does not support desktop notification");
  808. }
  809.  
  810. // Let's check if the user is okay to get some notification
  811. else if (Notification.permission === "granted") {
  812. // If it's okay let's create a notification
  813. var notification = new Notification(notice, { 'icon': icon, 'body': body});
  814. }
  815. // Otherwise, we need to ask the user for permission
  816. // Note, Chrome does not implement the permission static property
  817. // So we have to check for NOT 'denied' instead of 'default'
  818. else if (Notification.permission !== 'denied')
  819. {
  820. Notification.requestPermission(function (permission)
  821. {
  822. // Whatever the user answers, we make sure we store the information
  823. if(!('permission' in Notification)) {
  824. Notification.permission = permission;
  825. }
  826.  
  827. // If the user is okay, let's create a notification
  828. if (permission === "granted") {
  829. var notification = new Notification(notice, { 'icon': icon, 'body': body});
  830. }
  831. });
  832. }
  833. }
  834.  
  835. function getJournalDetail(){
  836. var strLastRecordedJournal = getStorageToVariableStr('LastRecordedJournal', '');
  837. var classJournal = document.getElementsByClassName('journaltext');
  838. var i, j, eleA, strTrap, temp, nIndexStart, nIndexEnd, nIndexCharm, nIndexCheese;
  839. var objResave ={
  840. trinket : false,
  841. bait : false
  842. };
  843. for(i=0;i<classJournal.length;i++){
  844. if(classJournal[i].parentNode.textContent == strLastRecordedJournal)
  845. break;
  846.  
  847. eleA = classJournal[i].getElementsByTagName('a');
  848. if(eleA.length > 0){ // has loot(s)
  849. for(j=0;j<eleA.length;j++){
  850. strTrap = '';
  851. temp = eleA[j].textContent;
  852. if(temp.indexOf('Charm') > -1){
  853. strTrap = 'trinket';
  854. temp = temp.replace(/Charms/, 'Charm');
  855. }
  856. else if(temp.indexOf('Cheese') > -1)
  857. strTrap = 'bait';
  858. temp = temp.replace(/\d+/, '');
  859. temp = temp.trimLeft();
  860. if(strTrap !== '' && objTrapList[strTrap].indexOf(temp) < 0){
  861. console.plog('Add', temp, 'into', strTrap, 'list');
  862. objTrapList[strTrap].unshift(temp);
  863. objResave[strTrap] = true;
  864. }
  865. }
  866. }
  867. else{
  868. nIndexStart = -1;
  869. temp = classJournal[i].textContent.replace(/\./, '');
  870. temp = temp.replace(/Charms/, 'Charm');
  871. temp = temp.split(' ');
  872. if(classJournal[i].textContent.indexOf('crafted') > -1){
  873. nIndexStart = temp.indexOf('crafted');
  874. if(nIndexStart > -1)
  875. nIndexStart += 2;
  876. }
  877. else if(classJournal[i].textContent.indexOf('purchased') > -1){
  878. nIndexStart = temp.indexOf('purchased');
  879. if(nIndexStart > -1)
  880. nIndexStart += 2;
  881. }
  882. if(nIndexStart > -1){
  883. strTrap = '';
  884. nIndexEnd = -1;
  885. nIndexCharm = temp.indexOf('Charm');
  886. nIndexCheese = temp.indexOf('Cheese');
  887. if(nIndexCharm > -1){
  888. strTrap = 'trinket';
  889. nIndexEnd = nIndexCharm + 1;
  890. }
  891. else if(nIndexCheese > -1){
  892. strTrap = 'bait';
  893. nIndexEnd = nIndexCheese + 1;
  894. }
  895. if(strTrap !== '' && nIndexEnd > -1){
  896. temp = temp.slice(nIndexStart, nIndexEnd);
  897. temp = temp.join(' ');
  898. if(temp !== '' && objTrapList[strTrap].indexOf(temp) < 0){
  899. console.plog('Add', temp, 'into', strTrap, 'list');
  900. objTrapList[strTrap].unshift(temp);
  901. objResave[strTrap] = true;
  902. }
  903. }
  904. }
  905. }
  906. }
  907. for (var prop in objResave) {
  908. if(objResave.hasOwnProperty(prop) && objResave[prop] === true)
  909. setStorage("TrapList" + capitalizeFirstLetter(prop), objTrapList[prop].join(","));
  910. }
  911. setStorage('LastRecordedJournal', classJournal[0].parentNode.textContent);
  912. }
  913.  
  914. function getJournalDetailFRift(){
  915. if(g_arrHeirloom.length != 3)
  916. return;
  917. var strLastRecordedJournal = getStorageToVariableStr('LastRecordedJournalFRift', '');
  918. var classJournal = document.getElementsByClassName('journaltext');
  919. var i, j, eleA, temp, nIndex;
  920. for(i=0;i<classJournal.length;i++){
  921. if(classJournal[i].parentNode.textContent == strLastRecordedJournal)
  922. break;
  923. eleA = classJournal[i].getElementsByTagName('a');
  924. if(eleA.length > 0){ // has loot(s)
  925. for(j=0;j<eleA.length;j++){
  926. temp = eleA[j].textContent;
  927. if(temp.indexOf('Chi Belt Heirloom') > -1)
  928. nIndex = 0;
  929. else if(temp.indexOf('Chi Fang Heirloom') > -1)
  930. nIndex = 1;
  931. else if(temp.indexOf('Chi Claw Heirloom') > -1)
  932. nIndex = 2;
  933. else
  934. nIndex = -1;
  935. if(nIndex > -1)
  936. g_arrHeirloom[nIndex]++;
  937. }
  938. }
  939. }
  940. setStorage('LastRecordedJournalFRift', classJournal[0].parentNode.textContent);
  941. }
  942.  
  943. function specialFeature(caller){
  944. return;
  945. var strSpecial = getStorageToVariableStr("SpecialFeature", "None");
  946. console.plog('Special Selected:', strSpecial, 'Call From:', caller);
  947. switch (strSpecial) {
  948. case 'PILLOWCASE':
  949. magicalPillowcase(); break;
  950. default:
  951. break;
  952. }
  953. }
  954.  
  955. function eventLocationCheck(caller) {
  956. var selAlgo = getStorageToVariableStr("eventLocation", "None");
  957. var temp = "";
  958. switch (selAlgo){
  959. case 'Charge Egg 2015':
  960. checkCharge(12); break;
  961. case 'Charge Egg 2015(17)':
  962. checkCharge(17); break;
  963. case 'Charge Egg 2016 Medium + High':
  964. checkCharge2016(chargeMedium); break;
  965. case 'Charge Egg 2016 High':
  966. checkCharge2016(chargeHigh); break;
  967. case 'Burroughs Rift(Red)':
  968. BurroughRift(true, 19, 20); break;
  969. case 'Burroughs Rift(Green)':
  970. BurroughRift(true, 6, 18); break;
  971. case 'Burroughs Rift(Yellow)':
  972. BurroughRift(true, 1, 5); break;
  973. case 'Burroughs Rift Custom':
  974. BRCustom(); break;
  975. case 'Halloween 2016':
  976. Halloween2016(); break;
  977. case 'Halloween 2018':
  978. Halloween2018(); break;
  979. case 'Iceberg':
  980. iceberg(); break;
  981. case 'WWRift':
  982. wwrift(); break;
  983. case 'GES':
  984. ges(); break;
  985. case 'GWH2016R':
  986. gwh(); break;
  987. case 'All LG Area':
  988. var objLGTemplate = {
  989. isAutoFill : false,
  990. isAutoPour : false,
  991. maxSaltCharged : 25,
  992. base : {
  993. before : '',
  994. after : ''
  995. },
  996. trinket : {
  997. before : '',
  998. after : ''
  999. },
  1000. bait : {
  1001. before : '',
  1002. after : ''
  1003. }
  1004. };
  1005. var objDefaultLG = {
  1006. LG : JSON.parse(JSON.stringify(objLGTemplate)),
  1007. TG : JSON.parse(JSON.stringify(objLGTemplate)),
  1008. LC : JSON.parse(JSON.stringify(objLGTemplate)),
  1009. CC : JSON.parse(JSON.stringify(objLGTemplate)),
  1010. SD : JSON.parse(JSON.stringify(objLGTemplate)),
  1011. SC : JSON.parse(JSON.stringify(objLGTemplate)),
  1012. };
  1013. temp = getStorageToObject("LGArea", objDefaultLG);
  1014. LGGeneral(temp);
  1015. break;
  1016. case 'SG':
  1017. seasonalGarden(); break;
  1018. case 'ZT':
  1019. zugzwangTower(); break;
  1020. case 'Sunken City':
  1021. SunkenCity(false); break;
  1022. case 'Sunken City Aggro':
  1023. SunkenCity(true); break;
  1024. case 'Sunken City Custom':
  1025. SCCustom(); break;
  1026. case 'Labyrinth':
  1027. labyrinth(); break;
  1028. case 'Zokor':
  1029. zokor(); break;
  1030. case 'Fiery Warpath':
  1031. fw(); break;
  1032. case 'Furoma Rift':
  1033. fRift(); break;
  1034. case 'BC/JOD':
  1035. balackCoveJOD(); break;
  1036. case 'FG/AR':
  1037. forbiddenGroveAR(); break;
  1038. case 'Bristle Woods Rift':
  1039. bwRift(); break;
  1040. case 'Fort Rox':
  1041. fortRox(); break;
  1042. case 'Test':
  1043. checkThenArm('any', 'bait', ['Gouda', 'Brie']);
  1044. break;
  1045. default:
  1046. break;
  1047. }
  1048. }
  1049.  
  1050. function mapHunting(){
  1051. var objDefaultMapHunting = {
  1052. status : false,
  1053. selectedMouse : [],
  1054. logic : 'OR',
  1055. weapon : 'Remain',
  1056. base : 'Remain',
  1057. trinket : 'Remain',
  1058. bait : 'Remain',
  1059. leave : false
  1060. };
  1061. var objMapHunting = getStorageToObject('MapHunting', objDefaultMapHunting);
  1062. var strViewState = getPageVariable('user.quests.QuestRelicHunter.view_state');
  1063. var bHasMap = (strViewState == 'hasMap' || strViewState == 'hasReward');
  1064. if(!objMapHunting.status || !bHasMap || objMapHunting.selectedMouse.length === 0)
  1065. return;
  1066.  
  1067. checkCaughtMouse(objMapHunting);
  1068. }
  1069.  
  1070. function checkCaughtMouse(obj, arrUpdatedUncaught){
  1071. var arrUncaughtMouse = [];
  1072. if(!(Array.isArray(arrUpdatedUncaught)))
  1073. arrUpdatedUncaught = [];
  1074.  
  1075. var bHasReward = (getPageVariable('user.quests.QuestRelicHunter.view_state') == 'hasReward');
  1076. if(!bHasReward && arrUpdatedUncaught.length === 0){
  1077. var nRemaining = -1;
  1078. var classTreasureMap = document.getElementsByClassName('mousehuntHud-userStat treasureMap')[0];
  1079. if(classTreasureMap.children[2].textContent.toLowerCase().indexOf('remaining') > -1)
  1080. nRemaining = parseInt(classTreasureMap.children[2].textContent);
  1081.  
  1082. if(Number.isNaN(nRemaining) || nRemaining == -1)
  1083. return;
  1084.  
  1085. var temp = getStorageToVariableStr('Last Record Uncaught', null);
  1086. if(!isNullOrUndefined(temp))
  1087. arrUncaughtMouse = temp.split(",");
  1088.  
  1089. if(arrUncaughtMouse.length != nRemaining){
  1090. // get updated uncaught mouse list
  1091. arrUncaughtMouse = [];
  1092. var objData = {
  1093. sn : 'Hitgrab',
  1094. hg_is_ajax : 1,
  1095. action : 'info',
  1096. uh : getPageVariable('user.unique_hash')
  1097. };
  1098. if(isNullOrUndefined(getMapPort)){
  1099. // direct call jquery
  1100. ajaxPost(window.location.origin + '/managers/ajax/users/relichunter.php', objData, function (data){
  1101. console.log(data.treasure_map);
  1102. if(!isNullOrUndefined(data.treasure_map.groups)){
  1103. var arrUncaught = [];
  1104. for(var i=0;i<data.treasure_map.groups.length;i++){
  1105. if(data.treasure_map.groups[i].is_uncaught === true){
  1106. for(var j=0;j<data.treasure_map.groups[i].mice.length;j++){
  1107. arrUncaught.push(data.treasure_map.groups[i].mice[j].name);
  1108. }
  1109. }
  1110. }
  1111. if(arrUncaught.length > 0)
  1112. checkCaughtMouse(obj, arrUncaught);
  1113. }
  1114. }, function (error){
  1115. console.error('ajax:',error);
  1116. });
  1117. }
  1118. else{
  1119. getMapPort.postMessage({
  1120. request: "getUncaught",
  1121. data: objData,
  1122. url: window.location.origin + '/managers/ajax/users/relichunter.php',
  1123. objMapHunting : obj
  1124. });
  1125. }
  1126. return;
  1127. }
  1128. }
  1129. else{
  1130. if(bHasReward)
  1131. setStorage('Last Record Uncaught', '');
  1132. else
  1133. setStorage('Last Record Uncaught', arrUpdatedUncaught.join(","));
  1134. arrUncaughtMouse = arrUpdatedUncaught.slice();
  1135. }
  1136.  
  1137. console.plog('Uncaught:', arrUncaughtMouse);
  1138. var i;
  1139. var bChangeTrap = false;
  1140. var bCanLeave = false;
  1141. var arrIndex = [];
  1142. for(i=0;i<obj.selectedMouse.length;i++){
  1143. arrIndex.push(arrUncaughtMouse.indexOf(obj.selectedMouse[i]));
  1144. }
  1145. if(obj.logic == 'AND'){
  1146. bChangeTrap = (countArrayElement(-1, arrIndex) == arrIndex.length || bHasReward);
  1147. }
  1148. else{
  1149. bChangeTrap = (countArrayElement(-1, arrIndex) > 0 || bHasReward);
  1150. }
  1151.  
  1152. bCanLeave = !bHasReward && bChangeTrap;
  1153. if(bChangeTrap){
  1154. for(i=arrIndex.length-1;i>=0;i--){
  1155. if(arrIndex[i] == -1)
  1156. obj.selectedMouse.splice(i,1);
  1157. }
  1158. setStorage('MapHunting', JSON.stringify(obj));
  1159. for (var prop in obj) {
  1160. if(obj.hasOwnProperty(prop) &&
  1161. (prop == 'weapon' || prop == 'base' || prop == 'trinket' || prop == 'bait')) {
  1162. if(obj[prop] != 'Remain'){
  1163. if(obj[prop] == 'None')
  1164. disarmTrap(prop);
  1165. else
  1166. checkThenArm(null, prop, obj[prop]);
  1167. }
  1168. }
  1169. }
  1170. }
  1171.  
  1172. if(bCanLeave && obj.leave){
  1173. var objData = {
  1174. sn : 'Hitgrab',
  1175. hg_is_ajax : 1,
  1176. action : 'discard',
  1177. uh : getPageVariable('user.unique_hash')
  1178. };
  1179. if(isNullOrUndefined(getMapPort)){
  1180. // direct call jquery
  1181. ajaxPost(window.location.origin + '/managers/ajax/users/relichunter.php', objData, function (data){
  1182. console.plog('Map discarded');
  1183. }, function (error){
  1184. console.perror('ajax discard:',error);
  1185. });
  1186. }
  1187. else{
  1188. getMapPort.postMessage({
  1189. request: "discard",
  1190. data: objData,
  1191. url: window.location.origin + '/managers/ajax/users/relichunter.php',
  1192. });
  1193. }
  1194. }
  1195. }
  1196.  
  1197. function GetCurrentLocation(){
  1198. var loc = getPageVariable('user.environment_name');
  1199. console.plog('Current Location:', loc);
  1200. return loc;
  1201. }
  1202.  
  1203. function bwRift(){
  1204. if (GetCurrentLocation().indexOf("Bristle Woods Rift") < 0)
  1205. return;
  1206.  
  1207. var objDefaultBWRift = {
  1208. order : ['NONE','GEARWORKS','ANCIENT','RUNIC','TIMEWARP','GUARD','SECURITY','FROZEN','FURNACE','INGRESS','PURSUER','ACOLYTE_CHARGING','ACOLYTE_DRAINING','ACOLYTE_DRAINED','LUCKY','HIDDEN'],
  1209. master : {
  1210. weapon : new Array(32).fill('Mysteriously unYielding'),
  1211. base : new Array(32).fill('Fissure Base'),
  1212. trinket : new Array(32).fill('Rift Vacuum Charm'),
  1213. bait : new Array(32).fill('Brie String'),
  1214. activate : new Array(32).fill(false),
  1215. },
  1216. specialActivate : {
  1217. forceActivate : new Array(32).fill(false),
  1218. remainingLootActivate : new Array(32).fill(1),
  1219. forceDeactivate : new Array(32).fill(false),
  1220. remainingLootDeactivate : new Array(32).fill(1)
  1221. },
  1222. gw : {
  1223. weapon : new Array(4).fill('MASTER'),
  1224. base : new Array(4).fill('MASTER'),
  1225. trinket : new Array(4).fill('MASTER'),
  1226. bait : new Array(4).fill('MASTER'),
  1227. activate : new Array(4).fill('MASTER'),
  1228. },
  1229. al : {
  1230. weapon : new Array(4).fill('MASTER'),
  1231. base : new Array(4).fill('MASTER'),
  1232. trinket : new Array(4).fill('MASTER'),
  1233. bait : new Array(4).fill('MASTER'),
  1234. activate : new Array(4).fill('MASTER'),
  1235. },
  1236. rl : {
  1237. weapon : new Array(4).fill('MASTER'),
  1238. base : new Array(4).fill('MASTER'),
  1239. trinket : new Array(4).fill('MASTER'),
  1240. bait : new Array(4).fill('MASTER'),
  1241. activate : new Array(4).fill('MASTER'),
  1242. },
  1243. gb : {
  1244. weapon : new Array(14).fill('MASTER'),
  1245. base : new Array(14).fill('MASTER'),
  1246. trinket : new Array(14).fill('MASTER'),
  1247. bait : new Array(14).fill('MASTER'),
  1248. activate : new Array(14).fill('MASTER'),
  1249. },
  1250. ic : {
  1251. weapon : new Array(8).fill('MASTER'),
  1252. base : new Array(8).fill('MASTER'),
  1253. trinket : new Array(8).fill('MASTER'),
  1254. bait : new Array(8).fill('MASTER'),
  1255. activate : new Array(8).fill('MASTER'),
  1256. },
  1257. fa : {
  1258. weapon : new Array(32).fill('MASTER'),
  1259. base : new Array(32).fill('MASTER'),
  1260. trinket : new Array(32).fill('MASTER'),
  1261. bait : new Array(32).fill('MASTER'),
  1262. activate : new Array(32).fill('MASTER'),
  1263. },
  1264. choosePortal : false,
  1265. choosePortalAfterCC : false,
  1266. priorities : ['SECURITY', 'FURNACE', 'PURSUER', 'ACOLYTE', 'LUCKY', 'HIDDEN', 'TIMEWARP', 'RUNIC', 'ANCIENT', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS'],
  1267. prioritiesCursed : ['SECURITY', 'FURNACE', 'PURSUER', 'ANCIENT', 'GEARWORKS', 'RUNIC', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS'],
  1268. minTimeSand : [70,70,50,50,50,50,40,40,999],
  1269. minRSCType : 'NUMBER',
  1270. minRSC : 0,
  1271. enterMinigameWCurse : false
  1272. };
  1273.  
  1274. var objBWRift = getStorageToObject('BWRift', objDefaultBWRift);
  1275. var objUser = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestRiftBristleWoods)'));
  1276. var nIndex = -1;
  1277. var nLootRemaining = objUser.progress_remaining;
  1278. var nTimeSand = parseInt(objUser.items.rift_hourglass_sand_stat_item.quantity);
  1279. var strChamberName = objUser.chamber_name.split(' ')[0].toUpperCase();
  1280. var strTestName = objUser.chamber_name.toUpperCase();
  1281. if(strTestName.indexOf('LUCK') > -1)
  1282. strChamberName = 'LUCKY';
  1283. if(strChamberName == 'ACOLYTE'){ // in Acolyte Chamber
  1284. var strStatus;
  1285. if(objUser.minigame.acolyte_chamber.obelisk_charge < 100){
  1286. strStatus = 'ACOLYTE_CHARGING';
  1287. nLootRemaining = 100 - objUser.minigame.acolyte_chamber.obelisk_charge;
  1288. }
  1289. else if(objUser.minigame.acolyte_chamber.acolyte_sand > 0){
  1290. strStatus = 'ACOLYTE_DRAINING';
  1291. nLootRemaining = Number.MAX_SAFE_INTEGER;
  1292. }
  1293. else{
  1294. strStatus = 'ACOLYTE_DRAINED';
  1295. nLootRemaining = Number.MAX_SAFE_INTEGER;
  1296. }
  1297. console.plog('Status:',strStatus,'Obelisk:',objUser.minigame.acolyte_chamber.obelisk_charge,'Acolyte Sand:',objUser.minigame.acolyte_chamber.acolyte_sand);
  1298. nIndex = objBWRift.order.indexOf(strStatus);
  1299. }
  1300. else if(strChamberName == 'RIFT')
  1301. nIndex = 0;
  1302. else{
  1303. if(nLootRemaining > 0)
  1304. nIndex = objBWRift.order.indexOf(strChamberName);
  1305. else
  1306. nIndex = 0;
  1307. }
  1308. console.plog('Status:', objUser.chamber_status, 'Name:', objUser.chamber_name, 'Shortname:', strChamberName, 'Index:', nIndex, 'Remaining Loot:', nLootRemaining, 'Time Sand:', nTimeSand);
  1309. if(nIndex < 0)
  1310. return;
  1311. var nIndexBuffCurse = 0;
  1312. if(!(objUser.status_effects.un.indexOf('default') > -1 || objUser.status_effects.un.indexOf('remove') > -1) ||
  1313. !(objUser.status_effects.fr.indexOf('default') > -1 || objUser.status_effects.fr.indexOf('remove') > -1) ||
  1314. !(objUser.status_effects.st.indexOf('default') > -1 || objUser.status_effects.st.indexOf('remove') > -1))
  1315. nIndexBuffCurse = 8;
  1316. else{
  1317. if(objUser.status_effects.ng.indexOf('default') < 0)
  1318. nIndexBuffCurse |= 0x04;
  1319. if(objUser.status_effects.ac.indexOf('default') < 0)
  1320. nIndexBuffCurse |= 0x02;
  1321. if(objUser.status_effects.ex.indexOf('default') < 0)
  1322. nIndexBuffCurse |= 0x01;
  1323. }
  1324. console.plog('Buff & Curse Index:', nIndexBuffCurse, 'Obj:', objUser.status_effects);
  1325. if(nIndex === 0 || objUser.chamber_status == 'open'){
  1326. var classPortalContainer = document.getElementsByClassName('riftBristleWoodsHUD-portalContainer');
  1327. if(classPortalContainer.length > 0){
  1328. var objPortal = {
  1329. arrName : new Array(classPortalContainer[0].children.length).fill(''),
  1330. arrIndex : new Array(classPortalContainer[0].children.length).fill(Number.MAX_SAFE_INTEGER)
  1331. };
  1332. var i,j;
  1333. var arrPriorities = (nIndexBuffCurse == 8) ? objBWRift.prioritiesCursed : objBWRift.priorities;
  1334. var nIndexCustom = -1;
  1335. for(i=0;i<arrPriorities.length;i++){
  1336. if(arrPriorities[i].indexOf('AL/RL') > -1){
  1337. nIndexCustom = i;
  1338. break;
  1339. }
  1340. }
  1341. for(i=0;i<objPortal.arrName.length;i++){
  1342. objPortal.arrName[i] = classPortalContainer[0].children[i].getElementsByClassName('riftBristleWoodsHUD-portal-name')[0].textContent;
  1343. strTestName = objPortal.arrName[i].toUpperCase();
  1344. if(strTestName.indexOf('LUCK') > -1)
  1345. objPortal.arrName[i] = 'LUCKY';
  1346. else if(strTestName.indexOf('HIDDEN') > -1 || strTestName.indexOf('TREASUR') > -1)
  1347. objPortal.arrName[i] = 'HIDDEN';
  1348. objPortal.arrName[i] = objPortal.arrName[i].split(' ')[0].toUpperCase();
  1349. objPortal.arrIndex[i] = arrPriorities.indexOf(objPortal.arrName[i]);
  1350. if(nIndexCustom > -1 && (objPortal.arrName[i] == 'ANCIENT' || objPortal.arrName[i] == 'RUNIC')){
  1351. if(objPortal.arrIndex[i] < 0 || nIndexCustom < objPortal.arrIndex[i])
  1352. objPortal.arrIndex[i] = nIndexCustom;
  1353. }
  1354. if(objPortal.arrIndex[i] < 0)
  1355. objPortal.arrIndex[i] = Number.MAX_SAFE_INTEGER;
  1356. }
  1357. console.plog(objPortal);
  1358. if(objBWRift.choosePortal){
  1359. if(nIndex === 0 || (nIndex > 0 && objUser.chamber_status == 'open' && objBWRift.choosePortalAfterCC)){
  1360. var nIndexOld = nIndex;
  1361. var arrIndices = [];
  1362. var nRSCPot = parseInt(objUser.items.runic_string_cheese_potion.quantity);
  1363. var nRSC = parseInt(objUser.items.runic_string_cheese.quantity);
  1364. var nTotalRSC = nRSC+nRSCPot*2;
  1365. var nIndexTemp = objPortal.arrName.indexOf('ACOLYTE');
  1366. if(nIndexTemp > -1){
  1367. if(!Number.isInteger(nTotalRSC))
  1368. nTotalRSC = Number.MAX_SAFE_INTEGER;
  1369. console.plog('RSC Pot:', nRSCPot, 'RSC:', nRSC, 'Total RSC:', nTotalRSC);
  1370. var nMinRSC = -1;
  1371. if(objBWRift.minRSCType == 'NUMBER')
  1372. nMinRSC = objBWRift.minRSC;
  1373. else if(objBWRift.minRSCType == 'GEQ')
  1374. nMinRSC = objBWRift.minTimeSand[nIndexBuffCurse];
  1375. if(nTotalRSC < nMinRSC || nTimeSand < objBWRift.minTimeSand[nIndexBuffCurse]){
  1376. arrIndices = getAllIndices(objPortal.arrName, 'ACOLYTE');
  1377. for(i=0;i<arrIndices.length;i++)
  1378. objPortal.arrIndex[arrIndices[i]] = Number.MAX_SAFE_INTEGER;
  1379. }
  1380. }
  1381. var arrTemp = ['TIMEWARP', 'GUARD'];
  1382. for(i=0;i<arrTemp.length;i++){
  1383. nIndexTemp = objPortal.arrName.indexOf(arrTemp[i]);
  1384. if(nIndexTemp > -1 && nTimeSand >= objBWRift.minTimeSand[nIndexBuffCurse]){
  1385. arrIndices = getAllIndices(objPortal.arrName, arrTemp[i]);
  1386. for(j=0;j<arrIndices.length;j++)
  1387. objPortal.arrIndex[arrIndices[j]] = Number.MAX_SAFE_INTEGER;
  1388. }
  1389. }
  1390. arrTemp = ['GUARD', 'FROZEN', 'INGRESS'];
  1391. for(i=0;i<arrTemp.length;i++){
  1392. nIndexTemp = objPortal.arrName.indexOf(arrTemp[i]);
  1393. if(nIndexTemp > -1 && nIndexBuffCurse == 8 && objBWRift.enterMinigameWCurse === false){
  1394. arrIndices = getAllIndices(objPortal.arrName, arrTemp[i]);
  1395. for(j=0;j<arrIndices.length;j++)
  1396. objPortal.arrIndex[arrIndices[j]] = Number.MAX_SAFE_INTEGER;
  1397. }
  1398. }
  1399. var arrAL = getAllIndices(objPortal.arrName, 'ANCIENT');
  1400. var arrRL = getAllIndices(objPortal.arrName, 'RUNIC');
  1401. if(arrAL.length > 0 && arrRL.length > 0 && nIndexCustom > -1){
  1402. var nASCPot = parseInt(objUser.items.ancient_string_cheese_potion.quantity);
  1403. var nASC = parseInt(objUser.items.ancient_string_cheese.quantity);
  1404. var nTotalASC = nASCPot + nASC;
  1405. if(arrPriorities[nIndexCustom].indexOf('MSC') > -1)
  1406. nTotalASC += nASCPot;
  1407. console.plog('ASC Pot:', nASCPot, 'ASC:', nASC, 'Total ASC:', nTotalASC, 'RSC Pot:', nRSCPot, 'RSC:', nRSC, 'Total RSC:', nTotalRSC);
  1408. if(nTotalASC < nTotalRSC){ // ancient first
  1409. for(j=0;j<arrRL.length;j++)
  1410. objPortal.arrIndex[arrRL[j]] = Number.MAX_SAFE_INTEGER;
  1411. }
  1412. else{ // runic first
  1413. for(j=0;j<arrAL.length;j++)
  1414. objPortal.arrIndex[arrAL[j]] = Number.MAX_SAFE_INTEGER;
  1415. }
  1416. }
  1417. nIndexTemp = objPortal.arrName.indexOf('ENTER');
  1418. if(nIndexTemp > -1)
  1419. objPortal.arrIndex[nIndexTemp] = 1;
  1420. console.plog(objPortal);
  1421. var nMinIndex = minIndex(objPortal.arrIndex);
  1422. if(objPortal.arrIndex[nMinIndex] == Number.MAX_SAFE_INTEGER || classPortalContainer[0].children[nMinIndex] == 'frozen')
  1423. nIndex = nIndexOld;
  1424. else{
  1425. if(objPortal.arrName[nMinIndex] == 'ACOLYTE'){
  1426. console.plog('Chosen Portal:',objPortal.arrName[nMinIndex],'Index: Unknown');
  1427. fireEvent(classPortalContainer[0].children[nMinIndex], 'click');
  1428. window.setTimeout(function () { fireEvent(document.getElementsByClassName('mousehuntActionButton small')[1], 'click'); }, 1000);
  1429. window.setTimeout(function () { bwRift(); }, 2000);
  1430. return;
  1431. }
  1432. if(objPortal.arrName[nMinIndex] == 'ENTER')
  1433. nIndex = objBWRift.order.indexOf('GEARWORKS');
  1434. else
  1435. nIndex = objBWRift.order.indexOf(objPortal.arrName[nMinIndex]);
  1436. if(nIndex > -1){
  1437. console.plog('Chosen Portal:',objPortal.arrName[nMinIndex],'Index:', nIndex);
  1438. strChamberName = objBWRift.order[nIndex];
  1439. fireEvent(classPortalContainer[0].children[nMinIndex], 'click');
  1440. window.setTimeout(function () { fireEvent(document.getElementsByClassName('mousehuntActionButton small')[1], 'click'); }, 1000);
  1441. nLootRemaining = Number.MAX_SAFE_INTEGER;
  1442. }
  1443. else
  1444. nIndex = nIndexOld;
  1445. }
  1446. }
  1447. }
  1448. }
  1449. }
  1450. var objTemp = {
  1451. weapon : '',
  1452. base : '',
  1453. trinket : '',
  1454. bait : '',
  1455. activate : false
  1456. };
  1457. if(nIndex === 0)
  1458. strChamberName = 'NONE';
  1459. if(nIndexBuffCurse == 8)
  1460. nIndex += 16;
  1461. if(strChamberName == 'GEARWORKS' || strChamberName == 'ANCIENT' || strChamberName == 'RUNIC'){
  1462. var nCleaverAvailable = (objUser.cleaver_status == 'available') ? 1 : 0;
  1463. console.plog('Cleaver Available Status:',nCleaverAvailable);
  1464. var strTemp = '';
  1465. if(strChamberName == 'GEARWORKS')
  1466. strTemp = 'gw';
  1467. else if(strChamberName == 'ANCIENT')
  1468. strTemp = 'al';
  1469. else
  1470. strTemp = 'rl';
  1471. if(nIndexBuffCurse == 8)
  1472. nCleaverAvailable += 2;
  1473. for (var prop in objTemp) {
  1474. if(objTemp.hasOwnProperty(prop))
  1475. objTemp[prop] = (objBWRift[strTemp][prop][nCleaverAvailable] == 'MASTER') ? objBWRift.master[prop][nIndex] : objBWRift[strTemp][prop][nCleaverAvailable];
  1476. }
  1477. }
  1478. else if(strChamberName == 'GUARD'){
  1479. var nAlertLvl = (isNullOrUndefined(objUser.minigame.guard_chamber)) ? -1 : parseInt(objUser.minigame.guard_chamber.status.split("_")[1]);
  1480. console.plog('Guard Barracks Alert Lvl:',nAlertLvl);
  1481. if(Number.isNaN(nAlertLvl) || nAlertLvl < 0 || nAlertLvl > 6){
  1482. for (var prop in objTemp) {
  1483. if(objTemp.hasOwnProperty(prop))
  1484. objTemp[prop] = objBWRift.master[prop][nIndex];
  1485. }
  1486. }
  1487. else{
  1488. if(nIndexBuffCurse == 8)
  1489. nAlertLvl += 7;
  1490. for (var prop in objTemp) {
  1491. if(objTemp.hasOwnProperty(prop))
  1492. objTemp[prop] = (objBWRift.gb[prop][nAlertLvl] == 'MASTER') ? objBWRift.master[prop][nIndex] : objBWRift.gb[prop][nAlertLvl];
  1493. }
  1494. }
  1495. }
  1496. /*else if(strChamberName == 'INGRESS'){
  1497. }
  1498. else if(strChamberName == 'FROZEN'){
  1499. }*/
  1500. else{
  1501. for (var prop in objTemp) {
  1502. if(objTemp.hasOwnProperty(prop))
  1503. objTemp[prop] = objBWRift.master[prop][nIndex];
  1504. }
  1505. }
  1506.  
  1507. checkThenArm(null, 'weapon', objTemp.weapon);
  1508. checkThenArm(null, 'base', objTemp.base);
  1509. checkThenArm(null, 'trinket', objTemp.trinket);
  1510. if(objTemp.bait == 'Runic/Ancient')
  1511. checkThenArm('any', 'bait', ['Runic String Cheese', 'Ancient String Cheese']);
  1512. else if(objTemp.bait == 'Runic=>Ancient')
  1513. checkThenArm('best', 'bait', ['Runic String Cheese', 'Ancient String Cheese']);
  1514. else
  1515. checkThenArm(null, 'bait', objTemp.bait);
  1516. var classLootBooster = document.getElementsByClassName('riftBristleWoodsHUD-portalEquipment lootBooster mousehuntTooltipParent')[0];
  1517. var bPocketwatchActive = (classLootBooster.getAttribute('class').indexOf('selected') > -1);
  1518. var classButton = classLootBooster.getElementsByClassName('riftBristleWoodsHUD-portalEquipment-action')[0];
  1519. var bForce = false;
  1520. var bToggle = false;
  1521. if(objTemp.activate){
  1522. bForce = (objBWRift.specialActivate.forceDeactivate[nIndex] && nLootRemaining <= objBWRift.specialActivate.remainingLootDeactivate[nIndex]);
  1523. if(bForce === bPocketwatchActive)
  1524. bToggle = true;
  1525. }
  1526. else{
  1527. bForce = (objBWRift.specialActivate.forceActivate[nIndex] && nLootRemaining <= objBWRift.specialActivate.remainingLootActivate[nIndex]);
  1528. if(bForce !== bPocketwatchActive)
  1529. bToggle = true;
  1530. }
  1531. console.plog('QQ Activated:', bPocketwatchActive, 'Activate?:', objTemp.activate, 'Force:', bForce, 'Toggle:', bToggle);
  1532. if(bToggle){
  1533. var nRetry = 5;
  1534. var intervalPocket = setInterval( function () {
  1535. if (classLootBooster.getAttribute('class').indexOf('chamberEmpty') < 0 || --nRetry <= 0){
  1536. fireEvent(classButton, 'click');
  1537. clearInterval(intervalPocket);
  1538. intervalPocket = null;
  1539. }
  1540. }, 1000);
  1541. }
  1542. }
  1543.  
  1544. function fortRox(){
  1545. if (GetCurrentLocation().indexOf("Fort Rox") < 0)
  1546. return;
  1547.  
  1548. var objDefaultFRox = {
  1549. stage : ['DAY','stage_one','stage_two','stage_three','stage_four','stage_five','DAWN'],
  1550. order : ['DAY','TWILIGHT','MIDNIGHT','PITCH','UTTER','FIRST','DAWN'],
  1551. weapon : new Array(7).fill(''),
  1552. base : new Array(7).fill(''),
  1553. trinket : new Array(7).fill('None'),
  1554. bait : new Array(7).fill('Gouda'),
  1555. activate : new Array(7).fill(false),
  1556. fullHPDeactivate : true
  1557. };
  1558.  
  1559. var objFRox = getStorageToObject('FRox', objDefaultFRox);
  1560. var objUser = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestFortRox)'));
  1561. var nIndex = -1;
  1562. if(objUser.is_dawn === true){
  1563. nIndex = 6;
  1564. console.plog('In Dawn');
  1565. }
  1566. else if(objUser.current_phase == 'night'){
  1567. nIndex = objFRox.stage.indexOf(objUser.current_stage);
  1568. console.plog('In Night, Current Stage:', objUser.current_stage);
  1569. }
  1570. else if(objUser.current_phase == 'day'){
  1571. nIndex = 0;
  1572. console.plog('In Day');
  1573. }
  1574.  
  1575. if(nIndex < 0)
  1576. return;
  1577. checkThenArm(null, 'weapon', objFRox.weapon[nIndex]);
  1578. checkThenArm(null, 'base', objFRox.base[nIndex]);
  1579. checkThenArm(null, 'trinket', objFRox.trinket[nIndex]);
  1580. if(objFRox.bait[nIndex] == 'ANY_LUNAR')
  1581. checkThenArm('any', 'bait', ['Moon Cheese', 'Crescent Cheese']);
  1582. else if(objFRox.bait[nIndex].indexOf('=>') > -1){
  1583. var arr = objFRox.bait[nIndex].split('=>');
  1584. checkThenArm('best', 'bait', arr);
  1585. }
  1586. else
  1587. checkThenArm(null, 'bait', objFRox.bait[nIndex]);
  1588.  
  1589. var bTowerActive = !(objUser.tower_status.indexOf('inactive') > -1);
  1590. var nMana = parseInt(document.getElementsByClassName('fortRoxHUD-mana quantity')[0].textContent);
  1591. console.plog('Tower Active:', bTowerActive, 'Mana:', nMana, 'Current HP:', objUser.hp, 'Max HP:', objUser.max_hp);
  1592. if(nMana > 0 && nIndex > 0){
  1593. var classButton = document.getElementsByClassName('fortRoxHUD-spellTowerButton')[0];
  1594. if(bTowerActive){
  1595. if(objFRox.activate[nIndex]){
  1596. if(objFRox.fullHPDeactivate && objUser.hp >= objUser.max_hp){
  1597. // deactivate tower
  1598. fireEvent(classButton, 'click');
  1599. }
  1600. }
  1601. else{
  1602. //deactivate tower
  1603. fireEvent(classButton, 'click');
  1604. }
  1605. }
  1606. else{
  1607. if(objFRox.activate[nIndex]){
  1608. //activate tower
  1609. fireEvent(classButton, 'click');
  1610. }
  1611. }
  1612. }
  1613. }
  1614.  
  1615. function Halloween2016(){
  1616. if (GetCurrentLocation().indexOf("Spooky Sandcastle") < 0)
  1617. return;
  1618.  
  1619. var areaName = document.getElementsByClassName('halloweenHud-areaDetails-name')[0].innerHTML;
  1620. var warning = document.getElementsByClassName('halloweenHud-areaDetails-warning active').length;
  1621. var isWarning = (warning > 0);
  1622. var trickContainer = document.getElementsByClassName('halloweenHud-bait trick_cheese clear-block')[0];
  1623. var treatContainer = document.getElementsByClassName('halloweenHud-bait treat_cheese clear-block')[0];
  1624. var bTricking = (trickContainer.children[2].getAttribute('class') == 'armNow active');
  1625. var bTreating = (treatContainer.children[2].getAttribute('class') == 'armNow active');
  1626. console.plog('Current Area Name:', areaName, 'Warning:', isWarning, 'Tricking:', bTricking, 'Treating:', bTreating);
  1627. if(!(bTricking || bTreating))
  1628. return;
  1629. if (isWarning){
  1630. if (bTricking){
  1631. if(parseInt(treatContainer.children[1].textContent) > 0)
  1632. fireEvent(treatContainer.children[2], 'click');
  1633. else{
  1634. disarmTrap('trinket');
  1635. checkThenArm(null, 'bait', 'Brie Cheese');
  1636. }
  1637. }
  1638. else{
  1639. if(parseInt(trickContainer.children[1].textContent) > 0)
  1640. fireEvent(trickContainer.children[2], 'click');
  1641. else{
  1642. disarmTrap('trinket');
  1643. checkThenArm(null, 'bait', 'Brie Cheese');
  1644. }
  1645. }
  1646. }
  1647. else{
  1648. var i;
  1649. var nSquareMin = 0;
  1650. var classContent = document.getElementsByClassName('halloweenHud-trinket-content clear-block');
  1651. for(i=0;i<classContent.length;i+=3){
  1652. if(classContent[i].children[3].getAttribute('class').indexOf('armNow active') > -1)
  1653. nSquareMin++;
  1654. }
  1655. if(nSquareMin === 0)
  1656. return;
  1657. i = (areaName.indexOf('Haunted Dream') > -1) ? 0 : 1 ;
  1658. var stageContainer = document.getElementsByClassName('halloweenHud-progress-stage-row-container')[i];
  1659. i = (bTricking) ? 0 : 1 ;
  1660. var nSquareLeft = stageContainer.children[i].getElementsByTagName('i').length;
  1661. console.plog('Min Square:', nSquareMin, 'Square Left:', nSquareLeft);
  1662. if(nSquareLeft <= nSquareMin){
  1663. for(i=0;i<classContent.length;i+=3){
  1664. if(classContent[i].children[3].getAttribute('class').indexOf('armNow active') > -1)
  1665. fireEvent(classContent[i].children[3], 'click');
  1666. }
  1667. }
  1668.  
  1669. }
  1670. }
  1671.  
  1672. function Halloween2018(){
  1673. var has_reward = (getPageVariable('user.quests.QuestHalloween2018.has_reward') == 'true')
  1674. , has_puzzle = (getPageVariable('user.has_puzzle') == 'true')
  1675. , $btn_reward = $(".halloweenHUD-campBanner-claimReward")
  1676. , $btn_cannon = $(".halloweenHUD-campBanner-cannonBall-button")
  1677. , int_handler = null;
  1678.  
  1679. if(!has_puzzle){
  1680. if(has_reward){
  1681. hg.views.HeadsUpDisplayHalloweenView.claimReward($btn_reward[0]);
  1682. int_handler = setInterval(
  1683. function(){
  1684. if(!$btn_reward.hasClass("busy")){
  1685. hg.views.HeadsUpDisplayHalloweenView.toggleCannon($btn_cannon[0]);
  1686. clearInterval(int_handler);
  1687. }
  1688. }, 300);
  1689.  
  1690.  
  1691. }
  1692. }
  1693. }
  1694.  
  1695. function ges(){
  1696. if(GetCurrentLocation().indexOf('Gnawnian Express Station') < 0)
  1697. return;
  1698.  
  1699. var i, j;
  1700. var bOnTrain = (getPageVariable('user.quests.QuestTrainStation.on_train') == 'true');
  1701. var charmArmed = getPageVariable("user.trinket_name");
  1702. var arrCharm;
  1703. var nCharmQuantity;
  1704. var objDefaultGES = {
  1705. bLoadCrate : false,
  1706. nMinCrate : 11,
  1707. bUseRepellent : false,
  1708. nMinRepellent : 11,
  1709. bStokeEngine : false,
  1710. nMinFuelNugget : 20,
  1711. SD_BEFORE : {
  1712. weapon : '',
  1713. base : '',
  1714. trinket : '',
  1715. bait : ''
  1716. },
  1717. SD_AFTER : {
  1718. weapon : '',
  1719. base : '',
  1720. trinket : '',
  1721. bait : ''
  1722. },
  1723. RR : {
  1724. weapon : '',
  1725. base : '',
  1726. trinket : '',
  1727. bait : ''
  1728. },
  1729. DC : {
  1730. weapon : '',
  1731. base : '',
  1732. trinket : '',
  1733. bait : ''
  1734. },
  1735. WAITING : {
  1736. weapon : '',
  1737. base : '',
  1738. trinket : '',
  1739. bait : ''
  1740. }
  1741. };
  1742. var objGES = getStorageToObject('GES', objDefaultGES);
  1743. var nPhaseSecLeft = parseInt(getPageVariable('user.quests.QuestTrainStation.phase_seconds_remaining'));
  1744. var strCurrentPhase = '';
  1745. if(!bOnTrain){
  1746. strCurrentPhase = 'WAITING';
  1747. }
  1748. else{
  1749. var classPhase = document.getElementsByClassName('box phaseName');
  1750. if(classPhase.length > 0 && classPhase[0].children.length > 1)
  1751. strCurrentPhase = classPhase[0].children[1].textContent;
  1752. }
  1753. console.plog('Current Phase:', strCurrentPhase, 'Time Left (s):', nPhaseSecLeft);
  1754. if(strCurrentPhase === '')
  1755. return;
  1756.  
  1757. var strStage = '';
  1758. if(strCurrentPhase.indexOf('Supply Depot') > -1 ){
  1759. if(nPhaseSecLeft <= nextActiveTime || (enableTrapCheck && trapCheckTimeDiff===0 && nPhaseSecLeft <= 900)){ // total seconds left to next phase less than next active time or next trap check time
  1760. strStage = 'RR';
  1761. checkThenArm(null, 'trinket', objGES[strStage].trinket);
  1762. }
  1763. else{
  1764. var nTurn = parseInt(document.getElementsByClassName('supplyHoarderTab')[0].textContent.substr(0, 1));
  1765. console.plog("Supply Hoarder Turn:", nTurn);
  1766. if(nTurn <= 0){ // before
  1767. strStage = 'SD_BEFORE';
  1768. if(objGES.SD_BEFORE.trinket.indexOf('Supply Schedule') > -1 && charmArmed.indexOf('Supply Schedule') < 0){
  1769. var classCharm = document.getElementsByClassName('charms');
  1770. var linkCharm = classCharm[0].children[0];
  1771. nCharmQuantity = parseInt(document.getElementsByClassName('charms')[0].getElementsByClassName('quantity')[0].textContent);
  1772. console.plog('Supply Schedule Charm Quantity:', nCharmQuantity);
  1773. if(Number.isInteger(nCharmQuantity) && nCharmQuantity > 0)
  1774. fireEvent(linkCharm, 'click');
  1775. }
  1776. else
  1777. checkThenArm(null, 'trinket', objGES.SD_BEFORE.trinket);
  1778. }
  1779. else{
  1780. strStage = 'SD_AFTER';
  1781. if(objGES.SD_AFTER.trinket.indexOf('Supply Schedule') > -1)
  1782. disarmTrap('trinket');
  1783. else
  1784. checkThenArm(null, 'trinket', objGES.SD_AFTER.trinket);
  1785. }
  1786. }
  1787.  
  1788. if(objGES.bLoadCrate){
  1789. var nCrateQuantity = parseInt(document.getElementsByClassName('supplyCrates')[0].getElementsByClassName('quantity')[0].textContent);
  1790. console.plog('Crate Quantity:', nCrateQuantity);
  1791. if(Number.isInteger(nCrateQuantity) && nCrateQuantity >= objGES.nMinCrate)
  1792. fireEvent(document.getElementsByClassName('phaseButton')[0], 'click');
  1793. }
  1794. }
  1795. else if(strCurrentPhase.indexOf('Raider River') > -1 ){
  1796. if(nPhaseSecLeft <= nextActiveTime || (enableTrapCheck && trapCheckTimeDiff===0 && nPhaseSecLeft <= 900)){ // total seconds left to next phase less than next active time or next trap check time
  1797. strStage = 'DC';
  1798. checkThenArm(null, 'trinket', objGES[strStage].trinket);
  1799. }
  1800. else{
  1801. strStage = 'RR';
  1802. if(objGES.RR.trinket == 'AUTO'){
  1803. // get raider status and arm respective charm
  1804. arrCharm = ['Roof Rack', 'Door Guard', 'Greasy Glob'];
  1805. var classTrainCarArea = document.getElementsByClassName('trainCarArea');
  1806. nCharmQuantity = 0;
  1807. var strAttack = '';
  1808. for (i=0;i<classTrainCarArea.length;i++) {
  1809. if(classTrainCarArea[i].className.indexOf('attacked') > -1){
  1810. strAttack = classTrainCarArea[i].className.substr(0, classTrainCarArea[i].className.indexOf(' '));
  1811. nCharmQuantity = parseInt(classTrainCarArea[i].getElementsByClassName('quantity')[0].textContent);
  1812. console.plog('Raiders Attack:', capitalizeFirstLetter(strAttack), ',', arrCharm[i], 'Charm Quantity:', nCharmQuantity);
  1813. if(Number.isInteger(nCharmQuantity) && nCharmQuantity > 0 && charmArmed.indexOf(arrCharm[i]) < 0)
  1814. fireEvent(classTrainCarArea[i].firstChild, 'click');
  1815. else{
  1816. for(j=0;j<arrCharm.length;j++){
  1817. if(j!=i && charmArmed.indexOf(arrCharm[j]) > -1){
  1818. disarmTrap('trinket');
  1819. break;
  1820. }
  1821. }
  1822. }
  1823. break;
  1824. }
  1825. }
  1826. }
  1827. else
  1828. checkThenArm(null, 'trinket', objGES.RR.trinket);
  1829. }
  1830.  
  1831. if(objGES.bUseRepellent){
  1832. var nRepellentQuantity = parseInt(document.getElementsByClassName('mouseRepellent')[0].getElementsByClassName('quantity')[0].textContent);
  1833. console.plog('Repellent Quantity:', nRepellentQuantity);
  1834. if(Number.isInteger(nRepellentQuantity) && nRepellentQuantity >= objGES.nMinRepellent)
  1835. fireEvent(document.getElementsByClassName('phaseButton')[0], 'click');
  1836. }
  1837. }
  1838. else if(strCurrentPhase.indexOf('Daredevil Canyon') > -1 ){
  1839. if(nPhaseSecLeft <= nextActiveTime || (enableTrapCheck && trapCheckTimeDiff===0 && nPhaseSecLeft <= 900)){ // total seconds left to next phase less than next active time or next trap check time
  1840. strStage = 'WAITING';
  1841. checkThenArm(null, 'trinket', objGES[strStage].trinket);
  1842. }
  1843. else{
  1844. strStage = 'DC';
  1845. arrCharm = ['Magmatic Crystal Charm', 'Black Powder Charm', 'Dusty Coal Charm'];
  1846. if(objGES.DC.trinket == 'AUTO')
  1847. checkThenArm('best', 'trinket', arrCharm);
  1848. else{
  1849. arrCharm.reverse();
  1850. var nIndex = arrCharm.indexOf(objGES.DC.trinket);
  1851. if(arrCharm.indexOf(objGES.DC.trinket) > -1){
  1852. var classCharms = document.getElementsByClassName('charms');
  1853. nCharmQuantity = parseInt(classCharms[0].children[nIndex].getElementsByClassName('quantity')[0].textContent);
  1854. console.plog(objGES.DC.trinket, 'Quantity:', nCharmQuantity);
  1855. if(Number.isInteger(nCharmQuantity) && nCharmQuantity > 0 && charmArmed.indexOf(objGES.DC.trinket) < 0)
  1856. fireEvent(classCharms[0].children[nIndex], 'click');
  1857. }
  1858. else
  1859. checkThenArm(null, 'trinket', objGES.DC.trinket);
  1860. }
  1861. }
  1862.  
  1863. if(objGES.bStokeEngine){
  1864. // get fuel nugget quantity
  1865. var nFuelQuantity = parseInt(document.getElementsByClassName('fuelNugget')[0].getElementsByClassName('quantity')[0].textContent);
  1866. console.plog('Fuel Nugget Quantity:', nFuelQuantity);
  1867. if(Number.isInteger(nFuelQuantity) && nFuelQuantity >= objGES.nMinFuelNugget)
  1868. fireEvent(document.getElementsByClassName('phaseButton')[0], 'click');
  1869. }
  1870. }
  1871. else{
  1872. strStage = 'WAITING';
  1873. arrCharm = ['Supply Schedule', 'Roof Rack', 'Door Guard', 'Greasy Blob', 'Magmatic Crystal', 'Black Powder', 'Dusty Coal'];
  1874. if(objGES.WAITING.trinket.indexOf(arrCharm) > -1)
  1875. disarmTrap('trinket');
  1876. else
  1877. checkThenArm(null, 'trinket', objGES.WAITING.trinket);
  1878. }
  1879. checkThenArm(null, 'weapon', objGES[strStage].weapon);
  1880. checkThenArm(null, 'base', objGES[strStage].base);
  1881. checkThenArm(null, 'bait', objGES[strStage].bait);
  1882. }
  1883.  
  1884. function wwrift(){
  1885. if(GetCurrentLocation().indexOf('Whisker Woods Rift') < 0)
  1886. return;
  1887.  
  1888. var objDefaultWWRift = {
  1889. factionFocus : "CC",
  1890. factionFocusNext : "Remain",
  1891. faction : {
  1892. weapon : new Array(3).fill(''),
  1893. base : new Array(3).fill(''),
  1894. trinket : new Array(3).fill('None'),
  1895. bait : new Array(3).fill('None')
  1896. },
  1897. MBW : {
  1898. minRageLLC : 40,
  1899. rage4044: {
  1900. weapon : new Array(7).fill(''),
  1901. base : new Array(7).fill(''),
  1902. trinket : new Array(7).fill('None'),
  1903. bait : new Array(7).fill('None')
  1904. },
  1905. rage4548: {
  1906. weapon : new Array(8).fill(''),
  1907. base : new Array(8).fill(''),
  1908. trinket : new Array(8).fill('None'),
  1909. bait : new Array(8).fill('None')
  1910. },
  1911. },
  1912. };
  1913. var objWWRift = getStorageToObject('WWRift', objDefaultWWRift);
  1914. if(isNullOrUndefined(objWWRift.factionFocusNext) || objWWRift.factionFocus === "")
  1915. objWWRift.factionFocusNext = "Remain";
  1916. objWWRift.order = ['CC', 'GGT', 'DL'];
  1917. objWWRift.funnelCharm = ['Cherry Charm', 'Gnarled Charm', 'Stagnant Charm'];
  1918. objWWRift.rage = new Array(3);
  1919. var i;
  1920. var temp = -1;
  1921. var tempNext = -1;
  1922. var nIndex = -1;
  1923. var classRage = document.getElementsByClassName('riftWhiskerWoodsHUD-zone-rageLevel');
  1924. for(i=0;i<classRage.length;i++){
  1925. objWWRift.rage[i] = parseInt(classRage[i].textContent);
  1926. if(Number.isNaN(objWWRift.rage[i]))
  1927. return;
  1928. }
  1929. console.plog(objWWRift);
  1930. var charmArmed = getPageVariable("user.trinket_name");
  1931. var nBar25 = 0;
  1932. var nBar44 = 0;
  1933. var nBarMinRage = 0;
  1934. var nIndexCharm = -1;
  1935. var nLimit = 0;
  1936. var bResave = false;
  1937. if(objWWRift.factionFocus == 'MBW_40_44'){
  1938. for(i=0;i<objWWRift.rage.length;i++){
  1939. if(objWWRift.rage[i] >= 25)
  1940. nBar25++;
  1941. }
  1942. if(nBar25 >= 3){
  1943. for(i=0;i<objWWRift.rage.length;i++){
  1944. if(objWWRift.rage[i] >= objWWRift.MBW.minRageLLC)
  1945. nBarMinRage++;
  1946. }
  1947. }
  1948. nIndex = nBarMinRage + nBar25;
  1949. checkThenArm(null, 'weapon', objWWRift.MBW.rage4044.weapon[nIndex]);
  1950. checkThenArm(null, 'base', objWWRift.MBW.rage4044.base[nIndex]);
  1951. if(objWWRift.MBW.rage4044.trinket[nIndex].indexOf('FSC') > -1){
  1952. nIndexCharm = objWWRift.funnelCharm.indexOf(charmArmed);
  1953. nLimit = (nIndex >= 3) ? objWWRift.MBW.minRageLLC : 25;
  1954. if(nIndexCharm > -1){
  1955. if(objWWRift.rage[nIndexCharm] >= nLimit){
  1956. temp = minIndex(objWWRift.rage);
  1957. if(temp > -1)
  1958. objWWRift.MBW.rage4044.trinket[nIndex] = objWWRift.funnelCharm[temp];
  1959. }
  1960. else
  1961. objWWRift.MBW.rage4044.trinket[nIndex] = charmArmed;
  1962. }
  1963. else{
  1964. temp = minIndex(objWWRift.rage);
  1965. if(temp > -1)
  1966. objWWRift.MBW.rage4044.trinket[nIndex] = objWWRift.funnelCharm[temp];
  1967. }
  1968. }
  1969. checkThenArm(null, 'trinket', objWWRift.MBW.rage4044.trinket[nIndex]);
  1970. checkThenArm(null, 'bait', objWWRift.MBW.rage4044.bait[nIndex]);
  1971. }
  1972. else if(objWWRift.factionFocus == 'MBW_45_48'){
  1973. for(i=0;i<objWWRift.rage.length;i++){
  1974. if(objWWRift.rage[i] >= 25)
  1975. nBar25++;
  1976. }
  1977. if(nBar25 >= 3){
  1978. for(i=0;i<objWWRift.rage.length;i++){
  1979. if(objWWRift.rage[i] >= 44)
  1980. nBar44++;
  1981. }
  1982. }
  1983. if(nBar44 >= 3){
  1984. for(i=0;i<objWWRift.rage.length;i++){
  1985. if(objWWRift.rage[i] >= objWWRift.MBW.minRageLLC)
  1986. nBarMinRage++;
  1987. }
  1988. }
  1989. nIndex = nBar25 + nBar44 + nBarMinRage;
  1990. checkThenArm(null, 'weapon', objWWRift.MBW.rage4548.weapon[nIndex]);
  1991. checkThenArm(null, 'base', objWWRift.MBW.rage4548.base[nIndex]);
  1992. if(objWWRift.MBW.rage4548.trinket[nIndex].indexOf('FSC') > -1){
  1993. nIndexCharm = objWWRift.funnelCharm.indexOf(charmArmed);
  1994. nLimit = (nIndex >= 3) ? 44 : 25;
  1995. if(nIndexCharm > -1){
  1996. if(objWWRift.rage[nIndexCharm] >= nLimit){
  1997. temp = minIndex(objWWRift.rage);
  1998. if(temp > -1)
  1999. objWWRift.MBW.rage4548.trinket[nIndex] = objWWRift.funnelCharm[temp];
  2000. }
  2001. else
  2002. objWWRift.MBW.rage4548.trinket[nIndex] = charmArmed;
  2003. }
  2004. else{
  2005. temp = minIndex(objWWRift.rage);
  2006. if(temp > -1)
  2007. objWWRift.MBW.rage4548.trinket[nIndex] = objWWRift.funnelCharm[temp];
  2008. }
  2009. }
  2010. checkThenArm(null, 'trinket', objWWRift.MBW.rage4548.trinket[nIndex]);
  2011. checkThenArm(null, 'bait', objWWRift.MBW.rage4548.bait[nIndex]);
  2012. }
  2013. else{
  2014. temp = objWWRift.order.indexOf(objWWRift.factionFocus);
  2015. if(temp == -1)
  2016. return;
  2017. nIndex = Math.floor(objWWRift.rage[temp]/25);
  2018. checkThenArm(null, 'weapon', objWWRift.faction.weapon[nIndex]);
  2019. checkThenArm(null, 'base', objWWRift.faction.base[nIndex]);
  2020. if(objWWRift.faction.trinket[nIndex].indexOf('FSC') > -1){
  2021. if(objWWRift.factionFocusNext == "Remain" || objWWRift.factionFocus == objWWRift.factionFocusNext)
  2022. objWWRift.faction.trinket[nIndex] = objWWRift.funnelCharm[temp];
  2023. else{
  2024. var nLastRage = getStorageToVariableInt("LastRage", 0);
  2025. if(objWWRift.rage[temp] < nLastRage){
  2026. tempNext = objWWRift.order.indexOf(objWWRift.factionFocusNext);
  2027. objWWRift.faction.trinket[nIndex] = objWWRift.funnelCharm[tempNext];
  2028. objWWRift.factionFocus = objWWRift.factionFocusNext;
  2029. bResave = true;
  2030. }
  2031. else
  2032. objWWRift.faction.trinket[nIndex] = objWWRift.funnelCharm[temp];
  2033. }
  2034. }
  2035. checkThenArm(null, 'trinket', objWWRift.faction.trinket[nIndex]);
  2036. checkThenArm(null, 'bait', objWWRift.faction.bait[nIndex]);
  2037. if(bResave){
  2038. // resave into localStorage
  2039. var obj = getStorageToObject('WWRift', objDefaultWWRift);
  2040. obj.factionFocus = objWWRift.factionFocus;
  2041. setStorage('WWRift', JSON.stringify(obj));
  2042. }
  2043. setStorage("LastRage", objWWRift.rage[temp]);
  2044. }
  2045. }
  2046.  
  2047. function iceberg(){
  2048. var loc = GetCurrentLocation();
  2049. var arrOrder = ['GENERAL', 'TREACHEROUS', 'BRUTAL', 'BOMBING', 'MAD', 'ICEWING', 'HIDDEN', 'DEEP', 'SLUSHY'];
  2050. var objDefaultIceberg = {
  2051. base : new Array(9).fill(''),
  2052. trinket : new Array(9).fill('None'),
  2053. bait : new Array(9).fill('Gouda')
  2054. };
  2055. var objIceberg = getStorageToObject('Iceberg', objDefaultIceberg);
  2056. var nIndex = -1;
  2057. if (loc.indexOf('Iceberg') > -1) {
  2058. var phase;
  2059. var nProgress = -1;
  2060. var classCurrentPhase = document.getElementsByClassName('currentPhase');
  2061. if(classCurrentPhase.length > 0)
  2062. phase = classCurrentPhase[0].textContent;
  2063. else
  2064. phase = getPageVariable('user.quests.QuestIceberg.current_phase');
  2065. var classProgress = document.getElementsByClassName('user_progress');
  2066. if(classProgress.length > 0)
  2067. nProgress = parseInt(classProgress[0].textContent.replace(',', ''));
  2068. else
  2069. nProgress = parseInt(getPageVariable('user.quests.QuestIceberg.user_progress'));
  2070. console.plog('In', phase, 'at', nProgress, 'feets');
  2071.  
  2072. if (nProgress == 300 || nProgress == 600 || nProgress == 1600 || nProgress == 1800)
  2073. nIndex = 0;
  2074. else{
  2075. phase = phase.toUpperCase();
  2076. for(var i=1;i<arrOrder.length;i++){
  2077. if(phase.indexOf(arrOrder[i]) > -1){
  2078. nIndex = i;
  2079. break;
  2080. }
  2081. }
  2082. }
  2083. }
  2084. else if (loc.indexOf('Slushy Shoreline') > -1)
  2085. nIndex = arrOrder.indexOf('SLUSHY');
  2086. if(nIndex < 0)
  2087. return;
  2088. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  2089. checkThenArm(null, 'base', objIceberg.base[nIndex]);
  2090. checkThenArm(null, 'trinket', objIceberg.trinket[nIndex]);
  2091. checkThenArm(null, 'bait', objIceberg.bait[nIndex]);
  2092. }
  2093.  
  2094. function BurroughRift(bCheckLoc, minMist, maxMist, nToggle)
  2095. {
  2096. //Tier 0: 0 Mist Canisters
  2097. //Tier 1/Yellow: 1-5 Mist Canisters
  2098. //Tier 2/Green: 6-18 Mist Canisters
  2099. //Tier 3/Red: 19-20 Mist Canisters
  2100. if (bCheckLoc && GetCurrentLocation().indexOf('Burroughs Rift') < 0)
  2101. return;
  2102.  
  2103. var currentMistQuantity = parseInt(document.getElementsByClassName('mistQuantity')[0].innerText);
  2104. var isMisting = (getPageVariable('user.quests.QuestRiftBurroughs.is_misting') == 'true');
  2105. var mistButton = document.getElementsByClassName('mistButton')[0];
  2106. console.plog('Current Mist Quantity:', currentMistQuantity, 'Is Misting:', isMisting);
  2107. if(minMist === 0 && maxMist === 0){
  2108. if(isMisting){
  2109. console.plog('Stop mist...');
  2110. fireEvent(mistButton, 'click');
  2111. }
  2112. }
  2113. else if(currentMistQuantity >= maxMist && isMisting)
  2114. {
  2115. if(maxMist == 20 && Number.isInteger(nToggle)){
  2116. if(nToggle == 1){
  2117. console.plog('Stop mist...');
  2118. fireEvent(mistButton, 'click');
  2119. }
  2120. else{
  2121. var nCount20 = getStorageToVariableInt('BR20_Count', 0);
  2122. nCount20++;
  2123. if(nCount20 >= nToggle){
  2124. nCount20 = 0;
  2125. console.plog('Stop mist...');
  2126. fireEvent(mistButton, 'click');
  2127. }
  2128. setStorage('BR20_Count', nCount20);
  2129. }
  2130. }
  2131. else{
  2132. console.plog('Stop mist...');
  2133. fireEvent(mistButton, 'click');
  2134. }
  2135. }
  2136. else if(currentMistQuantity <= minMist && !isMisting)
  2137. {
  2138. console.plog('Start mist...');
  2139. fireEvent(mistButton, 'click');
  2140. }
  2141. return currentMistQuantity;
  2142. }
  2143.  
  2144. function BRCustom(){
  2145. if (GetCurrentLocation().indexOf('Burroughs Rift') < 0)
  2146. return;
  2147.  
  2148. var objDefaultBRCustom = {
  2149. hunt : '',
  2150. toggle : 1,
  2151. name : ['Red', 'Green', 'Yellow', 'None'],
  2152. weapon : new Array(4),
  2153. base : new Array(4),
  2154. trinket : new Array(4),
  2155. bait : new Array(4)
  2156. };
  2157. var objBR = getStorageToObject('BRCustom', objDefaultBRCustom);
  2158. var mistQuantity = 0;
  2159. if(objBR.hunt == 'Red')
  2160. mistQuantity = BurroughRift(false, 19, 20, objBR.toggle);
  2161. else if(objBR.hunt == 'Green')
  2162. mistQuantity = BurroughRift(false, 6, 18);
  2163. else if(objBR.hunt == 'Yellow')
  2164. mistQuantity = BurroughRift(false, 1, 5);
  2165. else
  2166. mistQuantity = BurroughRift(false, 0, 0);
  2167.  
  2168. var currentTier = '';
  2169. if(mistQuantity >= 19)
  2170. currentTier = 'Red';
  2171. else if(mistQuantity >= 6)
  2172. currentTier = 'Green';
  2173. else if(mistQuantity >= 1)
  2174. currentTier = 'Yellow';
  2175. else
  2176. currentTier = 'None';
  2177.  
  2178. if(currentTier != objBR.hunt)
  2179. return;
  2180.  
  2181. var nIndex = objBR.name.indexOf(currentTier);
  2182. checkThenArm(null, 'weapon', objBR.weapon[nIndex]);
  2183. checkThenArm(null, 'base', objBR.base[nIndex]);
  2184. checkThenArm(null, 'bait', objBR.bait[nIndex]);
  2185. if(objBR.trinket[nIndex] == 'None')
  2186. disarmTrap('trinket');
  2187. else
  2188. checkThenArm(null, 'trinket', objBR.trinket[nIndex]);
  2189. }
  2190.  
  2191. function LGGeneral(objLG) {
  2192. var loc = GetCurrentLocation();
  2193. switch (loc)
  2194. {
  2195. case 'Living Garden':
  2196. livingGarden(objLG); break;
  2197. case 'Lost City':
  2198. lostCity(objLG); break;
  2199. case 'Sand Dunes':
  2200. sandDunes(); break;
  2201. case 'Twisted Garden':
  2202. twistedGarden(objLG); break;
  2203. case 'Cursed City':
  2204. cursedCity(objLG); break;
  2205. case 'Sand Crypts':
  2206. sandCrypts(objLG); break;
  2207. default:
  2208. return;
  2209. }
  2210. DisarmLGSpecialCharm(loc);
  2211. }
  2212.  
  2213. function seasonalGarden(){
  2214. if(GetCurrentLocation().indexOf('Seasonal Garden') < 0)
  2215. return;
  2216.  
  2217. var cheeseArmed = getPageVariable('user.bait_name');
  2218. if(cheeseArmed.indexOf('Checkmate') > -1)
  2219. checkThenArm(null, 'bait', 'Gouda');
  2220.  
  2221. var objDefaultSG = {
  2222. weapon : new Array(4).fill(''),
  2223. base : new Array(4).fill(''),
  2224. trinket : new Array(4).fill(''),
  2225. bait : new Array(4).fill(''),
  2226. disarmBaitAfterCharged : false
  2227. };
  2228. var objSG = getStorageToObject('SGarden', objDefaultSG);
  2229. objSG.season = ['Spring', 'Summer', 'Fall', 'Winter'];
  2230. var now = (g_nTimeOffset === 0) ? new Date() : new Date(Date.now() + g_nTimeOffset*1000);
  2231. var nTimeStamp = Date.parse(now)/1000;
  2232. var nFirstSeasonTimeStamp = 1283328000;
  2233. var nSeasonLength = 288000; // 80hr
  2234. var nSeason = Math.floor((nTimeStamp - nFirstSeasonTimeStamp)/nSeasonLength) % objSG.season.length;
  2235. var nSeasonNext = nSeasonLength - ((nTimeStamp - nFirstSeasonTimeStamp) % nSeasonLength);
  2236. var nCurrentAmp = parseInt(getPageVariable("user.viewing_atts.zzt_amplifier"));
  2237. var nMaxAmp = parseInt(getPageVariable("user.viewing_atts.zzt_max_amplifier"));
  2238. console.plog('Current Amplifier:', nCurrentAmp, 'Current Season:', objSG.season[nSeason], 'Next Season In:', timeFormat(nSeasonNext));
  2239. if(nSeasonNext <= nextActiveTime){ // total seconds left to next season less than next active time
  2240. nSeason++;
  2241. if(nSeason >= objSG.season.length)
  2242. nSeason = 0;
  2243. }
  2244.  
  2245. checkThenArm(null, 'weapon', objSG.weapon[nSeason]);
  2246. checkThenArm(null, 'base', objSG.base[nSeason]);
  2247. checkThenArm(null, 'trinket', objSG.trinket[nSeason]);
  2248. if(nCurrentAmp+1 >= nMaxAmp){
  2249. if(getPageVariable('user.trinket_name').indexOf('Amplifier') > -1)
  2250. disarmTrap('trinket');
  2251. if(nCurrentAmp >= nMaxAmp && objSG.disarmBaitAfterCharged)
  2252. disarmTrap('bait');
  2253. else
  2254. checkThenArm(null, 'bait', objSG.bait[nSeason]);
  2255. }
  2256. else
  2257. checkThenArm(null, 'bait', objSG.bait[nSeason]);
  2258. }
  2259.  
  2260. function zugzwangTower(){
  2261. var loc = GetCurrentLocation();
  2262. if (loc.indexOf("Seasonal Garden") > -1){
  2263. setStorage('eventLocation', 'SG');
  2264. seasonalGarden();
  2265. return;
  2266. }
  2267. else if (loc.indexOf("Zugzwang's Tower") < 0)
  2268. return;
  2269.  
  2270. var objDefaultZT = {
  2271. focus : 'MYSTIC',
  2272. order : ['PAWN', 'KNIGHT', 'BISHOP', 'ROOK', 'QUEEN', 'KING', 'CHESSMASTER'],
  2273. weapon : new Array(14).fill(''),
  2274. base : new Array(14).fill(''),
  2275. trinket : new Array(14).fill('None'),
  2276. bait : new Array(14).fill('Gouda'),
  2277. };
  2278. var objZT = getStorageToObject('ZTower', objDefaultZT);
  2279. objZT.focus = objZT.focus.toUpperCase();
  2280. var nProgressMystic = parseInt(getPageVariable('user.viewing_atts.zzt_mage_progress'));
  2281. var nProgressTechnic = parseInt(getPageVariable('user.viewing_atts.zzt_tech_progress'));
  2282. if(Number.isNaN(nProgressMystic) || Number.isNaN(nProgressTechnic))
  2283. return;
  2284.  
  2285. var strUnlockMystic = getZTUnlockedMouse(nProgressMystic);
  2286. var strUnlockTechnic = getZTUnlockedMouse(nProgressTechnic);
  2287. if(strUnlockMystic === "" || strUnlockTechnic === "")
  2288. return;
  2289. var nIndex = -1;
  2290. console.plog(capitalizeFirstLetter(objZT.focus),'Progress Mystic:',nProgressMystic,'Unlock Mystic:',strUnlockMystic,'Progress Technic:',nProgressTechnic,'Unlock Technic:',strUnlockTechnic);
  2291. if(objZT.focus.indexOf('MYSTIC') === 0){ // Mystic side first
  2292. if(strUnlockMystic == 'CHESSMASTER' && objZT.focus.indexOf('=>') > -1){ // is double run?
  2293. nIndex = objZT.order.indexOf(strUnlockTechnic);
  2294. if(nIndex > -1)
  2295. nIndex += 7;
  2296. }
  2297. else{ // single run
  2298. nIndex = objZT.order.indexOf(strUnlockMystic);
  2299. }
  2300. }
  2301. else{ // Technic side first
  2302. if(strUnlockTechnic == 'CHESSMASTER' && objZT.focus.indexOf('=>') > -1){ // is double run?
  2303. nIndex = objZT.order.indexOf(strUnlockMystic);
  2304. if(nIndex > -1)
  2305. nIndex += 7;
  2306. }
  2307. else{ // single run
  2308. nIndex = objZT.order.indexOf(strUnlockTechnic);
  2309. }
  2310. }
  2311.  
  2312. if(nIndex == -1)
  2313. return;
  2314.  
  2315. if(objZT.weapon[nIndex] == 'MPP/TPP'){
  2316. if(objZT.focus.indexOf('MYSTIC') === 0)
  2317. objZT.weapon[nIndex] = (nIndex >= 7) ? 'Technic Pawn Pincher' : 'Mystic Pawn Pincher';
  2318. else
  2319. objZT.weapon[nIndex] = (nIndex >= 7) ? 'Mystic Pawn Pincher' : 'Technic Pawn Pincher';
  2320. }
  2321. else if(objZT.weapon[nIndex] == 'BPT/OAT'){
  2322. if(objZT.focus.indexOf('MYSTIC') === 0)
  2323. objZT.weapon[nIndex] = (nIndex >= 7) ? 'Obvious Ambush Trap' : 'Blackstone Pass Trap';
  2324. else
  2325. objZT.weapon[nIndex] = (nIndex >= 7) ? 'Blackstone Pass Trap' : 'Obvious Ambush Trap';
  2326. }
  2327.  
  2328. for (var prop in objZT) {
  2329. if(objZT.hasOwnProperty(prop) &&
  2330. (prop == 'weapon' || prop == 'base' || prop == 'trinket' || prop == 'bait')) {
  2331. if(objZT[prop][nIndex] == 'None')
  2332. disarmTrap(prop);
  2333. else
  2334. checkThenArm(null, prop, objZT[prop][nIndex]);
  2335. }
  2336. }
  2337. }
  2338.  
  2339. function getZTUnlockedMouse(nProgress){
  2340. var strUnlock = "";
  2341. if(nProgress <= 7)
  2342. strUnlock = 'PAWN';
  2343. else if(nProgress <= 9)
  2344. strUnlock = 'KNIGHT';
  2345. else if(nProgress <= 11)
  2346. strUnlock = 'BISHOP';
  2347. else if(nProgress <= 13)
  2348. strUnlock = 'ROOK';
  2349. else if(nProgress <= 14)
  2350. strUnlock = 'QUEEN';
  2351. else if(nProgress <= 15)
  2352. strUnlock = 'KING';
  2353. else if(nProgress <= 16)
  2354. strUnlock = 'CHESSMASTER';
  2355. return strUnlock;
  2356. }
  2357.  
  2358. function balackCoveJOD(){
  2359. var curLoc = GetCurrentLocation();
  2360. var bInJOD = (curLoc.indexOf('Jungle') > -1);
  2361. var bInBC = (curLoc.indexOf('Balack') > -1);
  2362. if(!(bInJOD || bInBC))
  2363. return;
  2364. var objDefaultBCJOD = {
  2365. order : ['JOD','LOW','MID','HIGH'],
  2366. weapon : new Array(4).fill(''),
  2367. base : new Array(4).fill(''),
  2368. trinket : new Array(4).fill(''),
  2369. bait : new Array(4).fill('')
  2370. };
  2371. var objBCJOD = getStorageToObject('BC_JOD', objDefaultBCJOD);
  2372. var nIndex = -1;
  2373. if(bInJOD)
  2374. nIndex = 0;
  2375. else{
  2376. var i = 0;
  2377. var objBC = {
  2378. arrTide : ['Low Rising', 'Mid Rising', 'High Rising', 'High Ebbing', 'Mid Ebbing', 'Low Ebbing'],
  2379. arrLength : [24, 3, 1, 1, 3, 24],
  2380. arrAll : []
  2381. };
  2382. var nTimeStamp = Math.floor(Date.now()/1000) + g_nTimeOffset*1000;
  2383. var nFirstTideTimeStamp = 1294708860;
  2384. var nTideLength = 1200; // 20min
  2385. for(i=0;i<objBC.arrTide.length;i++){
  2386. objBC.arrAll = objBC.arrAll.concat(new Array(objBC.arrLength[i]).fill(objBC.arrTide[i]));
  2387. }
  2388. var nTideTotalLength = sumData(objBC.arrLength);
  2389. var nDiff = nTimeStamp - nFirstTideTimeStamp;
  2390. var nIndexCurrentTide = Math.floor(nDiff/nTideLength) % nTideTotalLength;
  2391. var tideNameCurrent = objBC.arrAll[nIndexCurrentTide];
  2392. var tideNameNext;
  2393. if(tideNameCurrent.indexOf('Low') > -1)
  2394. tideNameNext = 'Mid Rising';
  2395. else if(tideNameCurrent.indexOf('High') > -1)
  2396. tideNameNext = 'Mid Ebbing';
  2397. else if(tideNameCurrent == 'Mid Rising')
  2398. tideNameNext = 'High Rising';
  2399. else if(tideNameCurrent == 'Mid Ebbing')
  2400. tideNameNext = 'Low Ebbing';
  2401.  
  2402. var nTideDist = objBC.arrAll.indexOf(tideNameNext) + nTideTotalLength - nIndexCurrentTide;
  2403. nTideDist = nTideDist % nTideTotalLength;
  2404. var nNextTideTime = nTideDist*nTideLength - nDiff%nTideLength;
  2405. var strTempCurrent = tideNameCurrent.toUpperCase().split(' ')[0];
  2406. var strTempNext = tideNameNext.toUpperCase().split(' ')[0];
  2407. nIndex = objBCJOD.order.indexOf(strTempCurrent);
  2408. if(nNextTideTime <= nextActiveTime && strTempNext != strTempCurrent) // total seconds left to next tide less than next active time
  2409. nIndex = objBCJOD.order.indexOf(strTempNext);
  2410. console.plog('Current Tide:', objBC.arrAll[nIndexCurrentTide], 'Index:', nIndex, 'Next Tide:', tideNameNext, 'In', timeFormat(nNextTideTime));
  2411. if(nIndex < 0)
  2412. return;
  2413. }
  2414. checkThenArm(null, 'weapon', objBCJOD.weapon[nIndex]);
  2415. checkThenArm(null, 'base', objBCJOD.base[nIndex]);
  2416. checkThenArm(null, 'trinket', objBCJOD.trinket[nIndex]);
  2417. checkThenArm(null, 'bait', objBCJOD.bait[nIndex]);
  2418. }
  2419.  
  2420. function forbiddenGroveAR(){
  2421. var curLoc = GetCurrentLocation();
  2422. var bInFG = (curLoc.indexOf('Forbidden Grove') > -1);
  2423. var bInAR = (curLoc.indexOf('Acolyte Realm') > -1);
  2424. if(!(bInFG || bInAR))
  2425. return;
  2426. var objDefaultFGAR = {
  2427. order : ['FG','AR'],
  2428. weapon : new Array(2).fill(''),
  2429. base : new Array(2).fill(''),
  2430. trinket : new Array(2).fill(''),
  2431. bait : new Array(2).fill('')
  2432. };
  2433. var objFGAR = getStorageToObject('FG_AR', objDefaultFGAR);
  2434. var nIndex = (bInFG) ? 0 : 1;
  2435. checkThenArm(null, 'weapon', objFGAR.weapon[nIndex]);
  2436. checkThenArm(null, 'base', objFGAR.base[nIndex]);
  2437. checkThenArm(null, 'trinket', objFGAR.trinket[nIndex]);
  2438. checkThenArm(null, 'bait', objFGAR.bait[nIndex]);
  2439. }
  2440.  
  2441. function SunkenCity(isAggro) {
  2442. if (GetCurrentLocation().indexOf("Sunken City") < 0)
  2443. return;
  2444.  
  2445. var zone = document.getElementsByClassName('zoneName')[0].innerText;
  2446. console.plog('Current Zone:', zone);
  2447. var currentZone = GetSunkenCityZone(zone);
  2448. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  2449. if (currentZone == objSCZone.ZONE_NOT_DIVE){
  2450. checkThenArm('best', 'base', objBestTrap.base.luck);
  2451. checkThenArm(null, 'trinket', 'Oxygen Burst');
  2452. checkThenArm('best', 'bait', ['Fishy Fromage', 'Gouda']);
  2453. return;
  2454. }
  2455.  
  2456. checkThenArm('best', 'base', bestSCBase);
  2457. var distance = parseInt(getPageVariable('user.quests.QuestSunkenCity.distance'));
  2458. console.plog('Dive Distance(m):', distance);
  2459. var charmArmed = getPageVariable("user.trinket_name");
  2460. var charmElement = document.getElementsByClassName('charm');
  2461. var isEACArmed = (charmArmed.indexOf('Empowered Anchor') > -1);
  2462. var isWJCArmed = (charmArmed.indexOf('Water Jet') > -1);
  2463. if (currentZone == objSCZone.ZONE_OXYGEN || currentZone == objSCZone.ZONE_TREASURE || currentZone == objSCZone.ZONE_BONUS){
  2464. if (isAggro && (currentZone == objSCZone.ZONE_TREASURE))
  2465. checkThenArm('best', 'trinket', ['Golden Anchor', 'Empowered Anchor']);
  2466. else{
  2467. // arm Empowered Anchor Charm
  2468. if (!isEACArmed){
  2469. if (parseInt(charmElement[0].innerText) > 0)
  2470. fireEvent(charmElement[0], 'click');
  2471. }
  2472. }
  2473.  
  2474. checkThenArm(null, 'bait', 'SUPER');
  2475. }
  2476. else if (currentZone == objSCZone.ZONE_DANGER_PP || currentZone == objSCZone.ZONE_DANGER_PP_LOTA){
  2477. if (!isAggro){
  2478. // arm Empowered Anchor Charm
  2479. if (!isEACArmed && !isAggro){
  2480. if (parseInt(charmElement[0].innerText) > 0)
  2481. fireEvent(charmElement[0], 'click');
  2482. }
  2483. }
  2484. else
  2485. checkThenArm('best', 'trinket', ['Spiked Anchor', 'Empowered Anchor']);
  2486. checkThenArm(null, 'bait', 'Gouda');
  2487. }
  2488. else if ((currentZone == objSCZone.ZONE_DEFAULT) && isAggro){
  2489. var depth = parseInt(getPageVariable('user.quests.QuestSunkenCity.zones[1].length'));
  2490. if (depth >= 500){
  2491. var nextZoneName = getPageVariable('user.quests.QuestSunkenCity.zones[2].name');
  2492. var nextZoneLeft = parseInt(getPageVariable('user.quests.QuestSunkenCity.zones[2].left'));
  2493. var nextZone = GetSunkenCityZone(nextZoneName);
  2494. var distanceToNextZone = parseInt((nextZoneLeft - 80) / 0.6);
  2495. console.plog('Distance to next zone(m):', distanceToNextZone);
  2496. if (distanceToNextZone >= 480 || (distanceToNextZone >= 230 && nextZone == objSCZone.ZONE_DEFAULT)){
  2497. // arm Water Jet Charm
  2498. checkThenArm('best', 'trinket', ['Smart Water Jet', 'Water Jet']);
  2499. }
  2500. else
  2501. DisarmSCSpecialCharm(charmArmed);
  2502. }
  2503. else
  2504. DisarmSCSpecialCharm(charmArmed);
  2505.  
  2506. checkThenArm(null, 'bait', 'Gouda');
  2507. }
  2508. else{
  2509. DisarmSCSpecialCharm(charmArmed);
  2510. checkThenArm(null, 'bait', 'Gouda');
  2511. }
  2512. }
  2513.  
  2514. function gwh(){
  2515. if (GetCurrentLocation().indexOf("Great Winter Hunt") < 0)
  2516. return;
  2517.  
  2518. var userVariable = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestWinterHunt2016)'));
  2519. var objDefaultGWH2016 = {
  2520. zone : ['ORDER1','ORDER2','NONORDER1','NONORDER2','WINTER_WASTELAND','SNOWBALL_STORM','FLYING','NEW_YEAR\'S_PARTY'],
  2521. weapon : new Array(8).fill(''),
  2522. base : new Array(8).fill(''),
  2523. trinket : new Array(8).fill(''),
  2524. bait : new Array(8).fill(''),
  2525. boost : new Array(8).fill(false),
  2526. turbo : false,
  2527. minAAToFly : 20,
  2528. minFireworkToFly : 20,
  2529. landAfterFireworkRunOut : false
  2530. };
  2531. var objGWH = getStorageToObject('GWH2016R', objDefaultGWH2016);
  2532. var i,j,nLimit,strTemp,nIndex,nIndexTemp;
  2533. var bCanFly = false;
  2534. var nAAQuantity = parseInt(document.getElementsByClassName('winterHunt2016HUD-featuredItem-quantity')[0].textContent);
  2535. var nFireworkQuantity = parseInt(document.getElementsByClassName('winterHunt2016HUD-fireworks-quantity')[0].textContent);
  2536. if(userVariable.order_progress >= 10){ // can fly
  2537. bCanFly = true;
  2538. console.plog('Order Progress:', userVariable.order_progress, 'AA Quantity:', nAAQuantity, 'Firework Quantity:', nFireworkQuantity);
  2539. if(nAAQuantity >= objGWH.minAAToFly && nFireworkQuantity >= objGWH.minFireworkToFly){
  2540. fireEvent(document.getElementsByClassName('winterHunt2016HUD-flightButton')[0], 'click');
  2541. userVariable.status = 'flying';
  2542. }
  2543. }
  2544. if(userVariable.status == 'flying'){
  2545. if(nFireworkQuantity < 1 && objGWH.landAfterFireworkRunOut === true){
  2546. console.plog('Landing');
  2547. fireEvent(document.getElementsByClassName('winterHunt2016HUD-landButton mousehuntTooltipParent mousehuntActionButton tiny')[0], 'click');
  2548. window.setTimeout(function () { fireEvent(document.getElementsByClassName('mousehuntActionButton small winterHunt2016HUD-help-action-land active')[0], 'click'); }, 1500);
  2549. window.setTimeout(function () { eventLocationCheck('gwh'); }, 5000);
  2550. return;
  2551. }
  2552. console.plog('Flying');
  2553. nIndex = objGWH.zone.indexOf('FLYING');
  2554. checkThenArm(null, 'weapon', objGWH.weapon[nIndex]);
  2555. checkThenArm(null, 'base', objGWH.base[nIndex]);
  2556. checkThenArm(null, 'trinket', objGWH.trinket[nIndex]);
  2557. if(objGWH.bait[nIndex].indexOf('ANY') > -1 && nAAQuantity > 0)
  2558. checkThenArm(null, 'bait', 'Arctic Asiago');
  2559. else
  2560. checkThenArm(null, 'bait', objGWH.bait[nIndex]);
  2561. if(objGWH.boost[nIndex] === true){
  2562. var nNitroQuantity = parseInt(document.getElementsByClassName('winterHunt2016HUD-sledDetail')[2].textContent);
  2563. console.plog('Nitro Quantity:', nNitroQuantity);
  2564. if(Number.isNaN(nNitroQuantity) || nNitroQuantity < 1)
  2565. return;
  2566. if(objGWH.turbo && nNitroQuantity >= 3)
  2567. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[3], 'click');
  2568. else
  2569. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[2], 'click');
  2570. }
  2571. else{
  2572. if(userVariable.speed > 800){ // disable nitro when flying
  2573. console.plog('Disable nitro, Current Speed:', userVariable.speed);
  2574. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[1], 'click');
  2575. }
  2576. }
  2577. return;
  2578. }
  2579. var objOrderTemplate = {
  2580. type : "none",
  2581. tier : 1,
  2582. progress : 0
  2583. };
  2584. var arrOrder = [];
  2585. var arrType = ["decoration", "ski", "toy"];
  2586. for(i=0;i<userVariable.orders.length;i++){
  2587. arrOrder.push(JSON.parse(JSON.stringify(objOrderTemplate)));
  2588. for(j=0;j<arrType.length;j++){
  2589. if(userVariable.orders[i].item_type.indexOf(arrType[j]) > -1){
  2590. arrOrder[i].type = arrType[j];
  2591. break;
  2592. }
  2593. }
  2594. if(userVariable.orders[i].item_type.indexOf("_one_") > -1)
  2595. arrOrder[i].tier = 1;
  2596. else
  2597. arrOrder[i].tier = 2;
  2598. arrOrder[i].progress = userVariable.orders[i].progress;
  2599. if(arrOrder[i].progress >= 100 && !bCanFly){
  2600. console.plog('Order No:',i,'Type:',arrOrder[i].type,'Tier:',arrOrder[i].tier,'Progress:',arrOrder[i].progress);
  2601. fireEvent(document.getElementsByClassName('winterHunt2016HUD-order-action')[i],'click');
  2602. window.setTimeout(function () { eventLocationCheck('gwh'); }, 5000);
  2603. return;
  2604. }
  2605. }
  2606. console.plog(arrOrder);
  2607.  
  2608. var objZoneTemplate = {
  2609. name : "",
  2610. depth : 0,
  2611. isOrderZone : false,
  2612. type : "none",
  2613. tier : 1,
  2614. codename : ""
  2615. };
  2616. var arrZone = [];
  2617. var nIndexActive = -1;
  2618. for(i=userVariable.sprites.length-1;i>=0;i--){
  2619. if(userVariable.sprites[i].css_class.indexOf('active') > -1){ // current zone
  2620. nIndexActive = i;
  2621. break;
  2622. }
  2623. }
  2624. if(nIndexActive < 0)
  2625. return;
  2626. nLimit = nIndexActive + 2;
  2627. if(nLimit >= userVariable.sprites.length)
  2628. nLimit = userVariable.sprites.length - 1;
  2629. for(i=nIndexActive;i<=nLimit;i++){
  2630. nIndex = i - nIndexActive;
  2631. arrZone.push(JSON.parse(JSON.stringify(objZoneTemplate)));
  2632. nIndexTemp = userVariable.sprites[i].name.indexOf("(");
  2633. arrZone[nIndex].name = userVariable.sprites[i].name.substr(0,nIndexTemp-1);
  2634. if(arrZone[nIndex].name == 'Toy Lot' || arrZone[nIndex].name == 'Toy Emporium')
  2635. arrZone[nIndex].type = "toy";
  2636. else if(arrZone[nIndex].name == 'Decorative Oasis' || arrZone[nIndex].name == 'Tinsel Forest')
  2637. arrZone[nIndex].type = "decoration";
  2638. else if(arrZone[nIndex].name == 'Bunny Hills' || arrZone[nIndex].name == 'Frosty Mountains')
  2639. arrZone[nIndex].type = "ski";
  2640. arrZone[nIndex].tier = (userVariable.sprites[i].css_class.indexOf('tier_two') > -1) ? 2 : 1;
  2641. for(j=0;j<arrOrder.length;j++){
  2642. if(arrOrder[j].type == arrZone[nIndex].type && arrOrder[j].tier <= arrZone[nIndex].tier){
  2643. arrZone[nIndex].isOrderZone = true;
  2644. break;
  2645. }
  2646. }
  2647. if(arrZone[nIndex].type == "none"){
  2648. arrZone[nIndex].codename = arrZone[nIndex].name.toUpperCase().replace(/ /g,'_');
  2649. }
  2650. else{
  2651. if(arrZone[nIndex].isOrderZone)
  2652. arrZone[nIndex].codename = "ORDER" + arrZone[nIndex].tier;
  2653. else
  2654. arrZone[nIndex].codename = "NONORDER" + arrZone[nIndex].tier;
  2655. }
  2656. arrZone[nIndex].depth = parseInt(userVariable.sprites[i].name.substr(nIndexTemp+1,5));
  2657. }
  2658. console.plog(arrZone);
  2659.  
  2660. var nIndexZone = objGWH.zone.indexOf(arrZone[0].codename);
  2661. if(nIndexZone < 0)
  2662. return;
  2663. checkThenArm(null, 'weapon', objGWH.weapon[nIndexZone]);
  2664. checkThenArm(null, 'base', objGWH.base[nIndexZone]);
  2665. checkThenArm(null, 'trinket', objGWH.trinket[nIndexZone]);
  2666. if(objGWH.bait[nIndexZone].indexOf('ANY') > -1 && nAAQuantity > 0)
  2667. checkThenArm(null, 'bait', 'Arctic Asiago');
  2668. else
  2669. checkThenArm(null, 'bait', objGWH.bait[nIndexZone]);
  2670. if(objGWH.boost[nIndexZone] === true){
  2671. var nNitroQuantity = parseInt(document.getElementsByClassName('winterHunt2016HUD-sledDetail')[2].textContent);
  2672. console.plog('Nitro Quantity:', nNitroQuantity);
  2673. if(Number.isNaN(nNitroQuantity) || nNitroQuantity < 1)
  2674. return;
  2675. var nTotalMetersRemaining = parseInt(userVariable.meters_remaining);
  2676. for(i=1;i<arrZone.length;i++){
  2677. nIndexZone = objGWH.zone.indexOf(arrZone[i].codename);
  2678. if(nIndexZone < 0)
  2679. continue;
  2680. if(objGWH.boost[nIndexZone] === true)
  2681. nTotalMetersRemaining += arrZone[i].depth;
  2682. else
  2683. break;
  2684. }
  2685. console.plog('Boost Distance:', nTotalMetersRemaining, 'Turbo:', objGWH.turbo);
  2686. var fTemp = nTotalMetersRemaining/250;
  2687. var nLevel = Math.floor(fTemp);
  2688. if((nLevel - fTemp) >= 0.92) // because 230/250 = 0.92
  2689. nLevel++;
  2690. if(nLevel == 1){ // normal boost
  2691. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[2], 'click');
  2692. }
  2693. else if(nLevel > 1){
  2694. if(objGWH.turbo && nNitroQuantity >= 3)
  2695. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[3], 'click');
  2696. else
  2697. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[2], 'click');
  2698. }
  2699. else if(nLevel < 1 && userVariable.speed > 30){
  2700. console.plog('Disable nitro, Current Speed:', userVariable.speed);
  2701. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[1], 'click');
  2702. }
  2703. }
  2704. else{
  2705. if(userVariable.speed > 30){ // disable nitro in order zone
  2706. console.plog('Disable nitro, Current Speed:', userVariable.speed);
  2707. fireEvent(document.getElementsByClassName('winterHunt2016HUD-nitroButton-boundingBox')[1], 'click');
  2708. }
  2709. }
  2710. }
  2711.  
  2712. function SCCustom() {
  2713. if (GetCurrentLocation().indexOf("Sunken City") < 0)
  2714. return;
  2715.  
  2716. var objDefaultSCCustom = {
  2717. zone : ['ZONE_NOT_DIVE','ZONE_DEFAULT','ZONE_CORAL','ZONE_SCALE','ZONE_BARNACLE','ZONE_TREASURE','ZONE_DANGER','ZONE_DANGER_PP','ZONE_OXYGEN','ZONE_BONUS','ZONE_DANGER_PP_LOTA'],
  2718. zoneID : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
  2719. isHunt : new Array(11).fill(true),
  2720. bait : new Array(11).fill('Gouda'),
  2721. trinket : new Array(11).fill('None'),
  2722. useSmartJet : false
  2723. };
  2724. var objSCCustom = getStorageToObject('SCCustom', objDefaultSCCustom);
  2725. var zone = document.getElementsByClassName('zoneName')[0].innerText;
  2726. var zoneID = GetSunkenCityZone(zone);
  2727. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  2728. if (zoneID == objSCZone.ZONE_NOT_DIVE){
  2729. checkThenArm('best', 'base', objBestTrap.base.luck);
  2730. checkThenArm(null, 'trinket', objSCCustom.trinket[zoneID]);
  2731. checkThenArm(null, 'bait', objSCCustom.bait[zoneID]);
  2732. return;
  2733. }
  2734. var distance = parseInt(getPageVariable('user.quests.QuestSunkenCity.distance'));
  2735. console.plog('Current Zone:', zone, 'ID', zoneID, 'at meter', distance);
  2736. checkThenArm('best', 'base', bestSCBase);
  2737. var canJet = false;
  2738. if (!objSCCustom.isHunt[zoneID]){
  2739. var distanceToNextZone = [];
  2740. var isNextZoneInHuntZone = [];
  2741. var arrZone = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestSunkenCity.zones)'));
  2742. var nActiveZone = parseInt(getPageVariable('user.quests.QuestSunkenCity.active_zone'));
  2743. var nStartZoneIndex = 0;
  2744. var i, nIndex;
  2745. for(i=0;i<arrZone.length;i++){
  2746. if(arrZone[i].num == nActiveZone){
  2747. nStartZoneIndex = i+1;
  2748. break;
  2749. }
  2750. }
  2751. console.plog('Start Zone Index:', nStartZoneIndex);
  2752. for(i=nStartZoneIndex;i<arrZone.length;i++){
  2753. nIndex = i-nStartZoneIndex;
  2754. distanceToNextZone[nIndex] = parseInt((arrZone[i].left - 80) / 0.6);
  2755. isNextZoneInHuntZone[nIndex] = (objSCCustom.isHunt[GetSunkenCityZone(arrZone[i].name)]);
  2756. console.plog('Next Zone:', arrZone[i].name, 'in meter', distanceToNextZone[nIndex], 'Is In Hunt Zone:', isNextZoneInHuntZone[nIndex]);
  2757. }
  2758. if(distanceToNextZone.length === 0){
  2759. distanceToNextZone[0] = 0;
  2760. isNextZoneInHuntZone[0] = true;
  2761. }
  2762.  
  2763. // jet through
  2764. var charmElement = document.getElementsByClassName('charm');
  2765. var charmArmed = getPageVariable("user.trinket_name");
  2766. var isWJCArmed = (charmArmed.indexOf('Water Jet') > -1);
  2767. if (distanceToNextZone[0] >= 480 || (distanceToNextZone[1] >= 480 && (!isNextZoneInHuntZone[0])) || (!(isNextZoneInHuntZone[0]||isNextZoneInHuntZone[1]))) {
  2768. // arm Water Jet Charm
  2769. if(objSCCustom.useSmartJet)
  2770. checkThenArm('best', 'trinket', ['Smart Water Jet', 'Water Jet', objSCCustom.trinket[zoneID]]);
  2771. else
  2772. checkThenArm('best', 'trinket', ['Water Jet', objSCCustom.trinket[zoneID]]);
  2773. }
  2774. else
  2775. checkThenArm(null, 'trinket', objSCCustom.trinket[zoneID]);
  2776. }
  2777. else
  2778. checkThenArm(null, 'trinket', objSCCustom.trinket[zoneID]);
  2779. checkThenArm(null, 'bait', objSCCustom.bait[zoneID]);
  2780. }
  2781.  
  2782. function DisarmSCSpecialCharm(charmArmedName)
  2783. {
  2784. var specialCharms = ['Golden Anchor', 'Spiked Anchor', 'Ultimate Anchor', 'Oxygen Burst', 'Empowered Anchor', 'Water Jet'];
  2785. for (var i = 0; i < specialCharms.length; i++)
  2786. {
  2787. if (charmArmedName.indexOf(specialCharms[i]) > -1)
  2788. {
  2789. disarmTrap('trinket');
  2790. break;
  2791. }
  2792. }
  2793. }
  2794.  
  2795. function GetSunkenCityZone(zoneName)
  2796. {
  2797. var returnZone = 0;
  2798. switch (zoneName){
  2799. case 'Sand Dollar Sea Bar':
  2800. case 'Pearl Patch':
  2801. case 'Sunken Treasure':
  2802. returnZone = objSCZone.ZONE_TREASURE;
  2803. break;
  2804. case 'Feeding Grounds':
  2805. case 'Carnivore Cove':
  2806. returnZone = objSCZone.ZONE_DANGER;
  2807. break;
  2808. case 'Monster Trench':
  2809. returnZone = objSCZone.ZONE_DANGER_PP;
  2810. break;
  2811. case 'Lair of the Ancients':
  2812. returnZone = objSCZone.ZONE_DANGER_PP_LOTA;
  2813. break;
  2814. case 'Deep Oxygen Stream':
  2815. case 'Oxygen Stream':
  2816. returnZone = objSCZone.ZONE_OXYGEN;
  2817. break;
  2818. case 'Magma Flow':
  2819. returnZone = objSCZone.ZONE_BONUS;
  2820. break;
  2821. case 'Coral Reef':
  2822. case 'Coral Garden':
  2823. case 'Coral Castle':
  2824. returnZone = objSCZone.ZONE_CORAL;
  2825. break;
  2826. case 'School of Mice':
  2827. case 'Mermouse Den':
  2828. case 'Lost Ruins':
  2829. returnZone = objSCZone.ZONE_SCALE;
  2830. break;
  2831. case 'Rocky Outcrop':
  2832. case 'Shipwreck':
  2833. case 'Haunted Shipwreck':
  2834. returnZone = objSCZone.ZONE_BARNACLE;
  2835. break;
  2836. case 'Shallow Shoals':
  2837. case 'Sea Floor':
  2838. case 'Murky Depths':
  2839. returnZone = objSCZone.ZONE_DEFAULT;
  2840. break;
  2841. default:
  2842. returnZone = objSCZone.ZONE_NOT_DIVE;
  2843. break;
  2844. }
  2845. return returnZone;
  2846. }
  2847.  
  2848. function labyrinth() {
  2849. if (GetCurrentLocation().indexOf("Labyrinth") < 0)
  2850. return;
  2851.  
  2852. var labyStatus = getPageVariable("user.quests.QuestLabyrinth.status");
  2853. var isAtEntrance = (labyStatus=="intersection entrance");
  2854. var isAtHallway = (labyStatus=="hallway");
  2855. var isAtIntersection = (labyStatus=="intersection");
  2856. var isAtExit = (labyStatus=="exit");
  2857. var lastHunt = document.getElementsByClassName('labyrinthHUD-hallway-tile locked').length + 1;
  2858. var totalClue = parseInt(document.getElementsByClassName('labyrinthHUD-clueBar-totalClues')[0].innerText);
  2859. console.plog("Entrance:", isAtEntrance, "Intersection:", isAtIntersection, "Exit:", isAtExit);
  2860. var objLaby = getStorageToObject('Labyrinth', objDefaultLaby);
  2861. console.plog('District to focus:', objLaby.districtFocus);
  2862. bestLabyBase = bestLabyBase.concat(objBestTrap.base.luck).concat(objBestTrap.base.power);
  2863. var charmArmed = getPageVariable('user.trinket_name');
  2864. if(objLaby.armOtherBase != 'false'){
  2865. if(charmArmed.indexOf('Compass Magnet') === 0)
  2866. checkThenArm(null, 'base', objLaby.armOtherBase);
  2867. else
  2868. checkThenArm('best', 'base', bestLabyBase);
  2869. }
  2870. else
  2871. checkThenArm('best', 'base', bestLabyBase);
  2872.  
  2873. var userVariable = undefined;
  2874. if(objLaby.disarmCompass && charmArmed.indexOf('Compass Magnet') > -1){
  2875. userVariable = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestLabyrinth)'));
  2876. for (var i=0;i<userVariable.all_clues.length;i++){
  2877. if (userVariable.all_clues[i].name.toUpperCase().indexOf("DEAD") > -1){
  2878. if(userVariable.all_clues[i].quantity <= objLaby.nDeadEndClue)
  2879. disarmTrap('trinket');
  2880. break;
  2881. }
  2882. }
  2883. }
  2884.  
  2885. if(isAtHallway){
  2886. var strCurHallwayFullname = document.getElementsByClassName('labyrinthHUD-hallwayName')[0].textContent.toUpperCase();
  2887. if(strCurHallwayFullname.indexOf('FARMING') > -1){
  2888. if(objLaby.weaponFarming == 'Arcane')
  2889. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane.concat(objBestTrap.weapon.forgotten));
  2890. else
  2891. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  2892. }
  2893. else
  2894. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  2895. if(objLaby.securityDisarm){
  2896. var strCurHallwayTier = strCurHallwayFullname.split(' ')[1];
  2897. var maxCluePerHunt = 0;
  2898. if(strCurHallwayTier == 'PLAIN')
  2899. maxCluePerHunt = 1;
  2900. else if(strCurHallwayTier == 'SUPERIOR')
  2901. maxCluePerHunt = 2;
  2902. else
  2903. maxCluePerHunt = 3;
  2904. var classLantern = document.getElementsByClassName('labyrinthHUD-toggleLantern mousehuntTooltipParent');
  2905. var bLanternActive = true;
  2906. if(classLantern.length < 1)
  2907. bLanternActive = (getPageVariable('user.quests.QuestLabyrinth.lantern_status') == 'active');
  2908. else
  2909. bLanternActive = (classLantern[0].getAttribute('class').indexOf('inactive') < 0);
  2910. if(bLanternActive)
  2911. maxCluePerHunt++;
  2912. if(charmArmed.indexOf('Lantern Oil') > -1)
  2913. maxCluePerHunt++;
  2914. console.plog('Hallway Last Hunt :', lastHunt, 'Total Clues:', totalClue, 'Max Clue Per Hunt:', maxCluePerHunt);
  2915. if(lastHunt <= objLaby.lastHunt && totalClue >= (100-maxCluePerHunt*lastHunt))
  2916. disarmTrap('bait');
  2917. }
  2918. return;
  2919. }
  2920.  
  2921. if(isAtEntrance || isAtExit || objLaby.districtFocus.indexOf('None') > -1){
  2922. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  2923. checkThenArm(null, 'bait', 'Gouda');
  2924. disarmTrap('trinket');
  2925. return;
  2926. }
  2927.  
  2928. var doorsIntersect = document.getElementsByClassName('labyrinthHUD-door');
  2929. var doorsExit = document.getElementsByClassName('labyrinthHUD-exit');
  2930. var objDoors = {
  2931. name : [],
  2932. length : [],
  2933. tier : [],
  2934. clue : [],
  2935. code : [],
  2936. priorities : [],
  2937. debug : []
  2938. };
  2939. var temp = "";
  2940. for (var i=0;i<doorsIntersect.length;i++){
  2941. if (doorsIntersect[i].getAttribute('class').indexOf('mystery') > -1){
  2942. isAtIntersection = false;
  2943. return;
  2944. }
  2945.  
  2946. if (doorsIntersect[i].getAttribute('class').indexOf('broken') > -1 || doorsIntersect[i].children.length<2){
  2947. objDoors.length.push("LONG");
  2948. objDoors.tier.push("PLAIN");
  2949. objDoors.name.push("BROKEN");
  2950. objDoors.debug.push("LONG PLAIN BROKEN");
  2951. objDoors.code.push("");
  2952. objDoors.clue.push(Number.MAX_SAFE_INTEGER);
  2953. objDoors.priorities.push(Number.MAX_SAFE_INTEGER);
  2954. }
  2955. else {
  2956. temp = doorsIntersect[i].children[1].innerText.toUpperCase();
  2957. objDoors.debug.push(temp);
  2958. temp = temp.split(" ");
  2959. objDoors.length.push(temp[0]);
  2960. objDoors.tier.push(temp[1]);
  2961. objDoors.name.push(temp[2]);
  2962. objDoors.code.push(objCodename[temp[0]] + objCodename[temp[1]]);
  2963. objDoors.clue.push(Number.MAX_SAFE_INTEGER);
  2964. objDoors.priorities.push(Number.MAX_SAFE_INTEGER);
  2965. }
  2966. isAtIntersection = true;
  2967. }
  2968.  
  2969. console.plog(objDoors.debug.join(","));
  2970. temp = "";
  2971. var range = "";
  2972. var index = [];
  2973. try {
  2974. if(isNullOrUndefined(userVariable))
  2975. userVariable = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestLabyrinth)'));
  2976. for (var i=0;i<userVariable.all_clues.length;i++){
  2977. temp = userVariable.all_clues[i].name.toUpperCase();
  2978. if (temp.indexOf("DEAD") > -1)
  2979. continue;
  2980. index = getAllIndices(objDoors.name, temp);
  2981. for(var j=0;j<index.length;j++){
  2982. objDoors.clue[index[j]] = userVariable.all_clues[i].quantity;
  2983. }
  2984. }
  2985.  
  2986. index = objDoors.name.indexOf(objLaby.districtFocus);
  2987. if(index<0){
  2988. if(objLaby.chooseOtherDoors){
  2989. console.plog(objDoors);
  2990. temp = min(objDoors.clue);
  2991. var objFewestClue = {
  2992. num : temp,
  2993. indices : getAllIndices(objDoors.clue, temp),
  2994. count : countArrayElement(temp, objDoors.clue)
  2995. };
  2996. var objShortestLength = {
  2997. type : "SHORT",
  2998. indices : [],
  2999. count : 0
  3000. };
  3001. if(objDoors.length.indexOf("SHORT") > -1)
  3002. objShortestLength.type = "SHORT";
  3003. else if(objDoors.length.indexOf("MEDIUM") > -1)
  3004. objShortestLength.type = "MEDIUM";
  3005. else if(objDoors.length.indexOf("LONG") > -1)
  3006. objShortestLength.type = "LONG";
  3007. objShortestLength.indices = getAllIndices(objDoors.length, objShortestLength.type);
  3008. objShortestLength.count = objShortestLength.indices.length;
  3009. console.plog(JSON.stringify(objShortestLength));
  3010. console.plog(JSON.stringify(objFewestClue));
  3011. if(objShortestLength.indices.length < 1 || objFewestClue.indices.length < 1){
  3012. checkThenArm(null, 'bait', 'Gouda');
  3013. disarmTrap('trinket');
  3014. return;
  3015. }
  3016.  
  3017. var arrTemp = [];
  3018. var nMin = Number.MAX_SAFE_INTEGER;
  3019. var nMinIndex = -1;
  3020. if(objLaby.typeOtherDoors.indexOf("SHORTEST") === 0){ // SHORTEST_ONLY / SHORTEST_FEWEST
  3021. if(objShortestLength.count > 1 && objLaby.typeOtherDoors.indexOf("FEWEST") > -1){
  3022. for(var i=0;i<objShortestLength.indices.length;i++){
  3023. if(objDoors.clue[objShortestLength.indices[i]] < nMin){
  3024. nMin = objDoors.clue[objShortestLength.indices[i]];
  3025. nMinIndex = objShortestLength.indices[i];
  3026. }
  3027. }
  3028. if(nMinIndex > -1)
  3029. arrTemp.push(nMinIndex);
  3030. }
  3031. else
  3032. arrTemp = objShortestLength.indices;
  3033. }
  3034. else if(objLaby.typeOtherDoors.indexOf("FEWEST") === 0){ // FEWEST_ONLY / FEWEST_SHORTEST
  3035. if(objFewestClue.count > 1 && objLaby.typeOtherDoors.indexOf("SHORTEST") > -1){
  3036. var strTemp = "";
  3037. for(var i=0;i<objFewestClue.indices.length;i++){
  3038. strTemp = objDoors.length[objFewestClue.indices[i]].toUpperCase();
  3039. if(objLength.hasOwnProperty(strTemp) && objLength[strTemp] < nMin){
  3040. nMin = objLength[strTemp];
  3041. nMinIndex = objFewestClue.indices[i];
  3042. }
  3043. }
  3044. if(nMinIndex > -1)
  3045. arrTemp.push(nMinIndex);
  3046. }
  3047. else
  3048. arrTemp = objFewestClue.indices;
  3049. }
  3050. for(var i=0;i<arrTemp.length;i++){
  3051. if(objDoors.name[arrTemp[i]].indexOf("BROKEN") < 0){
  3052. if(objDoors.name[arrTemp[i]].indexOf('FARMING') > -1){
  3053. if(objLaby.weaponFarming == 'Arcane')
  3054. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane.concat(objBestTrap.weapon.forgotten));
  3055. else
  3056. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  3057. }
  3058. else
  3059. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  3060. checkThenArm(null, 'bait', 'Gouda');
  3061. disarmTrap('trinket');
  3062. fireEvent(doorsIntersect[arrTemp[i]], 'click');
  3063. window.setTimeout(function () { fireEvent(document.getElementsByClassName('mousehuntActionButton confirm')[0], 'click'); }, 1500);
  3064. break;
  3065. }
  3066. }
  3067. }
  3068. else{
  3069. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  3070. checkThenArm(null, 'bait', 'Gouda');
  3071. disarmTrap('trinket');
  3072. }
  3073. return;
  3074. }
  3075. else{
  3076. if(objDoors.clue[index]<15)
  3077. range = 'between0and14';
  3078. else if(objDoors.clue[index]<60)
  3079. range = 'between15and59';
  3080. else
  3081. range = 'between60and100';
  3082. }
  3083.  
  3084. var arr;
  3085. var arrAll = [];
  3086. for (var i=0;i<objLaby[range].length;i++){
  3087. // i = 0/1/2 = plain/superior/epic
  3088. arr = [];
  3089. for (var j=0;j<3;j++)
  3090. arr.push(j+1 + (objLaby[range].length-1-i)*3);
  3091.  
  3092. if(objLaby[range][i].indexOf(objCodename.LONG) === 0)
  3093. arrAll = arrAll.concat(arr.reverse());
  3094. else
  3095. arrAll = arrAll.concat(arr);
  3096. }
  3097.  
  3098. for (var i=arrAll.length;i<arrHallwayOrder.length;i++)
  3099. arrAll.push(Number.MAX_SAFE_INTEGER);
  3100.  
  3101. for (var i=0;i<objDoors.code.length;i++){
  3102. if(objDoors.name[i].indexOf(objLaby.districtFocus)>-1){
  3103. index = arrHallwayOrder.indexOf(objDoors.code[i]);
  3104. if(index > -1){
  3105. objDoors.priorities[i] = arrAll[index];
  3106. }
  3107. }
  3108. }
  3109.  
  3110. console.plog(objDoors);
  3111. var sortedDoorPriorities = sortWithIndices(objDoors.priorities, "ascend");
  3112. fireEvent(doorsIntersect[sortedDoorPriorities.index[0]], 'click');
  3113. window.setTimeout(function () { fireEvent(document.getElementsByClassName('mousehuntActionButton confirm')[0], 'click'); }, 1500);
  3114. if(objLaby.districtFocus.indexOf('FARMING') > -1){
  3115. if(objLaby.weaponFarming == 'Arcane')
  3116. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane.concat(objBestTrap.weapon.forgotten));
  3117. else
  3118. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  3119. }
  3120. else
  3121. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  3122. }
  3123. catch (e){
  3124. console.perror('labyrinth',e.message);
  3125. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  3126. checkThenArm(null, 'bait', 'Gouda');
  3127. disarmTrap('trinket');
  3128. return;
  3129. }
  3130. }
  3131.  
  3132. function zokor(){
  3133. var loc = GetCurrentLocation();
  3134. if (loc.indexOf("Labyrinth") > -1){
  3135. setStorage('eventLocation', 'Labyrinth');
  3136. labyrinth();
  3137. return;
  3138. }
  3139. else if (loc.indexOf("Zokor") < 0)
  3140. return;
  3141.  
  3142. var objDefaultZokor = {
  3143. bossStatus : ['INCOMING', 'ACTIVE', 'DEFEATED'],
  3144. bait : new Array(3).fill('Gouda'),
  3145. trinket : new Array(3).fill('None')
  3146. };
  3147. var objZokor = getStorageToObject('Zokor', objDefaultZokor);
  3148. var objAncientCity = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestAncientCity)'));
  3149. objAncientCity.boss = objAncientCity.boss.toUpperCase();
  3150. var nIndex = objZokor.bossStatus.indexOf(objAncientCity.boss);
  3151. console.plog('District Tier:', objAncientCity.district_tier, 'Boss Status:', objAncientCity.boss);
  3152. if(objAncientCity.district_tier < 3)
  3153. return;
  3154.  
  3155. checkThenArm('best', 'weapon', objBestTrap.weapon.forgotten);
  3156. checkThenArm('best', 'base', objBestTrap.base.luck);
  3157. if(nIndex > -1){
  3158. checkThenArm(null, 'bait', objZokor.bait[nIndex]);
  3159. if(objZokor.trinket[nIndex] == 'None')
  3160. disarmTrap('trinket');
  3161. else
  3162. checkThenArm(null, 'trinket', objZokor.trinket[nIndex]);
  3163. }
  3164. }
  3165.  
  3166. function fw(){
  3167. if (GetCurrentLocation().indexOf("Fiery Warpath") < 0)
  3168. return;
  3169.  
  3170. var wave = getPageVariable('user.viewing_atts.desert_warpath.wave');
  3171. wave = parseInt(wave);
  3172. var objDefaultFWAll = {
  3173. wave1 : JSON.parse(JSON.stringify(objDefaultFW)),
  3174. wave2 : JSON.parse(JSON.stringify(objDefaultFW)),
  3175. wave3 : JSON.parse(JSON.stringify(objDefaultFW)),
  3176. wave4 : JSON.parse(JSON.stringify(objDefaultFW)),
  3177. };
  3178. var objFWAll = getStorageToObject('FW', objDefaultFWAll);
  3179. var temp = false;
  3180. for(var prop in objFWAll){
  3181. if(objFWAll.hasOwnProperty(prop)){
  3182. if(assignMissingDefault(objFWAll[prop], objDefaultFW))
  3183. temp = true;
  3184. }
  3185. }
  3186. if(temp)
  3187. setStorage('FW', JSON.stringify(objFWAll));
  3188. var objFW = objFWAll['wave'+wave];
  3189. if (wave == 4){
  3190. var nWardenLeft = parseInt(document.getElementsByClassName('warpathHUD-wave wave_4')[0].getElementsByClassName('warpathHUD-wave-mouse-population')[0].textContent);
  3191. console.plog('Wave:', wave, 'Warden Left:', nWardenLeft);
  3192. if(Number.isNaN(nWardenLeft))
  3193. nWardenLeft = 12;
  3194. temp = (nWardenLeft <= 0) ? "after" : "before";
  3195. checkThenArm(null, 'weapon', objFW.warden[temp].weapon);
  3196. checkThenArm(null, 'base', objFW.warden[temp].base);
  3197. checkThenArm(null, 'trinket', objFW.warden[temp].trinket);
  3198. checkThenArm(null, 'bait', objFW.warden[temp].bait);
  3199. return;
  3200. }
  3201.  
  3202. checkThenArm(null, 'base', objFW.base);
  3203. objFW.streak = parseInt(document.getElementsByClassName('warpathHUD-streak-quantity')[0].innerText);
  3204. console.plog('Wave:', wave, 'Streak:', objFW.streak);
  3205. if(Number.isNaN(objFW.streak) || objFW.streak < 0 || objFW.streak >= g_fwStreakLength)
  3206. return;
  3207.  
  3208. if(isNullOrUndefined(objFW.cheese[objFW.streak]))
  3209. objFW.cheese[objFW.streak] = 'Gouda';
  3210. if(isNullOrUndefined(objFW.charmType[objFW.streak]))
  3211. objFW.charmType[objFW.streak] = 'Warpath';
  3212. if(isNullOrUndefined(objFW.special[objFW.streak]))
  3213. objFW.special[objFW.streak] = 'None';
  3214.  
  3215. objFW.streakMouse = getPageVariable('user.viewing_atts.desert_warpath.streak_type');
  3216. if(objFW.streakMouse.indexOf('desert_') > -1)
  3217. objFW.streakMouse = capitalizeFirstLetter(objFW.streakMouse.split('_')[1]);
  3218.  
  3219. console.plog('Current streak mouse type:', objFW.streakMouse);
  3220. var population = document.getElementsByClassName('warpathHUD-wave wave_' + wave.toString())[0].getElementsByClassName('warpathHUD-wave-mouse-population');
  3221. objFW.population = {
  3222. all : [],
  3223. normal : [],
  3224. special : [],
  3225. active : []
  3226. };
  3227. objFW.soldierActive = false;
  3228. var charmName;
  3229. for(var i=0;i<population.length;i++){
  3230. temp = parseInt(population[i].innerText);
  3231. if(Number.isNaN(temp))
  3232. temp = 0;
  3233. objFW.population.all.push(temp);
  3234. if(temp > 0)
  3235. objFW.population.active.push(1);
  3236. else
  3237. objFW.population.active.push(0);
  3238. if(i == objPopulation.WARRIOR || i == objPopulation.SCOUT || i == objPopulation.ARCHER){
  3239. objFW.population.normal.push(temp);
  3240. objFW.soldierActive |= (temp > 0);
  3241. }
  3242. else{
  3243. objFW.population.special.push(temp);
  3244. }
  3245. }
  3246.  
  3247. if(!objFW.soldierActive && objFW.focusType == 'NORMAL')
  3248. objFW.focusType = 'SPECIAL';
  3249.  
  3250. console.plog(objFW);
  3251. var index = -1;
  3252. var charmArmed = getPageVariable('user.trinket_name');
  3253. var nSum;
  3254. if(wave == 3 && !objFW.includeArtillery){
  3255. var arrTemp = objFW.population.active.slice();
  3256. arrTemp[objPopulation.ARTILLERY] = 0;
  3257. nSum = sumData(arrTemp);
  3258. if(nSum < 1)
  3259. nSum = 1;
  3260. }
  3261. else
  3262. nSum = sumData(objFW.population.active);
  3263. if(nSum == 1){ // only one soldier type left
  3264. if(objFW.lastSoldierConfig == 'CONFIG_STREAK')
  3265. objFW.priorities = 'HIGHEST';
  3266. else if(objFW.lastSoldierConfig == 'CONFIG_UNCHANGED')
  3267. return;
  3268. else if(objFW.lastSoldierConfig == 'CONFIG_GOUDA' || objFW.lastSoldierConfig == 'NO_WARPATH'){
  3269. index = objFW.population.active.indexOf(1);
  3270. if(index == objPopulation.CAVALRY)
  3271. checkThenArm('best', 'weapon', objBestTrap.weapon.tactical);
  3272. else if(index == objPopulation.MAGE)
  3273. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  3274. else if(index == objPopulation.ARTILLERY)
  3275. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane);
  3276. else
  3277. checkThenArm(null, 'weapon', objFW.weapon);
  3278. if(charmArmed.indexOf('Warpath') > -1)
  3279. disarmTrap('trinket');
  3280. if(objFW.lastSoldierConfig == 'CONFIG_GOUDA')
  3281. checkThenArm(null, 'bait', 'Gouda');
  3282. return;
  3283. }
  3284. }
  3285. if(objFW.special[objFW.streak] == 'COMMANDER'){
  3286. checkThenArm(null, 'weapon', objFW.weapon);
  3287. if(objFW.charmType[objFW.streak].indexOf('Super') > -1)
  3288. charmName = ["Super Warpath Commander's Charm", "Warpath Commander's Charm"];
  3289. else
  3290. charmName = "Warpath Commander's Charm";
  3291. }
  3292. else if(objFW.special[objFW.streak].indexOf('GARGANTUA') === 0){
  3293. checkThenArm('best', 'weapon', objBestTrap.weapon.draconic);
  3294. if(objFW.special[objFW.streak] == 'GARGANTUA_GGC' && objFW.streak >= 7)
  3295. charmName = 'Gargantua Guarantee Charm';
  3296. else
  3297. charmName = (charmArmed.indexOf('Warpath') > -1) ? 'None' : undefined;
  3298. }
  3299. else{
  3300. var bCurrentStreakZeroPopulation = false;
  3301. var bWrongSoldierTypeStreak = false;
  3302. var indexMinMax;
  3303. objFW.focusType = objFW.focusType.toLowerCase();
  3304. if(objFW.priorities == 'HIGHEST')
  3305. indexMinMax = maxIndex(objFW.population[objFW.focusType]);
  3306. else{
  3307. for(var i=0;i<objFW.population[objFW.focusType].length;i++){
  3308. if(objFW.population[objFW.focusType][i] < 1)
  3309. objFW.population[objFW.focusType][i] = Number.MAX_SAFE_INTEGER;
  3310. }
  3311. indexMinMax = minIndex(objFW.population[objFW.focusType]);
  3312. }
  3313. index = objPopulation.name.indexOf(objFW.streakMouse);
  3314. if(index > -1){
  3315. bCurrentStreakZeroPopulation = (objFW.population.all[index] < 1);
  3316. if(objFW.soldierActive && index >=3 && objFW.focusType.toUpperCase() == 'NORMAL'){
  3317. bWrongSoldierTypeStreak = !(objFW.streak == 2 || objFW.streak >= 5);
  3318. }
  3319. else if(!objFW.soldierActive && objFW.focusType.toUpperCase() == 'SPECIAL'){
  3320. bWrongSoldierTypeStreak = (index != (indexMinMax+3) && objFW.streak < 2);
  3321. }
  3322. }
  3323.  
  3324. if(objFW.streak === 0 || bCurrentStreakZeroPopulation || bWrongSoldierTypeStreak){
  3325. objFW.streak = 0;
  3326. temp = objFW.population[objFW.focusType][indexMinMax];
  3327. if(objFW.focusType.toUpperCase() == 'NORMAL'){
  3328. checkThenArm(null, 'weapon', objFW.weapon);
  3329. var count = countArrayElement(temp, objFW.population[objFW.focusType]);
  3330. if(count > 1){
  3331. if(objFW.population[objFW.focusType][objPopulation.SCOUT] == temp)
  3332. charmName = objFW.charmType[0] + ' Scout';
  3333. else if(objFW.population[objFW.focusType][objPopulation.ARCHER] == temp)
  3334. charmName = objFW.charmType[0] + ' Archer';
  3335. else if(objFW.population[objFW.focusType][objPopulation.WARRIOR] == temp)
  3336. charmName = objFW.charmType[0] + ' Warrior';
  3337. }
  3338. else{
  3339. charmName = objFW.charmType[0] + ' ' + objPopulation.name[indexMinMax];
  3340. }
  3341. }
  3342. else{
  3343. if((indexMinMax+3) == objPopulation.ARTILLERY && nSum !=1){
  3344. temp = objFW.population.special.slice();
  3345. temp.splice(indexMinMax,1);
  3346. if(objFW.priorities == 'HIGHEST')
  3347. indexMinMax = maxIndex(temp);
  3348. else
  3349. indexMinMax = minIndex(temp);
  3350. }
  3351. indexMinMax += 3;
  3352. if(indexMinMax == objPopulation.CAVALRY){
  3353. checkThenArm('best', 'weapon', objBestTrap.weapon.tactical);
  3354. charmName = objFW.charmType[0] + ' Cavalry';
  3355. }
  3356. else if(indexMinMax == objPopulation.MAGE){
  3357. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  3358. charmName = objFW.charmType[0] + ' Mage';
  3359. }
  3360. else if(indexMinMax == objPopulation.ARTILLERY){
  3361. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane);
  3362. if(charmArmed.indexOf('Warpath') > -1)
  3363. charmName = 'None';
  3364. else
  3365. charmName = undefined;
  3366. }
  3367. }
  3368. }
  3369. else{ // streak 1 and above
  3370. if(index == objPopulation.ARTILLERY && charmArmed.indexOf('Warpath') > -1)
  3371. charmName = 'None';
  3372. else{
  3373. if(objFW.charmType[objFW.streak].indexOf('Super') > -1)
  3374. charmName = [objFW.charmType[objFW.streak] + ' ' + objPopulation.name[index], 'Warpath ' + objPopulation.name[index]];
  3375. else
  3376. charmName = objFW.charmType[objFW.streak] + ' ' + objPopulation.name[index];
  3377. }
  3378.  
  3379. if(index == objPopulation.CAVALRY)
  3380. checkThenArm('best', 'weapon', objBestTrap.weapon.tactical);
  3381. else if(index == objPopulation.MAGE)
  3382. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  3383. else if(index == objPopulation.ARTILLERY)
  3384. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane);
  3385. else
  3386. checkThenArm(null, 'weapon', objFW.weapon);
  3387. }
  3388. }
  3389. checkThenArm(null, 'bait', objFW.cheese[objFW.streak]);
  3390. if(objFW.disarmAfterSupportRetreat && sumData(objFW.population.all) <= g_arrFWSupportRetreat[wave]){
  3391. if(charmArmed.indexOf('Warpath') > -1)
  3392. disarmTrap('trinket');
  3393. }
  3394. else
  3395. checkThenArm('best', 'trinket', charmName);
  3396. }
  3397.  
  3398. function fRift(){
  3399. if(GetCurrentLocation().indexOf('Furoma Rift') < 0)
  3400. return;
  3401.  
  3402. var objDefaultFR = {
  3403. enter : 0,
  3404. retreat : 0,
  3405. weapon : new Array(11).fill(''),
  3406. base : new Array(11).fill(''),
  3407. trinket : new Array(11).fill(''),
  3408. bait : new Array(11).fill(''),
  3409. masterOrder : new Array(11).fill('Glutter=>Combat=>Susheese')
  3410. };
  3411. var objFR = getStorageToObject('FRift', objDefaultFR);
  3412. objFR.enter = parseInt(objFR.enter);
  3413. objFR.retreat = parseInt(objFR.retreat);
  3414. var objUserFRift = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestRiftFuroma)'));
  3415. console.plog(objUserFRift.view_state);
  3416. var bInPagoda = (objUserFRift.view_state == 'pagoda' || objUserFRift.view_state == 'pagoda knows_all');
  3417. var i;
  3418. if(bInPagoda){
  3419. var nCurBatteryLevel = 0;
  3420. var nRemainingEnergy = parseInt(getPageVariable('user.quests.QuestRiftFuroma.droid.remaining_energy').replace(/,/g, ''));
  3421. if(Number.isNaN(nRemainingEnergy)){
  3422. console.plog('Remaining Energy:', nRemainingEnergy);
  3423. return;
  3424. }
  3425. for(i=objFRBattery.cumulative.length-1;i>=0;i--){
  3426. if(nRemainingEnergy <= objFRBattery.cumulative[i])
  3427. nCurBatteryLevel = i+1;
  3428. else
  3429. break;
  3430. }
  3431. console.plog('In Pagoda, Current Battery Level:', nCurBatteryLevel, 'Remaining Energy:', nRemainingEnergy);
  3432. if(nCurBatteryLevel <= objFR.retreat){
  3433. fRiftArmTrap(objFR, 0);
  3434. if(nCurBatteryLevel !== 0){
  3435. // retreat
  3436. fireEvent(document.getElementsByClassName('riftFuromaHUD-leavePagoda')[0], 'click');
  3437. window.setTimeout(function () { fireEvent(document.getElementsByClassName('mousehuntActionButton confirm')[0], 'click'); }, 1500);
  3438. }
  3439. }
  3440. else{
  3441. fRiftArmTrap(objFR, nCurBatteryLevel);
  3442. }
  3443. }
  3444. else{
  3445. var nFullBatteryLevel = 0;
  3446. var classBattery = document.getElementsByClassName('riftFuromaHUD-battery');
  3447. var nStoredEnerchi = parseInt(document.getElementsByClassName('total_energy')[0].children[1].innerText.replace(/,/g, ''));
  3448. if(classBattery.length < 1 || Number.isNaN(nStoredEnerchi)){
  3449. console.plog('Stored Enerchi:',nStoredEnerchi);
  3450. return;
  3451. }
  3452. for(i=0;i<objFRBattery.cumulative.length;i++){
  3453. if(nStoredEnerchi >= objFRBattery.cumulative[i])
  3454. nFullBatteryLevel = i+1;
  3455. else
  3456. break;
  3457. }
  3458. console.plog('In Training Ground, Fully Charged Battery Level:', nFullBatteryLevel, 'Stored Enerchi:', nStoredEnerchi);
  3459. if(Number.isInteger(objFR.enter) && nFullBatteryLevel >= objFR.enter){
  3460. fRiftArmTrap(objFR, objFR.enter);
  3461. // enter
  3462. fireEvent(classBattery[objFR.enter-1], 'click');
  3463. window.setTimeout(function () { fireEvent(document.getElementsByClassName('mousehuntActionButton confirm')[0], 'click'); }, 1500);
  3464. }
  3465. else{
  3466. fRiftArmTrap(objFR, 0);
  3467. }
  3468. }
  3469. }
  3470.  
  3471. function fRiftArmTrap(obj, nIndex, bReadJournal){
  3472. if(isNullOrUndefined(bReadJournal))
  3473. bReadJournal = true;
  3474. checkThenArm(null, 'weapon', obj.weapon[nIndex]);
  3475. checkThenArm(null, 'base', obj.base[nIndex]);
  3476. checkThenArm(null, 'trinket', obj.trinket[nIndex]);
  3477. if(obj.bait[nIndex] == 'ANY_MASTER')
  3478. checkThenArm('any', 'bait', 'ANY_MASTER');
  3479. else if(obj.bait[nIndex] == 'ORDER_MASTER'){
  3480. var arr = obj.masterOrder[nIndex].split("=>");
  3481. arr = arr.map(function(e) {return 'Rift ' + e;});
  3482. checkThenArm('best', 'bait', arr);
  3483. }
  3484. else if(obj.bait[nIndex] == 'BALANCE_MASTER'){
  3485. if(g_arrHeirloom.length === 0){
  3486. var nRetry = 4;
  3487. var bFirst = true;
  3488. var intervalFRAT = setInterval( function () {
  3489. if (document.getElementsByClassName('riftFuromaHUD-craftingPopup-tabContent pinnacle').length > 0){
  3490. fireEvent(document.getElementsByClassName('riftFuromaHUD-craftingPopup-tabHeader')[3],'click'); // close
  3491. var classPinnacle = document.getElementsByClassName('riftFuromaHUD-craftingPopup-tabContent pinnacle');
  3492. var i,temp;
  3493. for(i=0;i<3;i++){
  3494. temp = classPinnacle[0].getElementsByClassName('riftFuromaHUD-craftingPopup-recipe-part')[i];
  3495. g_arrHeirloom.push(parseInt(temp.getAttribute('data-part-owned')));
  3496. if(Number.isNaN(g_arrHeirloom[i])){
  3497. console.plog('Invalid Heirloom:', g_arrHeirloom);
  3498. checkThenArm('any', 'bait', 'ANY_MASTER');
  3499. return;
  3500. }
  3501. }
  3502. if(g_arrHeirloom.length != 3){
  3503. console.plog('Invalid length:', g_arrHeirloom);
  3504. checkThenArm('any', 'bait', 'ANY_MASTER');
  3505. return;
  3506. }
  3507. setStorage('LastRecordedJournalFRift', document.getElementsByClassName('journaltext')[0].parentNode.textContent);
  3508. fRiftArmTrap(obj, nIndex, false);
  3509. clearInterval(intervalFRAT);
  3510. intervalFRAT = null;
  3511. }
  3512. else{
  3513. fireEvent(document.getElementsByClassName('riftFuromaHUD-itemGroup-craftButton')[3],'click');
  3514. --nRetry;
  3515. if(nRetry <= 0){
  3516. console.plog('Max Retry, arm any Rift Master Cheese');
  3517. checkThenArm('any', 'bait', 'ANY_MASTER');
  3518. clearInterval(intervalFRAT);
  3519. intervalFRAT = null;
  3520. }
  3521. }
  3522. }, 1000);
  3523. }
  3524. else{
  3525. if(bReadJournal === true)
  3526. getJournalDetailFRift();
  3527. console.plog('Heirloom:', g_arrHeirloom);
  3528. var arrBait = g_objConstTrap.bait.ANY_MASTER.name;
  3529. var nMin = min(g_arrHeirloom);
  3530. var fAvg = average(g_arrHeirloom);
  3531. if(fAvg == nMin){
  3532. checkThenArm('any', 'bait', 'ANY_MASTER');
  3533. }
  3534. else{
  3535. temp = minIndex(g_arrHeirloom);
  3536. if(temp > -1){
  3537. var arrBaitNew = [];
  3538. var objSort = sortWithIndices(g_arrHeirloom);
  3539. for(i=0;i<objSort.index.length;i++){
  3540. arrBaitNew[i] = arrBait[objSort.index[i]];
  3541. }
  3542. console.plog('New Bait List:', arrBaitNew);
  3543. checkThenArm('best', 'bait', arrBaitNew);
  3544. }
  3545. else{
  3546. console.plog('Invalid index:', temp);
  3547. checkThenArm('any', 'bait', 'ANY_MASTER');
  3548. }
  3549. }
  3550. }
  3551. }
  3552. else
  3553. checkThenArm(null, 'bait', obj.bait[nIndex]);
  3554. }
  3555.  
  3556. function livingGarden(obj) {
  3557. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  3558. var charmArmed = getPageVariable('user.trinket_name');
  3559. var baitArmed = getPageVariable('user.bait_name');
  3560. var pourEstimate = document.getElementsByClassName('pourEstimate')[0];
  3561. var estimateHunt = parseInt(pourEstimate.innerText);
  3562. var strStatus = '';
  3563. if(Number.isNaN(estimateHunt))
  3564. strStatus = 'Poured';
  3565. else if(estimateHunt >= 35)
  3566. strStatus = 'Filled';
  3567. else
  3568. strStatus = 'Filling';
  3569. console.plog('Estimate Hunt:', estimateHunt, 'Status:', strStatus);
  3570. if (obj.LG.trinket.after.indexOf('Sponge') > -1)
  3571. obj.LG.trinket.after = 'None';
  3572. if(strStatus == 'Poured'){
  3573. checkThenArm(null, 'base', obj.LG.base.after);
  3574. checkThenArm(null, 'trinket', obj.LG.trinket.after);
  3575. checkThenArm(null, 'bait', obj.LG.bait.after);
  3576. }
  3577. else if(strStatus == 'Filled'){
  3578. var pourButton = document.getElementsByClassName('pour')[0];
  3579. if(obj.LG.isAutoPour && !isNullOrUndefined(pourButton)){
  3580. fireEvent(pourButton, 'click');
  3581. if (document.getElementsByClassName('confirm button')[0]){
  3582. window.setTimeout(function () { fireEvent(document.getElementsByClassName('confirm button')[0], 'click'); }, 1000);
  3583. checkThenArm(null, 'base', obj.LG.base.after);
  3584. checkThenArm(null, 'trinket', obj.LG.trinket.after);
  3585. checkThenArm(null, 'bait', obj.LG.bait.after);
  3586. }
  3587. else{
  3588. checkThenArm('best', 'base', bestLGBase);
  3589. if (charmArmed.indexOf('Sponge') > -1)
  3590. disarmTrap('trinket');
  3591. if (baitArmed.indexOf('Camembert') > -1)
  3592. checkThenArm(null, 'bait', 'Gouda');
  3593. }
  3594. }
  3595. else{
  3596. checkThenArm('best', 'base', bestLGBase);
  3597. if (charmArmed.indexOf('Sponge') > -1)
  3598. disarmTrap('trinket');
  3599. if (baitArmed.indexOf('Camembert') > -1)
  3600. checkThenArm(null, 'bait', 'Gouda');
  3601. }
  3602. }
  3603. else if(strStatus == 'Filling'){
  3604. checkThenArm('best', 'base', bestLGBase);
  3605. if(!obj.LG.isAutoFill){
  3606. if (charmArmed.indexOf('Sponge') > -1 ||
  3607. obj.LG.trinket.after.indexOf(charmArmed) > -1 || charmArmed.indexOf(obj.LG.trinket.after) > -1)
  3608. disarmTrap('trinket');
  3609. }
  3610. else{
  3611. if (estimateHunt >= 28)
  3612. checkThenArm(null, 'trinket', 'Sponge');
  3613. else
  3614. checkThenArm('best', 'trinket', spongeCharm);
  3615. }
  3616. if (baitArmed.indexOf('Camembert') > -1 && baitArmed.indexOf('Duskshade') < 0)
  3617. checkThenArm(null, 'bait', 'Gouda');
  3618. }
  3619. }
  3620.  
  3621. function lostCity(obj) {
  3622. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane);
  3623. checkThenArm(null, 'bait', 'Dewthief');
  3624. var isCursed = (document.getElementsByClassName('stateBlessed hidden').length > 0);
  3625. console.plog('Cursed:', isCursed);
  3626.  
  3627. //disarm searcher charm when cursed is lifted
  3628. if (!isCursed) {
  3629. checkThenArm(null, 'base', obj.LG.base.after);
  3630. if (obj.LC.trinket.after.indexOf('Searcher') > -1)
  3631. obj.LC.trinket.after = 'None';
  3632. checkThenArm(null, 'trinket', obj.LC.trinket.after);
  3633. }
  3634. else{
  3635. checkThenArm(null, 'trinket', 'Searcher');
  3636. checkThenArm('best', 'base', bestLGBase);
  3637. }
  3638. }
  3639.  
  3640. function sandDunes() {
  3641. var hasStampede = getPageVariable('user.quests.QuestSandDunes.minigame.has_stampede');
  3642. console.plog('Has Stampede:', hasStampede);
  3643.  
  3644. //disarm grubling chow charm when there is no stampede
  3645. if (hasStampede == 'false'){
  3646. if (getPageVariable('user.trinket_name').indexOf('Chow') > -1)
  3647. disarmTrap('trinket');
  3648. }
  3649. else
  3650. checkThenArm(null, 'trinket', 'Grubling Chow');
  3651. checkThenArm('best', 'weapon', objBestTrap.weapon.shadow);
  3652. checkThenArm('best', 'base', bestLGBase);
  3653. checkThenArm(null, 'bait', 'Dewthief');
  3654. }
  3655.  
  3656. function twistedGarden(obj) {
  3657. checkThenArm('best', 'weapon', objBestTrap.weapon.hydro);
  3658. var red = parseInt(document.getElementsByClassName('itemImage red')[0].innerText);
  3659. var yellow = parseInt(document.getElementsByClassName('itemImage yellow')[0].innerText);
  3660. var nEstimateHunt = -1;
  3661. var charmArmed = getPageVariable('user.trinket_name');
  3662. var strStatus = '';
  3663. if(Number.isNaN(red) || Number.isNaN(yellow) || document.getElementsByClassName('stateFilling hidden').length > 0){
  3664. strStatus = 'Poured';
  3665. nEstimateHunt = parseInt(document.getElementsByClassName('pouring')[0].textContent);
  3666. }
  3667. else if(red == 10 && yellow == 10)
  3668. strStatus = 'Filled';
  3669. else
  3670. strStatus = 'Filling';
  3671. console.plog('Red:', red, 'Yellow:', yellow, 'Estimate Hunt:', nEstimateHunt, 'Status:', strStatus);
  3672. var redPlusYellow = redSpongeCharm.concat(yellowSpongeCharm);
  3673. if (obj.TG.trinket.after.indexOf('Red') > -1 || obj.TG.trinket.after.indexOf('Yellow') > -1)
  3674. obj.TG.trinket.after = 'None';
  3675. if(strStatus == 'Poured'){
  3676. checkThenArm(null, 'base', obj.TG.base.after);
  3677. checkThenArm(null, 'trinket', obj.TG.trinket.after);
  3678. checkThenArm(null, 'bait', obj.TG.bait.after);
  3679. }
  3680. else if(strStatus == 'Filled'){
  3681. var pourButton = document.getElementsByClassName('pour')[0];
  3682. if(obj.TG.isAutoPour && !isNullOrUndefined(pourButton)){
  3683. fireEvent(pourButton, 'click');
  3684. if (document.getElementsByClassName('confirm button')[0]){
  3685. window.setTimeout(function () { fireEvent(document.getElementsByClassName('confirm button')[0], 'click'); }, 1000);
  3686. checkThenArm(null, 'base', obj.TG.base.after);
  3687. checkThenArm(null, 'trinket', obj.TG.trinket.after);
  3688. checkThenArm(null, 'bait', obj.TG.bait.after);
  3689. }
  3690. else{
  3691. checkThenArm('best', 'base', bestLGBase);
  3692. if (charmArmed.indexOf('Red') > -1 || charmArmed.indexOf('Yellow') > -1)
  3693. disarmTrap('trinket');
  3694. checkThenArm(null, 'bait', 'Duskshade Camembert');
  3695. }
  3696. }
  3697. else{
  3698. checkThenArm('best', 'base', bestLGBase);
  3699. if (charmArmed.indexOf('Red') > -1 || charmArmed.indexOf('Yellow') > -1)
  3700. disarmTrap('trinket');
  3701. checkThenArm(null, 'bait', 'Duskshade Camembert');
  3702. }
  3703. }
  3704. else if(strStatus == 'Filling'){
  3705. checkThenArm('best', 'base', bestLGBase);
  3706. if(!obj.TG.isAutoFill){
  3707. if (charmArmed.indexOf('Red') > -1 || charmArmed.indexOf('Yellow') > -1 ||
  3708. obj.TG.trinket.after.indexOf(charmArmed) > -1 || charmArmed.indexOf(obj.TG.trinket.after) > -1)
  3709. disarmTrap('trinket');
  3710. }
  3711. else{
  3712. if (red <= 8 && yellow <= 8)
  3713. checkThenArm('best', 'trinket', redPlusYellow);
  3714. else if (red < 10){
  3715. if (red <= 8)
  3716. checkThenArm('best', 'trinket', redSpongeCharm);
  3717. else
  3718. checkThenArm(null, 'trinket', 'Red Sponge');
  3719. }
  3720. else if (red == 10 && yellow < 10){
  3721. if (yellow <=8)
  3722. checkThenArm('best', 'trinket', yellowSpongeCharm);
  3723. else
  3724. checkThenArm(null, 'trinket', 'Yellow Sponge');
  3725. }
  3726. }
  3727. checkThenArm(null, 'bait', 'Duskshade Camembert');
  3728. }
  3729. }
  3730.  
  3731. function cursedCity(obj) {
  3732. checkThenArm('best', 'weapon', objBestTrap.weapon.arcane);
  3733. checkThenArm(null, 'bait', 'Graveblossom');
  3734. var objCC = JSON.parse(getPageVariable('JSON.stringify(user.quests.QuestLostCity.minigame)'));
  3735. var curses = "";
  3736. var charmArmed = getPageVariable('user.trinket_name');
  3737. console.plog(objCC);
  3738. if (objCC.is_cursed === false){
  3739. checkThenArm(null, 'base', obj.CC.base.after);
  3740. if (obj.CC.trinket.after.indexOf('Bravery') > -1 || obj.CC.trinket.after.indexOf('Shine') > -1 || obj.CC.trinket.after.indexOf('Clarity') > -1)
  3741. obj.CC.trinket.after = 'None';
  3742. checkThenArm(null, 'trinket', obj.CC.trinket.after);
  3743. }
  3744. else{
  3745. var cursedCityCharm = [];
  3746. for (var i = 0; i < objCC.curses.length; ++i){
  3747. console.plog("i:", i, "Active:", objCC.curses[i].active);
  3748. if(objCC.curses[i].active){
  3749. switch (i){
  3750. case 0:
  3751. console.plog("Fear Active");
  3752. cursedCityCharm.push('Bravery');
  3753. break;
  3754. case 1:
  3755. console.plog("Darkness Active");
  3756. cursedCityCharm.push('Shine');
  3757. break;
  3758. case 2:
  3759. console.plog("Mist Active");
  3760. cursedCityCharm.push('Clarity');
  3761. break;
  3762. }
  3763. }
  3764. }
  3765. checkThenArm('any', 'trinket', cursedCityCharm);
  3766. checkThenArm('best', 'base', bestLGBase);
  3767. }
  3768. }
  3769.  
  3770. function sandCrypts(obj) {
  3771. checkThenArm('best', 'weapon', objBestTrap.weapon.shadow);
  3772. checkThenArm(null, 'bait', 'Graveblossom');
  3773. var salt = parseInt(document.getElementsByClassName('salt_charms')[0].innerText);
  3774. console.plog('Salted:', salt);
  3775. if (salt >= obj.SC.maxSaltCharged){
  3776. checkThenArm(null, 'base', obj.SC.base.after);
  3777. checkThenArm(null, 'trinket', 'Grub Scent');
  3778. }
  3779. else {
  3780. checkThenArm(null, 'base', obj.SC.base.before);
  3781. if ((obj.SC.maxSaltCharged - salt) == 1)
  3782. checkThenArm(null, 'trinket', 'Grub Salt');
  3783. else
  3784. checkThenArm('best', 'trinket', bestSalt);
  3785. }
  3786. }
  3787.  
  3788. function DisarmLGSpecialCharm(locationName)
  3789. {
  3790. var obj = {};
  3791. obj['Living Garden'] = spongeCharm.slice();
  3792. obj['Lost City'] = ['Searcher'];
  3793. obj['Sand Dunes'] = ['Grubling Chow'];
  3794. obj['Twisted Garden'] = redSpongeCharm.concat(yellowSpongeCharm);
  3795. obj['Cursed City'] = ['Bravery', 'Shine', 'Clarity'];
  3796. obj['Sand Crypts'] = bestSalt.slice();
  3797. delete obj[locationName];
  3798. var charmArmed = getPageVariable("user.trinket_name");
  3799. for (var prop in obj)
  3800. {
  3801. if(obj.hasOwnProperty(prop))
  3802. {
  3803. for (var i = 0; i < obj[prop].length; ++i)
  3804. {
  3805. if (charmArmed.indexOf(obj[prop][i]) === 0)
  3806. {
  3807. disarmTrap('trinket');
  3808. return;
  3809. }
  3810. }
  3811. }
  3812. }
  3813. }
  3814.  
  3815. function retrieveMouseList() {
  3816. fireEvent(document.getElementById('effectiveness'), 'click');
  3817. var sec = secWait;
  3818. var intervalRML = setInterval(
  3819. function () {
  3820. if (document.getElementsByClassName('thumb').length > 0)
  3821. {
  3822. mouseList = [];
  3823. var y = document.getElementsByClassName('thumb');
  3824. for (var i = 0; i < y.length; ++i) {
  3825. mouseList.push(y[i].getAttribute('title'));
  3826. }
  3827. fireEvent(document.getElementById('trapSelectorBrowserClose'), 'click');
  3828. clearInterval(intervalRML);
  3829. intervalRML = null;
  3830. return;
  3831. }
  3832. else
  3833. {
  3834. --sec;
  3835. if (sec <= 0) {
  3836. fireEvent(document.getElementById('effectiveness'), 'click');
  3837. sec = secWait;
  3838. }
  3839. }
  3840. }, 1000);
  3841. return;
  3842. }
  3843.  
  3844. function checkMouse(mouseName) {
  3845. for (var i = 0; i < mouseList.length; ++i) {
  3846. if (mouseList[i].indexOf(mouseName) > -1) {
  3847. return true;
  3848. }
  3849. return false;
  3850. }
  3851. }
  3852.  
  3853. function magicalPillowcase(){
  3854.  
  3855. }
  3856.  
  3857. function checkCharge2016(stopDischargeAt){
  3858. try {
  3859. var charge = parseInt(document.getElementsByClassName('springHuntHUD-charge-quantity')[0].innerText);
  3860. var isDischarge = (getStorage("discharge") == "true");
  3861. console.plog('Current Charge:', charge, 'Discharging:', isDischarge, 'Stop Discharge At:', stopDischargeAt);
  3862. var charmContainer = document.getElementsByClassName('springHuntHUD-charmContainer')[0];
  3863. var eggstra = {};
  3864. eggstra.quantity = parseInt(charmContainer.children[0].children[0].innerText);
  3865. eggstra.link = charmContainer.children[0].children[1];
  3866. eggstra.isArmed = (eggstra.link.getAttribute('class').indexOf('active') > 0);
  3867. eggstra.canArm = (eggstra.quantity > 0 && !eggstra.isArmed);
  3868. var eggstraCharge = {};
  3869. eggstraCharge.quantity = parseInt(charmContainer.children[1].children[0].innerText);
  3870. eggstraCharge.link = charmContainer.children[1].children[1];
  3871. eggstraCharge.isArmed = (eggstraCharge.link.getAttribute('class').indexOf('active') > 0);
  3872. eggstraCharge.canArm = (eggstraCharge.quantity > 0 && !eggstraCharge.isArmed);
  3873. var eggscavator = {};
  3874. eggscavator.quantity = parseInt(charmContainer.children[2].children[0].innerText);
  3875. eggscavator.link = charmContainer.children[2].children[1];
  3876. eggscavator.isArmed = (eggscavator.link.getAttribute('class').indexOf('active') > 0);
  3877. eggscavator.canArm = (eggscavator.quantity > 0 && !eggscavator.isArmed);
  3878.  
  3879. if (charge == 20) {
  3880. setStorage("discharge", "true");
  3881. if (eggstra.canArm) fireEvent(eggstra.link, 'click');
  3882. }
  3883. else if (charge < 20 && charge > stopDischargeAt) {
  3884. if (isDischarge) {
  3885. if (eggstra.canArm) fireEvent(eggstra.link, 'click');
  3886. }
  3887. else {
  3888. if (charge >= chargeHigh) {
  3889. if (eggstraCharge.quantity > 0){
  3890. if (!eggstraCharge.isArmed) fireEvent(eggstraCharge.link, 'click');
  3891. }
  3892. else{
  3893. if (eggscavator.canArm) fireEvent(eggscavator.link, 'click');
  3894. }
  3895. }
  3896. else {
  3897. if (eggscavator.canArm) fireEvent(eggscavator.link, 'click');
  3898. }
  3899. }
  3900. }
  3901. else if (charge <= stopDischargeAt) {
  3902. if (charge >= chargeHigh) {
  3903. if (eggstraCharge.quantity > 0){
  3904. if (!eggstraCharge.isArmed) fireEvent(eggstraCharge.link, 'click');
  3905. }
  3906. else{
  3907. if (eggscavator.canArm) fireEvent(eggscavator.link, 'click');
  3908. }
  3909. }
  3910. else {
  3911. if (eggscavator.canArm) fireEvent(eggscavator.link, 'click');
  3912. }
  3913. setStorage("discharge", "false");
  3914. }
  3915. }
  3916. catch (e) {
  3917. console.perror('checkCharge2016',e.message);
  3918. }
  3919. }
  3920. function checkCharge(stopDischargeAt) {
  3921. try {
  3922. var charge = parseInt(document.getElementsByClassName("chargeQuantity")[0].innerText);
  3923. console.plog('Current Charge:', charge);
  3924. if (charge == 20) {
  3925. setStorage("discharge", true.toString());
  3926. checkThenArm(null, "trinket", "Eggstra Charm");
  3927. }
  3928.  
  3929. else if (charge < 20 && charge > stopDischargeAt) {
  3930. if (getStorage("discharge") == "true") {
  3931. checkThenArm(null, "trinket", "Eggstra Charm");
  3932. }
  3933. else {
  3934. if (stopDischargeAt == 17) {
  3935. checkThenArm('best', "trinket", chargeCharm);
  3936. }
  3937. else {
  3938. checkThenArm(null, "trinket", "Eggscavator");
  3939. }
  3940. }
  3941. }
  3942. else if (charge == stopDischargeAt) {
  3943. if (stopDischargeAt == 17) {
  3944. checkThenArm('best', "trinket", chargeCharm);
  3945. }
  3946. else {
  3947. checkThenArm(null, "trinket", "Eggscavator");
  3948. }
  3949. setStorage("discharge", false.toString());
  3950. }
  3951. else if (charge < stopDischargeAt) {
  3952. setStorage("discharge", false.toString());
  3953. checkThenArm(null, "trinket", "Eggscavator");
  3954. }
  3955. return;
  3956. }
  3957. catch (e) {
  3958. console.perror('checkCharge',e.message);
  3959. }
  3960. }
  3961.  
  3962. function checkThenArm(sort, category, name, isForcedRetry) //category = weapon/base/charm/trinket/bait
  3963. {
  3964. if(isNullOrUndefined(name) || name === '')
  3965. return;
  3966.  
  3967. if (category == "charm")
  3968. category = "trinket";
  3969.  
  3970. if(!(Array.isArray(name))){
  3971. var obj = getConstToRealValue(sort, category, name);
  3972. if(obj.changed){
  3973. sort = obj.sort;
  3974. name = obj.name;
  3975. }
  3976. }
  3977.  
  3978. if(Array.isArray(name)){
  3979. if(!(sort == 'best' || sort == 'any'))
  3980. sort = 'best';
  3981. if(name.length == 1){
  3982. sort = null;
  3983. name = name[0];
  3984. }
  3985. }
  3986. else{
  3987. if(name.toUpperCase().indexOf('NONE') === 0){
  3988. disarmTrap(category);
  3989. return;
  3990. }
  3991. sort = null;
  3992. }
  3993.  
  3994. if(isNullOrUndefined(isForcedRetry))
  3995. isForcedRetry = true;
  3996.  
  3997. var trapArmed = undefined;
  3998. var userVariable = getPageVariable("user." + category + "_name");
  3999. if (sort == 'best') {
  4000. getTrapList(category);
  4001. if (objTrapList[category].length === 0){
  4002. var intervalCTA1 = setInterval(
  4003. function (){
  4004. if (!arming){
  4005. getTrapListFromTrapSelector(sort, category, name, isForcedRetry);
  4006. clearInterval(intervalCTA1);
  4007. intervalCTA1 = null;
  4008. return;
  4009. }
  4010. }, 1000);
  4011. return;
  4012. }
  4013. else{
  4014. var nIndex = -1;
  4015. for (var i = 0; i < name.length; i++) {
  4016. for (var j = 0; j < objTrapList[category].length; j++) {
  4017. nIndex = objTrapList[category][j].indexOf("...");
  4018. if(nIndex > -1)
  4019. name[i] = name[i].substr(0,nIndex);
  4020. if (objTrapList[category][j].indexOf(name[i]) === 0){
  4021. console.plog('Best', category, 'found:', name[i], 'Currently Armed:', userVariable);
  4022. if (userVariable.indexOf(name[i]) === 0) {
  4023. trapArmed = true;
  4024. arming = false;
  4025. closeTrapSelector(category);
  4026. return;
  4027. }
  4028. else {
  4029. trapArmed = false;
  4030. break;
  4031. }
  4032. }
  4033. }
  4034. if (trapArmed === false)
  4035. break;
  4036. }
  4037. }
  4038. }
  4039. else if(sort == 'any'){
  4040. trapArmed = false;
  4041. for (var i = 0; i < name.length; i++){
  4042. if (userVariable.indexOf(name[i]) === 0){
  4043. trapArmed = true;
  4044. break;
  4045. }
  4046. }
  4047. }
  4048. else{
  4049. trapArmed = (userVariable.indexOf(name) === 0);
  4050. }
  4051.  
  4052. if (trapArmed === undefined && isForcedRetry){
  4053. console.plog(name.join("/"), "not found in TrapList" + capitalizeFirstLetter(category));
  4054. clearTrapList(category);
  4055. checkThenArm(sort, category, name, false);
  4056. }
  4057. else if (trapArmed === false){
  4058. addArmingIntoList(category);
  4059. var intervalCTA = setInterval(
  4060. function (){
  4061. if (arming === false){
  4062. clickThenArmTrapInterval(sort, category, name);
  4063. clearInterval(intervalCTA);
  4064. intervalCTA = null;
  4065. return;
  4066. }
  4067. }, 1000);
  4068. }
  4069. }
  4070.  
  4071. function getConstToRealValue(sort, category, name){
  4072. var objRet = {
  4073. changed : false,
  4074. sort : sort,
  4075. name : name
  4076. };
  4077. if(g_objConstTrap.hasOwnProperty(category)){
  4078. var arrKeys = Object.keys(g_objConstTrap[category]);
  4079. var nIndex = arrKeys.indexOf(name);
  4080. if(nIndex > -1){
  4081. var keyName = arrKeys[nIndex];
  4082. objRet.sort = g_objConstTrap[category][keyName].sort;
  4083. objRet.name = g_objConstTrap[category][keyName].name.slice();
  4084. objRet.changed = true;
  4085. }
  4086. }
  4087. return objRet;
  4088. }
  4089.  
  4090. function addArmingIntoList(category){
  4091. g_arrArmingList.push(category);
  4092. }
  4093.  
  4094. function deleteArmingFromList(category){
  4095. var nIndex = g_arrArmingList.indexOf(category);
  4096. if(nIndex > -1)
  4097. g_arrArmingList.splice(nIndex, 1);
  4098. }
  4099.  
  4100. function isArmingInList(){
  4101. return (g_arrArmingList.length > 0);
  4102. }
  4103.  
  4104. function clickThenArmTrapInterval(sort, trap, name){ //sort = power/luck/attraction
  4105. clickTrapSelector(trap);
  4106. var sec = secWait;
  4107. var armStatus = LOADING;
  4108. var retry = armTrapRetry;
  4109. var intervalCTATI = setInterval(
  4110. function (){
  4111. armStatus = armTrap(sort, trap, name);
  4112. if (armStatus != LOADING){
  4113. deleteArmingFromList(trap);
  4114. if(isNewUI && !isArmingInList())
  4115. closeTrapSelector(trap);
  4116. clearInterval(intervalCTATI);
  4117. arming = false;
  4118. intervalCTATI = null;
  4119. if (armStatus == NOT_FOUND){
  4120. //clearTrapList(trap);
  4121. if (trap == 'trinket')
  4122. disarmTrap('trinket');
  4123. else
  4124. closeTrapSelector(trap);
  4125. }
  4126. return;
  4127. }
  4128. else{
  4129. --sec;
  4130. if (sec <= 0){
  4131. if(isNewUI)
  4132. closeTrapSelector(trap);
  4133. clickTrapSelector(trap, true);
  4134. sec = secWait;
  4135. --retry;
  4136. if (retry <= 0){
  4137. deleteArmingFromList(trap);
  4138. if(isNewUI && !isArmingInList())
  4139. closeTrapSelector(trap);
  4140. clearInterval(intervalCTATI);
  4141. arming = false;
  4142. intervalCTATI = null;
  4143. return;
  4144. }
  4145. }
  4146. }
  4147. }, 1000);
  4148. return;
  4149. }
  4150.  
  4151. // name = Brie/Gouda/Swiss (brie = wrong)
  4152. function armTrap(sort, trap, name) {
  4153. return (isNewUI) ? armTrapNewUI(sort, trap, name) : armTrapClassicUI(sort, trap, name);
  4154. }
  4155.  
  4156. function armTrapClassicUI(sort, trap, name){
  4157. var tagGroupElement = document.getElementsByClassName('tagGroup');
  4158. var tagElement;
  4159. var nameElement;
  4160. var nIndex = -1;
  4161. var arrName = (Array.isArray(name)) ? name.slice() : [name];
  4162.  
  4163. if (sort == 'best' || sort == 'any')
  4164. name = name[0];
  4165.  
  4166. if (tagGroupElement.length > 0){
  4167. console.plog('Try to arm', name);
  4168. for (var i = 0; i < tagGroupElement.length; ++i){
  4169. tagElement = tagGroupElement[i].getElementsByTagName('a');
  4170. for (var j = 0; j < tagElement.length; ++j){
  4171. nameElement = tagElement[j].getElementsByClassName('name')[0].innerText;
  4172. nIndex = nameElement.indexOf("...");
  4173. if(nIndex > -1)
  4174. name = name.substr(0, nIndex);
  4175. if (nameElement.indexOf(name) === 0){
  4176. if(tagElement[j].getAttribute('class').indexOf('selected')<0) // only click when not arming
  4177. fireEvent(tagElement[j], 'click');
  4178. else
  4179. closeTrapSelector(trap);
  4180.  
  4181. if(objTrapList[trap].indexOf(nameElement) < 0){
  4182. objTrapList[trap].unshift(nameElement);
  4183. setStorage("TrapList" + capitalizeFirstLetter(trap), objTrapList[trap].join(","));
  4184. }
  4185. console.plog(name, 'armed');
  4186. return ARMED;
  4187. }
  4188. }
  4189. }
  4190. console.plog(name, 'not found');
  4191. for(var i=0;i<objTrapList[trap].length;i++){
  4192. if(objTrapList[trap][i].indexOf(name) === 0){
  4193. objTrapList[trap].splice(i,1);
  4194. setStorage("TrapList" + capitalizeFirstLetter(trap), objTrapList[trap].join(","));
  4195. break;
  4196. }
  4197. }
  4198. if (sort == 'best' || sort == 'any'){
  4199. arrName.shift();
  4200. if (arrName.length > 0)
  4201. return armTrapClassicUI(sort, trap, arrName);
  4202. else
  4203. return NOT_FOUND;
  4204. }
  4205. else
  4206. return NOT_FOUND;
  4207. }
  4208. else
  4209. return LOADING;
  4210. }
  4211.  
  4212. function armTrapNewUI(sort, trap, name){
  4213. var itemEle = document.getElementsByClassName('campPage-trap-itemBrowser-item');
  4214. var nameElement;
  4215. var arrName = (Array.isArray(name)) ? name.slice() : [name];
  4216.  
  4217. if (sort == 'best' || sort == 'any')
  4218. name = name[0];
  4219.  
  4220. if (itemEle.length > 0) {
  4221. console.plog('Trying to arm ' + name);
  4222. for (var i = 0; i < itemEle.length; i++) {
  4223. nameElement = itemEle[i].getElementsByClassName('campPage-trap-itemBrowser-item-name')[0].textContent;
  4224. if (nameElement.indexOf(name) === 0) {
  4225. if(itemEle[i].getAttribute('class').indexOf('canArm') > -1)
  4226. fireEvent(itemEle[i].getElementsByClassName('campPage-trap-itemBrowser-item-armButton')[0], 'click');
  4227. else
  4228. closeTrapSelector(trap);
  4229. if(objTrapList[trap].indexOf(nameElement) < 0){
  4230. objTrapList[trap].unshift(nameElement);
  4231. setStorage("TrapList" + capitalizeFirstLetter(trap), objTrapList[trap].join(","));
  4232. }
  4233. console.plog(name + ' armed');
  4234. return ARMED;
  4235. }
  4236. }
  4237.  
  4238. console.plog(name, 'not found');
  4239. for(var i=0;i<objTrapList[trap].length;i++){
  4240. if(objTrapList[trap][i].indexOf(name) === 0){
  4241. objTrapList[trap].splice(i,1);
  4242. setStorage("TrapList" + capitalizeFirstLetter(trap), objTrapList[trap].join(","));
  4243. break;
  4244. }
  4245. }
  4246. if (sort == 'best' || sort == 'any'){
  4247. arrName.shift();
  4248. if (arrName.length > 0)
  4249. return armTrapNewUI(sort, trap, arrName);
  4250. else
  4251. return NOT_FOUND;
  4252. }
  4253. else
  4254. return NOT_FOUND;
  4255. }
  4256. else
  4257. return LOADING;
  4258. }
  4259.  
  4260. function clickTrapSelector(strSelect, bForceClick){ //strSelect = weapon/base/charm/trinket/bait
  4261. if(isNullOrUndefined(bForceClick))
  4262. bForceClick = false;
  4263. if(isNewUI){
  4264. var armedItem = document.getElementsByClassName('campPage-trap-armedItem ' + strSelect)[0];
  4265. var arrTemp = armedItem.getAttribute('class').split(" ");
  4266. if(bForceClick !== true && arrTemp[arrTemp.length-1] == 'active'){ // trap selector opened
  4267. arming = true;
  4268. return (console.plog('Trap selector', strSelect, 'opened'));
  4269. }
  4270. fireEvent(armedItem, 'click');
  4271. }
  4272. else{
  4273. if(bForceClick !== true && document.getElementsByClassName("showComponents " + strSelect).length > 0){ // trap selector opened
  4274. arming = true;
  4275. return (console.plog('Trap selector', strSelect, 'opened'));
  4276. }
  4277. if (strSelect == "base")
  4278. fireEvent(document.getElementsByClassName('trapControlThumb')[0], 'click');
  4279. else if (strSelect == "weapon")
  4280. fireEvent(document.getElementsByClassName('trapControlThumb')[1], 'click');
  4281. else if (strSelect == "charm" || strSelect == "trinket")
  4282. fireEvent(document.getElementsByClassName('trapControlThumb')[2], 'click');
  4283. else if (strSelect == "bait")
  4284. fireEvent(document.getElementsByClassName('trapControlThumb')[3], 'click');
  4285. else
  4286. return (console.plog("Invalid trapSelector"));
  4287. }
  4288. arming = true;
  4289. console.plog("Trap selector", strSelect, "clicked");
  4290. }
  4291.  
  4292. function closeTrapSelector(category){
  4293. if(isNewUI){
  4294. var armedItem = document.getElementsByClassName('campPage-trap-armedItem ' + category)[0];
  4295. if(!isNullOrUndefined(armedItem) && armedItem.getAttribute('class').indexOf('active') > -1){ // trap selector opened
  4296. fireEvent(armedItem, 'click');
  4297. console.plog("Trap selector", category, "closed");
  4298. }
  4299. }
  4300. else{
  4301. if(document.getElementsByClassName("showComponents " + category).length > 0){
  4302. fireEvent(document.getElementById('trapSelectorBrowserClose'), 'click');
  4303. console.plog("Trap selector", category, "closed");
  4304. }
  4305. }
  4306. }
  4307.  
  4308. function retrieveDataFirst() {
  4309. try {
  4310. var gotHornTime = false;
  4311. var gotPuzzle = false;
  4312. var gotBaitQuantity = false;
  4313. var retrieveSuccess = false;
  4314.  
  4315. var scriptElementList = document.getElementsByTagName('script');
  4316.  
  4317. if (scriptElementList) {
  4318. var i;
  4319. for (i = 0; i < scriptElementList.length; ++i) {
  4320. var scriptString = scriptElementList[i].innerHTML;
  4321.  
  4322. // get next horn time
  4323. var hornTimeStartIndex = scriptString.indexOf("next_activeturn_seconds");
  4324. if (hornTimeStartIndex >= 0) {
  4325. hornTimeStartIndex += 25;
  4326. var hornTimeEndIndex = scriptString.indexOf(",", hornTimeStartIndex);
  4327. var hornTimerString = scriptString.substring(hornTimeStartIndex, hornTimeEndIndex);
  4328. nextActiveTime = parseInt(hornTimerString);
  4329.  
  4330. hornTimeDelay = hornTimeDelayMin + Math.round(Math.random() * (hornTimeDelayMax - hornTimeDelayMin));
  4331. //console.plog('Horn Time:', nextActiveTime, 'Delay:', hornTimeDelay);
  4332. if (!aggressiveMode) {
  4333. // calculation base on the js in Mousehunt
  4334. var additionalDelayTime = Math.ceil(nextActiveTime * 0.1);
  4335.  
  4336. // need to found out the mousehunt provided timer interval to determine the additional delay
  4337. var timerIntervalStartIndex = scriptString.indexOf("hud.timer_interval");
  4338. if (timerIntervalStartIndex >= 0) {
  4339. timerIntervalStartIndex += 21;
  4340. var timerIntervalEndIndex = scriptString.indexOf(";", timerIntervalStartIndex);
  4341. var timerIntervalString = scriptString.substring(timerIntervalStartIndex, timerIntervalEndIndex);
  4342. var timerInterval = parseInt(timerIntervalString);
  4343.  
  4344. // calculation base on the js in Mousehunt
  4345. if (timerInterval == 1) {
  4346. additionalDelayTime = 2;
  4347. }
  4348.  
  4349. timerIntervalStartIndex = undefined;
  4350. timerIntervalEndIndex = undefined;
  4351. timerIntervalString = undefined;
  4352. timerInterval = undefined;
  4353. }
  4354.  
  4355. // safety mode, include extra delay like time in horn image appear
  4356. //hornTime = nextActiveTime + additionalDelayTime + hornTimeDelay;
  4357. hornTime = nextActiveTime + hornTimeDelay;
  4358. lastDateRecorded = undefined;
  4359. lastDateRecorded = new Date();
  4360.  
  4361. additionalDelayTime = undefined;
  4362. }
  4363. else {
  4364. // aggressive mode, no extra delay like time in horn image appear
  4365. hornTime = nextActiveTime;
  4366. lastDateRecorded = undefined;
  4367. lastDateRecorded = new Date();
  4368. }
  4369.  
  4370. gotHornTime = true;
  4371.  
  4372. hornTimeStartIndex = undefined;
  4373. hornTimeEndIndex = undefined;
  4374. hornTimerString = undefined;
  4375. }
  4376.  
  4377. // get is king's reward or not
  4378. var hasPuzzleStartIndex = scriptString.indexOf("has_puzzle");
  4379. if (hasPuzzleStartIndex >= 0) {
  4380. hasPuzzleStartIndex += 12;
  4381. var hasPuzzleEndIndex = scriptString.indexOf(",", hasPuzzleStartIndex);
  4382. var hasPuzzleString = scriptString.substring(hasPuzzleStartIndex, hasPuzzleEndIndex);
  4383. console.plog('hasPuzzleString:', hasPuzzleString);
  4384. isKingReward = (hasPuzzleString != 'false');
  4385.  
  4386. gotPuzzle = true;
  4387.  
  4388. hasPuzzleStartIndex = undefined;
  4389. hasPuzzleEndIndex = undefined;
  4390. hasPuzzleString = undefined;
  4391. }
  4392.  
  4393. // get cheese quantity
  4394. var baitQuantityStartIndex = scriptString.indexOf("bait_quantity");
  4395. if (baitQuantityStartIndex >= 0) {
  4396. baitQuantityStartIndex += 15;
  4397. var baitQuantityEndIndex = scriptString.indexOf(",", baitQuantityStartIndex);
  4398. var baitQuantityString = scriptString.substring(baitQuantityStartIndex, baitQuantityEndIndex);
  4399. g_nBaitQuantity = parseInt(baitQuantityString);
  4400.  
  4401. gotBaitQuantity = true;
  4402.  
  4403. baitQuantityStartIndex = undefined;
  4404. baitQuantityEndIndex = undefined;
  4405. baitQuantityString = undefined;
  4406. }
  4407.  
  4408. var locationStartIndex;
  4409. var locationEndIndex;
  4410. locationStartIndex = scriptString.indexOf("location\":\"");
  4411. if (locationStartIndex >= 0) {
  4412. locationStartIndex += 11;
  4413. locationEndIndex = scriptString.indexOf("\"", locationStartIndex);
  4414. var locationString = scriptString.substring(locationStartIndex, locationEndIndex);
  4415. currentLocation = locationString;
  4416.  
  4417. locationStartIndex = undefined;
  4418. locationEndIndex = undefined;
  4419. locationString = undefined;
  4420. }
  4421.  
  4422. scriptString = undefined;
  4423. }
  4424. i = undefined;
  4425. }
  4426. scriptElementList = undefined;
  4427.  
  4428. if (gotHornTime && gotPuzzle && gotBaitQuantity) {
  4429. // get trap check time
  4430. CalculateNextTrapCheckInMinute();
  4431.  
  4432. // get last location
  4433. var huntLocationCookie = getStorage("huntLocation");
  4434. if (isNullOrUndefined(huntLocationCookie)) {
  4435. huntLocation = currentLocation;
  4436. setStorage("huntLocation", currentLocation);
  4437. }
  4438. else {
  4439. huntLocation = huntLocationCookie;
  4440. setStorage("huntLocation", huntLocation);
  4441. }
  4442. huntLocationCookie = undefined;
  4443.  
  4444. // get last king reward time
  4445. var lastKingRewardDate = getStorage("lastKingRewardDate");
  4446. if (isNullOrUndefined(lastKingRewardDate)) {
  4447. lastKingRewardSumTime = -1;
  4448. }
  4449. else {
  4450. var lastDate = new Date(lastKingRewardDate);
  4451. lastKingRewardSumTime = parseInt((new Date() - lastDate) / 1000);
  4452. lastDate = undefined;
  4453. }
  4454. lastKingRewardDate = undefined;
  4455.  
  4456. retrieveSuccess = true;
  4457. }
  4458. else {
  4459. retrieveSuccess = false;
  4460. }
  4461.  
  4462. // clean up
  4463. gotHornTime = undefined;
  4464. gotPuzzle = undefined;
  4465. gotBaitQuantity = undefined;
  4466. return (retrieveSuccess);
  4467. }
  4468. catch (e) {
  4469. console.perror('retrieveDataFirst',e.message);
  4470. }
  4471. }
  4472.  
  4473. function GetHornTime() {
  4474. var huntTimerElement = document.getElementById('huntTimer');
  4475. var totalSec = 900;
  4476. if (huntTimerElement !== null) {
  4477. huntTimerElement = huntTimerElement.textContent;
  4478. if(huntTimerElement.toLowerCase().indexOf('ready') > -1)
  4479. totalSec = 0;
  4480. else if (isNewUI) {
  4481. var arrTime = huntTimerElement.split(":");
  4482. if(arrTime.length == 2){
  4483. for(var i=0;i<arrTime.length;i++)
  4484. arrTime[i] = parseInt(arrTime[i]);
  4485. totalSec = arrTime[0] * 60 + arrTime[1];
  4486. }
  4487. }
  4488. else {
  4489. var temp = parseInt(huntTimerElement);
  4490. if(Number.isInteger(temp))
  4491. totalSec = temp * 60;
  4492. }
  4493. }
  4494. return totalSec;
  4495. }
  4496.  
  4497. function getKingRewardStatus() {
  4498. var strValue = getPageVariable('user.has_puzzle');
  4499. console.plog('user.has_puzzle:', strValue);
  4500. return (strValue == 'true');
  4501. var headerOrHud = (isNewUI) ? document.getElementById('mousehuntHud') : document.getElementById('envHeaderImg');
  4502. if (headerOrHud !== null) {
  4503. var textContentLowerCase = headerOrHud.textContent.toLowerCase();
  4504. if (textContentLowerCase.indexOf("king reward") > -1 ||
  4505. textContentLowerCase.indexOf("king's reward") > -1 ||
  4506. textContentLowerCase.indexOf("kings reward") > -1) {
  4507. return true;
  4508. }
  4509. else
  4510. return (strValue == 'true');
  4511. }
  4512. else
  4513. return false;
  4514. }
  4515.  
  4516. function getBaitQuantity() {
  4517. var hudBaitQuantity = document.getElementsByClassName("mousehuntHud-userStat bait")[0].getElementsByClassName("value")[0];
  4518. if (hudBaitQuantity !== null) {
  4519. return parseInt(hudBaitQuantity.innerText);
  4520. }
  4521. else {
  4522. return 0;
  4523. }
  4524. }
  4525.  
  4526. function getCurrentLocation() {
  4527. var tempLocation;
  4528. if (isNewUI) {
  4529. tempLocation = document.getElementsByClassName('mousehuntHud-environmentName');
  4530. if (tempLocation.length > 0)
  4531. return tempLocation[0].textContent;
  4532. else
  4533. return "";
  4534. }
  4535. else {
  4536. tempLocation = document.getElementById('hud_location');
  4537. if (!isNullOrUndefined(tempLocation))
  4538. return tempLocation.textContent;
  4539. else
  4540. return "";
  4541. }
  4542. }
  4543.  
  4544. function retrieveData() {
  4545. try {
  4546. // get next horn time
  4547. currentLocation = getCurrentLocation();
  4548. isKingReward = getKingRewardStatus();
  4549. g_nBaitQuantity = getBaitQuantity();
  4550. nextActiveTime = GetHornTime();
  4551. if (nextActiveTime === "" || isNaN(nextActiveTime)) {
  4552. // fail to retrieve data, might be due to slow network
  4553.  
  4554. // reload the page to see it fix the problem
  4555. window.setTimeout(function () { reloadWithMessage("Fail to retrieve data. Reloading...", false); }, 5000);
  4556. }
  4557. else {
  4558. // got the timer right!
  4559. if(nextActiveTime === 0)
  4560. hornTimeDelay = 0;
  4561. else{
  4562. // calculate the delay
  4563. hornTimeDelay = hornTimeDelayMin + Math.round(Math.random() * (hornTimeDelayMax - hornTimeDelayMin));
  4564. }
  4565. console.plog('Horn Time:', nextActiveTime, 'Delay:', hornTimeDelay);
  4566. if (!aggressiveMode) {
  4567. // safety mode, include extra delay like time in horn image appear
  4568. hornTime = nextActiveTime + hornTimeDelay;
  4569. }
  4570. else {
  4571. // aggressive mode, no extra delay like time in horn image appear
  4572. hornTime = nextActiveTime;
  4573. }
  4574. lastDateRecorded = new Date();
  4575. }
  4576.  
  4577. // get trap check time
  4578. CalculateNextTrapCheckInMinute();
  4579. getJournalDetail();
  4580. eventLocationCheck('retrieveData()');
  4581. specialFeature('retrieveData()');
  4582. mapHunting();
  4583. }
  4584. catch (e) {
  4585. console.perror('retrieveData',e.message);
  4586. }
  4587. }
  4588.  
  4589. function checkJournalDate() {
  4590. var reload = false;
  4591.  
  4592. var journalDateDiv = document.getElementsByClassName('journaldate');
  4593. if (journalDateDiv) {
  4594. var journalDateStr = journalDateDiv[0].innerHTML.toString();
  4595. var midIndex = journalDateStr.indexOf(":", 0);
  4596. var spaceIndex = journalDateStr.indexOf(" ", midIndex);
  4597.  
  4598. if (midIndex >= 1) {
  4599. var hrStr = journalDateStr.substring(0, midIndex);
  4600. var minStr = journalDateStr.substr(midIndex + 1, 2);
  4601. var hourSysStr = journalDateStr.substr(spaceIndex + 1, 2);
  4602.  
  4603. var nowDate = new Date();
  4604. var lastHuntDate = new Date();
  4605. if (hourSysStr == "am") {
  4606. lastHuntDate.setHours(parseInt(hrStr), parseInt(minStr), 0, 0);
  4607. }
  4608. else {
  4609. lastHuntDate.setHours(parseInt(hrStr) + 12, parseInt(minStr), 0, 0);
  4610. }
  4611. if (parseInt(nowDate - lastHuntDate) / 1000 > 900) {
  4612. reload = true;
  4613. }
  4614. hrStr = undefined;
  4615. minStr = undefined;
  4616. nowDate = undefined;
  4617. lastHuntDate = undefined;
  4618. }
  4619. else {
  4620. reload = true;
  4621. }
  4622.  
  4623. journalDateStr = undefined;
  4624. midIndex = undefined;
  4625. spaceIndex = undefined;
  4626. }
  4627. journalDateDiv = undefined;
  4628.  
  4629. if (reload) {
  4630. reloadWithMessage("Timer error. Try reload to fix.", true);
  4631. }
  4632.  
  4633. try {
  4634. return (reload);
  4635. }
  4636. finally {
  4637. reload = undefined;
  4638. }
  4639. }
  4640.  
  4641. function action() {
  4642. if (isKingReward) {
  4643. kingRewardAction();
  4644. }
  4645. else if (pauseAtInvalidLocation && (huntLocation != currentLocation)) {
  4646. // update timer
  4647. displayTimer("Out of pre-defined hunting location...", "Out of pre-defined hunting location...", "Out of pre-defined hunting location...");
  4648. if (fbPlatform)
  4649. displayLocation("<font color='red'>" + currentLocation + "</font> [<a onclick='window.localStorage.removeItem(\"huntLocation\");' href='" + g_strHTTP + "://www.mousehuntgame.com/canvas/\'>Hunt Here</a>] - <i>Script pause because you had move to a different location recently, click hunt here to continue hunt at this location.</i>");
  4650. else if (hiFivePlatform)
  4651. displayLocation("<font color='red'>" + currentLocation + "</font> [<a onclick='window.localStorage.removeItem(\"huntLocation\");' href='" + g_strHTTP + "://mousehunt.hi5.hitgrab.com/\'>Hunt Here</a>] - <i>Script pause because you had move to a different location recently, click hunt here to continue hunt at this location.</i>");
  4652. else if (mhPlatform)
  4653. displayLocation("<font color='red'>" + currentLocation + "</font> [<a onclick='window.localStorage.removeItem(\"huntLocation\");' href='" + g_strHTTP + "://www.mousehuntgame.com/\'>Hunt Here</a>] - <i>Script pause because you had move to a different location recently, click hunt here to continue hunt at this location.</i>");
  4654. displayKingRewardSumTime(null);
  4655. // pause script
  4656. }
  4657. else if (g_nBaitQuantity === 0) {
  4658. // update timer
  4659. displayTimer("No more cheese!", "Cannot hunt without the cheese...", "Cannot hunt without the cheese...");
  4660. displayLocation(huntLocation);
  4661. displayKingRewardSumTime(null);
  4662.  
  4663. // pause the script
  4664. }
  4665. else {
  4666. // update location
  4667. displayLocation(huntLocation);
  4668.  
  4669. var isHornSounding = false;
  4670.  
  4671. // check if the horn image is visible
  4672. var headerElement = (isNewUI) ? document.getElementById('mousehuntHud').firstChild : document.getElementById('envHeaderImg');
  4673. if (headerElement) {
  4674. var headerStatus = headerElement.getAttribute('class');
  4675. headerStatus = headerStatus.toLowerCase();
  4676. if (headerStatus.indexOf("hornready") != -1) {
  4677. // if the horn image is visible, why do we need to wait any more, sound the horn!
  4678. soundHorn();
  4679.  
  4680. // make sure the timer don't run twice!
  4681. isHornSounding = true;
  4682. }
  4683. headerStatus = undefined;
  4684. }
  4685. headerElement = undefined;
  4686.  
  4687. if (isHornSounding === false) {
  4688. // start timer
  4689. window.setTimeout(function () { countdownTimer(); }, timerRefreshInterval * 1000);
  4690. }
  4691.  
  4692. isHornSounding = undefined;
  4693. try{
  4694. getJournalDetail();
  4695. eventLocationCheck('action()');
  4696. specialFeature('action()');
  4697. mapHunting();
  4698. }
  4699. catch (e){
  4700. console.perror('action:',e.message);
  4701. }
  4702. }
  4703. }
  4704.  
  4705. function countdownTimer() {
  4706. try {
  4707. if (isKingReward) {
  4708. // update timer
  4709. displayTimer("King's Reward!", "King's Reward!", "King's Reward!");
  4710. displayKingRewardSumTime("Now");
  4711. lastKingRewardSumTime = 0;
  4712. if(isNewUI){
  4713. reloadPage(false);
  4714. }
  4715. else{
  4716. // reload the page so that the sound can be play
  4717. // simulate mouse click on the camp button
  4718. fireEvent(document.getElementsByClassName(g_strCampButton)[0], 'click');
  4719. }
  4720.  
  4721. // reload the page if click on the camp button fail
  4722. window.setTimeout(function () { reloadWithMessage("Fail to click on camp button. Reloading...", false); }, 5000);
  4723. }
  4724. else if (pauseAtInvalidLocation && (huntLocation != currentLocation)) {
  4725. // update timer
  4726. displayTimer("Out of pre-defined hunting location...", "Out of pre-defined hunting location...", "Out of pre-defined hunting location...");
  4727. if (fbPlatform)
  4728. displayLocation("<font color='red'>" + currentLocation + "</font> [<a onclick='window.localStorage.removeItem(\"huntLocation\");' href='" + g_strHTTP + "://www.mousehuntgame.com/canvas/\'>Hunt Here</a>] - <i>Script pause because you had move to a different location recently, click hunt here to continue hunt at this location.</i>");
  4729. else if (hiFivePlatform)
  4730. displayLocation("<font color='red'>" + currentLocation + "</font> [<a onclick='window.localStorage.removeItem(\"huntLocation\");' href='" + g_strHTTP + "://mousehunt.hi5.hitgrab.com/\'>Hunt Here</a>] - <i>Script pause because you had move to a different location recently, click hunt here to continue hunt at this location.</i>");
  4731. else if (mhPlatform)
  4732. displayLocation("<font color='red'>" + currentLocation + "</font> [<a onclick='window.localStorage.removeItem(\"huntLocation\");' href='" + g_strHTTP + "://www.mousehuntgame.com/\'>Hunt Here</a>] - <i>Script pause because you had move to a different location recently, click hunt here to continue hunt at this location.</i>");
  4733. displayKingRewardSumTime(null);
  4734.  
  4735. // pause script
  4736. }
  4737. else {
  4738. var dateNow = new Date();
  4739. var intervalTime = timeElapsed(lastDateRecorded, dateNow);
  4740. lastDateRecorded = undefined;
  4741. lastDateRecorded = dateNow;
  4742. dateNow = undefined;
  4743.  
  4744. if (enableTrapCheck) checkTime -= intervalTime;
  4745.  
  4746. // update time
  4747. hornTime -= intervalTime;
  4748. if (lastKingRewardSumTime != -1) {
  4749. lastKingRewardSumTime += intervalTime;
  4750. }
  4751.  
  4752. intervalTime = undefined;
  4753.  
  4754. if (hornTime <= 0) {
  4755. // blow the horn!
  4756. hornTime = 0;
  4757. if(getBaitQuantity() > 0)
  4758. soundHorn();
  4759. else{
  4760. displayTimer("No more cheese!", "Cannot hunt without the cheese...", "Cannot hunt without the cheese...");
  4761. displayLocation(huntLocation);
  4762. displayKingRewardSumTime(null);
  4763. }
  4764. }
  4765. else if (enableTrapCheck && checkTime <= 0) {
  4766. // trap check!
  4767. if(getBaitQuantity() > 0)
  4768. trapCheck();
  4769. else{
  4770. displayTimer("No more cheese!", "Cannot hunt without the cheese...", "Cannot hunt without the cheese...");
  4771. displayLocation(huntLocation);
  4772. displayKingRewardSumTime(null);
  4773. }
  4774. }
  4775. else {
  4776. if (enableTrapCheck) {
  4777. // update timer
  4778. if (!aggressiveMode) {
  4779. displayTimer("Horn: " + timeFormat(hornTime) + " | Check: " + timeFormat(checkTime),
  4780. timeFormat(hornTime) + " <i>(included extra " + timeFormat(hornTimeDelay) + " delay & +/- 5 seconds different from MouseHunt timer)</i>",
  4781. timeFormat(checkTime) + " <i>(included extra " + timeFormat(checkTimeDelay) + " delay)</i>");
  4782. }
  4783. else {
  4784. displayTimer("Horn: " + timeFormat(hornTime) + " | Check: " + timeFormat(checkTime),
  4785. timeFormat(hornTime) + " <i>(lot faster than MouseHunt timer)</i>",
  4786. timeFormat(checkTime) + " <i>(included extra " + timeFormat(checkTimeDelay) + " delay)</i>");
  4787. }
  4788. }
  4789. else {
  4790. // update timer
  4791. if (!aggressiveMode) {
  4792. displayTimer("Horn: " + timeFormat(hornTime),
  4793. timeFormat(hornTime) + " <i>(included extra " + timeFormat(hornTimeDelay) + " delay & +/- 5 seconds different from MouseHunt timer)</i>",
  4794. "-");
  4795.  
  4796. // check if user manaually sounded the horn
  4797. var scriptNode = document.getElementById("scriptNode");
  4798. if (scriptNode) {
  4799. var isHornSounded = scriptNode.getAttribute("soundedHornAtt");
  4800. if (isHornSounded == "true") {
  4801. // sound horn function do the rest
  4802. soundHorn();
  4803.  
  4804. // stop loopping
  4805. return;
  4806. }
  4807. isHornSounded = undefined;
  4808. }
  4809. scriptNode = undefined;
  4810. }
  4811. else {
  4812. displayTimer("Horn: " + timeFormat(hornTime),
  4813. timeFormat(hornTime) + " <i>(lot faster than MouseHunt timer)</i>",
  4814. "-");
  4815.  
  4816. // agressive mode should sound the horn whenever it is possible to do so.
  4817. var headerElement = (isNewUI) ? document.getElementById('mousehuntHud').firstChild : document.getElementById('envHeaderImg');
  4818. if (headerElement) {
  4819. var headerStatus = headerElement.getAttribute('class');
  4820. headerStatus = headerStatus.toLowerCase();
  4821. // the horn image appear before the timer end
  4822. if (headerStatus.indexOf("hornready") != -1) {
  4823. // who care, blow the horn first!
  4824. soundHorn();
  4825.  
  4826. headerElement = undefined;
  4827.  
  4828. // skip all the code below
  4829. return;
  4830. }
  4831. }
  4832. headerElement = undefined;
  4833. }
  4834. }
  4835.  
  4836. // set king reward sum time
  4837. displayKingRewardSumTime(timeFormatLong(lastKingRewardSumTime));
  4838.  
  4839. window.setTimeout(function () { (countdownTimer)(); }, timerRefreshInterval * 1000);
  4840. }
  4841. }
  4842. }
  4843. catch (e) {
  4844. console.perror('countdownTimer',e.message);
  4845. }
  4846. }
  4847.  
  4848. function reloadPage(soundHorn) {
  4849. // reload the page
  4850. var strTurn = (soundHorn) ? "turn.php" : "";
  4851. if (fbPlatform) {
  4852. // for Facebook only
  4853. window.location.href = g_strHTTP + "://www.mousehuntgame.com/canvas/" + strTurn;
  4854. }
  4855. else if (hiFivePlatform) {
  4856. // for Hi5 only
  4857. window.location.href = g_strHTTP + "://mousehunt.hi5.hitgrab.com/" + strTurn;
  4858. }
  4859. else if (mhPlatform) {
  4860. // for mousehunt game only
  4861. window.location.href = g_strHTTP + "://www.mousehuntgame.com/" + strTurn;
  4862. }
  4863. }
  4864.  
  4865. function reloadWithMessage(msg, soundHorn) {
  4866. // display the message
  4867. displayTimer(msg, msg, msg, msg);
  4868.  
  4869. // reload the page
  4870. reloadPage(soundHorn);
  4871.  
  4872. msg = undefined;
  4873. soundHorn = undefined;
  4874. }
  4875.  
  4876. // ################################################################################################
  4877. // Timer Function - Start
  4878. // ################################################################################################
  4879.  
  4880. function embedTimer(targetPage) {
  4881. if (showTimerInPage) {
  4882. var headerElement;
  4883. if (fbPlatform || hiFivePlatform || mhPlatform)
  4884. headerElement = document.getElementById('noscript');
  4885. else if (mhMobilePlatform)
  4886. headerElement = document.getElementById('mobileHorn');
  4887.  
  4888. if (headerElement) {
  4889. var timerDivElement = document.createElement('div');
  4890.  
  4891. var hr1Element = document.createElement('hr');
  4892. timerDivElement.appendChild(hr1Element);
  4893. hr1Element = null;
  4894.  
  4895. // show bot title and version
  4896. var titleElement = document.createElement('div');
  4897. titleElement.setAttribute('id', 'titleElement');
  4898. if (targetPage && aggressiveMode)
  4899. titleElement.innerHTML = "<a href=\"http://devcnn.wordpress.com\" target=\"_blank\"><b>MouseHunt AutoBot (version " + g_strVersion + " Enhanced Edition)</b></a> - <font color='red'>Aggressive Mode</font>";
  4900. else if (targetPage && browser != 'chrome' && browser != 'opera')
  4901. titleElement.innerHTML = "<a href=\"http://devcnn.wordpress.com\" target=\"_blank\"><b>MouseHunt AutoBot (version " + g_strVersion + " Enhanced Edition)</b></a> - <font color='red'><b>Pls use Chrome browser for fully working features</b></font>";
  4902. else
  4903. titleElement.innerHTML = "<a href=\"http://devcnn.wordpress.com\" target=\"_blank\"><b>MouseHunt AutoBot (version " + g_strVersion + " Enhanced Edition)</b></a>";
  4904. timerDivElement.appendChild(titleElement);
  4905. titleElement = null;
  4906.  
  4907. if (targetPage) {
  4908. nextHornTimeElement = document.createElement('div');
  4909. nextHornTimeElement.setAttribute('id', 'nextHornTimeElement');
  4910. nextHornTimeElement.innerHTML = "<b>Next Hunter Horn Time:</b> Loading...";
  4911. timerDivElement.appendChild(nextHornTimeElement);
  4912.  
  4913. checkTimeElement = document.createElement('div');
  4914. checkTimeElement.setAttribute('id', 'checkTimeElement');
  4915. checkTimeElement.innerHTML = "<b>Next Trap Check Time:</b> Loading...";
  4916. timerDivElement.appendChild(checkTimeElement);
  4917.  
  4918. if (pauseAtInvalidLocation) {
  4919. // location information only display when enable this feature
  4920. travelElement = document.createElement('div');
  4921. travelElement.setAttribute('id', 'travelElement');
  4922. travelElement.innerHTML = "<b>Target Hunt Location:</b> Loading...";
  4923. timerDivElement.appendChild(travelElement);
  4924. }
  4925.  
  4926. var lastKingRewardDate = getStorage("lastKingRewardDate");
  4927. var lastDateStr;
  4928. if (isNullOrUndefined(lastKingRewardDate)) {
  4929. lastDateStr = "-";
  4930. }
  4931. else {
  4932. var lastDate = new Date(lastKingRewardDate);
  4933. lastDateStr = lastDate.toDateString() + " " + lastDate.toTimeString().substring(0, 8);
  4934. lastDate = null;
  4935. }
  4936.  
  4937. kingTimeElement = document.createElement('div');
  4938. kingTimeElement.setAttribute('id', 'kingTimeElement');
  4939. kingTimeElement.innerHTML = "<b>Last King's Reward:</b> " + lastDateStr + " ";
  4940. timerDivElement.appendChild(kingTimeElement);
  4941.  
  4942. lastKingRewardSumTimeElement = document.createElement('font');
  4943. lastKingRewardSumTimeElement.setAttribute('id', 'lastKingRewardSumTimeElement');
  4944. lastKingRewardSumTimeElement.innerHTML = "(Loading...)";
  4945. kingTimeElement.appendChild(lastKingRewardSumTimeElement);
  4946.  
  4947. lastKingRewardDate = null;
  4948. lastDateStr = null;
  4949.  
  4950. if (showLastPageLoadTime) {
  4951. var nowDate = new Date();
  4952.  
  4953. // last page load time
  4954. var loadTimeElement = document.createElement('div');
  4955. loadTimeElement.setAttribute('id', 'loadTimeElement');
  4956. loadTimeElement.innerHTML = "<b>Last Page Load: </b>" + nowDate.toDateString() + " " + nowDate.toTimeString().substring(0, 8);
  4957. timerDivElement.appendChild(loadTimeElement);
  4958.  
  4959. loadTimeElement = null;
  4960. nowDate = null;
  4961. }
  4962. }
  4963. else {
  4964. // player currently navigating other page instead of hunter camp
  4965. var helpTextElement = document.createElement('div');
  4966. helpTextElement.setAttribute('id', 'helpTextElement');
  4967. if (fbPlatform)
  4968. helpTextElement.innerHTML = "<b>Note:</b> MouseHunt AutoBot will only run at <a href='" + g_strHTTP + "://www.mousehuntgame.com/canvas/'>Hunter Camp</a>. This is to prevent the bot from interfering user's activity.";
  4969. else if (hiFivePlatform)
  4970. helpTextElement.innerHTML = "<b>Note:</b> MouseHunt AutoBot will only run at <a href='" + g_strHTTP + "://mousehunt.hi5.hitgrab.com/'>Hunter Camp</a>. This is to prevent the bot from interfering user's activity.";
  4971. else if (mhPlatform)
  4972. helpTextElement.innerHTML = "<b>Note:</b> MouseHunt AutoBot will only run at <a href='" + g_strHTTP + "://www.mousehuntgame.com/'>Hunter Camp</a>. This is to prevent the bot from interfering user's activity.";
  4973. else if (mhMobilePlatform)
  4974. helpTextElement.innerHTML = "<b>Note:</b> Mobile version of Mousehunt is not supported currently. Please use the <a href='" + g_strHTTP + "://www.mousehuntgame.com/?switch_to=standard'>standard version of MouseHunt</a>.";
  4975. timerDivElement.appendChild(helpTextElement);
  4976.  
  4977. helpTextElement = null;
  4978. }
  4979.  
  4980. var showPreference = getStorage('showPreference');
  4981. if (isNullOrUndefined(showPreference)) {
  4982. showPreference = false;
  4983. setStorage("showPreference", showPreference);
  4984. }
  4985.  
  4986. var showPreferenceLinkDiv = document.createElement('div');
  4987. showPreferenceLinkDiv.setAttribute('id', 'showPreferenceLinkDiv');
  4988. showPreferenceLinkDiv.setAttribute('style', 'text-align:right');
  4989. timerDivElement.appendChild(showPreferenceLinkDiv);
  4990.  
  4991. var showPreferenceSpan = document.createElement('span');
  4992. var showPreferenceLinkStr = '<a id="showPreferenceLink" style="display:none" name="showPreferenceLink" onclick="\
  4993. if (document.getElementById(\'showPreferenceLink\').innerHTML == \'<b>[Hide Preference]</b>\'){\
  4994. document.getElementById(\'preferenceDiv\').style.display=\'none\';\
  4995. document.getElementById(\'showPreferenceLink\').innerHTML=\'<b>[Show Preference]</b>\';\
  4996. }\
  4997. else{\
  4998. setLocalToSession();\
  4999. var selectedAlgo = window.sessionStorage.getItem(\'eventLocation\');\
  5000. showOrHideTr(selectedAlgo);\
  5001. document.getElementById(\'preferenceDiv\').style.display=\'block\';\
  5002. document.getElementById(\'showPreferenceLink\').innerHTML=\'<b>[Hide Preference]</b>\';\
  5003. document.getElementById(\'eventAlgo\').value = selectedAlgo;\
  5004. initControlsBestTrap();\
  5005. }\
  5006. ">';
  5007. if (showPreference === true)
  5008. showPreferenceLinkStr += '<b>[Hide Preference]</b>';
  5009. else
  5010. showPreferenceLinkStr += '<b>[Show Preference]</b>';
  5011. showPreferenceLinkStr += '</a>';
  5012. showPreferenceLinkStr += '&nbsp;&nbsp;&nbsp;';
  5013.  
  5014. var restorePreferenceStr = '<input type="file" id="inputFiles" name="files" style="display:none;" onchange="handleFiles(this.files)"/>';
  5015. restorePreferenceStr += '<a id="idRestore" style="display:none" name="Restore" title="Click to restore preference" onclick="onIdRestoreClicked();">';
  5016. if(getSessionStorage('bRestart') != 'true')
  5017. restorePreferenceStr += '<b>[Restore]</b>';
  5018. else
  5019. restorePreferenceStr += '<b>Restart browser is required!</b>';
  5020. restorePreferenceStr += '</a>&nbsp;&nbsp;&nbsp;';
  5021. var getLogPreferenceStr = '<a id="idGetLogAndPreference" style="display:none" name="GetLogAndPreference" title="Click to get saved log & preference" onclick="onIdGetLogPreferenceClicked();">';
  5022. getLogPreferenceStr += '<b>[Get Log & Preference / Backup]</b></a>&nbsp;&nbsp;&nbsp;';
  5023. var clearTrapListStr = '<a id="clearTrapList" style="display:none" name="clearTrapList" title="Click to clear trap list from localStorage and trap list will be updated on the next arming by script" onclick="\
  5024. window.localStorage.removeItem(\'TrapListWeapon\');\
  5025. window.localStorage.removeItem(\'TrapListBase\');\
  5026. window.localStorage.removeItem(\'TrapListTrinket\');\
  5027. window.localStorage.removeItem(\'TrapListBait\');\
  5028. window.localStorage.removeItem(\'LastRecordedJournal\');\
  5029. document.getElementById(\'clearTrapList\').getElementsByTagName(\'b\')[0].innerHTML = \'[Done!]\';\
  5030. window.setTimeout(function () { document.getElementById(\'clearTrapList\').getElementsByTagName(\'b\')[0].innerHTML = \'[Clear Trap List]\'; }, 1000);\
  5031. ">';
  5032. clearTrapListStr += '<b>[Clear Trap List]</b></a>&nbsp;&nbsp;&nbsp;';
  5033. showPreferenceSpan.innerHTML = restorePreferenceStr + getLogPreferenceStr + clearTrapListStr + showPreferenceLinkStr;
  5034. showPreferenceLinkDiv.appendChild(showPreferenceSpan);
  5035. showPreferenceLinkStr = null;
  5036. showPreferenceSpan = null;
  5037. showPreferenceLinkDiv = null;
  5038.  
  5039. var hr2Element = document.createElement('hr');
  5040. timerDivElement.appendChild(hr2Element);
  5041. hr2Element = null;
  5042.  
  5043. var temp = "";
  5044. var i;
  5045. var preferenceHTMLStr = '<table border="0" width="100%">';
  5046. preferenceHTMLStr += '<tr>';
  5047. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5048. preferenceHTMLStr += '<a title="Bot aggressively by ignore all safety measure such as check horn image visible before sounding it"><b>Aggressive Mode</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5049. preferenceHTMLStr += '</td>';
  5050. preferenceHTMLStr += '<td style="height:24px">';
  5051. preferenceHTMLStr += '<select id="AggressiveModeInput" onchange="var isDisable = (value == \'true\') ? \'disabled\' : \'\'; document.getElementById(\'HornTimeDelayMinInput\').disabled=isDisable; document.getElementById(\'HornTimeDelayMaxInput\').disabled=isDisable;">';
  5052. if (aggressiveMode) {
  5053. preferenceHTMLStr += '<option value="false">False</option>';
  5054. preferenceHTMLStr += '<option value="true" selected>True</option>';
  5055. temp = 'disabled';
  5056. }
  5057. else {
  5058. preferenceHTMLStr += '<option value="false" selected>False</option>';
  5059. preferenceHTMLStr += '<option value="true">True</option>';
  5060. temp = '';
  5061. }
  5062. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a title="Extra delay time before sounding the horn (in seconds)"><b>Delay:</b></a>&emsp;';
  5063. preferenceHTMLStr += '<input type="number" id="HornTimeDelayMinInput" min="0" max="360" size="5" value="' + hornTimeDelayMin.toString() + '" ' + temp + '> seconds ~ ';
  5064. preferenceHTMLStr += '<input type="number" id="HornTimeDelayMaxInput" min="1" max="361" size="5" value="' + hornTimeDelayMax.toString() + '" ' + temp + '> seconds';
  5065. preferenceHTMLStr += '</td>';
  5066. preferenceHTMLStr += '</tr>';
  5067.  
  5068. preferenceHTMLStr += '<tr>';
  5069. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5070. preferenceHTMLStr += '<a title="Enable trap check once an hour"><b>Trap Check</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5071. preferenceHTMLStr += '</td>';
  5072. preferenceHTMLStr += '<td style="height:24px">';
  5073. preferenceHTMLStr += '<select id="TrapCheckInput" onchange="var isDisable = (value == \'false\') ? \'disabled\' : \'\'; document.getElementById(\'TrapCheckTimeDelayMinInput\').disabled=isDisable; document.getElementById(\'TrapCheckTimeDelayMaxInput\').disabled=isDisable;">';
  5074. if (enableTrapCheck) {
  5075. preferenceHTMLStr += '<option value="false">False</option>';
  5076. preferenceHTMLStr += '<option value="true" selected>True</option>';
  5077. temp = '';
  5078. }
  5079. else {
  5080. preferenceHTMLStr += '<option value="false" selected>False</option>';
  5081. preferenceHTMLStr += '<option value="true">True</option>';
  5082. temp = 'disabled';
  5083. }
  5084. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a title="Extra delay time to trap check (in seconds)"><b>Delay:</b></a>&emsp;';
  5085. preferenceHTMLStr += '<input type="number" id="TrapCheckTimeDelayMinInput" min="0" max="360" size="5" value="' + checkTimeDelayMin.toString() + '" ' + temp + '> seconds ~ ';
  5086. preferenceHTMLStr += '<input type="number" id="TrapCheckTimeDelayMaxInput" min="1" max="361" size="5" value="' + checkTimeDelayMax.toString() + '" ' + temp + '> seconds';
  5087. preferenceHTMLStr += '</td>';
  5088. preferenceHTMLStr += '</tr>';
  5089.  
  5090. preferenceHTMLStr += '<tr>';
  5091. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5092. preferenceHTMLStr += '<a title="Play sound when encounter king\'s reward"><b>Play King Reward Sound</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5093. preferenceHTMLStr += '</td>';
  5094. preferenceHTMLStr += '<td style="height:24px">';
  5095. preferenceHTMLStr += '<select id="PlayKingRewardSoundInput" >';
  5096. if (isKingWarningSound) {
  5097. preferenceHTMLStr += '<option value="false">False</option>';
  5098. preferenceHTMLStr += '<option value="true" selected>True</option>';
  5099. }
  5100. else {
  5101. preferenceHTMLStr += '<option value="false" selected>False</option>';
  5102. preferenceHTMLStr += '<option value="true">True</option>';
  5103. }
  5104. preferenceHTMLStr += '</select>';
  5105. preferenceHTMLStr += '</td>';
  5106. preferenceHTMLStr += '</tr>';
  5107.  
  5108. preferenceHTMLStr += '<tr>';
  5109. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5110. preferenceHTMLStr += '<a title="Solve King Reward automatically"><b>Auto Solve King Reward</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5111. preferenceHTMLStr += '</td>';
  5112. preferenceHTMLStr += '<td style="height:24px">';
  5113. preferenceHTMLStr += '<select id="AutoSolveKRInput" onchange="var isDisable = (value == \'false\') ? \'disabled\' : \'\'; document.getElementById(\'AutoSolveKRDelayMinInput\').disabled=isDisable; document.getElementById(\'AutoSolveKRDelayMaxInput\').disabled=isDisable;">';
  5114. if (isAutoSolve) {
  5115. preferenceHTMLStr += '<option value="false">False</option>';
  5116. preferenceHTMLStr += '<option value="true" selected>True</option>';
  5117. temp = '';
  5118. }
  5119. else {
  5120. preferenceHTMLStr += '<option value="false" selected>False</option>';
  5121. preferenceHTMLStr += '<option value="true">True</option>';
  5122. temp = 'disabled';
  5123. }
  5124. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a title="Extra delay time to solve King Reward (in seconds)"><b>Delay:</b></a>&emsp;';
  5125. preferenceHTMLStr += '<input type="number" id="AutoSolveKRDelayMinInput" min="0" max="360" size="5" value="' + krDelayMin.toString() + '" ' + temp + '> seconds ~ ';
  5126. preferenceHTMLStr += '<input type="number" id="AutoSolveKRDelayMaxInput" min="1" max="361" size="5" value="' + krDelayMax.toString() + '" ' + temp + '> seconds';
  5127. preferenceHTMLStr += '</td>';
  5128. preferenceHTMLStr += '</tr>';
  5129.  
  5130. preferenceHTMLStr += '<tr>';
  5131. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5132. preferenceHTMLStr += '<a title="Save King Reward image into localStorage"><b>Save King Reward Image</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5133. preferenceHTMLStr += '</td>';
  5134. preferenceHTMLStr += '<td style="height:24px">';
  5135. preferenceHTMLStr += '<select id="SaveKRImageInput" >';
  5136. if (saveKRImage) {
  5137. preferenceHTMLStr += '<option value="false">False</option>';
  5138. preferenceHTMLStr += '<option value="true" selected>True</option>';
  5139. }
  5140. else {
  5141. preferenceHTMLStr += '<option value="false" selected>False</option>';
  5142. preferenceHTMLStr += '<option value="true">True</option>';
  5143. }
  5144. preferenceHTMLStr += '</select>';
  5145. preferenceHTMLStr += '</td>';
  5146. preferenceHTMLStr += '</tr>';
  5147.  
  5148. preferenceHTMLStr += '<tr>';
  5149. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5150. preferenceHTMLStr += '<a title="View Saved King Reward Image from localStorage"><b>View King Reward Image</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5151. preferenceHTMLStr += '</td>';
  5152. preferenceHTMLStr += '<td style="height:24px">';
  5153. preferenceHTMLStr += '<select id="viewKR">';
  5154. preferenceHTMLStr += '</select>';
  5155. preferenceHTMLStr += '<input type="button" id="buttonViewKR" value="View" onclick="var keyValue = document.getElementById(\'viewKR\').value;var value = window.localStorage.getItem(keyValue);if(value.indexOf(\'data:image/png;base64,\') > -1){var pom = document.createElement(\'a\');pom.setAttribute(\'href\', value);pom.setAttribute(\'download\', keyValue.split(\'~\')[2]+\'.png\');if(document.createEvent){var event = document.createEvent(\'MouseEvents\');event.initEvent(\'click\', true, true);pom.dispatchEvent(event);}else pom.click();}else if(value.indexOf(\'i.imgur.com\') > -1){var win = window.open(value, \'_blank\');if(win)win.focus();else alert(\'Please allow popups for this site\');}">';
  5156. preferenceHTMLStr += '</td>';
  5157. preferenceHTMLStr += '</tr>';
  5158.  
  5159. preferenceHTMLStr += '<tr>';
  5160. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5161. preferenceHTMLStr += '<a title="The script will pause if player at different location that hunt location set before"><b>Remember Location</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5162. preferenceHTMLStr += '</td>';
  5163. preferenceHTMLStr += '<td style="height:24px">';
  5164. preferenceHTMLStr += '<select id="PauseLocationInput" >';
  5165. if (pauseAtInvalidLocation) {
  5166. preferenceHTMLStr += '<option value="false">False</option>';
  5167. preferenceHTMLStr += '<option value="true" selected>True</option>';
  5168. }
  5169. else {
  5170. preferenceHTMLStr += '<option value="false" selected>False</option>';
  5171. preferenceHTMLStr += '<option value="true">True</option>';
  5172. }
  5173. preferenceHTMLStr += '</select>';
  5174. preferenceHTMLStr += '</td>';
  5175. preferenceHTMLStr += '</tr>';
  5176.  
  5177. preferenceHTMLStr += '<tr>';
  5178. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Best Weapon for </b></a>';
  5179. preferenceHTMLStr += '<select id="selectBestTrapPowerType" style="width:75px;" onchange="initControlsBestTrap();">';
  5180. preferenceHTMLStr += '<option value="arcane">Arcane</option>';
  5181. preferenceHTMLStr += '<option value="draconic">Draconic</option>';
  5182. preferenceHTMLStr += '<option value="forgotten">Forgotten</option>';
  5183. preferenceHTMLStr += '<option value="hydro">Hydro</option>';
  5184. preferenceHTMLStr += '<option value="law">Law</option>';
  5185. preferenceHTMLStr += '<option value="physical">Physical</option>';
  5186. preferenceHTMLStr += '<option value="rift">Rift</option>';
  5187. preferenceHTMLStr += '<option value="shadow">Shadow</option>';
  5188. preferenceHTMLStr += '<option value="tactical">Tactical</option>';
  5189. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5190. preferenceHTMLStr += '</td>';
  5191. preferenceHTMLStr += '<td style="height:24px">';
  5192. preferenceHTMLStr += '<select id="selectBestTrapWeapon" style="width: 300px" onchange="saveBestTrap();">';
  5193. preferenceHTMLStr += '</select>';
  5194. preferenceHTMLStr += '</td>';
  5195. preferenceHTMLStr += '</tr>';
  5196.  
  5197. preferenceHTMLStr += '<tr>';
  5198. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Best Base for </b></a>';
  5199. preferenceHTMLStr += '<select id="selectBestTrapBaseType" style="width:75px;" onchange="initControlsBestTrap();">';
  5200. preferenceHTMLStr += '<option value="luck">Luck</option>';
  5201. preferenceHTMLStr += '<option value="power">Power</option>';
  5202. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5203. preferenceHTMLStr += '</td>';
  5204. preferenceHTMLStr += '<td style="height:24px">';
  5205. preferenceHTMLStr += '<select id="selectBestTrapBase" onchange="saveBestTrap();">';
  5206. preferenceHTMLStr += '</select>';
  5207. preferenceHTMLStr += '</td>';
  5208. preferenceHTMLStr += '</tr>';
  5209.  
  5210. preferenceHTMLStr += '<tr>';
  5211. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Support Me</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5212. preferenceHTMLStr += '<td style="height:24px">';
  5213. preferenceHTMLStr += '<input type="button" id="inputShowAds" value="Click to Show Ads" onclick="onIdAdsClicked()">';
  5214. preferenceHTMLStr += '</td>';
  5215. preferenceHTMLStr += '</tr>';
  5216.  
  5217. preferenceHTMLStr += '<tr>';
  5218. preferenceHTMLStr += '<td style="height:24px; text-align:right;" colspan="2">';
  5219. preferenceHTMLStr += '(Changes above this line only take place after user save the preference) ';
  5220. preferenceHTMLStr += '<input type="button" id="PreferenceSaveInput" value="Save" onclick="\
  5221. window.localStorage.setItem(\'AggressiveMode\', document.getElementById(\'AggressiveModeInput\').value);\
  5222. window.localStorage.setItem(\'HornTimeDelayMin\', document.getElementById(\'HornTimeDelayMinInput\').value);\
  5223. window.localStorage.setItem(\'HornTimeDelayMax\', document.getElementById(\'HornTimeDelayMaxInput\').value);\
  5224. window.localStorage.setItem(\'TrapCheck\', document.getElementById(\'TrapCheckInput\').value);\
  5225. window.localStorage.setItem(\'TrapCheckTimeDelayMin\', document.getElementById(\'TrapCheckTimeDelayMinInput\').value);\
  5226. window.localStorage.setItem(\'TrapCheckTimeDelayMax\', document.getElementById(\'TrapCheckTimeDelayMaxInput\').value);\
  5227. window.localStorage.setItem(\'PlayKingRewardSound\', document.getElementById(\'PlayKingRewardSoundInput\').value);\
  5228. window.localStorage.setItem(\'AutoSolveKR\', document.getElementById(\'AutoSolveKRInput\').value);\
  5229. window.localStorage.setItem(\'AutoSolveKRDelayMin\', document.getElementById(\'AutoSolveKRDelayMinInput\').value);\
  5230. window.localStorage.setItem(\'AutoSolveKRDelayMax\', document.getElementById(\'AutoSolveKRDelayMaxInput\').value);\
  5231. window.localStorage.setItem(\'SaveKRImage\', document.getElementById(\'SaveKRImageInput\').value);\
  5232. window.localStorage.setItem(\'PauseLocation\', document.getElementById(\'PauseLocationInput\').value);\
  5233. setSessionToLocal();\
  5234. for(var i=0;i<window.sessionStorage.length;i++){\
  5235. window.sessionStorage.removeItem(window.sessionStorage.key(i));\
  5236. }\
  5237. ';
  5238. if (fbPlatform)
  5239. temp = 'window.location.href=\'' + g_strHTTP + '://www.mousehuntgame.com/canvas/\';';
  5240. else if (hiFivePlatform)
  5241. temp = 'window.location.href=\'' + g_strHTTP + '://www.mousehunt.hi5.hitgrab.com/\';';
  5242. else if (mhPlatform)
  5243. temp = 'window.location.href=\'' + g_strHTTP + '://www.mousehuntgame.com/\';';
  5244.  
  5245. preferenceHTMLStr += temp + '"/>&nbsp;&nbsp;&nbsp;</td>';
  5246. preferenceHTMLStr += '</tr>';
  5247.  
  5248. preferenceHTMLStr += '<tr>';
  5249. preferenceHTMLStr += '<td style="height:24px" colspan="2">';
  5250. preferenceHTMLStr += '<div style="width: 100%; height: 1px; background: #000000; overflow: hidden;">';
  5251. preferenceHTMLStr += '</td>';
  5252. preferenceHTMLStr += '</tr>';
  5253.  
  5254. preferenceHTMLStr += '<tr id="trSpecialFeature" style="display:none;">';
  5255. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select special feature"><b>Special Feature</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5256. preferenceHTMLStr += '<td style="height:24px">';
  5257. preferenceHTMLStr += '<select id="selectSpecialFeature" onchange="onSelectSpecialFeature();">';
  5258. preferenceHTMLStr += '<option value="None">None</option>';
  5259. preferenceHTMLStr += '<option value="PILLOWCASE">Open Magical Pillowcase</option>';
  5260. preferenceHTMLStr += '</select>';
  5261. preferenceHTMLStr += '</td>';
  5262. preferenceHTMLStr += '</tr>';
  5263.  
  5264. preferenceHTMLStr += '<tr>';
  5265. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5266. preferenceHTMLStr += '<a title="Turn on/off Map Hunting feature"><b>Season 4 Map Hunting</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5267. preferenceHTMLStr += '</td>';
  5268. preferenceHTMLStr += '<td style="height:24px">';
  5269. preferenceHTMLStr += '<select id="selectMapHunting" onChange="onSelectMapHuntingChanged();">';
  5270. preferenceHTMLStr += '<option value="false">False</option>';
  5271. preferenceHTMLStr += '<option value="true">True</option>';
  5272. preferenceHTMLStr += '</select>';
  5273. preferenceHTMLStr += '</td>';
  5274. preferenceHTMLStr += '</tr>';
  5275.  
  5276. preferenceHTMLStr += '<tr id="trUncaughtMouse" style="display:none;">';
  5277. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5278. preferenceHTMLStr += '<a title="Click button Get to retrieve all uncaught mouse"><b>Uncaught Mouse</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5279. preferenceHTMLStr += '</td>';
  5280. preferenceHTMLStr += '<td style="height:24px">';
  5281. preferenceHTMLStr += '<select id="selectMouseList"></select>';
  5282. preferenceHTMLStr += '<input type="button" id="inputSelectMouse" title="Click to select the mouse from the left dropdown list" value="Select This Mouse" onclick="onInputSelectMouse();" disabled>&nbsp;&nbsp;';
  5283. preferenceHTMLStr += '<input type="button" id="inputGetMouse" title="Click to Get all uncaught mouse from treasure map" value="Refresh Uncaught Mouse List" onclick="onInputGetMouse();">';
  5284. preferenceHTMLStr += '</td>';
  5285. preferenceHTMLStr += '</tr>';
  5286.  
  5287. preferenceHTMLStr += '<tr id="trSelectedUncaughtMouse" style="display:none;">';
  5288. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select desired uncaught mouse"><b>Selected Mouse</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5289. preferenceHTMLStr += '<td style="height:24px">';
  5290. preferenceHTMLStr += '<input type="text" id="inputUncaughtMouse" value="" disabled>&nbsp;&nbsp;';
  5291. preferenceHTMLStr += '<input type="button" id="inputClearUncaughtMouse" title="Click to clear the selected mouse" value="Clear" onclick="onInputClearUncaughtMouse();">';
  5292. preferenceHTMLStr += '</td>';
  5293. preferenceHTMLStr += '</tr>';
  5294.  
  5295. preferenceHTMLStr += '<tr id="trCatchLogic" style="display:none;">';
  5296. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select desired catch logic"><b>Catch Logic</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5297. preferenceHTMLStr += '<td style="height:24px">';
  5298. preferenceHTMLStr += '<select id="selectCatchLogic" onchange="saveMapHunting();">';
  5299. preferenceHTMLStr += '<option value="OR">When either one of the Selected Mouse was caught</option>';
  5300. preferenceHTMLStr += '<option value="AND">When all of the Selected Mouse were caught</option>';
  5301. preferenceHTMLStr += '</select>';
  5302. preferenceHTMLStr += '</td>';
  5303. preferenceHTMLStr += '</tr>';
  5304.  
  5305. preferenceHTMLStr += '<tr id="trMapHuntingTrapSetup" style="display:none;">';
  5306. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5307. preferenceHTMLStr += '<a title="Select trap setup after catch logic is fulfilled"><b>After Caught</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5308. preferenceHTMLStr += '</td>';
  5309. preferenceHTMLStr += '<td style="height:24px">';
  5310. preferenceHTMLStr += '<select id="selectWeapon" style="width: 75px" onchange="saveMapHunting();">';
  5311. preferenceHTMLStr += '<option value="Remain">Remain</option>';
  5312. preferenceHTMLStr += '</select>';
  5313. preferenceHTMLStr += '<select id="selectBase" style="width: 75px" onchange="saveMapHunting();">';
  5314. preferenceHTMLStr += '<option value="Remain">Remain</option>';
  5315. preferenceHTMLStr += '</select>';
  5316. preferenceHTMLStr += '<select id="selectTrinket" style="width: 75px" onchange="saveMapHunting();">';
  5317. preferenceHTMLStr += '<option value="Remain">Remain</option>';
  5318. preferenceHTMLStr += '<option value="None">None</option>';
  5319. preferenceHTMLStr += '</select>';
  5320. preferenceHTMLStr += '<select id="selectBait" style="width: 75px" onchange="saveMapHunting();">';
  5321. preferenceHTMLStr += '<option value="Remain">Remain</option>';
  5322. preferenceHTMLStr += '<option value="None">None</option>';
  5323. preferenceHTMLStr += '</select>';
  5324. preferenceHTMLStr += '</td>';
  5325. preferenceHTMLStr += '</tr>';
  5326.  
  5327. preferenceHTMLStr += '<tr id="trMapHuntingLeave" style="display:none;">';
  5328. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select to leave map after catch logic is fulfilled"><b>Leave Map After Caught</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5329. preferenceHTMLStr += '<td style="height:24px">';
  5330. preferenceHTMLStr += '<select id="selectLeaveMap" onchange="saveMapHunting();">';
  5331. preferenceHTMLStr += '<option value="false">False</option>';
  5332. preferenceHTMLStr += '<option value="true">True</option>';
  5333. preferenceHTMLStr += '</select>';
  5334. preferenceHTMLStr += '</td>';
  5335. preferenceHTMLStr += '</tr>';
  5336.  
  5337. preferenceHTMLStr += '<tr>';
  5338. preferenceHTMLStr += '<td style="height:24px" colspan="2">';
  5339. preferenceHTMLStr += '<div style="width: 100%; height: 1px; background: #FFFFFF; overflow: hidden;">';
  5340. preferenceHTMLStr += '</td>';
  5341. preferenceHTMLStr += '</tr>';
  5342.  
  5343. preferenceHTMLStr += '<tr>';
  5344. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  5345. preferenceHTMLStr += '<a title="Select the script algorithm based on certain event / location"><b>Event or Location</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5346. preferenceHTMLStr += '</td>';
  5347. preferenceHTMLStr += '<td style="height:24px">';
  5348. preferenceHTMLStr += '<select id="eventAlgo" style="width:150px" onChange="window.sessionStorage.setItem(\'eventLocation\', value); showOrHideTr(value);">';
  5349. preferenceHTMLStr += '<option value="None" selected>None</option>';
  5350. preferenceHTMLStr += '<option value="All LG Area">All LG Area</option>';
  5351. preferenceHTMLStr += '<option value="BC/JOD">BC => JOD</option>';
  5352. preferenceHTMLStr += '<option value="Bristle Woods Rift">Bristle Woods Rift</option>';
  5353. preferenceHTMLStr += '<option value="Burroughs Rift(Red)">Burroughs Rift(Red)</option>';
  5354. preferenceHTMLStr += '<option value="Burroughs Rift(Green)">Burroughs Rift(Green)</option>';
  5355. preferenceHTMLStr += '<option value="Burroughs Rift(Yellow)">Burroughs Rift(Yellow)</option>';
  5356. preferenceHTMLStr += '<option value="Burroughs Rift Custom">Burroughs Rift Custom</option>';
  5357. preferenceHTMLStr += '<option value="Charge Egg 2016 Medium + High">Charge Egg 2016 Medium + High</option>';
  5358. preferenceHTMLStr += '<option value="Charge Egg 2016 High">Charge Egg 2016 High</option>';
  5359. preferenceHTMLStr += '<option value="FG/AR">FG => AR</option>';
  5360. preferenceHTMLStr += '<option value="Fiery Warpath">Fiery Warpath</option>';
  5361. preferenceHTMLStr += '<option value="Fort Rox">Fort Rox</option>';
  5362. preferenceHTMLStr += '<option value="Furoma Rift">Furoma Rift</option>';
  5363. preferenceHTMLStr += '<option value="GES">Gnawnian Express Station</option>';
  5364. //preferenceHTMLStr += '<option value="GWH2016R">GWH 2016</option>';
  5365. preferenceHTMLStr += '<option value="Halloween 2016">Halloween 2016</option>';
  5366. preferenceHTMLStr += '<option value="Halloween 2018">Halloween 2018</option>';
  5367. preferenceHTMLStr += '<option value="Iceberg">Iceberg</option>';
  5368. preferenceHTMLStr += '<option value="Labyrinth">Labyrinth</option>';
  5369. preferenceHTMLStr += '<option value="SG">Seasonal Garden</option>';
  5370. preferenceHTMLStr += '<option value="Sunken City">Sunken City</option>';
  5371. preferenceHTMLStr += '<option value="Sunken City Custom">Sunken City Custom</option>';
  5372. preferenceHTMLStr += '<option value="Test">Test</option>';
  5373. preferenceHTMLStr += '<option value="WWRift">WWRift</option>';
  5374. preferenceHTMLStr += '<option value="Zokor">Zokor</option>';
  5375. preferenceHTMLStr += '<option value="ZT">Zugzwang\'s Tower</option>';
  5376. preferenceHTMLStr += '</select>';
  5377. preferenceHTMLStr += '<input type="button" id="inputResetReload" title="Reset setting of current selected algo" value="Reset & Reload" onclick="onInputResetReload();' + temp + '">';
  5378. preferenceHTMLStr += '</td>';
  5379. preferenceHTMLStr += '</tr>';
  5380.  
  5381. preferenceHTMLStr += '<tr id="trBCJODSubLocation" style="display:none;">';
  5382. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Sub-Location</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5383. preferenceHTMLStr += '<td style="height:24px">';
  5384. preferenceHTMLStr += '<select id="selectBCJODSublocation" onchange="initControlsBCJOD();">';
  5385. preferenceHTMLStr += '<option value="JOD">Jungle of Dread</option>';
  5386. preferenceHTMLStr += '<option value="LOW">BC Low Tide</option>';
  5387. preferenceHTMLStr += '<option value="MID">BC Mid Tide</option>';
  5388. preferenceHTMLStr += '<option value="HIGH">BC High Tide</option>';
  5389. preferenceHTMLStr += '</select>';
  5390. preferenceHTMLStr += '</td>';
  5391. preferenceHTMLStr += '</tr>';
  5392.  
  5393. preferenceHTMLStr += '<tr id="trBCJODTrapSetup" style="display:none;">';
  5394. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup based on current sub-location"><b>Trap Setup </b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5395. preferenceHTMLStr += '<td style="height:24px">';
  5396. preferenceHTMLStr += '<select id="selectBCJODWeapon" style="width: 75px;" onchange="saveBCJOD();">';
  5397. preferenceHTMLStr += '</select>';
  5398. preferenceHTMLStr += '<select id="selectBCJODBase" style="width: 75px;" onchange="saveBCJOD();">';
  5399. preferenceHTMLStr += '</select>';
  5400. preferenceHTMLStr += '<select id="selectBCJODTrinket" style="width: 75px;" onchange="saveBCJOD();">';
  5401. preferenceHTMLStr += '<option value="None">None</option>';
  5402. preferenceHTMLStr += '</select>';
  5403. preferenceHTMLStr += '<select id="selectBCJODBait" style="width: 75px;" onchange="saveBCJOD();">';
  5404. preferenceHTMLStr += '<option value="None">None</option>';
  5405. preferenceHTMLStr += '<option value="Vanilla Stilton Cheese">Vanilla Stilton Cheese</option>';
  5406. preferenceHTMLStr += '<option value="Vengeful Vanilla Stilton Cheese">Vengeful Vanilla Stilton Cheese</option>';
  5407. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  5408. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  5409. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  5410. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  5411. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  5412. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  5413. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  5414. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  5415. preferenceHTMLStr += '</select>';
  5416. preferenceHTMLStr += '</td>';
  5417. preferenceHTMLStr += '</tr>';
  5418.  
  5419. preferenceHTMLStr += '<tr id="trFGARSubLocation" style="display:none;">';
  5420. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Sub-Location</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5421. preferenceHTMLStr += '<td style="height:24px">';
  5422. preferenceHTMLStr += '<select id="selectFGARSublocation" onchange="initControlsFGAR();">';
  5423. preferenceHTMLStr += '<option value="FG">Forbidden Grove</option>';
  5424. preferenceHTMLStr += '<option value="AR">Acolyte Realm</option>';
  5425. preferenceHTMLStr += '</select>';
  5426. preferenceHTMLStr += '</td>';
  5427. preferenceHTMLStr += '</tr>';
  5428.  
  5429. preferenceHTMLStr += '<tr id="trFGARTrapSetup" style="display:none;">';
  5430. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup based on current sub-location"><b>Trap Setup </b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5431. preferenceHTMLStr += '<td style="height:24px">';
  5432. preferenceHTMLStr += '<select id="selectFGARWeapon" style="width: 75px;" onchange="saveFGAR();">';
  5433. preferenceHTMLStr += '</select>';
  5434. preferenceHTMLStr += '<select id="selectFGARBase" style="width: 75px;" onchange="saveFGAR();">';
  5435. preferenceHTMLStr += '</select>';
  5436. preferenceHTMLStr += '<select id="selectFGARTrinket" style="width: 75px;" onchange="saveFGAR();">';
  5437. preferenceHTMLStr += '<option value="None">None</option>';
  5438. preferenceHTMLStr += '</select>';
  5439. preferenceHTMLStr += '<select id="selectFGARBait" style="width: 75px;" onchange="saveFGAR();">';
  5440. preferenceHTMLStr += '<option value="None">None</option>';
  5441. preferenceHTMLStr += '<option value="Runic Cheese">Runic Cheese</option>';
  5442. preferenceHTMLStr += '<option value="Ancient Cheese">Ancient Cheese</option>';
  5443. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  5444. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  5445. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  5446. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  5447. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  5448. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  5449. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  5450. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  5451. preferenceHTMLStr += '</select>';
  5452. preferenceHTMLStr += '</td>';
  5453. preferenceHTMLStr += '</tr>';
  5454.  
  5455. preferenceHTMLStr += '<tr id="trBWRiftAutoChoosePortal" style="display:none;">';
  5456. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Choose portal automatically"><b>Auto Choose Portal</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5457. preferenceHTMLStr += '<td style="height:24px">';
  5458. preferenceHTMLStr += '<select id="selectBWRiftChoosePortal" style="width: 75px;" onchange="onSelectBWRiftChoosePortal();">';
  5459. preferenceHTMLStr += '<option value="false">False</option>';
  5460. preferenceHTMLStr += '<option value="true">True</option>';
  5461. preferenceHTMLStr += '</select>';
  5462. preferenceHTMLStr += '</td>';
  5463. preferenceHTMLStr += '</tr>';
  5464.  
  5465. preferenceHTMLStr += '<tr id="trBWRiftChoosePortalAfterCC" style="display:none;">';
  5466. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Choose portal after Chamber Cleaver has been caught"><b>Choose Portal</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5467. preferenceHTMLStr += '<td style="height:24px">';
  5468. preferenceHTMLStr += '<select id="selectBWRiftChoosePortalAfterCC" style="width: 75px;" onchange="saveBWRift();">';
  5469. preferenceHTMLStr += '<option value="false">False</option>';
  5470. preferenceHTMLStr += '<option value="true">True</option>';
  5471. preferenceHTMLStr += '</select>&nbsp;&nbsp;After Chamber Cleaver Caught';
  5472. preferenceHTMLStr += '</td>';
  5473. preferenceHTMLStr += '</tr>';
  5474.  
  5475. preferenceHTMLStr += '<tr id="trBWRiftPortalPriority" style="display:none;">';
  5476. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select portal priority"><b>Portal Priority </b></a>';
  5477. preferenceHTMLStr += '<select id="selectBWRiftPriority" style="width: 75px;" onchange="initControlsBWRift();">';
  5478. for(i=1;i<=13;i++){
  5479. if(i==1)
  5480. preferenceHTMLStr += '<option value="' + i + '">' + i + ' (Highest)</option>';
  5481. else if(i==13)
  5482. preferenceHTMLStr += '<option value="' + i + '">' + i + ' (Lowest)</option>';
  5483. else
  5484. preferenceHTMLStr += '<option value="' + i + '">' + i + '</option>';
  5485. }
  5486. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5487. preferenceHTMLStr += '</td>';
  5488. preferenceHTMLStr += '<td style="height:24px">';
  5489. preferenceHTMLStr += '<select id="selectBWRiftPortal" onchange="saveBWRift();">';
  5490. preferenceHTMLStr += '<option value="GEARWORKS">Gearworks</option>';
  5491. preferenceHTMLStr += '<option value="ANCIENT">Ancient Lab</option>';
  5492. preferenceHTMLStr += '<option value="RUNIC">Runic Laboratory</option>';
  5493. preferenceHTMLStr += '<option value="AL/RL_MSC">AL/RL (MSC)</option>';
  5494. preferenceHTMLStr += '<option value="AL/RL_BSC">AL/RL (BSC)</option>';
  5495. preferenceHTMLStr += '<option value="TIMEWARP">Timewarp Chamber</option>';
  5496. preferenceHTMLStr += '<option value="LUCKY">Lucky Tower</option>';
  5497. preferenceHTMLStr += '<option value="HIDDEN">Hidden Treasury</option>';
  5498. preferenceHTMLStr += '<option value="GUARD">Guard Barracks</option>';
  5499. preferenceHTMLStr += '<option value="SECURITY">Security Chamber</option>';
  5500. preferenceHTMLStr += '<option value="FROZEN">Frozen Alcove</option>';
  5501. preferenceHTMLStr += '<option value="FURNACE">Furnace Room</option>';
  5502. preferenceHTMLStr += '<option value="INGRESS">Ingress Chamber</option>';
  5503. preferenceHTMLStr += '<option value="PURSUER">Pursuer Mousoleum</option>';
  5504. preferenceHTMLStr += '<option value="ACOLYTE">Acolyte Chamber</option>';
  5505. preferenceHTMLStr += '</select>';
  5506. preferenceHTMLStr += '</td>';
  5507. preferenceHTMLStr += '</tr>';
  5508.  
  5509. preferenceHTMLStr += '<tr id="trBWRiftPortalPriorityCursed" style="display:none;">';
  5510. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select portal priority when get cursed"><b>Portal Priority - Cursed </b></a>';
  5511. preferenceHTMLStr += '<select id="selectBWRiftPriorityCursed" style="width: 75px;" onchange="initControlsBWRift();">';
  5512. for(i=1;i<=13;i++){
  5513. if(i==1)
  5514. preferenceHTMLStr += '<option value="' + i + '">' + i + ' (Highest)</option>';
  5515. else if(i==13)
  5516. preferenceHTMLStr += '<option value="' + i + '">' + i + ' (Lowest)</option>';
  5517. else
  5518. preferenceHTMLStr += '<option value="' + i + '">' + i + '</option>';
  5519. }
  5520. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5521. preferenceHTMLStr += '</td>';
  5522. preferenceHTMLStr += '<td style="height:24px">';
  5523. preferenceHTMLStr += '<select id="selectBWRiftPortalCursed" onchange="saveBWRift();">';
  5524. preferenceHTMLStr += '<option value="GEARWORKS">Gearworks</option>';
  5525. preferenceHTMLStr += '<option value="ANCIENT">Ancient Lab</option>';
  5526. preferenceHTMLStr += '<option value="RUNIC">Runic Laboratory</option>';
  5527. preferenceHTMLStr += '<option value="AL/RL_MSC">AL/RL (MSC)</option>';
  5528. preferenceHTMLStr += '<option value="AL/RL_BSC">AL/RL (BSC)</option>';
  5529. preferenceHTMLStr += '<option value="TIMEWARP">Timewarp Chamber</option>';
  5530. preferenceHTMLStr += '<option value="LUCKY">Lucky Tower</option>';
  5531. preferenceHTMLStr += '<option value="HIDDEN">Hidden Treasury</option>';
  5532. preferenceHTMLStr += '<option value="GUARD">Guard Barracks</option>';
  5533. preferenceHTMLStr += '<option value="SECURITY">Security Chamber</option>';
  5534. preferenceHTMLStr += '<option value="FROZEN">Frozen Alcove</option>';
  5535. preferenceHTMLStr += '<option value="FURNACE">Furnace Room</option>';
  5536. preferenceHTMLStr += '<option value="INGRESS">Ingress Chamber</option>';
  5537. preferenceHTMLStr += '<option value="PURSUER">Pursuer Mousoleum</option>';
  5538. preferenceHTMLStr += '<option value="ACOLYTE">Acolyte Chamber</option>';
  5539. preferenceHTMLStr += '</select>';
  5540. preferenceHTMLStr += '</td>';
  5541. preferenceHTMLStr += '</tr>';
  5542.  
  5543. preferenceHTMLStr += '<tr id="trBWRiftMinTimeSand" style="display:none;">';
  5544. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select minimum time sand before entering Acolyte Chamber (AC)"><b>Min Time Sand </b></a>';
  5545. preferenceHTMLStr += '<select id="selectBWRiftBuffCurse" style="width: 75px;" onchange="initControlsBWRift();">';
  5546. preferenceHTMLStr += '<option value="0">No Buff & No Curse</option>';
  5547. preferenceHTMLStr += '<option value="1">Fourth Portal & No Curse</option>';
  5548. preferenceHTMLStr += '<option value="2">Acolyte Influence & No Curse</option>';
  5549. preferenceHTMLStr += '<option value="3">Acolyte Influence + Fourth Portal & No Curse</option>';
  5550. preferenceHTMLStr += '<option value="4">Paladin\'s Bane & No Curse</option>';
  5551. preferenceHTMLStr += '<option value="5">Paladin\'s Bane + Fourth Portal & No Curse</option>';
  5552. preferenceHTMLStr += '<option value="6">Paladin\'s Bane + Acolyte Influence & No Curse</option>';
  5553. preferenceHTMLStr += '<option value="7">All Buffs & No Curse</option>';
  5554. preferenceHTMLStr += '<option value="8">Buff(s) & Curse(s)</option>';
  5555. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5556. preferenceHTMLStr += '<td style="height:24px">';
  5557. preferenceHTMLStr += '<input type="number" id="inputMinTimeSand" min="0" max="99999" style="width:75px" value="50" onchange="onInputMinTimeSandChanged(this);">&nbsp;&nbsp;Before Enter AC';
  5558. preferenceHTMLStr += '</td>';
  5559. preferenceHTMLStr += '</tr>';
  5560.  
  5561. preferenceHTMLStr += '<tr id="trBWRiftMinRSC" style="display:none;">';
  5562. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select minimum Runic String Cheese before entering Acolyte Chamber (AC)&#13;Note 1: Total RSC = 2*RSC Pot + RSC"><b>Min Runic String Cheese</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5563. preferenceHTMLStr += '<td style="height:24px">';
  5564. preferenceHTMLStr += '<select id="selectBWRiftMinRSCType" style="width: 75px;" onchange="onSelectBWRiftMinRSCType();">';
  5565. preferenceHTMLStr += '<option value="NUMBER">Number</option>';
  5566. preferenceHTMLStr += '<option value="GEQ">Greater or Equal to Min Time Sand</option>';
  5567. preferenceHTMLStr += '</select>';
  5568. preferenceHTMLStr += '<input type="number" id="inputMinRSC" min="0" max="99999" style="width:75px" value="50" onchange="onInputMinRSCChanged(this);">&nbsp;&nbsp;Before Enter AC';
  5569. preferenceHTMLStr += '</td>';
  5570. preferenceHTMLStr += '</tr>';
  5571.  
  5572. preferenceHTMLStr += '<tr id="trBWRiftEnterMinigame" style="display:none;">';
  5573. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select to enter minigame with curse(s)"><b>Enter Minigame with Curse(s)</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5574. preferenceHTMLStr += '<td style="height:24px">';
  5575. preferenceHTMLStr += '<select id="selectBWRiftEnterWCurse" style="width: 75px;" onchange="saveBWRift();">';
  5576. preferenceHTMLStr += '<option value="false">False</option>';
  5577. preferenceHTMLStr += '<option value="true">True</option>';
  5578. preferenceHTMLStr += '</select>';
  5579. preferenceHTMLStr += '</td>';
  5580. preferenceHTMLStr += '</tr>';
  5581.  
  5582. preferenceHTMLStr += '<tr id="trBWRiftSubLocation" style="display:none;">';
  5583. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Chamber in Bristle Woods Rift"><b>Sub-Location</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5584. preferenceHTMLStr += '<td style="height:24px">';
  5585. preferenceHTMLStr += '<select id="selectBWRiftChamber" onchange="initControlsBWRift();">';
  5586. preferenceHTMLStr += '<option value="NONE">Non-Chamber</option>';
  5587. preferenceHTMLStr += '<option value="GEARWORKS">Gearworks</option>';
  5588. preferenceHTMLStr += '<option value="ANCIENT">Ancient Lab</option>';
  5589. preferenceHTMLStr += '<option value="RUNIC">Runic Laboratory</option>';
  5590. preferenceHTMLStr += '<option value="TIMEWARP">Timewarp Chamber</option>';
  5591. preferenceHTMLStr += '<option value="LUCKY">Lucky Tower</option>';
  5592. preferenceHTMLStr += '<option value="HIDDEN">Hidden Treasury</option>';
  5593. preferenceHTMLStr += '<option value="GUARD">Guard Barracks</option>';
  5594. preferenceHTMLStr += '<option value="SECURITY">Security Chamber</option>';
  5595. preferenceHTMLStr += '<option value="FROZEN">Frozen Alcove</option>';
  5596. preferenceHTMLStr += '<option value="FURNACE">Furnace Room</option>';
  5597. preferenceHTMLStr += '<option value="INGRESS">Ingress Chamber</option>';
  5598. preferenceHTMLStr += '<option value="PURSUER">Pursuer Mousoleum</option>';
  5599. preferenceHTMLStr += '<option value="ACOLYTE_CHARGING">Acolyte Chamber Charging</option>';
  5600. preferenceHTMLStr += '<option value="ACOLYTE_DRAINING">Acolyte Chamber Draining</option>';
  5601. preferenceHTMLStr += '<option value="ACOLYTE_DRAINED">Acolyte Chamber Drained</option>';
  5602. preferenceHTMLStr += '<option value="SEPARATOR" disabled>========= Separator =========</option>';
  5603. preferenceHTMLStr += '<option value="NONE_CURSED">Non-Chamber Cursed</option>';
  5604. preferenceHTMLStr += '<option value="GEARWORKS_CURSED">Gearworks Cursed</option>';
  5605. preferenceHTMLStr += '<option value="ANCIENT_CURSED">Ancient Lab Cursed</option>';
  5606. preferenceHTMLStr += '<option value="RUNIC_CURSED">Runic Laboratory Cursed</option>';
  5607. preferenceHTMLStr += '<option value="TIMEWARP_CURSED">Timewarp Chamber Cursed</option>';
  5608. preferenceHTMLStr += '<option value="LUCKY_CURSED">Lucky Tower Cursed</option>';
  5609. preferenceHTMLStr += '<option value="HIDDEN_CURSED">Hidden Treasury Cursed</option>';
  5610. preferenceHTMLStr += '<option value="GUARD_CURSED">Guard Barracks Cursed</option>';
  5611. preferenceHTMLStr += '<option value="SECURITY_CURSED">Security Chamber Cursed</option>';
  5612. preferenceHTMLStr += '<option value="FROZEN_CURSED">Frozen Alcove Cursed</option>';
  5613. preferenceHTMLStr += '<option value="FURNACE_CURSED">Furnace Room Cursed</option>';
  5614. preferenceHTMLStr += '<option value="INGRESS_CURSED">Ingress Chamber Cursed</option>';
  5615. preferenceHTMLStr += '<option value="PURSUER_CURSED">Pursuer Mousoleum Cursed</option>';
  5616. preferenceHTMLStr += '<option value="ACOLYTE_CHARGING_CURSED">Acolyte Chamber Charging Cursed</option>';
  5617. preferenceHTMLStr += '<option value="ACOLYTE_DRAINING_CURSED">Acolyte Chamber Draining Cursed</option>';
  5618. preferenceHTMLStr += '<option value="ACOLYTE_DRAINED_CURSED">Acolyte Chamber Drained Cursed</option>';
  5619. preferenceHTMLStr += '</select>';
  5620. preferenceHTMLStr += '</td>';
  5621. preferenceHTMLStr += '</tr>';
  5622.  
  5623. preferenceHTMLStr += '<tr id="trBWRiftMasterTrapSetup" style="display:none;">';
  5624. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup based on current chamber"><b>Master Trap Setup</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5625. preferenceHTMLStr += '<td style="height:24px">';
  5626. preferenceHTMLStr += '<select id="selectBWRiftWeapon" style="width: 75px;" onchange="saveBWRift();">';
  5627. preferenceHTMLStr += '<option value="Chrome Celestial Dissonance">Chrome CD</option>';
  5628. preferenceHTMLStr += '<option value="Celestial Dissonance">Cel Dis</option>';
  5629. preferenceHTMLStr += '<option value="Timesplit Dissonance">TDW</option>';
  5630. preferenceHTMLStr += '<option value="Mysteriously unYielding">MYNORCA</option>';
  5631. preferenceHTMLStr += '<option value="Focused Crystal Laser">FCL</option>';
  5632. preferenceHTMLStr += '<option value="Multi-Crystal Laser">MCL</option>';
  5633. preferenceHTMLStr += '<option value="Biomolecular Re-atomizer">BRT</option>';
  5634. preferenceHTMLStr += '<option value="Crystal Tower">CT</option>';
  5635. preferenceHTMLStr += '</select>';
  5636. preferenceHTMLStr += '<select id="selectBWRiftBase" style="width: 75px;" onchange="saveBWRift();">';
  5637. preferenceHTMLStr += '<option value="Clockwork Base">Clockwork</option>';
  5638. preferenceHTMLStr += '<option value="Fissure Base">Fissure</option>';
  5639. preferenceHTMLStr += '<option value="Rift Base">Rift</option>';
  5640. preferenceHTMLStr += '<option value="Fracture Base">Fracture</option>';
  5641. preferenceHTMLStr += '<option value="Enerchi Induction Base">Enerchi</option>';
  5642. preferenceHTMLStr += '<option value="Attuned Enerchi Induction Base">A. Enerchi</option>';
  5643. preferenceHTMLStr += '<option value="Minotaur Base">Minotaur</option>';
  5644. preferenceHTMLStr += '</select>';
  5645. preferenceHTMLStr += '<select id="selectBWRiftTrinket" style="width: 75px;" onchange="saveBWRift();">';
  5646. preferenceHTMLStr += '<option value="None">None</option>';
  5647. preferenceHTMLStr += '</select>';
  5648. preferenceHTMLStr += '<select id="selectBWRiftBait" style="width: 75px;" onchange="saveBWRift();">';
  5649. preferenceHTMLStr += '<option value="None">None</option>';
  5650. preferenceHTMLStr += '<option value="Runic String">Runic</option>';
  5651. preferenceHTMLStr += '<option value="Ancient String">Ancient</option>';
  5652. preferenceHTMLStr += '<option value="Runic/Ancient">Runic/Ancient</option>';
  5653. preferenceHTMLStr += '<option value="Runic=>Ancient">Runic=>Ancient</option>';
  5654. preferenceHTMLStr += '<option value="Magical String">Magical</option>';
  5655. preferenceHTMLStr += '<option value="Brie String">Brie</option>';
  5656. preferenceHTMLStr += '<option value="Swiss String">Swiss</option>';
  5657. preferenceHTMLStr += '<option value="Marble String">Marble</option>';
  5658. preferenceHTMLStr += '</select>';
  5659. preferenceHTMLStr += '<select id="selectBWRiftActivatePocketWatch" style="width: 75px;" onchange="saveBWRift();">';
  5660. preferenceHTMLStr += '<option value="false">Deactivate Quantum Pocketwatch</option>';
  5661. preferenceHTMLStr += '<option value="true">Activate Quantum Pocketwatch</option>';
  5662. preferenceHTMLStr += '</select>';
  5663. preferenceHTMLStr += '</td>';
  5664. preferenceHTMLStr += '</tr>';
  5665.  
  5666. preferenceHTMLStr += '<tr id="trBWRiftTrapSetupSpecial" style="display:none;">';
  5667. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup based on current chamber"><b>Conditional Trap Setup </b></a>';
  5668. preferenceHTMLStr += '<select id="selectBWRiftCleaverStatus" style="width:75px;display:none" onchange="initControlsBWRift();">';
  5669. preferenceHTMLStr += '<option value="0">Cleaver Not Available</option>';
  5670. preferenceHTMLStr += '<option value="1">Cleaver Available</option>';
  5671. preferenceHTMLStr += '</select>';
  5672. preferenceHTMLStr += '<select id="selectBWRiftAlertLvl" style="width:75px;display:none" onchange="initControlsBWRift();">';
  5673. for(i=0;i<=6;i++)
  5674. preferenceHTMLStr += '<option value="' + i + '">Alert Lvl ' + i + '</option>';
  5675. preferenceHTMLStr += '</select>';
  5676. preferenceHTMLStr += '<select id="selectBWRiftFTC" style="width:75px;display:none" onchange="initControlsBWRift();">';
  5677. for(i=0;i<=3;i++)
  5678. preferenceHTMLStr += '<option value="' + i + '">FTC ' + i + '</option>';
  5679. preferenceHTMLStr += '</select>';
  5680. preferenceHTMLStr += '<select id="selectBWRiftHunt" style="width:75px;display:none" onchange="initControlsBWRift();">';
  5681. for(i=0;i<=15;i++)
  5682. preferenceHTMLStr += '<option value="' + i + '">Hunt ' + i + '</option>';
  5683. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5684. preferenceHTMLStr += '</td>';
  5685. preferenceHTMLStr += '<td style="height:24px">';
  5686. preferenceHTMLStr += '<select id="selectBWRiftWeaponSpecial" style="width: 75px;" onchange="saveBWRift();">';
  5687. preferenceHTMLStr += '<option value="MASTER">Master</option>';
  5688. preferenceHTMLStr += '<option value="Chrome Celestial Dissonance">Chrome CD</option>';
  5689. preferenceHTMLStr += '<option value="Celestial Dissonance">Cel Dis</option>';
  5690. preferenceHTMLStr += '<option value="Timesplit Dissonance">TDW</option>';
  5691. preferenceHTMLStr += '<option value="Mysteriously unYielding">MYNORCA</option>';
  5692. preferenceHTMLStr += '<option value="Focused Crystal Laser">FCL</option>';
  5693. preferenceHTMLStr += '<option value="Multi-Crystal Laser">MCL</option>';
  5694. preferenceHTMLStr += '<option value="Biomolecular Re-atomizer">BRT</option>';
  5695. preferenceHTMLStr += '<option value="Crystal Tower">CT</option>';
  5696. preferenceHTMLStr += '</select>';
  5697. preferenceHTMLStr += '<select id="selectBWRiftBaseSpecial" style="width: 75px;" onchange="saveBWRift();">';
  5698. preferenceHTMLStr += '<option value="MASTER">Master</option>';
  5699. preferenceHTMLStr += '<option value="Clockwork Base">Clockwork</option>';
  5700. preferenceHTMLStr += '<option value="Fissure Base">Fissure</option>';
  5701. preferenceHTMLStr += '<option value="Rift Base">Rift</option>';
  5702. preferenceHTMLStr += '<option value="Fracture Base">Fracture</option>';
  5703. preferenceHTMLStr += '<option value="Enerchi Induction Base">Enerchi</option>';
  5704. preferenceHTMLStr += '<option value="Attuned Enerchi Induction Base">A. Enerchi</option>';
  5705. preferenceHTMLStr += '<option value="Minotaur Base">Minotaur</option>';
  5706. preferenceHTMLStr += '</select>';
  5707. preferenceHTMLStr += '<select id="selectBWRiftTrinketSpecial" style="width: 75px;" onchange="saveBWRift();">';
  5708. preferenceHTMLStr += '<option value="MASTER">Master</option>';
  5709. preferenceHTMLStr += '<option value="None">None</option>';
  5710. preferenceHTMLStr += '</select>';
  5711. preferenceHTMLStr += '<select id="selectBWRiftBaitSpecial" style="width: 75px;" onchange="saveBWRift();">';
  5712. preferenceHTMLStr += '<option value="MASTER">Master</option>';
  5713. preferenceHTMLStr += '<option value="None">None</option>';
  5714. preferenceHTMLStr += '<option value="Runic String">Runic</option>';
  5715. preferenceHTMLStr += '<option value="Ancient String">Ancient</option>';
  5716. preferenceHTMLStr += '<option value="Runic/Ancient">Runic/Ancient</option>';
  5717. preferenceHTMLStr += '<option value="Runic=>Ancient">Runic=>Ancient</option>';
  5718. preferenceHTMLStr += '<option value="Magical String">Magical</option>';
  5719. preferenceHTMLStr += '<option value="Brie String">Brie</option>';
  5720. preferenceHTMLStr += '<option value="Swiss String">Swiss</option>';
  5721. preferenceHTMLStr += '<option value="Marble String">Marble</option>';
  5722. preferenceHTMLStr += '</select>';
  5723. preferenceHTMLStr += '<select id="selectBWRiftActivatePocketWatchSpecial" style="width: 75px;" onchange="saveBWRift();">';
  5724. preferenceHTMLStr += '<option value="MASTER">Master</option>';
  5725. preferenceHTMLStr += '<option value="false">Deactivate Quantum Pocketwatch</option>';
  5726. preferenceHTMLStr += '<option value="true">Activate Quantum Pocketwatch</option>';
  5727. preferenceHTMLStr += '</select>';
  5728. preferenceHTMLStr += '</td>';
  5729. preferenceHTMLStr += '</tr>';
  5730.  
  5731. preferenceHTMLStr += '<tr id="trBWRiftActivatePocketWatch" style="display:none;">';
  5732. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Activate Quantum Pocketwatch forcibly"><b>Force Activate Quantum</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5733. preferenceHTMLStr += '<td style="height:24px">';
  5734. preferenceHTMLStr += '<select id="selectBWRiftForceActiveQuantum" style="width: 75px;" onchange="onSelectBWRiftForceActiveQuantum();">';
  5735. preferenceHTMLStr += '<option value="false">False</option>';
  5736. preferenceHTMLStr += '<option value="true">True</option>';
  5737. preferenceHTMLStr += '</select>&nbsp;&nbsp;If Remaining Loot/Obelisk Charge &le;&nbsp;&nbsp;:&nbsp;&nbsp;';
  5738. preferenceHTMLStr += '<input type="number" id="inputRemainingLootA" min="1" max="100" size="5" value="1" onchange="onInputRemaininigLootAChanged(this);">';
  5739. preferenceHTMLStr += '</td>';
  5740. preferenceHTMLStr += '</tr>';
  5741.  
  5742. preferenceHTMLStr += '<tr id="trBWRiftDeactivatePocketWatch" style="display:none;">';
  5743. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Deactivate Quantum Pocketwatch forcibly"><b>Force Deactivate Quantum</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5744. preferenceHTMLStr += '<td style="height:24px">';
  5745. preferenceHTMLStr += '<select id="selectBWRiftForceDeactiveQuantum" style="width: 75px;" onchange="onSelectBWRiftForceDeactiveQuantum();">';
  5746. preferenceHTMLStr += '<option value="false">False</option>';
  5747. preferenceHTMLStr += '<option value="true">True</option>';
  5748. preferenceHTMLStr += '</select>&nbsp;&nbsp;If Remaining Loot/Obelisk Charge &le;&nbsp;&nbsp;:&nbsp;&nbsp;';
  5749. preferenceHTMLStr += '<input type="number" id="inputRemainingLootD" min="1" max="100" size="5" value="1" onchange="onInputRemaininigLootDChanged(this);">';
  5750. preferenceHTMLStr += '</td>';
  5751. preferenceHTMLStr += '</tr>';
  5752.  
  5753. preferenceHTMLStr += '<tr id="trFRoxTrapSetup" style="display:none;">';
  5754. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup based on current stage"><b>Trap Setup for </b></a>';
  5755. preferenceHTMLStr += '<select id="selectFRoxStage" onchange="initControlsFRox();">';
  5756. preferenceHTMLStr += '<option value="DAY">Day</option>';
  5757. preferenceHTMLStr += '<option value="TWILIGHT">Twilight</option>';
  5758. preferenceHTMLStr += '<option value="MIDNIGHT">Midnight</option>';
  5759. preferenceHTMLStr += '<option value="PITCH">Pitch</option>';
  5760. preferenceHTMLStr += '<option value="UTTER">Utter Darkness</option>';
  5761. preferenceHTMLStr += '<option value="FIRST">First Light</option>';
  5762. preferenceHTMLStr += '<option value="DAWN">Dawn</option>';
  5763. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5764. preferenceHTMLStr += '</td>';
  5765. preferenceHTMLStr += '<td style="height:24px">';
  5766. preferenceHTMLStr += '<select id="selectFRoxWeapon" style="width: 75px;" onchange="saveFRox();"></select>';
  5767. preferenceHTMLStr += '<select id="selectFRoxBase" style="width: 75px;" onchange="saveFRox();"></select>';
  5768. preferenceHTMLStr += '<select id="selectFRoxTrinket" style="width: 75px;" onchange="saveFRox();">';
  5769. preferenceHTMLStr += '<option value="None">None</option>';
  5770. preferenceHTMLStr += '</select>';
  5771. preferenceHTMLStr += '<select id="selectFRoxBait" style="width: 75px;" onchange="saveFRox();">';
  5772. preferenceHTMLStr += '<option value="None">None</option>';
  5773. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  5774. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  5775. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  5776. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  5777. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  5778. preferenceHTMLStr += '<option value="Crescent">Crescent</option>';
  5779. preferenceHTMLStr += '<option value="Moon">Moon</option>';
  5780. preferenceHTMLStr += '<option value="ANY_LUNAR">Moon/Crescent</option>';
  5781. preferenceHTMLStr += '<option value="Moon=>Crescent">Moon=>Crescent</option>';
  5782. preferenceHTMLStr += '<option value="Crescent=>Moon">Crescent=>Moon</option>';
  5783. preferenceHTMLStr += '</select>';
  5784. preferenceHTMLStr += '<select id="selectFRoxActivateTower" style="width: 75px;" onchange="saveFRox();">';
  5785. preferenceHTMLStr += '<option value="false">Deactivate Tower</option>';
  5786. preferenceHTMLStr += '<option value="true">Activate Tower</option>';
  5787. preferenceHTMLStr += '</select>';
  5788. preferenceHTMLStr += '</td>';
  5789. preferenceHTMLStr += '</tr>';
  5790.  
  5791. preferenceHTMLStr += '<tr id="trFRoxDeactiveTower" style="display:none;">';
  5792. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select to deactivate tower when full HP"><b>Deactivate Tower When HP Full</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5793. preferenceHTMLStr += '<td style="height:24px">';
  5794. preferenceHTMLStr += '<select id="selectFRoxFullHPDeactivate" onchange="saveFRox();">';
  5795. preferenceHTMLStr += '<option value="false">False</option>';
  5796. preferenceHTMLStr += '<option value="true">True</option>';
  5797. preferenceHTMLStr += '</select>';
  5798. preferenceHTMLStr += '</td>';
  5799. preferenceHTMLStr += '</tr>';
  5800.  
  5801. preferenceHTMLStr += '<tr id="trGESTrapSetup" style="display:none;">';
  5802. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Trap Setup at </b></a>';
  5803. preferenceHTMLStr += '<select id="selectGESStage" style="width: 75px;" onchange="initControlsGES();">';
  5804. preferenceHTMLStr += '<option value="SD_BEFORE">Supply Depot (No Supply Rush)</option>';
  5805. preferenceHTMLStr += '<option value="SD_AFTER">Supply Depot (Supply Rush)</option>';
  5806. preferenceHTMLStr += '<option value="RR">Raider River</option>';
  5807. preferenceHTMLStr += '<option value="DC">Daredevil Canyon</option>';
  5808. preferenceHTMLStr += '<option value="WAITING">Waiting</option>';
  5809. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5810. preferenceHTMLStr += '</td>';
  5811. preferenceHTMLStr += '<td style="height:24px">';
  5812. preferenceHTMLStr += '<select id="selectGESTrapWeapon" style="width: 75px;" onchange="saveGES();">';
  5813. preferenceHTMLStr += '<option value="S.L.A.C.">S.L.A.C.</option>';
  5814. preferenceHTMLStr += '<option value="S.L.A.C. II">S.L.A.C. II</option>';
  5815. preferenceHTMLStr += '<option value="Supply Grabber">Supply Grabber</option>';
  5816. preferenceHTMLStr += '<option value="Bandit Deflector">Bandit Deflector</option>';
  5817. preferenceHTMLStr += '<option value="Engine Doubler">Engine Doubler</option>';
  5818. preferenceHTMLStr += '<option value="The Law Draw">The Law Draw</option>';
  5819. preferenceHTMLStr += '<option value="Law Laser Trap">Law Laser Trap</option>';
  5820. preferenceHTMLStr += '<option value="Meteor Prison Core Trap">Meteor Prison Core Trap</option>';
  5821. preferenceHTMLStr += '</select>';
  5822. preferenceHTMLStr += '<select id="selectGESTrapBase" style="width: 75px" onchange="saveGES();">';
  5823. preferenceHTMLStr += '</select>';
  5824. preferenceHTMLStr += '<select id="selectGESTrapTrinket" style="width: 75px;" onchange="saveGES();">';
  5825. preferenceHTMLStr += '<option value="None">None</option>';
  5826. preferenceHTMLStr += '</select>';
  5827. preferenceHTMLStr += '<select id="selectGESRRTrapTrinket" style="width: 75px;display:none" onchange="saveGES();">';
  5828. preferenceHTMLStr += '<option value="None">None</option>';
  5829. preferenceHTMLStr += '<option value="AUTO">Roof Rack/Door Guard/Greasy Glob</option>';
  5830. preferenceHTMLStr += '</select>';
  5831. preferenceHTMLStr += '<select id="selectGESDCTrapTrinket" style="width: 75px;display:none" onchange="saveGES();">';
  5832. preferenceHTMLStr += '<option value="None">None</option>';
  5833. preferenceHTMLStr += '<option value="AUTO">Magmatic Crystal/Black Powder/Dusty Coal</option>';
  5834. preferenceHTMLStr += '</select>';
  5835. preferenceHTMLStr += '<select id="selectGESTrapBait" style="width: 75px" onchange="saveGES();">';
  5836. preferenceHTMLStr += '<option value="None">None</option>';
  5837. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  5838. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  5839. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  5840. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  5841. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  5842. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  5843. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  5844. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  5845. preferenceHTMLStr += '</select>';
  5846. preferenceHTMLStr += '</td>';
  5847. preferenceHTMLStr += '</tr>';
  5848.  
  5849. preferenceHTMLStr += '<tr id="trGESSDLoadCrate" style="display:none;">';
  5850. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Load Crate</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5851. preferenceHTMLStr += '<td style="height:24px">';
  5852. preferenceHTMLStr += '<select id="selectGESSDLoadCrate" onchange="onSelectGESSDLoadCrate();">';
  5853. preferenceHTMLStr += '<option value="false">False</option>';
  5854. preferenceHTMLStr += '<option value="true">True</option>';
  5855. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a><b>When Crate &ge; :</b></a>&nbsp;';
  5856. preferenceHTMLStr += '<input type="number" id="inputMinCrate" min="1" max="50" size="5" value="11" onchange="saveGES(this);">';
  5857. preferenceHTMLStr += '</td>';
  5858. preferenceHTMLStr += '</tr>';
  5859.  
  5860. preferenceHTMLStr += '<tr id="trGESRRRepellent" style="display:none;">';
  5861. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Use Repellent</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5862. preferenceHTMLStr += '<td style="height:24px">';
  5863. preferenceHTMLStr += '<select id="selectGESRRRepellent" onchange="onSelectGESRRRepellent();">';
  5864. preferenceHTMLStr += '<option value="false">False</option>';
  5865. preferenceHTMLStr += '<option value="true">True</option>';
  5866. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a><b>When Repellent &ge; :</b></a>&nbsp;';
  5867. preferenceHTMLStr += '<input type="number" id="inputMinRepellent" min="1" max="50" size="5" value="11" onchange="saveGES(this);">';
  5868. preferenceHTMLStr += '</td>';
  5869. preferenceHTMLStr += '</tr>';
  5870.  
  5871. preferenceHTMLStr += '<tr id="trGESDCStokeEngine" style="display:none;">';
  5872. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Stoke Engine</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5873. preferenceHTMLStr += '<td style="height:24px">';
  5874. preferenceHTMLStr += '<select id="selectGESDCStokeEngine" onchange="onSelectGESDCStokeEngine();">';
  5875. preferenceHTMLStr += '<option value="false">False</option>';
  5876. preferenceHTMLStr += '<option value="true">True</option>';
  5877. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a><b>When Fuel Nuggests &ge;:</b></a>&nbsp;';
  5878. preferenceHTMLStr += '<input type="number" id="inputMinFuelNugget" min="1" max="20" size="5" value="20" onchange="saveGES(this);">';
  5879. preferenceHTMLStr += '</td>';
  5880. preferenceHTMLStr += '</tr>';
  5881.  
  5882. preferenceHTMLStr += '<tr id="trWWRiftFactionFocus" style="display:none;">';
  5883. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select a faction to focus on"><b>Faction to Focus</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5884. preferenceHTMLStr += '<td style="height:24px">';
  5885. preferenceHTMLStr += '<select id="selectWWRiftFaction" onchange="onSelectWWRiftFaction();">';
  5886. preferenceHTMLStr += '<option value="CC">Crazed Clearing</option>';
  5887. preferenceHTMLStr += '<option value="GGT">Gigantic Gnarled Tree</option>';
  5888. preferenceHTMLStr += '<option value="DL">Deep Lagoon</option>';
  5889. preferenceHTMLStr += '<option value="MBW_40_44">MBW 40 &le; Rage &le; 44</option>';
  5890. preferenceHTMLStr += '<option value="MBW_45_48">MBW 45 &le; Rage &le; 48</option>';
  5891. preferenceHTMLStr += '</select>';
  5892. preferenceHTMLStr += '</td>';
  5893. preferenceHTMLStr += '</tr>';
  5894.  
  5895. preferenceHTMLStr += '<tr id="trWWRiftFactionFocusNext" style="display:none;">';
  5896. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select next faction to focus on"><b>Next Faction to Focus</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5897. preferenceHTMLStr += '<td style="height:24px">';
  5898. preferenceHTMLStr += '<select id="selectWWRiftFactionNext" onchange="saveWWRift();">';
  5899. preferenceHTMLStr += '<option value="Remain">Remain</option>';
  5900. preferenceHTMLStr += '<option value="CC">Crazed Clearing</option>';
  5901. preferenceHTMLStr += '<option value="GGT">Gigantic Gnarled Tree</option>';
  5902. preferenceHTMLStr += '<option value="DL">Deep Lagoon</option>';
  5903. preferenceHTMLStr += '</select>';
  5904. preferenceHTMLStr += '</td>';
  5905. preferenceHTMLStr += '</tr>';
  5906.  
  5907. preferenceHTMLStr += '<tr id="trWWRiftTrapSetup" style="display:none;">';
  5908. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select to trap setup based on certain range of rage"><b>Trap Setup for Rage</b></a>';
  5909. preferenceHTMLStr += '<select id="selectWWRiftRage" onchange="initControlsWWRift();">';
  5910. preferenceHTMLStr += '<option value="0">0-24</option>';
  5911. preferenceHTMLStr += '<option value="25">25-49</option>';
  5912. preferenceHTMLStr += '<option value="50">50</option>';
  5913. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5914. preferenceHTMLStr += '</td>';
  5915. preferenceHTMLStr += '<td style="height:24px">';
  5916. preferenceHTMLStr += '<select id="selectWWRiftTrapWeapon" onchange="saveWWRift();">';
  5917. preferenceHTMLStr += '<option value="Chrome Celestial Dissonance">Chrome CD</option>';
  5918. preferenceHTMLStr += '<option value="Celestial Dissonance">Cel Dis</option>';
  5919. preferenceHTMLStr += '<option value="Timesplit Dissonance">TDW</option>';
  5920. preferenceHTMLStr += '<option value="Mysteriously unYielding">MYNORCA</option>';
  5921. preferenceHTMLStr += '<option value="Focused Crystal Laser">FCL</option>';
  5922. preferenceHTMLStr += '<option value="Multi-Crystal Laser">MCL</option>';
  5923. preferenceHTMLStr += '<option value="Biomolecular Re-atomizer">BRT</option>';
  5924. preferenceHTMLStr += '<option value="Crystal Tower">CT</option>';
  5925. preferenceHTMLStr += '</select>';
  5926. preferenceHTMLStr += '<select id="selectWWRiftTrapBase" style="width: 75px" onchange="saveWWRift();">';
  5927. preferenceHTMLStr += '</select>';
  5928. preferenceHTMLStr += '<select id="selectWWRiftTrapTrinket" style="width: 75px" onchange="saveWWRift();">';
  5929. preferenceHTMLStr += '<option value="None">None</option>';
  5930. preferenceHTMLStr += '<option value="FSC">Faction Specific Charm</option>';
  5931. preferenceHTMLStr += '</select>';
  5932. preferenceHTMLStr += '<select id="selectWWRiftTrapBait" onchange="saveWWRift();">';
  5933. preferenceHTMLStr += '<option value="None">None</option>';
  5934. preferenceHTMLStr += '<option value="Magical String">Magical</option>';
  5935. preferenceHTMLStr += '<option value="Brie String">Brie</option>';
  5936. preferenceHTMLStr += '<option value="Swiss String">Swiss</option>';
  5937. preferenceHTMLStr += '<option value="Marble String">Marble</option>';
  5938. preferenceHTMLStr += '</select>';
  5939. preferenceHTMLStr += '</td>';
  5940. preferenceHTMLStr += '</tr>';
  5941.  
  5942. preferenceHTMLStr += '<tr id="trWWRiftMBWMinRage" style="display:none;">';
  5943. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select minimum rage to hunt MBW"><b>Min Rage to Hunt MBW</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  5944. preferenceHTMLStr += '<td style="height:24px">';
  5945. preferenceHTMLStr += '<input type="number" id="inputMinRage" min="40" max="48" size="5" value="40" onchange="onInputMinRageChanged(this);">';
  5946. preferenceHTMLStr += '</td>';
  5947. preferenceHTMLStr += '</tr>';
  5948.  
  5949. preferenceHTMLStr += '<tr id="trWWRiftMBWTrapSetup" style="display:none;">';
  5950. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Trap Setup When </b></a>';
  5951. preferenceHTMLStr += '<select id="selectWWRiftMBWBar4044" style="width: 75px; display:none" onchange="initControlsWWRift();">';
  5952. preferenceHTMLStr += '<option value="25_0">0 Bar &ge; 25 Rage</option>';
  5953. preferenceHTMLStr += '<option value="25_1">1 Bar &ge; 25 Rage</option>';
  5954. preferenceHTMLStr += '<option value="25_2">2 Bars &ge; 25 Rage</option>';
  5955. preferenceHTMLStr += '<option value="MIN_RAGE_0">3 Bars &ge; 25 Rage / 0 Bar &ge; Min Rage to Hunt MBW</option>';
  5956. preferenceHTMLStr += '<option value="MIN_RAGE_1">1 Bar &ge; Min Rage to Hunt MBW</option>';
  5957. preferenceHTMLStr += '<option value="MIN_RAGE_2">2 Bars &ge; Min Rage to Hunt MBW</option>';
  5958. preferenceHTMLStr += '<option value="MIN_RAGE_3">3 Bars &ge; Min Rage to Hunt MBW</option>';
  5959. preferenceHTMLStr += '</select>';
  5960. preferenceHTMLStr += '<select id="selectWWRiftMBWBar4548" style="width: 75px; display:none" onchange="initControlsWWRift();">';
  5961. preferenceHTMLStr += '<option value="25_0">0 Bar &ge; 25 Rage</option>';
  5962. preferenceHTMLStr += '<option value="25_1">1 Bar &ge; 25 Rage</option>';
  5963. preferenceHTMLStr += '<option value="25_2">2 Bars &ge; 25 Rage</option>';
  5964. preferenceHTMLStr += '<option value="44_0">3 Bars &ge; 25 Rage / 0 Bar &ge; 44 Rage</option>';
  5965. preferenceHTMLStr += '<option value="44_1">1 Bar &ge; 44 Rage</option>';
  5966. preferenceHTMLStr += '<option value="44_2">2 Bars &ge; 44 Rage</option>';
  5967. preferenceHTMLStr += '<option value="44_3">3 Bars &ge; 44 Rage / 0 Bar &ge; Min Rage to Hunt MBW</option>';
  5968. preferenceHTMLStr += '<option value="MIN_RAGE_1">1 Bar &ge; Min Rage to Hunt MBW</option>';
  5969. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  5970. preferenceHTMLStr += '</td>';
  5971. preferenceHTMLStr += '<td style="height:24px">';
  5972. preferenceHTMLStr += '<select id="selectWWRiftMBWTrapWeapon" onchange="saveWWRift();">';
  5973. preferenceHTMLStr += '<option value="Chrome Celestial Dissonance">Chrome CD</option>';
  5974. preferenceHTMLStr += '<option value="Celestial Dissonance">Cel Dis</option>';
  5975. preferenceHTMLStr += '<option value="Timesplit Dissonance">TDW</option>';
  5976. preferenceHTMLStr += '<option value="Mysteriously unYielding">MYNORCA</option>';
  5977. preferenceHTMLStr += '<option value="Focused Crystal Laser">FCL</option>';
  5978. preferenceHTMLStr += '<option value="Multi-Crystal Laser">MCL</option>';
  5979. preferenceHTMLStr += '<option value="Biomolecular Re-atomizer">BRT</option>';
  5980. preferenceHTMLStr += '<option value="Crystal Tower">CT</option>';
  5981. preferenceHTMLStr += '</select>';
  5982. preferenceHTMLStr += '<select id="selectWWRiftMBWTrapBase" style="width: 75px" onchange="saveWWRift();">';
  5983. preferenceHTMLStr += '</select>';
  5984. preferenceHTMLStr += '<select id="selectWWRiftMBWTrapTrinket" style="width: 75px" onchange="saveWWRift();">';
  5985. preferenceHTMLStr += '<option value="None">None</option>';
  5986. preferenceHTMLStr += '<option value="FSCLR">Faction Specific Charm (Lowest Rage)</option>';
  5987. preferenceHTMLStr += '</select>';
  5988. preferenceHTMLStr += '<select id="selectWWRiftMBWTrapBait" onchange="saveWWRift();">';
  5989. preferenceHTMLStr += '<option value="None">None</option>';
  5990. preferenceHTMLStr += '<option value="Lactrodectus Lancashire">LLC</option>';
  5991. preferenceHTMLStr += '<option value="Magical String">Magical</option>';
  5992. preferenceHTMLStr += '<option value="Brie String">Brie</option>';
  5993. preferenceHTMLStr += '<option value="Swiss String">Swiss</option>';
  5994. preferenceHTMLStr += '<option value="Marble String">Marble</option>';
  5995. preferenceHTMLStr += '</select>';
  5996. preferenceHTMLStr += '</td>';
  5997. preferenceHTMLStr += '</tr>';
  5998.  
  5999. preferenceHTMLStr += '<tr id="trFREnterBattery" style="display:none;">';
  6000. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select which battery level to enter Pagoda"><b>Enter at Battery</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6001. preferenceHTMLStr += '<td style="height:24px">';
  6002. preferenceHTMLStr += '<select id="selectEnterAtBattery" onchange="saveFR();">';
  6003. preferenceHTMLStr += '<option value="None">None</option>';
  6004. for(i=1;i<=10;i++)
  6005. preferenceHTMLStr += '<option value="' + i + '">' + i + '</option>';
  6006. preferenceHTMLStr += '</select>';
  6007. preferenceHTMLStr += '</td>';
  6008. preferenceHTMLStr += '</tr>';
  6009.  
  6010. preferenceHTMLStr += '<tr id="trFRRetreatBattery" style="display:none;">';
  6011. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select which battery level to retreat from Pagoda"><b>Retreat at Battery</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6012. preferenceHTMLStr += '<td style="height:24px">';
  6013. preferenceHTMLStr += '<select id="selectRetreatAtBattery" onchange="saveFR();">';
  6014. for(i=0;i<=10;i++)
  6015. preferenceHTMLStr += '<option value="' + i + '">' + i + '</option>';
  6016. preferenceHTMLStr += '</select>';
  6017. preferenceHTMLStr += '</td>';
  6018. preferenceHTMLStr += '</tr>';
  6019.  
  6020. preferenceHTMLStr += '<tr id="trFRTrapSetupAtBattery" style="display:none;">';
  6021. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup for each battery"><b>Trap Setup at Battery</b></a>&nbsp;&nbsp;';
  6022. preferenceHTMLStr += '<select id="selectTrapSetupAtBattery" onchange="initControlsFR();">';
  6023. for(i=0;i<=10;i++)
  6024. preferenceHTMLStr += '<option value="' + i + '">' + i + '</option>';
  6025. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6026. preferenceHTMLStr += '</td>';
  6027. preferenceHTMLStr += '<td style="height:24px">';
  6028. preferenceHTMLStr += '<select id="selectFRTrapWeapon" onchange="saveFR();">';
  6029. preferenceHTMLStr += '<option value="Chrome Celestial Dissonance">Chrome CD</option>';
  6030. preferenceHTMLStr += '<option value="Celestial Dissonance">Cel Dis</option>';
  6031. preferenceHTMLStr += '<option value="Timesplit Dissonance">TDW</option>';
  6032. preferenceHTMLStr += '<option value="Mysteriously unYielding">MYNORCA</option>';
  6033. preferenceHTMLStr += '<option value="Focused Crystal Laser">FCL</option>';
  6034. preferenceHTMLStr += '<option value="Multi-Crystal Laser">MCL</option>';
  6035. preferenceHTMLStr += '<option value="Biomolecular Re-atomizer">BRT</option>';
  6036. preferenceHTMLStr += '<option value="Crystal Tower">CT</option>';
  6037. preferenceHTMLStr += '</select>';
  6038. preferenceHTMLStr += '<select id="selectFRTrapBase" onchange="saveFR();">';
  6039. preferenceHTMLStr += '<option value="Clockwork Base">Clockwork</option>';
  6040. preferenceHTMLStr += '<option value="Fissure Base">Fissure</option>';
  6041. preferenceHTMLStr += '<option value="Rift Base">Rift</option>';
  6042. preferenceHTMLStr += '<option value="Fracture Base">Fracture</option>';
  6043. preferenceHTMLStr += '<option value="Enerchi Induction Base">Enerchi</option>';
  6044. preferenceHTMLStr += '<option value="Attuned Enerchi Induction Base">A. Enerchi</option>';
  6045. preferenceHTMLStr += '<option value="Minotaur Base">Minotaur</option>';
  6046. preferenceHTMLStr += '</select>';
  6047. preferenceHTMLStr += '<select id="selectFRTrapTrinket" style="width: 75px" onchange="saveFR();">';
  6048. preferenceHTMLStr += '<option value="None">None</option>';
  6049. preferenceHTMLStr += '</select>';
  6050. preferenceHTMLStr += '<select id="selectFRTrapBait" style="width: 75px" onchange="onSelectFRTrapBait();">';
  6051. preferenceHTMLStr += '<option value="None">None</option>';
  6052. preferenceHTMLStr += '<option value="Ascended">Ascended</option>';
  6053. preferenceHTMLStr += '<option value="Null Onyx Gorgonzola">Null Onyx Gorgonzola</option>';
  6054. preferenceHTMLStr += '<option value="Rift Rumble">Rift Rumble</option>';
  6055. preferenceHTMLStr += '<option value="Rift Glutter">Rift Glutter</option>';
  6056. preferenceHTMLStr += '<option value="Rift Susheese">Rift Susheese</option>';
  6057. preferenceHTMLStr += '<option value="Rift Combat">Rift Combat</option>';
  6058. preferenceHTMLStr += '<option value="ANY_MASTER">Glutter/Combat/Susheese</option>';
  6059. preferenceHTMLStr += '<option value="BALANCE_MASTER">Balance Heirloom</option>';
  6060. preferenceHTMLStr += '<option value="ORDER_MASTER">Master Cheese in Order</option>';
  6061. preferenceHTMLStr += '<option value="Master Fusion">Master Fusion</option>';
  6062. preferenceHTMLStr += '<option value="Maki String">Maki</option>';
  6063. preferenceHTMLStr += '<option value="Magical String">Magical</option>';
  6064. preferenceHTMLStr += '<option value="Brie String">Brie</option>';
  6065. preferenceHTMLStr += '<option value="Swiss String">Swiss</option>';
  6066. preferenceHTMLStr += '<option value="Marble String">Marble</option>';
  6067. preferenceHTMLStr += '</select>';
  6068. preferenceHTMLStr += '<select id="selectFRTrapBaitMasterOrder" style="width: 75px;display:none" onchange="saveFR();">';
  6069. preferenceHTMLStr += '<option value="Glutter=>Combat=>Susheese">Glutter=>Combat=>Susheese</option>';
  6070. preferenceHTMLStr += '<option value="Glutter=>Susheese=>Combat">Glutter=>Susheese=>Combat</option>';
  6071. preferenceHTMLStr += '<option value="Combat=>Glutter=>Susheese">Combat=>Glutter=>Susheese</option>';
  6072. preferenceHTMLStr += '<option value="Combat=>Susheese=>Glutter">Combat=>Susheese=>Glutter</option>';
  6073. preferenceHTMLStr += '<option value="Susheese=>Glutter=>Combat">Susheese=>Glutter=>Combat</option>';
  6074. preferenceHTMLStr += '<option value="Susheese=>Combat=>Glutter">Susheese=>Combat=>Glutter</option>';
  6075. preferenceHTMLStr += '</select>';
  6076. preferenceHTMLStr += '</td>';
  6077. preferenceHTMLStr += '</tr>';
  6078.  
  6079. preferenceHTMLStr += '<tr id="trIceberg" style="display:none;">';
  6080. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select to trap setup based on current phase"><b>Trap Setup for</b></a>';
  6081. preferenceHTMLStr += '<select id="selectIcebergPhase" style="width: 75px" onchange="initControlsIceberg();">';
  6082. preferenceHTMLStr += '<option value="GENERAL">Iceberg General</option>';
  6083. preferenceHTMLStr += '<option value="TREACHEROUS">Treacherous Tunnels</option>';
  6084. preferenceHTMLStr += '<option value="BRUTAL">Brutal Bulwark</option>';
  6085. preferenceHTMLStr += '<option value="BOMBING">Bombing Run</option>';
  6086. preferenceHTMLStr += '<option value="MAD">Mad Depths</option>';
  6087. preferenceHTMLStr += '<option value="ICEWING">Icewing\'s Lair</option>';
  6088. preferenceHTMLStr += '<option value="HIDDEN">Hidden Depths</option>';
  6089. preferenceHTMLStr += '<option value="DEEP">The Deep Lair</option>';
  6090. preferenceHTMLStr += '<option value="SLUSHY">Slushy Shoreline</option>';
  6091. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6092. preferenceHTMLStr += '</td>';
  6093. preferenceHTMLStr += '<td style="height:24px">';
  6094. preferenceHTMLStr += '<select id="selectIcebergBase" style="width: 75px" onchange="saveIceberg();">';
  6095. preferenceHTMLStr += '</select>';
  6096. preferenceHTMLStr += '<select id="selectIcebergTrinket" style="width: 75px" onchange="saveIceberg();">';
  6097. preferenceHTMLStr += '<option value="None">None</option>';
  6098. preferenceHTMLStr += '</select>';
  6099. preferenceHTMLStr += '<select id="selectIcebergBait" style="width: 75px" onchange="saveIceberg();">';
  6100. preferenceHTMLStr += '<option value="None">None</option>';
  6101. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6102. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6103. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6104. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6105. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6106. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6107. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6108. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6109. preferenceHTMLStr += '</select>';
  6110. preferenceHTMLStr += '</td>';
  6111. preferenceHTMLStr += '</tr>';
  6112.  
  6113. preferenceHTMLStr += '<tr id="trZTFocus" style="display:none;">';
  6114. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select to chesspiece side to focus"><b>Side to Focus</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6115. preferenceHTMLStr += '<td style="height:24px">';
  6116. preferenceHTMLStr += '<select id="selectZTFocus" onchange="saveZT();">';
  6117. preferenceHTMLStr += '<option value="MYSTIC">Mystic Only</option>';
  6118. preferenceHTMLStr += '<option value="TECHNIC">Technic Only</option>';
  6119. preferenceHTMLStr += '<option value="MYSTIC=>TECHNIC">Mystic First Technic Second</option>';
  6120. preferenceHTMLStr += '<option value="TECHNIC=>MYSTIC">Technic First Mystic Second</option>';
  6121. preferenceHTMLStr += '</select>';
  6122. preferenceHTMLStr += '</td>';
  6123. preferenceHTMLStr += '</tr>';
  6124. preferenceHTMLStr += '<tr id="trZTTrapSetup1st" style="display:none;">';
  6125. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup based on first focus-side chesspiece order"><b>First Side Trap Setup for </b></a>';
  6126. preferenceHTMLStr += '<select id="selectZTMouseOrder1st" onchange="initControlsZT();">';
  6127. preferenceHTMLStr += '<option value="PAWN">Pawn</option>';
  6128. preferenceHTMLStr += '<option value="KNIGHT">Knight</option>';
  6129. preferenceHTMLStr += '<option value="BISHOP">Bishop</option>';
  6130. preferenceHTMLStr += '<option value="ROOK">Rook</option>';
  6131. preferenceHTMLStr += '<option value="QUEEN">Queen</option>';
  6132. preferenceHTMLStr += '<option value="KING">King</option>';
  6133. preferenceHTMLStr += '<option value="CHESSMASTER">Chessmaster</option>';
  6134. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6135. preferenceHTMLStr += '</td>';
  6136. preferenceHTMLStr += '<td style="height:24px">';
  6137. preferenceHTMLStr += '<select id="selectZTWeapon1st" style="width: 75px" onchange="saveZT();">';
  6138. preferenceHTMLStr += '<option value="MPP/TPP">Focused-Side Pawn Pincher</option>';
  6139. preferenceHTMLStr += '<option value="BPT/OAT">Focused-Side Trap BPT/OAT</option>';
  6140. preferenceHTMLStr += '</select>';
  6141. preferenceHTMLStr += '<select id="selectZTBase1st" style="width: 75px" onchange="saveZT();">';
  6142. preferenceHTMLStr += '</select>';
  6143. preferenceHTMLStr += '<select id="selectZTTrinket1st" style="width: 75px" onchange="saveZT();">';
  6144. preferenceHTMLStr += '<option value="None">None</option>';
  6145. preferenceHTMLStr += '</select>';
  6146. preferenceHTMLStr += '<select id="selectZTBait1st" style="width: 75px" onchange="saveZT();">';
  6147. preferenceHTMLStr += '<option value="None">None</option>';
  6148. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6149. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6150. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6151. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6152. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6153. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6154. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6155. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6156. preferenceHTMLStr += '<option value="Checkmate">Checkmate</option>';
  6157. preferenceHTMLStr += '</select>';
  6158. preferenceHTMLStr += '</td>';
  6159. preferenceHTMLStr += '</tr>';
  6160. preferenceHTMLStr += '<tr id="trZTTrapSetup2nd" style="display:none;">';
  6161. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup based on second focus-side chesspiece order"><b>Second Side Trap Setup for </b></a>';
  6162. preferenceHTMLStr += '<select id="selectZTMouseOrder2nd" onchange="initControlsZT();">';
  6163. preferenceHTMLStr += '<option value="PAWN">Pawn</option>';
  6164. preferenceHTMLStr += '<option value="KNIGHT">Knight</option>';
  6165. preferenceHTMLStr += '<option value="BISHOP">Bishop</option>';
  6166. preferenceHTMLStr += '<option value="ROOK">Rook</option>';
  6167. preferenceHTMLStr += '<option value="QUEEN">Queen</option>';
  6168. preferenceHTMLStr += '<option value="KING">King</option>';
  6169. preferenceHTMLStr += '<option value="CHESSMASTER">Chessmaster</option>';
  6170. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6171. preferenceHTMLStr += '</td>';
  6172. preferenceHTMLStr += '<td style="height:24px">';
  6173. preferenceHTMLStr += '<select id="selectZTWeapon2nd" style="width: 75px" onchange="saveZT();">';
  6174. preferenceHTMLStr += '<option value="MPP/TPP">Focused-Side Pawn Pincher</option>';
  6175. preferenceHTMLStr += '<option value="BPT/OAT">Focused-Side Trap BPT/OAT</option>';
  6176. preferenceHTMLStr += '</select>';
  6177. preferenceHTMLStr += '<select id="selectZTBase2nd" style="width: 75px" onchange="saveZT();">';
  6178. preferenceHTMLStr += '</select>';
  6179. preferenceHTMLStr += '<select id="selectZTTrinket2nd" style="width: 75px" onchange="saveZT();">';
  6180. preferenceHTMLStr += '<option value="None">None</option>';
  6181. preferenceHTMLStr += '</select>';
  6182. preferenceHTMLStr += '<select id="selectZTBait2nd" style="width: 75px" onchange="saveZT();">';
  6183. preferenceHTMLStr += '<option value="None">None</option>';
  6184. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6185. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6186. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6187. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6188. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6189. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6190. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6191. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6192. preferenceHTMLStr += '<option value="Checkmate">Checkmate</option>';
  6193. preferenceHTMLStr += '</select>';
  6194. preferenceHTMLStr += '</td>';
  6195. preferenceHTMLStr += '</tr>';
  6196.  
  6197. preferenceHTMLStr += '<tr id="trSGTrapSetup" style="display:none;">';
  6198. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select to trap setup based on certain season"><b>Trap Setup For </b></a>';
  6199. preferenceHTMLStr += '<select id="selectSGSeason" onchange="initControlsSG();">';
  6200. preferenceHTMLStr += '<option value="SPRING">Spring</option>';
  6201. preferenceHTMLStr += '<option value="SUMMER">Summer</option>';
  6202. preferenceHTMLStr += '<option value="FALL">Fall</option>';
  6203. preferenceHTMLStr += '<option value="WINTER">Winter</option>';
  6204. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6205. preferenceHTMLStr += '</td>';
  6206. preferenceHTMLStr += '<td style="height:24px">';
  6207. preferenceHTMLStr += '<select id="selectSGTrapWeapon" style="width: 75px" onchange="saveSG();">';
  6208. preferenceHTMLStr += '</select>';
  6209. preferenceHTMLStr += '<select id="selectSGTrapBase" style="width: 75px" onchange="saveSG();">';
  6210. preferenceHTMLStr += '</select>';
  6211. preferenceHTMLStr += '<select id="selectSGTrapTrinket" style="width: 75px" onchange="saveSG();">';
  6212. preferenceHTMLStr += '<option value="None">None</option>';
  6213. preferenceHTMLStr += '</select>';
  6214. preferenceHTMLStr += '<select id="selectSGTrapBait" style="width: 75px" onchange="saveSG();">';
  6215. preferenceHTMLStr += '<option value="None">None</option>';
  6216. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6217. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6218. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6219. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6220. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6221. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6222. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6223. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6224. preferenceHTMLStr += '</select>';
  6225. preferenceHTMLStr += '</td>';
  6226. preferenceHTMLStr += '</tr>';
  6227.  
  6228. preferenceHTMLStr += '<tr id="trSGDisarmBait" style="display:none;">';
  6229. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select to disarm bait when amplifier is fully charged"><b>Disarm Bait</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6230. preferenceHTMLStr += '<td style="height:24px">';
  6231. preferenceHTMLStr += '<select id="selectSGDisarmBait" onchange="saveSG();">';
  6232. preferenceHTMLStr += '<option value="false">False</option>';
  6233. preferenceHTMLStr += '<option value="true">True</option>';
  6234. preferenceHTMLStr += '</select>&nbsp;&nbsp;After Amplifier Fully Charged';
  6235. preferenceHTMLStr += '</td>';
  6236. preferenceHTMLStr += '</tr>';
  6237.  
  6238. preferenceHTMLStr += '<tr id="trLGTGAutoFill" style="display:none;">';
  6239. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Auto Fill in </b></a>';
  6240. preferenceHTMLStr += '<select id="selectLGTGAutoFillSide" onchange="initControlsLG();">';
  6241. preferenceHTMLStr += '<option value="LG">Living Garden</option>';
  6242. preferenceHTMLStr += '<option value="TG">Twisted Garden</option>';
  6243. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6244. preferenceHTMLStr += '</td>';
  6245. preferenceHTMLStr += '<td style="height:24px">';
  6246. preferenceHTMLStr += '<select id="selectLGTGAutoFillState" onchange="saveLG();">';
  6247. preferenceHTMLStr += '<option value="false">False</option>';
  6248. preferenceHTMLStr += '<option value="true">True</option>';
  6249. preferenceHTMLStr += '</select>';
  6250. preferenceHTMLStr += '</td>';
  6251. preferenceHTMLStr += '</tr>';
  6252. preferenceHTMLStr += '<tr id="trLGTGAutoPour" style="display:none;">';
  6253. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Auto Pour in </b></a>';
  6254. preferenceHTMLStr += '<select id="selectLGTGAutoPourSide" onchange="initControlsLG();">';
  6255. preferenceHTMLStr += '<option value="LG">Living Garden</option>';
  6256. preferenceHTMLStr += '<option value="TG">Twisted Garden</option>';
  6257. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6258. preferenceHTMLStr += '</td>';
  6259. preferenceHTMLStr += '<td style="height:24px">';
  6260. preferenceHTMLStr += '<select id="selectLGTGAutoPourState" onchange="saveLG();">';
  6261. preferenceHTMLStr += '<option value="false">False</option>';
  6262. preferenceHTMLStr += '<option value="true">True</option>';
  6263. preferenceHTMLStr += '</select>';
  6264. preferenceHTMLStr += '</td>';
  6265. preferenceHTMLStr += '</tr>';
  6266. preferenceHTMLStr += '<tr id="trPourTrapSetup" style="display:none;">';
  6267. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>After Poured in </b></a>';
  6268. preferenceHTMLStr += '<select id="selectLGTGSide" onchange="initControlsLG();">';
  6269. preferenceHTMLStr += '<option value="LG">Living Garden</option>';
  6270. preferenceHTMLStr += '<option value="TG">Twisted Garden</option>';
  6271. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6272. preferenceHTMLStr += '</td>';
  6273. preferenceHTMLStr += '<td style="height:24px">';
  6274. preferenceHTMLStr += '<select id="selectLGTGBase" style="width: 75px" onchange="saveLG();">';
  6275. preferenceHTMLStr += '</select>';
  6276. preferenceHTMLStr += '<select id="selectLGTGTrinket" style="width: 75px" onchange="saveLG();">';
  6277. preferenceHTMLStr += '<option value="None">None</option>';
  6278. preferenceHTMLStr += '</select>';
  6279. preferenceHTMLStr += '<select id="selectLGTGBait" style="width: 75px" onchange="saveLG();">';
  6280. preferenceHTMLStr += '<option value="None">None</option>';
  6281. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6282. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6283. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6284. preferenceHTMLStr += '<option value="Duskshade Camembert">Duskshade Camembert</option>';
  6285. preferenceHTMLStr += '<option value="Lunaria Camembert">Lunaria Camembert</option>';
  6286. preferenceHTMLStr += '</select>';
  6287. preferenceHTMLStr += '</td>';
  6288. preferenceHTMLStr += '</tr>';
  6289. preferenceHTMLStr += '<tr id="trCurseLiftedTrapSetup" style="display:none;">';
  6290. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>After Curse Lifted in </b></a>';
  6291. preferenceHTMLStr += '<select id="selectLCCCSide" onchange="initControlsLG();">';
  6292. preferenceHTMLStr += '<option value="LC">Lost City</option>';
  6293. preferenceHTMLStr += '<option value="CC">Cursed City</option>';
  6294. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6295. preferenceHTMLStr += '</td>';
  6296. preferenceHTMLStr += '<td style="height:24px">';
  6297. preferenceHTMLStr += '<select id="selectLCCCBase" style="width: 75px" onchange="saveLG();">';
  6298. preferenceHTMLStr += '</select>';
  6299. preferenceHTMLStr += '<select id="selectLCCCTrinket" style="width: 75px" onchange="saveLG();">';
  6300. preferenceHTMLStr += '<option value="None">None</option>';
  6301. preferenceHTMLStr += '</select>';
  6302. preferenceHTMLStr += '</td>';
  6303. preferenceHTMLStr += '</tr>';
  6304. preferenceHTMLStr += '<tr id="trSaltedTrapSetup" style="display:none;">';
  6305. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Trap Setup </b></a>';
  6306. preferenceHTMLStr += '<select id="selectSaltedStatus" onchange="initControlsLG();">';
  6307. preferenceHTMLStr += '<option value="before">During</option>';
  6308. preferenceHTMLStr += '<option value="after">After</option>';
  6309. preferenceHTMLStr += '</select><a><b> Salt Charging</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6310. preferenceHTMLStr += '</td>';
  6311. preferenceHTMLStr += '<td style="height:24px">';
  6312. preferenceHTMLStr += '<select id="selectSCBase" style="width: 75px" onchange="saveLG();">';
  6313. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a title="Max number of salt before hunting King Grub"><b>Salt Charge : </b></a>';
  6314. preferenceHTMLStr += '<input type="number" id="inputKGSalt" min="1" max="50" size="5" value="25" onchange="saveLG();">';
  6315. preferenceHTMLStr += '</td>';
  6316. preferenceHTMLStr += '</tr>';
  6317.  
  6318. preferenceHTMLStr += '<tr id="trGWHTrapSetup" style="display:none;">';
  6319. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup based on anchor/boost status"><b>Trap Setup When </b></a>';
  6320. preferenceHTMLStr += '<select id="selectGWHZone" style="width: 75px" onchange="initControlsGWH2016();">';
  6321. preferenceHTMLStr += '<option value="ORDER1">Simple Zone With Order</option>';
  6322. preferenceHTMLStr += '<option value="ORDER2">Deluxe Zone With Order</option>';
  6323. preferenceHTMLStr += '<option value="NONORDER1">Simple Zone W/O Order</option>';
  6324. preferenceHTMLStr += '<option value="NONORDER2">Deluxe Zone W/O Order</option>';
  6325. preferenceHTMLStr += '<option value="WINTER_WASTELAND">Winter Wasteland</option>';
  6326. preferenceHTMLStr += '<option value="SNOWBALL_STORM">Snowball Storm</option>';
  6327. preferenceHTMLStr += '<option value="FLYING">Flying</option>';
  6328. preferenceHTMLStr += '<option value="NEW_YEAR\'S_PARTY">New Year\'s Party</option>';
  6329. preferenceHTMLStr += '</select>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6330. preferenceHTMLStr += '</td>';
  6331. preferenceHTMLStr += '<td style="height:24px">';
  6332. preferenceHTMLStr += '<select id="selectGWHWeapon" style="width: 75px" onchange="saveGWH2016();">';
  6333. preferenceHTMLStr += '</select>';
  6334. preferenceHTMLStr += '<select id="selectGWHBase" style="width: 75px" onchange="saveGWH2016();">';
  6335. preferenceHTMLStr += '</select>';
  6336. preferenceHTMLStr += '<select id="selectGWHTrinket" style="width: 75px;" onchange="onSelectGWHTrinketChanged();">';
  6337. preferenceHTMLStr += '<option value="None">None</option>';
  6338. preferenceHTMLStr += '<option value="ANCHOR_FAC/EAC">FAC/EAC</option>';
  6339. preferenceHTMLStr += '</select>';
  6340. preferenceHTMLStr += '<select id="selectGWHBait" style="width: 75px" onchange="saveGWH2016();">';
  6341. preferenceHTMLStr += '<option value="None">None</option>';
  6342. preferenceHTMLStr += '<option value="ANY_FESTIVE_BRIE">AA/Festive Cheese/Brie</option>';
  6343. preferenceHTMLStr += '<option value="ANY_FESTIVE_GOUDA">AA/Festive Cheese/Gouda</option>';
  6344. preferenceHTMLStr += '<option value="ANY_FESTIVE_SB">AA/Festive Cheese/SUPER|brie+</option>';
  6345. preferenceHTMLStr += '</select>';
  6346. preferenceHTMLStr += '<select id="selectGWHBoost" style="width: 75px" onchange="saveGWH2016();">';
  6347. preferenceHTMLStr += '<option value="false">Not Boost</option>';
  6348. preferenceHTMLStr += '<option value="true">Boost</option>';
  6349. preferenceHTMLStr += '</select>';
  6350. preferenceHTMLStr += '</td>';
  6351. preferenceHTMLStr += '</tr>';
  6352. preferenceHTMLStr += '<tr id="trGWHTurboBoost" style="display:none;">';
  6353. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select to always Turbo boost (500m)"><b>Always Turbo Boost</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6354. preferenceHTMLStr += '<td style="height:24px">';
  6355. preferenceHTMLStr += '<select id="selectGWHUseTurboBoost" onchange="saveGWH2016();">';
  6356. preferenceHTMLStr += '<option value="false">False</option>';
  6357. preferenceHTMLStr += '<option value="true">True</option>';
  6358. preferenceHTMLStr += '</select>';
  6359. preferenceHTMLStr += '</td>';
  6360. preferenceHTMLStr += '</tr>';
  6361. preferenceHTMLStr += '<tr id="trGWHFlying" style="display:none;">';
  6362. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select minimum AA to take flight"><b>Min AA to Fly (&ge;)</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6363. preferenceHTMLStr += '<td style="height:24px">';
  6364. preferenceHTMLStr += '<input type="number" id="inputMinAA" min="0" max="9007199254740991" style="width:50px" value="20" onchange="onInputMinAAChanged(this);">';
  6365. preferenceHTMLStr += '</td>';
  6366. preferenceHTMLStr += '</tr>';
  6367. preferenceHTMLStr += '<tr id="trGWHFlyingFirework" style="display:none;">';
  6368. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select minimum firework to take flight"><b>Min Firework to Fly (&ge;)</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6369. preferenceHTMLStr += '<td style="height:24px">';
  6370. preferenceHTMLStr += '<input type="number" id="inputMinFirework" min="0" max="9007199254740991" style="width:50px" value="20" onchange="onInputMinWorkChanged(this);">';
  6371. preferenceHTMLStr += '</td>';
  6372. preferenceHTMLStr += '</tr>';
  6373. preferenceHTMLStr += '<tr id="trGWHFlyingLand" style="display:none;">';
  6374. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select whether land after firework run out"><b>Land after Firework Run Out</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6375. preferenceHTMLStr += '<td style="height:24px">';
  6376. preferenceHTMLStr += '<select id="selectGWHLandAfterRunOutFirework" onchange="saveGWH2016();">';
  6377. preferenceHTMLStr += '<option value="false">False</option>';
  6378. preferenceHTMLStr += '<option value="true">True</option>';
  6379. preferenceHTMLStr += '</select>';
  6380. preferenceHTMLStr += '</td>';
  6381. preferenceHTMLStr += '</tr>';
  6382.  
  6383. preferenceHTMLStr += '<tr id="trSCCustom" style="display:none;">';
  6384. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6385. preferenceHTMLStr += '<a title="Select custom algorithm"><b>SC Custom Algorithm</b></a>';
  6386. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6387. preferenceHTMLStr += '</td>';
  6388. preferenceHTMLStr += '<td style="height:24px">';
  6389. preferenceHTMLStr += '<select id="selectSCHuntZone" style="width:75px" onChange="initControlsSCCustom();">';
  6390. preferenceHTMLStr += '<option value="ZONE_NOT_DIVE">Surface</option>';
  6391. preferenceHTMLStr += '<option value="ZONE_DEFAULT">Default</option>';
  6392. preferenceHTMLStr += '<option value="ZONE_CORAL">Coral</option>';
  6393. preferenceHTMLStr += '<option value="ZONE_SCALE">Scale</option>';
  6394. preferenceHTMLStr += '<option value="ZONE_BARNACLE">Barnacle</option>';
  6395. preferenceHTMLStr += '<option value="ZONE_TREASURE">Treasure</option>';
  6396. preferenceHTMLStr += '<option value="ZONE_DANGER">Danger</option>';
  6397. preferenceHTMLStr += '<option value="ZONE_DANGER_PP">Danger PP MT</option>';
  6398. preferenceHTMLStr += '<option value="ZONE_DANGER_PP_LOTA">Danger PP LOTA</option>';
  6399. preferenceHTMLStr += '<option value="ZONE_OXYGEN">Oxygen</option>';
  6400. preferenceHTMLStr += '<option value="ZONE_BONUS">Bonus</option>';
  6401. preferenceHTMLStr += '</select>';
  6402. preferenceHTMLStr += '<select id="selectSCHuntZoneEnable" style="width:75px;display:none" onChange="saveSCCustomAlgo();">';
  6403. preferenceHTMLStr += '<option value="true">Hunt</option>';
  6404. preferenceHTMLStr += '<option value="false">Jet Through</option>';
  6405. preferenceHTMLStr += '</select>';
  6406. preferenceHTMLStr += '<select id="selectSCHuntBait" style="width: 75px" onchange="saveSCCustomAlgo();">';
  6407. preferenceHTMLStr += '<option value="None">None</option>';
  6408. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6409. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6410. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6411. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6412. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6413. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6414. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6415. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6416. preferenceHTMLStr += '<option value="Fishy Fromage">Fishy Fromage</option>';
  6417. preferenceHTMLStr += '</select>';
  6418. preferenceHTMLStr += '<select id="selectSCHuntTrinket" style="width: 75px" onchange="saveSCCustomAlgo();">';
  6419. preferenceHTMLStr += '<option value="None">None</option>';
  6420. preferenceHTMLStr += '<option value="Empowered Anchor">EAC</option>';
  6421. preferenceHTMLStr += '<option value="GAC_EAC">GAC, EAC</option>';
  6422. preferenceHTMLStr += '<option value="SAC_EAC">SAC, EAC</option>';
  6423. preferenceHTMLStr += '<option value="UAC_EAC">UAC, EAC</option>';
  6424. preferenceHTMLStr += '</select>';
  6425. preferenceHTMLStr += '</td>';
  6426. preferenceHTMLStr += '</tr>';
  6427.  
  6428. preferenceHTMLStr += '<tr id="trSCCustomUseSmartJet" style="display:none;">';
  6429. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select to always use Smart Water Jet Charm"><b>Use Smart Jet</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6430. preferenceHTMLStr += '<td style="height:24px">';
  6431. preferenceHTMLStr += '<select id="selectSCUseSmartJet" onchange="saveSCCustomAlgo();">';
  6432. preferenceHTMLStr += '<option value="false">False</option>';
  6433. preferenceHTMLStr += '<option value="true">True</option>';
  6434. preferenceHTMLStr += '</select>';
  6435. preferenceHTMLStr += '</td>';
  6436. preferenceHTMLStr += '</tr>';
  6437.  
  6438. preferenceHTMLStr += '<tr id="trLabyrinth" style="display:none;">';
  6439. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6440. preferenceHTMLStr += '<a title="Select a district to focus on"><b>District to Focus</b></a>';
  6441. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6442. preferenceHTMLStr += '</td>';
  6443. preferenceHTMLStr += '<td style="height:24px">';
  6444. preferenceHTMLStr += '<select id="selectLabyrinthDistrict" onChange="onSelectLabyrinthDistrict();">';
  6445. preferenceHTMLStr += '<option value="None">None</option>';
  6446. preferenceHTMLStr += '<option value="FEALTY">Fealty</option>';
  6447. preferenceHTMLStr += '<option value="TECH">Tech</option>';
  6448. preferenceHTMLStr += '<option value="SCHOLAR">Scholar</option>';
  6449. preferenceHTMLStr += '<option value="TREASURY">Treasury</option>';
  6450. preferenceHTMLStr += '<option value="FARMING">Farming</option>';
  6451. preferenceHTMLStr += '</select>';
  6452. preferenceHTMLStr += '</td>';
  6453. preferenceHTMLStr += '</tr>';
  6454.  
  6455. preferenceHTMLStr += '<tr id="trLabyrinthDisarm" style="display:none;">';
  6456. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6457. preferenceHTMLStr += '<a title="Select to disarm cheese at X last hunt in hallway when total clues near 100"><b>Security Disarm</b></a>';
  6458. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6459. preferenceHTMLStr += '</td>';
  6460. preferenceHTMLStr += '<td style="height:24px">';
  6461. preferenceHTMLStr += '<select id="selectLabyrinthDisarm" onChange="onSelectLabyrinthDisarm();">';
  6462. preferenceHTMLStr += '<option value="false">False</option>';
  6463. preferenceHTMLStr += '<option value="true">True</option>';
  6464. preferenceHTMLStr += '</select>&nbsp;&nbsp;At Last&nbsp;';
  6465. preferenceHTMLStr += '<input type="number" id="inputLabyrinthLastHunt" min="2" max="10" style="width:40px" value="2" onchange="onInputLabyrinthLastHuntChanged(this);">&nbsp;Hunt(s) in Hallway Near 100 Total Clues';
  6466. preferenceHTMLStr += '</td>';
  6467. preferenceHTMLStr += '</tr>';
  6468.  
  6469. preferenceHTMLStr += '<tr id="trLabyrinthArmOtherBase" style="display:none;">';
  6470. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select to arm other base if Compass Magnet Charm is currently armed"><b>Arm Other Base</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6471. preferenceHTMLStr += '<td style="height:24px">';
  6472. preferenceHTMLStr += '<select id="selectLabyrinthOtherBase" style="width: 75px" onchange="saveLaby();">';
  6473. preferenceHTMLStr += '<option value="false">False</option>';
  6474. preferenceHTMLStr += '</select>&nbsp;&nbsp;If Compass Magnet Charm is armed';
  6475. preferenceHTMLStr += '</td>';
  6476. preferenceHTMLStr += '</tr>';
  6477.  
  6478. preferenceHTMLStr += '<tr id="trLabyrinthDisarmCompass" style="display:none;">';
  6479. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a><b>Disarm Compass Magnet</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6480. preferenceHTMLStr += '<td style="height:24px">';
  6481. preferenceHTMLStr += '<select id="selectLabyrinthDisarmCompass" onchange="onSelectLabyrinthDisarmCompass();">';
  6482. preferenceHTMLStr += '<option value="true">True</option>';
  6483. preferenceHTMLStr += '<option value="false">False</option>';
  6484. preferenceHTMLStr += '</select>&nbsp;&nbsp;If Dead End Clue &le; :&nbsp;';
  6485. preferenceHTMLStr += '<input type="number" id="inputLabyrinthDEC" min="0" max="20" style="width:40px" value="0" onchange="onInputLabyrinthDECChanged(this);">';
  6486. preferenceHTMLStr += '</td>';
  6487. preferenceHTMLStr += '</tr>';
  6488.  
  6489. preferenceHTMLStr += '<tr id="trPriorities15" style="display:none;">';
  6490. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6491. preferenceHTMLStr += '<a title="Select hallway priorities when focus-district clues less than 15"><b>Priorities (Focus-District Clues < 15)</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6492. preferenceHTMLStr += '</td>';
  6493. preferenceHTMLStr += '<td style="height:24px">';
  6494. preferenceHTMLStr += '<select id="selectHallway15Plain" onChange="saveLaby();">';
  6495. preferenceHTMLStr += '<option value="lp">Long Plain Hallway First</option>';
  6496. preferenceHTMLStr += '<option value="sp">Short Plain Hallway First</option>';
  6497. preferenceHTMLStr += '</select>';
  6498. preferenceHTMLStr += '</td>';
  6499. preferenceHTMLStr += '</tr>';
  6500.  
  6501. preferenceHTMLStr += '<tr id="trPriorities1560" style="display:table-row;">';
  6502. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6503. preferenceHTMLStr += '<a title="Select hallway priorities when focus-district clues within 15 and 60"><b>Priorities (15 < Focus-District Clues < 60)</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6504. preferenceHTMLStr += '<td style="height:24px">';
  6505. preferenceHTMLStr += '<select id="selectHallway1560Superior" onchange="saveLaby();">';
  6506. preferenceHTMLStr += '<option value="ls">Long Superior Hallway First</option>';
  6507. preferenceHTMLStr += '<option value="ss">Short Superior Hallway First</option>';
  6508. preferenceHTMLStr += '</select>';
  6509. preferenceHTMLStr += '<select id="selectHallway1560Plain" onchange="saveLaby();">';
  6510. preferenceHTMLStr += '<option value="lp">Long Plain Hallway First</option>';
  6511. preferenceHTMLStr += '<option value="sp">Short Plain Hallway First</option>';
  6512. preferenceHTMLStr += '</select>';
  6513. preferenceHTMLStr += '</td>';
  6514. preferenceHTMLStr += '</tr>';
  6515.  
  6516. preferenceHTMLStr += '<tr id="trPriorities60" style="display:none;">';
  6517. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6518. preferenceHTMLStr += '<a title="Select hallway priorities when focus-district clues more than 60"><b>Priorities (Focus-District Clues > 60)</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6519. preferenceHTMLStr += '<td style="height:24px">';
  6520. preferenceHTMLStr += '<select id="selectHallway60Epic" onchange="saveLaby();">';
  6521. preferenceHTMLStr += '<option value="le">Long Epic Hallway First</option>';
  6522. preferenceHTMLStr += '<option value="se">Short Epic Hallway First</option>';
  6523. preferenceHTMLStr += '</select>';
  6524. preferenceHTMLStr += '<select id="selectHallway60Superior" onchange="saveLaby();">';
  6525. preferenceHTMLStr += '<option value="ls">Long Superior Hallway First</option>';
  6526. preferenceHTMLStr += '<option value="ss">Short Superior Hallway First</option>';
  6527. preferenceHTMLStr += '</select>';
  6528. preferenceHTMLStr += '<select id="selectHallway60Plain" onchange="saveLaby();">';
  6529. preferenceHTMLStr += '<option value="lp">Long Plain Hallway First</option>';
  6530. preferenceHTMLStr += '<option value="sp">Short Plain Hallway First</option>';
  6531. preferenceHTMLStr += '</select>';
  6532. preferenceHTMLStr += '</td>';
  6533. preferenceHTMLStr += '</tr>';
  6534.  
  6535. preferenceHTMLStr += '<tr id="trLabyrinthOtherHallway" style="display:none;">';
  6536. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6537. preferenceHTMLStr += '<a title="Choose doors other than focused door when there is no available focused door to be choosen"><b>Open Non-Focus Door</b></a>';
  6538. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6539. preferenceHTMLStr += '</td>';
  6540. preferenceHTMLStr += '<td style="height:24px">';
  6541. preferenceHTMLStr += '<select id="chooseOtherDoors" onChange="\
  6542. saveLaby();\
  6543. document.getElementById(\'typeOtherDoors\').disabled = (value == \'false\') ? \'disabled\' : \'\'; ">';
  6544. preferenceHTMLStr += '<option value="false">False</option>';
  6545. preferenceHTMLStr += '<option value="true">True</option>';
  6546. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a title="Select a choosing type for non-focused doors"><b>Choosing Type:</b></a>&emsp;';
  6547. preferenceHTMLStr += '<select id="typeOtherDoors" onChange="saveLaby();">';
  6548. preferenceHTMLStr += '<option value="SHORTEST_ONLY">Shortest Length Only</option>';
  6549. preferenceHTMLStr += '<option value="FEWEST_ONLY">Fewest Clue Only</option>';
  6550. preferenceHTMLStr += '<option value="SHORTEST_FEWEST">Shortest Length => Fewest Clue</option>';
  6551. preferenceHTMLStr += '<option value="FEWEST_SHORTEST">Fewest Clue => Shortest Length </option>';
  6552. preferenceHTMLStr += '</select>';
  6553. preferenceHTMLStr += '</td>';
  6554. preferenceHTMLStr += '</tr>';
  6555.  
  6556. preferenceHTMLStr += '<tr id="trLabyrinthWeaponFarming" style="display:none;">';
  6557. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select weapon type in farming hallways"><b>Weapon Type in Farming</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6558. preferenceHTMLStr += '<td style="height:24px">';
  6559. preferenceHTMLStr += '<select id="selectLabyrinthWeaponType" onchange="saveLaby();">';
  6560. preferenceHTMLStr += '<option value="Forgotten">Forgotten</option>';
  6561. preferenceHTMLStr += '<option value="Arcane">Arcane</option>';
  6562. preferenceHTMLStr += '</select>';
  6563. preferenceHTMLStr += '</td>';
  6564. preferenceHTMLStr += '</tr>';
  6565.  
  6566. preferenceHTMLStr += '<tr id="trZokorTrapSetup" style="display:none;">';
  6567. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6568. preferenceHTMLStr += '<a title="Select trap setup under different boss status"><b>Trap Setup When</b></a>';
  6569. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6570. preferenceHTMLStr += '</td>';
  6571. preferenceHTMLStr += '<td style="height:24px">';
  6572. preferenceHTMLStr += '<select id="selectZokorBossStatus" onChange="initControlsZokor();">';
  6573. preferenceHTMLStr += '<option value="INCOMING">Boss Incoming</option>';
  6574. preferenceHTMLStr += '<option value="ACTIVE">Boss Active</option>';
  6575. preferenceHTMLStr += '<option value="DEFEATED">Boss Defeated</option>';
  6576. preferenceHTMLStr += '</select>&nbsp;&nbsp;';
  6577. preferenceHTMLStr += '<select id="selectZokorBait" style="width: 75px" onChange="saveZokor();">';
  6578. preferenceHTMLStr += '<option value="None">None</option>';
  6579. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6580. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6581. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6582. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6583. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6584. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6585. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6586. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6587. preferenceHTMLStr += '<option value="Glowing Gruyere">GG</option>';
  6588. preferenceHTMLStr += '</select>&nbsp;&nbsp;';
  6589. preferenceHTMLStr += '<select id="selectZokorTrinket" style="width: 75px" onChange="saveZokor();">';
  6590. preferenceHTMLStr += '<option value="None">None</option>';
  6591. preferenceHTMLStr += '</select>';
  6592. preferenceHTMLStr += '</td>';
  6593. preferenceHTMLStr += '</tr>';
  6594.  
  6595. preferenceHTMLStr += '<tr id="trFWWave" style="display:none;">';
  6596. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6597. preferenceHTMLStr += '<a title="Select FW wave"><b>Wave</b></a>';
  6598. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6599. preferenceHTMLStr += '</td>';
  6600. preferenceHTMLStr += '<td style="height:24px">';
  6601. preferenceHTMLStr += '<select id="selectFWWave" onChange="initControlsFW();">';
  6602. preferenceHTMLStr += '<option value="1">1</option>';
  6603. preferenceHTMLStr += '<option value="2">2</option>';
  6604. preferenceHTMLStr += '<option value="3">3</option>';
  6605. preferenceHTMLStr += '<option value="4">4</option>';
  6606. preferenceHTMLStr += '</select>';
  6607. preferenceHTMLStr += '</td>';
  6608. preferenceHTMLStr += '</tr>';
  6609.  
  6610. preferenceHTMLStr += '<tr id="trFWTrapSetup" style="display:none;">';
  6611. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup based on certain FW wave"><b>Physical Trap Setup</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6612. preferenceHTMLStr += '<td style="height:24px">';
  6613. preferenceHTMLStr += '<select id="selectFWTrapSetupWeapon" style="width: 75px" onchange="saveFW();">';
  6614. preferenceHTMLStr += '</select>';
  6615. preferenceHTMLStr += '<select id="selectFWTrapSetupBase" style="width: 75px" onchange="saveFW();">';
  6616. preferenceHTMLStr += '</select>';
  6617. preferenceHTMLStr += '</td>';
  6618. preferenceHTMLStr += '</tr>';
  6619.  
  6620. preferenceHTMLStr += '<tr id="trFW4TrapSetup" style="display:none;">';
  6621. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select trap setup based on warden status"><b>Trap Setup </b></a>';
  6622. preferenceHTMLStr += '<select id="selectFW4WardenStatus" onchange="initControlsFW();">';
  6623. preferenceHTMLStr += '<option value="before">Before</option>';
  6624. preferenceHTMLStr += '<option value="after">After</option>';
  6625. preferenceHTMLStr += '</select><a><b> Clear Warden</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;';
  6626. preferenceHTMLStr += '</td>';
  6627. preferenceHTMLStr += '<td style="height:24px">';
  6628. preferenceHTMLStr += '<select id="selectFW4TrapSetupWeapon" style="width: 75px" onchange="saveFW();">';
  6629. preferenceHTMLStr += '</select>';
  6630. preferenceHTMLStr += '<select id="selectFW4TrapSetupBase" style="width: 75px" onchange="saveFW();">';
  6631. preferenceHTMLStr += '</select>';
  6632. preferenceHTMLStr += '<select id="selectFW4TrapSetupTrinket" style="width: 75px" onchange="saveFW();">';
  6633. preferenceHTMLStr += '<option value="None">None</option>';
  6634. preferenceHTMLStr += '</select>';
  6635. preferenceHTMLStr += '<select id="selectFW4TrapSetupBait" style="width: 75px" onchange="saveFW();">';
  6636. preferenceHTMLStr += '<option value="None">None</option>';
  6637. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6638. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6639. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6640. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6641. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6642. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6643. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6644. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6645. preferenceHTMLStr += '</select>';
  6646. preferenceHTMLStr += '</td>';
  6647. preferenceHTMLStr += '</tr>';
  6648.  
  6649. preferenceHTMLStr += '<tr id="trFWFocusType" style="display:none;">';
  6650. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6651. preferenceHTMLStr += '<a title="Select either Normal (Warrior, Scout, Archer) or Special (Cavalry, Mage)"><b>Soldier Type to Focus</b></a>';
  6652. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6653. preferenceHTMLStr += '</td>';
  6654. preferenceHTMLStr += '<td style="height:24px">';
  6655. preferenceHTMLStr += '<select id="selectFWFocusType" onChange="saveFW();">';
  6656. preferenceHTMLStr += '<option value="NORMAL">Normal</option>';
  6657. preferenceHTMLStr += '<option value="SPECIAL">Special</option>';
  6658. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a title="Select which soldier type comes first based on population"><b>Priorities:</b></a>&emsp;';
  6659. preferenceHTMLStr += '<select id="selectFWPriorities" onChange="saveFW();">';
  6660. preferenceHTMLStr += '<option value="HIGHEST">Highest Population First</option>';
  6661. preferenceHTMLStr += '<option value="LOWEST">Lowest Population First</option>';
  6662. preferenceHTMLStr += '</select>';
  6663. preferenceHTMLStr += '</td>';
  6664. preferenceHTMLStr += '</tr>';
  6665.  
  6666. preferenceHTMLStr += '<tr id="trFWStreak" style="display:none;">';
  6667. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6668. preferenceHTMLStr += '<a title="Select streak"><b>Streak</b></a>';
  6669. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6670. preferenceHTMLStr += '</td>';
  6671. preferenceHTMLStr += '<td style="height:24px">';
  6672. preferenceHTMLStr += '<select id="selectFWStreak" onChange="initControlsFW();">';
  6673. preferenceHTMLStr += '<option value="0">0</option>';
  6674. preferenceHTMLStr += '<option value="1">1</option>';
  6675. preferenceHTMLStr += '<option value="2">2</option>';
  6676. preferenceHTMLStr += '<option value="3">3</option>';
  6677. preferenceHTMLStr += '<option value="4">4</option>';
  6678. preferenceHTMLStr += '<option value="5">5</option>';
  6679. preferenceHTMLStr += '<option value="6">6</option>';
  6680. preferenceHTMLStr += '<option value="7">7</option>';
  6681. preferenceHTMLStr += '<option value="8">8</option>';
  6682. preferenceHTMLStr += '<option value="9">9</option>';
  6683. preferenceHTMLStr += '<option value="10">10</option>';
  6684. preferenceHTMLStr += '<option value="11">11</option>';
  6685. preferenceHTMLStr += '<option value="12">12</option>';
  6686. preferenceHTMLStr += '<option value="13">13</option>';
  6687. preferenceHTMLStr += '<option value="14">14</option>';
  6688. preferenceHTMLStr += '<option value="15">15</option>';
  6689. preferenceHTMLStr += '</select>';
  6690. preferenceHTMLStr += '<select id="selectFWCheese" style="width: 75px" onChange="saveFW();">';
  6691. preferenceHTMLStr += '<option value="None">None</option>';
  6692. preferenceHTMLStr += '<option value="Brie Cheese">Brie</option>';
  6693. preferenceHTMLStr += '<option value="Toxic Brie">Toxic Brie</option>';
  6694. preferenceHTMLStr += '<option value="Gouda">Gouda</option>';
  6695. preferenceHTMLStr += '<option value="SUPER">SB+</option>';
  6696. preferenceHTMLStr += '<option value="Toxic SUPER">Toxic SB+</option>';
  6697. preferenceHTMLStr += '<option value="Ghoulgonzola">Ghoulgonzola</option>';
  6698. preferenceHTMLStr += '<option value="Candy Corn">Candy Corn</option>';
  6699. preferenceHTMLStr += '<option value="ANY_HALLOWEEN">Ghoulgonzola/Candy Corn</option>';
  6700. preferenceHTMLStr += '</select>';
  6701. preferenceHTMLStr += '<select id="selectFWCharmType" style="width: 75px" onChange="saveFW();">';
  6702. preferenceHTMLStr += '<option value="None">None</option>';
  6703. preferenceHTMLStr += '<option value="Warpath">Warpath</option>';
  6704. preferenceHTMLStr += '<option value="Super Warpath">Super Warpath</option>';
  6705. preferenceHTMLStr += '</select>';
  6706. preferenceHTMLStr += '<select id="selectFWSpecial" style="width: 75px" onChange="saveFW();">';
  6707. preferenceHTMLStr += '<option value="None">None</option>';
  6708. preferenceHTMLStr += '<option value="COMMANDER">Commander</option>';
  6709. preferenceHTMLStr += '<option value="GARGANTUA">Gargantua</option>';
  6710. preferenceHTMLStr += '<option value="GARGANTUA_GGC" disabled="disabled">Gargantua GGC</option>';
  6711. preferenceHTMLStr += '</select>';
  6712. preferenceHTMLStr += '</td>';
  6713. preferenceHTMLStr += '</tr>';
  6714.  
  6715. preferenceHTMLStr += '<tr id="trFWLastType" style="display:none;">';
  6716. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6717. preferenceHTMLStr += '<a title="Select config when there is only one soldier type left"><b>Last Soldier Type</b></a>';
  6718. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6719. preferenceHTMLStr += '</td>';
  6720. preferenceHTMLStr += '<td style="height:24px;">';
  6721. preferenceHTMLStr += '<select id="selectFWLastTypeConfig" onChange="saveFW();">';
  6722. preferenceHTMLStr += '<option value="CONFIG_STREAK">Follow Streak Config</option>';
  6723. preferenceHTMLStr += '<option value="CONFIG_GOUDA">Gouda & No Warpath Charm</option>';
  6724. preferenceHTMLStr += '<option value="NO_WARPATH">No Warpath Charm Only</option>';
  6725. preferenceHTMLStr += '<option value="CONFIG_UNCHANGED">Trap Setup Unchanged</option>';
  6726. preferenceHTMLStr += '</select>&nbsp;&nbsp;<a title="Select whether to include Artillery in checking of Last Soldier"><b>Include Artillery:</b></a>&emsp;';
  6727. preferenceHTMLStr += '<select id="selectFWLastTypeConfigIncludeArtillery" onchange="saveFW();">';
  6728. preferenceHTMLStr += '<option value="true">True</option>';
  6729. preferenceHTMLStr += '<option value="false">False</option>';
  6730. preferenceHTMLStr += '</select>';
  6731. preferenceHTMLStr += '</td>';
  6732. preferenceHTMLStr += '</tr>';
  6733.  
  6734. preferenceHTMLStr += '<tr id="trFWSupportConfig" style="display:none;">';
  6735. preferenceHTMLStr += '<td style="height:24px; text-align:right;"><a title="Select whether to disarm any Warpath Charm when supports are gone"><b>Disarm Warpath Charm</b></a>&nbsp;&nbsp;:&nbsp;&nbsp;</td>';
  6736. preferenceHTMLStr += '<td style="height:24px">';
  6737. preferenceHTMLStr += '<select id="selectFWSupportConfig" onchange="saveFW();">';
  6738. preferenceHTMLStr += '<option value="false">False</option>';
  6739. preferenceHTMLStr += '<option value="true">True</option>';
  6740. preferenceHTMLStr += '</select>&nbsp;&nbsp;When Support Retreated';
  6741. preferenceHTMLStr += '</td>';
  6742. preferenceHTMLStr += '</tr>';
  6743.  
  6744. preferenceHTMLStr += '<tr id="trBRConfig" style="display:none;">';
  6745. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6746. preferenceHTMLStr += '<a title="Select the mist tier to hunt"><b>Hunt At</b></a>';
  6747. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6748. preferenceHTMLStr += '</td>';
  6749. preferenceHTMLStr += '<td style="height:24px;">';
  6750. preferenceHTMLStr += '<select id="selectBRHuntMistTier" onChange="onSelectBRHuntMistTierChanged();">';
  6751. preferenceHTMLStr += '<option value="Red">Red</option>';
  6752. preferenceHTMLStr += '<option value="Green">Green</option>';
  6753. preferenceHTMLStr += '<option value="Yellow">Yellow</option>';
  6754. preferenceHTMLStr += '<option value="None">None</option>';
  6755. preferenceHTMLStr += '</select>&nbsp;&nbsp;Mist Tier';
  6756. preferenceHTMLStr += '</td>';
  6757. preferenceHTMLStr += '</tr>';
  6758.  
  6759. preferenceHTMLStr += '<tr id="trBRToggle" style="display:none;">';
  6760. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6761. preferenceHTMLStr += '<a title="Select the amount of hunt to toggle canister"><b>Toggle Canister Every</b></a>';
  6762. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6763. preferenceHTMLStr += '</td>';
  6764. preferenceHTMLStr += '<td style="height:24px;">';
  6765. preferenceHTMLStr += '<input type="number" id="inputToggleCanister" min="1" max="999" value="1" onchange="onInputToggleCanisterChanged(this);">&nbsp;&nbsp;Hunt(s)';
  6766. preferenceHTMLStr += '</td>';
  6767. preferenceHTMLStr += '</tr>';
  6768.  
  6769. preferenceHTMLStr += '<tr id="trBRTrapSetup" style="display:none;">';
  6770. preferenceHTMLStr += '<td style="height:24px; text-align:right;">';
  6771. preferenceHTMLStr += '<a title="Select trap setup combination for respective mist tier"><b>Trap Setup</b></a>';
  6772. preferenceHTMLStr += '&nbsp;&nbsp;:&nbsp;&nbsp;';
  6773. preferenceHTMLStr += '</td>';
  6774. preferenceHTMLStr += '<td style="height:24px;">';
  6775. preferenceHTMLStr += '<option value="Chrome Celestial Dissonance">Chrome CD</option>';
  6776. preferenceHTMLStr += '<option value="Celestial Dissonance">Cel Dis</option>';
  6777. preferenceHTMLStr += '<option value="Timesplit Dissonance">TDW</option>';
  6778. preferenceHTMLStr += '<option value="Mysteriously unYielding">MYNORCA</option>';
  6779. preferenceHTMLStr += '<option value="Focused Crystal Laser">FCL</option>';
  6780. preferenceHTMLStr += '<option value="Multi-Crystal Laser">MCL</option>';
  6781. preferenceHTMLStr += '<option value="Biomolecular Re-atomizer">BRT</option>';
  6782. preferenceHTMLStr += '<option value="Crystal Tower">CT</option>';
  6783. preferenceHTMLStr += '</select>';
  6784. preferenceHTMLStr += '<select id="selectBRTrapBase" style="width: 75px" onchange="saveBR();">';
  6785. preferenceHTMLStr += '</select>';
  6786. preferenceHTMLStr += '<select id="selectBRTrapTrinket" style="width: 75px" onchange="saveBR();">';
  6787. preferenceHTMLStr += '<option value="None">None</option>';
  6788. preferenceHTMLStr += '</select>';
  6789. preferenceHTMLStr += '<select id="selectBRTrapBait" onchange="saveBR();">';
  6790. preferenceHTMLStr += '<option value="None">None</option>';
  6791. preferenceHTMLStr += '<option value="Polluted Parmesan">PP</option>';
  6792. preferenceHTMLStr += '<option value="Terre Ricotta">Terre</option>';
  6793. preferenceHTMLStr += '<option value="Magical String">Magical</option>';
  6794. preferenceHTMLStr += '<option value="Brie String">Brie</option>';
  6795. preferenceHTMLStr += '<option value="Swiss String">Swiss</option>';
  6796. preferenceHTMLStr += '<option value="Marble String">Marble</option>';
  6797. preferenceHTMLStr += '<option value="Undead String Emmental">USE</option>';
  6798. preferenceHTMLStr += '</select>';
  6799. preferenceHTMLStr += '</td>';
  6800. preferenceHTMLStr += '</tr>';
  6801.  
  6802. preferenceHTMLStr += '<tr>';
  6803. preferenceHTMLStr += '<td style="height:24px; text-align:right;" colspan="2">';
  6804. preferenceHTMLStr += '<input type="button" id="AlgoConfigSaveInput" title="Save changes of Event or Location without reload, take effect after current hunt" value="Apply" onclick="setSessionToLocal();">&nbsp;&nbsp;&nbsp;';
  6805. preferenceHTMLStr += '<input type="button" id="AlgoConfigSaveReloadInput" title="Save changes of Event or Location with reload, take effect immediately" value="Apply & Reload" onclick="setSessionToLocal();' + temp + '">&nbsp;&nbsp;&nbsp;';
  6806. preferenceHTMLStr += '</td>';
  6807. preferenceHTMLStr += '</tr>';
  6808. preferenceHTMLStr += '</table>';
  6809.  
  6810. var preferenceDiv = document.createElement('div');
  6811. preferenceDiv.setAttribute('id', 'preferenceDiv');
  6812. if (showPreference === true)
  6813. preferenceDiv.setAttribute('style', 'display: block');
  6814. else
  6815. preferenceDiv.setAttribute('style', 'display: none');
  6816. preferenceDiv.innerHTML = preferenceHTMLStr;
  6817. timerDivElement.appendChild(preferenceDiv);
  6818. preferenceHTMLStr = null;
  6819. showPreference = null;
  6820.  
  6821. var hr3Element = document.createElement('hr');
  6822. preferenceDiv.appendChild(hr3Element);
  6823. hr3Element = null;
  6824. preferenceDiv = null;
  6825.  
  6826. // embed all msg to the page
  6827. headerElement.parentNode.insertBefore(timerDivElement, headerElement);
  6828.  
  6829. timerDivElement = null;
  6830.  
  6831. var scriptElement = document.createElement("script");
  6832. scriptElement.setAttribute('type', "text/javascript");
  6833. scriptElement.setAttribute('id', "scriptUIFunction");
  6834. scriptElement.innerHTML = functionToHTMLString(bodyJS);
  6835. headerElement.parentNode.insertBefore(scriptElement, headerElement);
  6836. scriptElement = null;
  6837.  
  6838. addKREntries();
  6839. setKREntriesColor();
  6840.  
  6841. // insert trap list
  6842. var objSelectStr = {
  6843. weapon : ['selectWeapon','selectZTWeapon1st','selectZTWeapon2nd','selectBestTrapWeapon','selectFWTrapSetupWeapon','selectFW4TrapSetupWeapon','selectSGTrapWeapon','selectFRoxWeapon','selectGWHWeapon','selectBCJODWeapon','selectFGARWeapon'],
  6844. base : ['selectBase','selectLabyrinthOtherBase','selectZTBase1st','selectZTBase2nd','selectBestTrapBase','selectFWTrapSetupBase','selectFW4TrapSetupBase','selectLGTGBase','selectLCCCBase','selectSCBase', 'selectIcebergBase', 'selectGESTrapBase','selectSGTrapBase','selectFRoxBase','selectGWHBase','selectBRTrapBase','selectWWRiftTrapBase','selectWWRiftMBWTrapBase','selectBCJODBase','selectFGARBase'],
  6845. trinket : ['selectZokorTrinket','selectTrinket','selectZTTrinket1st','selectZTTrinket2nd','selectFRTrapTrinket','selectBRTrapTrinket','selectLGTGTrinket','selectLCCCTrinket','selectIcebergTrinket','selectWWRiftTrapTrinket','selectWWRiftMBWTrapTrinket','selectGESTrapTrinket','selectGESRRTrapTrinket','selectGESDCTrapTrinket','selectFW4TrapSetupTrinket','selectSGTrapTrinket','selectSCHuntTrinket','selectFRoxTrinket','selectGWHTrinket','selectGESTrapTrinket','selectBWRiftTrinket','selectBWRiftTrinketSpecial','selectBCJODTrinket','selectFGARTrinket'],
  6846. bait : ['selectBait','selectGWHBait']
  6847. };
  6848. var temp;
  6849. var optionEle;
  6850. for (var prop in objTrapCollection) {
  6851. if(objTrapCollection.hasOwnProperty(prop)) {
  6852. objTrapCollection[prop] = objTrapCollection[prop].sort();
  6853. for(i=0;i<objTrapCollection[prop].length;i++){
  6854. optionEle = document.createElement("option");
  6855. optionEle.setAttribute('value', objTrapCollection[prop][i]);
  6856. optionEle.innerText = objTrapCollection[prop][i];
  6857. if(objSelectStr.hasOwnProperty(prop)){
  6858. for(var j=0;j<objSelectStr[prop].length;j++){
  6859. temp = document.getElementById(objSelectStr[prop][j]);
  6860. if(!isNullOrUndefined(temp))
  6861. temp.appendChild(optionEle.cloneNode(true));
  6862. }
  6863. }
  6864. }
  6865. }
  6866. }
  6867. document.getElementById('idRestore').style.display = (targetPage) ? 'table-row' : 'none';
  6868. document.getElementById('idGetLogAndPreference').style.display = (targetPage) ? 'table-row' : 'none';
  6869. document.getElementById('clearTrapList').style.display = (targetPage) ? 'table-row' : 'none';
  6870. document.getElementById('showPreferenceLink').style.display = (targetPage) ? 'table-row' : 'none';
  6871. }
  6872. headerElement = null;
  6873. }
  6874. targetPage = null;
  6875. }
  6876.  
  6877. function addKREntries(){
  6878. var i,temp,maxLen,keyName;
  6879. var replaced = "";
  6880. var nTimezoneOffset = -(new Date().getTimezoneOffset()) * 60000;
  6881. var count = 1;
  6882. var strInnerHTML = '';
  6883. var selectViewKR = document.getElementById('viewKR');
  6884. if(selectViewKR.options.length > 0){
  6885. // append keyKR for new KR entries under new UI
  6886. for(i = 0; i<window.localStorage.length;i++){
  6887. keyName = window.localStorage.key(i);
  6888. if(keyName.indexOf("KR" + separator) > -1 && keyKR.indexOf(keyName) < 0)
  6889. keyKR.push(keyName);
  6890. }
  6891. }
  6892. maxLen = keyKR.length.toString().length;
  6893. for(i=0;i<keyKR.length;i++){
  6894. if (keyKR[i].indexOf("KR" + separator) > -1){
  6895. temp = keyKR[i].split(separator);
  6896. temp.splice(0,1);
  6897. temp[0] = parseInt(temp[0]);
  6898. if (Number.isNaN(temp[0]))
  6899. temp[0] = 0;
  6900.  
  6901. temp[0] += nTimezoneOffset;
  6902. temp[0] = (new Date(temp[0])).toISOString();
  6903. replaced = temp.join("&nbsp;&nbsp;");
  6904. temp = count.toString();
  6905. while(temp.length < maxLen){
  6906. temp = '0' + temp;
  6907. }
  6908. replaced = temp + '. ' + replaced;
  6909. strInnerHTML += '<option value="' + keyKR[i] +'"' + ((i == keyKR.length - 1) ? ' selected':'') + '>' + replaced +'</option>';
  6910. count++;
  6911. }
  6912. }
  6913. if(strInnerHTML !== '')
  6914. selectViewKR.innerHTML = strInnerHTML;
  6915. }
  6916.  
  6917. function setKREntriesColor(){
  6918. // set KR entries color
  6919. var i, nCurrent, nNext, strCurrent;
  6920. var selectViewKR = document.getElementById('viewKR');
  6921. for(i=0;i<selectViewKR.children.length;i++){
  6922. if(i < selectViewKR.children.length-1){
  6923. nCurrent = parseInt(selectViewKR.children[i].value.split('~')[1]);
  6924. nNext = parseInt(selectViewKR.children[i+1].value.split('~')[1]);
  6925. if(Math.round((nNext-nCurrent)/60000) < 2)
  6926. selectViewKR.children[i].style = 'color:red';
  6927. }
  6928. strCurrent = selectViewKR.children[i].value.split('~')[2];
  6929. if(strCurrent == strCurrent.toUpperCase() && selectViewKR.children[i].style.color != 'red'){
  6930. selectViewKR.children[i].style = 'color:magenta';
  6931. }
  6932. }
  6933. }
  6934.  
  6935. function loadPreferenceSettingFromStorage() {
  6936. aggressiveMode = getStorageToVariableBool("AggressiveMode", aggressiveMode);
  6937. hornTimeDelayMin = getStorageToVariableInt("HornTimeDelayMin", hornTimeDelayMin);
  6938. hornTimeDelayMax = getStorageToVariableInt("HornTimeDelayMax", hornTimeDelayMax);
  6939. enableTrapCheck = getStorageToVariableBool("TrapCheck", enableTrapCheck);
  6940. checkTimeDelayMin = getStorageToVariableInt("TrapCheckTimeDelayMin", checkTimeDelayMin);
  6941. checkTimeDelayMax = getStorageToVariableInt("TrapCheckTimeDelayMax", checkTimeDelayMax);
  6942. isKingWarningSound = getStorageToVariableBool("PlayKingRewardSound", isKingWarningSound);
  6943. isAutoSolve = getStorageToVariableBool("AutoSolveKR", isAutoSolve);
  6944. krDelayMin = getStorageToVariableInt("AutoSolveKRDelayMin", krDelayMin);
  6945. krDelayMax = getStorageToVariableInt("AutoSolveKRDelayMax", krDelayMax);
  6946. kingsRewardRetry = getStorageToVariableInt("KingsRewardRetry", kingsRewardRetry);
  6947. pauseAtInvalidLocation = getStorageToVariableBool("PauseLocation", pauseAtInvalidLocation);
  6948. saveKRImage = getStorageToVariableBool("SaveKRImage", saveKRImage);
  6949. g_nTimeOffset = getStorageToVariableInt("TimeOffset", g_nTimeOffset);
  6950. discharge = getStorageToVariableBool("discharge", discharge);
  6951. try{
  6952. keyKR = [];
  6953. var keyName = "";
  6954. var keyRemove = [];
  6955. var i, j, value, objTest;
  6956. for(i = 0; i<window.localStorage.length;i++){
  6957. keyName = window.localStorage.key(i);
  6958. if(keyName.indexOf("KR-") > -1){ // remove old KR entries
  6959. keyRemove.push(keyName);
  6960. }
  6961. else if(keyName.indexOf("KR" + separator) > -1){
  6962. keyKR.push(keyName);
  6963. }
  6964. value = getStorage(keyName); // remove entries of duplicate JSON.stringify
  6965. if(value.indexOf("{") > -1){
  6966. try{
  6967. objTest = JSON.parse(value);
  6968. if(typeof objTest == 'string'){
  6969. setStorage(keyName, objTest);
  6970. setSessionStorage(keyName, objTest);
  6971. }
  6972. }
  6973. catch(e){
  6974. console.perror(keyName, e.message);
  6975. }
  6976. }
  6977. }
  6978.  
  6979. for(i = 0; i<keyRemove.length;i++){
  6980. removeStorage(keyRemove[i]);
  6981. }
  6982.  
  6983. if (keyKR.length > maxSaveKRImage){
  6984. keyKR = keyKR.sort();
  6985. var count = Math.floor(maxSaveKRImage / 2);
  6986. for(i=0;i<count;i++)
  6987. removeStorage(keyKR[i]);
  6988. }
  6989.  
  6990. // Backward compatibility of SCCustom
  6991. var temp = "";
  6992. var keyValue = "";
  6993. var obj = {};
  6994. var bResave = false;
  6995. var objSCCustomBackward = {
  6996. zone : ['ZONE_NOT_DIVE'],
  6997. zoneID : [0],
  6998. isHunt : [true],
  6999. bait : ['Gouda'],
  7000. trinket : ['None'],
  7001. useSmartJet : false
  7002. };
  7003. for (var prop in objSCZone) {
  7004. if(objSCZone.hasOwnProperty(prop)) {
  7005. keyName = "SCCustom_" + prop;
  7006. keyValue = window.localStorage.getItem(keyName);
  7007. if(!isNullOrUndefined(keyValue)){
  7008. keyValue = keyValue.split(',');
  7009. objSCCustomBackward.zone[objSCZone[prop]] = prop;
  7010. objSCCustomBackward.zoneID[objSCZone[prop]] = objSCZone[prop];
  7011. objSCCustomBackward.isHunt[objSCZone[prop]] = (keyValue[0] === 'true' || keyValue[0] === true);
  7012. objSCCustomBackward.bait[objSCZone[prop]] = keyValue[1];
  7013. objSCCustomBackward.trinket[objSCZone[prop]] = keyValue[2];
  7014. removeStorage(keyName);
  7015. }
  7016. }
  7017. }
  7018. if(objSCCustomBackward.zone.length > 1){
  7019. setStorage('SCCustom', JSON.stringify(objSCCustomBackward));
  7020. setSessionStorage('SCCustom', JSON.stringify(objSCCustomBackward));
  7021. }
  7022.  
  7023. keyValue = getStorage("SCCustom");
  7024. if(!isNullOrUndefined(keyValue)){
  7025. obj = JSON.parse(keyValue);
  7026. bResave = false;
  7027. var arrTempOri = ['NoSC', 'TT', 'EAC', 'scAnchorTreasure', 'scAnchorDanger', 'scAnchorUlti'];
  7028. var arrTempNew = ['None', 'Treasure Trawling Charm', 'Empowered Anchor Charm', 'GAC_EAC', 'SAC_EAC', 'UAC_EAC'];
  7029. var nIndex = -1;
  7030. for(var prop in obj){
  7031. if(obj.hasOwnProperty(prop) && prop == 'trinket'){
  7032. for(i=0;i<obj[prop].length;i++){
  7033. nIndex = arrTempOri.indexOf(obj[prop][i]);
  7034. if(nIndex > -1){
  7035. obj[prop][i] = arrTempNew[nIndex];
  7036. bResave = true;
  7037. }
  7038. }
  7039. }
  7040. }
  7041. if(obj.zone.indexOf('ZONE_DANGER_PP_LOTA') < 0){
  7042. obj.zone = ['ZONE_NOT_DIVE','ZONE_DEFAULT','ZONE_CORAL','ZONE_SCALE','ZONE_BARNACLE','ZONE_TREASURE','ZONE_DANGER','ZONE_DANGER_PP','ZONE_OXYGEN','ZONE_BONUS','ZONE_DANGER_PP_LOTA'];
  7043. obj.zoneID = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  7044. nIndex = obj.zone.indexOf('ZONE_DANGER_PP');
  7045. obj.isHunt[10] = obj.isHunt[nIndex];
  7046. obj.bait[10] = obj.bait[nIndex];
  7047. obj.trinket[10] = obj.trinket[nIndex];
  7048. bResave = true;
  7049. }
  7050. if(bResave){
  7051. setStorage("SCCustom", JSON.stringify(obj));
  7052. setSessionStorage("SCCustom", JSON.stringify(obj));
  7053. }
  7054. }
  7055.  
  7056. // Backward compatibility of SGZT
  7057. keyValue = getStorage("SGZT");
  7058. if(!isNullOrUndefined(keyValue)){
  7059. setStorage("SGarden", keyValue);
  7060. setSessionStorage("SGarden", keyValue);
  7061. removeStorage("SGZT");
  7062. removeSessionStorage("SGZT");
  7063. }
  7064.  
  7065. // Backward compatibility of ZTower
  7066. keyValue = getStorage("ZTower");
  7067. if(!isNullOrUndefined(keyValue)){
  7068. obj = JSON.parse(keyValue);
  7069. bResave = false;
  7070. var arrTemp = new Array(7).fill('');
  7071. for(var prop in obj){
  7072. if(obj.hasOwnProperty(prop) &&
  7073. (prop == 'weapon' || prop == 'base' || prop == 'trinket' || prop == 'bait')){
  7074. if(obj[prop].length == 7){
  7075. obj[prop] = obj[prop].concat(arrTemp);
  7076. bResave = true;
  7077. }
  7078. if(prop == 'bait'){
  7079. for(i=0;i<obj[prop].length;i++){
  7080. if(obj[prop][i] == 'Brie'){
  7081. obj[prop][i] = 'Brie Cheese';
  7082. bResave = true;
  7083. }
  7084. }
  7085. }
  7086. }
  7087. }
  7088. if(bResave){
  7089. setStorage("ZTower", JSON.stringify(obj));
  7090. setSessionStorage("ZTower", JSON.stringify(obj));
  7091. }
  7092. }
  7093.  
  7094. // Backward compatibility of BRCustom
  7095. keyValue = getStorage("BRCustom");
  7096. if(!isNullOrUndefined(keyValue)){
  7097. obj = JSON.parse(keyValue);
  7098. bResave = false;
  7099. for(i=0;i<obj.trinket.length;i++){
  7100. if(obj.trinket[i] == 'None' || obj.trinket[i] == 'NoAbove' || obj.trinket[i] === '' || isNullOrUndefined(obj.trinket[i]))
  7101. continue;
  7102. if(obj.trinket[i].indexOf('Charm') < 0){
  7103. obj.trinket[i] += ' Charm';
  7104. bResave = true;
  7105. }
  7106. }
  7107. if(bResave){
  7108. setStorage("BRCustom", JSON.stringify(obj));
  7109. setSessionStorage("BRCustom", JSON.stringify(obj));
  7110. }
  7111. }
  7112.  
  7113. // Backward compatibility of FRift
  7114. keyValue = getStorage("FRift");
  7115. if(!isNullOrUndefined(keyValue)){
  7116. obj = JSON.parse(keyValue);
  7117. bResave = false;
  7118. for(i=0;i<obj.trinket.length;i++){
  7119. if(obj.trinket[i] == 'None' || obj.trinket[i] == 'NoAbove' || obj.trinket[i] === '' || isNullOrUndefined(obj.trinket[i]))
  7120. continue;
  7121. if(obj.trinket[i].indexOf('Charm') < 0){
  7122. obj.trinket[i] += ' Charm';
  7123. bResave = true;
  7124. }
  7125. }
  7126. if(bResave){
  7127. setStorage("FRift", JSON.stringify(obj));
  7128. setSessionStorage("FRift", JSON.stringify(obj));
  7129. }
  7130. }
  7131.  
  7132. // Remove old LG
  7133. keyValue = getStorage("LGArea");
  7134. if(!isNullOrUndefined(keyValue) && keyValue.split(",").length == 2){
  7135. removeStorage("LGArea");
  7136. removeSessionStorage("LGArea");
  7137. }
  7138.  
  7139. // Backward compatibility of FW
  7140. keyValue = getStorage('FW');
  7141. if(isNullOrUndefined(keyValue)){
  7142. obj = {};
  7143. for(i=1;i<=4;i++){
  7144. temp = 'FW_Wave'+i;
  7145. keyValue = getStorage(temp);
  7146. if(!isNullOrUndefined(keyValue)){
  7147. obj['wave'+i] = JSON.parse(keyValue);
  7148. removeStorage(temp);
  7149. removeSessionStorage(temp);
  7150. }
  7151. else{
  7152. obj['wave'+i] = JSON.parse(JSON.stringify(objDefaultFW));
  7153. }
  7154. }
  7155. setStorage('FW', JSON.stringify(obj));
  7156. }
  7157. else{
  7158. obj = JSON.parse(keyValue);
  7159. bResave = false;
  7160. for(i=1;i<=4;i++){
  7161. temp = 'wave'+i;
  7162. for(j=0;j<obj[temp].cheese.length;j++){
  7163. if(obj[temp].cheese[j] == 'Brie'){
  7164. obj[temp].cheese[j] = 'Brie Cheese';
  7165. bResave = true;
  7166. }
  7167. }
  7168. }
  7169. if(bResave){
  7170. setStorage("FW", JSON.stringify(obj));
  7171. setSessionStorage("FW", JSON.stringify(obj));
  7172. }
  7173. }
  7174.  
  7175. // Backward compatibility of Labyrinth
  7176. keyValue = getStorage('Labyrinth');
  7177. if(isNullOrUndefined(keyValue)){
  7178. obj = {};
  7179. temp = getStorage('Labyrinth_DistrictFocus');
  7180. keyValue = getStorage('Labyrinth_HallwayPriorities');
  7181. if(isNullOrUndefined(keyValue)){
  7182. obj = JSON.parse(JSON.stringify(objDefaultLaby));
  7183. }
  7184. else{
  7185. obj = JSON.parse(keyValue);
  7186. if(isNullOrUndefined(temp))
  7187. temp = 'None';
  7188. obj.districtFocus = temp;
  7189. }
  7190. setStorage('Labyrinth', JSON.stringify(obj));
  7191. temp = ['Labyrinth_DistrictFocus', 'Labyrinth_HallwayPriorities'];
  7192. for(i=0;i<temp.length;i++){
  7193. removeStorage(temp[i]);
  7194. removeSessionStorage(temp[i]);
  7195. }
  7196. }
  7197.  
  7198. // Backward compatibility of Zokor
  7199. keyValue = getStorage('Zokor');
  7200. if(!isNullOrUndefined(keyValue)){
  7201. obj = JSON.parse(keyValue);
  7202. bResave = false;
  7203. for(i=0;i<obj.bait.length;i++){
  7204. if(obj.bait[i] == 'Brie'){
  7205. obj.bait[i] = 'Brie Cheese';
  7206. bResave = true;
  7207. }
  7208. }
  7209. if(bResave){
  7210. setStorage('Zokor', JSON.stringify(obj));
  7211. setSessionStorage('Zokor', JSON.stringify(obj));
  7212. }
  7213. }
  7214.  
  7215. // Backward compatibility of GWH2016R
  7216. keyValue = getStorage('GWH2016R');
  7217. if(!isNullOrUndefined(keyValue)){
  7218. obj = JSON.parse(keyValue);
  7219. bResave = false;
  7220. if(obj.zone.indexOf("NEW_YEAR'S_PARTY") < 0){
  7221. obj.zone.push("NEW_YEAR'S_PARTY");
  7222. obj.weapon.push('');
  7223. obj.base.push('');
  7224. obj.trinket.push('');
  7225. obj.bait.push('');
  7226. obj.boost.push(false);
  7227. bResave = true;
  7228. }
  7229. if(bResave){
  7230. setStorage('GWH2016R', JSON.stringify(obj));
  7231. setSessionStorage('GWH2016R', JSON.stringify(obj));
  7232. }
  7233. }
  7234.  
  7235. // Disable GWH2016
  7236. if(getStorageToVariableStr("eventLocation", "None").indexOf('GWH2016') > -1)
  7237. setStorage("eventLocation", "None");
  7238.  
  7239. // Backward compatibility of GES
  7240. keyValue = getStorage('GES');
  7241. if(!isNullOrUndefined(keyValue)){
  7242. obj = JSON.parse(keyValue);
  7243. if(isNullOrUndefined(obj.SD_BEFORE)){
  7244. var objNew = {
  7245. bLoadCrate : obj.SD.bLoadCrate,
  7246. nMinCrate : obj.SD.nMinCrate,
  7247. bUseRepellent : obj.RR.bUseRepellent,
  7248. nMinRepellent : obj.RR.nMinRepellent,
  7249. bStokeEngine : obj.DC.bStokeEngine,
  7250. nMinFuelNugget : obj.DC.nMinFuelNugget,
  7251. SD_BEFORE : {
  7252. weapon : obj.SD.weapon,
  7253. base : obj.SD.base,
  7254. trinket : obj.SD.trinket.before,
  7255. bait : obj.SD.bait,
  7256. },
  7257. SD_AFTER : {
  7258. weapon : obj.SD.weapon,
  7259. base : obj.SD.base,
  7260. trinket : obj.SD.trinket.after,
  7261. bait : obj.SD.bait,
  7262. },
  7263. RR : {
  7264. weapon : obj.RR.weapon,
  7265. base : obj.RR.base,
  7266. trinket : obj.RR.trinket,
  7267. bait : obj.RR.bait,
  7268. },
  7269. DC : {
  7270. weapon : obj.DC.weapon,
  7271. base : obj.DC.base,
  7272. trinket : obj.DC.trinket,
  7273. bait : obj.DC.bait,
  7274. },
  7275. WAITING : {
  7276. weapon : '',
  7277. base : '',
  7278. trinket : '',
  7279. bait : ''
  7280. }
  7281. };
  7282. setStorage('GES', JSON.stringify(objNew));
  7283. setSessionStorage('GES', JSON.stringify(objNew));
  7284. }
  7285. }
  7286.  
  7287. // Backward compatibility of BWRift
  7288. keyValue = getStorage('BWRift');
  7289. if(!isNullOrUndefined(keyValue)){
  7290. obj = JSON.parse(keyValue);
  7291. bResave = false;
  7292. if(obj.order.length != 16){
  7293. obj.order = ['NONE','GEARWORKS','ANCIENT','RUNIC','TIMEWARP','GUARD','SECURITY','FROZEN','FURNACE','INGRESS','PURSUER','ACOLYTE_CHARGING','ACOLYTE_DRAINING','ACOLYTE_DRAINED','LUCKY','HIDDEN'];
  7294. bResave = true;
  7295. }
  7296. if(obj.priorities.length != 13){
  7297. if(obj.priorities.length == 11){
  7298. obj.priorities.push('LUCKY');
  7299. obj.priorities.push('HIDDEN');
  7300. }
  7301. else
  7302. obj.priorities = ['SECURITY', 'FURNACE', 'PURSUER', 'ACOLYTE', 'LUCKY', 'HIDDEN', 'TIMEWARP', 'RUNIC', 'ANCIENT', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS'];
  7303. bResave = true;
  7304. }
  7305. if(isNullOrUndefined(obj.specialActivate)){
  7306. obj.specialActivate = {
  7307. forceActivate : new Array(16).fill(false),
  7308. remainingLootActivate : new Array(16).fill(1),
  7309. forceDeactivate : new Array(16).fill(obj.forceDeactivate),
  7310. remainingLootDeactivate : new Array(16).fill(obj.remainingLootDeactivate)
  7311. };
  7312. delete obj.forceDeactivate;
  7313. delete obj.remainingLootDeactivate;
  7314. bResave = true;
  7315. }
  7316. if(obj.minTimeSand.length != 9){
  7317. var arrTemp = new Array(9);
  7318. arrTemp[0] = obj.minTimeSand[0];
  7319. arrTemp[8] = obj.minTimeSand[2];
  7320. for(i=1;i<=7;i++)
  7321. arrTemp[i] = obj.minTimeSand[1];
  7322. obj.minTimeSand = arrTemp;
  7323. bResave = true;
  7324. }
  7325. var objTemp = {
  7326. arrTemp : ['master', 'specialActivate', 'gw', 'al', 'rl', 'gb', 'ic', 'fa'],
  7327. arrLength : [16, 16, 2, 2, 2, 7, 4, 16],
  7328. };
  7329. for(i=0;i<objTemp.arrTemp.length;i++){
  7330. if(obj.hasOwnProperty(objTemp.arrTemp[i])){
  7331. for(var prop in obj[objTemp.arrTemp[i]]){
  7332. if(obj[objTemp.arrTemp[i]].hasOwnProperty(prop)){
  7333. while(obj[objTemp.arrTemp[i]][prop].length < objTemp.arrLength[i]){
  7334. obj[objTemp.arrTemp[i]][prop].push(obj[objTemp.arrTemp[i]][prop][0]);
  7335. bResave = true;
  7336. }
  7337. if(obj[objTemp.arrTemp[i]][prop].length < (objTemp.arrLength[i] * 2)){
  7338. obj[objTemp.arrTemp[i]][prop] = obj[objTemp.arrTemp[i]][prop].concat(obj[objTemp.arrTemp[i]][prop]);
  7339. bResave = true;
  7340. }
  7341. }
  7342. }
  7343. }
  7344. }
  7345. if(bResave){
  7346. setStorage('BWRift', JSON.stringify(obj));
  7347. setSessionStorage('BWRift', JSON.stringify(obj));
  7348. }
  7349. }
  7350. }
  7351. catch (e){
  7352. console.perror('loadPreferenceSettingFromStorage',e.message);
  7353. }
  7354. getTrapList();
  7355. getBestTrap();
  7356. bestLGBase = arrayConcatUnique(bestLGBase, objBestTrap.base.luck);
  7357. bestSCBase = arrayConcatUnique(bestSCBase, objBestTrap.base.luck);
  7358. }
  7359.  
  7360. function getTrapList(category){
  7361. var temp = "";
  7362. var arrObjList;
  7363. if (category === null || category === undefined)
  7364. arrObjList = Object.keys(objTrapList);
  7365. else
  7366. arrObjList = [category];
  7367.  
  7368. for (var i=0;i<arrObjList.length;i++){
  7369. temp = getStorageToVariableStr("TrapList" + capitalizeFirstLetter(arrObjList[i]), "");
  7370. if (temp === ""){
  7371. objTrapList[arrObjList[i]] = [];
  7372. }
  7373. else{
  7374. try{
  7375. objTrapList[arrObjList[i]] = temp.split(",");
  7376. }
  7377. catch (e) {
  7378. objTrapList[arrObjList[i]] = [];
  7379. }
  7380. }
  7381. }
  7382. }
  7383.  
  7384. function clearTrapList(category){
  7385. var arrObjList;
  7386. if (category === null || category === undefined)
  7387. arrObjList = Object.keys(objTrapList);
  7388. else
  7389. arrObjList = [category];
  7390.  
  7391. for (var i=0;i<arrObjList.length;i++){
  7392. removeStorage("TrapList" + capitalizeFirstLetter(arrObjList[i]));
  7393. objTrapList[arrObjList[i]] = [];
  7394. }
  7395. }
  7396.  
  7397. function capitalizeFirstLetter(strIn){
  7398. return strIn.charAt(0).toUpperCase() + strIn.slice(1);
  7399. }
  7400.  
  7401. function getTrapListFromTrapSelector(sort, category, name, isForcedRetry){
  7402. clickTrapSelector(category);
  7403. objTrapList[category] = [];
  7404. var sec = secWait;
  7405. var retry = armTrapRetry;
  7406. var i, j, tagGroupElement, tagElement, nameElement, itemEle;
  7407. var intervalGTLFTS = setInterval(
  7408. function (){
  7409. if(isNewUI)
  7410. itemEle = document.getElementsByClassName('campPage-trap-itemBrowser-item');
  7411. else
  7412. tagGroupElement = document.getElementsByClassName('tagGroup');
  7413.  
  7414. if(isNewUI && itemEle.length > 0){
  7415. for (i = 0; i < itemEle.length; i++) {
  7416. nameElement = itemEle[i].getElementsByClassName('campPage-trap-itemBrowser-item-name')[0].textContent;
  7417. objTrapList[category].push(nameElement);
  7418. }
  7419. setStorage("TrapList" + capitalizeFirstLetter(category), objTrapList[category].join(","));
  7420. clearInterval(intervalGTLFTS);
  7421. arming = false;
  7422. intervalGTLFTS = null;
  7423. checkThenArm(sort, category, name, isForcedRetry);
  7424. return;
  7425. }
  7426. else if(!isNewUI && tagGroupElement.length > 0){
  7427. for (i = 0; i < tagGroupElement.length; ++i){
  7428. tagElement = tagGroupElement[i].getElementsByTagName('a');
  7429. for (j = 0; j < tagElement.length; ++j){
  7430. nameElement = tagElement[j].getElementsByClassName('name')[0].innerText;
  7431. objTrapList[category].push(nameElement);
  7432. }
  7433. }
  7434. setStorage("TrapList" + capitalizeFirstLetter(category), objTrapList[category].join(","));
  7435. clearInterval(intervalGTLFTS);
  7436. arming = false;
  7437. intervalGTLFTS = null;
  7438. checkThenArm(sort, category, name, isForcedRetry);
  7439. return;
  7440. }
  7441. else{
  7442. --sec;
  7443. if (sec <= 0){
  7444. clickTrapSelector(category);
  7445. sec = secWait;
  7446. --retry;
  7447. if (retry <= 0){
  7448. clearInterval(intervalGTLFTS);
  7449. arming = false;
  7450. intervalGTLFTS = null;
  7451. return;
  7452. }
  7453. }
  7454. }
  7455. }, 1000);
  7456. return;
  7457. }
  7458.  
  7459. function getBestTrap(){
  7460. var obj = getStorage("BestTrap");
  7461. if(!isNullOrUndefined(obj)){
  7462. obj = JSON.parse(obj);
  7463. for (var prop in obj) {
  7464. if(obj.hasOwnProperty(prop) && objBestTrap.hasOwnProperty(prop)){
  7465. for(var prop1 in obj[prop]){
  7466. if(obj[prop].hasOwnProperty(prop1) && objBestTrap[prop].hasOwnProperty(prop1)){
  7467. objBestTrap[prop][prop1] = arrayConcatUnique([obj[prop][prop1]], objBestTrap[prop][prop1]);
  7468. }
  7469. }
  7470. }
  7471. }
  7472. }
  7473. }
  7474.  
  7475. function getStorageToVariableInt(storageName, defaultInt)
  7476. {
  7477. var temp = getStorage(storageName);
  7478. var tempInt = defaultInt;
  7479. if (isNullOrUndefined(temp)) {
  7480. setStorage(storageName, defaultInt);
  7481. }
  7482. else {
  7483. tempInt = parseInt(temp);
  7484. if(Number.isNaN(tempInt))
  7485. tempInt = defaultInt;
  7486. }
  7487. return tempInt;
  7488. }
  7489.  
  7490. function getStorageToVariableStr(storageName, defaultStr)
  7491. {
  7492. var temp = getStorage(storageName);
  7493. if (isNullOrUndefined(temp)) {
  7494. setStorage(storageName, defaultStr);
  7495. temp = defaultStr;
  7496. }
  7497. return temp;
  7498. }
  7499.  
  7500. function getStorageToVariableBool(storageName, defaultBool)
  7501. {
  7502. var temp = getStorage(storageName);
  7503. if (isNullOrUndefined(temp)) {
  7504. setStorage(storageName, defaultBool.toString());
  7505. return defaultBool;
  7506. }
  7507. else if (temp === true || temp.toLowerCase() == "true") {
  7508. return true;
  7509. }
  7510. else {
  7511. return false;
  7512. }
  7513. }
  7514.  
  7515. function getStorageToObject(keyName, objDefault){
  7516. var obj = getStorage(keyName);
  7517. var bCheckNewProp = true;
  7518. if(isNullOrUndefined(obj)){
  7519. obj = JSON.stringify(objDefault);
  7520. setStorage(keyName, obj);
  7521. bCheckNewProp = false;
  7522. }
  7523. obj = JSON.parse(obj);
  7524. if(bCheckNewProp){
  7525. if(assignMissingDefault(obj, objDefault)){
  7526. setStorage(keyName, JSON.stringify(obj));
  7527. }
  7528. }
  7529.  
  7530. return obj;
  7531. }
  7532.  
  7533. function assignMissingDefault(obj, objDefault){
  7534. var bResave = false;
  7535. for(var prop in objDefault){
  7536. if(objDefault.hasOwnProperty(prop) && !obj.hasOwnProperty(prop)){
  7537. obj[prop] = objDefault[prop];
  7538. bResave = true;
  7539. }
  7540. }
  7541.  
  7542. return bResave;
  7543. }
  7544.  
  7545. function displayTimer(title, nextHornTime, checkTime) {
  7546. if (showTimerInTitle) {
  7547. document.title = title + " | "+ getPageVariable('user.firstname');
  7548. }
  7549.  
  7550. if (showTimerInPage) {
  7551. nextHornTimeElement.innerHTML = "<b>Next Hunter Horn Time:</b> " + nextHornTime;
  7552. checkTimeElement.innerHTML = "<b>Next Trap Check Time:</b> " + checkTime;
  7553. }
  7554.  
  7555. title = null;
  7556. nextHornTime = null;
  7557. checkTime = null;
  7558. }
  7559.  
  7560. function displayLocation(locStr) {
  7561. if (showTimerInPage && pauseAtInvalidLocation) {
  7562. travelElement.innerHTML = "<b>Hunt Location:</b> " + locStr;
  7563. }
  7564.  
  7565. locStr = null;
  7566. }
  7567.  
  7568. function displayKingRewardSumTime(timeStr) {
  7569. if (showTimerInPage) {
  7570. if (timeStr) {
  7571. lastKingRewardSumTimeElement.innerHTML = "(" + timeStr + ")";
  7572. }
  7573. else {
  7574. lastKingRewardSumTimeElement.innerHTML = "";
  7575. }
  7576. }
  7577.  
  7578. timeStr = null;
  7579. }
  7580.  
  7581. // ################################################################################################
  7582. // Timer Function - End
  7583. // ################################################################################################
  7584.  
  7585. // ################################################################################################
  7586. // Horn Function - Start
  7587. // ################################################################################################
  7588.  
  7589. function soundHorn() {
  7590. var isAtCampPage = (isNewUI)? (document.getElementById('journalContainer') !== null) : (document.getElementById('huntingTips') !== null) ;
  7591. if (!isAtCampPage) {
  7592. displayTimer("Not At Camp Page", "Not At Camp Page", "Not At Camp Page");
  7593. window.setTimeout(function () { soundHorn(); }, timerRefreshInterval * 1000);
  7594. return;
  7595. }
  7596.  
  7597. // update timer
  7598. displayTimer("Ready to Blow The Horn...", "Ready to Blow The Horn...", "Ready to Blow The Horn...");
  7599.  
  7600. var scriptNode = document.getElementById("scriptNode");
  7601. if (scriptNode) {
  7602. scriptNode.setAttribute("soundedHornAtt", "false");
  7603. }
  7604. scriptNode = null;
  7605.  
  7606. if (!aggressiveMode) {
  7607. // safety mode, check the horn image is there or not before sound the horn
  7608. var headerElement = (isNewUI) ? document.getElementById('mousehuntHud').firstChild : document.getElementById('envHeaderImg');
  7609. if (headerElement) {
  7610. // need to make sure that the timer is ready before we can click on it
  7611. var headerStatus = headerElement.getAttribute('class');
  7612. headerStatus = headerStatus.toLowerCase();
  7613. if (document.getElementsByClassName('mousehuntHud-hornTimer')[0].innerText == "Ready!") {
  7614. // timer is ready, let's sound the horn!
  7615.  
  7616. // update timer
  7617. displayTimer("Blowing The Horn...", "Blowing The Horn...", "Blowing The Horn...");
  7618.  
  7619. // simulate mouse click on the horn
  7620. fireEvent(document.getElementsByClassName(g_strHornButton)[0].firstChild, 'click');
  7621.  
  7622. // clean up
  7623. headerElement = null;
  7624. headerStatus = null;
  7625.  
  7626. // double check if the horn was already sounded
  7627. window.setTimeout(function () { afterSoundingHorn(); }, 5000);
  7628. }
  7629. else if (headerStatus.indexOf("hornsounding") != -1 || headerStatus.indexOf("hornsounded") != -1) {
  7630. // some one just sound the horn...
  7631.  
  7632. // update timer
  7633. displayTimer("Synchronizing Data...", "Someone had just sound the horn. Synchronizing data...", "Someone had just sound the horn. Synchronizing data...");
  7634.  
  7635. // clean up
  7636. headerElement = null;
  7637. headerStatus = null;
  7638.  
  7639. // load the new data
  7640. window.setTimeout(function () { afterSoundingHorn(); }, 5000);
  7641. }
  7642. else if (headerStatus.indexOf("hornwaiting") != -1) {
  7643. // the horn is not appearing, let check the time again
  7644.  
  7645. // update timer
  7646. displayTimer("Synchronizing Data...", "Hunter horn is not ready yet. Synchronizing data...", "Hunter horn is not ready yet. Synchronizing data...");
  7647.  
  7648. // sync the time again, maybe user already click the horn
  7649. retrieveData();
  7650.  
  7651. checkJournalDate();
  7652.  
  7653. // clean up
  7654. headerElement = null;
  7655. headerStatus = null;
  7656.  
  7657. // loop again
  7658. window.setTimeout(function () { countdownTimer(); }, timerRefreshInterval * 1000);
  7659. }
  7660. else {
  7661. // some one steal the horn!
  7662.  
  7663. // update timer
  7664. displayTimer("Synchronizing Data...", "Hunter horn is missing. Synchronizing data...", "Hunter horn is missing. Synchronizing data...");
  7665.  
  7666. if(isNewUI){
  7667. // sync the time again, maybe user already click the horn
  7668. retrieveData();
  7669.  
  7670. checkJournalDate();
  7671.  
  7672. // clean up
  7673. headerElement = null;
  7674. headerStatus = null;
  7675.  
  7676. // loop again
  7677. window.setTimeout(function () { countdownTimer(); }, timerRefreshInterval * 1000);
  7678. }
  7679. else{
  7680. // try to click on the horn
  7681. fireEvent(document.getElementsByClassName(g_strHornButton)[0].firstChild, 'click');
  7682.  
  7683. // clean up
  7684. headerElement = null;
  7685. headerStatus = null;
  7686.  
  7687. // double check if the horn was already sounded
  7688. window.setTimeout(function () { afterSoundingHorn(true); }, 5000);
  7689. }
  7690. }
  7691. }
  7692. else {
  7693. // something wrong, can't even found the header...
  7694.  
  7695. // clean up
  7696. headerElement = null;
  7697.  
  7698. // reload the page see if thing get fixed
  7699. reloadWithMessage("Fail to find the horn header. Reloading...", false);
  7700. }
  7701.  
  7702. }
  7703. else {
  7704. // aggressive mode, ignore whatever horn image is there or not, just sound the horn!
  7705.  
  7706. // simulate mouse click on the horn
  7707. fireEvent(document.getElementsByClassName(g_strHornButton)[0].firstChild, 'click');
  7708.  
  7709. // double check if the horn was already sounded
  7710. window.setTimeout(function () { afterSoundingHorn(); }, 3000);
  7711. }
  7712. }
  7713.  
  7714. function afterSoundingHorn(bLog) {
  7715. var scriptNode = document.getElementById("scriptNode");
  7716. if (scriptNode) {
  7717. scriptNode.setAttribute("soundedHornAtt", "false");
  7718. }
  7719. scriptNode = null;
  7720.  
  7721. var headerElement = (isNewUI) ? document.getElementById('mousehuntHud').firstChild : document.getElementById('envHeaderImg');
  7722. if (headerElement) {
  7723. // double check if the horn image is still visible after the script already sound it
  7724. var headerStatus = headerElement.getAttribute('class');
  7725. headerStatus = headerStatus.toLowerCase();
  7726. if(bLog === true) console.plog('headerStatus:', headerStatus);
  7727. if (headerStatus.indexOf("hornready") != -1) {
  7728. // seen like the horn is not functioning well
  7729.  
  7730. // update timer
  7731. displayTimer("Blowing The Horn Again...", "Blowing The Horn Again...", "Blowing The Horn Again...");
  7732.  
  7733. // simulate mouse click on the horn
  7734. fireEvent(document.getElementsByClassName(g_strHornButton)[0].firstChild, 'click');
  7735.  
  7736. // clean up
  7737. headerElement = null;
  7738. headerStatus = null;
  7739.  
  7740. // increase the horn retry counter and check if the script is caugh in loop
  7741. ++hornRetry;
  7742. if (hornRetry > hornRetryMax) {
  7743. // reload the page see if thing get fixed
  7744. reloadWithMessage("Detected script caught in loop. Reloading...", true);
  7745.  
  7746. // reset the horn retry counter
  7747. hornRetry = 0;
  7748. }
  7749. else {
  7750. // check again later
  7751. window.setTimeout(function () { afterSoundingHorn(); }, 1000);
  7752. }
  7753. }
  7754. else if (headerStatus.indexOf("hornsounding") != -1) {
  7755. // the horn is already sound, but the network seen to slow on fetching the data
  7756.  
  7757. // update timer
  7758. displayTimer("The horn sounding taken extra longer than normal...", "The horn sounding taken extra longer than normal...", "The horn sounding taken extra longer than normal...");
  7759.  
  7760. // clean up
  7761. headerElement = null;
  7762. headerStatus = null;
  7763.  
  7764. // increase the horn retry counter and check if the script is caugh in loop
  7765. ++hornRetry;
  7766. if (hornRetry > hornRetryMax) {
  7767. // reload the page see if thing get fixed
  7768. reloadWithMessage("Detected script caught in loop. Reloading...", true);
  7769.  
  7770. // reset the horn retry counter
  7771. hornRetry = 0;
  7772. }
  7773. else {
  7774. // check again later
  7775. window.setTimeout(function () { afterSoundingHorn(); }, 3000);
  7776. }
  7777. }
  7778. else {
  7779. // everything look ok
  7780.  
  7781. // update timer
  7782. displayTimer("Horn sounded. Synchronizing Data...", "Horn sounded. Synchronizing data...", "Horn sounded. Synchronizing data...");
  7783.  
  7784. // reload data
  7785. retrieveData();
  7786.  
  7787. // clean up
  7788. headerElement = null;
  7789. headerStatus = null;
  7790.  
  7791. // script continue as normal
  7792. window.setTimeout(function () { countdownTimer(); }, timerRefreshInterval * 1000);
  7793.  
  7794. // reset the horn retry counter
  7795. hornRetry = 0;
  7796. }
  7797. }
  7798. }
  7799.  
  7800. function embedScript() {
  7801. // create a javascript to detect if user click on the horn manually
  7802. var scriptNode = document.createElement('script');
  7803. scriptNode.setAttribute('id', 'scriptNode');
  7804. scriptNode.setAttribute('type', 'text/javascript');
  7805. scriptNode.setAttribute('soundedHornAtt', 'false');
  7806. scriptNode.innerHTML = ' \
  7807. function soundedHorn(){ \
  7808. var scriptNode = document.getElementById("scriptNode"); \
  7809. if (scriptNode){ \
  7810. scriptNode.setAttribute("soundedHornAtt", "true"); \
  7811. } \
  7812. scriptNode = null; \
  7813. }';
  7814.  
  7815. // find the head node and insert the script into it
  7816. var headerElement;
  7817. if (fbPlatform || hiFivePlatform || mhPlatform) {
  7818. headerElement = document.getElementById('noscript');
  7819. }
  7820. else if (mhMobilePlatform) {
  7821. headerElement = document.getElementById('mobileHorn');
  7822. }
  7823. headerElement.parentNode.insertBefore(scriptNode, headerElement);
  7824. scriptNode = null;
  7825. headerElement = null;
  7826.  
  7827. // change the function call of horn
  7828. var nLength = document.getElementsByClassName('mousehuntHud-menu-item').length;
  7829. if(nLength==8){
  7830. // old UI
  7831. isNewUI = false;
  7832. g_strCampButton = 'mousehuntHud-campButton';
  7833. }
  7834. else {
  7835. // new UI
  7836. isNewUI = true;
  7837. g_strCampButton = 'mousehuntHud-menu-item';
  7838. //alert("New UI might not work properly with this script. Use at your own risk");
  7839. //document.getElementById('titleElement').innerHTML += " - <font color='red'><b>Pls use Classic UI (i.e. Non-FreshCoat Layout) for fully working features</b></font>";
  7840. }
  7841. setStorage('NewUI', isNewUI);
  7842.  
  7843. var hornButtonLink = document.getElementsByClassName(g_strHornButton)[0].firstChild;
  7844. var oriStr = hornButtonLink.getAttribute('onclick').toString();
  7845. var index = oriStr.indexOf('return false;');
  7846. var modStr = oriStr.substring(0, index) + 'soundedHorn();' + oriStr.substring(index);
  7847. hornButtonLink.setAttribute('onclick', modStr);
  7848.  
  7849. hornButtonLink = null;
  7850. oriStr = null;
  7851. index = null;
  7852. modStr = null;
  7853. }
  7854.  
  7855. // ################################################################################################
  7856. // Horn Function - End
  7857. // ################################################################################################
  7858.  
  7859.  
  7860.  
  7861. // ################################################################################################
  7862. // King's Reward Function - Start
  7863. // ################################################################################################
  7864.  
  7865. function kingRewardAction() {
  7866. // update timer
  7867. displayTimer("King's Reward!", "King's Reward!", "King's Reward!");
  7868. displayLocation("-");
  7869.  
  7870. // play music if needed
  7871. playKingRewardSound();
  7872.  
  7873. // focus on the answer input
  7874. var inputElementList = document.getElementsByTagName('input');
  7875. if (inputElementList) {
  7876. for (var i = 0; i < inputElementList.length; ++i) {
  7877. // check if it is a resume button
  7878. if (inputElementList[i].getAttribute('name') == "puzzle_answer") {
  7879. inputElementList[i].focus();
  7880. break;
  7881. }
  7882. }
  7883. }
  7884. inputElementList = null;
  7885.  
  7886. // retrieve last king's reward time
  7887. var lastDate = getStorage("lastKingRewardDate");
  7888. lastDate = (isNullOrUndefined(lastDate)) ? new Date(0) : new Date(lastDate);
  7889.  
  7890. // record last king's reward time
  7891. var nowDate = new Date();
  7892. setStorage("lastKingRewardDate", nowDate.toString());
  7893. var nTimezoneOffset = -(nowDate.getTimezoneOffset()) * 60000;
  7894. var nInterval = Math.abs(nowDate - lastDate) / 1000; // in second
  7895.  
  7896. console.plog("Last KR:", new Date(Date.parse(lastDate)+nTimezoneOffset).toISOString(), "Current KR:", new Date(Date.parse(nowDate)+nTimezoneOffset).toISOString(), "Interval:", timeFormat(nInterval));
  7897. if (!isAutoSolve){
  7898. var intervalCRB = setInterval(
  7899. function (){
  7900. if (checkResumeButton()){
  7901. clearInterval(intervalCRB);
  7902. intervalCRB = null;
  7903. return;
  7904. }
  7905. }, 1000);
  7906. return;
  7907. }
  7908.  
  7909. var krDelaySec = krDelayMax;
  7910. if (kingsRewardRetry > 0){
  7911. var nMin = krDelayMin / (kingsRewardRetry * 2);
  7912. var nMax = krDelayMax / (kingsRewardRetry * 2);
  7913. krDelaySec = nMin + Math.floor(Math.random() * (nMax - nMin));
  7914. }
  7915. else
  7916. krDelaySec = krDelayMin + Math.floor(Math.random() * (krDelayMax - krDelayMin));
  7917.  
  7918. var krStopHourNormalized = krStopHour;
  7919. var krStartHourNormalized = krStartHour;
  7920. if (krStopHour > krStartHour){ // e.g. Stop to Start => 22 to 06
  7921. var offset = 24 - krStopHour;
  7922. krStartHourNormalized = krStartHour + offset;
  7923. krStopHourNormalized = 0;
  7924. nowDate.setHours(nowDate.getHours() + offset);
  7925. }
  7926.  
  7927. if (nowDate.getHours() >= krStopHourNormalized && nowDate.getHours() < krStartHourNormalized && nInterval > (5*60)){
  7928. var krDelayMinute = krStartHourDelayMin + Math.floor(Math.random() * (krStartHourDelayMax - krStartHourDelayMin));
  7929. krDelaySec += krStartHour * 3600 - (nowDate.getHours() * 3600 + nowDate.getMinutes() * 60 + nowDate.getSeconds());
  7930. krDelaySec += krDelayMinute * 60;
  7931. kingRewardCountdownTimer(krDelaySec, true);
  7932. }
  7933. else{
  7934. kingRewardCountdownTimer(krDelaySec, false);
  7935. }
  7936. }
  7937.  
  7938. function playKingRewardSound() {
  7939. if (isKingWarningSound) {
  7940. unsafeWindow.hornAudio = new Audio('https://raw.githubusercontent.com/devcnn88/MHAutoBotEnhanced/master/resources/Girtab.mp3');
  7941. hornAudio.loop = true;
  7942. hornAudio.play();
  7943. }
  7944. }
  7945.  
  7946. function kingRewardCountdownTimer(interval, isReloadToSolve)
  7947. {
  7948. var strTemp = (isReloadToSolve) ? "Reload to solve KR in " : "Solve KR in (extra few sec delay) ";
  7949. strTemp = strTemp + timeFormat(interval);
  7950. displayTimer(strTemp, strTemp, strTemp);
  7951. interval -= timerRefreshInterval;
  7952. if (interval < 0)
  7953. {
  7954. if (isReloadToSolve)
  7955. {
  7956. strTemp = "Reloading...";
  7957. displayTimer(strTemp, strTemp, strTemp);
  7958. if(isNewUI){
  7959. reloadPage(false);
  7960. }
  7961. else{
  7962. // simulate mouse click on the camp button
  7963. fireEvent(document.getElementsByClassName(g_strCampButton)[0], 'click');
  7964. }
  7965.  
  7966. // reload the page if click on the camp button fail
  7967. window.setTimeout(function () { reloadWithMessage("Fail to click on camp button. Reloading...", false); }, 5000);
  7968. }
  7969. else
  7970. {
  7971. strTemp = "Solving...";
  7972. displayTimer(strTemp, strTemp, strTemp);
  7973. var intervalCRB = setInterval(
  7974. function ()
  7975. {
  7976. if (checkResumeButton())
  7977. {
  7978. clearInterval(intervalCRB);
  7979. intervalCRB = null;
  7980. return;
  7981. }
  7982. }, 1000);
  7983. CallKRSolver();
  7984. }
  7985. }
  7986. else
  7987. {
  7988. if (!checkResumeButton()) {
  7989. window.setTimeout(function () { kingRewardCountdownTimer(interval, isReloadToSolve); }, timerRefreshInterval * 1000);
  7990. }
  7991. }
  7992. }
  7993.  
  7994. function checkResumeButton() {
  7995. var found = false;
  7996. var resumeElement;
  7997. if (isNewUI) {
  7998. var krFormClass = document.getElementsByTagName('form')[0].className;
  7999. if (krFormClass.indexOf("noPuzzle") > -1) {
  8000. // found resume button
  8001.  
  8002. // simulate mouse click on the resume button
  8003. resumeElement = document.getElementsByClassName('mousehuntPage-puzzle-form-complete-button')[0];
  8004. var nowDate = new Date();
  8005. var nTimezoneOffset = -(nowDate.getTimezoneOffset()) * 60000;
  8006. console.plog('Click Resume button at:', new Date(Date.parse(nowDate)+nTimezoneOffset).toISOString());
  8007. fireEvent(resumeElement, 'click');
  8008. resumeElement = null;
  8009.  
  8010. var nRetry = 5;
  8011. var intervalCRB1 = setInterval( function (){
  8012. if (isNullOrUndefined(document.getElementById('journalContainer'))) {
  8013. // not at camp page
  8014. --nRetry;
  8015. if(nRetry <= 0){
  8016. // reload url if click fail
  8017. reloadWithMessage("Fail to click on resume button. Reloading...", false);
  8018. clearInterval(intervalCRB1);
  8019. }
  8020. }
  8021. else{
  8022. var lastKingRewardDate = getStorage("lastKingRewardDate");
  8023. var lastDateStr;
  8024. if (isNullOrUndefined(lastKingRewardDate)) {
  8025. lastDateStr = "-";
  8026. lastKingRewardSumTime = -1;
  8027. }
  8028. else {
  8029. var lastDate = new Date(lastKingRewardDate);
  8030. lastDateStr = lastDate.toDateString() + " " + lastDate.toTimeString().substring(0, 8);
  8031. lastKingRewardSumTime = parseInt((new Date() - lastDate) / 1000);
  8032. }
  8033. kingTimeElement.innerHTML = "<b>Last King's Reward:</b> " + lastDateStr + " ";
  8034. kingTimeElement.appendChild(lastKingRewardSumTimeElement);
  8035. retrieveData(true);
  8036. countdownTimer();
  8037. addKREntries();
  8038. setKREntriesColor();
  8039. clearInterval(intervalCRB1);
  8040. }
  8041. }, 1000);
  8042. found = true;
  8043. }
  8044. krFormClass = null;
  8045. }
  8046. else{
  8047. var linkElementList = document.getElementsByTagName('img');
  8048. if (linkElementList) {
  8049. var i;
  8050. for (i = 0; i < linkElementList.length; ++i) {
  8051. // check if it is a resume button
  8052. if (linkElementList[i].getAttribute('src').indexOf("resume_hunting_blue.gif") != -1) {
  8053. // found resume button
  8054.  
  8055. // simulate mouse click on the horn
  8056. resumeElement = linkElementList[i].parentNode;
  8057. var nowDate = new Date();
  8058. var nTimezoneOffset = -(nowDate.getTimezoneOffset()) * 60000;
  8059. console.plog('Click Resume button at:', new Date(Date.parse(nowDate)+nTimezoneOffset).toISOString());
  8060. fireEvent(resumeElement, 'click');
  8061. resumeElement = null;
  8062.  
  8063. // reload url if click fail
  8064. window.setTimeout(function () {
  8065. console.perror('Fail to click on resume button:', new Date());
  8066. reloadWithMessage("Fail to click on resume button. Reloading...", false);
  8067. }, 6000);
  8068.  
  8069. // recheck if the resume button is click because some time even the url reload also fail
  8070.  
  8071. window.setTimeout(function () {
  8072. console.perror('Recheck resume button:', new Date());
  8073. checkResumeButton();
  8074. }, 10000);
  8075.  
  8076. found = true;
  8077. break;
  8078. }
  8079. }
  8080. i = null;
  8081. }
  8082. linkElementList = null;
  8083. }
  8084.  
  8085. try {
  8086. return (found);
  8087. }
  8088. finally {
  8089. found = null;
  8090. }
  8091. }
  8092.  
  8093. function CallKRSolver()
  8094. {
  8095. var frame = document.createElement('iframe');
  8096. frame.setAttribute("id", "myFrame");
  8097. var img;
  8098. if (debugKR){
  8099. //frame.src = "https://dl.dropboxusercontent.com/s/4u5msso39hfpo87/Capture.PNG";
  8100. //frame.src = "https://dl.dropboxusercontent.com/s/og73bcdsn2qod63/download%20%2810%29Ori.png";
  8101. frame.src = "https://dl.dropboxusercontent.com/s/ppg0l35h25phrx3/download%20(16).png";
  8102. }
  8103. else{
  8104. if(isNewUI){
  8105. img = document.getElementsByClassName('mousehuntPage-puzzle-form-captcha-image')[0];
  8106. frame.src = img.querySelector('img').src;
  8107. }
  8108. else{
  8109. img = document.getElementById('puzzleImage');
  8110. frame.src = img.src;
  8111. }
  8112. }
  8113. document.body.appendChild(frame);
  8114. }
  8115.  
  8116. function CheckKRAnswerCorrectness()
  8117. {
  8118. var strTemp = '';
  8119. if(isNewUI){
  8120. var codeError = document.getElementsByClassName("mousehuntPage-puzzle-form-code-error");
  8121. for(var i=0;i<codeError.length;i++){
  8122. if(codeError[i].innerText.toLowerCase().indexOf("incorrect claim code") > -1){
  8123. if (kingsRewardRetry >= kingsRewardRetryMax){
  8124. kingsRewardRetry = 0;
  8125. setStorage("KingsRewardRetry", kingsRewardRetry);
  8126. strTemp = 'Max ' + kingsRewardRetryMax + 'retries. Pls solve it manually ASAP.';
  8127. alert(strTemp);
  8128. displayTimer(strTemp, strTemp, strTemp);
  8129. console.perror(strTemp);
  8130. }
  8131. else{
  8132. ++kingsRewardRetry;
  8133. setStorage("KingsRewardRetry", kingsRewardRetry);
  8134. CallKRSolver();
  8135. }
  8136. return;
  8137. }
  8138. }
  8139. }
  8140. else{
  8141. var pageMsg = document.getElementById('pagemessage');
  8142. if (!isNullOrUndefined(pageMsg) && pageMsg.innerText.toLowerCase().indexOf("unable to claim reward") > -1){ // KR answer not correct, re-run OCR
  8143. if (kingsRewardRetry >= kingsRewardRetryMax){
  8144. kingsRewardRetry = 0;
  8145. setStorage("KingsRewardRetry", kingsRewardRetry);
  8146. strTemp = 'Max ' + kingsRewardRetryMax + 'retries. Pls solve it manually ASAP.';
  8147. alert(strTemp);
  8148. displayTimer(strTemp, strTemp, strTemp);
  8149. console.perror(strTemp);
  8150. }
  8151. else{
  8152. ++kingsRewardRetry;
  8153. setStorage("KingsRewardRetry", kingsRewardRetry);
  8154. CallKRSolver();
  8155. }
  8156. return;
  8157. }
  8158. }
  8159.  
  8160. window.setTimeout(function () { CheckKRAnswerCorrectness(); }, 1000);
  8161. }
  8162.  
  8163. // ################################################################################################
  8164. // King's Reward Function - End
  8165. // ################################################################################################
  8166.  
  8167.  
  8168.  
  8169. // ################################################################################################
  8170. // Trap Check Function - Start
  8171. // ################################################################################################
  8172.  
  8173. function trapCheck() {
  8174. // update timer
  8175. displayTimer("Checking The Trap...", "Checking trap now...", "Checking trap now...");
  8176.  
  8177. // simulate mouse click on the camp button
  8178. fireEvent(document.getElementsByClassName(g_strCampButton)[0], 'click');
  8179.  
  8180. // reload the page if click on camp button fail
  8181. // window.setTimeout(function () { reloadWithMessage("Fail to click on camp button. Reloading...", false); }, 5000);
  8182. var nDelay = 5000;
  8183. window.setTimeout(function () { retrieveData(); }, nDelay);
  8184. window.setTimeout(function () { countdownTimer(); }, nDelay + timerRefreshInterval * 1000);
  8185. }
  8186.  
  8187. function CalculateNextTrapCheckInMinute() {
  8188. if (enableTrapCheck) {
  8189. var now = (g_nTimeOffset === 0) ? new Date() : new Date(Date.now() + g_nTimeOffset*1000);
  8190. var temp = (trapCheckTimeDiff * 60) - (now.getMinutes() * 60 + now.getSeconds());
  8191. checkTimeDelay = checkTimeDelayMin + Math.round(Math.random() * (checkTimeDelayMax - checkTimeDelayMin));
  8192. checkTime = (now.getMinutes() >= trapCheckTimeDiff) ? 3600 + temp : temp;
  8193. checkTime += checkTimeDelay;
  8194. now = undefined;
  8195. temp = undefined;
  8196. }
  8197. }
  8198.  
  8199. // ################################################################################################
  8200. // Trap Check Function - End
  8201. // ################################################################################################
  8202.  
  8203.  
  8204. // ################################################################################################
  8205. // General Function - Start
  8206. // ################################################################################################
  8207.  
  8208. function ajaxPost(postURL, objData, callback, throwerror){
  8209. try {
  8210. jQuery.ajax({
  8211. type: 'POST',
  8212. url: postURL,
  8213. data: objData,
  8214. contentType: 'application/x-www-form-urlencoded',
  8215. dataType: 'json',
  8216. xhrFields: {
  8217. withCredentials: false
  8218. },
  8219. success: callback,
  8220. error: throwerror,
  8221. });
  8222. }
  8223. catch (e) {
  8224. throwerror(e);
  8225. }
  8226. }
  8227.  
  8228. function isNullOrUndefined(obj){
  8229. return (obj === null || obj === undefined || obj === 'null' || obj === 'undefined');
  8230. }
  8231.  
  8232. function getAllIndices(arr, val) {
  8233. var indices = [];
  8234. for(var i = 0; i < arr.length; i++){
  8235. if (arr[i] === val)
  8236. indices.push(i);
  8237. }
  8238. return indices;
  8239. }
  8240.  
  8241. function range(value, min, max){
  8242. if(value > max)
  8243. value = max;
  8244. else if(value < min)
  8245. value = min;
  8246. else if(Number.isNaN(value))
  8247. value = min + Math.floor(Math.random() * (max - min));
  8248.  
  8249. return value;
  8250. }
  8251.  
  8252. function min(data){
  8253. var value = Number.MAX_SAFE_INTEGER;
  8254. for (var i=0;i<data.length;i++){
  8255. if (data[i] < value)
  8256. value = data[i];
  8257. }
  8258. return value;
  8259. }
  8260.  
  8261. function minIndex(data){
  8262. var value = Number.MAX_SAFE_INTEGER;
  8263. var index = -1;
  8264. for (var i=0;i<data.length;i++){
  8265. if (data[i] < value){
  8266. value = data[i];
  8267. index = i;
  8268. }
  8269. }
  8270. return index;
  8271. }
  8272.  
  8273. function max(data){
  8274. var value = Number.MIN_SAFE_INTEGER;
  8275. for (var i=0;i<data.length;i++){
  8276. if (data[i] > value)
  8277. value = data[i];
  8278. }
  8279. return value;
  8280. }
  8281.  
  8282. function maxIndex(data){
  8283. var value = Number.MIN_SAFE_INTEGER;
  8284. var index = -1;
  8285. for (var i=0;i<data.length;i++){
  8286. if (data[i] > value){
  8287. value = data[i];
  8288. index = i;
  8289. }
  8290. }
  8291. return index;
  8292. }
  8293.  
  8294. function arrayConcatUnique(arrOriginal, arrConcat){
  8295. if(!Array.isArray(arrOriginal))
  8296. arrOriginal = [arrOriginal];
  8297. if(!Array.isArray(arrConcat))
  8298. arrConcat = [arrConcat];
  8299.  
  8300. var nIndex = -1;
  8301. var arrTemp = arrConcat.slice();
  8302. for(var i=0;i<arrOriginal.length;i++){
  8303. nIndex = arrTemp.indexOf(arrOriginal[i]);
  8304. if(nIndex > -1)
  8305. arrTemp.splice(nIndex, 1);
  8306. }
  8307. arrTemp = arrOriginal.concat(arrTemp);
  8308. return arrTemp;
  8309. }
  8310.  
  8311. function countUnique(arrIn){
  8312. var objCount = {
  8313. value : [],
  8314. count : [],
  8315. };
  8316.  
  8317. arrIn.forEach(function(i) {
  8318. var index = objCount.value.indexOf(i);
  8319. if (index < 0){
  8320. objCount.value.push(i);
  8321. objCount.count.push(1);
  8322. }
  8323. else {
  8324. objCount.count[index]++;
  8325. }
  8326. });
  8327.  
  8328. return objCount;
  8329. }
  8330.  
  8331. function hasDuplicate(arrIn){
  8332. var obj = countUnique(arrIn);
  8333. for (var i=0;i<obj.count.length;i++){
  8334. if(obj.count[i] > 1)
  8335. return true;
  8336. }
  8337. return false;
  8338. }
  8339.  
  8340. function countArrayElement(value, arrIn){
  8341. var count = 0;
  8342. for (var i=0;i<arrIn.length;i++){
  8343. if (arrIn[i] == value)
  8344. count++;
  8345. }
  8346. return count;
  8347. }
  8348.  
  8349. function sortWithIndices(toSort, sortType) {
  8350. var arr = toSort.slice();
  8351. var objSorted = {
  8352. value : [],
  8353. index : []
  8354. };
  8355. for (var i = 0; i < arr.length; i++) {
  8356. arr[i] = [arr[i], i];
  8357. }
  8358.  
  8359. if (sortType == "descend"){
  8360. arr.sort(function(left, right) {
  8361. return left[0] > right[0] ? -1 : 1;
  8362. });
  8363. }
  8364. else {
  8365. arr.sort(function(left, right) {
  8366. return left[0] < right[0] ? -1 : 1;
  8367. });
  8368. }
  8369.  
  8370. for (var j = 0; j < arr.length; j++) {
  8371. objSorted.value.push(arr[j][0]);
  8372. objSorted.index.push(arr[j][1]);
  8373. }
  8374. return objSorted;
  8375. }
  8376.  
  8377. function standardDeviation(values){
  8378. var avg = average(values);
  8379. var squareDiffs = values.map(function(value){
  8380. var diff = value - avg;
  8381. var sqrDiff = diff * diff;
  8382. return sqrDiff;
  8383. });
  8384.  
  8385. var avgSquareDiff = average(squareDiffs);
  8386. var stdDev = Math.sqrt(avgSquareDiff);
  8387. return stdDev;
  8388. }
  8389.  
  8390. function sumData(data){
  8391. var sum = data.reduce(function(sum, value){
  8392. return sum + value;
  8393. }, 0);
  8394.  
  8395. return sum;
  8396. }
  8397.  
  8398. function average(data){
  8399. var avg = sumData(data) / data.length;
  8400. return avg;
  8401. }
  8402.  
  8403. function moveArrayElement(arr, fromIndex, toIndex) {
  8404. arr.splice(toIndex,0,arr.splice(fromIndex,1)[0]);
  8405. }
  8406.  
  8407. function functionToHTMLString(func){
  8408. var str = func.toString();
  8409. str = str.substring(str.indexOf("{")+1, str.lastIndexOf("}"));
  8410. str = replaceAll(str, '"', '\'');
  8411. return str;
  8412. }
  8413.  
  8414. function replaceAll(str, find, replace) {
  8415. return str.replace(new RegExp(find, 'g'), replace);
  8416. }
  8417.  
  8418. function browserDetection() {
  8419. var browserName = "unknown";
  8420. var userAgentStr = navigator.userAgent.toString().toLowerCase();
  8421. if (userAgentStr.indexOf("firefox") >= 0)
  8422. browserName = "firefox";
  8423. else if (userAgentStr.indexOf("opera") >= 0 || userAgentStr.indexOf("opr/") >= 0)
  8424. browserName = "opera";
  8425. else if (userAgentStr.indexOf("chrome") >= 0)
  8426. browserName = "chrome";
  8427. setStorage('Browser', browserName);
  8428. setStorage('UserAgent', userAgentStr);
  8429. return browserName;
  8430. }
  8431.  
  8432. function setSessionStorage(name, value) {
  8433. // check if the web browser support HTML5 storage
  8434. if ('sessionStorage' in window && !isNullOrUndefined(window.sessionStorage)) {
  8435. window.sessionStorage.setItem(name, value);
  8436. }
  8437.  
  8438. name = undefined;
  8439. value = undefined;
  8440. }
  8441.  
  8442. function removeSessionStorage(name) {
  8443. // check if the web browser support HTML5 storage
  8444. if ('sessionStorage' in window && !isNullOrUndefined(window.sessionStorage)) {
  8445. window.sessionStorage.removeItem(name);
  8446. }
  8447. name = undefined;
  8448. }
  8449.  
  8450. function getSessionStorage(name) {
  8451. // check if the web browser support HTML5 storage
  8452. if ('sessionStorage' in window && !isNullOrUndefined(window.sessionStorage)) {
  8453. return (window.sessionStorage.getItem(name));
  8454. }
  8455. name = undefined;
  8456. }
  8457.  
  8458. function clearSessionStorage() {
  8459. // check if the web browser support HTML5 storage
  8460. if ('sessionStorage' in window && !isNullOrUndefined(window.sessionStorage))
  8461. window.sessionStorage.clear();
  8462. }
  8463.  
  8464. function setStorage(name, value) {
  8465. // check if the web browser support HTML5 storage
  8466. if ('localStorage' in window && !isNullOrUndefined(window.localStorage)) {
  8467. window.localStorage.setItem(name, value);
  8468. }
  8469.  
  8470. name = undefined;
  8471. value = undefined;
  8472. }
  8473.  
  8474. function removeStorage(name) {
  8475. // check if the web browser support HTML5 storage
  8476. if ('localStorage' in window && !isNullOrUndefined(window.localStorage)) {
  8477. window.localStorage.removeItem(name);
  8478. }
  8479. name = undefined;
  8480. }
  8481.  
  8482. function getStorage(name) {
  8483. // check if the web browser support HTML5 storage
  8484. if ('localStorage' in window && !isNullOrUndefined(window.localStorage)) {
  8485. return (window.localStorage.getItem(name));
  8486. }
  8487. name = undefined;
  8488. }
  8489.  
  8490. function getCookie(c_name) {
  8491. if (document.cookie.length > 0) {
  8492. var c_start = document.cookie.indexOf(c_name + "=");
  8493. if (c_start != -1) {
  8494. c_start = c_start + c_name.length + 1;
  8495. var c_end = document.cookie.indexOf(";", c_start);
  8496. if (c_end == -1) {
  8497. c_end = document.cookie.length;
  8498. }
  8499.  
  8500. var cookieString = unescape(document.cookie.substring(c_start, c_end));
  8501.  
  8502. // clean up
  8503. c_name = null;
  8504. c_start = null;
  8505. c_end = null;
  8506.  
  8507. try {
  8508. return cookieString;
  8509. }
  8510. finally {
  8511. cookieString = null;
  8512. }
  8513. }
  8514. c_start = null;
  8515. }
  8516. c_name = null;
  8517. return null;
  8518. }
  8519.  
  8520. function disarmTrap(trapSelector) {
  8521. if(trapSelector == 'weapon' || trapSelector == 'base')
  8522. return;
  8523.  
  8524. var nQuantity = parseInt(getPageVariable("user." + trapSelector + "_quantity"));
  8525. if(nQuantity === 0){
  8526. deleteArmingFromList(trapSelector);
  8527. if(isNewUI && !isArmingInList())
  8528. closeTrapSelector(trapSelector);
  8529. arming = false;
  8530. return;
  8531. }
  8532. var x;
  8533. var strTemp = "";
  8534. var intervalDisarm = setInterval(
  8535. function (){
  8536. if(arming === false){
  8537. addArmingIntoList(trapSelector);
  8538. clickTrapSelector(trapSelector);
  8539. var intervalDT = setInterval(
  8540. function () {
  8541. if(isNewUI){
  8542. x = document.getElementsByClassName('campPage-trap-itemBrowser-item-disarmButton');
  8543. if(x.length > 0){
  8544. fireEvent(x[0], 'click');
  8545. console.plog('Disarmed');
  8546. deleteArmingFromList(trapSelector);
  8547. if(isNewUI && !isArmingInList())
  8548. closeTrapSelector(trapSelector);
  8549. arming = false;
  8550. //window.setTimeout(function () { closeTrapSelector(trapSelector); }, 1000);
  8551. clearInterval(intervalDT);
  8552. intervalDT = null;
  8553. return;
  8554. }
  8555. }
  8556. else{
  8557. x = document.getElementsByClassName(trapSelector + ' canDisarm');
  8558. if (x.length > 0) {
  8559. for (var i = 0; i < x.length; ++i) {
  8560. strTemp = x[i].getAttribute('title');
  8561. if (strTemp.indexOf('Click to disarm') > -1) {
  8562. fireEvent(x[i], 'click');
  8563. console.plog('Disarmed');
  8564. deleteArmingFromList(trapSelector);
  8565. arming = false;
  8566. clearInterval(intervalDT);
  8567. intervalDT = null;
  8568. return;
  8569. }
  8570. }
  8571. }
  8572. }
  8573. }, 1000);
  8574. clearInterval(intervalDisarm);
  8575. intervalDisarm = null;
  8576. }
  8577. }, 1000);
  8578. return;
  8579. }
  8580.  
  8581. function fireEvent(element, event) {
  8582. if(element === null || element === undefined)
  8583. return;
  8584. var evt;
  8585. if (document.createEventObject) {
  8586. // dispatch for IE
  8587. evt = document.createEventObject();
  8588.  
  8589. try {
  8590. return element.fireEvent('on' + event, evt);
  8591. }
  8592. finally {
  8593. element = null;
  8594. event = null;
  8595. evt = null;
  8596. }
  8597. }
  8598. else {
  8599. // dispatch for firefox + others
  8600. evt = new MouseEvent(event, {
  8601. "bubbles": true,
  8602. "cancelable": true
  8603. });
  8604.  
  8605. try {
  8606. return !element.dispatchEvent(evt);
  8607. }
  8608. finally {
  8609. element = null;
  8610. event = null;
  8611. evt = null;
  8612. }
  8613. }
  8614. }
  8615.  
  8616. function getPageVariable(variableName) {
  8617. var value = "";
  8618. try {
  8619. if (browser == 'chrome' || browser == 'opera') {
  8620. // google chrome & opera only
  8621. var scriptElement = document.createElement("script");
  8622. scriptElement.setAttribute('id', "scriptElement");
  8623. scriptElement.setAttribute('type', "text/javascript");
  8624. scriptElement.innerHTML = "document.getElementById('scriptElement').innerText=" + variableName + ";";
  8625. document.body.appendChild(scriptElement);
  8626.  
  8627. value = scriptElement.innerHTML;
  8628. document.body.removeChild(scriptElement);
  8629. scriptElement = null;
  8630. variableName = null;
  8631. }
  8632. }
  8633. catch (e) {
  8634. console.perror('getPageVariable',e.message);
  8635. }
  8636. return value;
  8637. }
  8638.  
  8639. function timeElapsed(dateA, dateB) {
  8640. var elapsed = 0;
  8641.  
  8642. var secondA = Date.UTC(dateA.getFullYear(), dateA.getMonth(), dateA.getDate(), dateA.getHours(), dateA.getMinutes(), dateA.getSeconds());
  8643. var secondB = Date.UTC(dateB.getFullYear(), dateB.getMonth(), dateB.getDate(), dateB.getHours(), dateB.getMinutes(), dateB.getSeconds());
  8644. elapsed = (secondB - secondA) / 1000;
  8645.  
  8646. secondA = null;
  8647. secondB = null;
  8648. dateA = null;
  8649. dateB = null;
  8650.  
  8651. try {
  8652. return (elapsed);
  8653. }
  8654. finally {
  8655. elapsed = null;
  8656. }
  8657. }
  8658.  
  8659. function timeFormat(time) {
  8660. var timeString;
  8661. var hr = Math.floor(time / 3600);
  8662. var min = Math.floor((time % 3600) / 60);
  8663. var sec = (time % 3600 % 60) % 60;
  8664.  
  8665. if (hr > 0) {
  8666. timeString = hr.toString() + " hr " + min.toString() + " min " + sec.toString() + " sec";
  8667. }
  8668. else if (min > 0) {
  8669. timeString = min.toString() + " min " + sec.toString() + " sec";
  8670. }
  8671. else {
  8672. timeString = sec.toString() + " sec";
  8673. }
  8674.  
  8675. time = null;
  8676. hr = null;
  8677. min = null;
  8678. sec = null;
  8679.  
  8680. try {
  8681. return (timeString);
  8682. }
  8683. finally {
  8684. timeString = null;
  8685. }
  8686. }
  8687.  
  8688. function timeFormatLong(time) {
  8689. var timeString;
  8690.  
  8691. if (time != -1) {
  8692. var day = Math.floor(time / 86400);
  8693. var hr = Math.floor((time % 86400) / 3600);
  8694. var min = Math.floor((time % 3600) / 60);
  8695.  
  8696. if (day > 0) {
  8697. timeString = day.toString() + " day " + hr.toString() + " hr " + min.toString() + " min ago";
  8698. }
  8699. else if (hr > 0) {
  8700. timeString = hr.toString() + " hr " + min.toString() + " min ago";
  8701. }
  8702. else if (min > 0) {
  8703. timeString = min.toString() + " min ago";
  8704. }
  8705.  
  8706. day = null;
  8707. hr = null;
  8708. min = null;
  8709. }
  8710. else {
  8711. timeString = null;
  8712. }
  8713.  
  8714. time = null;
  8715.  
  8716. try {
  8717. return (timeString);
  8718. }
  8719. finally {
  8720. timeString = null;
  8721. }
  8722. }
  8723. // ################################################################################################
  8724. // General Function - End
  8725. // ################################################################################################
  8726.  
  8727. // ################################################################################################
  8728. // HTML Function - Start
  8729. // ################################################################################################
  8730. function refreshTrapList() {
  8731. try {
  8732. var objUserHash = {
  8733. uh : user.unique_hash
  8734. };
  8735.  
  8736. jQuery.ajax({
  8737. type: 'POST',
  8738. url: '/managers/ajax/users/gettrapcomponents.php',
  8739. data: objUserHash,
  8740. contentType: 'text/plain',
  8741. dataType: 'json',
  8742. xhrFields: {
  8743. withCredentials: false
  8744. },
  8745. timeout: 10000,
  8746. statusCode: {
  8747. 200: function () {}
  8748. },
  8749. success: function (data){
  8750. var objTrap = {
  8751. weapon : [],
  8752. base : [],
  8753. trinket : [],
  8754. bait : []
  8755. };
  8756. for (var i=0;i<data.components.length;i++){
  8757. if (data.components[i].classification == 'skin')
  8758. continue;
  8759. objTrap[data.components[i].classification].push(data.components[i].name);
  8760. }
  8761. window.localStorage.setItem('TrapListWeapon', objTrap.weapon.join());
  8762. window.localStorage.setItem('TrapListBase', objTrap.base.join());
  8763. window.localStorage.setItem('TrapListTrinket', objTrap.trinket.join());
  8764. window.localStorage.setItem('TrapListBait', objTrap.bait.join());
  8765. },
  8766. error: function (error){
  8767. console.perror('refreshTrapList:',error);
  8768. }
  8769. });
  8770. } catch (e) {
  8771. console.perror('refreshTrapList',e.message);
  8772. }
  8773. }
  8774.  
  8775. function bodyJS(){
  8776. var objDefaultFGAR = {
  8777. order : ['FG','AR'],
  8778. weapon : new Array(2).fill(''),
  8779. base : new Array(2).fill(''),
  8780. trinket : new Array(2).fill(''),
  8781. bait : new Array(2).fill('')
  8782. };
  8783. var objDefaultBCJOD = {
  8784. order : ['JOD','LOW','MID','HIGH'],
  8785. weapon : new Array(4).fill(''),
  8786. base : new Array(4).fill(''),
  8787. trinket : new Array(4).fill(''),
  8788. bait : new Array(4).fill('')
  8789. };
  8790. var objDefaultBWRift = {
  8791. order : ['NONE','GEARWORKS','ANCIENT','RUNIC','TIMEWARP','GUARD','SECURITY','FROZEN','FURNACE','INGRESS','PURSUER','ACOLYTE_CHARGING','ACOLYTE_DRAINING','ACOLYTE_DRAINED','LUCKY','HIDDEN'],
  8792. master : {
  8793. weapon : new Array(32).fill('Mysteriously unYielding'),
  8794. base : new Array(32).fill('Fissure Base'),
  8795. trinket : new Array(32).fill('Rift Vacuum Charm'),
  8796. bait : new Array(32).fill('Brie String'),
  8797. activate : new Array(32).fill(false),
  8798. },
  8799. specialActivate : {
  8800. forceActivate : new Array(32).fill(false),
  8801. remainingLootActivate : new Array(32).fill(1),
  8802. forceDeactivate : new Array(32).fill(false),
  8803. remainingLootDeactivate : new Array(32).fill(1)
  8804. },
  8805. gw : {
  8806. weapon : new Array(4).fill('MASTER'),
  8807. base : new Array(4).fill('MASTER'),
  8808. trinket : new Array(4).fill('MASTER'),
  8809. bait : new Array(4).fill('MASTER'),
  8810. activate : new Array(4).fill('MASTER'),
  8811. },
  8812. al : {
  8813. weapon : new Array(4).fill('MASTER'),
  8814. base : new Array(4).fill('MASTER'),
  8815. trinket : new Array(4).fill('MASTER'),
  8816. bait : new Array(4).fill('MASTER'),
  8817. activate : new Array(4).fill('MASTER'),
  8818. },
  8819. rl : {
  8820. weapon : new Array(4).fill('MASTER'),
  8821. base : new Array(4).fill('MASTER'),
  8822. trinket : new Array(4).fill('MASTER'),
  8823. bait : new Array(4).fill('MASTER'),
  8824. activate : new Array(4).fill('MASTER'),
  8825. },
  8826. gb : {
  8827. weapon : new Array(14).fill('MASTER'),
  8828. base : new Array(14).fill('MASTER'),
  8829. trinket : new Array(14).fill('MASTER'),
  8830. bait : new Array(14).fill('MASTER'),
  8831. activate : new Array(14).fill('MASTER'),
  8832. },
  8833. ic : {
  8834. weapon : new Array(8).fill('MASTER'),
  8835. base : new Array(8).fill('MASTER'),
  8836. trinket : new Array(8).fill('MASTER'),
  8837. bait : new Array(8).fill('MASTER'),
  8838. activate : new Array(8).fill('MASTER'),
  8839. },
  8840. fa : {
  8841. weapon : new Array(32).fill('MASTER'),
  8842. base : new Array(32).fill('MASTER'),
  8843. trinket : new Array(32).fill('MASTER'),
  8844. bait : new Array(32).fill('MASTER'),
  8845. activate : new Array(32).fill('MASTER'),
  8846. },
  8847. choosePortal : false,
  8848. choosePortalAfterCC : false,
  8849. priorities : ['SECURITY', 'FURNACE', 'PURSUER', 'ACOLYTE', 'LUCKY', 'HIDDEN', 'TIMEWARP', 'RUNIC', 'ANCIENT', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS'],
  8850. prioritiesCursed : ['SECURITY', 'FURNACE', 'PURSUER', 'ANCIENT', 'GEARWORKS', 'RUNIC', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS', 'GEARWORKS'],
  8851. minTimeSand : [70,70,50,50,50,50,40,40,999],
  8852. minRSCType : 'NUMBER',
  8853. minRSC : 0,
  8854. enterMinigameWCurse : false
  8855. };
  8856.  
  8857. function limitMinMax(value, min, max){
  8858. value = parseInt(value);
  8859. min = parseInt(min);
  8860. max = parseInt(max);
  8861. if(value < min)
  8862. value = min;
  8863. else if(value > max)
  8864. value = max;
  8865. return value;
  8866. }
  8867.  
  8868. function isNullOrUndefined(obj){
  8869. return (obj === null || obj === undefined || obj === 'null' || obj === 'undefined' || (Array.isArray(obj) && obj.length === 0));
  8870. }
  8871.  
  8872. function onIdRestoreClicked(){
  8873. var idRestore = document.getElementById('idRestore');
  8874. var inputFiles = document.getElementById('inputFiles');
  8875. if (window.FileReader) {
  8876. if(inputFiles && window.sessionStorage.getItem('bRestart') != 'true'){
  8877. inputFiles.click();
  8878. }
  8879. }
  8880. else {
  8881. alert('The File APIs are not fully supported in this browser.');
  8882. }
  8883. }
  8884.  
  8885. function handleFiles(files) {
  8886. if(files.length < 1)
  8887. return;
  8888. var reader = new FileReader();
  8889. reader.onloadend = function(evt) {
  8890. if (evt.target.readyState == FileReader.DONE) { // DONE == 2
  8891. var arr = evt.target.result.split('\r\n');
  8892. var arrSplit = [];
  8893. var bRestart = false;
  8894. var nIndex = -1;
  8895. var temp = "";
  8896. for(var i=0;i<arr.length;i++){
  8897. if(arr[i].indexOf('|') > -1){
  8898. arrSplit = arr[i].split('|');
  8899. if(arrSplit.length == 2){
  8900. nIndex = arrSplit[0].indexOf('Z');
  8901. temp = (nIndex > -1) ? arrSplit[0].substr(0,nIndex+1) : arrSplit[0];
  8902. if(Number.isNaN(Date.parse(temp))){
  8903. console.log(arrSplit);
  8904. window.localStorage.setItem(arrSplit[0], arrSplit[1]);
  8905. window.sessionStorage.setItem(arrSplit[0], arrSplit[1]);
  8906. bRestart = true;
  8907. }
  8908. }
  8909. }
  8910. }
  8911. if(bRestart){
  8912. alert('Please restart browser to take effect!');
  8913. window.sessionStorage.setItem('bRestart', 'true');
  8914. document.getElementById('idRestore').firstChild.textContent = 'Restart browser is required!';
  8915. document.getElementById('idRestore').style = "color:red";
  8916. }
  8917. else{
  8918. alert('Invalid preference file!');
  8919. }
  8920. }
  8921. };
  8922. var blob = files[0].slice(0, files[0].size);
  8923. reader.readAsText(blob);
  8924. }
  8925.  
  8926. function onIdAdsClicked(){
  8927. document.getElementById('inputShowAds').value = 'Loading Ads...';
  8928. document.getElementById('inputShowAds').disabled = 'disabled';
  8929. var xmlHttp = new XMLHttpRequest();
  8930. xmlHttp.onreadystatechange = function() {
  8931. if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
  8932. document.getElementById('inputShowAds').value = 'Click to Show Ads';
  8933. document.getElementById('inputShowAds').disabled = '';
  8934. var arr = xmlHttp.responseText.split("\r\n");
  8935. console.log(arr);
  8936. var win;
  8937. for(var i=0;i<arr.length;i++){
  8938. if(arr[i].indexOf("http") === 0){
  8939. win = window.open(arr[i]);
  8940. if(!win){
  8941. alert("Please allow popups for this site");
  8942. return;
  8943. }
  8944. }
  8945. }
  8946. }
  8947. };
  8948. xmlHttp.open("GET", "https://dl.dropboxusercontent.com/s/3cbo6en86lrpas1/Test.txt", true); // true for asynchronous
  8949. xmlHttp.send(null);
  8950. window.setTimeout(function () {
  8951. document.getElementById('inputShowAds').value = 'Click to Show Ads';
  8952. document.getElementById('inputShowAds').disabled = '';
  8953. }, 5000);
  8954. }
  8955.  
  8956. function onIdGetLogPreferenceClicked(){
  8957. var i;
  8958. var str = "";
  8959. var strKeyName = "";
  8960. var arrTimestamp = [];
  8961. var arrValue = [];
  8962. for(i=0;i<window.localStorage.length;i++){
  8963. strKeyName = window.localStorage.key(i);
  8964. if(strKeyName.indexOf('KR') === 0)
  8965. continue;
  8966. str += strKeyName + '|' + window.localStorage.getItem(strKeyName);
  8967. str += "\r\n";
  8968. }
  8969. for(i=0;i<window.sessionStorage.length;i++){
  8970. strKeyName = window.sessionStorage.key(i);
  8971. if(strKeyName.indexOf('Log_') > -1){
  8972. arrTimestamp.push(parseFloat(strKeyName.split('_')[1]));
  8973. arrValue.push(window.sessionStorage.getItem(strKeyName));
  8974. }
  8975. }
  8976. arrTimestamp = arrTimestamp.sort();
  8977. var nTimezoneOffset = -(new Date().getTimezoneOffset()) * 60000;
  8978. for(i=0;i<arrTimestamp.length;i++){
  8979. if(Number.isNaN(arrTimestamp[i]))
  8980. strKeyName = arrTimestamp[i];
  8981. else{
  8982. arrTimestamp[i] += nTimezoneOffset;
  8983. strKeyName = (new Date(arrTimestamp[i])).toISOString();
  8984. strKeyName += '.' + arrTimestamp[i].toFixed(3).split('.')[1];
  8985. }
  8986. str += strKeyName + "|" + arrValue[i];
  8987. str += "\r\n";
  8988. }
  8989. saveFile(str,'log_preference.txt');
  8990. }
  8991.  
  8992. function saveFile(content, filename){
  8993. var pom = document.createElement('a');
  8994. pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(content));
  8995. pom.setAttribute('download', filename);
  8996.  
  8997. if (document.createEvent) {
  8998. var event = document.createEvent('MouseEvents');
  8999. event.initEvent('click', true, true);
  9000. pom.dispatchEvent(event);
  9001. }
  9002. else {
  9003. pom.click();
  9004. }
  9005. }
  9006.  
  9007. function onSelectSpecialFeature(){
  9008. saveSpecialFeature();
  9009. }
  9010.  
  9011. function saveSpecialFeature(){
  9012. var selectSpecialFeature = document.getElementById('selectSpecialFeature');
  9013. window.sessionStorage.setItem('SpecialFeature', selectSpecialFeature.value);
  9014. }
  9015.  
  9016. function initControlsSpecialFeature(){
  9017. var selectSpecialFeature = document.getElementById('selectSpecialFeature');
  9018. var storageValue = window.sessionStorage.getItem('SpecialFeature');
  9019. if(storageValue === null || storageValue === undefined){
  9020. storageValue = 'None';
  9021. }
  9022. selectSpecialFeature.value = storageValue;
  9023. }
  9024.  
  9025. function onSelectMapHuntingChanged(){
  9026. saveMapHunting();
  9027. initControlsMapHunting();
  9028. }
  9029.  
  9030. function saveMapHunting(){
  9031. var selectMapHunting = document.getElementById('selectMapHunting');
  9032. var selectMouseList = document.getElementById('selectMouseList');
  9033. var selectWeapon = document.getElementById('selectWeapon');
  9034. var selectBase = document.getElementById('selectBase');
  9035. var selectTrinket = document.getElementById('selectTrinket');
  9036. var selectBait = document.getElementById('selectBait');
  9037. var selectLeaveMap = document.getElementById('selectLeaveMap');
  9038. var inputUncaughtMouse = document.getElementById('inputUncaughtMouse');
  9039. var selectCatchLogic = document.getElementById('selectCatchLogic');
  9040. var objDefaultMapHunting = {
  9041. status : false,
  9042. selectedMouse : [],
  9043. logic : 'OR',
  9044. weapon : 'Remain',
  9045. base : 'Remain',
  9046. trinket : 'Remain',
  9047. bait : 'Remain',
  9048. leave : false
  9049. };
  9050. var storageValue = JSON.parse(window.sessionStorage.getItem('MapHunting'));
  9051. if(isNullOrUndefined(storageValue))
  9052. storageValue = objDefaultMapHunting;
  9053. storageValue.status = (selectMapHunting.value == 'true');
  9054. if(inputUncaughtMouse.value === '')
  9055. storageValue.selectedMouse = [];
  9056. else
  9057. storageValue.selectedMouse = inputUncaughtMouse.value.split(',');
  9058. storageValue.logic = selectCatchLogic.value;
  9059. storageValue.weapon = selectWeapon.value;
  9060. storageValue.base = selectBase.value;
  9061. storageValue.trinket = selectTrinket.value;
  9062. storageValue.bait = selectBait.value;
  9063. storageValue.leave = (selectLeaveMap.value == 'true');
  9064. window.sessionStorage.setItem('MapHunting', JSON.stringify(storageValue));
  9065. }
  9066.  
  9067. function initControlsMapHunting(){
  9068. var trUncaughtMouse = document.getElementById('trUncaughtMouse');
  9069. var trSelectedUncaughtMouse = document.getElementById('trSelectedUncaughtMouse');
  9070. var trCatchLogic = document.getElementById('trCatchLogic');
  9071. var selectMapHunting = document.getElementById('selectMapHunting');
  9072. var selectMouseList = document.getElementById('selectMouseList');
  9073. var trMapHuntingTrapSetup = document.getElementById('trMapHuntingTrapSetup');
  9074. var trMapHuntingLeave = document.getElementById('trMapHuntingLeave');
  9075. var inputUncaughtMouse = document.getElementById('inputUncaughtMouse');
  9076. var selectCatchLogic = document.getElementById('selectCatchLogic');
  9077. var selectWeapon = document.getElementById('selectWeapon');
  9078. var selectBase = document.getElementById('selectBase');
  9079. var selectTrinket = document.getElementById('selectTrinket');
  9080. var selectBait = document.getElementById('selectBait');
  9081. var selectLeaveMap = document.getElementById('selectLeaveMap');
  9082. var storageValue = window.sessionStorage.getItem('MapHunting');
  9083. if(isNullOrUndefined(storageValue)){
  9084. selectMapHunting.selectedIndex = 0;
  9085. trUncaughtMouse.style.display = 'none';
  9086. trMapHuntingTrapSetup.style.display = 'none';
  9087. trMapHuntingLeave.style.display = 'none';
  9088. inputUncaughtMouse.value = '';
  9089. selectCatchLogic.selectedIndex = -1;
  9090. selectWeapon.selectedIndex = -1;
  9091. selectBase.selectedIndex = -1;
  9092. selectTrinket.selectedIndex = -1;
  9093. selectBait.selectedIndex = -1;
  9094. selectLeaveMap.selectedIndex = -1;
  9095. }
  9096. else{
  9097. storageValue = JSON.parse(storageValue);
  9098. selectMapHunting.value = storageValue.status;
  9099. trUncaughtMouse.style.display = (storageValue.status) ? 'table-row' : 'none';
  9100. trSelectedUncaughtMouse.style.display = (storageValue.status) ? 'table-row' : 'none';
  9101. trCatchLogic.style.display = (storageValue.status) ? 'table-row' : 'none';
  9102. trMapHuntingTrapSetup.style.display = (storageValue.status) ? 'table-row' : 'none';
  9103. trMapHuntingLeave.style.display = (storageValue.status) ? 'table-row' : 'none';
  9104. inputUncaughtMouse.value = storageValue.selectedMouse.join(',');
  9105. selectCatchLogic.value = storageValue.logic;
  9106. selectWeapon.value = storageValue.weapon;
  9107. selectBase.value = storageValue.base;
  9108. selectTrinket.value = storageValue.trinket;
  9109. selectBait.value = storageValue.bait;
  9110. selectLeaveMap.value = storageValue.leave;
  9111. }
  9112. storageValue = window.localStorage.getItem('Last Record Uncaught');
  9113. if(!isNullOrUndefined(storageValue)){
  9114. storageValue = storageValue.split(",");
  9115. var i;
  9116. for(i = selectMouseList.options.length-1 ; i >= 0 ; i--){
  9117. selectMouseList.remove(i);
  9118. }
  9119. var optionEle;
  9120. for(i=0;i<storageValue.length;i++){
  9121. optionEle = document.createElement("option");
  9122. optionEle.setAttribute('value', storageValue[i]);
  9123. optionEle.textContent = storageValue[i];
  9124. selectMouseList.appendChild(optionEle);
  9125. }
  9126. }
  9127. document.getElementById('inputSelectMouse').disabled = (selectMouseList.options.length > 0) ? '' : 'disabled';
  9128. }
  9129.  
  9130. function onInputSelectMouse(){
  9131. var inputUncaughtMouse = document.getElementById('inputUncaughtMouse');
  9132. var selectMouseList = document.getElementById('selectMouseList');
  9133. if(inputUncaughtMouse.value.indexOf(selectMouseList.value) < 0){
  9134. if(inputUncaughtMouse.value.length !== 0)
  9135. inputUncaughtMouse.value = selectMouseList.value + ',' + inputUncaughtMouse.value;
  9136. else
  9137. inputUncaughtMouse.value = selectMouseList.value;
  9138. }
  9139. saveMapHunting();
  9140. }
  9141.  
  9142. function onInputGetMouse(){
  9143. var classTreasureMap = document.getElementsByClassName('mousehuntHud-userStat treasureMap')[0];
  9144. if(classTreasureMap.children[2].textContent.toLowerCase().indexOf('remaining') < 0)
  9145. return;
  9146.  
  9147. document.getElementById('inputGetMouse').value = 'Processing...';
  9148. document.getElementById('inputGetMouse').disabled = 'disabled';
  9149. try {
  9150. var objData = {
  9151. sn : 'Hitgrab',
  9152. hg_is_ajax : 1,
  9153. action : 'info',
  9154. uh : user.unique_hash
  9155. };
  9156.  
  9157. jQuery.ajax({
  9158. type: 'POST',
  9159. url: '/managers/ajax/users/relichunter.php',
  9160. data: objData,
  9161. contentType: 'application/x-www-form-urlencoded',
  9162. dataType: 'json',
  9163. xhrFields: {
  9164. withCredentials: false
  9165. },
  9166. success: function (data){
  9167. document.getElementById('inputGetMouse').value = 'Refresh Uncaught Mouse List';
  9168. document.getElementById('inputGetMouse').disabled = '';
  9169. console.log(data.treasure_map);
  9170. if(data.treasure_map.groups !== null && data.treasure_map.groups !== undefined){
  9171. var arrUncaught = [];
  9172. for(var i=0;i<data.treasure_map.groups.length;i++){
  9173. if(data.treasure_map.groups[i].is_uncaught === true){
  9174. for(var j=0;j<data.treasure_map.groups[i].mice.length;j++){
  9175. arrUncaught.push(data.treasure_map.groups[i].mice[j].name);
  9176. }
  9177. }
  9178. }
  9179. window.localStorage.setItem('Last Record Uncaught', arrUncaught.join(","));
  9180. initControlsMapHunting();
  9181. }
  9182. },
  9183. error: function (error){
  9184. document.getElementById('inputGetMouse').value = 'Refresh Uncaught Mouse List';
  9185. document.getElementById('inputGetMouse').disabled = '';
  9186. console.error('onInputGetMouse ajax:',error);
  9187. }
  9188. });
  9189. }
  9190. catch (e) {
  9191. document.getElementById('inputGetMouse').value = 'Refresh Uncaught Mouse List';
  9192. document.getElementById('inputGetMouse').disabled = '';
  9193. console.error('onInputGetMouse',e.message);
  9194. }
  9195. }
  9196.  
  9197. function onInputClearUncaughtMouse(){
  9198. document.getElementById('inputUncaughtMouse').value = "";
  9199. saveMapHunting();
  9200. }
  9201.  
  9202. var arrKey = ['SCCustom','Labyrinth','LGArea','eventLocation','FW','BRCustom','SGarden','Zokor','FRift','MapHunting','ZTower','BestTrap','Iceberg','WWRift','GES','FRox','GWH2016R','SpecialFeature','BWRift','BC_JOD','FG_AR'];
  9203. function setLocalToSession(){
  9204. var i, j, key;
  9205. for(i=0;i<window.localStorage.length;i++){
  9206. key = window.localStorage.key(i);
  9207. for(j=0;j<arrKey.length;j++){
  9208. if(key.indexOf(arrKey[j]) > -1){
  9209. window.sessionStorage.setItem(key, window.localStorage.getItem(key));
  9210. break;
  9211. }
  9212. }
  9213. }
  9214. }
  9215.  
  9216. function setSessionToLocal(){
  9217. if(window.sessionStorage.length===0)
  9218. return;
  9219.  
  9220. var i, j, key;
  9221. for(i=0;i<window.sessionStorage.length;i++){
  9222. key = window.sessionStorage.key(i);
  9223. for(j=0;j<arrKey.length;j++){
  9224. if(key.indexOf(arrKey[j]) > -1){
  9225. window.localStorage.setItem(key, window.sessionStorage.getItem(key));
  9226. break;
  9227. }
  9228. }
  9229. }
  9230. }
  9231.  
  9232. function onInputResetReload(){
  9233. var strValue = document.getElementById('eventAlgo').value;
  9234. var keyName;
  9235. if(strValue == 'Burroughs Rift Custom') keyName = 'BRCustom';
  9236. else if(strValue == 'All LG Area') keyName = 'LGArea';
  9237. else if(strValue == 'SG') keyName = 'SGarden';
  9238. else if(strValue == 'ZT') keyName = 'ZTower';
  9239. else if(strValue == 'Sunken City Custom') keyName = 'SCCustom';
  9240. else if(strValue == 'Labyrinth') keyName = 'Labyrinth';
  9241. else if(strValue == 'Zokor') keyName = 'Zokor';
  9242. else if(strValue == 'Fiery Warpath') keyName = 'FW';
  9243. else if(strValue == 'Furoma Rift') keyName = 'FRift';
  9244. else if(strValue == 'Iceberg') keyName = 'Iceberg';
  9245. else if(strValue == 'WWRift') keyName = 'WWRift';
  9246. else if(strValue == 'GES') keyName = 'GES';
  9247. else if(strValue == 'Fort Rox') keyName = 'FRox';
  9248. else if(strValue == 'GWH2016R') keyName = 'GWH2016R';
  9249. else if(strValue == 'Bristle Woods Rift') keyName = 'BWRift';
  9250. else if(strValue == 'BC/JOD') keyName = 'BC_JOD';
  9251. else if(strValue == 'FG/AR') keyName = 'FG_AR';
  9252.  
  9253. if(!isNullOrUndefined(keyName)){
  9254. window.sessionStorage.removeItem(keyName);
  9255. window.localStorage.removeItem(keyName);
  9256. }
  9257. }
  9258.  
  9259. function initControlsBestTrap(){
  9260. var selectBestTrapPowerType = document.getElementById('selectBestTrapPowerType');
  9261. var selectBestTrapWeapon = document.getElementById('selectBestTrapWeapon');
  9262. var selectBestTrapBaseType = document.getElementById('selectBestTrapBaseType');
  9263. var selectBestTrapBase = document.getElementById('selectBestTrapBase');
  9264. var storageValue = window.sessionStorage.getItem('BestTrap');
  9265. if (isNullOrUndefined(storageValue)){
  9266. selectBestTrapWeapon.selectedIndex = -1;
  9267. selectBestTrapBase.selectedIndex = -1;
  9268. }
  9269. else{
  9270. storageValue = JSON.parse(storageValue);
  9271. selectBestTrapWeapon.value = storageValue.weapon[selectBestTrapPowerType.value];
  9272. selectBestTrapBase.value = storageValue.base[selectBestTrapBaseType.value];
  9273. }
  9274. }
  9275.  
  9276. function saveBestTrap(){
  9277. var selectBestTrapPowerType = document.getElementById('selectBestTrapPowerType');
  9278. var selectBestTrapWeapon = document.getElementById('selectBestTrapWeapon');
  9279. var selectBestTrapBaseType = document.getElementById('selectBestTrapBaseType');
  9280. var selectBestTrapBase = document.getElementById('selectBestTrapBase');
  9281. var storageValue = window.sessionStorage.getItem('BestTrap');
  9282. if (isNullOrUndefined(storageValue)){
  9283. var objBestTrapDefault = {
  9284. weapon : {
  9285. arcane : '',
  9286. draconic : '',
  9287. forgotten : '',
  9288. hydro : '',
  9289. law : '',
  9290. physical : '',
  9291. rift : '',
  9292. shadow : '',
  9293. tactical : ''
  9294. },
  9295. base : {
  9296. luck : '',
  9297. power : ''
  9298. }
  9299. };
  9300. storageValue = JSON.stringify(objBestTrapDefault);
  9301. }
  9302.  
  9303. storageValue = JSON.parse(storageValue);
  9304. storageValue.weapon[selectBestTrapPowerType.value] = selectBestTrapWeapon.value;
  9305. storageValue.base[selectBestTrapBaseType.value] = selectBestTrapBase.value;
  9306. window.sessionStorage.setItem('BestTrap', JSON.stringify(storageValue));
  9307. }
  9308.  
  9309. function onInputMinAAChanged(input){
  9310. input.value = limitMinMax(input.value, input.min, input.max);
  9311. saveGWH2016();
  9312. }
  9313.  
  9314. function onInputMinWorkChanged(input){
  9315. input.value = limitMinMax(input.value, input.min, input.max);
  9316. saveGWH2016();
  9317. }
  9318.  
  9319. function onSelectGWHTrinketChanged(){
  9320. saveGWH2016();
  9321. initControlsGWH2016();
  9322. }
  9323.  
  9324. function initControlsGWH2016(bAutoChangeZone){
  9325. if(isNullOrUndefined(bAutoChangeZone))
  9326. bAutoChangeZone = false;
  9327. var selectGWHZone = document.getElementById('selectGWHZone');
  9328. var selectGWHWeapon = document.getElementById('selectGWHWeapon');
  9329. var selectGWHBase = document.getElementById('selectGWHBase');
  9330. var selectGWHTrinket = document.getElementById('selectGWHTrinket');
  9331. var selectGWHBait = document.getElementById('selectGWHBait');
  9332. var selectGWHBoost = document.getElementById('selectGWHBoost');
  9333. var selectGWHUseTurboBoost = document.getElementById('selectGWHUseTurboBoost');
  9334. var inputMinAA = document.getElementById('inputMinAA');
  9335. var inputMinFirework = document.getElementById('inputMinFirework');
  9336. var selectGWHLandAfterRunOutFirework = document.getElementById('selectGWHLandAfterRunOutFirework');
  9337. var storageValue = window.sessionStorage.getItem('GWH2016R');
  9338. if(isNullOrUndefined(storageValue)){
  9339. selectGWHWeapon.selectedIndex = -1;
  9340. selectGWHBase.selectedIndex = -1;
  9341. selectGWHTrinket.selectedIndex = -1;
  9342. selectGWHBait.selectedIndex = -1;
  9343. selectGWHBoost.selectedIndex = -1;
  9344. selectGWHUseTurboBoost.selectedIndex = 0;
  9345. inputMinAA.value = 20;
  9346. inputMinFirework.value = 20;
  9347. selectGWHLandAfterRunOutFirework.selectedIndex = 0;
  9348. }
  9349. else{
  9350. storageValue = JSON.parse(storageValue);
  9351. var nIndex = storageValue.zone.indexOf(selectGWHZone.value);
  9352. selectGWHWeapon.value = storageValue.weapon[nIndex];
  9353. selectGWHBase.value = storageValue.base[nIndex];
  9354. selectGWHTrinket.value = storageValue.trinket[nIndex];
  9355. selectGWHBait.value = storageValue.bait[nIndex];
  9356. selectGWHBoost.value = (storageValue.boost[nIndex] === true) ? 'true' : 'false';
  9357. selectGWHBoost.disabled = (selectGWHTrinket.value.toUpperCase().indexOf('ANCHOR') > -1) ? 'disabled' : '';
  9358. selectGWHUseTurboBoost.value = (storageValue.turbo === true) ? 'true' : 'false';
  9359. inputMinAA.value = storageValue.minAAToFly;
  9360. inputMinFirework.value = storageValue.minFireworkToFly;
  9361. selectGWHLandAfterRunOutFirework.value = (storageValue.landAfterFireworkRunOut === true) ? 'true' : 'false';
  9362. }
  9363. }
  9364.  
  9365. function saveGWH2016(){
  9366. var selectGWHZone = document.getElementById('selectGWHZone');
  9367. var selectGWHWeapon = document.getElementById('selectGWHWeapon');
  9368. var selectGWHBase = document.getElementById('selectGWHBase');
  9369. var selectGWHTrinket = document.getElementById('selectGWHTrinket');
  9370. var selectGWHBait = document.getElementById('selectGWHBait');
  9371. var selectGWHBoost = document.getElementById('selectGWHBoost');
  9372. var selectGWHUseTurboBoost = document.getElementById('selectGWHUseTurboBoost');
  9373. var inputMinAA = document.getElementById('inputMinAA');
  9374. var inputMinFirework = document.getElementById('inputMinFirework');
  9375. var selectGWHLandAfterRunOutFirework = document.getElementById('selectGWHLandAfterRunOutFirework');
  9376. var storageValue = window.sessionStorage.getItem('GWH2016R');
  9377. if(isNullOrUndefined(storageValue)){
  9378. var objDefaultGWH2016 = {
  9379. zone : ['ORDER1','ORDER2','NONORDER1','NONORDER2','WINTER_WASTELAND','SNOWBALL_STORM','FLYING','NEW_YEAR\'S_PARTY'],
  9380. weapon : new Array(8).fill(''),
  9381. base : new Array(8).fill(''),
  9382. trinket : new Array(8).fill(''),
  9383. bait : new Array(8).fill(''),
  9384. boost : new Array(8).fill(false),
  9385. turbo : false,
  9386. minAAToFly : 20,
  9387. minFireworkToFly : 20,
  9388. landAfterFireworkRunOut : false
  9389. };
  9390. storageValue = JSON.stringify(objDefaultGWH2016);
  9391. }
  9392. storageValue = JSON.parse(storageValue);
  9393. var nIndex = storageValue.zone.indexOf(selectGWHZone.value);
  9394. storageValue.weapon[nIndex] = selectGWHWeapon.value;
  9395. storageValue.base[nIndex] = selectGWHBase.value;
  9396. storageValue.trinket[nIndex] = selectGWHTrinket.value;
  9397. storageValue.bait[nIndex] = selectGWHBait.value;
  9398. storageValue.boost[nIndex] = (selectGWHTrinket.value.toUpperCase().indexOf('ANCHOR') > -1) ? false : (selectGWHBoost.value == 'true');
  9399. storageValue.turbo = (selectGWHUseTurboBoost.value == 'true');
  9400. storageValue.minAAToFly = parseInt(inputMinAA.value);
  9401. storageValue.minFireworkToFly = parseInt(inputMinFirework.value);
  9402. storageValue.landAfterFireworkRunOut = (selectGWHLandAfterRunOutFirework.value == 'true');
  9403. window.sessionStorage.setItem('GWH2016R', JSON.stringify(storageValue));
  9404. }
  9405.  
  9406. function initControlsSCCustom(bAutoChangeZone){
  9407. if(isNullOrUndefined(bAutoChangeZone))
  9408. bAutoChangeZone = false;
  9409. var selectSCHuntZone = document.getElementById('selectSCHuntZone');
  9410. var selectSCHuntZoneEnable = document.getElementById('selectSCHuntZoneEnable');
  9411. var selectSCHuntBait = document.getElementById('selectSCHuntBait');
  9412. var selectSCHuntTrinket = document.getElementById('selectSCHuntTrinket');
  9413. var selectSCUseSmartJet = document.getElementById('selectSCUseSmartJet');
  9414. var storageValue = window.sessionStorage.getItem('SCCustom');
  9415. if(isNullOrUndefined(storageValue)){
  9416. var objDefaultSCCustom = {
  9417. zone : ['ZONE_NOT_DIVE','ZONE_DEFAULT','ZONE_CORAL','ZONE_SCALE','ZONE_BARNACLE','ZONE_TREASURE','ZONE_DANGER','ZONE_DANGER_PP','ZONE_OXYGEN','ZONE_BONUS','ZONE_DANGER_PP_LOTA'],
  9418. zoneID : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
  9419. isHunt : new Array(11).fill(true),
  9420. bait : new Array(11).fill('Gouda'),
  9421. trinket : new Array(11).fill('None'),
  9422. useSmartJet : false
  9423. };
  9424. storageValue = JSON.stringify(objDefaultSCCustom);
  9425. }
  9426.  
  9427. storageValue = JSON.parse(storageValue);
  9428. if(bAutoChangeZone && !isNullOrUndefined(user) && user.environment_name.indexOf('Sunken City') > -1){
  9429. var zone = document.getElementsByClassName('zoneName')[0].innerText;
  9430. var objZone = {
  9431. 'ZONE_TREASURE' : ['Sand Dollar Sea Bar', 'Pearl Patch', 'Sunken Treasure'],
  9432. 'ZONE_DANGER' : ['Feeding Grounds', 'Carnivore Cove'],
  9433. 'ZONE_DANGER_PP' : ['Monster Trench'],
  9434. 'ZONE_DANGER_PP_LOTA' : ['Lair of the Ancients'],
  9435. 'ZONE_OXYGEN' : ['Deep Oxygen Stream', 'Oxygen Stream'],
  9436. 'ZONE_BONUS' : ['Magma Flow'],
  9437. 'ZONE_CORAL' : ['Coral Reef', 'Coral Garden', 'Coral Castle'],
  9438. 'ZONE_SCALE' : ['School of Mice', 'Mermouse Den', 'Lost Ruins'],
  9439. 'ZONE_BARNACLE' : ['Rocky Outcrop', 'Shipwreck', 'Haunted Shipwreck'],
  9440. 'ZONE_DEFAULT' : ['Shallow Shoals', 'Sea Floor', 'Murky Depths'],
  9441. };
  9442. selectSCHuntZone.selectedIndex = 0;
  9443. for(var prop in objZone){
  9444. if(objZone.hasOwnProperty(prop)){
  9445. if(objZone[prop].indexOf(zone) > -1){
  9446. selectSCHuntZone.value = prop;
  9447. break;
  9448. }
  9449. }
  9450. }
  9451. }
  9452. var nIndex = storageValue.zone.indexOf(selectSCHuntZone.value);
  9453. if(nIndex < 0)
  9454. nIndex = 0;
  9455. selectSCHuntZoneEnable.value = storageValue.isHunt[nIndex];
  9456. selectSCHuntBait.value = storageValue.bait[nIndex];
  9457. selectSCHuntTrinket.value = storageValue.trinket[nIndex];
  9458. selectSCUseSmartJet.value = storageValue.useSmartJet;
  9459. selectSCHuntZoneEnable.style.display = (selectSCHuntZone.value == 'ZONE_NOT_DIVE') ? 'none' : '';
  9460. }
  9461.  
  9462. function saveSCCustomAlgo(){
  9463. var selectSCHuntZone = document.getElementById('selectSCHuntZone');
  9464. var selectSCHuntZoneEnable = document.getElementById('selectSCHuntZoneEnable');
  9465. var selectSCHuntBait = document.getElementById('selectSCHuntBait');
  9466. var selectSCHuntTrinket = document.getElementById('selectSCHuntTrinket');
  9467. var selectSCUseSmartJet = document.getElementById('selectSCUseSmartJet');
  9468. var storageValue = window.sessionStorage.getItem('SCCustom');
  9469. if(isNullOrUndefined(storageValue)){
  9470. var objDefaultSCCustom = {
  9471. zone : ['ZONE_NOT_DIVE','ZONE_DEFAULT','ZONE_CORAL','ZONE_SCALE','ZONE_BARNACLE','ZONE_TREASURE','ZONE_DANGER','ZONE_DANGER_PP','ZONE_OXYGEN','ZONE_BONUS','ZONE_DANGER_PP_LOTA'],
  9472. zoneID : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
  9473. isHunt : new Array(11).fill(true),
  9474. bait : new Array(11).fill('Gouda'),
  9475. trinket : new Array(11).fill('None'),
  9476. useSmartJet : false
  9477. };
  9478. storageValue = JSON.stringify(objDefaultSCCustom);
  9479. }
  9480.  
  9481. storageValue = JSON.parse(storageValue);
  9482. var nIndex = storageValue.zone.indexOf(selectSCHuntZone.value);
  9483. if(nIndex < 0)
  9484. nIndex = 0;
  9485. storageValue.isHunt[nIndex] = (selectSCHuntZoneEnable.value === 'true');
  9486. storageValue.bait[nIndex] = selectSCHuntBait.value;
  9487. storageValue.trinket[nIndex] = selectSCHuntTrinket.value;
  9488. storageValue.useSmartJet = (selectSCUseSmartJet.value === 'true');
  9489. window.sessionStorage.setItem('SCCustom', JSON.stringify(storageValue));
  9490. }
  9491.  
  9492. function onSelectLabyrinthDistrict(){
  9493. saveLaby();
  9494. initControlsLaby();
  9495. }
  9496.  
  9497. function onSelectLabyrinthDisarm(){
  9498. var inputLabyrinthLastHunt = document.getElementById('inputLabyrinthLastHunt');
  9499. var selectLabyrinthDisarm = document.getElementById('selectLabyrinthDisarm');
  9500. inputLabyrinthLastHunt.disabled = (selectLabyrinthDisarm.value == 'true') ? '' : 'disabled';
  9501. saveLaby();
  9502. }
  9503.  
  9504. function onInputLabyrinthLastHuntChanged(input){
  9505. input.value = limitMinMax(input.value, input.min, input.max);
  9506. saveLaby();
  9507. }
  9508.  
  9509. function onSelectLabyrinthDisarmCompass(){
  9510. saveLaby();
  9511. initControlsLaby();
  9512. }
  9513.  
  9514. function onInputLabyrinthDECChanged(input){
  9515. input.value = limitMinMax(input.value, input.min, input.max);
  9516. saveLaby();
  9517. }
  9518.  
  9519. function saveLaby(){
  9520. var selectLabyrinthDistrict = document.getElementById('selectLabyrinthDistrict');
  9521. var selectHallway15Plain = document.getElementById('selectHallway15Plain');
  9522. var selectHallway1560Plain = document.getElementById('selectHallway1560Plain');
  9523. var selectHallway1560Superior = document.getElementById('selectHallway1560Superior');
  9524. var selectHallway60Plain = document.getElementById('selectHallway60Plain');
  9525. var selectHallway60Superior = document.getElementById('selectHallway60Superior');
  9526. var selectHallway60Epic = document.getElementById('selectHallway60Epic');
  9527. var selectLabyrinthOtherBase = document.getElementById('selectLabyrinthOtherBase');
  9528. var inputLabyrinthDEC = document.getElementById('inputLabyrinthDEC');
  9529. var selectLabyrinthDisarmCompass = document.getElementById('selectLabyrinthDisarmCompass');
  9530. var selectLabyrinthWeaponType = document.getElementById('selectLabyrinthWeaponType');
  9531. var storageValue = window.sessionStorage.getItem('Labyrinth');
  9532. if(isNullOrUndefined(storageValue)){
  9533. var objDefaultLaby = {
  9534. districtFocus : 'None',
  9535. between0and14 : ['LP'],
  9536. between15and59 : ['SP','LS'],
  9537. between60and100 : ['SP','SS','LE'],
  9538. chooseOtherDoors : false,
  9539. typeOtherDoors : "SHORTEST_ONLY",
  9540. securityDisarm : false,
  9541. lastHunt : 0,
  9542. armOtherBase : 'false',
  9543. disarmCompass : true,
  9544. nDeadEndClue : 0,
  9545. weaponFarming : 'Forgotten'
  9546. };
  9547. storageValue = JSON.stringify(objDefaultLaby);
  9548. }
  9549.  
  9550. storageValue = JSON.parse(storageValue);
  9551. storageValue.districtFocus = selectLabyrinthDistrict.value;
  9552. storageValue.between0and14 = [selectHallway15Plain.value];
  9553. storageValue.between15and59 = [selectHallway1560Plain.value, selectHallway1560Superior.value];
  9554. storageValue.between60and100 = [selectHallway60Plain.value, selectHallway60Superior.value, selectHallway60Epic.value];
  9555. storageValue.chooseOtherDoors = (document.getElementById('chooseOtherDoors').value == 'true');
  9556. storageValue.typeOtherDoors = document.getElementById('typeOtherDoors').value;
  9557. storageValue.securityDisarm = (document.getElementById('selectLabyrinthDisarm').value == 'true');
  9558. storageValue.lastHunt = parseInt(document.getElementById('inputLabyrinthLastHunt').value);
  9559. storageValue.armOtherBase = selectLabyrinthOtherBase.value;
  9560. storageValue.disarmCompass = (selectLabyrinthDisarmCompass.value == 'true');
  9561. storageValue.nDeadEndClue = parseInt(inputLabyrinthDEC.value);
  9562. storageValue.weaponFarming = selectLabyrinthWeaponType.value;
  9563. window.sessionStorage.setItem('Labyrinth', JSON.stringify(storageValue));
  9564. }
  9565.  
  9566. function initControlsLaby(){
  9567. var selectLabyrinthDistrict = document.getElementById('selectLabyrinthDistrict');
  9568. var inputLabyrinthLastHunt = document.getElementById('inputLabyrinthLastHunt');
  9569. var selectLabyrinthDisarm = document.getElementById('selectLabyrinthDisarm');
  9570. var selectHallway15Plain = document.getElementById('selectHallway15Plain');
  9571. var selectHallway1560Plain = document.getElementById('selectHallway1560Plain');
  9572. var selectHallway1560Superior = document.getElementById('selectHallway1560Superior');
  9573. var selectHallway60Plain = document.getElementById('selectHallway60Plain');
  9574. var selectHallway60Superior = document.getElementById('selectHallway60Superior');
  9575. var selectHallway60Epic = document.getElementById('selectHallway60Epic');
  9576. var selectChooseOtherDoors = document.getElementById('chooseOtherDoors');
  9577. var typeOtherDoors = document.getElementById('typeOtherDoors');
  9578. var selectLabyrinthOtherBase = document.getElementById('selectLabyrinthOtherBase');
  9579. var selectLabyrinthDisarmCompass = document.getElementById('selectLabyrinthDisarmCompass');
  9580. var inputLabyrinthDEC = document.getElementById('inputLabyrinthDEC');
  9581. var selectLabyrinthWeaponType = document.getElementById('selectLabyrinthWeaponType');
  9582. var storageValue = window.sessionStorage.getItem('Labyrinth');
  9583. if(isNullOrUndefined(storageValue)){
  9584. selectLabyrinthDistrict.selectedIndex = -1;
  9585. inputLabyrinthLastHunt.value = 2;
  9586. selectLabyrinthDisarm.selectedIndex = -1;
  9587. selectHallway15Plain.selectedIndex = -1;
  9588. selectHallway1560Plain.selectedIndex = -1;
  9589. selectHallway1560Superior.selectedIndex = -1;
  9590. selectHallway60Plain.selectedIndex = -1;
  9591. selectHallway60Superior.selectedIndex = -1;
  9592. selectHallway60Epic.selectedIndex = -1;
  9593. selectChooseOtherDoors.selectedIndex = -1;
  9594. typeOtherDoors.selectedIndex = -1;
  9595. selectLabyrinthOtherBase.selectedIndex = -1;
  9596. selectLabyrinthDisarmCompass.selectedIndex = -1;
  9597. inputLabyrinthDEC.value = 0;
  9598. selectLabyrinthWeaponType.selectedIndex = 0;
  9599. }
  9600. else{
  9601. storageValue = JSON.parse(storageValue);
  9602. selectLabyrinthDistrict.value = storageValue.districtFocus;
  9603. inputLabyrinthLastHunt.value = storageValue.lastHunt;
  9604. selectLabyrinthDisarm.value = (storageValue.securityDisarm) ? 'true' : 'false';
  9605. selectHallway15Plain.value = storageValue.between0and14[0];
  9606. selectHallway1560Plain.value = storageValue.between15and59[0];
  9607. selectHallway1560Superior.value = storageValue.between15and59[1];
  9608. selectHallway60Plain.value = storageValue.between60and100[0];
  9609. selectHallway60Superior.value = storageValue.between60and100[1];
  9610. selectHallway60Epic.value = storageValue.between60and100[2];
  9611. selectChooseOtherDoors.value = (storageValue.chooseOtherDoors) ? 'true' : 'false';
  9612. typeOtherDoors.value = storageValue.typeOtherDoors;
  9613. selectLabyrinthOtherBase.value = storageValue.armOtherBase;
  9614. selectLabyrinthDisarmCompass.value = (storageValue.disarmCompass) ? 'true' : 'false';
  9615. inputLabyrinthDEC.value = storageValue.nDeadEndClue;
  9616. selectLabyrinthWeaponType.value = storageValue.weaponFarming;
  9617. }
  9618. inputLabyrinthLastHunt.disabled = (storageValue.securityDisarm) ? '' : 'disabled';
  9619. document.getElementById('trPriorities15').style.display = (selectLabyrinthDistrict.value == 'None') ? 'none' : 'table-row';
  9620. document.getElementById('trPriorities1560').style.display = (selectLabyrinthDistrict.value == 'None') ? 'none' : 'table-row';
  9621. document.getElementById('trPriorities60').style.display = (selectLabyrinthDistrict.value == 'None') ? 'none' : 'table-row';
  9622. document.getElementById('trLabyrinthOtherHallway').style.display = (selectLabyrinthDistrict.value == 'None') ? 'none' : 'table-row';
  9623. inputLabyrinthDEC.disabled = (storageValue.disarmCompass) ? '' : 'disabled';
  9624. selectHallway60Epic.style = (selectLabyrinthDistrict.value == 'TREASURY' || selectLabyrinthDistrict.value == 'FARMING') ? 'display:none' : 'display:inline';
  9625. document.getElementById('typeOtherDoors').disabled = (storageValue.chooseOtherDoors)? '' : 'disabled';
  9626. }
  9627.  
  9628. function saveLG(){
  9629. var selectLGTGAutoFillSide = document.getElementById('selectLGTGAutoFillSide');
  9630. var selectLGTGAutoFillState = document.getElementById('selectLGTGAutoFillState');
  9631. var selectLGTGAutoPourSide = document.getElementById('selectLGTGAutoPourSide');
  9632. var selectLGTGAutoPourState = document.getElementById('selectLGTGAutoPourState');
  9633. var selectLGTGSide = document.getElementById('selectLGTGSide');
  9634. var selectLGTGBase = document.getElementById('selectLGTGBase');
  9635. var selectLGTGTrinket = document.getElementById('selectLGTGTrinket');
  9636. var selectLGTGBait = document.getElementById('selectLGTGBait');
  9637. var selectLCCCSide = document.getElementById('selectLCCCSide');
  9638. var selectLCCCBase = document.getElementById('selectLCCCBase');
  9639. var selectLCCCTrinket = document.getElementById('selectLCCCTrinket');
  9640. var selectSaltedStatus = document.getElementById('selectSaltedStatus');
  9641. var selectSCBase = document.getElementById('selectSCBase');
  9642. var inputKGSalt = document.getElementById('inputKGSalt');
  9643. var storageValue = window.sessionStorage.getItem('LGArea');
  9644. if(isNullOrUndefined(storageValue)){
  9645. var objLGTemplate = {
  9646. isAutoFill : false,
  9647. isAutoPour : false,
  9648. maxSaltCharged : 25,
  9649. base : {
  9650. before : '',
  9651. after : ''
  9652. },
  9653. trinket : {
  9654. before : '',
  9655. after : ''
  9656. },
  9657. bait : {
  9658. before : '',
  9659. after : ''
  9660. }
  9661. };
  9662. var objAllLG = {
  9663. LG : JSON.parse(JSON.stringify(objLGTemplate)),
  9664. TG : JSON.parse(JSON.stringify(objLGTemplate)),
  9665. LC : JSON.parse(JSON.stringify(objLGTemplate)),
  9666. CC : JSON.parse(JSON.stringify(objLGTemplate)),
  9667. SD : JSON.parse(JSON.stringify(objLGTemplate)),
  9668. SC : JSON.parse(JSON.stringify(objLGTemplate)),
  9669. };
  9670. storageValue = JSON.stringify(objAllLG);
  9671. }
  9672. storageValue = JSON.parse(storageValue);
  9673. storageValue[selectLGTGAutoFillSide.value].isAutoFill = (selectLGTGAutoFillState.value == 'true');
  9674. storageValue[selectLGTGAutoPourSide.value].isAutoPour = (selectLGTGAutoPourState.value == 'true');
  9675. storageValue[selectLGTGSide.value].base.after = selectLGTGBase.value;
  9676. storageValue[selectLGTGSide.value].base.after = selectLGTGBase.value;
  9677. storageValue[selectLGTGSide.value].trinket.after = selectLGTGTrinket.value;
  9678. storageValue[selectLGTGSide.value].bait.after = selectLGTGBait.value;
  9679. storageValue[selectLCCCSide.value].base.after = selectLCCCBase.value;
  9680. storageValue[selectLCCCSide.value].trinket.after = selectLCCCTrinket.value;
  9681. storageValue.SC.base[selectSaltedStatus.value] = selectSCBase.value;
  9682. storageValue.SC.maxSaltCharged = inputKGSalt.value;
  9683. window.sessionStorage.setItem('LGArea', JSON.stringify(storageValue));
  9684. }
  9685.  
  9686. function initControlsLG(bAutoChangeLocation){
  9687. if(isNullOrUndefined(bAutoChangeLocation))
  9688. bAutoChangeLocation = false;
  9689. var selectLGTGAutoFillSide = document.getElementById('selectLGTGAutoFillSide');
  9690. var selectLGTGAutoFillState = document.getElementById('selectLGTGAutoFillState');
  9691. var selectLGTGAutoPourSide = document.getElementById('selectLGTGAutoPourSide');
  9692. var selectLGTGAutoPourState = document.getElementById('selectLGTGAutoPourState');
  9693. var selectLGTGSide = document.getElementById('selectLGTGSide');
  9694. var selectLGTGBase = document.getElementById('selectLGTGBase');
  9695. var selectLGTGTrinket = document.getElementById('selectLGTGTrinket');
  9696. var selectLGTGBait = document.getElementById('selectLGTGBait');
  9697. var selectLCCCSide = document.getElementById('selectLCCCSide');
  9698. var selectLCCCBase = document.getElementById('selectLCCCBase');
  9699. var selectLCCCTrinket = document.getElementById('selectLCCCTrinket');
  9700. var selectSaltedStatus = document.getElementById('selectSaltedStatus');
  9701. var selectSCBase = document.getElementById('selectSCBase');
  9702. var inputKGSalt = document.getElementById('inputKGSalt');
  9703. var storageValue = window.sessionStorage.getItem('LGArea');
  9704. if(isNullOrUndefined(storageValue)){
  9705. selectLGTGAutoFillState.selectedIndex = -1;
  9706. selectLGTGAutoPourState.selectedIndex = -1;
  9707. selectLGTGBase.selectedIndex = -1;
  9708. selectLGTGTrinket.selectedIndex = -1;
  9709. selectLGTGBait.selectedIndex = -1;
  9710. selectLCCCBase.selectedIndex = -1;
  9711. selectLCCCTrinket.selectedIndex = -1;
  9712. selectSCBase.selectedIndex = -1;
  9713. inputKGSalt.value = 25;
  9714. }
  9715. else{
  9716. storageValue = JSON.parse(storageValue);
  9717. if(bAutoChangeLocation && !isNullOrUndefined(user)){
  9718. if(user.environment_name.indexOf('Living Garden') > -1){
  9719. selectLGTGAutoFillSide.value = 'LG';
  9720. selectLGTGAutoPourSide.value = 'LG';
  9721. selectLGTGSide.value = 'LG';
  9722. }
  9723. else if(user.environment_name.indexOf('Twisted Garden') > -1){
  9724. selectLGTGAutoFillSide.value = 'TG';
  9725. selectLGTGAutoPourSide.value = 'TG';
  9726. selectLGTGSide.value = 'TG';
  9727. }
  9728. else if(user.environment_name.indexOf('Lost City') > -1){
  9729. selectLCCCSide.value = 'LC';
  9730. }
  9731. else if(user.environment_name.indexOf('Cursed City') > -1){
  9732. selectLCCCSide.value = 'CC';
  9733. }
  9734. }
  9735. selectLGTGAutoFillState.value = storageValue[selectLGTGAutoFillSide.value].isAutoFill;
  9736. selectLGTGAutoPourState.value = storageValue[selectLGTGAutoPourSide.value].isAutoPour;
  9737. selectLGTGBase.value = storageValue[selectLGTGSide.value].base.after;
  9738. selectLGTGTrinket.value = storageValue[selectLGTGSide.value].trinket.after;
  9739. selectLGTGBait.value = storageValue[selectLGTGSide.value].bait.after;
  9740. selectLCCCBase.value = storageValue[selectLCCCSide.value].base.after;
  9741. selectLCCCTrinket.value = storageValue[selectLCCCSide.value].trinket.after;
  9742. selectSCBase.value = storageValue.SC.base[selectSaltedStatus.value];
  9743. inputKGSalt.value = storageValue.SC.maxSaltCharged;
  9744. }
  9745. }
  9746.  
  9747. function initControlsFW(bAutoChangeWave){
  9748. if(isNullOrUndefined(bAutoChangeWave))
  9749. bAutoChangeWave = false;
  9750. var selectFWWave = document.getElementById('selectFWWave');
  9751. var selectFWTrapSetupWeapon = document.getElementById('selectFWTrapSetupWeapon');
  9752. var selectFWTrapSetupBase = document.getElementById('selectFWTrapSetupBase');
  9753. var selectFWStreak = document.getElementById('selectFWStreak');
  9754. var selectFWFocusType = document.getElementById('selectFWFocusType');
  9755. var selectFWPriorities = document.getElementById('selectFWPriorities');
  9756. var selectFWCheese = document.getElementById('selectFWCheese');
  9757. var selectFWCharmType = document.getElementById('selectFWCharmType');
  9758. var selectFWSpecial = document.getElementById('selectFWSpecial');
  9759. var selectFWLastTypeConfig = document.getElementById('selectFWLastTypeConfig');
  9760. var selectFWLastTypeConfigIncludeArtillery = document.getElementById('selectFWLastTypeConfigIncludeArtillery');
  9761. var selectFWSupportConfig = document.getElementById('selectFWSupportConfig');
  9762. var selectFW4WardenStatus = document.getElementById('selectFW4WardenStatus');
  9763. var selectFW4TrapSetupWeapon = document.getElementById('selectFW4TrapSetupWeapon');
  9764. var selectFW4TrapSetupBase = document.getElementById('selectFW4TrapSetupBase');
  9765. var selectFW4TrapSetupTrinket = document.getElementById('selectFW4TrapSetupTrinket');
  9766. var selectFW4TrapSetupBait = document.getElementById('selectFW4TrapSetupBait');
  9767. var storageValue = window.sessionStorage.getItem('FW');
  9768. if(isNullOrUndefined(storageValue)){
  9769. selectFWTrapSetupWeapon.selectedIndex = -1;
  9770. selectFWTrapSetupBase.selectedIndex = -1;
  9771. selectFW4TrapSetupWeapon.selectedIndex = -1;
  9772. selectFW4TrapSetupBase.selectedIndex = -1;
  9773. selectFW4TrapSetupTrinket.selectedIndex = -1;
  9774. selectFW4TrapSetupBait.selectedIndex = -1;
  9775. selectFWFocusType.selectedIndex = -1;
  9776. selectFWPriorities.selectedIndex = -1;
  9777. selectFWCheese.selectedIndex = -1;
  9778. selectFWCharmType.selectedIndex = -1;
  9779. selectFWSpecial.selectedIndex = -1;
  9780. selectFWLastTypeConfig.selectedIndex = -1;
  9781. selectFWLastTypeConfigIncludeArtillery.selectedIndex = 0;
  9782. selectFWSupportConfig.selectedIndex = 0;
  9783. }
  9784. else{
  9785. storageValue = JSON.parse(storageValue);
  9786. if(bAutoChangeWave && !isNullOrUndefined(user) && user.environment_name.indexOf('Fiery Warpath') > -1){
  9787. if(user.viewing_atts.desert_warpath.wave < 1)
  9788. selectFWWave.value = 1;
  9789. else if(user.viewing_atts.desert_warpath.wave > 4)
  9790. selectFWWave.value = 4;
  9791. else
  9792. selectFWWave.value = user.viewing_atts.desert_warpath.wave;
  9793.  
  9794. var nStreak = parseInt(user.viewing_atts.desert_warpath.streak_quantity);
  9795. if(Number.isInteger(nStreak)){
  9796. if(nStreak !== 0)
  9797. selectFWStreak.value = nStreak+1;
  9798. }
  9799. }
  9800. var strWave = 'wave'+selectFWWave.value;
  9801. if(isNullOrUndefined(storageValue[strWave].weapon))
  9802. storageValue[strWave].weapon = 'Sandtail Sentinel';
  9803. if(isNullOrUndefined(storageValue[strWave].base))
  9804. storageValue[strWave].base = 'Physical Brace Base';
  9805. if(selectFWWave.value == 4){
  9806. selectFW4TrapSetupWeapon.value = storageValue[strWave].warden[selectFW4WardenStatus.value].weapon;
  9807. selectFW4TrapSetupBase.value = storageValue[strWave].warden[selectFW4WardenStatus.value].base;
  9808. selectFW4TrapSetupTrinket.value = storageValue[strWave].warden[selectFW4WardenStatus.value].trinket;
  9809. selectFW4TrapSetupBait.value = storageValue[strWave].warden[selectFW4WardenStatus.value].bait;
  9810. }
  9811. else{
  9812. selectFWTrapSetupWeapon.value = storageValue[strWave].weapon;
  9813. selectFWTrapSetupBase.value = storageValue[strWave].base;
  9814. }
  9815. selectFWFocusType.value = storageValue[strWave].focusType;
  9816. selectFWPriorities.value = storageValue[strWave].priorities;
  9817. selectFWCheese.value = storageValue[strWave].cheese[selectFWStreak.selectedIndex];
  9818. selectFWCharmType.value = storageValue[strWave].charmType[selectFWStreak.selectedIndex];
  9819. selectFWSpecial.value = storageValue[strWave].special[selectFWStreak.selectedIndex];
  9820. selectFWLastTypeConfig.value = storageValue[strWave].lastSoldierConfig;
  9821. selectFWLastTypeConfigIncludeArtillery.value = (storageValue[strWave].includeArtillery) ? 'true' : 'false';
  9822. selectFWSupportConfig.value = (storageValue[strWave].disarmAfterSupportRetreat) ? 'true' : 'false';
  9823. }
  9824. for(var i=0;i<selectFWSpecial.options.length;i++){
  9825. if(selectFWSpecial.options[i].value == 'GARGANTUA_GGC'){
  9826. if(selectFWStreak.selectedIndex >= 7)
  9827. selectFWSpecial.options[i].removeAttribute('disabled');
  9828. else
  9829. selectFWSpecial.options[i].setAttribute('disabled','disabled');
  9830. break;
  9831. }
  9832. }
  9833. var nWave = parseInt(selectFWWave.value);
  9834. var option = selectFWFocusType.children;
  9835. for(var i=0;i<option.length;i++){
  9836. if(option[i].innerText.indexOf('Special') > -1)
  9837. option[i].style = (nWave==1) ? 'display:none' : '';
  9838. }
  9839. if(selectFWWave.value == 4){
  9840. document.getElementById('trFWStreak').style.display = 'none';
  9841. document.getElementById('trFWFocusType').style.display = 'none';
  9842. document.getElementById('trFWLastType').style.display = 'none';
  9843. document.getElementById('trFWSupportConfig').style.display = 'none';
  9844. document.getElementById('trFWTrapSetup').style.display = 'none';
  9845. document.getElementById('trFW4TrapSetup').style.display = 'table-row';
  9846. }
  9847. else{
  9848. document.getElementById('trFWStreak').style.display = 'table-row';
  9849. document.getElementById('trFWFocusType').style.display = 'table-row';
  9850. document.getElementById('trFWLastType').style.display = 'table-row';
  9851. document.getElementById('trFWSupportConfig').style.display = 'table-row';
  9852. document.getElementById('trFWTrapSetup').style.display = 'table-row';
  9853. document.getElementById('trFW4TrapSetup').style.display = 'none';
  9854. if(selectFWWave.value == 3)
  9855. selectFWLastTypeConfigIncludeArtillery.disabled = '';
  9856. else
  9857. selectFWLastTypeConfigIncludeArtillery.disabled = 'disabled';
  9858. }
  9859. }
  9860.  
  9861. function saveFW(){
  9862. var selectFWWave = document.getElementById('selectFWWave');
  9863. var selectFWTrapSetupWeapon = document.getElementById('selectFWTrapSetupWeapon');
  9864. var selectFWTrapSetupBase = document.getElementById('selectFWTrapSetupBase');
  9865. var nWave = selectFWWave.value;
  9866. var selectFWStreak = document.getElementById('selectFWStreak');
  9867. var nStreak = parseInt(selectFWStreak.value);
  9868. var nStreakLength = selectFWStreak.children.length;
  9869. var selectFWFocusType = document.getElementById('selectFWFocusType');
  9870. var selectFWPriorities = document.getElementById('selectFWPriorities');
  9871. var selectFWCheese = document.getElementById('selectFWCheese');
  9872. var selectFWCharmType = document.getElementById('selectFWCharmType');
  9873. var selectFWSpecial = document.getElementById('selectFWSpecial');
  9874. var selectFWLastTypeConfig = document.getElementById('selectFWLastTypeConfig');
  9875. var selectFWLastTypeConfigIncludeArtillery = document.getElementById('selectFWLastTypeConfigIncludeArtillery');
  9876. var selectFWSupportConfig = document.getElementById('selectFWSupportConfig');
  9877. var selectFW4WardenStatus = document.getElementById('selectFW4WardenStatus');
  9878. var selectFW4TrapSetupWeapon = document.getElementById('selectFW4TrapSetupWeapon');
  9879. var selectFW4TrapSetupBase = document.getElementById('selectFW4TrapSetupBase');
  9880. var selectFW4TrapSetupTrinket = document.getElementById('selectFW4TrapSetupTrinket');
  9881. var selectFW4TrapSetupBait = document.getElementById('selectFW4TrapSetupBait');
  9882. var storageValue = window.sessionStorage.getItem('FW');
  9883. if(isNullOrUndefined(storageValue)){
  9884. var obj = {
  9885. weapon : new Array(4),
  9886. base : new Array(4),
  9887. focusType : 'NORMAL',
  9888. priorities : 'HIGHEST',
  9889. cheese : new Array(nStreakLength),
  9890. charmType : new Array(nStreakLength),
  9891. special : new Array(nStreakLength),
  9892. lastSoldierConfig : 'CONFIG_GOUDA',
  9893. includeArtillery : true,
  9894. disarmAfterSupportRetreat : false,
  9895. warden : {
  9896. before : {
  9897. weapon : '',
  9898. base : '',
  9899. trinket : '',
  9900. bait : ''
  9901. },
  9902. after : {
  9903. weapon : '',
  9904. base : '',
  9905. trinket : '',
  9906. bait : ''
  9907. }
  9908. }
  9909. };
  9910. var objAll = {
  9911. wave1 : JSON.parse(JSON.stringify(obj)),
  9912. wave2 : JSON.parse(JSON.stringify(obj)),
  9913. wave3 : JSON.parse(JSON.stringify(obj)),
  9914. wave4 : JSON.parse(JSON.stringify(obj)),
  9915. };
  9916. storageValue = JSON.stringify(objAll);
  9917. }
  9918. storageValue = JSON.parse(storageValue);
  9919. var strWave = 'wave'+selectFWWave.value;
  9920. if(isNullOrUndefined(storageValue[strWave].weapon))
  9921. storageValue[strWave].weapon = 'Sandtail Sentinel';
  9922. if(isNullOrUndefined(storageValue[strWave].base))
  9923. storageValue[strWave].base = 'Physical Brace Base';
  9924. if(nWave == 4){
  9925. storageValue[strWave].warden[selectFW4WardenStatus.value].weapon = selectFW4TrapSetupWeapon.value;
  9926. storageValue[strWave].warden[selectFW4WardenStatus.value].base = selectFW4TrapSetupBase.value;
  9927. storageValue[strWave].warden[selectFW4WardenStatus.value].trinket = selectFW4TrapSetupTrinket.value;
  9928. storageValue[strWave].warden[selectFW4WardenStatus.value].bait = selectFW4TrapSetupBait.value;
  9929. }
  9930. else{
  9931. storageValue[strWave].weapon = selectFWTrapSetupWeapon.value;
  9932. storageValue[strWave].base = selectFWTrapSetupBase.value;
  9933. }
  9934. storageValue[strWave].focusType = selectFWFocusType.value;
  9935. storageValue[strWave].priorities = selectFWPriorities.value;
  9936. storageValue[strWave].cheese[nStreak] = selectFWCheese.value;
  9937. storageValue[strWave].charmType[nStreak] = selectFWCharmType.value;
  9938. storageValue[strWave].special[nStreak] = selectFWSpecial.value;
  9939. storageValue[strWave].lastSoldierConfig = selectFWLastTypeConfig.value;
  9940. storageValue[strWave].includeArtillery = (selectFWLastTypeConfigIncludeArtillery.value == 'true');
  9941. storageValue[strWave].disarmAfterSupportRetreat = (selectFWSupportConfig.value == 'true');
  9942. window.sessionStorage.setItem('FW', JSON.stringify(storageValue));
  9943. }
  9944.  
  9945. function onSelectBRHuntMistTierChanged(){
  9946. var hunt = document.getElementById('selectBRHuntMistTier').value;
  9947. var storageValue = window.sessionStorage.getItem('BRCustom');
  9948. if(isNullOrUndefined(storageValue)){
  9949. var objBR = {
  9950. hunt : '',
  9951. toggle : 1,
  9952. name : ['Red', 'Green', 'Yellow', 'None'],
  9953. weapon : new Array(4),
  9954. base : new Array(4),
  9955. trinket : new Array(4),
  9956. bait : new Array(4)
  9957. };
  9958. storageValue = JSON.stringify(objBR);
  9959. }
  9960. storageValue = JSON.parse(storageValue);
  9961. storageValue.hunt = hunt;
  9962. window.sessionStorage.setItem('BRCustom', JSON.stringify(storageValue));
  9963. initControlsBR();
  9964. }
  9965.  
  9966. function onInputToggleCanisterChanged(input){
  9967. input.value = limitMinMax(input.value, input.min, input.max);
  9968. saveBR();
  9969. }
  9970.  
  9971. function initControlsBR(){
  9972. var hunt = document.getElementById('selectBRHuntMistTier');
  9973. var toggle = document.getElementById('inputToggleCanister');
  9974. var weapon = document.getElementById('selectBRTrapWeapon');
  9975. var base = document.getElementById('selectBRTrapBase');
  9976. var trinket = document.getElementById('selectBRTrapTrinket');
  9977. var bait = document.getElementById('selectBRTrapBait');
  9978. var storageValue = window.sessionStorage.getItem('BRCustom');
  9979. if(isNullOrUndefined(storageValue)){
  9980. toggle.value = 1;
  9981. hunt.selectedIndex = 0;
  9982. weapon.selectedIndex = -1;
  9983. base.selectedIndex = -1;
  9984. trinket.selectedIndex = -1;
  9985. bait.selectedIndex = -1;
  9986. }
  9987. else{
  9988. storageValue = JSON.parse(storageValue);
  9989. hunt.value = storageValue.hunt;
  9990. toggle.value = storageValue.toggle;
  9991. var nIndex = storageValue.name.indexOf(hunt.value);
  9992. weapon.value = storageValue.weapon[nIndex];
  9993. base.value = storageValue.base[nIndex];
  9994. trinket.value = storageValue.trinket[nIndex];
  9995. bait.value = storageValue.bait[nIndex];
  9996. }
  9997. document.getElementById('trBRToggle').style.display = (hunt.value == 'Red')? 'table-row' : 'none';
  9998. }
  9999.  
  10000. function saveBR(){
  10001. var hunt = document.getElementById('selectBRHuntMistTier').value;
  10002. var nToggle = parseInt(document.getElementById('inputToggleCanister').value);
  10003. var weapon = document.getElementById('selectBRTrapWeapon').value;
  10004. var base = document.getElementById('selectBRTrapBase').value;
  10005. var trinket = document.getElementById('selectBRTrapTrinket').value;
  10006. var bait = document.getElementById('selectBRTrapBait').value;
  10007. var storageValue = window.sessionStorage.getItem('BRCustom');
  10008. if(isNullOrUndefined(storageValue)){
  10009. var objBR = {
  10010. hunt : '',
  10011. toggle : 1,
  10012. name : ['Red', 'Green', 'Yellow', 'None'],
  10013. weapon : new Array(4),
  10014. base : new Array(4),
  10015. trinket : new Array(4),
  10016. bait : new Array(4)
  10017. };
  10018. storageValue = JSON.stringify(objBR);
  10019. }
  10020. storageValue = JSON.parse(storageValue);
  10021. var nIndex = storageValue.name.indexOf(hunt);
  10022. if(nIndex < 0)
  10023. nIndex = 0;
  10024. storageValue.hunt = hunt;
  10025. storageValue.toggle = nToggle;
  10026. storageValue.weapon[nIndex] = weapon;
  10027. storageValue.base[nIndex] = base;
  10028. storageValue.trinket[nIndex] = trinket;
  10029. storageValue.bait[nIndex] = bait;
  10030. window.sessionStorage.setItem('BRCustom', JSON.stringify(storageValue));
  10031. }
  10032.  
  10033. function saveSG(){
  10034. var selectSGSeason = document.getElementById('selectSGSeason');
  10035. var selectSGTrapWeapon = document.getElementById('selectSGTrapWeapon');
  10036. var selectSGTrapBase = document.getElementById('selectSGTrapBase');
  10037. var selectSGTrapTrinket = document.getElementById('selectSGTrapTrinket');
  10038. var selectSGTrapBait = document.getElementById('selectSGTrapBait');
  10039. var selectSGDisarmBait = document.getElementById('selectSGDisarmBait');
  10040. var storageValue = window.sessionStorage.getItem('SGarden');
  10041. if(isNullOrUndefined(storageValue)){
  10042. var objSG = {
  10043. weapon : new Array(4).fill(''),
  10044. base : new Array(4).fill(''),
  10045. trinket : new Array(4).fill(''),
  10046. bait : new Array(4).fill(''),
  10047. disarmBaitAfterCharged : false
  10048. };
  10049. storageValue = JSON.stringify(objSG);
  10050. }
  10051. storageValue = JSON.parse(storageValue);
  10052. var nIndex = (selectSGSeason.selectedIndex < 0) ? 0 : selectSGSeason.selectedIndex;
  10053. storageValue.weapon[nIndex] = selectSGTrapWeapon.value;
  10054. storageValue.base[nIndex] = selectSGTrapBase.value;
  10055. storageValue.trinket[nIndex] = selectSGTrapTrinket.value;
  10056. storageValue.bait[nIndex] = selectSGTrapBait.value;
  10057. storageValue.disarmBaitAfterCharged = (selectSGDisarmBait.value == 'true');
  10058. window.sessionStorage.setItem('SGarden', JSON.stringify(storageValue));
  10059. }
  10060.  
  10061. function initControlsSG(bAutoChangeSeason){
  10062. if(isNullOrUndefined(bAutoChangeSeason))
  10063. bAutoChangeSeason = false;
  10064. var selectSGSeason = document.getElementById('selectSGSeason');
  10065. var selectSGTrapWeapon = document.getElementById('selectSGTrapWeapon');
  10066. var selectSGTrapBase = document.getElementById('selectSGTrapBase');
  10067. var selectSGTrapTrinket = document.getElementById('selectSGTrapTrinket');
  10068. var selectSGTrapBait = document.getElementById('selectSGTrapBait');
  10069. var selectSGDisarmBait = document.getElementById('selectSGDisarmBait');
  10070. var storageValue = window.sessionStorage.getItem('SGarden');
  10071. if(isNullOrUndefined(storageValue)){
  10072. selectSGTrapWeapon.selectedIndex = -1;
  10073. selectSGTrapBase.selectedIndex = -1;
  10074. selectSGTrapTrinket.selectedIndex = -1;
  10075. selectSGTrapBait.selectedIndex = -1;
  10076. selectSGDisarmBait.selectedIndex = -1;
  10077. }
  10078. else{
  10079. storageValue = JSON.parse(storageValue);
  10080. if(bAutoChangeSeason && !isNullOrUndefined(user) && user.environment_name.indexOf('Seasonal Garden') > -1){
  10081. var arrSeason = ['Spring', 'Summer', 'Fall', 'Winter'];
  10082. var nTimeStamp = Date.parse(new Date())/1000;
  10083. var nFirstSeasonTimeStamp = 1283328000;
  10084. var nSeasonLength = 288000; // 80hr
  10085. var nSeason = Math.floor((nTimeStamp - nFirstSeasonTimeStamp)/nSeasonLength) % arrSeason.length;
  10086. selectSGSeason.value = arrSeason[nSeason].toUpperCase();
  10087. }
  10088. var nIndex = (selectSGSeason.selectedIndex < 0) ? 0 : selectSGSeason.selectedIndex;
  10089. selectSGTrapWeapon.value = storageValue.weapon[nIndex];
  10090. selectSGTrapBase.value = storageValue.base[nIndex];
  10091. selectSGTrapTrinket.value = storageValue.trinket[nIndex];
  10092. selectSGTrapBait.value = storageValue.bait[nIndex];
  10093. selectSGDisarmBait.value = (storageValue.disarmBaitAfterCharged) ? 'true' : 'false';
  10094. }
  10095. }
  10096.  
  10097. function initControlsZT(bAutoChangeMouseOrder){
  10098. if(isNullOrUndefined(bAutoChangeMouseOrder))
  10099. bAutoChangeMouseOrder = false;
  10100. var selectZTFocus = document.getElementById('selectZTFocus');
  10101. var arrSelectZTMouseOrder = [document.getElementById('selectZTMouseOrder1st'),document.getElementById('selectZTMouseOrder2nd')];
  10102. var arrSelectZTWeapon = [document.getElementById('selectZTWeapon1st'),document.getElementById('selectZTWeapon2nd')];
  10103. var arrSelectZTBase = [document.getElementById('selectZTBase1st'),document.getElementById('selectZTBase2nd')];
  10104. var arrSelectZTTrinket = [document.getElementById('selectZTTrinket1st'),document.getElementById('selectZTTrinket2nd')];
  10105. var arrSelectZTBait = [document.getElementById('selectZTBait1st'),document.getElementById('selectZTBait2nd')];
  10106. var storageValue = window.sessionStorage.getItem('ZTower');
  10107. var i;
  10108. if(isNullOrUndefined(storageValue)){
  10109. for(i=0;i<2;i++){
  10110. arrSelectZTMouseOrder[i].selectedIndex = 0;
  10111. arrSelectZTWeapon[i].selectedIndex = -1;
  10112. arrSelectZTBase[i].selectedIndex = -1;
  10113. arrSelectZTTrinket[i].selectedIndex = -1;
  10114. arrSelectZTBait[i].selectedIndex = -1;
  10115. }
  10116. }
  10117. else{
  10118. storageValue = JSON.parse(storageValue);
  10119. selectZTFocus.value = storageValue.focus.toUpperCase();
  10120. if(bAutoChangeMouseOrder && !isNullOrUndefined(user) && user.environment_name.indexOf('Zugzwang\'s Tower') > -1){
  10121. var nProgressMystic = parseInt(user.viewing_atts.zzt_mage_progress);
  10122. var nProgressTechnic = parseInt(user.viewing_atts.zzt_tech_progress);
  10123. if(Number.isNaN(nProgressMystic) || Number.isNaN(nProgressTechnic)){
  10124. for(i=0;i<2;i++){
  10125. arrSelectZTMouseOrder[i].selectedIndex = 0;
  10126. }
  10127. }
  10128. else{
  10129. var arrProgress = [];
  10130. if(selectZTFocus.value.indexOf('MYSTIC') === 0)
  10131. arrProgress = [nProgressMystic,nProgressTechnic];
  10132. else
  10133. arrProgress = [nProgressTechnic,nProgressMystic];
  10134. for(i=0;i<2;i++){
  10135. if(arrProgress[i] <= 7)
  10136. arrSelectZTMouseOrder[i].value = 'PAWN';
  10137. else if(arrProgress[i] <= 9)
  10138. arrSelectZTMouseOrder[i].value = 'KNIGHT';
  10139. else if(arrProgress[i] <= 11)
  10140. arrSelectZTMouseOrder[i].value = 'BISHOP';
  10141. else if(arrProgress[i] <= 13)
  10142. arrSelectZTMouseOrder[i].value = 'ROOK';
  10143. else if(arrProgress[i] <= 14)
  10144. arrSelectZTMouseOrder[i].value = 'QUEEN';
  10145. else if(arrProgress[i] <= 15)
  10146. arrSelectZTMouseOrder[i].value = 'KING';
  10147. else if(arrProgress[i] <= 16)
  10148. arrSelectZTMouseOrder[i].value = 'CHESSMASTER';
  10149. }
  10150. }
  10151. }
  10152. for(i=0;i<2;i++){
  10153. if(arrSelectZTMouseOrder[i].selectedIndex < 0)
  10154. arrSelectZTMouseOrder[i].selectedIndex = 0;
  10155. }
  10156. var nIndex = -1;
  10157. for(i=0;i<2;i++){
  10158. nIndex = storageValue.order.indexOf(arrSelectZTMouseOrder[i].value);
  10159. if(nIndex < 0)
  10160. nIndex = 0;
  10161. nIndex += i*7;
  10162. arrSelectZTWeapon[i].value = storageValue.weapon[nIndex];
  10163. arrSelectZTBase[i].value = storageValue.base[nIndex];
  10164. arrSelectZTTrinket[i].value = storageValue.trinket[nIndex];
  10165. arrSelectZTBait[i].value = storageValue.bait[nIndex];
  10166. }
  10167. }
  10168. }
  10169.  
  10170. function saveZT(){
  10171. var selectZTFocus = document.getElementById('selectZTFocus');
  10172. var arrSelectZTMouseOrder = [document.getElementById('selectZTMouseOrder1st'),document.getElementById('selectZTMouseOrder2nd')];
  10173. var arrSelectZTWeapon = [document.getElementById('selectZTWeapon1st'),document.getElementById('selectZTWeapon2nd')];
  10174. var arrSelectZTBase = [document.getElementById('selectZTBase1st'),document.getElementById('selectZTBase2nd')];
  10175. var arrSelectZTTrinket = [document.getElementById('selectZTTrinket1st'),document.getElementById('selectZTTrinket2nd')];
  10176. var arrSelectZTBait = [document.getElementById('selectZTBait1st'),document.getElementById('selectZTBait2nd')];
  10177. var storageValue = window.sessionStorage.getItem('ZTower');
  10178. if(isNullOrUndefined(storageValue)){
  10179. var objZT = {
  10180. focus : 'MYSTIC',
  10181. order : ['PAWN', 'KNIGHT', 'BISHOP', 'ROOK', 'QUEEN', 'KING', 'CHESSMASTER'],
  10182. weapon : new Array(14).fill(''),
  10183. base : new Array(14).fill(''),
  10184. trinket : new Array(14).fill('None'),
  10185. bait : new Array(14).fill('Gouda'),
  10186. };
  10187. storageValue = JSON.stringify(objZT);
  10188. }
  10189. storageValue = JSON.parse(storageValue);
  10190. var nIndex = -1;
  10191. for(var i=0;i<2;i++){
  10192. nIndex = storageValue.order.indexOf(arrSelectZTMouseOrder[i].value);
  10193. if(nIndex < 0)
  10194. nIndex = 0;
  10195. nIndex += i*7;
  10196. storageValue.focus = selectZTFocus.value;
  10197. storageValue.weapon[nIndex] = arrSelectZTWeapon[i].value;
  10198. storageValue.base[nIndex] = arrSelectZTBase[i].value;
  10199. storageValue.trinket[nIndex] = arrSelectZTTrinket[i].value;
  10200. storageValue.bait[nIndex] = arrSelectZTBait[i].value;
  10201. }
  10202. window.sessionStorage.setItem('ZTower', JSON.stringify(storageValue));
  10203. }
  10204.  
  10205. function saveZokor(){
  10206. var selectZokorBossStatus = document.getElementById('selectZokorBossStatus');
  10207. var selectZokorBait = document.getElementById('selectZokorBait');
  10208. var selectZokorTrinket = document.getElementById('selectZokorTrinket');
  10209. var storageValue = window.sessionStorage.getItem('Zokor');
  10210. if(isNullOrUndefined(storageValue)){
  10211. var objZokor = {
  10212. bossStatus : ['INCOMING', 'ACTIVE', 'DEFEATED'],
  10213. bait : new Array(3).fill('Gouda'),
  10214. trinket : new Array(3).fill('None')
  10215. };
  10216. storageValue = JSON.stringify(objZokor);
  10217. }
  10218. storageValue = JSON.parse(storageValue);
  10219. var nIndex = storageValue.bossStatus.indexOf(selectZokorBossStatus.value);
  10220. if(nIndex < 0)
  10221. nIndex = 0;
  10222. storageValue.bait[nIndex] = selectZokorBait.value;
  10223. storageValue.trinket[nIndex] = selectZokorTrinket.value;
  10224. window.sessionStorage.setItem('Zokor', JSON.stringify(storageValue));
  10225. }
  10226.  
  10227. function initControlsZokor(){
  10228. var selectZokorBossStatus = document.getElementById('selectZokorBossStatus');
  10229. var selectZokorBait = document.getElementById('selectZokorBait');
  10230. var selectZokorTrinket = document.getElementById('selectZokorTrinket');
  10231. var storageValue = window.sessionStorage.getItem('Zokor');
  10232. if(isNullOrUndefined(storageValue)){
  10233. selectZokorBait.selectedIndex = -1;
  10234. selectZokorTrinket.selectedIndex = -1;
  10235. }
  10236. else{
  10237. storageValue = JSON.parse(storageValue);
  10238. var nIndex = storageValue.bossStatus.indexOf(selectZokorBossStatus.value);
  10239. if(nIndex < 0)
  10240. nIndex = 0;
  10241. selectZokorBait.value = storageValue.bait[nIndex];
  10242. selectZokorTrinket.value = storageValue.trinket[nIndex];
  10243. }
  10244. }
  10245.  
  10246. function onSelectFRTrapBait(){
  10247. saveFR();
  10248. initControlsFR();
  10249. }
  10250.  
  10251. function saveFR(){
  10252. var selectEnterAtBattery = document.getElementById('selectEnterAtBattery');
  10253. var selectRetreatAtBattery = document.getElementById('selectRetreatAtBattery');
  10254. var nIndex = document.getElementById('selectTrapSetupAtBattery').selectedIndex;
  10255. var weapon = document.getElementById('selectFRTrapWeapon').value;
  10256. var base = document.getElementById('selectFRTrapBase').value;
  10257. var trinket = document.getElementById('selectFRTrapTrinket').value;
  10258. var bait = document.getElementById('selectFRTrapBait').value;
  10259. var selectFRTrapBaitMasterOrder = document.getElementById('selectFRTrapBaitMasterOrder');
  10260. var storageValue = window.sessionStorage.getItem('FRift');
  10261. if(isNullOrUndefined(storageValue)){
  10262. var objFR = {
  10263. enter : 0,
  10264. retreat : 0,
  10265. weapon : new Array(11).fill(''),
  10266. base : new Array(11).fill(''),
  10267. trinket : new Array(11).fill(''),
  10268. bait : new Array(11).fill(''),
  10269. masterOrder : new Array(11).fill('Glutter=>Combat=>Susheese')
  10270. };
  10271. storageValue = JSON.stringify(objFR);
  10272. }
  10273. storageValue = JSON.parse(storageValue);
  10274. storageValue.enter = parseInt(selectEnterAtBattery.value);
  10275. storageValue.retreat = parseInt(selectRetreatAtBattery.value);
  10276. storageValue.weapon[nIndex] = weapon;
  10277. storageValue.base[nIndex] = base;
  10278. storageValue.trinket[nIndex] = trinket;
  10279. storageValue.bait[nIndex] = bait;
  10280. storageValue.masterOrder[nIndex] = selectFRTrapBaitMasterOrder.value;
  10281. window.sessionStorage.setItem('FRift', JSON.stringify(storageValue));
  10282. }
  10283.  
  10284. function initControlsFR(bAutoChangeBatteryLevel){
  10285. if(isNullOrUndefined(bAutoChangeBatteryLevel))
  10286. bAutoChangeBatteryLevel = false;
  10287. var selectEnterAtBattery = document.getElementById('selectEnterAtBattery');
  10288. var selectRetreatAtBattery = document.getElementById('selectRetreatAtBattery');
  10289. var selectTrapSetupAtBattery = document.getElementById('selectTrapSetupAtBattery');
  10290. var selectFRTrapWeapon = document.getElementById('selectFRTrapWeapon');
  10291. var selectFRTrapBase = document.getElementById('selectFRTrapBase');
  10292. var selectFRTrapTrinket = document.getElementById('selectFRTrapTrinket');
  10293. var selectFRTrapBait = document.getElementById('selectFRTrapBait');
  10294. var selectFRTrapBaitMasterOrder = document.getElementById('selectFRTrapBaitMasterOrder');
  10295. var storageValue = window.sessionStorage.getItem('FRift');
  10296. if(isNullOrUndefined(storageValue)){
  10297. selectEnterAtBattery.selectedIndex = -1;
  10298. selectRetreatAtBattery.selectedIndex = -1;
  10299. selectFRTrapWeapon.selectedIndex = -1;
  10300. selectFRTrapBase.selectedIndex = -1;
  10301. selectFRTrapTrinket.selectedIndex = -1;
  10302. selectFRTrapBait.selectedIndex = -1;
  10303. selectFRTrapBaitMasterOrder.selectedIndex = 0;
  10304. selectTrapSetupAtBattery.selectedIndex = 0;
  10305. }
  10306. else{
  10307. storageValue = JSON.parse(storageValue);
  10308. var nIndex = 0;
  10309. if(bAutoChangeBatteryLevel && !isNullOrUndefined(user) && user.environment_name.indexOf('Furoma Rift') > -1 && (user.quests.QuestRiftFuroma.view_state == 'pagoda' || user.quests.QuestRiftFuroma.view_state == 'pagoda knows_all')){
  10310. var classCharge = document.getElementsByClassName('riftFuromaHUD-droid-charge');
  10311. if(classCharge.length > 0){
  10312. var nRemainingEnergy = parseInt(classCharge[0].innerText.replace(/,/g, ''));
  10313. if(Number.isInteger(nRemainingEnergy)){
  10314. var arrCumulative = [20,65,140,260,460,770,1220,1835,2625,3600];
  10315. for(var i=arrCumulative.length-1;i>=0;i--){
  10316. if(nRemainingEnergy <= arrCumulative[i])
  10317. nIndex = i+1;
  10318. else
  10319. break;
  10320. }
  10321. selectTrapSetupAtBattery.selectedIndex = nIndex;
  10322. }
  10323. }
  10324. }
  10325. else{
  10326. nIndex = selectTrapSetupAtBattery.selectedIndex;
  10327. }
  10328. selectEnterAtBattery.value = (Number.isInteger(storageValue.enter)) ? storageValue.enter : 'None';
  10329. selectRetreatAtBattery.value = storageValue.retreat;
  10330. selectFRTrapWeapon.value = storageValue.weapon[nIndex];
  10331. selectFRTrapBase.value = storageValue.base[nIndex];
  10332. selectFRTrapTrinket.value = storageValue.trinket[nIndex];
  10333. selectFRTrapBait.value = storageValue.bait[nIndex];
  10334. selectFRTrapBaitMasterOrder.value = storageValue.masterOrder[nIndex];
  10335. }
  10336. selectFRTrapBaitMasterOrder.style.display = (selectFRTrapBait.value == 'ORDER_MASTER') ? '' : 'none';
  10337. }
  10338.  
  10339. function saveIceberg(){
  10340. var selectIcebergPhase = document.getElementById('selectIcebergPhase');
  10341. var selectIcebergBase = document.getElementById('selectIcebergBase');
  10342. var selectIcebergBait = document.getElementById('selectIcebergBait');
  10343. var selectIcebergTrinket = document.getElementById('selectIcebergTrinket');
  10344. var storageValue = window.sessionStorage.getItem('Iceberg');
  10345. var arrOrder = ['GENERAL', 'TREACHEROUS', 'BRUTAL', 'BOMBING', 'MAD', 'ICEWING', 'HIDDEN', 'DEEP', 'SLUSHY'];
  10346. if(isNullOrUndefined(storageValue)){
  10347. var objDefaultIceberg = {
  10348. base : new Array(9).fill(''),
  10349. trinket : new Array(9).fill('None'),
  10350. bait : new Array(9).fill('Gouda')
  10351. };
  10352. storageValue = JSON.stringify(objDefaultIceberg);
  10353. }
  10354. storageValue = JSON.parse(storageValue);
  10355. var nIndex = arrOrder.indexOf(selectIcebergPhase.value);
  10356. if(nIndex < 0)
  10357. nIndex = 0;
  10358. storageValue.base[nIndex] = selectIcebergBase.value;
  10359. storageValue.bait[nIndex] = selectIcebergBait.value;
  10360. storageValue.trinket[nIndex] = selectIcebergTrinket.value;
  10361. window.sessionStorage.setItem('Iceberg', JSON.stringify(storageValue));
  10362. }
  10363.  
  10364. function initControlsIceberg(bAutoChangePhase){
  10365. if(isNullOrUndefined(bAutoChangePhase))
  10366. bAutoChangePhase = false;
  10367. var selectIcebergPhase = document.getElementById('selectIcebergPhase');
  10368. var selectIcebergBase = document.getElementById('selectIcebergBase');
  10369. var selectIcebergBait = document.getElementById('selectIcebergBait');
  10370. var selectIcebergTrinket = document.getElementById('selectIcebergTrinket');
  10371. var storageValue = window.sessionStorage.getItem('Iceberg');
  10372. if(isNullOrUndefined(storageValue)){
  10373. selectIcebergBase.selectedIndex = -1;
  10374. selectIcebergBait.selectedIndex = -1;
  10375. selectIcebergTrinket.selectedIndex = -1;
  10376. }
  10377. else{
  10378. storageValue = JSON.parse(storageValue);
  10379. var nIndex = -1;
  10380. var arrOrder = ['GENERAL', 'TREACHEROUS', 'BRUTAL', 'BOMBING', 'MAD', 'ICEWING', 'HIDDEN', 'DEEP', 'SLUSHY'];
  10381. if(bAutoChangePhase && !isNullOrUndefined(user)){
  10382. if(user.environment_name.indexOf('Iceberg') > -1){
  10383. var classCurrentPhase = document.getElementsByClassName('currentPhase');
  10384. var phase = (classCurrentPhase.length > 0) ? classCurrentPhase[0].textContent : user.quests.QuestIceberg.current_phase;
  10385. var classProgress = document.getElementsByClassName('user_progress');
  10386. var nProgress = (classProgress.length > 0) ? parseInt(classProgress[0].textContent.replace(',', '')) : parseInt(user.quests.QuestIceberg.user_progress);
  10387. if (nProgress == 300 || nProgress == 600 || nProgress == 1600 || nProgress == 1800)
  10388. nIndex = 0;
  10389. else{
  10390. phase = phase.toUpperCase();
  10391. for(var i=1;i<arrOrder.length;i++){
  10392. if(phase.indexOf(arrOrder[i]) > -1){
  10393. selectIcebergPhase.value = arrOrder[i];
  10394. break;
  10395. }
  10396. }
  10397. }
  10398. }
  10399. else if(user.environment_name.indexOf('Slushy Shoreline') > -1)
  10400. selectIcebergPhase.value = 'SLUSHY';
  10401. }
  10402. nIndex = arrOrder.indexOf(selectIcebergPhase.value);
  10403. selectIcebergBase.value = storageValue.base[nIndex];
  10404. selectIcebergTrinket.value = storageValue.trinket[nIndex];
  10405. selectIcebergBait.value = storageValue.bait[nIndex];
  10406. }
  10407. }
  10408.  
  10409. function saveFGAR(){
  10410. var selectFGARSublocation = document.getElementById('selectFGARSublocation');
  10411. var selectFGARWeapon = document.getElementById('selectFGARWeapon');
  10412. var selectFGARBase = document.getElementById('selectFGARBase');
  10413. var selectFGARTrinket = document.getElementById('selectFGARTrinket');
  10414. var selectFGARBait = document.getElementById('selectFGARBait');
  10415. var storageValue = window.sessionStorage.getItem('FG_AR');
  10416. if(isNullOrUndefined(storageValue))
  10417. storageValue = JSON.stringify(objDefaultFGAR);
  10418. storageValue = JSON.parse(storageValue);
  10419. var nIndex = storageValue.order.indexOf(selectFGARSublocation.value);
  10420. storageValue.weapon[nIndex] = selectFGARWeapon.value;
  10421. storageValue.base[nIndex] = selectFGARBase.value;
  10422. storageValue.trinket[nIndex] = selectFGARTrinket.value;
  10423. storageValue.bait[nIndex] = selectFGARBait.value;
  10424. window.sessionStorage.setItem('FG_AR', JSON.stringify(storageValue));
  10425. }
  10426.  
  10427. function initControlsFGAR(bAutoChangeSublocation){
  10428. if(isNullOrUndefined(bAutoChangeSublocation))
  10429. bAutoChangeSublocation = false;
  10430. var selectFGARSublocation = document.getElementById('selectFGARSublocation');
  10431. var selectFGARWeapon = document.getElementById('selectFGARWeapon');
  10432. var selectFGARBase = document.getElementById('selectFGARBase');
  10433. var selectFGARTrinket = document.getElementById('selectFGARTrinket');
  10434. var selectFGARBait = document.getElementById('selectFGARBait');
  10435. var storageValue = window.sessionStorage.getItem('FG_AR');
  10436. if(isNullOrUndefined(storageValue))
  10437. storageValue = JSON.stringify(objDefaultFGAR);
  10438. storageValue = JSON.parse(storageValue);
  10439. var nIndex = -1;
  10440. if(bAutoChangeSublocation && !isNullOrUndefined(user))
  10441. selectFGARSublocation.value = (user.environment_name.indexOf('Acolyte Realm') > -1) ? 'AR' : 'FG';
  10442. nIndex = storageValue.order.indexOf(selectFGARSublocation.value);
  10443. selectFGARWeapon.value = storageValue.weapon[nIndex];
  10444. selectFGARBase.value = storageValue.base[nIndex];
  10445. selectFGARTrinket.value = storageValue.trinket[nIndex];
  10446. selectFGARBait.value = storageValue.bait[nIndex];
  10447. }
  10448.  
  10449. function saveBCJOD(){
  10450. var selectBCJODSublocation = document.getElementById('selectBCJODSublocation');
  10451. var selectBCJODWeapon = document.getElementById('selectBCJODWeapon');
  10452. var selectBCJODBase = document.getElementById('selectBCJODBase');
  10453. var selectBCJODTrinket = document.getElementById('selectBCJODTrinket');
  10454. var selectBCJODBait = document.getElementById('selectBCJODBait');
  10455. var storageValue = window.sessionStorage.getItem('BC_JOD');
  10456. if(isNullOrUndefined(storageValue))
  10457. storageValue = JSON.stringify(objDefaultBCJOD);
  10458. storageValue = JSON.parse(storageValue);
  10459. var nIndex = storageValue.order.indexOf(selectBCJODSublocation.value);
  10460. storageValue.weapon[nIndex] = selectBCJODWeapon.value;
  10461. storageValue.base[nIndex] = selectBCJODBase.value;
  10462. storageValue.trinket[nIndex] = selectBCJODTrinket.value;
  10463. storageValue.bait[nIndex] = selectBCJODBait.value;
  10464. window.sessionStorage.setItem('BC_JOD', JSON.stringify(storageValue));
  10465. }
  10466.  
  10467. function initControlsBCJOD(bAutoChangeSublocation){
  10468. if(isNullOrUndefined(bAutoChangeSublocation))
  10469. bAutoChangeSublocation = false;
  10470. var selectBCJODSublocation = document.getElementById('selectBCJODSublocation');
  10471. var selectBCJODWeapon = document.getElementById('selectBCJODWeapon');
  10472. var selectBCJODBase = document.getElementById('selectBCJODBase');
  10473. var selectBCJODTrinket = document.getElementById('selectBCJODTrinket');
  10474. var selectBCJODBait = document.getElementById('selectBCJODBait');
  10475. var storageValue = window.sessionStorage.getItem('BC_JOD');
  10476. if(isNullOrUndefined(storageValue))
  10477. storageValue = JSON.stringify(objDefaultBCJOD);
  10478. storageValue = JSON.parse(storageValue);
  10479. var nIndex = -1;
  10480. if(bAutoChangeSublocation && !isNullOrUndefined(user))
  10481. selectBCJODSublocation.value = (user.environment_name.indexOf('Balack\'s Cove') > -1) ? 'LOW' : 'JOD';
  10482. nIndex = storageValue.order.indexOf(selectBCJODSublocation.value);
  10483. selectBCJODWeapon.value = storageValue.weapon[nIndex];
  10484. selectBCJODBase.value = storageValue.base[nIndex];
  10485. selectBCJODTrinket.value = storageValue.trinket[nIndex];
  10486. selectBCJODBait.value = storageValue.bait[nIndex];
  10487. }
  10488.  
  10489. function onSelectBWRiftForceActiveQuantum(){
  10490. saveBWRift();
  10491. initControlsBWRift();
  10492. }
  10493.  
  10494. function onSelectBWRiftForceDeactiveQuantum(){
  10495. saveBWRift();
  10496. initControlsBWRift();
  10497. }
  10498.  
  10499. function onInputRemaininigLootAChanged(input){
  10500. input.value = limitMinMax(input.value, input.min, input.max);
  10501. saveBWRift();
  10502. }
  10503.  
  10504. function onInputRemaininigLootDChanged(input){
  10505. input.value = limitMinMax(input.value, input.min, input.max);
  10506. saveBWRift();
  10507. }
  10508.  
  10509. function onSelectBWRiftChoosePortal(){
  10510. saveBWRift();
  10511. initControlsBWRift();
  10512. }
  10513.  
  10514. function onInputMinTimeSandChanged(input){
  10515. input.value = limitMinMax(input.value, input.min, input.max);
  10516. saveBWRift();
  10517. }
  10518.  
  10519. function onSelectBWRiftMinRSCType(){
  10520. saveBWRift();
  10521. initControlsBWRift();
  10522. }
  10523.  
  10524. function onInputMinRSCChanged(input){
  10525. input.value = limitMinMax(input.value, input.min, input.max);
  10526. saveBWRift();
  10527. }
  10528.  
  10529. function saveBWRift(){
  10530. var selectBWRiftChamber = document.getElementById('selectBWRiftChamber');
  10531. var selectBWRiftWeapon = document.getElementById('selectBWRiftWeapon');
  10532. var selectBWRiftBase = document.getElementById('selectBWRiftBase');
  10533. var selectBWRiftBait = document.getElementById('selectBWRiftBait');
  10534. var selectBWRiftTrinket = document.getElementById('selectBWRiftTrinket');
  10535. var selectBWRiftActivatePocketWatch = document.getElementById('selectBWRiftActivatePocketWatch');
  10536. var selectBWRiftCleaverStatus = document.getElementById('selectBWRiftCleaverStatus');
  10537. var selectBWRiftAlertLvl = document.getElementById('selectBWRiftAlertLvl');
  10538. var selectBWRiftWeaponSpecial = document.getElementById('selectBWRiftWeaponSpecial');
  10539. var selectBWRiftBaseSpecial = document.getElementById('selectBWRiftBaseSpecial');
  10540. var selectBWRiftBaitSpecial = document.getElementById('selectBWRiftBaitSpecial');
  10541. var selectBWRiftTrinketSpecial = document.getElementById('selectBWRiftTrinketSpecial');
  10542. var selectBWRiftActivatePocketWatchSpecial = document.getElementById('selectBWRiftActivatePocketWatchSpecial');
  10543. var selectBWRiftForceActiveQuantum = document.getElementById('selectBWRiftForceActiveQuantum');
  10544. var inputRemainingLootA = document.getElementById('inputRemainingLootA');
  10545. var selectBWRiftForceDeactiveQuantum = document.getElementById('selectBWRiftForceDeactiveQuantum');
  10546. var inputRemainingLootD = document.getElementById('inputRemainingLootD');
  10547. var selectBWRiftChoosePortal = document.getElementById('selectBWRiftChoosePortal');
  10548. var selectBWRiftChoosePortalAfterCC = document.getElementById('selectBWRiftChoosePortalAfterCC');
  10549. var selectBWRiftPriority = document.getElementById('selectBWRiftPriority');
  10550. var selectBWRiftPriorityCursed = document.getElementById('selectBWRiftPriorityCursed');
  10551. var selectBWRiftPortal = document.getElementById('selectBWRiftPortal');
  10552. var selectBWRiftBuffCurse = document.getElementById('selectBWRiftBuffCurse');
  10553. var inputMinTimeSand = document.getElementById('inputMinTimeSand');
  10554. var selectBWRiftMinRSCType = document.getElementById('selectBWRiftMinRSCType');
  10555. var inputMinRSC = document.getElementById('inputMinRSC');
  10556. var selectBWRiftEnterWCurse = document.getElementById('selectBWRiftEnterWCurse');
  10557. var storageValue = window.sessionStorage.getItem('BWRift');
  10558. if(isNullOrUndefined(storageValue))
  10559. storageValue = JSON.stringify(objDefaultBWRift);
  10560. storageValue = JSON.parse(storageValue);
  10561. var nIndexCursed = selectBWRiftChamber.value.indexOf('_CURSED');
  10562. var bCursed = (nIndexCursed > -1);
  10563. var strChamberName = (bCursed) ? selectBWRiftChamber.value.substr(0,nIndexCursed) : selectBWRiftChamber.value;
  10564. var nIndex = storageValue.order.indexOf(strChamberName);
  10565. if(nIndex < 0)
  10566. nIndex = 0;
  10567. if(bCursed)
  10568. nIndex += 16;
  10569. storageValue.master.weapon[nIndex] = selectBWRiftWeapon.value;
  10570. storageValue.master.base[nIndex] = selectBWRiftBase.value;
  10571. storageValue.master.bait[nIndex] = selectBWRiftBait.value;
  10572. storageValue.master.trinket[nIndex] = selectBWRiftTrinket.value;
  10573. storageValue.master.activate[nIndex] = (selectBWRiftActivatePocketWatch.value == 'true');
  10574. storageValue.specialActivate.forceActivate[nIndex] = (selectBWRiftForceActiveQuantum.value == 'true');
  10575. storageValue.specialActivate.remainingLootActivate[nIndex] = parseInt(inputRemainingLootA.value);
  10576. storageValue.specialActivate.forceDeactivate[nIndex] = (selectBWRiftForceDeactiveQuantum.value == 'true');
  10577. storageValue.specialActivate.remainingLootDeactivate[nIndex] = parseInt(inputRemainingLootD.value);
  10578. var strTemp = '';
  10579. if(strChamberName == 'GEARWORKS' || strChamberName == 'ANCIENT' || strChamberName == 'RUNIC'){
  10580. nIndex = selectBWRiftCleaverStatus.selectedIndex;
  10581. if(bCursed)
  10582. nIndex += 2;
  10583. if(strChamberName == 'GEARWORKS')
  10584. strTemp = 'gw';
  10585. else if(strChamberName == 'ANCIENT')
  10586. strTemp = 'al';
  10587. else
  10588. strTemp = 'rl';
  10589. }
  10590. else if(strChamberName == 'GUARD'){
  10591. nIndex = selectBWRiftAlertLvl.selectedIndex;
  10592. if(bCursed)
  10593. nIndex += 7;
  10594. strTemp = 'gb';
  10595. }
  10596. /*else if(strChamberName == 'INGRESS'){
  10597. nIndex = selectBWRiftFTC.selectedIndex;
  10598. if(bCursed)
  10599. nIndex += 4;
  10600. strTemp = 'ic';
  10601. }
  10602. else if(strChamberName == 'FROZEN'){
  10603. nIndex = selectBWRiftHunt.selectedIndex;
  10604. if(bCursed)
  10605. nIndex += 16;
  10606. strTemp = 'fa';
  10607. }*/
  10608. else
  10609. strTemp = 'master';
  10610. if(strTemp !== 'master'){
  10611. storageValue[strTemp].weapon[nIndex] = selectBWRiftWeaponSpecial.value;
  10612. storageValue[strTemp].base[nIndex] = selectBWRiftBaseSpecial.value;
  10613. storageValue[strTemp].bait[nIndex] = selectBWRiftBaitSpecial.value;
  10614. storageValue[strTemp].trinket[nIndex] = selectBWRiftTrinketSpecial.value;
  10615. if(selectBWRiftActivatePocketWatchSpecial.value == 'MASTER')
  10616. storageValue[strTemp].activate[nIndex] = selectBWRiftActivatePocketWatchSpecial.value;
  10617. else
  10618. storageValue[strTemp].activate[nIndex] = (selectBWRiftActivatePocketWatchSpecial.value == 'true');
  10619. }
  10620. storageValue.minRSCType = selectBWRiftMinRSCType.value;
  10621. storageValue.minRSC = parseInt(inputMinRSC.value);
  10622. storageValue.choosePortal = (selectBWRiftChoosePortal.value == 'true');
  10623. if(storageValue.choosePortal){
  10624. storageValue.choosePortalAfterCC = (selectBWRiftChoosePortalAfterCC.value == 'true');
  10625. storageValue.priorities[selectBWRiftPriority.selectedIndex] = selectBWRiftPortal.value;
  10626. storageValue.prioritiesCursed[selectBWRiftPriorityCursed.selectedIndex] = selectBWRiftPortalCursed.value;
  10627. nIndex = parseInt(selectBWRiftBuffCurse.value);
  10628. storageValue.minTimeSand[nIndex] = parseInt(inputMinTimeSand.value);
  10629. storageValue.enterMinigameWCurse = (selectBWRiftEnterWCurse.value == 'true');
  10630. }
  10631. window.sessionStorage.setItem('BWRift', JSON.stringify(storageValue));
  10632. }
  10633.  
  10634. function initControlsBWRift(bAutoChangeChamber){
  10635. if(isNullOrUndefined(bAutoChangeChamber))
  10636. bAutoChangeChamber = false;
  10637. var selectBWRiftChamber = document.getElementById('selectBWRiftChamber');
  10638. var selectBWRiftWeapon = document.getElementById('selectBWRiftWeapon');
  10639. var selectBWRiftBase = document.getElementById('selectBWRiftBase');
  10640. var selectBWRiftBait = document.getElementById('selectBWRiftBait');
  10641. var selectBWRiftTrinket = document.getElementById('selectBWRiftTrinket');
  10642. var selectBWRiftActivatePocketWatch = document.getElementById('selectBWRiftActivatePocketWatch');
  10643. var selectBWRiftCleaverStatus = document.getElementById('selectBWRiftCleaverStatus');
  10644. var selectBWRiftAlertLvl = document.getElementById('selectBWRiftAlertLvl');
  10645. var selectBWRiftWeaponSpecial = document.getElementById('selectBWRiftWeaponSpecial');
  10646. var selectBWRiftBaseSpecial = document.getElementById('selectBWRiftBaseSpecial');
  10647. var selectBWRiftBaitSpecial = document.getElementById('selectBWRiftBaitSpecial');
  10648. var selectBWRiftTrinketSpecial = document.getElementById('selectBWRiftTrinketSpecial');
  10649. var selectBWRiftActivatePocketWatchSpecial = document.getElementById('selectBWRiftActivatePocketWatchSpecial');
  10650. var selectBWRiftForceActiveQuantum = document.getElementById('selectBWRiftForceActiveQuantum');
  10651. var inputRemainingLootA = document.getElementById('inputRemainingLootA');
  10652. var selectBWRiftForceDeactiveQuantum = document.getElementById('selectBWRiftForceDeactiveQuantum');
  10653. var inputRemainingLootD = document.getElementById('inputRemainingLootD');
  10654. var selectBWRiftChoosePortal = document.getElementById('selectBWRiftChoosePortal');
  10655. var selectBWRiftChoosePortalAfterCC = document.getElementById('selectBWRiftChoosePortalAfterCC');
  10656. var selectBWRiftPriority = document.getElementById('selectBWRiftPriority');
  10657. var selectBWRiftPriorityCursed = document.getElementById('selectBWRiftPriorityCursed');
  10658. var selectBWRiftPortal = document.getElementById('selectBWRiftPortal');
  10659. var selectBWRiftBuffCurse = document.getElementById('selectBWRiftBuffCurse');
  10660. var inputMinTimeSand = document.getElementById('inputMinTimeSand');
  10661. var selectBWRiftMinRSCType = document.getElementById('selectBWRiftMinRSCType');
  10662. var inputMinRSC = document.getElementById('inputMinRSC');
  10663. var selectBWRiftEnterWCurse = document.getElementById('selectBWRiftEnterWCurse');
  10664. var storageValue = window.sessionStorage.getItem('BWRift');
  10665. if(isNullOrUndefined(storageValue))
  10666. storageValue = JSON.stringify(objDefaultBWRift);
  10667. storageValue = JSON.parse(storageValue);
  10668. var nIndex = -1;
  10669. var bCursed = false;
  10670. if(bAutoChangeChamber && !isNullOrUndefined(user) && user.environment_name.indexOf('Bristle Woods Rift') > -1){
  10671. if(!(user.quests.QuestRiftBristleWoods.status_effects.un.indexOf('default') > -1 || user.quests.QuestRiftBristleWoods.status_effects.un.indexOf('remove') > -1) ||
  10672. !(user.quests.QuestRiftBristleWoods.status_effects.fr.indexOf('default') > -1 || user.quests.QuestRiftBristleWoods.status_effects.fr.indexOf('remove') > -1) ||
  10673. !(user.quests.QuestRiftBristleWoods.status_effects.st.indexOf('default') > -1 || user.quests.QuestRiftBristleWoods.status_effects.st.indexOf('remove') > -1))
  10674. bCursed = true;
  10675. var nRemaining = user.quests.QuestRiftBristleWoods.progress_remaining;
  10676. if(nRemaining > 0){
  10677. var strName = user.quests.QuestRiftBristleWoods.chamber_name.split(' ')[0].toUpperCase();
  10678. if(strName == 'ACOLYTE'){
  10679. if(user.quests.QuestRiftBristleWoods.minigame.acolyte_chamber.obelisk_charge < 100)
  10680. nIndex = storageValue.order.indexOf('ACOLYTE_CHARGING');
  10681. else if(user.quests.QuestRiftBristleWoods.minigame.acolyte_chamber.acolyte_sand > 0)
  10682. nIndex = storageValue.order.indexOf('ACOLYTE_DRAINING');
  10683. else
  10684. nIndex = storageValue.order.indexOf('ACOLYTE_DRAINED');
  10685. }
  10686. else
  10687. nIndex = storageValue.order.indexOf(strName);
  10688. if(nIndex > -1)
  10689. selectBWRiftChamber.value = storageValue.order[nIndex];
  10690. }
  10691. else
  10692. selectBWRiftChamber.value = 'NONE';
  10693. if(bCursed)
  10694. selectBWRiftChamber.value += '_CURSED';
  10695. }
  10696. var nIndexCursed = selectBWRiftChamber.value.indexOf('_CURSED');
  10697. bCursed = (nIndexCursed > -1);
  10698. var strChamberName = (bCursed) ? selectBWRiftChamber.value.substr(0,nIndexCursed) : selectBWRiftChamber.value;
  10699. nIndex = storageValue.order.indexOf(strChamberName);
  10700. if(nIndex < 0)
  10701. nIndex = 0;
  10702. if(bCursed)
  10703. nIndex += 16;
  10704. selectBWRiftWeapon.value = storageValue.master.weapon[nIndex];
  10705. selectBWRiftBase.value = storageValue.master.base[nIndex];
  10706. selectBWRiftTrinket.value = storageValue.master.trinket[nIndex];
  10707. selectBWRiftBait.value = storageValue.master.bait[nIndex];
  10708. selectBWRiftActivatePocketWatch.value = (storageValue.master.activate[nIndex] === true) ? 'true' : 'false';
  10709. selectBWRiftForceActiveQuantum.value = (storageValue.specialActivate.forceActivate[nIndex] === true) ? 'true' : 'false';
  10710. inputRemainingLootA.value = storageValue.specialActivate.remainingLootActivate[nIndex];
  10711. inputRemainingLootA.disabled = (selectBWRiftForceActiveQuantum.value == 'true') ? '' : 'disabled';
  10712. selectBWRiftForceDeactiveQuantum.value = (storageValue.specialActivate.forceDeactivate[nIndex] === true) ? 'true' : 'false';
  10713. inputRemainingLootD.value = storageValue.specialActivate.remainingLootDeactivate[nIndex];
  10714. inputRemainingLootD.disabled = (selectBWRiftForceDeactiveQuantum.value == 'true') ? '' : 'disabled';
  10715. var strTemp = '';
  10716. if(strChamberName == 'GEARWORKS' || strChamberName == 'ANCIENT' || strChamberName == 'RUNIC'){
  10717. nIndex = selectBWRiftCleaverStatus.selectedIndex;
  10718. if(bCursed)
  10719. nIndex += 2;
  10720. if(strChamberName == 'GEARWORKS')
  10721. strTemp = 'gw';
  10722. else if(strChamberName == 'ANCIENT')
  10723. strTemp = 'al';
  10724. else
  10725. strTemp = 'rl';
  10726. selectBWRiftCleaverStatus.style.display = '';
  10727. selectBWRiftAlertLvl.style.display = 'none';
  10728. selectBWRiftFTC.style.display = 'none';
  10729. selectBWRiftHunt.style.display = 'none';
  10730. }
  10731. else if(strChamberName == 'GUARD'){
  10732. nIndex = selectBWRiftAlertLvl.selectedIndex;
  10733. if(bCursed)
  10734. nIndex += 7;
  10735. strTemp = 'gb';
  10736. selectBWRiftCleaverStatus.style.display = 'none';
  10737. selectBWRiftAlertLvl.style.display = '';
  10738. selectBWRiftFTC.style.display = 'none';
  10739. selectBWRiftHunt.style.display = 'none';
  10740. }
  10741. /*else if(strChamberName == 'INGRESS'){
  10742. nIndex = selectBWRiftFTC.selectedIndex;
  10743. if(bCursed)
  10744. nIndex += 4;
  10745. strTemp = 'ic';
  10746. selectBWRiftAlertLvl.style.display = 'none';
  10747. selectBWRiftFTC.style.display = '';
  10748. selectBWRiftHunt.style.display = 'none';
  10749. }
  10750. else if(strChamberName == 'FROZEN'){
  10751. nIndex = selectBWRiftHunt.selectedIndex;
  10752. if(bCursed)
  10753. nIndex += 16;
  10754. strTemp = 'fa';
  10755. selectBWRiftAlertLvl.style.display = 'none';
  10756. selectBWRiftFTC.style.display = 'none';
  10757. selectBWRiftHunt.style.display = '';
  10758. }*/
  10759. else{
  10760. strTemp = 'master';
  10761. selectBWRiftAlertLvl.style.display = 'none';
  10762. selectBWRiftFTC.style.display = 'none';
  10763. selectBWRiftHunt.style.display = 'none';
  10764. }
  10765. if(strTemp == 'master')
  10766. document.getElementById('trBWRiftTrapSetupSpecial').style.display = 'none';
  10767. else{
  10768. selectBWRiftWeaponSpecial.value = storageValue[strTemp].weapon[nIndex];
  10769. selectBWRiftBaseSpecial.value = storageValue[strTemp].base[nIndex];
  10770. selectBWRiftTrinketSpecial.value = storageValue[strTemp].trinket[nIndex];
  10771. selectBWRiftBaitSpecial.value = storageValue[strTemp].bait[nIndex];
  10772. if(storageValue[strTemp].activate[nIndex] == 'MASTER')
  10773. selectBWRiftActivatePocketWatchSpecial.value = storageValue[strTemp].activate[nIndex];
  10774. else
  10775. selectBWRiftActivatePocketWatchSpecial.value = (storageValue[strTemp].activate[nIndex] === true) ? 'true' : 'false';
  10776. document.getElementById('trBWRiftTrapSetupSpecial').style.display = '';
  10777. }
  10778. selectBWRiftChoosePortal.value = (storageValue.choosePortal === true) ? 'true' : 'false';
  10779. selectBWRiftChoosePortalAfterCC.value = (storageValue.choosePortalAfterCC === true) ? 'true' : 'false';
  10780. selectBWRiftPortal.value = storageValue.priorities[selectBWRiftPriority.selectedIndex];
  10781. selectBWRiftPortalCursed.value = storageValue.prioritiesCursed[selectBWRiftPriorityCursed.selectedIndex];
  10782. nIndex = parseInt(selectBWRiftBuffCurse.value);
  10783. inputMinTimeSand.value = storageValue.minTimeSand[nIndex];
  10784. selectBWRiftMinRSCType.value = storageValue.minRSCType;
  10785. inputMinRSC.value = storageValue.minRSC;
  10786. selectBWRiftEnterWCurse.value = (storageValue.enterMinigameWCurse === true) ? 'true' : 'false';
  10787. if(selectBWRiftChoosePortal.value == 'true'){
  10788. document.getElementById('trBWRiftChoosePortalAfterCC').style.display = '';
  10789. document.getElementById('trBWRiftPortalPriority').style.display = '';
  10790. document.getElementById('trBWRiftPortalPriorityCursed').style.display = '';
  10791. document.getElementById('trBWRiftMinTimeSand').style.display = '';
  10792. document.getElementById('trBWRiftEnterMinigame').style.display = '';
  10793. document.getElementById('trBWRiftMinRSC').style.display = '';
  10794. }
  10795. else{
  10796. document.getElementById('trBWRiftChoosePortalAfterCC').style.display = 'none';
  10797. document.getElementById('trBWRiftPortalPriority').style.display = 'none';
  10798. document.getElementById('trBWRiftPortalPriorityCursed').style.display = 'none';
  10799. document.getElementById('trBWRiftMinTimeSand').style.display = 'none';
  10800. document.getElementById('trBWRiftEnterMinigame').style.display = 'none';
  10801. document.getElementById('trBWRiftMinRSC').style.display = 'none';
  10802. }
  10803. inputMinRSC.style.display = (selectBWRiftMinRSCType.value == 'NUMBER') ? '' : 'none';
  10804. }
  10805.  
  10806. function saveFRox(){
  10807. var selectFRoxStage = document.getElementById('selectFRoxStage');
  10808. var selectFRoxWeapon = document.getElementById('selectFRoxWeapon');
  10809. var selectFRoxBase = document.getElementById('selectFRoxBase');
  10810. var selectFRoxBait = document.getElementById('selectFRoxBait');
  10811. var selectFRoxTrinket = document.getElementById('selectFRoxTrinket');
  10812. var selectFRoxActivateTower = document.getElementById('selectFRoxActivateTower');
  10813. var selectFRoxFullHPDeactivate = document.getElementById('selectFRoxFullHPDeactivate');
  10814. var storageValue = window.sessionStorage.getItem('FRox');
  10815. if(isNullOrUndefined(storageValue)){
  10816. var objDefaultFRox = {
  10817. stage : ['DAY','stage_one','stage_two','stage_three','stage_four','stage_five','DAWN'],
  10818. order : ['DAY','TWILIGHT','MIDNIGHT','PITCH','UTTER','FIRST','DAWN'],
  10819. weapon : new Array(7).fill(''),
  10820. base : new Array(7).fill(''),
  10821. trinket : new Array(7).fill('None'),
  10822. bait : new Array(7).fill('Gouda'),
  10823. activate : new Array(7).fill(false),
  10824. fullHPDeactivate : true
  10825. };
  10826. storageValue = JSON.stringify(objDefaultFRox);
  10827. }
  10828. storageValue = JSON.parse(storageValue);
  10829. var nIndex = storageValue.order.indexOf(selectFRoxStage.value);
  10830. if(nIndex < 0)
  10831. nIndex = 0;
  10832. storageValue.weapon[nIndex] = selectFRoxWeapon.value;
  10833. storageValue.base[nIndex] = selectFRoxBase.value;
  10834. storageValue.bait[nIndex] = selectFRoxBait.value;
  10835. storageValue.trinket[nIndex] = selectFRoxTrinket.value;
  10836. storageValue.activate[nIndex] = (selectFRoxActivateTower.value == 'true');
  10837. storageValue.fullHPDeactivate = (selectFRoxFullHPDeactivate.value == 'true');
  10838. window.sessionStorage.setItem('FRox', JSON.stringify(storageValue));
  10839. }
  10840.  
  10841. function initControlsFRox(bAutoChangeStage){
  10842. if(isNullOrUndefined(bAutoChangeStage))
  10843. bAutoChangeStage = false;
  10844. var selectFRoxStage = document.getElementById('selectFRoxStage');
  10845. var selectFRoxWeapon = document.getElementById('selectFRoxWeapon');
  10846. var selectFRoxBase = document.getElementById('selectFRoxBase');
  10847. var selectFRoxBait = document.getElementById('selectFRoxBait');
  10848. var selectFRoxTrinket = document.getElementById('selectFRoxTrinket');
  10849. var selectFRoxActivateTower = document.getElementById('selectFRoxActivateTower');
  10850. var selectFRoxFullHPDeactivate = document.getElementById('selectFRoxFullHPDeactivate');
  10851. var storageValue = window.sessionStorage.getItem('FRox');
  10852. if(isNullOrUndefined(storageValue)){
  10853. selectFRoxWeapon.selectedIndex = -1;
  10854. selectFRoxBase.selectedIndex = -1;
  10855. selectFRoxBait.selectedIndex = -1;
  10856. selectFRoxTrinket.selectedIndex = -1;
  10857. selectFRoxActivateTower.selectedIndex = -1;
  10858. selectFRoxFullHPDeactivate.selectedIndex = -1;
  10859. }
  10860. else{
  10861. storageValue = JSON.parse(storageValue);
  10862. var nIndex = -1;
  10863. if(bAutoChangeStage && !isNullOrUndefined(user) && user.environment_name.indexOf('Fort Rox') > -1){
  10864. if(user.quests.QuestFortRox.is_dawn === true)
  10865. selectFRoxStage.value = 'DAWN';
  10866. else if(user.quests.QuestFortRox.current_phase == 'night'){
  10867. nIndex = storageValue.stage.indexOf(user.quests.QuestFortRox.current_stage);
  10868. if(nIndex > -1)
  10869. selectFRoxStage.value = storageValue.order[nIndex];
  10870. }
  10871. else if(user.quests.QuestFortRox.current_phase == 'day'){
  10872. selectFRoxStage.value = 'DAY';
  10873. }
  10874. }
  10875. nIndex = storageValue.order.indexOf(selectFRoxStage.value);
  10876. if(nIndex < 0)
  10877. nIndex = 0;
  10878. selectFRoxWeapon.value = storageValue.weapon[nIndex];
  10879. selectFRoxBase.value = storageValue.base[nIndex];
  10880. selectFRoxTrinket.value = storageValue.trinket[nIndex];
  10881. selectFRoxBait.value = storageValue.bait[nIndex];
  10882. selectFRoxActivateTower.value = (storageValue.activate[nIndex] === true) ? 'true' : 'false';
  10883. selectFRoxFullHPDeactivate.value = (storageValue.fullHPDeactivate === true) ? 'true' : 'false';
  10884. }
  10885. }
  10886.  
  10887. function onSelectWWRiftFaction(){
  10888. onInputMinRageChanged(document.getElementById('inputMinRage'));
  10889. }
  10890.  
  10891. function onInputMinRageChanged(input){
  10892. var selectWWRiftFaction = document.getElementById('selectWWRiftFaction');
  10893. var nMin = (selectWWRiftFaction.value == 'MBW_45_48') ? 45 : input.min;
  10894. var nMax = (selectWWRiftFaction.value == 'MBW_40_44') ? 44 : input.max;
  10895. input.value = limitMinMax(input.value, nMin, nMax);
  10896. saveWWRift();
  10897. initControlsWWRift();
  10898. }
  10899.  
  10900. function saveWWRift(){
  10901. var selectWWRiftFaction = document.getElementById('selectWWRiftFaction');
  10902. var selectWWRiftFactionNext = document.getElementById('selectWWRiftFactionNext');
  10903. var selectWWRiftRage = document.getElementById('selectWWRiftRage');
  10904. var selectWWRiftTrapWeapon = document.getElementById('selectWWRiftTrapWeapon');
  10905. var selectWWRiftTrapBase = document.getElementById('selectWWRiftTrapBase');
  10906. var selectWWRiftTrapTrinket = document.getElementById('selectWWRiftTrapTrinket');
  10907. var selectWWRiftTrapBait = document.getElementById('selectWWRiftTrapBait');
  10908. var selectWWRiftMBWBar4044 = document.getElementById('selectWWRiftMBWBar4044');
  10909. var selectWWRiftMBWBar4548 = document.getElementById('selectWWRiftMBWBar4548');
  10910. var selectWWRiftMBWTrapWeapon = document.getElementById('selectWWRiftMBWTrapWeapon');
  10911. var selectWWRiftMBWTrapBase = document.getElementById('selectWWRiftMBWTrapBase');
  10912. var selectWWRiftMBWTrapTrinket = document.getElementById('selectWWRiftMBWTrapTrinket');
  10913. var selectWWRiftMBWTrapBait = document.getElementById('selectWWRiftMBWTrapBait');
  10914. var inputMinRage = document.getElementById('inputMinRage');
  10915. var storageValue = window.sessionStorage.getItem('WWRift');
  10916. if(isNullOrUndefined(storageValue)){
  10917. var objDefaultWWRift = {
  10918. factionFocus : "CC",
  10919. factionFocusNext : "Remain",
  10920. faction : {
  10921. weapon : new Array(3).fill(''),
  10922. base : new Array(3).fill(''),
  10923. trinket : new Array(3).fill('None'),
  10924. bait : new Array(3).fill('None')
  10925. },
  10926. MBW : {
  10927. minRageLLC : 40,
  10928. rage4044: {
  10929. weapon : new Array(7).fill(''),
  10930. base : new Array(7).fill(''),
  10931. trinket : new Array(7).fill('None'),
  10932. bait : new Array(7).fill('None')
  10933. },
  10934. rage4548: {
  10935. weapon : new Array(8).fill(''),
  10936. base : new Array(8).fill(''),
  10937. trinket : new Array(8).fill('None'),
  10938. bait : new Array(8).fill('None')
  10939. },
  10940. },
  10941. };
  10942. storageValue = JSON.stringify(objDefaultWWRift);
  10943. }
  10944. storageValue = JSON.parse(storageValue);
  10945. storageValue.factionFocus = selectWWRiftFaction.value;
  10946. storageValue.factionFocusNext = selectWWRiftFactionNext.value;
  10947. var nIndex = selectWWRiftRage.selectedIndex;
  10948. if(nIndex < 0)
  10949. nIndex = 0;
  10950. storageValue.faction.weapon[nIndex] = selectWWRiftTrapWeapon.value;
  10951. storageValue.faction.base[nIndex] = selectWWRiftTrapBase.value;
  10952. storageValue.faction.trinket[nIndex] = selectWWRiftTrapTrinket.value;
  10953. storageValue.faction.bait[nIndex] = selectWWRiftTrapBait.value;
  10954. storageValue.MBW.minRageLLC = parseInt(inputMinRage.value);
  10955. if(selectWWRiftFaction.value == 'MBW_40_44'){
  10956. nIndex = selectWWRiftMBWBar4044.selectedIndex;
  10957. if(nIndex < 0)
  10958. nIndex = 0;
  10959. storageValue.MBW.rage4044.weapon[nIndex] = selectWWRiftMBWTrapWeapon.value;
  10960. storageValue.MBW.rage4044.base[nIndex] = selectWWRiftMBWTrapBase.value;
  10961. storageValue.MBW.rage4044.trinket[nIndex] = selectWWRiftMBWTrapTrinket.value;
  10962. storageValue.MBW.rage4044.bait[nIndex] = selectWWRiftMBWTrapBait.value;
  10963. }
  10964. else if(selectWWRiftFaction.value == 'MBW_45_48'){
  10965. nIndex = selectWWRiftMBWBar4548.selectedIndex;
  10966. if(nIndex < 0)
  10967. nIndex = 0;
  10968. storageValue.MBW.rage4548.weapon[nIndex] = selectWWRiftMBWTrapWeapon.value;
  10969. storageValue.MBW.rage4548.base[nIndex] = selectWWRiftMBWTrapBase.value;
  10970. storageValue.MBW.rage4548.trinket[nIndex] = selectWWRiftMBWTrapTrinket.value;
  10971. storageValue.MBW.rage4548.bait[nIndex] = selectWWRiftMBWTrapBait.value;
  10972. }
  10973. window.sessionStorage.setItem('WWRift', JSON.stringify(storageValue));
  10974. }
  10975.  
  10976. function initControlsWWRift(bAutoChangeRageLevel){
  10977. if(isNullOrUndefined(bAutoChangeRageLevel))
  10978. bAutoChangeRageLevel = false;
  10979. var selectWWRiftFaction = document.getElementById('selectWWRiftFaction');
  10980. var selectWWRiftFactionNext = document.getElementById('selectWWRiftFactionNext');
  10981. var selectWWRiftRage = document.getElementById('selectWWRiftRage');
  10982. var selectWWRiftTrapWeapon = document.getElementById('selectWWRiftTrapWeapon');
  10983. var selectWWRiftTrapBase = document.getElementById('selectWWRiftTrapBase');
  10984. var selectWWRiftTrapTrinket = document.getElementById('selectWWRiftTrapTrinket');
  10985. var selectWWRiftTrapBait = document.getElementById('selectWWRiftTrapBait');
  10986. var selectWWRiftMBWBar4044 = document.getElementById('selectWWRiftMBWBar4044');
  10987. var selectWWRiftMBWBar4548 = document.getElementById('selectWWRiftMBWBar4548');
  10988. var selectWWRiftMBWTrapWeapon = document.getElementById('selectWWRiftMBWTrapWeapon');
  10989. var selectWWRiftMBWTrapBase = document.getElementById('selectWWRiftMBWTrapBase');
  10990. var selectWWRiftMBWTrapTrinket = document.getElementById('selectWWRiftMBWTrapTrinket');
  10991. var selectWWRiftMBWTrapBait = document.getElementById('selectWWRiftMBWTrapBait');
  10992. var inputMinRage = document.getElementById('inputMinRage');
  10993. var storageValue = window.sessionStorage.getItem('WWRift');
  10994. if(isNullOrUndefined(storageValue)){
  10995. selectWWRiftFaction.selectedIndex = -1;
  10996. selectWWRiftFactionNext.selectedIndex = 0;
  10997. selectWWRiftRage.selectedIndex = 0;
  10998. selectWWRiftTrapWeapon.selectedIndex = -1;
  10999. selectWWRiftTrapBase.selectedIndex = -1;
  11000. selectWWRiftTrapTrinket.selectedIndex = -1;
  11001. selectWWRiftTrapBait.selectedIndex = -1;
  11002. inputMinRage.value = 40;
  11003. selectWWRiftMBWBar4044.selectedIndex = 0;
  11004. selectWWRiftMBWBar4548.selectedIndex = 0;
  11005. selectWWRiftMBWTrapWeapon.selectedIndex = -1;
  11006. selectWWRiftMBWTrapBase.selectedIndex = -1;
  11007. selectWWRiftMBWTrapTrinket.selectedIndex = -1;
  11008. selectWWRiftMBWTrapBait.selectedIndex = -1;
  11009. }
  11010. else{
  11011. storageValue = JSON.parse(storageValue);
  11012. selectWWRiftFaction.value = storageValue.factionFocus;
  11013. selectWWRiftFactionNext.value = storageValue.factionFocusNext;
  11014. if(bAutoChangeRageLevel && !isNullOrUndefined(user) && user.environment_name.indexOf('Whisker Woods Rift') > -1){
  11015. var arrOrder = ['CC', 'GGT', 'DL'];
  11016. var arrRage = new Array(3);
  11017. var classRage = document.getElementsByClassName('riftWhiskerWoodsHUD-zone-rageLevel');
  11018. for(var i=0;i<classRage.length;i++)
  11019. arrRage[i] = parseInt(classRage[i].textContent);
  11020. var temp = arrOrder.indexOf(storageValue.factionFocus);
  11021. if(temp != -1 && Number.isInteger(arrRage[temp]))
  11022. selectWWRiftRage.selectedIndex = Math.floor(arrRage[temp]/25);
  11023. }
  11024. var nIndex = (selectWWRiftRage.selectedIndex < 0) ? 0 : selectWWRiftRage.selectedIndex;
  11025. selectWWRiftTrapWeapon.value = storageValue.faction.weapon[nIndex];
  11026. selectWWRiftTrapBase.value = storageValue.faction.base[nIndex];
  11027. selectWWRiftTrapTrinket.value = storageValue.faction.trinket[nIndex];
  11028. selectWWRiftTrapBait.value = storageValue.faction.bait[nIndex];
  11029. inputMinRage.value = storageValue.MBW.minRageLLC;
  11030. var temp = '';
  11031. if(selectWWRiftFaction.value == 'MBW_40_44'){
  11032. nIndex = (selectWWRiftMBWBar4044.selectedIndex < 0) ? 0 : selectWWRiftMBWBar4044.selectedIndex;
  11033. temp = 'rage4044';
  11034. }
  11035. else if(selectWWRiftFaction.value == 'MBW_45_48'){
  11036. nIndex = (selectWWRiftMBWBar4548.selectedIndex < 0) ? 0 : selectWWRiftMBWBar4548.selectedIndex;
  11037. temp = 'rage4548';
  11038. }
  11039. if(temp !== ''){
  11040. selectWWRiftMBWTrapWeapon.value = storageValue.MBW[temp].weapon[nIndex];
  11041. selectWWRiftMBWTrapBase.value = storageValue.MBW[temp].base[nIndex];
  11042. selectWWRiftMBWTrapTrinket.value = storageValue.MBW[temp].trinket[nIndex];
  11043. selectWWRiftMBWTrapBait.value = storageValue.MBW[temp].bait[nIndex];
  11044. }
  11045. }
  11046. if(selectWWRiftFaction.value.indexOf('MBW') > -1){
  11047. selectWWRiftMBWBar4044.style.display = (selectWWRiftFaction.value == 'MBW_40_44') ? '' : 'none';
  11048. selectWWRiftMBWBar4548.style.display = (selectWWRiftFaction.value == 'MBW_40_44') ? 'none' : '';
  11049. document.getElementById('trWWRiftFactionFocusNext').style.display = 'none';
  11050. document.getElementById('trWWRiftMBWMinRage').style.display = 'table-row';
  11051. document.getElementById('trWWRiftMBWTrapSetup').style.display = 'table-row';
  11052. document.getElementById('trWWRiftTrapSetup').style.display = 'none';
  11053. }
  11054. else{
  11055. document.getElementById('trWWRiftFactionFocusNext').style.display = 'table-row';
  11056. document.getElementById('trWWRiftMBWMinRage').style.display = 'none';
  11057. document.getElementById('trWWRiftMBWTrapSetup').style.display = 'none';
  11058. document.getElementById('trWWRiftTrapSetup').style.display = 'table-row';
  11059. }
  11060. }
  11061.  
  11062. function onSelectGESSDLoadCrate(){
  11063. saveGES();
  11064. initControlsGES();
  11065. }
  11066.  
  11067. function onSelectGESRRRepellent(){
  11068. saveGES();
  11069. initControlsGES();
  11070. }
  11071.  
  11072. function onSelectGESDCStokeEngine(){
  11073. saveGES();
  11074. initControlsGES();
  11075. }
  11076.  
  11077. function saveGES(){
  11078. var selectGESStage = document.getElementById('selectGESStage');
  11079. var selectGESTrapWeapon = document.getElementById('selectGESTrapWeapon');
  11080. var selectGESTrapBase = document.getElementById('selectGESTrapBase');
  11081. var selectGESSDTrapTrinket = document.getElementById('selectGESSDTrapTrinket');
  11082. var selectGESRRTrapTrinket = document.getElementById('selectGESRRTrapTrinket');
  11083. var selectGESDCTrapTrinket = document.getElementById('selectGESDCTrapTrinket');
  11084. var selectGESTrapBait = document.getElementById('selectGESTrapBait');
  11085. var selectGESSDLoadCrate = document.getElementById('selectGESSDLoadCrate');
  11086. var inputMinCrate = document.getElementById('inputMinCrate');
  11087. var selectGESRRRepellent = document.getElementById('selectGESRRRepellent');
  11088. var inputMinRepellent = document.getElementById('inputMinRepellent');
  11089. var selectGESDCStokeEngine = document.getElementById('selectGESDCStokeEngine');
  11090. var inputMinFuelNugget = document.getElementById('inputMinFuelNugget');
  11091. var storageValue = window.sessionStorage.getItem('GES');
  11092. if(isNullOrUndefined(storageValue)){
  11093. var objDefaultGES = {
  11094. bLoadCrate : false,
  11095. nMinCrate : 11,
  11096. bUseRepellent : false,
  11097. nMinRepellent : 11,
  11098. bStokeEngine : false,
  11099. nMinFuelNugget : 20,
  11100. SD_BEFORE : {
  11101. weapon : '',
  11102. base : '',
  11103. trinket : '',
  11104. bait : ''
  11105. },
  11106. SD_AFTER : {
  11107. weapon : '',
  11108. base : '',
  11109. trinket : '',
  11110. bait : ''
  11111. },
  11112. RR : {
  11113. weapon : '',
  11114. base : '',
  11115. trinket : '',
  11116. bait : ''
  11117. },
  11118. DC : {
  11119. weapon : '',
  11120. base : '',
  11121. trinket : '',
  11122. bait : ''
  11123. },
  11124. WAITING : {
  11125. weapon : '',
  11126. base : '',
  11127. trinket : '',
  11128. bait : ''
  11129. }
  11130. };
  11131. storageValue = JSON.stringify(objDefaultGES);
  11132. }
  11133. storageValue = JSON.parse(storageValue);
  11134. var strStage = selectGESStage.value;
  11135. storageValue[strStage].weapon = selectGESTrapWeapon.value;
  11136. storageValue[strStage].base = selectGESTrapBase.value;
  11137. storageValue[strStage].bait = selectGESTrapBait.value;
  11138. if (strStage == 'RR')
  11139. storageValue[strStage].trinket = selectGESRRTrapTrinket.value;
  11140. else if (strStage == 'DC')
  11141. storageValue[strStage].trinket = selectGESDCTrapTrinket.value;
  11142. else
  11143. storageValue[strStage].trinket = selectGESTrapTrinket.value;
  11144. storageValue.bLoadCrate = (selectGESSDLoadCrate.value == 'true');
  11145. storageValue.nMinCrate = parseInt(inputMinCrate.value);
  11146. storageValue.bUseRepellent = (selectGESRRRepellent.value == 'true');
  11147. storageValue.nMinRepellent = parseInt(inputMinRepellent.value);
  11148. storageValue.bStokeEngine = (selectGESDCStokeEngine.value == 'true');
  11149. storageValue.nMinFuelNugget = parseInt(inputMinFuelNugget.value);
  11150. window.sessionStorage.setItem('GES', JSON.stringify(storageValue));
  11151. }
  11152.  
  11153. function initControlsGES(bAutoChangePhase){
  11154. if(isNullOrUndefined(bAutoChangePhase))
  11155. bAutoChangePhase = false;
  11156. var selectGESStage = document.getElementById('selectGESStage');
  11157. var selectGESTrapWeapon = document.getElementById('selectGESTrapWeapon');
  11158. var selectGESTrapBase = document.getElementById('selectGESTrapBase');
  11159. var selectGESTrapTrinket = document.getElementById('selectGESTrapTrinket');
  11160. var selectGESRRTrapTrinket = document.getElementById('selectGESRRTrapTrinket');
  11161. var selectGESDCTrapTrinket = document.getElementById('selectGESDCTrapTrinket');
  11162. var selectGESTrapBait = document.getElementById('selectGESTrapBait');
  11163. var selectGESSDLoadCrate = document.getElementById('selectGESSDLoadCrate');
  11164. var inputMinCrate = document.getElementById('inputMinCrate');
  11165. var selectGESRRRepellent = document.getElementById('selectGESRRRepellent');
  11166. var inputMinRepellent = document.getElementById('inputMinRepellent');
  11167. var selectGESDCStokeEngine = document.getElementById('selectGESDCStokeEngine');
  11168. var inputMinFuelNugget = document.getElementById('inputMinFuelNugget');
  11169. var storageValue = window.sessionStorage.getItem('GES');
  11170. if(bAutoChangePhase && !isNullOrUndefined(user) && user.environment_name.indexOf('Gnawnian Express Station') > -1){
  11171. if(user.quests.QuestTrainStation.on_train){
  11172. var strCurrentPhase = '';
  11173. var classPhase = document.getElementsByClassName('box phaseName');
  11174. if(classPhase.length > 0 && classPhase[0].children.length > 1)
  11175. strCurrentPhase = classPhase[0].children[1].textContent;
  11176. if(strCurrentPhase == 'Supply Depot'){
  11177. selectGESStage.value = 'SD';
  11178. var nTurn = parseInt(document.getElementsByClassName('supplyHoarderTab')[0].textContent.substr(0, 1));
  11179. selectGESStage.value = (nTurn <= 0) ? 'SD_BEFORE' : 'SD_AFTER';
  11180. }
  11181. else if(strCurrentPhase == 'Raider River')
  11182. selectGESStage.value = 'RR';
  11183. else if(strCurrentPhase == 'Daredevil Canyon')
  11184. selectGESStage.value = 'DC';
  11185. }
  11186. else
  11187. selectGESStage.value = 'WAITING';
  11188. }
  11189. var strStage = selectGESStage.value;
  11190. if(isNullOrUndefined(storageValue)){
  11191. selectGESTrapWeapon.selectedIndex = -1;
  11192. selectGESTrapBase.selectedIndex = -1;
  11193. selectGESTrapTrinket.selectedIndex = -1;
  11194. selectGESRRTrapTrinket.selectedIndex = -1;
  11195. selectGESDCTrapTrinket.selectedIndex = -1;
  11196. selectGESTrapBait.selectedIndex = -1;
  11197. selectGESSDLoadCrate.selectedIndex = 0;
  11198. inputMinCrate.value = 11;
  11199. selectGESRRRepellent.selectedIndex = 0;
  11200. inputMinRepellent.value = 11;
  11201. selectGESDCStokeEngine.selectedIndex = 0;
  11202. inputMinFuelNugget.value = 20;
  11203. }
  11204. else{
  11205. storageValue = JSON.parse(storageValue);
  11206. selectGESTrapWeapon.value = storageValue[strStage].weapon;
  11207. selectGESTrapBase.value = storageValue[strStage].base;
  11208. selectGESTrapBait.value = storageValue[strStage].bait;
  11209. if(strStage == 'RR')
  11210. selectGESRRTrapTrinket.value = storageValue.RR.trinket;
  11211. else if(strStage == 'DC')
  11212. selectGESDCTrapTrinket.value = storageValue.DC.trinket;
  11213. else
  11214. selectGESTrapTrinket.value = storageValue[strStage].trinket;
  11215. selectGESSDLoadCrate.value = (storageValue.bLoadCrate === true) ? 'true' : 'false';
  11216. inputMinCrate.value = storageValue.nMinCrate;
  11217. selectGESRRRepellent.value = (storageValue.bUseRepellent === true) ? 'true' : 'false';
  11218. inputMinRepellent.value = storageValue.nMinRepellent;
  11219. selectGESDCStokeEngine.value = (storageValue.bStokeEngine === true) ? 'true' : 'false';
  11220. inputMinFuelNugget.value = storageValue.nMinFuelNugget;
  11221. }
  11222. if(strStage == 'RR'){
  11223. selectGESTrapTrinket.style.display = 'none';
  11224. selectGESRRTrapTrinket.style.display = '';
  11225. selectGESDCTrapTrinket.style.display = 'none';
  11226. }
  11227. else if(strStage == 'DC'){
  11228. selectGESTrapTrinket.style.display = 'none';
  11229. selectGESRRTrapTrinket.style.display = 'none';
  11230. selectGESDCTrapTrinket.style.display = '';
  11231. }
  11232. else{
  11233. selectGESTrapTrinket.style.display = '';
  11234. selectGESRRTrapTrinket.style.display = 'none';
  11235. selectGESDCTrapTrinket.style.display = 'none';
  11236. }
  11237. inputMinCrate.disabled = (selectGESSDLoadCrate.value == 'true') ? '' : 'disabled';
  11238. inputMinRepellent.disabled = (selectGESRRRepellent.value == 'true') ? '' : 'disabled';
  11239. inputMinFuelNugget.disabled = (selectGESDCStokeEngine.value == 'true') ? '' : 'disabled';
  11240. }
  11241.  
  11242. function showOrHideTr(algo){
  11243. var objTableRow = {
  11244. 'All LG Area' : {
  11245. arr : ['trLGTGAutoFill','trLGTGAutoPour','trPourTrapSetup','trCurseLiftedTrapSetup','trSaltedTrapSetup'],
  11246. init : function(data){initControlsLG(data);}
  11247. },
  11248. 'Sunken City Custom' : {
  11249. arr : ['trSCCustom','trSCCustomUseSmartJet'],
  11250. init : function(data){initControlsSCCustom(data);}
  11251. },
  11252. 'Labyrinth' : {
  11253. arr : ['trLabyrinth','trPriorities15','trPriorities1560','trPriorities60','trLabyrinthOtherHallway','trLabyrinthDisarm','trLabyrinthArmOtherBase', 'trLabyrinthDisarmCompass','trLabyrinthWeaponFarming'],
  11254. init : function(data){initControlsLaby(data);}
  11255. },
  11256. 'Fiery Warpath' : {
  11257. arr : ['trFWWave','trFWTrapSetup','trFW4TrapSetup','trFWStreak','trFWFocusType','trFWLastType','trFWSupportConfig'],
  11258. init : function(data){initControlsFW(data);}
  11259. },
  11260. 'Burroughs Rift Custom' : {
  11261. arr : ['trBRConfig','trBRToggle','trBRTrapSetup'],
  11262. init : function(data){initControlsBR(data);}
  11263. },
  11264. 'SG' : {
  11265. arr : ['trSGTrapSetup','trSGDisarmBait'],
  11266. init : function(data){initControlsSG(data);}
  11267. },
  11268. 'Zokor' : {
  11269. arr : ['trZokorTrapSetup'],
  11270. init : function(data){initControlsZokor(data);}
  11271. },
  11272. 'Furoma Rift' : {
  11273. arr : ['trFREnterBattery','trFRRetreatBattery','trFRTrapSetupAtBattery'],
  11274. init : function(data){initControlsFR(data);}
  11275. },
  11276. 'ZT' : {
  11277. arr : ['trZTFocus','trZTTrapSetup1st','trZTTrapSetup2nd'],
  11278. init : function(data){initControlsZT(data);}
  11279. },
  11280. 'Iceberg' : {
  11281. arr : ['trIceberg'],
  11282. init : function(data){initControlsIceberg(data);}
  11283. },
  11284. 'WWRift' : {
  11285. arr : ['trWWRiftFactionFocus', 'trWWRiftFactionFocusNext', 'trWWRiftTrapSetup', 'trWWRiftMBWTrapSetup', 'trWWRiftMBWMinRage'],
  11286. init : function(data){initControlsWWRift(data);}
  11287. },
  11288. 'GES' : {
  11289. arr : ['trGESTrapSetup', 'trGESSDLoadCrate', 'trGESRRRepellent', 'trGESDCStokeEngine'],
  11290. init : function(data){initControlsGES(data);}
  11291. },
  11292. 'Fort Rox' : {
  11293. arr : ['trFRoxTrapSetup', 'trFRoxDeactiveTower'],
  11294. init : function(data){initControlsFRox(data);}
  11295. },
  11296. 'GWH2016R' : {
  11297. arr : ['trGWHTrapSetup','trGWHTurboBoost','trGWHFlying','trGWHFlyingFirework','trGWHFlyingLand'],
  11298. init : function(data){initControlsGWH2016(data);}
  11299. },
  11300. 'Bristle Woods Rift' : {
  11301. arr : ['trBWRiftSubLocation','trBWRiftMasterTrapSetup','trBWRiftAutoChoosePortal','trBWRiftPortalPriority','trBWRiftPortalPriorityCursed','trBWRiftMinTimeSand','trBWRiftMinRSC','trBWRiftDeactivatePocketWatch','trBWRiftChoosePortalAfterCC','trBWRiftTrapSetupSpecial','trBWRiftEnterMinigame','trBWRiftActivatePocketWatch'],
  11302. init : function(data){initControlsBWRift(data);}
  11303. },
  11304. 'BC/JOD' : {
  11305. arr : ['trBCJODSubLocation', 'trBCJODTrapSetup'],
  11306. init : function(data){initControlsBCJOD(data);}
  11307. },
  11308. 'FG/AR' : {
  11309. arr : ['trFGARSubLocation', 'trFGARTrapSetup'],
  11310. init : function(data){initControlsFGAR(data);}
  11311. },
  11312. };
  11313. var i, temp;
  11314. for(var prop in objTableRow){
  11315. if(objTableRow.hasOwnProperty(prop)){
  11316. temp = (prop == algo) ? 'table-row' : 'none';
  11317. for(i=0;i<objTableRow[prop].arr.length;i++)
  11318. document.getElementById(objTableRow[prop].arr[i]).style.display = temp;
  11319. }
  11320. }
  11321. if(!isNullOrUndefined(objTableRow[algo]))
  11322. objTableRow[algo].init(true);
  11323.  
  11324. initControlsMapHunting();
  11325. initControlsSpecialFeature();
  11326. }
  11327. }
  11328. // ################################################################################################
  11329. // HTML Function - End
  11330. // #################################################################################################